Skip to content

Commit

Permalink
Merge pull request #18699 from cschomak/CMSSW_9_1_X_GeometryCompariso…
Browse files Browse the repository at this point in the history
…nUpdates

Small bugfix and several new features for the geometry comparison tool
  • Loading branch information
cmsbuild committed May 15, 2017
2 parents 393df83 + 5e103f3 commit 7a463e8
Show file tree
Hide file tree
Showing 8 changed files with 771 additions and 37 deletions.
21 changes: 9 additions & 12 deletions Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc
Expand Up @@ -299,7 +299,7 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup){
}
}
else{
std::cout << "Error: Module list not found! Please verify that given list exists!" << std::endl;
edm::LogInfo("TrackerGeometryCompare") << "Error: Module list not found! Please verify that given list exists!";
}

//declare alignments
Expand Down Expand Up @@ -382,15 +382,12 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup){
iSetup.get<PTrackerParametersRcd>().get( ptp );
TrackerGeomBuilderFromGeometricDet trackerBuilder;

edm::ESHandle<Alignments> globalPositionRcd;
iSetup.get<TrackerDigiGeometryRecord>().getRecord<GlobalPositionRcd>().get(globalPositionRcd);

//reference tracker
TrackerGeometry* theRefTracker = trackerBuilder.build(&*theGeometricDet, *ptp, tTopo );
if (_inputFilename1 != "IDEAL"){
GeometryAligner aligner1;
aligner1.applyAlignments<TrackerGeometry>( &(*theRefTracker), &(*alignments1), &(*alignmentErrors1),
align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker)));
AlignTransform());
}
referenceTracker = new AlignableTracker(&(*theRefTracker), tTopo);
//referenceTracker->setSurfaceDeformation(surfDef1, true) ;
Expand All @@ -413,7 +410,7 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup){
_inputTree11->SetBranchAddress("dpar", &p_inputDpar1);

unsigned int nEntries11 = _inputTree11->GetEntries();
edm::LogInfo("TrackerGeometryCompare") << " nentries11 = " << nEntries11 << std::endl ;
edm::LogInfo("TrackerGeometryCompare") << " nentries11 = " << nEntries11;
for (unsigned int iEntry = 0; iEntry < nEntries11; ++iEntry) {
_inputTree11->GetEntry(iEntry) ;

Expand All @@ -431,7 +428,7 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup){
if (_inputFilename2 != "IDEAL"){
GeometryAligner aligner2;
aligner2.applyAlignments<TrackerGeometry>( &(*theCurTracker), &(*alignments2), &(*alignmentErrors2),
align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker)));
AlignTransform());
}
currentTracker = new AlignableTracker(&(*theCurTracker), tTopo);

