Skip to content

Commit

Permalink
integrated 3D geometry comparison visualization into all-in-one tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Jered McInerney committed Jun 12, 2015
1 parent 7d95147 commit 76a675c
Show file tree
Hide file tree
Showing 4 changed files with 545 additions and 154 deletions.
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
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 @@ -118,7 +127,9 @@ 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."
Expand All @@ -132,8 +143,9 @@ def createScript(self, path):
repMap["runComparisonScripts"] += \
("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
".Comparison_common"+name+"_Images/CrossTalk\n")

### At the moment translations are images with suffix _1 and _2, rotations _3 and _4, and cross talk _5 and _6


### 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"] += \
Expand Down Expand Up @@ -198,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 @@ -223,7 +240,9 @@ def createScript(self, path):
)

#~ print configTemplates.scriptTemplate
scripts = {scriptName: replaceByMap( configTemplates.scriptTemplate, repMap ) }
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
Expand Up @@ -117,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 );
}
"""

0 comments on commit 76a675c

Please sign in to comment.