CMS 3D CMS Logo

Functions | Variables

makeMuonMisalignmentScenario Namespace Reference

Functions

def cholesky
def mmult
 Print out user's choices as diagnostics.
def mtrans
def mvdot
def random6dof
 Generate correlated random misalignments for all chambers.

Variables

tuple ave_phix = sum_phix/float(len(misal))
tuple ave_phixphix = sum_phixphix/float(len(misal))
tuple ave_phixphiy = sum_phixphiy/float(len(misal))
tuple ave_phixphiz = sum_phixphiz/float(len(misal))
tuple ave_phiy = sum_phiy/float(len(misal))
tuple ave_phiyphiy = sum_phiyphiy/float(len(misal))
tuple ave_phiyphiz = sum_phiyphiz/float(len(misal))
tuple ave_phiz = sum_phiz/float(len(misal))
tuple ave_phizphiz = sum_phizphiz/float(len(misal))
tuple ave_x = sum_x/float(len(misal))
tuple ave_xphix = sum_xphix/float(len(misal))
tuple ave_xphiy = sum_xphiy/float(len(misal))
tuple ave_xphiz = sum_xphiz/float(len(misal))
tuple ave_xx = sum_xx/float(len(misal))
tuple ave_xy = sum_xy/float(len(misal))
tuple ave_xz = sum_xz/float(len(misal))
tuple ave_y = sum_y/float(len(misal))
tuple ave_yphix = sum_yphix/float(len(misal))
tuple ave_yphiy = sum_yphiy/float(len(misal))
tuple ave_yphiz = sum_yphiz/float(len(misal))
tuple ave_yy = sum_yy/float(len(misal))
tuple ave_yz = sum_yz/float(len(misal))
tuple ave_z = sum_z/float(len(misal))
tuple ave_zphix = sum_zphix/float(len(misal))
tuple ave_zphiy = sum_zphiy/float(len(misal))
tuple ave_zphiz = sum_zphiz/float(len(misal))
tuple ave_zz = sum_zz/float(len(misal))
tuple cfgfile = file(outputName + "_convert_cfg.py", "w")
 Convert it to an SQLite file with CMSSW.
tuple chomat = cholesky(matrix)
string components = "xx"
tuple globalape = mmult(rot, mmult(localape, mtrans(rot)))
list globalxx = globalape[0]
list globalxy = globalape[0]
list globalxz = globalape[0]
list globalyy = globalape[1]
list globalyz = globalape[1]
list globalzz = globalape[2]
list localape = [[xx, xy, xz], [xy, yy, yz], [xz, yz, zz]]
list matrix
dictionary misal = {}
list outputName = args[0]
tuple parser = OptionParser(usage="Usage: python %prog outputName [options] (default is unit matrix times 1e-15)")
 Get variances and covariances from the commandline.
list rot = rotation[system, whendcap, station, ring, sector]
int sum_phix = 0
int sum_phixphix = 0
int sum_phixphiy = 0
int sum_phixphiz = 0
int sum_phiy = 0
int sum_phiyphiy = 0
int sum_phiyphiz = 0
int sum_phiz = 0
int sum_phizphiz = 0
int sum_x = 0
 More diagnostics.