Expand All @@ -445,7 +442,7 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup){
_inputTree12->SetBranchAddress("dpar", &p_inputDpar2);

unsigned int nEntries12 = _inputTree12->GetEntries();
edm::LogInfo("TrackerGeometryCompare") << " nentries12 = " << nEntries12 << std::endl ;
edm::LogInfo("TrackerGeometryCompare") << " nentries12 = " << nEntries12;
for (unsigned int iEntry = 0; iEntry < nEntries12; ++iEntry) {
_inputTree12->GetEntry(iEntry) ;

Expand Down Expand Up @@ -695,13 +692,13 @@ void TrackerGeometryCompare::setCommonTrackerSystem(){
align::RotationType rot = align::toMatrix( dOmega );
align::GlobalVector theR = _TrackerCommonT;

std::cout << "what we get from overlaying the pixels..." << theR << ", " << rot << std::endl;
edm::LogInfo("TrackerGeometryCompare") << "what we get from overlaying the pixels..." << theR << ", " << rot;

//transform to the Tracker System
align::PositionType trackerCM = currentTracker->globalPosition();
align::GlobalVector cmDiff( trackerCM.x()-_TrackerCommonCM.x(), trackerCM.y()-_TrackerCommonCM.y(), trackerCM.z()-_TrackerCommonCM.z() );

std::cout << "Pixel CM: " << _TrackerCommonCM << ", tracker CM: " << trackerCM << std::endl;
edm::LogInfo("TrackerGeometryCompare") << "Pixel CM: " << _TrackerCommonCM << ", tracker CM: " << trackerCM;

//adjust translational difference factoring in different rotational CM
//needed because rotateInGlobalFrame is about CM of alignable, not Tracker
Expand All @@ -713,7 +710,7 @@ void TrackerGeometryCompare::setCommonTrackerSystem(){
TrackerCommonTR(1) = theRprime.x(); TrackerCommonTR(2) = theRprime.y(); TrackerCommonTR(3) = theRprime.z();
TrackerCommonTR(4) = _TrackerCommonR.x(); TrackerCommonTR(5) = _TrackerCommonR.y(); TrackerCommonTR(6) = _TrackerCommonR.z();

std::cout << "and after the transformation: " << TrackerCommonTR << std::endl;
edm::LogInfo("TrackerGeometryCompare") << "and after the transformation: " << TrackerCommonTR;

align::moveAlignable(currentTracker, TrackerCommonTR );

Expand Down Expand Up @@ -1059,7 +1056,7 @@ void TrackerGeometryCompare::fillIdentifiers( int subdetlevel, int rawid, const
}
default:
{
std::cout << "Error: bad subdetid!!" << std::endl;
edm::LogInfo("TrackerGeometryCompare") << "Error: bad subdetid!!";
break;
}

Expand Down
Expand Up @@ -166,7 +166,7 @@ void TrackerGeometryIntoNtuples::analyze(const edm::Event& iEvent, const edm::Ev
const TrackerTopology* const tTopo = tTopoHandle.product();


edm::LogInfo("beginJob") << "Begin Job" << std::endl;
edm::LogInfo("beginJob") << "Begin Job";

//accessing the initial geometry
edm::ESHandle<GeometricDet> theGeometricDet;
Expand Down
Expand Up @@ -132,7 +132,7 @@ def getCompares( self ):
for section in self.sections():
if "compare:" in section:
self.checkInput(section,
knownSimpleOptions = ["levels", "dbOutput","moduleList","modulesToPlot","useDefaultRange","plotOnlyGlobal","plotPng",
knownSimpleOptions = ["levels", "dbOutput","moduleList","modulesToPlot","useDefaultRange","plotOnlyGlobal","plotPng","makeProfilePlots",
"dx_min","dx_max","dy_min","dy_max","dz_min","dz_max","dr_min","dr_max","rdphi_min","rdphi_max",
"dalpha_min","dalpha_max","dbeta_min","dbeta_max","dgamma_min","dgamma_max",
"jobmode", "3DSubdetector1", "3Dubdetector2", "3DTranslationalScaleFactor", "jobid"])
Expand Down
Expand Up @@ -34,6 +34,7 @@ def __init__( self, valName, alignment, referenceAlignment,
"useDefaultRange":"false",
"plotOnlyGlobal":"false",
"plotPng":"true",
"makeProfilePlots":"true",
"dx_min":"-99999",
"dx_max":"-99999",
"dy_min":"-99999",
Expand Down Expand Up @@ -157,7 +158,7 @@ def createScript(self, path):
"/scripts/GeometryComparisonPlotter.cc .\n"
"root -b -q 'comparisonScript.C+(\""
".oO[name]Oo..Comparison_common"+name+".root\",\""
"./\",\".oO[modulesToPlot]Oo.\",\".oO[alignmentName]Oo.\",\".oO[reference]Oo.\",\".oO[useDefaultRange]Oo.\",\".oO[plotOnlyGlobal]Oo.\",\".oO[plotPng]Oo.\""+y_ranges+")'\n"
"./\",\".oO[modulesToPlot]Oo.\",\".oO[alignmentName]Oo.\",\".oO[reference]Oo.\",.oO[useDefaultRange]Oo.,.oO[plotOnlyGlobal]Oo.,.oO[plotPng]Oo.,.oO[makeProfilePlots]Oo."+y_ranges+")'\n"
"rfcp "+path+"/TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C .\n"
"root -l -b -q TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C+\n")
if self.copyImages:
Expand Down Expand Up @@ -206,6 +207,11 @@ def createScript(self, path):
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")

repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name "
"\"*.tex\" -print | xargs -I {} bash -c"
" \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
".Comparison_common"+name+"_Images/\" \n")
repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name "
"\"TkMap_SurfDeform*.pdf\" -print | xargs -I {} bash -c"
Expand Down
Expand Up @@ -86,8 +86,8 @@
process.load("Alignment.OfflineValidation.TrackerGeometryCompare_cfi")
# the input "IDEAL" is special indicating to use the ideal geometry of the release
process.TrackerGeometryCompare.inputROOTFile1 = '.oO[comparedGeometry]Oo.'
process.TrackerGeometryCompare.inputROOTFile2 = '.oO[referenceGeometry]Oo.'
process.TrackerGeometryCompare.inputROOTFile1 = '.oO[referenceGeometry]Oo.'
process.TrackerGeometryCompare.inputROOTFile2 = '.oO[comparedGeometry]Oo.'
process.TrackerGeometryCompare.moduleList = '.oO[moduleListBase]Oo.'
process.TrackerGeometryCompare.outputFile = ".oO[name]Oo..Comparison_common.oO[common]Oo..root"
Expand Down

0 comments on commit 7a463e8

Please sign in to comment.