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

Zmumu validation tool set of commits #11195

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class GeometryComparison(GenericValidation):
Object representing a geometry comparison job.
"""
def __init__( self, valName, alignment, referenceAlignment,
config, copyImages = True, randomWorkdirPart = None):
config, copyImages = True):
"""
Constructor of the GeometryComparison class.

Expand All @@ -24,9 +24,6 @@ def __init__( self, valName, alignment, referenceAlignment,
configuration of the validations
- `copyImages`: Boolean which indicates whether png- and pdf-files
should be copied back from the batch farm
- `randomWorkDirPart`: If this option is ommitted a random number is
generated to create unique path names for the
individual validation instances.
"""
defaults = {
"3DSubdetector1":"1",
Expand All @@ -37,8 +34,6 @@ def __init__( self, valName, alignment, referenceAlignment,
GenericValidation.__init__(self, valName, alignment, config,
"compare", addDefaults=defaults,
addMandatories = mandatories)
if not randomWorkdirPart == None:
self.randomWorkdirPart = randomWorkdirPart
self.referenceAlignment = referenceAlignment
referenceName = "IDEAL"
if not self.referenceAlignment == "IDEAL":
Expand Down Expand Up @@ -82,14 +77,14 @@ def getRepMap(self, alignment = None):
def createConfiguration(self, path ):
# self.__compares
repMap = self.getRepMap()
cfgFileName = "TkAlCompareToNTuple.%s.%s_cfg.py"%(
self.alignmentToValidate.name, self.randomWorkdirPart)
cfgFileName = "TkAlCompareToNTuple.%s_cfg.py"%(
self.alignmentToValidate.name)
cfgs = {cfgFileName: configTemplates.intoNTuplesTemplate}
repMaps = {cfgFileName: repMap}
if not self.referenceAlignment == "IDEAL":
referenceRepMap = self.getRepMap( self.referenceAlignment )
cfgFileName = "TkAlCompareToNTuple.%s.%s_cfg.py"%(
self.referenceAlignment.name, self.randomWorkdirPart )
cfgFileName = "TkAlCompareToNTuple.%s_cfg.py"%(
self.referenceAlignment.name )
cfgs[cfgFileName] = configTemplates.intoNTuplesTemplate
repMaps[cfgFileName] = referenceRepMap

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def __init__(self, valName, config, valType,
config.checkInput("preexisting"+valType+":"+self.name,
knownSimpleOptions = knownOpts,
ignoreOptions = ignoreOpts)
self.jobmode = None

def getRepMap(self):
result = self.general
Expand Down Expand Up @@ -74,7 +75,7 @@ def getCompareStrings( self, requestId = None, plain = False ):
def createFiles(self, *args, **kwargs):
raise AllInOneError("Shouldn't be here...")
def createConfiguration(self, *args, **kwargs):
raise AllInOneError("Shouldn't be here...")
pass
def createScript(self, *args, **kwargs):
raise AllInOneError("Shouldn't be here...")
def createCrabCfg(self, *args, **kwargs):
Expand All @@ -88,7 +89,7 @@ def __init__(self, valName, config,
"DMRMinimum":"30",
"DMROptions":"",
"OfflineTreeBaseDir":"TrackHitFilter",
"SurfaceShapes":"none"
"SurfaceShapes":"coarse",
}
defaults.update(addDefaults)
PreexistingValidation.__init__(self, valName, config, "offline",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,16 @@ def createCrabCfg(self, path):
return GenericValidationData.createCrabCfg(self, path, self.crabCfgBaseName)

def getRepMap(self, alignment = None):
if alignment == None:
alignment = self.alignmentToValidate
repMap = GenericValidationData.getRepMap(self, alignment)
repMap.update({
"nEvents": self.general["maxevents"],
# "outputFile": "zmumuHisto.root"
"outputFile": ("0_zmumuHisto.root"
",genSimRecoPlots.root"
",FitParameters.txt")
",FitParameters.txt"),
"eosdir": os.path.join(self.general["eosdir"], "%s/%s/%s" % (self.outputBaseName, self.name, alignment.name)),
"workingdir": ".oO[datadir]Oo./%s/%s/%s" % (self.outputBaseName, self.name, alignment.name),
"plotsdir": ".oO[datadir]Oo./%s/%s/%s/plots" % (self.outputBaseName, self.name, alignment.name),
})
return repMap
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
.oO[datasetDefinition]Oo.
# process.load("Alignment.OfflineValidation..oO[dataset]Oo._cff")

process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
process.load("Geometry.CommonDetUnit.globalTrackingGeometry_cfi")
#process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
#process.load("Geometry.CommonDetUnit.globalTrackingGeometry_cfi")
process.load("RecoMuon.DetLayers.muonDetLayerGeometry_cfi")
process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi")
process.load("RecoMuon.TrackingTools.MuonServiceProxy_cff")

########### standard includes ##############################
process.load("Configuration.StandardSequences..oO[magneticField]Oo._cff")
process.load("Configuration.StandardSequences.Reconstruction_cff")
process.load("Configuration.Geometry.GeometryDB_cff")
process.load("Configuration.Geometry.GeometryRecoDB_cff")


########### DATABASE conditions ############################
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff")
process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."

.oO[condLoad]Oo.
Expand Down Expand Up @@ -114,21 +114,29 @@
parSmear = cms.vdouble(),

### taken from J/Psi #########################
ResolFitType = cms.int32(14),
parResol = cms.vdouble(0.007,0.015, -0.00077, 0.0063, 0.0018, 0.0164),
parResolFix = cms.vint32(0, 0, 0,0, 0,0),
parResolOrder = cms.vint32(0, 0, 0, 0, 0, 0),
# ResolFitType = cms.int32(14),
# parResol = cms.vdouble(0.007,0.015, -0.00077, 0.0063, 0.0018, 0.0164),
# parResolFix = cms.vint32(0, 0, 0,0, 0,0),
# parResolOrder = cms.vint32(0, 0, 0, 0, 0, 0),
ResolFitType = cms.int32(0),
parResol = cms.vdouble(0),
parResolFix = cms.vint32(0),
parResolOrder = cms.vint32(0),


# -------------------- #
# Scale fit parameters #
# -------------------- #

# -----------------------------------------------------------------------------------
ScaleFitType = cms.int32(18),
parScaleOrder = cms.vint32(0, 0, 0, 0),
parScaleFix = cms.vint32(0, 0, 0, 0),
parScale = cms.vdouble(1, 1, 1, 1),
# ScaleFitType = cms.int32(18),
# parScaleOrder = cms.vint32(0, 0, 0, 0),
# parScaleFix = cms.vint32(0, 0, 0, 0),
# parScale = cms.vdouble(1, 1, 1, 1),
ScaleFitType = cms.int32(0),
parScaleOrder = cms.vint32(0),
parScaleFix = cms.vint32(0),
parScale = cms.vdouble(0),



Expand Down Expand Up @@ -218,13 +226,12 @@

cwd=`pwd`
cd .oO[CMSSW_BASE]Oo./src
# export SCRAM_ARCH=slc5_amd64_gcc462
export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo.
eval `scram runtime -sh`
cd $cwd

rfmkdir -p .oO[datadir]Oo.

rfmkdir -p .oO[workingdir]Oo.
rfmkdir -p .oO[logdir]Oo.
rm -f .oO[logdir]Oo./*.stdout
rm -f .oO[logdir]Oo./*.stderr
Expand All @@ -244,11 +251,6 @@

ls -lh .

source /afs/cern.ch/sw/lcg/external/gcc/4.8.1/x86_64-slc6/setup.sh
source /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.10/x86_64-slc6-gcc48-opt/root/bin/thisroot.sh

# cd .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit
# ln -fs .oO[workdir]Oo./0_zmumuHisto.root .
cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/CompareBiasZValidation.cc .
cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/Legend.h .
cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitMassSlices.cc .
Expand All @@ -257,26 +259,25 @@
cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitWithRooFit.cc .
cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitMass1D.cc .

root -q -b "CompareBiasZValidation.cc+(\\\"\\\")"
root -q -b -l "CompareBiasZValidation.cc+()"


# mv BiasCheck.root .oO[workdir]Oo.

# cd .oO[workdir]Oo.
cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/tdrstyle.C .
cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/MultiHistoOverlap_.oO[resonance]Oo..C .
# ln -fs /afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN2/TMP_EM/ZMuMu/data/MC/BiasCheck_DYToMuMu_Summer11_TkAlZMuMu_IDEAL.root ./BiasCheck_Reference.root

if [[ .oO[zmumureference]Oo. == *store* ]]; then cmsStage -f .oO[zmumureference]Oo. BiasCheck_Reference.root; else ln -fs .oO[zmumureference]Oo. ./BiasCheck_Reference.root; fi
root -q -b MultiHistoOverlap_.oO[resonance]Oo..C
root -q -b -l MultiHistoOverlap_.oO[resonance]Oo..C

cmsMkdir /store/caf/user/$USER/.oO[eosdir]Oo.
cmsMkdir /store/caf/user/$USER/.oO[eosdir]Oo./plots/
for RootOutputFile in $(ls *root )
do
cmsStage -f ${RootOutputFile} /store/caf/user/$USER/.oO[eosdir]Oo./
rfcp ${RootOutputFile} .oO[workingdir]Oo.
done

mkdir -p .oO[plotsdir]Oo.
for PngOutputFile in $(ls *png ); do
rfcp ${PngOutputFile} .oO[datadir]Oo.
cmsStage -f ${PngOutputFile} /store/caf/user/$USER/.oO[eosdir]Oo./plots/
rfcp ${PngOutputFile} .oO[plotsdir]Oo.
done


Expand Down
31 changes: 9 additions & 22 deletions Alignment/OfflineValidation/scripts/validateAlignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ def __init__( self, validation, config, options ):
self.__valName = valString[1]
self.__commandLineOptions = options
self.__config = config
self.__preexisting = ("preexisting" in self.__valType)
if self.__valType[0] == "*":
self.__valType = self.__valType[1:]
self.__preexisting = True

# workaround for intermediate parallel version
if self.__valType == "offlineParallel":
print ("offlineParallel and offline are now the same. To run an offline parallel validation,\n"
Expand Down Expand Up @@ -109,22 +114,10 @@ def __getValidation( self, valType, name, alignments, config, options ):
secondAlign = Alignment( secondAlignName, self.__config,
secondRun )
secondAlignName = secondAlign.name
# check if alignment was already compared previously
try:
randomWorkdirPart = \
globalDictionaries.alignRandDict[firstAlignName]
except KeyError:
randomWorkdirPart = None

validation = GeometryComparison( name, firstAlign, secondAlign,
self.__config,
self.__commandLineOptions.getImages,
randomWorkdirPart )
globalDictionaries.alignRandDict[firstAlignName] = \
validation.randomWorkdirPart
if not secondAlignName == "IDEAL":
globalDictionaries.alignRandDict[secondAlignName] = \
validation.randomWorkdirPart
self.__commandLineOptions.getImages)
elif valType == "offline":
validation = OfflineValidation( name,
Alignment( alignments.strip(), self.__config ), self.__config )
Expand All @@ -148,27 +141,26 @@ def __getValidation( self, valType, name, alignments, config, options ):
Alignment( alignments.strip(), self.__config ), self.__config )
else:
raise AllInOneError, "Unknown validation mode '%s'"%valType
self.preexisting = ("preexisting" in valType)
return validation

def __createJob( self, jobMode, outpath ):
"""This private method creates the needed files for the validation job.
"""
self.validation.createConfiguration( outpath )
if self.__preexisting:
return
self.__scripts = sum([addIndex(script, self.validation.NJobs) for script in self.validation.createScript( outpath )], [])
if jobMode.split( ',' )[0] == "crab":
self.validation.createCrabCfg( outpath )
return None

def createJob(self):
"""This is the method called to create the job files."""
if self.preexisting:
return
self.__createJob( self.validation.jobmode,
os.path.abspath( self.__commandLineOptions.Name) )

def runJob( self ):
if self.preexisting:
if self.__preexisting:
log = "> " + self.validation.name + " is already validated."
print log
return log
Expand Down Expand Up @@ -506,11 +498,6 @@ def main(argv = None):
config.set("general","logdir",os.path.join(general["logdir"],options.Name) )
config.set("general","eosdir",os.path.join("AlignmentValidation", general["eosdir"], options.Name) )

# clean up of log directory to avoid cluttering with files with different
# random numbers for geometry comparison
if os.path.isdir( outPath ):
shutil.rmtree( outPath )

if not os.path.exists( outPath ):
os.makedirs( outPath )
elif not os.path.isdir( outPath ):
Expand Down
Loading