CMS 3D CMS Logo

Functions | Variables
geometryDiff Namespace Reference

Functions

def loopover (which)
 
def matrixmult (a, b)
 
def rotFromEuler (g)
 
def rotFromPhi (g)
 
def transpose (a)
 

Variables

 args
 
int epsilon = 1e-6
 
 file
 
 geom1 = MuonGeometry(file(args[0]))
 
 geom2 = MuonGeometry(file(args[1]))
 
 opts = dict(opts)
 
 sqrtepsilon = sqrt(epsilon)
 
string usage = "Usage: geometryDiff.py [-h|--help] [-e|--epsilon epsilon] geometry1.xml geometry2.xml"
 

Function Documentation

◆ loopover()

def geometryDiff.loopover (   which)

Definition at line 62 of file geometryDiff.py.

62 def loopover(which):
63  if which == "DT":
64  keys = geom1.dt.keys()
65  keys.sort(dtorder)
66 
67  elif which == "CSC":
68  keys = geom1.csc.keys()
69  keys.sort(cscorder)
70 
71  else: raise Exception
72 
73  for key in keys:
74  if which == "DT":
75  g1 = geom1.dt[key]
76  g2 = geom2.dt[key]
77  else:
78  g1 = geom1.csc[key]
79  g2 = geom2.csc[key]
80 
81  if g1.relativeto != g2.relativeto:
82  print("%s %s relativeto=\"%s\" versus relativeto=\"%s\"" % (which, str(key), g1.relativeto, g2.relativeto))
83 
84  if abs(g1.x - g2.x) > epsilon or abs(g1.y - g2.y) > epsilon or abs(g1.z - g2.z) > epsilon:
85  print("%s %s position difference: (%g, %g, %g) - (%g, %g, %g) = (%g, %g, %g)" % \
86  (which, str(key), g1.x, g1.y, g1.z, g2.x, g2.y, g2.z, g1.x - g2.x, g1.y - g2.y, g1.z - g2.z))
87 
88  if "phix" in g1.__dict__:
89  g1type = "phi"
90  g1a, g1b, g1c = g1.phix, g1.phiy, g1.phiz
91  g1rot = rotFromPhi(g1)
92  else:
93  g1type = "euler"
94  g1a, g1b, g1c = g1.alpha, g1.beta, g1.gamma
95  g1rot = rotFromEuler(g1)
96 
97  if "phix" in g2.__dict__:
98  g2type = "phi"
99  g2a, g2b, g2c = g2.phix, g2.phiy, g2.phiz
100  g2rot = rotFromPhi(g2)
101  else:
102  g2type = "euler"
103  g2a, g2b, g2c = g2.alpha, g2.beta, g2.gamma
104  g2rot = rotFromEuler(g2)
105 
106  diff = matrixmult(g1rot, transpose(g2rot))
107  if abs(diff[0][0] - 1.) > sqrtepsilon or abs(diff[1][1] - 1.) > sqrtepsilon or abs(diff[2][2] - 1.) > sqrtepsilon or \
108  abs(diff[0][1]) > epsilon or abs(diff[0][2]) > epsilon or abs(diff[1][2]) > epsilon:
109  print("%s %s rotation difference: %s(%g, %g, %g) - %s(%g, %g, %g) = %s" % \
110  (which, str(key), g1type, g1a, g1b, g1c, g2type, g2a, g2b, g2c, str(diff)))
111 
112 loopover("DT")
113 loopover("CSC")
114 
115 

References funct.abs(), matrixmult(), print(), rotFromEuler(), rotFromPhi(), str, and transpose().

◆ matrixmult()

def geometryDiff.matrixmult (   a,
  b 
)

Definition at line 36 of file geometryDiff.py.

36 def matrixmult(a, b):
37  return [[sum([i*j for i, j in zip(row, col)]) for col in zip(*b)] for row in a]
38 

References ComparisonHelper.zip().

Referenced by loopover(), and rotFromPhi().

◆ rotFromEuler()

def geometryDiff.rotFromEuler (   g)

Definition at line 55 of file geometryDiff.py.

55 def rotFromEuler(g):
56  s1, s2, s3 = sin(g.alpha), sin(g.beta), sin(g.gamma)
57  c1, c2, c3 = cos(g.alpha), cos(g.beta), cos(g.gamma)
58  return [[c2 * c3, c1 * s3 + s1 * s2 * c3, s1 * s3 - c1 * s2 * c3,],
59  [-c2 * s3, c1 * c3 - s1 * s2 * s3, s1 * c3 + c1 * s2 * s3,],
60  [s2, -s1 * c2, c1 * c2, ]]
61 

References funct.cos(), and funct.sin().

Referenced by loopover().

◆ rotFromPhi()

def geometryDiff.rotFromPhi (   g)

Definition at line 42 of file geometryDiff.py.

42 def rotFromPhi(g):
43  phix, phiy, phiz = g.phix, g.phiy, g.phiz
44  rotX = [[1., 0., 0., ],
45  [0., cos(phix), sin(phix),],
46  [0., -sin(phix), cos(phix),]]
47  rotY = [[cos(phiy), 0., -sin(phiy),],
48  [0., 1., 0., ],
49  [sin(phiy), 0., cos(phiy),]]
50  rotZ = [[cos(phiz), sin(phiz), 0., ],
51  [-sin(phiz), cos(phiz), 0., ],
52  [0., 0., 1., ]]
53  return matrixmult(rotX, matrixmult(rotY, rotZ))
54 

