CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

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(), and makeMuonMisalignmentScenario::rot.

Referenced by addRotWithNewName(), and 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
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 addRotWithNewName(), 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 constexpr double tol0
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
Definition: Rounding.h:11
static void addRotWithNewName(cms::DDNamespace &ns, std::string &name, const dd4hep::Rotation3D &rot)
static const std::string cms::rotation_utils::identityHash ( "1.00000000.00000000.00000000.00000001.00000000.00000000.00000000.00000001.0000000"  )
static
std::string cms::rotation_utils::rotHash ( const Double_t *  rot)

Definition at line 26 of file DDNamespace.cc.

References cuy::col, 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
int col
Definition: cuy.py:1009
std::string cms::rotation_utils::rotHash ( const dd4hep::Rotation3D &  rot)

Definition at line 39 of file DDNamespace.cc.

References makeMuonMisalignmentScenario::matrix, roundBinary(), AlCaHLTBitMon_QueryRunRegistry::string, and hgcalPerformanceValidation::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
template<typename T >
static const std::string& cms::rotation_utils::rotName ( const T rot,
const cms::DDParsingContext context 
)
static

Definition at line 81 of file DDCoreToDDXMLOutput.cc.

References rotHash(), cms::DDParsingContext::rotRevMap, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by algorithm(), DDHGCalSiliconModule::constructLayers(), DDPixFwdDiskAlgo::execute(), DDPixPhase1FwdDiskAlgo::execute(), HGCalSiliconModule::HGCalSiliconModule(), DDPixFwdDiskAlgo::initialize(), DDPixPhase1FwdDiskAlgo::initialize(), DDCoreToDDXMLOutput::position(), DDCoreToDDXMLOutput::rotation(), and DDCoreToDDXMLOutput::solid().

81  {
82  std::string hashVal = rotHash(rot);
83  auto rotNameIter = context.rotRevMap.find(hashVal);
84  if (rotNameIter != context.rotRevMap.end()) {
85  return (rotNameIter->second);
86  }
87  static const std::string nullStr{"NULL"};
88  return (nullStr);
89  }
std::string rotHash(const Double_t *rot)
Definition: DDNamespace.cc:26
std::unordered_map< std::string, std::string > rotRevMap
double cms::rotation_utils::roundBinary ( double  value)

Definition at line 18 of file DDNamespace.cc.

References 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 }
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
Definition: Rounding.h:11