Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanity checks TkAlMerge.sh 53X #1738

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 14 additions & 3 deletions Alignment/OfflineValidation/macros/PlotAlignmentValidation.C
Expand Up @@ -503,7 +503,7 @@ void PlotAlignmentValidation::plotSS( const std::string& options, const std::str
//------------------------------------------------------------------------------
void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits, const std::string& options)
{
// If several, comma-separated values are given,
// If several, comma-separated values are given in 'variable',
// call plotDMR with each value separately.
// If a comma is found, the string is divided to two.
// (no space allowed)
Expand All @@ -525,6 +525,14 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits
return;
}

// options:
// -plain (default, the whole distribution)
// -split (distribution splitted to two)
// -layers (plain db for each layer/disc superimposed in one plot)
// -layersSeparate (plain db for each layer/disc in separate plots)
// -layersSplit (splitted db for each layers/disc in one plot)
// -layersSplitSeparate (splitted db, for each layers/disc in separate plots)

TRegexp layer_re("layer=[0-9]+");
bool plotPlain = false, plotSplits = false, plotLayers = false;
int plotLayerN = 0;
Expand Down Expand Up @@ -565,10 +573,13 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits
plotinfo.plotPlain = plotPlain;
plotinfo.plotLayers = plotLayers;

// width in cm
// for DMRS, use 100 bins in range +-10 um, bin width 0.2um
// if modified, check also TrackerOfflineValidationSummary_cfi.py and TrackerOfflineValidation_Standalone_cff.py
if (variable == "meanX") { plotinfo.nbins = 50; plotinfo.min = -0.001; plotinfo.max = 0.001; }
else if (variable == "meanY") { plotinfo.nbins = 50; plotinfo.min = -0.005; plotinfo.max = 0.005; }
else if (variable == "medianX") { plotinfo.nbins = 50; plotinfo.min = -0.005; plotinfo.max = 0.005; }
else if (variable == "medianY") { plotinfo.nbins = 50; plotinfo.min = -0.005; plotinfo.max = 0.005; }
else if (variable == "medianX") { plotinfo.nbins = 100; plotinfo.min = -0.001; plotinfo.max = 0.001; }
else if (variable == "medianY") { plotinfo.nbins = 100; plotinfo.min = -0.001; plotinfo.max = 0.001; }
else if (variable == "meanNormX") { plotinfo.nbins = 100; plotinfo.min = -2.0; plotinfo.max = 2.0; }
else if (variable == "meanNormY") { plotinfo.nbins = 100; plotinfo.min = -2.0; plotinfo.max = 2.0; }
else if (variable == "rmsX") { plotinfo.nbins = 100; plotinfo.min = 0.0; plotinfo.max = 0.1; }
Expand Down
Expand Up @@ -106,6 +106,13 @@ def __init__(self, valName, alignment,config):
defaultDict = defaults )
self.general.update( offline )
self.__NJobs = self.general["parallelJobs"]
self.outputFiles = []
for index in range(int(self.general["parallelJobs"])):
fName = replaceByMap("AlignmentValidation_"+self.name
+"_.oO[name]Oo._%d.root"%(index),
self.getRepMap())
self.outputFiles.append(fName)


def createConfiguration(self, path, configBaseName = "TkAlOfflineValidation"):
# if offline validation uses N parallel jobs, we create here N cfg files
Expand Down Expand Up @@ -140,12 +147,7 @@ def createConfiguration(self, path, configBaseName = "TkAlOfflineValidation"):
repMap.update({"nIndex": str(index)})
# Create the result file directly to datadir since should not use /tmp/
# see https://cern.service-now.com/service-portal/article.do?n=KB0000484
repMap.update({
"outputFile": replaceByMap("AlignmentValidation_"
+ self.name +
"_.oO[name]Oo._.oO[nIndex]Oo..root",
repMap )
})
repMap.update({"outputFile": self.outputFiles[index]})
repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] )