References funct.cos(), matrixmult(), and funct.sin().

Referenced by loopover().

◆ transpose()

def geometryDiff.transpose (   a)

Variable Documentation

◆ args

geometryDiff.args

Definition at line 11 of file geometryDiff.py.

◆ epsilon

geometryDiff.epsilon = 1e-6

Definition at line 26 of file geometryDiff.py.

Referenced by ReferenceTrajectory.addMaterialEffectsCurvlinGbl(), ReferenceTrajectory.addMaterialEffectsLocalGbl(), trklet::VarAdjustK.adjust(), almost_equal(), GlobalTrackerMuonAlignment.analyzeTrackTrack(), GlobalTrackerMuonAlignment.analyzeTrackTrajectory(), trklet::TrackletCalculatorDisplaced.approxprojdisk(), GeneralBinFinderInPhi< T >.binIndex(), magneticfield::bSlab.bSlab(), TrackWithHistory.checkAtEnd(), TauDiscriminantCutMultiplexerT< TauType, TauTypeRef, ParentClass >.discriminate(), CMSCGEN.dNdEmudEnu(), IntegralOverPhiFunction.DoEval(), IntegrandThetaFunction.DoEval(), DTSegment4DQuality.dqmAnalyze(), TMultiDimFet.EvalControl(), KinematicPerigeeConversions.extendedPerigeeFromKinematicParameters(), DAClusterizerInZ_vect.fill(), DAClusterizerInZT_vect.fill(), Thrust.finalAxis(), PerigeeConversions.ftsToPerigeeParameters(), funct::GaussLegendreIntegrator.GaussLegendreIntegrator(), GEMEfficiencyAnalyzer.GEMEfficiencyAnalyzer(), PixelInactiveAreaFinder.getPhiSpanBarrel(), PixelInactiveAreaFinder.getPhiSpanEndcap(), ConversionProducer.getTrackImpactPosition(), AlignmentParameterStore.hierarchyConstraints(), SmartPropagator.initTkVolume(), HiPuRhoProducer.inputTowers(), VirtualJetProducer.inputTowers(), CSCLayerGeometry.inside(), SimpleNavigationSchool.linkNextLargerLayer(), SimpleNavigationSchool.linkNextLayerInGroup(), angle0to2pi.make0To2pi(), DTTopology.onWhichBorder(), DTTopology.onWhichBorder_old(), CMSInsideOutAlgorithm::ListIteratorLesserByDeltaR.operator()(), NumericSafeLessByEt< T >.operator()(), NumericSafeLessByPt< T >.operator()(), NumericSafeGreaterByEt< T >.operator()(), NumericSafeGreaterByPt< T >.operator()(), DTSegmentCand.operator==(), SimpleNavigationSchool.outerRadiusIncrease(), RecHitPropagator.propagate(), SteppingHelixPropagator.propagate(), tauImpactParameter::ErrorMatrixPropagator.propagateError(), SiLinearChargeDivider.readPulseShape(), FixedFlatOccupancy1d.set_epsilon_max(), CSC01.set_epsilon_max(), FixedFlatOccupancy1d.set_epsilon_min(), NAEquationSolver< Function >.SetTolerance(), HLLHCEvtVtxGenerator.sigma(), SmartPropagator.SmartPropagator(), DAClusterizerInZ.split(), DAClusterizerInZ_vect.split(), DAClusterizerInZ.splitAll(), muonisolation::NominalEfficiencyThresholds.thresholdValueForEfficiency(), trklet::VarAdjustK.VarAdjustK(), and trklet::VarAdjustKR.VarAdjustKR().

◆ file

geometryDiff.file

Definition at line 13 of file geometryDiff.py.

◆ geom1

geometryDiff.geom1 = MuonGeometry(file(args[0]))

Definition at line 30 of file geometryDiff.py.

Referenced by HGCalDigiValidation.analyze().

◆ geom2

geometryDiff.geom2 = MuonGeometry(file(args[1]))

Definition at line 31 of file geometryDiff.py.

◆ opts

geometryDiff.opts = dict(opts)

◆ sqrtepsilon

geometryDiff.sqrtepsilon = sqrt(epsilon)

Definition at line 34 of file geometryDiff.py.

◆ usage

geometryDiff.usage = "Usage: geometryDiff.py [-h|--help] [-e|--epsilon epsilon] geometry1.xml geometry2.xml"

Definition at line 8 of file geometryDiff.py.

geometryDiff.transpose
def transpose(a)
Definition: geometryDiff.py:39
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
str
#define str(s)
Definition: TestProcessor.cc:52
geometryDiff.matrixmult
def matrixmult(a, b)
Definition: geometryDiff.py:36
geometryDiff.rotFromPhi
def rotFromPhi(g)
Definition: geometryDiff.py:42
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
geometryDiff.rotFromEuler
def rotFromEuler(g)
Definition: geometryDiff.py:55
ComparisonHelper::zip
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
Definition: L1TStage2CaloLayer1.h:41
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
geometryDiff.loopover
def loopover(which)
Definition: geometryDiff.py:62