1 #include <DD4hep/DD4hepUnits.h>
19 template <
typename DDView>
20 double getDouble(
const char*
s, DDView
const&
ev) {
22 std::vector<const DDsvalues_type*>
result;
23 ev.specificsV(result);
24 std::vector<const DDsvalues_type*>::iterator it = result.begin();
26 for (; it != result.end(); ++it) {
32 const std::vector<std::string>&
temp =
val.strings();
33 if (temp.size() != 1) {
34 throw cms::Exception(
"Configuration") <<
"I need 1 " << s <<
" tags";
36 return double(::atof(temp[0].c_str()));
41 template <
typename DDView>
42 std::string getString(
const char* s, DDView
const& ev) {
44 std::vector<const DDsvalues_type*>
result;
45 ev.specificsV(result);
46 std::vector<const DDsvalues_type*>::iterator it = result.begin();
48 for (; it != result.end(); ++it) {
54 const std::vector<std::string>& temp =
val.strings();
55 if (temp.size() != 1) {
56 throw cms::Exception(
"Configuration") <<
"I need 1 " << s <<
" tags";
74 : ddname_(fv->
name()),
77 trans_(fv->translation()),
83 isFromDD4hep_(
false) {
90 radLength_ = getDouble(
"TrackerRadLength", *fv);
91 xi_ = getDouble(
"TrackerXi", *fv);
92 isBricked_ = (getString(
"isBricked", *fv) == strue);
95 pixROCx_ = getDouble(
"PixelROC_X", *fv);
96 pixROCy_ = getDouble(
"PixelROC_Y", *fv);
97 stereo_ = (getString(
"TrackerStereoDetectors", *fv) == strue);
98 isLowerSensor_ = (getString(
"TrackerLowerDetectors", *fv) == strue);
99 isUpperSensor_ = (getString(
"TrackerUpperDetectors", *fv) == strue);
111 trans_((fv->translation()) /
dd4hep::mm),
116 params_(computeLegacyShapeParameters(shape_, fv->solid())),
117 isFromDD4hep_(
true) {
118 using namespace angle_units::operators;
127 isBricked_ = (fv->
get<std::string_view>(
"isBricked") == strue);
134 stereo_ = (fv->
get<std::string_view>(
"TrackerStereoDetectors") == strue);
156 trans_(onePGD._x, onePGD._y, onePGD._z),
239 rot_.GetComponents(x, y, z);
261 cont.emplace_back(
this);
301 const dd4hep::Solid& mySolid)
const {
302 std::vector<double> myOldDDShapeParameters;
306 const dd4hep::Box& myBox = dd4hep::Box(mySolid);
307 myOldDDShapeParameters = {(myBox.x()) / dd4hep::mm, (myBox.y()) / dd4hep::mm, (myBox.z()) / dd4hep::mm};
312 const dd4hep::Trap& myTrap = dd4hep::Trap(mySolid);
313 myOldDDShapeParameters = {(myTrap->GetDZ()) / dd4hep::mm,
316 (myTrap->GetH1()) / dd4hep::mm,
317 (myTrap->GetBl1()) / dd4hep::mm,
318 (myTrap->GetTl1()) / dd4hep::mm,
320 (myTrap->GetH2()) / dd4hep::mm,
321 (myTrap->GetBl2()) / dd4hep::mm,
322 (myTrap->GetTl2()) / dd4hep::mm,
328 const dd4hep::Tube& myTube = dd4hep::Tube(mySolid);
332 using namespace angle0to2pi;
336 myOldDDShapeParameters = {
337 (myTube->GetDz()) / dd4hep::mm,
338 (myTube->GetRmin()) / dd4hep::mm,
339 (myTube->GetRmax()) / dd4hep::mm,
344 return myOldDDShapeParameters;
std::vector< GeometricDet * > GeometricDetContainer
constexpr double convertDegToRad(NumType degrees)
tuple cont
load Luminosity info ##
void addComponent(GeometricDet *)
std::vector< double > params_
void findSpecPar(T const &first, Ts const &...rest)
find a current Node SpecPar that has at least
std::enable_if<!std::numeric_limits< NumType >::is_integer, bool >::type almostEqual(NumType x, NumType y, int ulp)
nav_type navPos() const
return the stack of sibling numbers
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
std::vector< int > nav_type
enum GeometricDet::GDEnumType GeometricEnumType
std::vector< double > computeLegacyShapeParameters(const cms::DDSolidShape &mySolidShape, const dd4hep::Solid &mySolid) const
ConstGeometricDetContainer container_
Position positionBounds() const
double getNextValue(const std::string &) const
extract another value from the same SpecPar
GeometricDet(DDFilteredView *fv, GeometricEnumType dd)
std::unique_ptr< Bounds > bounds() const
std::vector< GeometricDet const * > ConstGeometricDetContainer
const std::array< const cms::dd::ValuePair< LegacySolidShape, cms::DDSolidShape >, 21 > LegacySolidShapeMap
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
T get(const std::string &)
extract attribute value
constexpr valType make0To2pi(valType angle)
Bounds * buildBounds(const cms::DDSolidShape &, const std::vector< double > &) const
ConstGeometricDetContainer deepComponents() const
DDExpandedView::nav_type nav_type
void addComponents(GeometricDetContainer const &cont)
Rotation rotationBounds() const
constexpr NumType convertMmToCm(NumType millimeters)
Mapping::value_type::name_type name_from_value(Mapping a, V value)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > Translation