Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make units dd4hep-dependent in Run3 Tracker algo #32863

Merged
merged 3 commits into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Geometry/TrackerCommonData/plugins/dd4hep/DDTECModuleAlgo.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#include "DD4hep/DetFactoryHelper.h"
#include "DataFormats/Math/interface/CMSUnits.h"
#include <DD4hep/DD4hepUnits.h>
#include "DataFormats/Math/interface/angle_units.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

using namespace std;
using namespace dd4hep;
using namespace cms;
using namespace cms_units::operators;
using namespace angle_units::operators;

static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, xml_h e) {
cms::DDNamespace ns(ctxt, e, true);
Expand Down Expand Up @@ -216,7 +217,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt,
xpos = -0.5 * topFrameBotWidth + bl2 * cos(detTilt) + dz * sin(fabs(thet) + detTilt) / cos(fabs(thet));
xpos = -xpos;
zpos = topFrameEndZ - topFrame2LHeight - 0.5 * sin(detTilt) * (topFrameBotWidth - topFrame2Width) -
dz * cos(detTilt + fabs(thet)) / cos(fabs(thet)) + bl2 * sin(detTilt) - 0.1_mm;
dz * cos(detTilt + fabs(thet)) / cos(fabs(thet)) + bl2 * sin(detTilt) - 0.1 * dd4hep::mm;
}
//position
mother.placeVolume(
Expand Down Expand Up @@ -252,7 +253,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt,
xpos = 0.5 * topFrameBotWidth - bl2 * cos(detTilt) - dz * sin(fabs(detTilt - fabs(thet))) / cos(fabs(thet));
xpos = -xpos;
zpos = topFrameEndZ - topFrame2RHeight + 0.5 * sin(detTilt) * (topFrameBotWidth - topFrame2Width) -
dz * cos(detTilt - fabs(thet)) / cos(fabs(thet)) - bl2 * sin(detTilt) - 0.1_mm;
dz * cos(detTilt - fabs(thet)) / cos(fabs(thet)) - bl2 * sin(detTilt) - 0.1 * dd4hep::mm;
}
//position it
mother.placeVolume(
Expand Down
13 changes: 7 additions & 6 deletions Geometry/TrackerCommonData/plugins/dd4hep/DDTIBLayerAlgo.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#include "DD4hep/DetFactoryHelper.h"
#include "DataFormats/Math/interface/CMSUnits.h"
#include <DD4hep/DD4hepUnits.h>
#include "DataFormats/Math/interface/angle_units.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

using namespace std;
using namespace dd4hep;
using namespace cms;
using namespace cms_units::operators;
using namespace angle_units::operators;

static long algorithm(Detector& /* description */, cms::DDParsingContext& context, xml_h element) {
using VecDouble = vector<double>;
Expand Down Expand Up @@ -249,12 +250,12 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex
name = idName + "Rib" + std::to_string(i);
double width = 2. * ribW[i] / (rin + rout);
double dz = 0.5 * layerL - 2. * fillerDz;
double _rmi = std::min(rin + 0.5_mm, rout - 0.5_mm);
double _rma = std::max(rin + 0.5_mm, rout - 0.5_mm);
double _rmi = std::min(rin + 0.5 * dd4hep::mm, rout - 0.5 * dd4hep::mm);
double _rma = std::max(rin + 0.5 * dd4hep::mm, rout - 0.5 * dd4hep::mm);
solid = ns.addSolidNS(name, Tube(_rmi, _rma, dz, -0.5 * width, width));
LogDebug("TIBGeom") << solid.name() << " Tubs made of " << ribMat << " from " << -0.5 * convertRadToDeg(width)
<< " to " << 0.5 * convertRadToDeg(width) << " with Rin " << rin + 0.5_mm << " Rout "
<< rout - 0.5_mm << " ZHalf " << dz;
<< " to " << 0.5 * convertRadToDeg(width) << " with Rin " << rin + 0.5 * dd4hep::mm << " Rout "
<< rout - 0.5 * dd4hep::mm << " ZHalf " << dz;
Volume cylinderRib = ns.addVolumeNS(Volume(name, solid, matrib));
double phix = ribPhi[i];
double theta = 90_deg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ std::unique_ptr<GeometricDet> DDDCmsTrackerContruction::construct(const DDCompac
theCmsTrackerDetIdBuilder.buildId(*tracker);

if (DEBUG) {
printAllTrackerGeometricDetsBeforeDetIDBuilding(tracker.get());
printAllTrackerGeometricDets(tracker.get());
}

fv.parent();
Expand Down Expand Up @@ -88,7 +88,7 @@ std::unique_ptr<GeometricDet> DDDCmsTrackerContruction::construct(const cms::DDC
theCmsTrackerDetIdBuilder.buildId(*tracker);

if (DEBUG) {
printAllTrackerGeometricDetsBeforeDetIDBuilding(tracker.get());
printAllTrackerGeometricDets(tracker.get());
}

return tracker;
Expand All @@ -100,7 +100,7 @@ std::unique_ptr<GeometricDet> DDDCmsTrackerContruction::construct(const cms::DDC
* and all GeometricDets are sorted according to their geometric position.
* This allows a convenient debugging, as the DetIds will be later assigned according to this information.
*/
void DDDCmsTrackerContruction::printAllTrackerGeometricDetsBeforeDetIDBuilding(const GeometricDet* tracker) {
void DDDCmsTrackerContruction::printAllTrackerGeometricDets(const GeometricDet* tracker) {
std::ofstream outputFile("All_Tracker_GeometricDets_before_DetId_building.log", std::ios::out);

// Tree navigation: queue for BFS (we want to see same hierarchy level together).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace cms {
namespace DDDCmsTrackerContruction {
std::unique_ptr<GeometricDet> construct(DDCompactView const& cpv, std::vector<int> const& detidShifts);
std::unique_ptr<GeometricDet> construct(cms::DDCompactView const& cpv, std::vector<int> const& detidShifts);
void printAllTrackerGeometricDetsBeforeDetIDBuilding(const GeometricDet* tracker);
void printAllTrackerGeometricDets(const GeometricDet* tracker);
}; // namespace DDDCmsTrackerContruction

#endif