forked from key4hep/k4geo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SimpleCylinder from FCCDetectors/common migrated to detector/other di…
…rectory in k4geo
- Loading branch information
1 parent
1031b52
commit c596669
Showing
3 changed files
with
67 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include "DD4hep/DetFactoryHelper.h" | ||
|
||
namespace det { | ||
/** | ||
Simple cylinder using Tube to be used to define cylinder composed of 1 single material | ||
@author Clement Helsens | ||
**/ | ||
static dd4hep::Ref_t | ||
createSimpleCylinder(dd4hep::Detector& lcdd, xml_h e, dd4hep::SensitiveDetector sensDet) { | ||
xml_det_t x_det = e; | ||
std::string name = x_det.nameStr(); | ||
dd4hep::DetElement cylinderDet(name, x_det.id()); | ||
|
||
dd4hep::Volume experimentalHall = lcdd.pickMotherVolume(cylinderDet); | ||
|
||
xml_comp_t cylinderDim(x_det.child(_U(dimensions))); | ||
|
||
dd4hep::Tube cylinder( | ||
cylinderDim.rmin(), cylinderDim.rmax(), cylinderDim.dz(), cylinderDim.phi0(), cylinderDim.deltaphi()); | ||
|
||
dd4hep::Volume cylinderVol( | ||
x_det.nameStr() + "_SimpleCylinder", cylinder, lcdd.material(cylinderDim.materialStr())); | ||
|
||
if (x_det.isSensitive()) { | ||
dd4hep::xml::Dimension sdType(x_det.child(_U(sensitive))); | ||
cylinderVol.setSensitiveDetector(sensDet); | ||
sensDet.setType(sdType.typeStr()); | ||
} | ||
|
||
dd4hep::PlacedVolume cylinderPhys; | ||
|
||
double zoff = cylinderDim.z_offset(); | ||
if (fabs(zoff) > 0.000000000001) { | ||
dd4hep::Position trans(0., 0., zoff); | ||
cylinderPhys = experimentalHall.placeVolume(cylinderVol, | ||
dd4hep::Transform3D(dd4hep::RotationZ(0.), trans)); | ||
} else | ||
cylinderPhys = experimentalHall.placeVolume(cylinderVol); | ||
|
||
cylinderPhys.addPhysVolID("system", x_det.id()); | ||
|
||
cylinderDet.setPlacement(cylinderPhys); | ||
|
||
cylinderDet.setVisAttributes(lcdd, x_det.visStr(), cylinderVol); | ||
|
||
return cylinderDet; | ||
} | ||
} | ||
DECLARE_DETELEMENT(SimpleCylinder_o1_v01, det::createSimpleCylinder) | ||
|