int sum_xphix = 0
int sum_xphiy = 0
int sum_xphiz = 0
int sum_xx = 0
int sum_xy = 0
int sum_xz = 0
int sum_y = 0
int sum_yphix = 0
int sum_yphiy = 0
int sum_yphiz = 0
int sum_yy = 0
int sum_yz = 0
int sum_z = 0
int sum_zphix = 0
int sum_zphiy = 0
int sum_zphiz = 0
int sum_zz = 0
tuple txtfile = file(outputName + "_correlations.txt", "w")
 Delete all three files at once to make sure the user never sees stale data (e.g.
tuple xmlfile = file(outputName + ".xml", "w")
 Make an XML representation of the misalignment.

Function Documentation

def makeMuonMisalignmentScenario::cholesky (   A)
Cholesky decomposition of the correlation matrix to properly normalize the transformed random deviates

Definition at line 110 of file makeMuonMisalignmentScenario.py.

00111                :
00112     """Cholesky decomposition of the correlation matrix to properly normalize the transformed random deviates"""
00113 
00114     # A = L * D * L^T = (L * D^0.5) * (L * D^0.5)^T where we want (L * D^0.5), the "square root" of A
00115     # find L and D from A using recurrence relations
00116     L = {}
00117     D = {}
00118     for j in range(len(A[0])):
00119         D[j] = A[j][j] - sum([L[j,k]**2 * D[k] for k in range(j)])
00120         for i in range(len(A)):
00121             if i > j:
00122                 L[i,j] = (A[i][j] - sum([L[i,k] * L[j,k] * D[k] for k in range(j)])) / D[j]
00123 
00124     L = [[    1.,     0.,     0.,     0.,     0., 0.],
00125          [L[1,0],     1.,     0.,     0.,     0., 0.],
00126          [L[2,0], L[2,1],     1.,     0.,     0., 0.],
00127          [L[3,0], L[3,1], L[3,2],     1.,     0., 0.],
00128          [L[4,0], L[4,1], L[4,2], L[4,1],     1., 0.],
00129          [L[5,0], L[5,1], L[5,2], L[5,1], L[5,0], 1.]]
00130 
00131     Dsqrt = [[sqrt(D[0]),         0.,          0.,         0.,         0.,         0.],
00132              [        0., sqrt(D[1]),          0.,         0.,         0.,         0.],
00133              [        0.,         0., sqrt(D[2]),          0.,         0.,         0.],
00134              [        0.,         0.,          0., sqrt(D[3]),         0.,         0.],
00135              [        0.,         0.,          0.,         0., sqrt(D[4]),         0.],
00136              [        0.,         0.,          0.,         0.,         0., sqrt(D[5])]]
00137 
00138     return mmult(L, Dsqrt)

def makeMuonMisalignmentScenario::mmult (   a,
  b 
)

Print out user's choices as diagnostics.

Some useful mathematical transformations (why don't we have access to numpy?)

Matrix multiplication: mmult([[11, 12], [21, 22]], [[-1, 0], [0, 1]]) returns [[-11, 12], [-21, 22]]

Definition at line 98 of file makeMuonMisalignmentScenario.py.

00099                :
00100     """Matrix multiplication: mmult([[11, 12], [21, 22]], [[-1, 0], [0, 1]]) returns [[-11, 12], [-21, 22]]"""
00101     return [[sum([i*j for i, j in zip(row, col)]) for col in zip(*b)] for row in a]

def makeMuonMisalignmentScenario::mtrans (   a)
Matrix transposition: mtrans([[11, 12], [21, 22]]) returns [[11, 21], [12, 22]]

Definition at line 106 of file makeMuonMisalignmentScenario.py.

00107              :
00108     """Matrix transposition: mtrans([[11, 12], [21, 22]]) returns [[11, 21], [12, 22]]"""
00109     return [[a[j][i] for j in range(len(a[i]))] for i in range(len(a))]

def makeMuonMisalignmentScenario::mvdot (   m,
  v 
)
Applies matrix m to vector v: mvdot([[-1, 0], [0, 1]], [12, 55]) returns [-12, 55]

Definition at line 102 of file makeMuonMisalignmentScenario.py.

00103                :
00104     """Applies matrix m to vector v: mvdot([[-1, 0], [0, 1]], [12, 55]) returns [-12, 55]"""
00105     return [i[0] for i in mmult(m, [[vi] for vi in v])]

def makeMuonMisalignmentScenario::random6dof ( )

Generate correlated random misalignments for all chambers.

Definition at line 150 of file makeMuonMisalignmentScenario.py.

00151                 :
00152     randomunit = [gauss(0., 1.), gauss(0., 1.), gauss(0., 1.), gauss(0., 1.), gauss(0., 1.), gauss(0., 1.)]
00153     return mvdot(chomat, randomunit)


Variable Documentation

Definition at line 236 of file makeMuonMisalignmentScenario.py.

Definition at line 255 of file makeMuonMisalignmentScenario.py.

Definition at line 256 of file makeMuonMisalignmentScenario.py.

Definition at line 257 of file makeMuonMisalignmentScenario.py.

Definition at line 237 of file makeMuonMisalignmentScenario.py.

Definition at line 258 of file makeMuonMisalignmentScenario.py.

Definition at line 259 of file makeMuonMisalignmentScenario.py.

Definition at line 238 of file makeMuonMisalignmentScenario.py.

Definition at line 260 of file makeMuonMisalignmentScenario.py.

Definition at line 233 of file makeMuonMisalignmentScenario.py.

Definition at line 243 of file makeMuonMisalignmentScenario.py.

Definition at line 244 of file makeMuonMisalignmentScenario.py.

Definition at line 245 of file makeMuonMisalignmentScenario.py.

Definition at line 240 of file makeMuonMisalignmentScenario.py.

Definition at line 241 of file makeMuonMisalignmentScenario.py.

Definition at line 242 of file makeMuonMisalignmentScenario.py.

Definition at line 234 of file makeMuonMisalignmentScenario.py.

Definition at line 248 of file makeMuonMisalignmentScenario.py.

Definition at line 249 of file makeMuonMisalignmentScenario.py.

Definition at line 250 of file makeMuonMisalignmentScenario.py.

Definition at line 246 of file makeMuonMisalignmentScenario.py.

Definition at line 247 of file makeMuonMisalignmentScenario.py.

Definition at line 235 of file makeMuonMisalignmentScenario.py.

Definition at line 252 of file makeMuonMisalignmentScenario.py.

Definition at line 253 of file makeMuonMisalignmentScenario.py.

Definition at line 254 of file makeMuonMisalignmentScenario.py.

Definition at line 251 of file makeMuonMisalignmentScenario.py.

tuple makeMuonMisalignmentScenario::cfgfile = file(outputName + "_convert_cfg.py", "w")

Convert it to an SQLite file with CMSSW.

Definition at line 350 of file makeMuonMisalignmentScenario.py.

Definition at line 146 of file makeMuonMisalignmentScenario.py.

tuple makeMuonMisalignmentScenario::globalape = mmult(rot, mmult(localape, mtrans(rot)))

Definition at line 322 of file makeMuonMisalignmentScenario.py.

Definition at line 323 of file makeMuonMisalignmentScenario.py.

Definition at line 324 of file makeMuonMisalignmentScenario.py.

Definition at line 325 of file makeMuonMisalignmentScenario.py.

Definition at line 326 of file makeMuonMisalignmentScenario.py.

Definition at line 327 of file makeMuonMisalignmentScenario.py.

Definition at line 328 of file makeMuonMisalignmentScenario.py.

list makeMuonMisalignmentScenario::localape = [[xx, xy, xz], [xy, yy, yz], [xz, yz, zz]]

Definition at line 321 of file makeMuonMisalignmentScenario.py.

Initial value:
00001 [[   xx,    xy,    xz,    xphix,    xphiy,    xphiz],
00002           [   xy,    yy,    yz,    yphix,    yphiy,    yphiz],
00003           [   xz,    yz,    zz,    zphix,    zphiy,    zphiz],
00004           [xphix, yphix, zphix, phixphix, phixphiy, phixphiz],
00005           [xphiy, yphiy, zphiy, phixphiy, phiyphiy, phiyphiz],
00006           [xphiz, yphiz, zphiz, phixphiz, phiyphiz, phizphiz]]

Definition at line 139 of file makeMuonMisalignmentScenario.py.

Referenced by MuonErrorMatrix::adjust(), TestOutliers::analyze(), AlcaBeamMonitor::beginLuminosityBlock(), clone(), reco::GsfComponent5D::covariance(), reco::BeamSpot::covariance3D(), PhysicsTools::VarProcessor::deriv(), CSCSegAlgoDF::derivativeMatrix(), CSCSegAlgoSK::derivativeMatrix(), CSCSegAlgoShowering::derivativeMatrix(), CSCSegAlgoHitPruning::derivativeMatrix(), CSCSegAlgoTC::derivativeMatrix(), CSCSegAlgoST::derivativeMatrix(), AlcaBeamSpotFromDB::endLuminosityBlock(), CSCDbStripConditions::fetchNoisifier(), BSFitter::Fit(), BSFitter::Fit_d0phi(), BSFitter::Fit_d_likelihood(), BSFitter::Fit_d_z_likelihood(), BSFitter::Fit_dres_z_likelihood(), BSFitter::Fit_z_chi2(), BSFitter::Fit_z_likelihood(), get_transform(), DTMuonMillepede::getbcsMatrix(), DTMuonMillepede::getbqcMatrix(), DTMuonMillepede::getbsurveyMatrix(), DTMuonMillepede::getCcsMatrix(), DTMuonMillepede::getCqcMatrix(), DTMuonMillepede::getCsurveyMatrix(), DTMuonMillepede::getLagMatrix(), matrixSaver::getMatrix(), FWGeometry::getMatrix(), matrixSaver::getMatrixVector(), reco::GsfComponent5D::GsfComponent5D(), FWGeometry::initMap(), FWGeometry::loadMap(), PhysicsTools::loadMatrix(), CSCConfigurableStripConditions::makeNoisifier(), CombinedKinematicConstraint::parametersDerivative(), MultiTrackPointingKinematicConstraint::parametersDerivative(), MultiTrackVertexLinkKinematicConstraint::parametersDerivative(), DDStreamer::pos_read(), MultiTrackPointingKinematicConstraint::positionDerivative(), MultiTrackVertexLinkKinematicConstraint::positionDerivative(), CombinedKinematicConstraint::positionDerivative(), TKinFitter::printMatrix(), BeamSpotOnlineProducer::produce(), BeamSpotProducer::produce(), cms::HITrackVertexMaker::produceTracks(), KFBasedPixelFitter::MyBeamSpotHit::projectionMatrix(), HICTrajectoryBuilder::qualityFilter(), DTMuonSLToSL::returnbSLMatrix(), DTMuonSLToSL::returnCSLMatrix(), reco::BeamSpot::rotatedCovariance3D(), PVFitter::runBXFitter(), PVFitter::runFitter(), BeamFitter::runPVandTrkFitter(), PhysicsTools::saveMatrix(), GsfMatrixTools::trace(), SignCaloSpecificAlgo::usePreviousSignif(), ValidateGeometry::validateCSChamberGeometry(), ValidateGeometry::validateCSCLayerGeometry(), ValidateGeometry::validateDTChamberGeometry(), ValidateGeometry::validateDTLayerGeometry(), ValidateGeometry::validateRPCGeometry(), ValidateGeometry::validateTrackerGeometry(), CSCSegAlgoTC::weightMatrix(), CSCSegAlgoST::weightMatrix(), CSCSegAlgoShowering::weightMatrix(), CSCSegAlgoHitPruning::weightMatrix(), CSCSegAlgoSK::weightMatrix(), CSCSegAlgoDF::weightMatrix(), EcalTBWeightsXMLTranslator::writeChi2WeightMatrix(), and EcalTBWeightsXMLTranslator::writeWeightMatrix().

Definition at line 154 of file makeMuonMisalignmentScenario.py.

Definition at line 44 of file makeMuonMisalignmentScenario.py.

tuple makeMuonMisalignmentScenario::parser = OptionParser(usage="Usage: python %prog outputName [options] (default is unit matrix times 1e-15)")

Get variances and covariances from the commandline.

Definition at line 9 of file makeMuonMisalignmentScenario.py.

list makeMuonMisalignmentScenario::rot = rotation[system, whendcap, station, ring, sector]

Definition at line 320 of file makeMuonMisalignmentScenario.py.

Referenced by AlignableModifier::addAlignmentPositionErrorFromLocalRotation(), AlignableModifier::addAlignmentPositionErrorFromRotation(), TrackerGeometryCompare::addSurveyInfo(), AlignmentProducer::addSurveyInfo_(), MuonAlignmentInputSurveyDB::addSurveyInfo_(), AlignableBeamSpot::alignments(), AlignableDet::alignments(), AlignableDetUnit::alignments(), HcalCorrPFCalculation::analyze(), BeamSpotAlignmentParameters::apply(), RigidBodyAlignmentParameters::apply(), TwoBowedSurfacesAlignmentParameters::apply(), BowedSurfaceAlignmentParameters::apply(), CtfSpecialSeedGenerator::beginRun(), CylinderBuilderFromDet::build(), PixelTrackBuilder::build(), RPCGeometryBuilderFromCondDB::build(), RPCGeometryBuilderFromDDD::buildGeometry(), MagGeoBuilderFromDDD::buildInterpolator(), ConversionProducer::checkPhi(), TrackerGeometryCompare::compareGeometries(), MuonGeometryArrange::compareGeometries(), GCC11_FINAL::computeDisk(), BarrelDetLayer::computeSurface(), ForwardDetLayer::computeSurface(), MuRingForwardDoubleLayer::computeSurface(), DDHCalEndcapAlgo::constructGeneralVolume(), DDHCalBarrelAlgo::constructGeneralVolume(), DDHCalBarrelAlgo::constructInsideLayers(), DDHCalEndcapAlgo::constructInsideModule(), DDHCalEndcapAlgo::constructInsideModule0(), TSCPBuilderNoMaterial::createFTSatTransverseImpactPointCharged(), TGeoMgrFromDdd::createShape(), ResidualRefitting::cylExtrapTrkSam(), DDrot(), DDrotReflect(), align::diffAlignables(), TrackerGeometryCompare::diffCommonTrackerSystem(), align::diffRot(), MuonAlignmentInputXML::do_setposition(), Decay3Body::doDecay(), DDTECModuleAlgo::doPos(), DDEcalPreshowerAlgoTB::doSens(), DDTrackerZPosAlgo::execute(), DDHCalTBCableAlgo::execute(), DDHCalTBZposAlgo::execute(), DDTrackerLinearXY::execute(), DDPixBarLayerAlgo::execute(), DDTOBRodAlgo::execute(), DDTIDModuleAlgo::execute(), DDTrackerXYZPosAlgo::execute(), DDTrackerLinear::execute(), DDHCalLinearXY::execute(), DDTIDModulePosAlgo::execute(), DDHCalForwardAlgo::execute(), DDHCalFibreBundle::execute(), TrajectoryExtrapolatorToLine::extrapolate(), AnalyticalTrajectoryExtrapolatorToLine::extrapolateSingleState(), AnalyticalImpactPointExtrapolator::extrapolateSingleState(), MuonGeometryArrange::fillTree(), TrackerGeometryCompare::fillTree(), SurveyMisalignmentInput::getAlignableSurface(), CocoaDBMgr::GetAlignInfoFromOptO(), ALIUtils::getRotationAnglesFromMatrix(), EcalShowerProperties::getSurface(), SurveyDBUploader::getSurveyInfo(), ConversionProducer::getTrackImpactPosition(), RectangularEtaPhiTrackingRegion::hits(), CosmicTrackingRegion::hits(), TrackerBounds::initialize(), ECALBounds::initialize(), ConversionTrackEcalImpactPoint::initialize(), SmartPropagator::initTkVolume(), ClusterShapeHitFilter::isNormalOriented(), JacobianCartesianToLocal::JacobianCartesianToLocal(), JacobianCurvilinearToLocal::JacobianCurvilinearToLocal(), JacobianLocalToCartesian::JacobianLocalToCartesian(), JacobianLocalToCurvilinear::JacobianLocalToCurvilinear(), TopologyWorker::ludbrb(), MuonScenarioBuilder::moveChamberInSector(), MuRingForwardLayer::MuRingForwardLayer(), TransverseBoundPlaneFactory::operator()(), PerpendicularBoundPlaneBuilder::operator()(), PFGeometry::PFGeometry(), TrackKinematicStatePropagator::planeCrossing(), DDStreamer::pos_read(), PlotRecTracks::printRecTracks(), printRot(), DDLRotationSequence::processElement(), DDLRotationByAxis::processElement(), EcalShowerProperties::processTrack(), AlCaHOCalibProducer::produce(), MuonSimHitProducer::produce(), NavPropagator::propagateInVolume(), DDG4SolidConverter::pseudotrap(), GeometricDetLoader::putOne(), PGeometricDetBuilder::putOne(), AlignableDataIORoot::readAbsRaw(), AlignableDataIORoot::readRelRaw(), CocoaAnalyzer::ReadXMLFile(), TkConvValidator::recalculateMomentumAtFittedVertex(), MuonAlignment::recursiveCopySurveyToAlignment(), Alignable::rotateAroundGlobalX(), Alignable::rotateAroundGlobalY(), Alignable::rotateAroundGlobalZ(), Alignable::rotateAroundLocalX(), Alignable::rotateAroundLocalY(), Alignable::rotateAroundLocalZ(), BeamSpotAlignmentParameters::rotation(), DDCoreToDDXMLOutput::rotation(), RigidBodyAlignmentParameters::rotation(), global_angular_0::rotation(), MuonAlignment::saveCSCSurveyToDB(), MuonAlignment::saveDTSurveyToDB(), SurveyResidual::sensorResidual(), TrackerGeometryCompare::setCommonTrackerSystem(), SurveyAlignment::shiftSensors(), SeedFromNuclearInteraction::stateWithError(), CosmicMuonUtilities::stepPropagate(), TrackerGeometryCompare::surveyToTracker(), align::toAngles(), FrameChanger::toFrame(), TFitParticleEMomDev::transform(), TFitParticleEScaledMomDev::transform(), TFitParticleMCMomDev::transform(), TFitParticleMomDev::transform(), FrameChanger::transformPlane(), DDG4SolidConverter::trunctubs(), AlignableDataIO::writeAbsPos(), AlignableDataIORoot::writeAbsRaw(), MuonAlignmentOutputXML::writeComponents(), AlignableDataIO::writeOrgPos(), AlignableDataIO::writeRelPos(), and AlignableDataIORoot::writeRelRaw().

Definition at line 177 of file makeMuonMisalignmentScenario.py.

Definition at line 196 of file makeMuonMisalignmentScenario.py.

Definition at line 197 of file makeMuonMisalignmentScenario.py.

Definition at line 198 of file makeMuonMisalignmentScenario.py.

Definition at line 178 of file makeMuonMisalignmentScenario.py.

Definition at line 199 of file makeMuonMisalignmentScenario.py.

Definition at line 200 of file makeMuonMisalignmentScenario.py.

Definition at line 179 of file makeMuonMisalignmentScenario.py.

Definition at line 201 of file makeMuonMisalignmentScenario.py.

Definition at line 184 of file makeMuonMisalignmentScenario.py.

Definition at line 185 of file makeMuonMisalignmentScenario.py.

Definition at line 186 of file makeMuonMisalignmentScenario.py.

Definition at line 182 of file makeMuonMisalignmentScenario.py.

Definition at line 183 of file makeMuonMisalignmentScenario.py.

Definition at line 175 of file makeMuonMisalignmentScenario.py.

Definition at line 189 of file makeMuonMisalignmentScenario.py.

Definition at line 190 of file makeMuonMisalignmentScenario.py.

Definition at line 191 of file makeMuonMisalignmentScenario.py.

Definition at line 188 of file makeMuonMisalignmentScenario.py.

Definition at line 176 of file makeMuonMisalignmentScenario.py.

Definition at line 193 of file makeMuonMisalignmentScenario.py.

Definition at line 194 of file makeMuonMisalignmentScenario.py.

Definition at line 195 of file makeMuonMisalignmentScenario.py.

Definition at line 192 of file makeMuonMisalignmentScenario.py.

tuple makeMuonMisalignmentScenario::txtfile = file(outputName + "_correlations.txt", "w")

Delete all three files at once to make sure the user never sees stale data (e.g.

from a stopped process due to failed conversion) Print out the list of correlations

Definition at line 294 of file makeMuonMisalignmentScenario.py.

Referenced by TrackerMap::printall(), and TrackerMap::printonline().

Make an XML representation of the misalignment.

Definition at line 311 of file makeMuonMisalignmentScenario.py.

Referenced by QualityTester::beginRun(), and TrackerMap::printlayers().