Skip to content

Commit

Permalink
Try internal computation in double for DDHcalAngular for dd4hep
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Sep 1, 2020
1 parent 2c14a0e commit 03d1a42
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Geometry/HcalAlgo/plugins/dd4hep/DDHCalAngular.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ static long algorithm(dd4hep::Detector& /* description */,
int n = args.value<int>("n");
int startCopyNo = args.value<int>("startCopyNo");
int incrCopyNo = args.value<int>("incrCopyNo");
float rangeAngle = args.value<float>("rangeAngle"); //Angular range
float startAngle = args.value<float>("startAngle"); //Start anle
float shiftX = args.value<float>("shiftX"); //x Shift
float shiftY = args.value<float>("shiftY"); //y Shift
float zoffset = args.value<float>("zoffset"); //z offset
double rangeAngle = args.value<double>("rangeAngle"); //Angular range
double startAngle = args.value<double>("startAngle"); //Start anle
double shiftX = args.value<double>("shiftX"); //x Shift
double shiftY = args.value<double>("shiftY"); //y Shift
double zoffset = args.value<double>("zoffset"); //z offset
dd4hep::Volume mother = ns.volume(args.parentName());
std::string childName = args.value<std::string>("ChildName");
childName = ns.prepend(childName);
dd4hep::Volume child = ns.volume(childName);

// Increment
float dphi = rangeAngle / n;
double dphi = rangeAngle / n;
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HCalGeom") << "DDHCalAngular: Parameters for positioning::"
<< " n " << n << " Start, Range, Delta " << convertRadToDeg(startAngle) << " "
Expand All @@ -36,7 +36,7 @@ static long algorithm(dd4hep::Detector& /* description */,
<< "\tChild " << child.name() << " NameSpace " << ns.name();
#endif
int copy = startCopyNo;
float phix = startAngle;
double phix = startAngle;
for (int ii = 0; ii < n; ++ii) {
if (phix >= 2._pi)
phix -= 2._pi;
Expand All @@ -52,8 +52,8 @@ static long algorithm(dd4hep::Detector& /* description */,
rotation = dd4hep::RotationZ(phix);
}

float xpos = shiftX * cos(phix) - shiftY * sin(phix);
float ypos = shiftX * sin(phix) + shiftY * cos(phix);
double xpos = shiftX * cos(phix) - shiftY * sin(phix);
double ypos = shiftX * sin(phix) + shiftY * cos(phix);
dd4hep::Position tran(xpos, ypos, zoffset);
mother.placeVolume(child, copy, dd4hep::Transform3D(rotation, tran));
#ifdef EDM_ML_DEBUG
Expand Down

0 comments on commit 03d1a42

Please sign in to comment.