diff --git a/DDExamples/CLICSiD/compact/compact.xml b/DDExamples/CLICSiD/compact/compact.xml index 3ac58d35dd166276650b77c0187d4835b21899b2..fa3a3e8c5f0676f95a7b2e5a1c5527e9e1df721e 100644 --- a/DDExamples/CLICSiD/compact/compact.xml +++ b/DDExamples/CLICSiD/compact/compact.xml @@ -680,6 +680,7 @@ <slice material = "Air" thickness = "0.033*cm" /> </layer> </detector> +<!-- <detector id="7" name="HcalBarrel" type="PolyhedraBarrelCalorimeter2" readout="HcalBarrelHits" vis="HcalBarrelVis" calorimeterType="HAD_BARREL" gap="0.*cm" material="Steel235"> <comment>Hadron Calorimeter Barrel</comment> <dimensions numsides="(int) CaloSides" rmin="HcalBarrel_rmin" z="EcalBarrel_zmax*2"/> @@ -690,6 +691,7 @@ <slice material = "Air" thickness = "0.15*cm" /> </layer> </detector> +--> <detector id="8" name="HcalEndcap" type="PolyhedraEndcapCalorimeter2" readout="HcalEndcapHits" vis="HcalEndcapVis" calorimeterType="HAD_ENDCAP"> <comment>Hadron Calorimeter Endcaps</comment> <dimensions numsides="(int) CaloSides" zmin="HcalEndcap_zmin" rmin="HcalEndcap_rmin" rmax="HcalEndcap_rmax" /> diff --git a/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp b/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp index d3b0848668371b599553c2f78f400a9012beb472..9b5366896770d9a6b1d98ffa18398f639f05ebba 100644 --- a/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp +++ b/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp @@ -22,8 +22,8 @@ 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(); - xml_comp_t x_staves = x_det.child(_X(staves)); - xml_comp_t x_dim = x_det.child(_X(dimensions)); + xml_comp_t x_staves = x_det.staves(); + xml_comp_t x_dim = x_det.dimensions(); int nsides = x_dim.numsides(); double inner_r = x_dim.rmin(); double dphi = 2*M_PI / nsides; @@ -141,9 +141,10 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens // 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); + PlacedVolume pv = envelope.placeVolume(mod_vol, - Position(-m_pos_x,-m_pos_y,0), - Rotation(M_PI*0.5,phi,0)); + Position(-m_pos_x,-m_pos_y,0), + Rotation(phi,M_PI*0.5,0)); pv.addPhysVolID("module",i); pv.addPhysVolID("system",det_id); pv.addPhysVolID("barrel",0); diff --git a/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp b/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp index 8c7699e65721a32f05e7d0c651248daf2977dec2..1a3a845dbc4abda16f047fec1147ea780fe7a0b0 100644 --- a/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp +++ b/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp @@ -17,7 +17,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens xml_det_t x_det = e; xml_dim_t dim = x_det.dimensions(); bool reflect = x_det.reflect(); - xml_comp_t beam = x_det.child(_X(beampipe)); + xml_comp_t beam = x_det.beampipe(); string det_name = x_det.nameStr(); int id = x_det.id(); Material air = lcdd.air(); @@ -32,9 +32,9 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens double outgoingR = beam.outgoing_r(); double incomingR = beam.incoming_r(); double xangle = beam.crossing_angle(); - double xangleHalf = xangle / 2; + double xangleHalf = xangle/2; double thickness = layering.totalThickness(); - double zpos = zinner + (thickness / 2); + double zpos = zinner + thickness/2; // Beampipe position in envelope. double beamPosX = std::tan(xangleHalf) * zpos; @@ -43,19 +43,19 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens // First envelope bool subtracion of outgoing beampipe. // Incoming beampipe solid. - Tube beamInTube(0,outgoingR,thickness * 2); + Tube beamInTube(0,outgoingR,thickness*2); // Position of incoming beampipe. Position beamInPos(beamPosX,0,0); /// Rotation of incoming beampipe. - Rotation beamInRot(0,xangleHalf,0); + Rotation beamInRot(0,0,xangleHalf); // Second envelope bool subtracion of outgoing beampipe. // Outgoing beampipe solid. - Tube beamOutTube(0,incomingR,thickness * 2); + Tube beamOutTube(0,incomingR,thickness*2); // Position of outgoing beampipe. Position beamOutPos(-beamPosX,0,0); // Rotation of outgoing beampipe. - Rotation beamOutRot(0,-xangleHalf,0); + Rotation beamOutRot(0,0,-xangleHalf); // First envelope bool subtraction of incoming beampipe. SubtractionSolid envelopeSubtraction1(envelopeTube,beamInTube,beamInPos,beamInRot); diff --git a/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp b/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp index 2768393193b34f0531eb1da6688a62e28baa43b8..3f0c956052d06ba2967bcbdfa6190bb72d2c1660 100644 --- a/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp +++ b/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp @@ -25,32 +25,31 @@ static void placeStaves(DetElement& parent, double innerRotation = innerAngle; double offsetRotation = -innerRotation / 2; double sectCenterRadius = rmin + total_thickness / 2; - double rotX = M_PI / 2; - double rotY = -offsetRotation; - double posX = -sectCenterRadius * std::sin(rotY); - double posY = sectCenterRadius * std::cos(rotY); + double rotY = M_PI / 2; + double rotZ = -offsetRotation; + double posX = sectCenterRadius * std::sin(rotZ); + double posY = sectCenterRadius * std::cos(rotZ); for (int module = 0; module < numsides; ++module) { DetElement det = module>0 ? stave.clone(_toString(module,"stave%d")) : stave; - PlacedVolume pv = envelopeVolume.placeVolume(sectVolume,Position(-posX,-posY,0),Rotation(rotX,rotY,0)); + PlacedVolume pv = envelopeVolume.placeVolume(sectVolume,Position(posX,-posY,0),Rotation(rotZ,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); + rotZ -= innerRotation; + posX = sectCenterRadius * std::sin(rotZ); + posY = sectCenterRadius * std::cos(rotZ); } } static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens) { xml_det_t x_det = e; - xml_comp_t staves = x_det.child(_X(staves)); - xml_dim_t dim = x_det.dimensions(); - - string det_name = x_det.nameStr(); - string det_type = x_det.typeStr(); - Material air = lcdd.air(); Layering layering(x_det); + xml_comp_t staves = x_det.staves(); + xml_dim_t dim = x_det.dimensions(); + string det_name = x_det.nameStr(); + string det_type = x_det.typeStr(); + Material air = lcdd.air(); double totalThickness = layering.totalThickness(); int totalRepeat = 0; int totalSlices = 0; @@ -62,8 +61,6 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens DetElement stave("stave0",x_det.id()); Volume motherVol = lcdd.pickMotherVolume(sdet); - //cout << det_name << " Gap:" << gap << endl; - for(xml_coll_t c(x_det,_X(layer)); c; ++c) { xml_comp_t x_layer = c; int repeat = x_layer.repeat(); diff --git a/DDExamples/CLICSiD/src/PolyhedraEndcapCalorimeter2_geo.cpp b/DDExamples/CLICSiD/src/PolyhedraEndcapCalorimeter2_geo.cpp index a02bf181a48dceae15e5e9dc92873f6cc92637ea..dc6d554066b0d7feb5ff281ed0200f74e7bdf217 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 if ( reflect ) { physvol = motherVol.placeVolume(envelopeVol, Position(0,0,-(zmin+totalThickness/2)), - Rotation(M_PI,0,M_PI/numsides)); + Rotation(0,M_PI,M_PI/numsides)); physvol.addPhysVolID("system",det_id); physvol.addPhysVolID("barrel",2); DetElement rdet(det_name+"_reflect",x_det.id()); diff --git a/DDExamples/CLICSiD/src/SiTrackerBarrel_geo.cpp b/DDExamples/CLICSiD/src/SiTrackerBarrel_geo.cpp index 7a3957a8585460ba6f77c8c735f3eb9000908424..fea62cf01124abc78126c91c33b7c549415fb277 100644 --- a/DDExamples/CLICSiD/src/SiTrackerBarrel_geo.cpp +++ b/DDExamples/CLICSiD/src/SiTrackerBarrel_geo.cpp @@ -32,8 +32,8 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens volumes[m_nam] = m_vol; for(xml_coll_t ci(x_mod,_X(module_component)); ci; ++ci, ++ncomponents) { xml_comp_t x_comp = ci; - xml_comp_t x_pos = x_comp.child(_X(position),false); - xml_comp_t x_rot = x_comp.child(_X(rotation),false); + xml_comp_t x_pos = x_comp.position(false); + xml_comp_t x_rot = x_comp.rotation(false); string c_nam = det_name+"_"+m_nam+_toString(ncomponents,"_component%d"); Box c_box(x_comp.width(),x_comp.length(),x_comp.thickness()); Volume c_vol(c_nam,c_box,lcdd.material(x_comp.materialStr())); @@ -41,11 +41,11 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens if ( x_pos && x_rot ) { Position c_pos(x_pos.x(0),x_pos.y(0),x_pos.z(0)); - Rotation c_rot(x_rot.x(0),x_rot.y(0),x_rot.z(0)); + Rotation c_rot(x_rot.z(0),x_rot.y(0),x_rot.x(0)); c_phv = m_vol.placeVolume(c_vol, c_pos, c_rot); } else if ( x_rot ) { - c_phv = m_vol.placeVolume(c_vol,Rotation(x_rot.x(0),x_rot.y(0),x_rot.z(0))); + c_phv = m_vol.placeVolume(c_vol,Rotation(x_rot.z(0),x_rot.y(0),x_rot.x(0))); } else if ( x_pos ) { c_phv = m_vol.placeVolume(c_vol,Position(x_pos.x(0),x_pos.y(0),x_pos.z(0))); @@ -106,7 +106,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens // Module PhysicalVolume. PlacedVolume m_physvol = lay_vol.placeVolume(m_env,Position(x,y,module_z), - Rotation(M_PI/2,-((M_PI/2)-phic-phi_tilt),0)); + Rotation(-((M_PI/2)-phic-phi_tilt),M_PI/2,0)); m_physvol.addPhysVolID("module", module++); // Adjust the x and y coordinates of the module. x += dx; diff --git a/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp b/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp index 8d3d712dc62a2afbcdf5218a3beee53baa1f1b6d..be0ab8c170b36bc30f4b0581844a6391932a9bc4 100644 --- a/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp +++ b/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp @@ -30,7 +30,7 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens for(xml_coll_t mi(x_det,_X(module)); mi; ++mi, ++m_id) { xml_comp_t x_mod = mi; string m_nam = x_mod.nameStr(); - xml_comp_t trd = x_mod.child(_X(trd)); + xml_comp_t trd = x_mod.trd(); double x1 = trd.x1(); double x2 = trd.x2(); double z = trd.z(); @@ -86,14 +86,14 @@ static Ref_t create_detector(LCDD& lcdd, const xml_h& e, SensitiveDetector& sens DetElement module(sdet,m_base,det_id); PlacedVolume pv = motherVol.placeVolume(m_vol, Position(x,y,zstart+dz), - Rotation(-M_PI/2,-M_PI/2-phi,0)); + Rotation(-M_PI/2-phi,-M_PI/2,0)); pv.addPhysVolID("system",det_id).addPhysVolID("barrel",1); pv.addPhysVolID("layer", l_id).addPhysVolID("module",mod_num); module.setPlacement(pv); if ( reflect ) { pv = motherVol.placeVolume(m_vol, Position(x,y,-zstart-dz), - Rotation(-M_PI/2,-M_PI/2-phi,M_PI)); + Rotation(-M_PI/2-phi,-M_PI/2,M_PI)); pv.addPhysVolID("system",det_id).addPhysVolID("barrel",2); pv.addPhysVolID("layer", l_id).addPhysVolID("module",mod_num); DetElement r_module(sdet,m_base+"_reflect",det_id); diff --git a/DDExamples/CLICSiD/src/TubeSegment_geo.cpp b/DDExamples/CLICSiD/src/TubeSegment_geo.cpp index 28e94d1aa30187ca34289ef441dc84ca92e8c1d3..30a9f826a03a44bd7531248d0fdd828716a7e7bd 100644 --- a/DDExamples/CLICSiD/src/TubeSegment_geo.cpp +++ b/DDExamples/CLICSiD/src/TubeSegment_geo.cpp @@ -14,10 +14,10 @@ using namespace DD4hep::Geometry; static Ref_t create_element(LCDD& lcdd, const xml_h& e, SensitiveDetector&) { xml_det_t x_det (e); - xml_comp_t x_tube (x_det.child(_X(tubs))); - xml_dim_t pos (x_det.child(_X(position))); - xml_dim_t rot (x_det.child(_X(rotation))); - string name = x_det.nameStr(); + xml_comp_t x_tube = x_det.tubs(); + xml_dim_t pos = x_det.position(); + xml_dim_t rot = x_det.rotation(); + string name = x_det.nameStr(); Tube tub (x_tube.rmin(),x_tube.rmax(),x_tube.zhalf()); Volume vol (name,tub,lcdd.material(x_det.materialStr())); @@ -27,7 +27,7 @@ static Ref_t create_element(LCDD& lcdd, const xml_h& e, SensitiveDetector&) { Volume mother = lcdd.pickMotherVolume(sdet); PlacedVolume phv = mother.placeVolume(vol,Position(pos.x(),pos.y(),pos.z()), - Rotation(rot.x(),rot.y(),rot.z())); + Rotation(rot.z(),rot.y(),rot.x())); phv.addPhysVolID(_A(id),x_det.id()); sdet.setPlacement(phv); return sdet;