diff --git a/DDExamples/AlignDet/compact/compact.xml b/DDExamples/AlignDet/compact/compact.xml
index 8765829147427b42acff3d12d2461473254cfc44..3ce33c5f7b0c070d3959db5f72aa3def9fe7d526 100644
--- a/DDExamples/AlignDet/compact/compact.xml
+++ b/DDExamples/AlignDet/compact/compact.xml
@@ -65,17 +65,47 @@
<books number="10" x="10*cm" y="15*cm" z="3*cm" dz="0.2*cm" vis="B2_vis"/>
</detector>
- </detectors>
-
- <alignments>
- <alignment name="/world_volume_1/S1_0/ensemble_0/book_7" shortcut="Book0.7">
- <position x="0" y="3*cm" z="0"/>
- <rotation x="0" y="0" z="10*degree"/>
- </alignment>
- <alignment name="/world_volume_1/S1_0/ensemble_1/book_2" shortcut="Book0.7">
- <position x="0" y="0" z="0"/>
- <rotation x="10*degree" y="0" z="0"/>
- </alignment>
- </alignments>
-
+ <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="B1_vis" alpha="1.0" r="1" g="0" b="0" showDaughters="true" visible="true"/>
+ <vis name="B2_vis" alpha="1.0" r="0" g="1" b="0" showDaughters="true" visible="true"/>
+ </display>
+
+ <detectors>
+ <comment>Boxes</comment>
+ <detector id="1" name="B1" type="BoxSegment" vis="B1_vis">
+ <comment>Horizontal box</comment>
+ <material name="Steel235"/>
+ <box x="20" y="0.1" z="5"/>
+ <position x="20" y="10" z="10"/>
+ <rotation x="1" y="0" z="0"/>
+ </detector>
+ <detector id="2" name="B2" type="BoxSegment" vis="B2_vis">
+ <comment>Vertical box</comment>
+ <material name="Steel235"/>
+ <box x="0.1" y="20" z="5"/>
+ <position x="0" y="30" z="10"/>
+ <rotation x="0" y="0" z="0"/>
+ </detector>
+ </detectors>
+
+
+ <alignments>
+ <alignment name="/world_volume_1/B1_vol_0" shortcut="Box1">
+<!--
+ <position x="0" y="0" z="0"/>
+ <position x="20" y="10" z="10"/>
+-->
+ <position x="-20" y="-10" z="-5"/>
+ <rotation x="0" y="0" z="0"/>
+ </alignment>
+ </alignments>
+
</lccdd>
diff --git a/DDExamples/AlignDet/src/BoxDetector_geo.cpp b/DDExamples/AlignDet/src/BoxDetector_geo.cpp
index 25d4a9583eeb9298e725a3f1adc756f4c8167287..6aa54616ebde58d33886cda376e27174a9b24fb1 100644
--- a/DDExamples/AlignDet/src/BoxDetector_geo.cpp
+++ b/DDExamples/AlignDet/src/BoxDetector_geo.cpp
@@ -20,15 +20,15 @@ static Ref_t create_element(LCDD& lcdd, const xml_h& e, SensitiveDetector&) {
xml_dim_t x_rot (x_det.child(_X(rotation)));
Material mat (lcdd.material(x_det.materialStr()));
DetElement det (lcdd,name,x_det.typeStr(),x_det.id());
- Box det_box(lcdd,name+"_envelope",x_box.x(),x_box.y(),x_box.z());
- Volume det_vol(lcdd,name+"_envelope_volume",det_box, mat);
+ Box det_box(lcdd,name,x_box.x(),x_box.y(),x_box.z());
+ Volume det_vol(lcdd,name+"_vol",det_box, mat);
Volume mother = lcdd.pickMotherVolume(det);
det_vol.setVisAttributes(lcdd, x_det.visStr());
PlacedVolume phv = mother.placeVolume(det_vol,Position(x_pos.x(),x_pos.y(),x_pos.z()),
Rotation(x_rot.x(),x_rot.y(),x_rot.z()));
phv.addPhysVolID(_A(id),x_det.id());
- det.addPlacement(phv);
+ det.setPlacement(phv);
return det;
}
diff --git a/DDExamples/CLICSiD/src/CylindricalBarrelCalorimeter_geo.cpp b/DDExamples/CLICSiD/src/CylindricalBarrelCalorimeter_geo.cpp
index 9b8dfaf1b52759b483363857791abf7be31b2023..71cd5d47e2e56a6e6bea16be238e19c80404617e 100644
--- a/DDExamples/CLICSiD/src/CylindricalBarrelCalorimeter_geo.cpp
+++ b/DDExamples/CLICSiD/src/CylindricalBarrelCalorimeter_geo.cpp
@@ -63,7 +63,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
PlacedVolume physvol = lcdd.pickMotherVolume(sdet).placeVolume(envelopeVol,IdentityPos());
physvol.addPhysVolID(_A(system),sdet.id()).addPhysVolID(_A(barrel),0);
- sdet.addPlacement(physvol);
+ sdet.setPlacement(physvol);
return sdet;
}
diff --git a/DDExamples/CLICSiD/src/CylindricalEndcapCalorimeter_geo.cpp b/DDExamples/CLICSiD/src/CylindricalEndcapCalorimeter_geo.cpp
index 59520d22615de68ef0570fcab9ab25b1e444f3df..a05c968acf403dd3cd0f6cda063de8dbfa8c720a 100644
--- a/DDExamples/CLICSiD/src/CylindricalEndcapCalorimeter_geo.cpp
+++ b/DDExamples/CLICSiD/src/CylindricalEndcapCalorimeter_geo.cpp
@@ -72,7 +72,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
PlacedVolume phv=motherVol.placeVolume(envelopeVol,Position(0,0,zmin+totWidth/2));
phv.addPhysVolID(_A(system),sdet.id())
.addPhysVolID(_A(barrel),1);
- sdet.addPlacement(phv);
+ sdet.setPlacement(phv);
if ( reflect ) {
phv=motherVol.placeVolume(envelopeVol,Position(0,0,-zmin-totWidth/2),ReflectRot());
phv.addPhysVolID(_A(system),sdet.id())
diff --git a/DDExamples/CLICSiD/src/DiskTracker_geo.cpp b/DDExamples/CLICSiD/src/DiskTracker_geo.cpp
index 8dd8e2c8d25fc40a6ea51ad6c590a03fb20c3c9c..d1756bb4fc2628e7527d2bee51622005126355a3 100644
--- a/DDExamples/CLICSiD/src/DiskTracker_geo.cpp
+++ b/DDExamples/CLICSiD/src/DiskTracker_geo.cpp
@@ -58,13 +58,13 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
lpv.addPhysVolID(_X(system),sdet.id());
lpv.addPhysVolID(_X(barrel),1);
DetElement layer(l_nam,det_type+"/Layer",l_num);
- sdet.add(layer.addPlacement(lpv));
+ sdet.add(layer.setPlacement(lpv));
if ( reflect ) {
PlacedVolume lpvR = motherVol.placeVolume(l_vol,Position(0,0,-zmin-layerWidth/2),ReflectRot());
lpvR.addPhysVolID(_X(system),sdet.id());
lpvR.addPhysVolID(_X(barrel),2);
DetElement layerR = layer.clone(l_nam+"_reflect");
- sdet.add(layerR.addPlacement(lpvR));
+ sdet.add(layerR.setPlacement(lpvR));
}
}
sdet.setCombineHits(x_det.attr<bool>(_A(combineHits)),sens);
diff --git a/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp b/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp
index a049c27143e540feccf5ea0665c9b04b645ad884..58ddd23511e0167a174f026864f8f5159b9f699f 100644
--- a/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp
+++ b/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp
@@ -16,32 +16,33 @@ using namespace DD4hep::Geometry;
static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens) {
static double tolerance = 0e0;
- Layering layering (e);
- xml_det_t x_det = e;
- Material air = lcdd.air();
- Material vacuum = lcdd.vacuum();
- int det_id = x_det.id();
- string det_name = x_det.nameStr();
- string det_type = x_det.typeStr();
- xml_comp_t x_staves = x_det.child(_X(staves));
- xml_comp_t x_dim = x_det.child(_X(dimensions));
- int nsides = x_dim.numsides();
- double inner_r = x_dim.rmin();
- double dphi = 2*M_PI / nsides;
- double hphi = dphi/2;
- double mod_z = layering.totalThickness();
- double outer_r = inner_r + mod_z;
- double totThick = mod_z;
- DetElement sdet (det_name,det_type,det_id);
- Volume motherVol = lcdd.pickMotherVolume(sdet);
+ Layering layering (e);
+ xml_det_t x_det = e;
+ Material air = lcdd.air();
+ Material vacuum = lcdd.vacuum();
+ int det_id = x_det.id();
+ string det_name = x_det.nameStr();
+ string det_type = x_det.typeStr();
+ xml_comp_t x_staves = x_det.child(_X(staves));
+ xml_comp_t x_dim = x_det.child(_X(dimensions));
+ int nsides = x_dim.numsides();
+ double inner_r = x_dim.rmin();
+ double dphi = 2*M_PI / nsides;
+ double hphi = dphi/2;
+ double mod_z = layering.totalThickness();
+ double outer_r = inner_r + mod_z;
+ double totThick = mod_z;
+ DetElement sdet (det_name,det_type,det_id);
+ Volume motherVol = lcdd.pickMotherVolume(sdet);
PolyhedraRegular hedra(lcdd,det_name,nsides,inner_r,inner_r+totThick+tolerance*2e0,x_dim.z());
- Volume envelope (lcdd,det_name,hedra,air);
- PlacedVolume env_phv = motherVol.placeVolume(envelope,Rotation(0,0,M_PI/nsides));
+ Volume envelope (lcdd,det_name,hedra,air);
+ PlacedVolume env_phv = motherVol.placeVolume(envelope,Rotation(0,0,M_PI/nsides));
env_phv.addPhysVolID("system",det_id);
env_phv.addPhysVolID("barrel",0);
- sdet.addPlacement(env_phv);
+ sdet.setPlacement(env_phv);
+ DetElement stave_det(det_name+"_stave0",det_type,det_id);
double dx = mod_z / std::sin(dphi); // dx per layer
dx = 0;
@@ -89,7 +90,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
Volume l_vol(lcdd,l_name,l_box,air);
DetElement layer(l_name,det_type+"/Layer",det_id);
- sdet.add(layer);
+ stave_det.add(layer);
// Loop over the sublayers or slices for this layer.
int s_num = 0;
double s_pos_z = -(l_thickness / 2);
@@ -110,7 +111,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
PlacedVolume slice_phv = l_vol.placeVolume(s_vol,Position(0,0,s_pos_z+s_thick/2));
slice_phv.addPhysVolID("layer", l_num);
slice_phv.addPhysVolID("slice", s_num);
- slice.addPlacement(slice_phv);
+ slice.setPlacement(slice_phv);
// Increment Z position of slice.
s_pos_z += s_thick;
@@ -123,7 +124,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
PlacedVolume layer_phv = mod_vol.placeVolume(l_vol,l_pos);
layer_phv.addPhysVolID("layer", l_num);
- layer.addPlacement(layer_phv);
+ layer.setPlacement(layer_phv);
// Increment to next layer Z position.
l_pos_z += l_thickness;
++l_num;
@@ -142,6 +143,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
// Create nsides staves.
for (int i = 0; i < nsides; i++, phi -= dphi) { // i is module number
+ DetElement stave_det(det_name+_toString(i,"_stave%d"),det_type,x_det.id());
// Compute the stave position
double m_pos_x = mod_x_off * std::cos(phi) - mod_y_off * std::sin(phi);
double m_pos_y = mod_x_off * std::sin(phi) + mod_y_off * std::cos(phi);
@@ -151,7 +153,8 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
pv.addPhysVolID("module",i);
pv.addPhysVolID("system",det_id);
pv.addPhysVolID("barrel",0);
- sdet.addPlacement(pv);
+ sdet.add(i==0 ? stave_det : stave_det.clone(det_name+_toString(i,"_stave%d")));
+ stave_det.setPlacement(pv);
}
// Set envelope volume attributes.
diff --git a/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp b/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp
index ddf76e4a68906bce91e8af648a16b45077f0b4db..3d49bea23620eb2f6505f955ed8e8b3cdba34be6 100644
--- a/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp
+++ b/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp
@@ -135,7 +135,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
slice.setAttributes(lcdd, sliceVol, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr());
// Place volume in layer
- slice.addPlacement(layerVol.placeVolume(sliceVol,Position(0,0,slicePosZ)));
+ slice.setPlacement(layerVol.placeVolume(sliceVol,Position(0,0,slicePosZ)));
layer.add(slice);
// Start of next slice.
@@ -149,7 +149,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
// Layer PV.
PlacedVolume layerPV = envelopeVol.placeVolume(layerVol,Position(0,0,layerPosZ));
layerPV.addPhysVolID(_X(layer), i);
- layer.addPlacement(layerPV);
+ layer.setPlacement(layerPV);
sdet.add(layer);
// Increment to start of next layer.
@@ -162,13 +162,14 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
PlacedVolume env_phv = motherVol.placeVolume(envelopeVol,Position(0,0,zpos));
env_phv.addPhysVolID(_X(system), id);
env_phv.addPhysVolID(_X(barrel), 1);
- sdet.addPlacement(env_phv);
+ sdet.setPlacement(env_phv);
// Reflect it.
if ( reflect ) {
env_phv = motherVol.placeVolume(envelopeVol,Position(0,0,-zpos),ReflectRot());
env_phv.addPhysVolID(_X(system), id);
env_phv.addPhysVolID(_X(barrel), 2);
- sdet.addPlacement(env_phv);
+ DetElement rdet(det_name+"_reflect",det_type,x_det.id());
+ rdet.setPlacement(env_phv);
}
return sdet;
}
diff --git a/DDExamples/CLICSiD/src/MultiLayerTracker_geo.cpp b/DDExamples/CLICSiD/src/MultiLayerTracker_geo.cpp
index 85114f1fba8cef86e380446405c2652670696f2d..9c3420612056996e5ca7106247d2ca10fc0cc96d 100644
--- a/DDExamples/CLICSiD/src/MultiLayerTracker_geo.cpp
+++ b/DDExamples/CLICSiD/src/MultiLayerTracker_geo.cpp
@@ -53,7 +53,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
PlacedVolume lpv = motherVol.placeVolume(l_vol,IdentityPos());
lpv.addPhysVolID(_X(system),sdet.id()).addPhysVolID(_X(barrel),0);
- sdet.add(layer.addPlacement(lpv));
+ sdet.add(layer.setPlacement(lpv));
}
sdet.setCombineHits(x_det.attr<bool>(_A(combineHits)),sens);
return sdet;
diff --git a/DDExamples/CLICSiD/src/PolyconeSupport_geo.cpp b/DDExamples/CLICSiD/src/PolyconeSupport_geo.cpp
index e705c8cfb65bfcf38f74030dc439e261cc05012d..103f41475c58029a816445a36953cd11bafff145 100644
--- a/DDExamples/CLICSiD/src/PolyconeSupport_geo.cpp
+++ b/DDExamples/CLICSiD/src/PolyconeSupport_geo.cpp
@@ -33,7 +33,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector&) {
}
cone.addZPlanes(rmin,rmax,z);
volume.setVisAttributes(lcdd, x_det.visStr());
- sdet.addPlacement(lcdd.pickMotherVolume(sdet).placeVolume(volume));
+ sdet.setPlacement(lcdd.pickMotherVolume(sdet).placeVolume(volume));
return sdet;
}
diff --git a/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp b/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp
index 11d5ed67713c37edcad5bb8c682f85d911b4fcef..c886f4f2caad3857e195491c6178c071a8276378 100644
--- a/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp
+++ b/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp
@@ -13,7 +13,9 @@ using namespace std;
using namespace DD4hep;
using namespace DD4hep::Geometry;
-static void placeStaves(double rmin,
+static void placeStaves(DetElement& parent,
+ DetElement& stave,
+ double rmin,
int numsides,
double total_thickness,
Volume envelopeVolume,
@@ -27,13 +29,15 @@ static void placeStaves(double rmin,
double rotY = -offsetRotation;
double posX = -sectCenterRadius * std::sin(rotY);
double posY = sectCenterRadius * std::cos(rotY);
- string nam = sectVolume.name();
- //numsides = 2;
for (int module = 0; module < numsides; ++module) {
+ string nam = stave.name();
+ nam = nam.substr(0,nam.length()-1)+_toString(module,"%d");
+ DetElement det = module>0 ? stave.clone(nam) : stave;
PlacedVolume pv=envelopeVolume.placeVolume(sectVolume,Position(-posX,-posY,0),Rotation(rotX,rotY,0));
pv.addPhysVolID(_X(stave), 0);
pv.addPhysVolID(_X(module),module);
-
+ det.setPlacement(pv);
+ parent.add(det);
rotY -= innerRotation;
posX = -sectCenterRadius * std::sin(rotY);
posY = sectCenterRadius * std::cos(rotY);
@@ -57,6 +61,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
double detZ = dim.z();
double rmin = dim.rmin();
DetElement sdet(det_name,det_type,x_det.id());
+ DetElement stave(det_name+"_stave0",det_type,x_det.id());
Volume motherVol = lcdd.pickMotherVolume(sdet);
cout << det_name << " Gap:" << gap << endl;
@@ -81,11 +86,11 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
Trapezoid staveTrdOuter(lcdd,det_name+"_stave_trapezoid_outer",
innerFaceLen/2,outerFaceLen/2,detZ/2,detZ/2,staveThickness/2);
- Volume staveOuterVol(lcdd,det_name+"_stave_outer",staveTrdOuter,air);
+ Volume staveOuterVol(lcdd,det_name+"_stave",staveTrdOuter,air);
Trapezoid staveTrdInner(lcdd,det_name+"_stave_trapezoid_inner",
innerFaceLen/2-gap,outerFaceLen/2-gap,detZ/2,detZ/2,staveThickness/2);
- Volume staveInnerVol(lcdd,det_name+"_stave_inner",staveTrdInner,air);
+ Volume staveInnerVol(lcdd,det_name+"_inner",staveTrdInner,air);
double layerOuterAngle = (M_PI-innerAngle)/2;
double layerInnerAngle = (M_PI/2 - layerOuterAngle);
@@ -98,36 +103,38 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
for(xml_coll_t c(x_det,_X(layer)); c; ++c) {
xml_comp_t x_layer = c;
- int repeat = x_layer.repeat(); // Get number of times to repeat this layer.
+ int repeat = x_layer.repeat(); // Get number of times to repeat this layer.
const Layer* lay = layering.layer(layer_num); // Get the layer from the layering engine.
// Loop over repeats for this layer.
- for (int j = 0; j < repeat; j++) {
- string layer_name = det_name+_toString(layer_num,"_stave_layer%d");
+ for (int j = 0; j < repeat; j++) {
+ //string layer_name = det_name+_toString(layer_num,"_stave_layer%d");
+ string layer_name = _toString(layer_num,"stave_layer%d");
double layer_thickness = lay->thickness();
DetElement layer(layer_name,det_name+"/Layer",x_det.id());
// Layer position in Z within the stave.
layer_pos_z += layer_thickness / 2;
// Layer box & volume
- Box layer_box(lcdd,layer_name, layer_dim_x, detZ/2, layer_thickness);
- Volume layer_vol(lcdd,layer_name,layer_box,air);
+ Box layer_box(lcdd,"layer", layer_dim_x, detZ/2, layer_thickness);
+ Volume layer_vol(lcdd,"layer", layer_box, air);
// Create the slices (sublayers) within the layer.
double slice_pos_z = -(layer_thickness / 2);
int slice_number = 0;
for(xml_coll_t k(x_layer,_X(slice)); k; ++k) {
xml_comp_t x_slice = k;
- string slice_name = layer_name + _toString(slice_number,"_slice%d");
+ //string slice_name = layer_name + _toString(slice_number,"_slice%d");
+ string slice_name = _toString(slice_number,"slice%d");
double slice_thickness = x_slice.thickness();
Material slice_material = lcdd.material(x_slice.materialStr());
DetElement slice(slice_name,det_name+"/Layer/Slice",x_det.id());
slice_pos_z += slice_thickness / 2;
// Slice box.
- Box slice_box(lcdd,slice_name,layer_dim_x,detZ/2,slice_thickness);
+ Box slice_box(lcdd,"slice",layer_dim_x,detZ/2,slice_thickness);
// Slice volume.
- Volume slice_vol(lcdd,slice_name,slice_box,slice_material);
+ Volume slice_vol(lcdd,"slice",slice_box,slice_material);
if ( x_slice.isSensitive() ) slice_vol.setSensitiveDetector(sens);
// Set region, limitset, and vis.
slice_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr());
@@ -148,7 +155,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
PlacedVolume layer_phv = staveInnerVol.placeVolume(layer_vol,Position(0,0,layer_pos_z));
layer_phv.addPhysVolID(_X(layer),layer_num);
- sdet.add(layer);
+ stave.add(layer);
// Increment the layer X dimension.
layer_dim_x += layer_thickness * std::tan(layerInnerAngle);// * 2;
@@ -163,15 +170,15 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
staveOuterVol.placeVolume(staveInnerVol,IdentityPos());
// Set the vis attributes of the outer stave section.
- sdet.setVisAttributes(lcdd,staves.visStr(),staveOuterVol);
+ stave.setVisAttributes(lcdd,staves.visStr(),staveOuterVol);
// Place the staves.
- placeStaves(rmin,numSides,totalThickness,envelopeVol,innerAngle,staveOuterVol);
+ placeStaves(sdet,stave,rmin,numSides,totalThickness,envelopeVol,innerAngle,staveOuterVol);
PlacedVolume env_phv = motherVol.placeVolume(envelopeVol,Rotation(0,0,M_PI/numSides));
env_phv.addPhysVolID(_X(system), sdet.id());
env_phv.addPhysVolID(_X(barrel), 0);
- sdet.addPlacement(env_phv);
+ sdet.setPlacement(env_phv);
return sdet;
}
diff --git a/DDExamples/CLICSiD/src/PolyhedraEndcapCalorimeter2_geo.cpp b/DDExamples/CLICSiD/src/PolyhedraEndcapCalorimeter2_geo.cpp
index 37a5136ca803c48d5d84913e0c852ebf29434307..de179d778db72a22ff768dba583bada7f7fcf631 100644
--- a/DDExamples/CLICSiD/src/PolyhedraEndcapCalorimeter2_geo.cpp
+++ b/DDExamples/CLICSiD/src/PolyhedraEndcapCalorimeter2_geo.cpp
@@ -81,7 +81,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
Rotation(0,0,M_PI/numsides));
physvol.addPhysVolID("system",det_id);
physvol.addPhysVolID("barrel",1);
- sdet.addPlacement(physvol);
+ sdet.setPlacement(physvol);
if ( reflect ) {
physvol = motherVol.placeVolume(envelopeVol,
@@ -90,7 +90,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
physvol.addPhysVolID("system",det_id);
physvol.addPhysVolID("barrel",2);
DetElement rdet(det_name+"_reflect",det_type,x_det.id());
- rdet.addPlacement(physvol);
+ rdet.setPlacement(physvol);
}
return sdet;
}
diff --git a/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp b/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp
index 085b6ea987ea2f46b5deba3f4ddf5167dcdb6617..8e1d3e520328dee236ba6a5350fdf26d2055579f 100644
--- a/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp
+++ b/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp
@@ -95,7 +95,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
pv.addPhysVolID("system",det_id).addPhysVolID("barrel",1);
pv.addPhysVolID("layer", l_id).addPhysVolID("module",mod_num);
DetElement module (m_base,det_type+"/Module",det_id);
- module.addPlacement(pv);
+ module.setPlacement(pv);
sdet.add(module);
if ( reflect ) {
@@ -105,7 +105,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens
pv.addPhysVolID("system",det_id).addPhysVolID("barrel",2);
pv.addPhysVolID("layer", l_id).addPhysVolID("module",mod_num);
DetElement r_module (m_base+"_reflect",det_type+"/Module",det_id);
- r_module.addPlacement(pv);
+ r_module.setPlacement(pv);
sdet.add(r_module);
}
dz = -dz;
diff --git a/DDExamples/CLICSiD/src/TubeSegment_geo.cpp b/DDExamples/CLICSiD/src/TubeSegment_geo.cpp
index f1705bc0ea7d57286fc8c4ca00849e5c6da9d185..b8e17308af4b173013f746795e9df56f483b9a4c 100644
--- a/DDExamples/CLICSiD/src/TubeSegment_geo.cpp
+++ b/DDExamples/CLICSiD/src/TubeSegment_geo.cpp
@@ -29,7 +29,7 @@ static Ref_t create_element(LCDD& lcdd, const xml_h& e, SensitiveDetector&) {
mother.placeVolume(vol,Position(x_pos.x(),x_pos.y(),x_pos.z()),
Rotation(x_rot.x(),x_rot.y(),x_rot.z()));
phv.addPhysVolID(_A(id),x_det.id());
- sdet.addPlacement(phv);
+ sdet.setPlacement(phv);
return sdet;
}
diff --git a/DDExamples/ILDExReco/src/GearTPC.cpp b/DDExamples/ILDExReco/src/GearTPC.cpp
index 1b3f9b8768c9a0acee8623c1e64ad53e595016d7..dcb5a0c7777fcd5c2dab797964b49e84c81000f5 100644
--- a/DDExamples/ILDExReco/src/GearTPC.cpp
+++ b/DDExamples/ILDExReco/src/GearTPC.cpp
@@ -60,7 +60,7 @@ namespace DD4hep {
double GearTPC::getEndPlateZPosition(int endplate) const {
DetElement ep=getEndPlate(endplate);
//find z position of endplate via the matrix of the placement
- TGeoMatrix *nm=ep.placements()[0]->GetMatrix();
+ TGeoMatrix *nm=ep.placement()->GetMatrix();
const Double_t *trans=nm->GetTranslation();
return trans[2];
}
@@ -78,9 +78,9 @@ namespace DD4hep {
std::map<std::string,DetElement>::const_iterator it2;
for ( it=children().begin() ; it != children().end(); it++ )
{
- std::cout << it->first << " " << it->second._data().id <<" "<<it->second.placements().size()<<std::endl;
+ std::cout << it->first << " " << it->second._data().id <<" "<<std::endl;
for ( it2=it->second.children().begin() ; it2 != it->second.children().end(); it2++ )
- std::cout <<" "<< it2->first << " " << it2->second._data().id << " "<<it2->second.placements().size()<<std::endl;
+ std::cout <<" "<< it2->first << " " << it2->second._data().id << " "<<it2->second.placement().isValid()<<std::endl;
}
}
@@ -155,7 +155,7 @@ namespace DD4hep {
for ( it=ep.children().begin() ; it != ep.children().end(); it++ )
{
Double_t point_local_node[3];
- it->second.placements()[0]->MasterToLocal(point_local, point_local_node);
+ it->second.placement()->MasterToLocal(point_local, point_local_node);
onMod=it->second.volume().solid()->Contains(point_local_node);
if(onMod)
@@ -174,7 +174,7 @@ namespace DD4hep {
neighbour=it->second;
}
}
- // std::cout<<"MINIMUM: "<<safe_dist<<" for "<<neighbour.placements()[0]->GetName()<<" "<<neighbour.id()<<std::endl;
+ // std::cout<<"MINIMUM: "<<safe_dist<<" for "<<neighbour.placement()->GetName()<<" "<<neighbour.id()<<std::endl;
return neighbour;
}