Skip to content

Commit

Permalink
Merge pull request #9598 from dmcinerney/3DGeomCompRedo-PR-74X
Browse files Browse the repository at this point in the history
integrated 3D geometry comparison visualization into all-in-one tool
  • Loading branch information
cmsbuild committed Jun 16, 2015
2 parents 903fa6a + 76a675c commit ba34750
Show file tree
Hide file tree
Showing 8 changed files with 651 additions and 217 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ def __init__(self, name, config, runGeomComp = "1"):
self.condShorts = {
"TrackerAlignmentErrorExtendedRcd":
{"zeroAPE":{"connectString": ("frontier://FrontierProd"
"/CMS_COND_31X_FROM21X"),
"tagName": "TrackerIdealGeometryErrors210_mc",
"/CMS_CONDITIONS"),
"tagName": "TrackerAlignmentExtendedErr_2009_v2_express_IOVs",

"labelName": ""}}}
section = "alignment:%s"%name
if not config.has_section( section ):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def getCompares( self ):
if "compare:" in section:
self.checkInput(section,
knownSimpleOptions = ["levels", "dbOutput",
"jobmode"])
"jobmode", "3DSubdetector1", "3Dubdetector2", "3DTranslationalScaleFactor"])
levels = self.get( section, "levels" )
dbOutput = self.get( section, "dbOutput" )
compares[section.split(":")[1]] = ( levels, dbOutput )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
cd .oO[CMSSW_BASE]Oo./src
export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo.
eval `scramv1 ru -sh`
rfmkdir -p .oO[datadir]Oo. &>! /dev/null
#rfmkdir -p .oO[datadir]Oo. &>! /dev/null
#remove possible result file from previous runs
previous_results=$(cmsLs -l /store/caf/user/$USER/.oO[eosdir]Oo. | awk '{print $5}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,15 @@ def __init__( self, valName, alignment, referenceAlignment,
generated to create unique path names for the
individual validation instances.
"""
defaults = {
"3DSubdetector1":"1",
"3DSubdetector2":"2",
"3DTranslationalScaleFactor":"50"
}
mandatories = ["levels", "dbOutput"]
GenericValidation.__init__(self, valName, alignment, config, "compare", addMandatories = mandatories)
GenericValidation.__init__(self, valName, alignment, config,
"compare", addDefaults=defaults,
addMandatories = mandatories)
if not randomWorkdirPart == None:
self.randomWorkdirPart = randomWorkdirPart
self.referenceAlignment = referenceAlignment
Expand Down Expand Up @@ -60,7 +67,9 @@ def getRepMap(self, alignment = None):
"ROOTGeometry.root"),
"referenceGeometry": "IDEAL", # will be replaced later
# if not compared to IDEAL
"reference": referenceName
"reference": referenceName,
"referenceTitle": self.referenceAlignment.title,
"alignmentTitle": self.alignmentToValidate.title
})
if not referenceName == "IDEAL":
repMap["referenceGeometry"] = (".oO[reference]Oo."
Expand Down Expand Up @@ -97,7 +106,7 @@ def createConfiguration(self, path ):
cfgs[cfgName] = configTemplates.compareTemplate
repMaps[cfgName] = repMap

cfgSchedule.append( cfgName )
cfgSchedule.append( cfgName )
GenericValidation.createConfiguration(self, cfgs, path, cfgSchedule, repMaps = repMaps)

def createScript(self, path):
Expand All @@ -107,6 +116,8 @@ def createScript(self, path):
%self.name), repMap)
for name in self.__compares:
if '"DetUnit"' in self.__compares[name][0].split(","):
repMap["outputFile"] = (".oO[name]Oo..Comparison_common"+name+".root")
repMap["nIndex"] = ("")
repMap["runComparisonScripts"] += \
("rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
"/scripts/comparisonScript.C .\n"
Expand All @@ -116,39 +127,54 @@ def createScript(self, path):
"/scripts/GeometryComparisonPlotter.cc .\n"
"root -b -q 'comparisonScript.C+(\""
".oO[name]Oo..Comparison_common"+name+".root\",\""
"./\")'\n")
"./\")'\n"
"rfcp "+path+"/TkAl3DVisualization_.oO[name]Oo..C .\n"
"root -l -b -q TkAl3DVisualization_.oO[name]Oo..C+\n")
if self.copyImages:
repMap["runComparisonScripts"] += \
("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
".Comparison_common"+name+"_Images\n")
repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*PXB*\" "
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
".Comparison_common"+name+"_Images/Translations\n")
repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*PXF*\" "
("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
".Comparison_common"+name+"_Images/Rotations\n")
repMap["runComparisonScripts"] += \
("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
".Comparison_common"+name+"_Images/CrossTalk\n")


### At the moment translations are immages with suffix _1 and _2, rotations _3 and _4, and cross talk _5 and _6
### The numeration depends on the order of the MakePlots(x, y) commands in comparisonScript.C
### If comparisonScript.C is changed, check if the following lines need to be changed as well
repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*_1*\" "
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
"/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")
repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*TIB*\" "
("find . -maxdepth 1 -name \"*_2*\" "
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
"/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")

repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*TID*\" "
("find . -maxdepth 1 -name \"*_3*\" "
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
"/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")
repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*TEC*\" "
("find . -maxdepth 1 -name \"*_4*\" "
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
"/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")

repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*TOB*\" "
("find . -maxdepth 1 -name \"*_5*\" "
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
"/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n")
repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name \"*tracker*\" "
("find . -maxdepth 1 -name \"*_6*\" "
"-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
"/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
"/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n")

repMap["runComparisonScripts"] += \
("find . -maxdepth 1 -name "
"\"TkMap_SurfDeform*.pdf\" -print | xargs -I {} bash -c"
Expand All @@ -171,7 +197,7 @@ def createScript(self, path):
repMap["runComparisonScripts"] += \
("rfcp .oO[CMSSW_BASE]Oo./src/Alignment"
"/OfflineValidation/scripts/makeArrowPlots.C "
"$CWD/TkAllInOneTool\n"
".\n"
"root -b -q 'makeArrowPlots.C(\""
".oO[name]Oo..Comparison_common"+name
+".root\",\".oO[name]Oo.."
Expand All @@ -184,6 +210,11 @@ def createScript(self, path):
"-maxdepth 1 -name \"*.png\" -print | xargs -I {} bash "
"-c \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
".Comparison_common"+name+"_Images/ArrowPlots\"\n")
repMap["runComparisonScripts"] += \
("find . "
"-maxdepth 1 -name \".oO[name]Oo..Visualization_rotated.gif\" -print | xargs -I {} bash "
"-c \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
".Comparison_common"+name+"_Images/.oO[name]Oo..Visualization.gif\"\n")

resultingFile = replaceByMap(("/store/caf/user/$USER/.oO[eosdir]Oo./compared%s_"
".oO[name]Oo..root"%name), repMap)
Expand All @@ -199,15 +230,19 @@ def createScript(self, path):
for cfg in self.configFiles:
# FIXME: produce this line only for enabled dbOutput
# postProcess = "rfcp .oO[workdir]Oo./*.db .oO[datadir]Oo.\n"
postProcess = "rfcp *.db .oO[datadir]Oo.\n"
# postProcess = "rfcp *.db .oO[datadir]Oo.\n"
postProcess = ""
repMap["CommandLine"]+= \
repMap["CommandLineTemplate"]%{"cfgFile":cfg,
"postProcess":postProcess}
repMap["CommandLine"]+= ("# overall postprocessing\n"
".oO[runComparisonScripts]Oo.\n"
)

scripts = {scriptName: replaceByMap( configTemplates.scriptTemplate, repMap ) }
#~ print configTemplates.scriptTemplate
scripts = {scriptName: replaceByMap( configTemplates.scriptTemplate, repMap )}
files = {replaceByMap("TkAl3DVisualization_.oO[name]Oo..C", repMap ): replaceByMap(configTemplates.visualizationTrackerTemplate, repMap )}
self.createFiles(files, path)
return GenericValidation.createScript(self, scripts, path)

def createCrabCfg(self, path):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
process.load("Configuration.Geometry.GeometryDB_cff")
#process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
#process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")
process.load('Configuration.Geometry.GeometryExtended2015_cff')
process.TrackerTopologyEP = cms.ESProducer("TrackerTopologyEP")
process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")
#process.load("Alignment.CommonAlignmentProducer.GlobalPosition_Frontier_cff")
process.load("CondCore.DBCommon.CondDBSetup_cfi")
process.MessageLogger = cms.Service("MessageLogger",
Expand All @@ -31,7 +31,6 @@
input = cms.untracked.int32(1)
)
process.dump = cms.EDAnalyzer("TrackerGeometryIntoNtuples",
# outputFile = cms.untracked.string('.oO[workdir]Oo./.oO[alignmentName]Oo.ROOTGeometry.root'),
outputFile = cms.untracked.string('.oO[alignmentName]Oo.ROOTGeometry.root'),
outputTreename = cms.untracked.string('alignTree')
)
Expand All @@ -50,15 +49,11 @@
# global tag
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
process.load("Configuration.Geometry.GeometryDB_cff")
#process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
#process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")
process.load('Configuration.Geometry.GeometryExtended2015_cff')
process.TrackerTopologyEP = cms.ESProducer("TrackerTopologyEP")
#process.load("Alignment.CommonAlignmentProducer.GlobalPosition_Frontier_cff")
# the input .GlobalPosition_Frontier_cff is providing the frontier://FrontierProd/CMS_COND_31X_ALIGNMENT in the release which does not provide the ideal geometry
#process.GlobalPosition.connect = 'frontier://FrontierProd/CMS_COND_31X_FROM21X'
process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")
process.load("CondCore.DBCommon.CondDBSetup_cfi")
Expand All @@ -76,11 +71,8 @@
process.load("DQM.SiStripCommon.TkHistoMap_cfi")
process.DQMStore=cms.Service("DQMStore")
#process.TkDetMap = cms.Service("TkDetMap")
#process.SiStripDetInfoFileReader = cms.Service("SiStripDetInfoFileReader")
process.load("DQMServices.Core.DQMStore_cfg")
#process.DQMStore=cms.Service("DQMStore")
# configuration of the Tracker Geometry Comparison Tool
# Tracker Geometry Comparison
Expand All @@ -89,13 +81,9 @@
process.TrackerGeometryCompare.inputROOTFile1 = '.oO[comparedGeometry]Oo.'
process.TrackerGeometryCompare.inputROOTFile2 = '.oO[referenceGeometry]Oo.'
# process.TrackerGeometryCompare.outputFile = ".oO[workdir]Oo./.oO[name]Oo..Comparison_common.oO[common]Oo..root"
process.TrackerGeometryCompare.outputFile = ".oO[name]Oo..Comparison_common.oO[common]Oo..root"
process.load("CommonTools.UtilAlgos.TFileService_cfi")
#process.TFileService = cms.Service("TFileService",
# fileName = cms.string('TkSurfDeform.root')
# )
process.TFileService.fileName = cms.string("TkSurfDeform_.oO[name]Oo..Comparison_common.oO[common]Oo..root")
process.TrackerGeometryCompare.levels = [ .oO[levels]Oo. ]
Expand All @@ -113,7 +101,7 @@
dbOutputTemplate= """
//_________________________ db Output ____________________________
# setup for writing out to DB
include "CondCore/DBCommon/data/CondDBSetup.cfi"
include "CondCore/DBCommon/CondDBSetup.cfi"
# include "CondCore/DBCommon/data/CondDBCommon.cfi"
service = PoolDBOutputService {
Expand All @@ -129,3 +117,55 @@
}
"""

######################################################################
######################################################################
visualizationTrackerTemplate= """
#include ".oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation/scripts/visualizationTracker.C"
void TkAl3DVisualization_.oO[name]Oo.(){
//------------------------------ONLY NEEDED INPUTS-------------------------------//
//------Tree Read In--------
TString inputFileName = ".oO[outputFile]Oo.";
//output file name
string outputFileName = ".oO[name]Oo..Visualization";
//title
string line1 = ".oO[alignmentTitle]Oo.";
string line2 = "vs. .oO[referenceTitle]Oo.";
//set subdetectors to see
int subdetector1 = .oO[3DSubdetector1]Oo.;
int subdetector2 = .oO[3DSubdetector2]Oo.;
//translation scale factor
int sclftr = .oO[3DTranslationalScaleFactor]Oo.;
//rotation scale factor
int sclfrt = 1;
//module size scale factor
float sclfmodulesizex = 1;
float sclfmodulesizey = 1;
float sclfmodulesizez = 1;
//beam pipe radius
float piperadius = 2.25;
//beam pipe xy coordinates
float pipexcoord = 0;
float pipeycoord = 0;
//beam line xy coordinates
float linexcoord = 0;
float lineycoord = 0;
//------------------------------End of ONLY NEEDED INPUTS-------------------------------//
cout << "running visualizer" << endl;
runVisualizer(inputFileName,
outputFileName,
line1,
line2,
subdetector1,
subdetector2,
sclftr,
sclfrt,
sclfmodulesizex,
sclfmodulesizey,
sclfmodulesizez,
piperadius,
pipexcoord,
pipeycoord,
linexcoord,
lineycoord );
}
"""
Loading

0 comments on commit ba34750

Please sign in to comment.