From c43815cda4b12db58c379987a04e1ba5490b7b97 Mon Sep 17 00:00:00 2001 From: Gregor Mittag Date: Tue, 12 Sep 2017 22:39:47 +0200 Subject: [PATCH 1/4] Fix geometry centering feature and avoid moving reference alignment. --- .../OfflineValidation/plugins/TrackerGeometryCompare.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc index 8b9542fdd7930..8679578decf32 100644 --- a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc +++ b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc @@ -633,7 +633,7 @@ void TrackerGeometryCompare::compareGeometries(Alignable* refAli, Alignable* cur lWtotal.set(0.,0.,0.); for (int i = 0; i < 100; i++){ - AlgebraicVector diff = align::diffAlignables(curAli,refAli, _weightBy, _weightById, _weightByIdVector); + AlgebraicVector diff = align::diffAlignables(refAli, curAli, _weightBy, _weightById, _weightByIdVector); CLHEP::Hep3Vector dR(diff[0],diff[1],diff[2]); Rtotal+=dR; CLHEP::Hep3Vector dW(diff[3],diff[4],diff[5]); @@ -645,9 +645,9 @@ void TrackerGeometryCompare::compareGeometries(Alignable* refAli, Alignable* cur lRtotal.set(diff[6],diff[7],diff[8]); lWtotal.set(diff[9],diff[10],diff[11]); - align::moveAlignable(refAli, diff); + align::moveAlignable(curAli, diff); float tolerance = 1e-7; - AlgebraicVector check = align::diffAlignables(curAli,refAli, _weightBy, _weightById, _weightByIdVector); + AlgebraicVector check = align::diffAlignables(refAli, curAli, _weightBy, _weightById, _weightByIdVector); align::GlobalVector checkR(check[0],check[1],check[2]); align::GlobalVector checkW(check[3],check[4],check[5]); if ((checkR.mag() > tolerance)||(checkW.mag() > tolerance)){ @@ -731,7 +731,7 @@ void TrackerGeometryCompare::diffCommonTrackerSystem(Alignable *refAli, Alignabl CLHEP::Hep3Vector Rtotal, Wtotal; Rtotal.set(0.,0.,0.); Wtotal.set(0.,0.,0.); - AlgebraicVector diff = align::diffAlignables(curAli,refAli, _weightBy, _weightById, _weightByIdVector); + AlgebraicVector diff = align::diffAlignables(refAli, curAli, _weightBy, _weightById, _weightByIdVector); CLHEP::Hep3Vector dR(diff[0],diff[1],diff[2]); Rtotal+=dR; CLHEP::Hep3Vector dW(diff[3],diff[4],diff[5]); From ca01568a13e95f98a8f81f8b931ab72997541f92 Mon Sep 17 00:00:00 2001 From: Gregor Mittag Date: Wed, 13 Sep 2017 17:32:59 +0200 Subject: [PATCH 2/4] Migrate geometry-centering config to phase-1 geometry. --- .../OfflineValidation/test/GeometryCentering_cfg.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Alignment/OfflineValidation/test/GeometryCentering_cfg.py b/Alignment/OfflineValidation/test/GeometryCentering_cfg.py index 8bb988361a155..a541bbb8c9cbe 100644 --- a/Alignment/OfflineValidation/test/GeometryCentering_cfg.py +++ b/Alignment/OfflineValidation/test/GeometryCentering_cfg.py @@ -9,18 +9,18 @@ ### needed to get the geometry from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag,"auto:run2_design") +process.GlobalTag = GlobalTag(process.GlobalTag,"auto:phase1_2017_design") from CondCore.CondDB.CondDB_cfi import * CondDBAlignment = CondDB.clone(connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS')) -### example starting MC geometry that is known to be off-centered +### example starting data geometry that is known to have an off-centered BPIX process.ZeroGeom = cms.ESSource("PoolDBESSource", CondDBAlignment, timetype = cms.string("runnumber"), toGet = cms.VPSet(cms.PSet(record = cms.string('TrackerAlignmentRcd'), - tag = cms.string('TrackerAlignment_Asymptotic_Run2016_v1_mc') + tag = cms.string('TrackerAlignment_StartUp17_v11') ) ) ) @@ -31,7 +31,7 @@ CondDBAPE, timetype = cms.string("runnumber"), toGet = cms.VPSet(cms.PSet(record = cms.string('TrackerAlignmentErrorExtendedRcd'), - tag = cms.string('TrackerIdealGeometryErrorsExtended210_mc') + tag = cms.string('TrackerAlignmentErrorsExtended_Upgrade2017_design_v0') ) ) ) @@ -56,7 +56,7 @@ process.load("Alignment.OfflineValidation.TrackerGeometryCompare_cfi") process.TrackerGeometryCompare.inputROOTFile1 = 'IDEAL' process.TrackerGeometryCompare.inputROOTFile2 = GeometryIntoNtuplesRootFile -process.TrackerGeometryCompare.setCommonTrackerSystem = "TPBBarrel" # for MC +process.TrackerGeometryCompare.setCommonTrackerSystem = "P1PXBBarrel" # for MC #process.TrackerGeometryCompare.setCommonTrackerSystem = "TOBBarrel" # for Data process.TrackerGeometryCompare.levels = [] process.TrackerGeometryCompare.writeToDB = True @@ -66,7 +66,7 @@ #fileName=cms.string("TOBCenteredOutputComparison.root") #for Data ) -CondDBoutput=CondDB.clone(connect = cms.string('sqlite_file:TrackerAlignment_Asymptotic_Run2016_v1_mc_Centred.db')) +CondDBoutput=CondDB.clone(connect = cms.string('sqlite_file:TrackerAlignment_StartUp17_v11_BPIX-Centred.db')) process.PoolDBOutputService = cms.Service("PoolDBOutputService", CondDBoutput, From fa210ac0f7cd3068e8f3614bb7163bfd710b644e Mon Sep 17 00:00:00 2001 From: Gregor Mittag Date: Wed, 13 Sep 2017 17:39:46 +0200 Subject: [PATCH 3/4] Add missing linebreak. This way one avoids that the warning "hides" other output which was previously printed on the same line. --- Configuration/AlCa/python/GlobalTag.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/AlCa/python/GlobalTag.py b/Configuration/AlCa/python/GlobalTag.py index 7546a721d7abd..ccec5b4895966 100644 --- a/Configuration/AlCa/python/GlobalTag.py +++ b/Configuration/AlCa/python/GlobalTag.py @@ -69,7 +69,7 @@ def GlobalTag(essource = None, globaltag = None, conditions = None): if globaltag not in autoCond: raise Exception('no correspondence for '+globaltag+'\navailable keys are\n'+','.join(autoCond.keys())) if 'phase1_2017_design' == globaltag: - sys.stderr.write('Warning: %s now points to %s. This has reco- Beamspot centered to (0,0,0)'%(globaltag,autoCond[globaltag])) + sys.stderr.write('Warning: %s now points to %s. This has reco-Beamspot centered to (0,0,0)\n'%(globaltag,autoCond[globaltag])) autoKey = autoCond[globaltag] if isinstance(autoKey, tuple) or isinstance(autoKey, list): globaltag = autoKey[0] From 57f53ec81bd37cb04425ffbdd7046b99f9e5ec89 Mon Sep 17 00:00:00 2001 From: Gregor Mittag Date: Wed, 13 Sep 2017 18:02:57 +0200 Subject: [PATCH 4/4] Apply code-checks. --- .../plugins/TrackerGeometryCompare.cc | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc index 8679578decf32..2c9eff1dfd123 100644 --- a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc +++ b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc @@ -59,23 +59,23 @@ #include TrackerGeometryCompare::TrackerGeometryCompare(const edm::ParameterSet& cfg) : - referenceTracker(0), - dummyTracker(0), - currentTracker(0), + referenceTracker(nullptr), + dummyTracker(nullptr), + currentTracker(nullptr), theSurveyIndex(0), - theSurveyValues(0), - theSurveyErrors(0), + theSurveyValues(nullptr), + theSurveyErrors(nullptr), _levelStrings(cfg.getUntrackedParameter< std::vector >("levels")), _writeToDB(cfg.getUntrackedParameter("writeToDB")), _commonTrackerLevel(align::invalid), - _moduleListFile(0), + _moduleListFile(nullptr), _moduleList(0), - _inputRootFile1(0), - _inputRootFile2(0), - _inputTree01(0), - _inputTree02(0), - _inputTree11(0), - _inputTree12(0), + _inputRootFile1(nullptr), + _inputRootFile2(nullptr), + _inputTree01(nullptr), + _inputTree02(nullptr), + _inputTree11(nullptr), + _inputTree12(nullptr), m_nBins(10000), m_rangeLow(-.1), m_rangeHigh(.1), @@ -702,7 +702,7 @@ void TrackerGeometryCompare::setCommonTrackerSystem(){ //adjust translational difference factoring in different rotational CM //needed because rotateInGlobalFrame is about CM of alignable, not Tracker - align::GlobalVector::BasicVectorType lpvgf = cmDiff.basicVector(); + const align::GlobalVector::BasicVectorType& lpvgf = cmDiff.basicVector(); align::GlobalVector moveV( rot.multiplyInverse(lpvgf) - lpvgf); align::GlobalVector theRprime(theR + moveV); @@ -920,7 +920,7 @@ void TrackerGeometryCompare::surveyToTracker(AlignableTracker* ali, Alignments* for(std::vector::iterator k = rcdAlis.begin(); k != rcdAlis.end(); k++){ const SurveyDet* surveyInfo = (*k)->survey(); - align::PositionType pos(surveyInfo->position()); + const align::PositionType& pos(surveyInfo->position()); align::RotationType rot(surveyInfo->rotation()); CLHEP::Hep3Vector clhepVector(pos.x(),pos.y(),pos.z()); CLHEP::HepRotation clhepRotation( CLHEP::HepRep3x3(rot.xx(),rot.xy(),rot.xz(),rot.yx(),rot.yy(),rot.yz(),rot.zx(),rot.zy(),rot.zz()));