CMS 3D CMS Logo

Functions
cms::rotation_utils Namespace Reference

Functions

static void addRotWithNewName (cms::DDNamespace &ns, std::string &name, const dd4hep::Rotation3D &rot)
 
static void addRotWithNewName (cms::DDNamespace &ns, std::string &name, const Double_t *rot)
 
static const std::string identityHash ("1.00000000.00000000.00000000.00000001.00000000.00000000.00000000.00000001.0000000")
 
std::string rotHash (const Double_t *rot)
 
std::string rotHash (const dd4hep::Rotation3D &rot)
 
template<typename T >
static const std::string & rotName (const T &rot, const cms::DDParsingContext &context)
 
double roundBinary (double value)
 

Function Documentation

◆ addRotWithNewName() [1/2]

static void cms::rotation_utils::addRotWithNewName ( cms::DDNamespace ns,
std::string &  name,
const dd4hep::Rotation3D &  rot 
)
static

Definition at line 60 of file DDCoreToDDXMLOutput.cc.

References cms::DDNamespace::addRotation(), mergeVDriftHistosByStation::name, and makeMuonMisalignmentScenario::rot.

Referenced by DDCoreToDDXMLOutput::position().

60  {
61  const dd4hep::Rotation3D& rot2 = rot;
62  name = name + "_DdNoNa"; // Name used by old DD to indicate an unnamed rotation
63  ns.addRotation(name, rot2);
64  }
void addRotation(const std::string &name, const dd4hep::Rotation3D &rot) const
Definition: DDNamespace.cc:170

◆ addRotWithNewName() [2/2]

static void cms::rotation_utils::addRotWithNewName ( cms::DDNamespace ns,
std::string &  name,
const Double_t *  rot 
)
static

Definition at line 66 of file DDCoreToDDXMLOutput.cc.

References mergeVDriftHistosByStation::name, makeMuonMisalignmentScenario::rot, cms_rounding::roundIfNear0(), and tol0.

66  {
67  using namespace cms_rounding;
68  dd4hep::Rotation3D rot2(roundIfNear0(rot[0], tol0),
69  roundIfNear0(rot[1], tol0),
70  roundIfNear0(rot[2], tol0),
71  roundIfNear0(rot[3], tol0),
72  roundIfNear0(rot[4], tol0),
73  roundIfNear0(rot[5], tol0),
74  roundIfNear0(rot[6], tol0),
75  roundIfNear0(rot[7], tol0),
76  roundIfNear0(rot[8], tol0));
77  addRotWithNewName(ns, name, rot2);
78  }
static void addRotWithNewName(cms::DDNamespace &ns, std::string &name, const Double_t *rot)
static constexpr double tol0
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
Definition: Rounding.h:11

◆ identityHash()

static const std::string cms::rotation_utils::identityHash ( "1.00000000.00000000.00000000.00000001.00000000.00000000.00000000.00000001.0000000"  )
static

◆ rotHash() [1/2]

std::string cms::rotation_utils::rotHash ( const Double_t *  rot)

Definition at line 26 of file DDNamespace.cc.

References cuy::col, alignBH_cfg::fixed, makeMuonMisalignmentScenario::rot, roundBinary(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by cms::DDNamespace::addRotation(), DDCoreToDDXMLOutput::position(), rotName(), and DDCoreToDDXMLOutput::solid().

26  {
27  std::string hashVal;
28  for (int row = 0; row <= 2; ++row) {
29  for (int col = 0; col <= 2; ++col) {
30  std::ostringstream numStream;
31  numStream << std::fixed << std::setprecision(7);
32  numStream << roundBinary(rot[(3 * row) + col]);
33  hashVal += numStream.str();
34  }
35  }
36  return (hashVal);
37 }
double roundBinary(double value)
Definition: DDNamespace.cc:18
col
Definition: cuy.py:1009

◆ rotHash() [2/2]

std::string cms::rotation_utils::rotHash ( const dd4hep::Rotation3D &  rot)

Definition at line 39 of file DDNamespace.cc.

References alignBH_cfg::fixed, makeMuonMisalignmentScenario::matrix, makeMuonMisalignmentScenario::rot, roundBinary(), AlCaHLTBitMon_QueryRunRegistry::string, and heppy_batch::val.

39  {
40  std::string hashVal;
41  std::vector<double> matrix;
42  matrix.assign(9, 0.);
43  rot.GetComponents(matrix.begin());
44  for (double val : matrix) {
45  std::ostringstream numStream;
46  numStream << std::fixed << std::setprecision(7);
47  numStream << roundBinary(val);
48  hashVal += numStream.str();
49  }
50  return (hashVal);
51 }
double roundBinary(double value)
Definition: DDNamespace.cc:18

◆ rotName()

template<typename T >
static const std::string& cms::rotation_utils::rotName ( const T rot,
const cms::DDParsingContext context 
)
static

◆ roundBinary()

double cms::rotation_utils::roundBinary ( double  value)

Definition at line 18 of file DDNamespace.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), and cms_rounding::roundIfNear0().

Referenced by rotHash().

18  {
20  static constexpr double roundingVal = 1 << 24;
21  value = (round(value * roundingVal) / roundingVal);
22  // Set -0 to 0
24 }
Definition: value.py:1
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
Definition: Rounding.h:11