cfgs = {cfgName:replaceByMap(configTemplates.offlineParallelTemplate,
Expand All @@ -168,12 +170,7 @@ def createScript(self, path, scriptBaseName = "TkAlOfflineValidation"):
repMap["nIndex"]=""
repMap["nIndex"]=str(index)
repMap["CommandLine"]=""
repMap.update({
"outputFile": replaceByMap("AlignmentValidation_"
+ self.name +
"_.oO[name]Oo._.oO[nIndex]Oo..root",
repMap )
})
repMap.update({"outputFile": self.outputFiles[index]})
for cfg in self.configFiles:
# The ugly solution here is to change the name for each parallel job
cfgtemp = cfg.replace(str(numJobs-1)+"_cfg.py",
Expand Down
Expand Up @@ -416,15 +416,8 @@
# ls -al .oO[datadir]Oo./AlignmentValidation*.root > .oO[datadir]Oo./log_rootfilelist.txt
ls -al AlignmentValidation*.root > .oO[datadir]Oo./log_rootfilelist.txt

# Remove parallel job files if merged file exists
for file in $(cmsLs -l /store/caf/user/$USER/.oO[eosdir]Oo. |awk '{print $5}')
do
if [[ ${file} = /store/caf/user/$USER/.oO[eosdir]Oo./AlignmentValidation*_[0-9].root ]]
then
cmsRm ${file}
fi
done

# Remove parallel job files
.oO[rmUnmerged]Oo.
"""


Expand Down
Expand Up @@ -9,7 +9,10 @@

# DMR (distribution of median of residuals per module) of X coordinate (Strip)
TH1DmrXprimeStripModules = cms.PSet(
Nbinx = cms.int32(200), xmin = cms.double(-0.05), xmax = cms.double(0.05)
# width 2.0 um
# Nbinx = cms.int32(500), xmin = cms.double(-0.05), xmax = cms.double(0.05)
# width 0.5 um
Nbinx = cms.int32(5000), xmin = cms.double(-0.05), xmax = cms.double(0.05)
),

# DMR (distribution of median of residuals per module) of Y coordinate (Strip)
Expand All @@ -19,12 +22,14 @@

# DMR (distribution of median of residuals per module) of X coordinate (Pixel)
TH1DmrXprimePixelModules = cms.PSet(
Nbinx = cms.int32(200), xmin = cms.double(-0.05), xmax = cms.double(0.05)
# Nbinx = cms.int32(500), xmin = cms.double(-0.05), xmax = cms.double(0.05)
Nbinx = cms.int32(5000), xmin = cms.double(-0.05), xmax = cms.double(0.05)
),

# DMR (distribution of median of residuals per module) of Y coordinate (Pixel)
TH1DmrYprimePixelModules = cms.PSet(
Nbinx = cms.int32(200), xmin = cms.double(-0.05), xmax = cms.double(0.05)
# Nbinx = cms.int32(200), xmin = cms.double(-0.05), xmax = cms.double(0.05)
Nbinx = cms.int32(5000), xmin = cms.double(-0.05), xmax = cms.double(0.05)
)

)
Expand Up @@ -14,19 +14,19 @@
#TrackerOfflineValidation.TH1NormXResStripModules.xmin = -3.0
#TrackerOfflineValidation.TH1NormXResStripModules.xmax = 3.0

TrackerOfflineValidation.TH1XprimeResStripModules.Nbinx = 2000
TrackerOfflineValidation.TH1XprimeResStripModules.xmin = -0.1 #-0.5
TrackerOfflineValidation.TH1XprimeResStripModules.xmax = 0.1 #0.5
TrackerOfflineValidation.TH1XprimeResStripModules.Nbinx = 5000
TrackerOfflineValidation.TH1XprimeResStripModules.xmin = -0.05 #-0.5
TrackerOfflineValidation.TH1XprimeResStripModules.xmax = 0.05 #0.5

#TrackerOfflineValidation.TH1XResStripModules.Nbinx = 2000
#TrackerOfflineValidation.TH1XResStripModules.Nbinx = 5000
#TrackerOfflineValidation.TH1XResStripModules.xmin = -0.5
#TrackerOfflineValidation.TH1XResStripModules.xmax = 0.5

TrackerOfflineValidation.TH1NormYResStripModules.Nbinx = 120
TrackerOfflineValidation.TH1NormYResStripModules.xmin = -3.0
TrackerOfflineValidation.TH1NormYResStripModules.xmax = 3.0

TrackerOfflineValidation.TH1YResStripModules.Nbinx = 2000
TrackerOfflineValidation.TH1YResStripModules.Nbinx = 5000
TrackerOfflineValidation.TH1YResStripModules.xmin = -11.0
TrackerOfflineValidation.TH1YResStripModules.xmax = 11.0

Expand All @@ -38,21 +38,21 @@
#TrackerOfflineValidation.TH1NormXResPixelModules.xmin = -3.0
#TrackerOfflineValidation.TH1NormXResPixelModules.xmax = 3.0

TrackerOfflineValidation.TH1XprimeResPixelModules.Nbinx = 2000
TrackerOfflineValidation.TH1XprimeResPixelModules.xmin = -0.1 #-0.5
TrackerOfflineValidation.TH1XprimeResPixelModules.xmax = 0.1 #0.5
TrackerOfflineValidation.TH1XprimeResPixelModules.Nbinx = 5000
TrackerOfflineValidation.TH1XprimeResPixelModules.xmin = -0.05 #-0.5
TrackerOfflineValidation.TH1XprimeResPixelModules.xmax = 0.05 #0.5

#TrackerOfflineValidation.TH1XResPixelModules.Nbinx = 2000
#TrackerOfflineValidation.TH1XResPixelModules.Nbinx = 5000
#TrackerOfflineValidation.TH1XResPixelModules.xmin = -0.5
#TrackerOfflineValidation.TH1XResPixelModules.xmax = 0.5

TrackerOfflineValidation.TH1NormYResPixelModules.Nbinx = 120
TrackerOfflineValidation.TH1NormYResPixelModules.xmin = -3.0
TrackerOfflineValidation.TH1NormYResPixelModules.xmax = 3.0

TrackerOfflineValidation.TH1YResPixelModules.Nbinx = 2000
TrackerOfflineValidation.TH1YResPixelModules.xmin = -0.1 #-0.5
TrackerOfflineValidation.TH1YResPixelModules.xmax = 0.1 #0.5
TrackerOfflineValidation.TH1YResPixelModules.Nbinx = 5000
TrackerOfflineValidation.TH1YResPixelModules.xmin = -0.05 #-0.5
TrackerOfflineValidation.TH1YResPixelModules.xmax = 0.05 #0.5

TrackerOfflineValidation.TProfileXResStripModules.Nbinx = 34
TrackerOfflineValidation.TProfileXResStripModules.xmin = -1.02
Expand Down
15 changes: 14 additions & 1 deletion Alignment/OfflineValidation/scripts/validateAlignments.py
Expand Up @@ -298,14 +298,27 @@ def createParallelMergeScript( path, validations ):

# introduced to merge individual validation outputs separately
# -> avoids problems with merge script
repMap["haddLoop"] = ""
repMap["haddLoop"] = "mergeRetCode=0\n"
repMap["rmUnmerged"] = "if [[ mergeRetCode -eq 0 ]]; then\n"
for validation in comparisonLists["OfflineValidationParallel"]:
repMap["haddLoop"] = validation.appendToMergeParJobs(repMap["haddLoop"])
repMap["haddLoop"] += "tmpMergeRetCode=${?}\n"
repMap["haddLoop"] += ("if [[ mergeRetCode -eq 0 ]]; "
"then mergeRetCode=${tmpMergeRetCode}; "
"fi\n")
repMap["haddLoop"] += ("cmsStage -f "
+validation.getRepMap()["outputFile"]
+" "
+validation.getRepMap()["resultFile"]
+"\n")
for f in validation.outputFiles:
longName = os.path.join("/store/caf/user/$USER/",
validation.getRepMap()["eosdir"], f)
repMap["rmUnmerged"] += " cmsRm "+longName+"\n"
repMap["rmUnmerged"] += ("else\n"
" echo \"WARNING: Merging failed, unmerged"
" files won't be deleted.\"\n"
"fi\n")

repMap["RunExtendedOfflineValidation"] = \
replaceByMap(configTemplates.extendedValidationExecution, repMap)
Expand Down