/DetectorDescription/RegressionTest/interface/DDCompareTools.h

https://github.com/aivanov-cern/cmssw · C Header · 99 lines · 69 code · 15 blank · 15 comment · 0 complexity · c23ec8b12c748e06fc1108ad98a2699d MD5 · raw file

  1. #include "DetectorDescription/Core/interface/DDCompactView.h"
  2. #include "DetectorDescription/Core/interface/DDExpandedView.h"
  3. #include "DetectorDescription/Core/interface/DDSolid.h"
  4. /// DDComparators need to know if names of DDRotation matter.
  5. /**
  6. Therefore the constructors (default) are set to care about rotation names
  7. but if one really wants to compare without regard to the name, for example
  8. in the case of two DDCompactViews created in-memory from reading two
  9. separate sets of XML rather than from DB objects, then one must set this
  10. to false.
  11. **/
  12. struct DDCompOptions {
  13. DDCompOptions() : compRotName_(false), attResync_(false),
  14. contOnError_(false), distTol_(0.0004),
  15. rotTol_(0.0004), specTol_(0.0004)
  16. { }
  17. bool compRotName_;
  18. bool attResync_;
  19. bool contOnError_;
  20. double distTol_;
  21. double rotTol_;
  22. double specTol_;
  23. };
  24. struct DDCompareEPV : public std::binary_function<DDExpandedView, DDExpandedView, bool> {
  25. DDCompareEPV();
  26. DDCompareEPV(const DDCompOptions& ddco);
  27. bool operator()(DDExpandedView& lhs, DDExpandedView& rhs) const ;
  28. DDCompOptions ddco_;
  29. };
  30. struct DDCompareCPV : public std::binary_function<DDCompactView, DDCompactView, bool> {
  31. DDCompareCPV();
  32. DDCompareCPV(const DDCompOptions& ddco);
  33. bool operator()(const DDCompactView& lhs, const DDCompactView& rhs) const ;
  34. DDCompOptions ddco_;
  35. };
  36. /// LogicalParts have solids which could be BooleanSolids.
  37. /**
  38. This means they need to know if the DDRotation naems matter.
  39. **/
  40. struct DDCompareLP : public std::binary_function<DDLogicalPart, DDLogicalPart, bool> {
  41. DDCompareLP();
  42. DDCompareLP(const DDCompOptions& ddco);
  43. bool operator()(const DDLogicalPart& lhs, const DDLogicalPart& rhs) const ;
  44. DDCompOptions ddco_;
  45. };
  46. /// Needs to know about rotmat because of BooleanSolid
  47. struct DDCompareSolid : public std::binary_function<DDSolid, DDSolid, bool> {
  48. DDCompareSolid();
  49. DDCompareSolid(const DDCompOptions& ddco);
  50. bool operator()(const DDSolid& lhs, const DDSolid& rhs) const ;
  51. DDCompOptions ddco_;
  52. };
  53. struct DDCompareDBLVEC : public std::binary_function<std::vector<double>, std::vector<double>, bool> {
  54. DDCompareDBLVEC();
  55. DDCompareDBLVEC(double tol);
  56. bool operator()(const std::vector<double>& lhs, const std::vector<double>& rhs) const ;
  57. double tol_;
  58. };
  59. /// Needs to know because of Rotation Matrix of Boolean Relationship.
  60. struct DDCompareBoolSol : public std::binary_function<DDBooleanSolid, DDBooleanSolid, bool> {
  61. DDCompareBoolSol();
  62. DDCompareBoolSol(const DDCompOptions& ddco);
  63. bool operator()(const DDBooleanSolid& lhs, const DDBooleanSolid& rhs) const ;
  64. DDCompOptions ddco_;
  65. };
  66. struct DDCompareDDTrans : public std::binary_function<DDTranslation, DDTranslation, bool> {
  67. DDCompareDDTrans();
  68. DDCompareDDTrans(double tol);
  69. bool operator()(const DDTranslation& lhs, const DDTranslation& rhs) const;
  70. double tol_;
  71. };
  72. /// Allows to compare name or not. If not, compares only values of the rotation matrix.
  73. struct DDCompareDDRot : public std::binary_function<DDRotation, DDRotation, bool> {
  74. DDCompareDDRot();
  75. DDCompareDDRot(const DDCompOptions& ddco);
  76. bool operator()(const DDRotation& lhs, const DDRotation& rhs) const;
  77. DDCompOptions ddco_;
  78. };
  79. struct DDCompareDDRotMat : public std::binary_function<DDRotationMatrix, DDRotationMatrix, bool> {
  80. DDCompareDDRotMat();
  81. DDCompareDDRotMat(double tol);
  82. bool operator()(const DDRotationMatrix& lhs, const DDRotationMatrix& rhs) const;
  83. double tol_;
  84. };