def createScript(self, path, scriptBaseName = "TkAlOfflineValidation"): # A separate script is created for each parallel jobs. # Since only one cfg is saved a bit ugly solution is needed in the loop. returnValue = [] numJobs = int( self.general["parallelJobs"] ) for index in range(numJobs): scriptName = "%s.%s.%s_%s.sh"%(scriptBaseName, self.name, self.alignmentToValidate.name, str(index)) repMap = GenericValidationData.getRepMap(self) repMap["nIndex"]="" repMap["nIndex"]=str(index) repMap["CommandLine"]="" 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", str(index)+"_cfg.py") repMap["CommandLine"]+= repMap["CommandLineTemplate"]%{"cfgFile":cfgtemp, "postProcess":"" } scripts = {scriptName: replaceByMap(configTemplates.parallelScriptTemplate, repMap ) } returnValue.extend(GenericValidationData.createScript(self, scripts, path) ) return returnValue
def createScript(self, path, scriptBaseName="TkAlOfflineValidation"): # A separate script is created for each parallel jobs. # Since only one cfg is saved a bit ugly solution is needed in the loop. returnValue = [] numJobs = int(self.general["parallelJobs"]) for index in range(numJobs): scriptName = "%s.%s.%s_%s.sh" % (scriptBaseName, self.name, self.alignmentToValidate.name, str(index)) repMap = GenericValidationData.getRepMap(self) repMap["nIndex"] = "" repMap["nIndex"] = str(index) repMap["CommandLine"] = "" 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", str(index) + "_cfg.py") repMap["CommandLine"] += repMap["CommandLineTemplate"] % { "cfgFile": cfgtemp, "postProcess": "" } scripts = { scriptName: replaceByMap(configTemplates.parallelScriptTemplate, repMap) } returnValue.extend( GenericValidationData.createScript(self, scripts, path)) return returnValue
def __init__(self, valName, alignment, config, configBaseName="TkAlTrackSplitting", scriptBaseName="TkAlTrackSplitting", crabCfgBaseName="TkAlTrackSplitting", resultBaseName="TrackSplitting", outputBaseName="TrackSplitting"): mandatories = ["trackcollection"] defaults = {"subdetector": "BPIX"} self.configBaseName = configBaseName self.scriptBaseName = scriptBaseName self.crabCfgBaseName = crabCfgBaseName self.resultBaseName = resultBaseName self.outputBaseName = outputBaseName self.needParentFiles = False GenericValidationData.__init__(self, valName, alignment, config, "split", addMandatories=mandatories, addDefaults=defaults) validsubdets = self.validsubdets() if self.general["subdetector"] not in validsubdets: raise AllInOneError("'%s' is not a valid subdetector!\n" % self.general["subdetector"] + "The options are: " + ", ".join(validsubdets))
def __init__(self, valName, alignment, config, configBaseName = "TkAlZMuMuValidation", scriptBaseName = "TkAlZMuMuValidation", crabCfgBaseName = "TkAlZMuMuValidation", resultBaseName = "ZMuMuValidation", outputBaseName = "ZMuMuValidation"): defaults = { "zmumureference": ("/store/caf/user/emiglior/Alignment/TkAlDiMuonValidation/Reference/BiasCheck_DYToMuMu_Summer12_TkAlZMuMu_IDEAL.root"), "resonance": "Z", "switchONfit": "false", "rebinphi": "4", "rebinetadiff": "2", "rebineta": "2", "rebinpt": "8", } mandatories = ["etamaxneg", "etaminneg", "etamaxpos", "etaminpos"] self.configBaseName = configBaseName self.scriptBaseName = scriptBaseName self.crabCfgBaseName = crabCfgBaseName self.resultBaseName = resultBaseName self.outputBaseName = outputBaseName self.needParentFiles = False GenericValidationData.__init__(self, valName, alignment, config, "zmumu", addDefaults=defaults, addMandatories=mandatories) if self.general["zmumureference"].startswith("/store"): self.general["zmumureference"] = "root://eoscms//eos/cms" + self.general["zmumureference"] if self.NJobs > 1: raise AllInOneError("Parallel jobs not implemented for the Z->mumu validation!\n" "Please set parallelJobs = 1.")
def __init__(self, valName, alignment, config, configBaseName = "TkAlZMuMuValidation", scriptBaseName = "TkAlZMuMuValidation", crabCfgBaseName = "TkAlZMuMuValidation", resultBaseName = "ZMuMuValidation", outputBaseName = "ZMuMuValidation"): defaults = { "zmumureference": ("/store/caf/user/emiglior/Alignment/TkAlDiMuonValidation/Reference/BiasCheck_DYToMuMu_Summer12_TkAlZMuMu_IDEAL.root"), } deprecateddefaults = { "resonance": "", "switchONfit": "", "rebinphi": "", "rebinetadiff": "", "rebineta": "", "rebinpt": "", } defaults.update(deprecateddefaults) mandatories = ["etamaxneg", "etaminneg", "etamaxpos", "etaminpos"] self.configBaseName = configBaseName self.scriptBaseName = scriptBaseName self.crabCfgBaseName = crabCfgBaseName self.resultBaseName = resultBaseName self.outputBaseName = outputBaseName self.needParentFiles = False GenericValidationData.__init__(self, valName, alignment, config, "zmumu", addDefaults=defaults, addMandatories=mandatories, addneedpackages=['MuonAnalysis/MomentumScaleCalibration']) if self.general["zmumureference"].startswith("/store"): self.general["zmumureference"] = "root://eoscms//eos/cms" + self.general["zmumureference"] if self.NJobs > 1: raise AllInOneError("Parallel jobs not implemented for the Z->mumu validation!\n" "Please set parallelJobs = 1.") for option in deprecateddefaults: if self.general[option]: raise AllInOneError("The '%s' option has been moved to the [plots:zmumu] section. Please specify it there."%option) del self.general[option]
def createConfiguration(self, path, configBaseName = "TkAlZMuMuValidation" ): cfgName = "%s.%s.%s_cfg.py"%( configBaseName, self.name, self.alignmentToValidate.name ) repMap = self.getRepMap() cfgs = {cfgName:replaceByMap(configTemplates.ZMuMuValidationTemplate, repMap)} GenericValidationData.createConfiguration(self, cfgs, path)
def __init__(self, valName, alignment, config, addDefaults = {}, addMandatories = [], configBaseName = "TkAlOfflineValidation", scriptBaseName = "TkAlOfflineValidation", crabCfgBaseName = "TkAlOfflineValidation", resultBaseName = "AlignmentValidation", outputBaseName = "AlignmentValidation"): defaults = { "DMRMethod":"median,rmsNorm", "DMRMinimum":"30", "DMROptions":"", "offlineModuleLevelHistsTransient":"False", "offlineModuleLevelProfiles":"True", "OfflineTreeBaseDir":"TrackHitFilter", "SurfaceShapes":"coarse", "stripYResiduals":"False", } mandatories = [ "trackcollection" ] defaults.update(addDefaults) mandatories += addMandatories self.configBaseName = configBaseName self.scriptBaseName = scriptBaseName self.crabCfgBaseName = crabCfgBaseName self.resultBaseName = resultBaseName self.outputBaseName = outputBaseName self.needParentFiles = False GenericValidationData.__init__(self, valName, alignment, config, "offline", addDefaults=defaults, addMandatories=mandatories)
def __init__(self, valName, alignment, config, configBaseName = "TkAlPrimaryVertexValidation", scriptBaseName = "TkAlPrimaryVertexValidation", crabCfgBaseName = "TkAlPrimaryVertexValidation", resultBaseName = "PrimaryVertexValidation", outputBaseName = "PrimaryVertexValidation"): defaults = { "pvvalidationreference": ("/store/caf/user/musich/Alignment/TkAlPrimaryVertexValidation/Reference/PrimaryVertexValidation_test_pvvalidation_mc_design_mc_48bins.root"), "ttrhbuilder":"WithAngleAndTemplate", "doBPix":"True", "doFPix":"True" } mandatories = ["isda","ismc","runboundary","trackcollection","vertexcollection","lumilist","ptCut","etaCut","runControl","numberOfBins"] self.configBaseName = configBaseName self.scriptBaseName = scriptBaseName self.crabCfgBaseName = crabCfgBaseName self.resultBaseName = resultBaseName self.outputBaseName = outputBaseName self.needParentFiles = False GenericValidationData.__init__(self, valName, alignment, config, "primaryvertex", addDefaults=defaults, addMandatories=mandatories) if self.general["pvvalidationreference"].startswith("/store"): self.general["pvvalidationreference"] = "root://eoscms//eos/cms" + self.general["pvvalidationreference"] if self.NJobs > 1: raise AllInOneError("Parallel jobs not implemented for the PrimaryVertex validation!\n" "Please set parallelJobs = 1.")
def __init__(self, valName, alignment, config, configBaseName="TkAlZMuMuValidation", scriptBaseName="TkAlZMuMuValidation", crabCfgBaseName="TkAlZMuMuValidation", resultBaseName="ZMuMuValidation", outputBaseName="ZMuMuValidation"): defaults = { "zmumureference": ("/store/caf/user/emiglior/Alignment/TkAlDiMuonValidation/Reference/BiasCheck_DYToMuMu_Summer12_TkAlZMuMu_IDEAL.root" ), "resonance": "Z" } mandatories = ["etamaxneg", "etaminneg", "etamaxpos", "etaminpos"] self.configBaseName = configBaseName self.scriptBaseName = scriptBaseName self.crabCfgBaseName = crabCfgBaseName self.resultBaseName = resultBaseName self.outputBaseName = outputBaseName self.needParentFiles = False GenericValidationData.__init__(self, valName, alignment, config, "zmumu", addDefaults=defaults, addMandatories=mandatories) if self.NJobs > 1: raise AllInOneError( "Parallel jobs not implemented for the Z->mumu validation!\n" "Please set parallelJobs = 1.")
def createConfiguration(self, path): cfgName = "%s.%s.%s_cfg.py"%( self.configBaseName, self.name, self.alignmentToValidate.name ) repMap = self.getRepMap() cfgs = {cfgName: configTemplates.PrimaryVertexValidationTemplate} self.filesToCompare[GenericValidationData.defaultReferenceName] = \ repMap["finalResultFile"] GenericValidationData.createConfiguration(self, cfgs, path, repMap = repMap)
def __init__(self, valName, alignment, config): mandatories = ["dataset", "maxevents"] GenericValidationData.__init__(self, valName, alignment, config, "mcValidate", addMandatories=mandatories)
def __init__(self, valName, alignment, config): mandatories = ["trackcollection", "maxevents", "dataset"] GenericValidationData.__init__(self, valName, alignment, config, "split", addMandatories=mandatories)
def createConfiguration(self, path): cfgName = "%s.%s.%s_cfg.py"%( self.configBaseName, self.name, self.alignmentToValidate.name ) repMap = self.getRepMap() self.filesToCompare[GenericValidationData.defaultReferenceName] = \ replaceByMap(".oO[eosdir]Oo./0_zmumuHisto.root", repMap) cfgs = {cfgName: configTemplates.ZMuMuValidationTemplate} GenericValidationData.createConfiguration(self, cfgs, path, repMap = repMap)
def createConfiguration(self, path ): cfgName = "TkAlMcValidate.%s.%s_cfg.py"%(self.name, self.alignmentToValidate.name) repMap = self.getRepMap() cfgs = {cfgName:replaceByMap(configTemplates.mcValidateTemplate, repMap)} self.filesToCompare[GenericValidationData.defaultReferenceName] = \ repMap["resultFile"] GenericValidationData.createConfiguration(self, cfgs, path)
def __init__(self, valName, alignment,config): defaults = { "zmumureference": ("/store/caf/user/emiglior/Alignment/TkAlDiMuonValidation/Reference/BiasCheck_DYToMuMu_Summer12_TkAlZMuMu_IDEAL.root"), "resonance": "Z" } mandatories = ["dataset", "maxevents", "etamaxneg", "etaminneg", "etamaxpos", "etaminpos"] GenericValidationData.__init__(self, valName, alignment, config, "zmumu", addDefaults=defaults, addMandatories=mandatories)
def createConfiguration(self, path): cfgName = "TkAlMcValidate.%s.%s_cfg.py" % ( self.name, self.alignmentToValidate.name) repMap = self.getRepMap() cfgs = { cfgName: replaceByMap(configTemplates.mcValidateTemplate, repMap) } self.filesToCompare[GenericValidationData.defaultReferenceName] = \ repMap["outputFile"] GenericValidationData.createConfiguration(self, cfgs, path)
def createConfiguration(self, path, configBaseName = "TkAlOfflineValidation" ): cfgName = "%s.%s.%s_cfg.py"%( configBaseName, self.name, self.alignmentToValidate.name ) repMap = self.getRepMap() cfgs = {cfgName:replaceByMap( configTemplates.offlineTemplate, repMap)} self.filesToCompare[ GenericValidationData.defaultReferenceName ] = repMap["resultFile"] GenericValidationData.createConfiguration(self, cfgs, path)
def createConfiguration(self, path): cfgName = "%s.%s.%s_cfg.py" % (self.configBaseName, self.name, self.alignmentToValidate.name) repMap = self.getRepMap() self.filesToCompare[GenericValidationData.defaultReferenceName] = \ replaceByMap(".oO[eosdir]Oo./0_zmumuHisto.root", repMap) cfgs = {cfgName: configTemplates.ZMuMuValidationTemplate} GenericValidationData.createConfiguration(self, cfgs, path, repMap=repMap)
def createConfiguration(self, path): cfgName = "%s.%s.%s_cfg.py" % (self.configBaseName, self.name, self.alignmentToValidate.name) repMap = self.getRepMap() cfgs = {cfgName: configTemplates.PrimaryVertexValidationTemplate} self.filesToCompare[GenericValidationData.defaultReferenceName] = \ repMap["finalResultFile"] GenericValidationData.createConfiguration(self, cfgs, path, repMap=repMap)
def __init__(self, valName, alignment, config, configBaseName="TkAlZMuMuValidation", scriptBaseName="TkAlZMuMuValidation", crabCfgBaseName="TkAlZMuMuValidation", resultBaseName="ZMuMuValidation", outputBaseName="ZMuMuValidation"): defaults = { "zmumureference": ("/store/caf/user/emiglior/Alignment/TkAlDiMuonValidation/Reference/BiasCheck_DYToMuMu_Summer12_TkAlZMuMu_IDEAL.root" ), } deprecateddefaults = { "resonance": "", "switchONfit": "", "rebinphi": "", "rebinetadiff": "", "rebineta": "", "rebinpt": "", } defaults.update(deprecateddefaults) mandatories = ["etamaxneg", "etaminneg", "etamaxpos", "etaminpos"] self.configBaseName = configBaseName self.scriptBaseName = scriptBaseName self.crabCfgBaseName = crabCfgBaseName self.resultBaseName = resultBaseName self.outputBaseName = outputBaseName self.needParentFiles = False GenericValidationData.__init__( self, valName, alignment, config, "zmumu", addDefaults=defaults, addMandatories=mandatories, addneedpackages=['MuonAnalysis/MomentumScaleCalibration']) if self.general["zmumureference"].startswith("/store"): self.general[ "zmumureference"] = "root://eoscms//eos/cms" + self.general[ "zmumureference"] if self.NJobs > 1: raise AllInOneError( "Parallel jobs not implemented for the Z->mumu validation!\n" "Please set parallelJobs = 1.") for option in deprecateddefaults: if self.general[option]: raise AllInOneError( "The '%s' option has been moved to the [plots:zmumu] section. Please specify it there." % option) del self.general[option]
def createScript(self, path, scriptBaseName = "TkAlOfflineValidation"): scriptName = "%s.%s.%s.sh"%( scriptBaseName, self.name, self.alignmentToValidate.name ) repMap = GenericValidationData.getRepMap(self) repMap["CommandLine"]="" for cfg in self.configFiles: repMap["CommandLine"]+= repMap["CommandLineTemplate"]%{"cfgFile":cfg, "postProcess":"" } scripts = {scriptName: replaceByMap( configTemplates.scriptTemplate, repMap ) } return GenericValidationData.createScript(self, scripts, path)
def __init__(self, valName, alignment, config): defaults = { "zmumureference": ( "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN2" "/TMP_EM/ZMuMu/data/MC/BiasCheck_DYToMuMu_Summer" "11_TkAlZMuMu_IDEAL.root" ) } mandatories = ["dataset", "maxevents", "etamaxneg", "etaminneg", "etamaxpos", "etaminpos"] GenericValidationData.__init__( self, valName, alignment, config, "zmumu", addDefaults=defaults, addMandatories=mandatories )
def __init__(self, valName, alignment, config, configBaseName = "TkAlTrackSplitting", scriptBaseName = "TkAlTrackSplitting", crabCfgBaseName = "TkAlTrackSplitting", resultBaseName = "TrackSplitting", outputBaseName = "TrackSplitting"): mandatories = ["trackcollection"] self.configBaseName = configBaseName self.scriptBaseName = scriptBaseName self.crabCfgBaseName = crabCfgBaseName self.resultBaseName = resultBaseName self.outputBaseName = outputBaseName self.needParentFiles = False GenericValidationData.__init__(self, valName, alignment, config, "split", addMandatories = mandatories)
def createConfiguration(self, path, configBaseName="TkAlOfflineValidation"): # if offline validation uses N parallel jobs, we create here N cfg files numberParallelJobs = int(self.general["parallelJobs"]) # limit maximum number of parallel jobs to 40 # (each output file is approximately 20MB) maximumNumberJobs = 40 if numberParallelJobs > maximumNumberJobs: msg = ("Maximum allowed number of parallel jobs " + str(maximumNumberJobs) + " exceeded!!!") raise AllInOneError(msg) # if maxevents is not specified, cannot calculate number of events for # each parallel job, and therefore running only a single job if int(self.general["maxevents"]) == -1: msg = ("Maximum number of events (maxevents) not specified: " "cannot use parallel jobs in offline validation") raise AllInOneError(msg) if numberParallelJobs > 1: if self.general["offlineModuleLevelHistsTransient"] == "True": msg = ( "To be able to merge results when running parallel jobs," " set offlineModuleLevelHistsTransient to false.") raise AllInOneError(msg) for index in range(numberParallelJobs): cfgName = "%s.%s.%s_%s_cfg.py" % (configBaseName, self.name, self.alignmentToValidate.name, str(index)) repMap = self.getRepMap() # in this parallel job, skip index*(maxEvents/nJobs) events from # the beginning # (first index is zero, so no skipping for a single job) # and use _index_ in the name of the output file 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( ".oO[datadir]Oo./AlignmentValidation_" + self.name + "_.oO[name]Oo._.oO[nIndex]Oo..root", repMap) }) repMap["outputFile"] = os.path.expandvars(repMap["outputFile"]) repMap["outputFile"] = os.path.abspath(repMap["outputFile"]) cfgs = { cfgName: replaceByMap(configTemplates.offlineParallelTemplate, repMap) } self.filesToCompare[GenericValidationData. defaultReferenceName] = repMap["resultFile"] GenericValidationData.createConfiguration(self, cfgs, path)
def __init__(self, valName, alignment, config, configBaseName = "TkAlMcValidate", scriptBaseName = "TkAlMcValidate", crabCfgBaseName = "TkAlMcValidate", resultBaseName = "McValidation", outputBaseName = "McValidation"): self.configBaseName = configBaseName self.scriptBaseName = scriptBaseName self.crabCfgBaseName = crabCfgBaseName self.resultBaseName = resultBaseName self.outputBaseName = outputBaseName self.needParentFiles = True GenericValidationData.__init__(self, valName, alignment, config, "mcValidate") if self.NJobs > 1: raise AllInOneError("Parallel jobs not implemented for the MC validation!\n" "Please set parallelJobs = 1.")
def __init__(self, valName, alignment,config): defaults = { "DMRMethod":"median,rmsNorm", "DMRMinimum":"30", "DMROptions":"", "offlineModuleLevelHistsTransient":"False", "offlineModuleLevelProfiles":"False", "OfflineTreeBaseDir":"TrackHitFilter", "SurfaceShapes":"none" } mandatories = [ "dataset", "maxevents", "trackcollection" ] GenericValidationData.__init__(self, valName, alignment, config, "offline", addDefaults=defaults, addMandatories=mandatories)
def createScript(self, path, scriptBaseName="TkAlOfflineValidation"): scriptName = "%s.%s.%s.sh" % (scriptBaseName, self.name, self.alignmentToValidate.name) repMap = GenericValidationData.getRepMap(self) repMap["CommandLine"] = "" for cfg in self.configFiles: repMap["CommandLine"] += repMap["CommandLineTemplate"] % { "cfgFile": cfg, "postProcess": "" } scripts = { scriptName: replaceByMap(configTemplates.scriptTemplate, repMap) } return GenericValidationData.createScript(self, scripts, path)
def __init__(self, valName, alignment, config, addDefaults={}, addMandatories=[], configBaseName="TkAlOfflineValidation", scriptBaseName="TkAlOfflineValidation", crabCfgBaseName="TkAlOfflineValidation", resultBaseName="AlignmentValidation", outputBaseName="AlignmentValidation"): defaults = { "offlineModuleLevelHistsTransient": "False", "offlineModuleLevelProfiles": "True", "stripYResiduals": "False", } deprecateddefaults = { "DMRMethod": "", "DMRMinimum": "", "DMROptions": "", "OfflineTreeBaseDir": "", "SurfaceShapes": "", } mandatories = ["trackcollection"] defaults.update(deprecateddefaults) defaults.update(addDefaults) mandatories += addMandatories self.configBaseName = configBaseName self.scriptBaseName = scriptBaseName self.crabCfgBaseName = crabCfgBaseName self.resultBaseName = resultBaseName self.outputBaseName = outputBaseName self.needParentFiles = False GenericValidationData.__init__(self, valName, alignment, config, "offline", addDefaults=defaults, addMandatories=mandatories) for option in deprecateddefaults: if self.general[option]: raise AllInOneError( "The '%s' option has been moved to the [plots:offline] section. Please specify it there." % option) del self.general[option]
def __init__(self, valName, alignment, config, configBaseName="TkAlPrimaryVertexValidation", scriptBaseName="TkAlPrimaryVertexValidation", crabCfgBaseName="TkAlPrimaryVertexValidation", resultBaseName="PrimaryVertexValidation", outputBaseName="PrimaryVertexValidation"): defaults = { "pvvalidationreference": ("/store/caf/user/musich/Alignment/TkAlPrimaryVertexValidation/Reference/PrimaryVertexValidation_test_pvvalidation_mc_design_mc_48bins.root" ), "ttrhbuilder": "WithAngleAndTemplate", "doBPix": "True", "doFPix": "True" } mandatories = [ "isda", "ismc", "runboundary", "trackcollection", "vertexcollection", "lumilist", "ptCut", "etaCut", "runControl", "numberOfBins" ] self.configBaseName = configBaseName self.scriptBaseName = scriptBaseName self.crabCfgBaseName = crabCfgBaseName self.resultBaseName = resultBaseName self.outputBaseName = outputBaseName self.needParentFiles = False GenericValidationData.__init__(self, valName, alignment, config, "primaryvertex", addDefaults=defaults, addMandatories=mandatories) if self.general["pvvalidationreference"].startswith("/store"): self.general[ "pvvalidationreference"] = "root://eoscms//eos/cms" + self.general[ "pvvalidationreference"] if self.NJobs > 1: raise AllInOneError( "Parallel jobs not implemented for the PrimaryVertex validation!\n" "Please set parallelJobs = 1.")
def getRepMap(self, alignment=None): repMap = GenericValidationData.getRepMap(self, alignment) repMap.update({ "nEvents": self.general["maxevents"], "outputFile": replaceByMap( ("AlignmentValidation_" + self.name + "_.oO[name]Oo..root"), repMap), "resultFile": replaceByMap( ("/store/caf/user/$USER/.oO[eosdir]Oo." "/AlignmentValidation_" + self.name + "_.oO[name]Oo..root"), repMap), "TrackSelectionTemplate": configTemplates.TrackSelectionTemplate, "LorentzAngleTemplate": configTemplates.LorentzAngleTemplate, "offlineValidationMode": "Standalone", "offlineValidationFileOutput": configTemplates.offlineStandaloneFileOutputTemplate, "TrackCollection": self.general["trackcollection"] }) repMap["outputFile"] = os.path.expandvars(repMap["outputFile"]) repMap["resultFile"] = os.path.expandvars(repMap["resultFile"]) return repMap
def getRepMap(self, alignment=None): repMap = GenericValidationData.getRepMap(self, alignment) repMap.update({ "nEvents": self.general["maxevents"], "outputFile": replaceByMap((".oO[workdir]Oo./AlignmentValidation_" + self.name + "_.oO[name]Oo..root"), repMap), "resultFile": replaceByMap((".oO[datadir]Oo./AlignmentValidation_" + self.name + "_.oO[name]Oo..root"), repMap), "TrackSelectionTemplate": configTemplates.TrackSelectionTemplate, "LorentzAngleTemplate": configTemplates.LorentzAngleTemplate, "offlineValidationMode": "Standalone", "offlineValidationFileOutput": configTemplates.offlineStandaloneFileOutputTemplate, "TrackCollection": self.general["trackcollection"] }) repMap["outputFile"] = os.path.expandvars(repMap["outputFile"]) repMap["outputFile"] = os.path.abspath(repMap["outputFile"]) repMap["resultFile"] = os.path.expandvars(repMap["resultFile"]) repMap["resultFile"] = os.path.abspath(repMap["resultFile"]) if self.jobmode.split(',')[0] == "crab": repMap["outputFile"] = os.path.basename(repMap["outputFile"]) repMap["resultFile"] = os.path.basename(repMap["resultFile"]) return repMap
def getRepMap(self, alignment = None): repMap = GenericValidationData.getRepMap(self, alignment) repMap.update({ "nEvents": self.general["maxevents"], "outputFile": replaceByMap( (".oO[workdir]Oo./AlignmentValidation_" + self.name + "_.oO[name]Oo..root"), repMap ), "resultFile": replaceByMap( (".oO[datadir]Oo./AlignmentValidation_" + self.name + "_.oO[name]Oo..root"), repMap ), "TrackSelectionTemplate": configTemplates.TrackSelectionTemplate, "LorentzAngleTemplate": configTemplates.LorentzAngleTemplate, "offlineValidationMode": "Standalone", "offlineValidationFileOutput": configTemplates.offlineStandaloneFileOutputTemplate, "TrackCollection": self.general["trackcollection"] }) repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] ) repMap["outputFile"] = os.path.abspath( repMap["outputFile"] ) repMap["resultFile"] = os.path.expandvars( repMap["resultFile"] ) repMap["resultFile"] = os.path.abspath( repMap["resultFile"] ) if self.jobmode.split( ',' )[0] == "crab": repMap["outputFile"] = os.path.basename( repMap["outputFile"] ) repMap["resultFile"] = os.path.basename( repMap["resultFile"] ) return repMap
def __init__(self, valName, alignment, config, configBaseName = "TkAlTrackSplitting", scriptBaseName = "TkAlTrackSplitting", crabCfgBaseName = "TkAlTrackSplitting", resultBaseName = "TrackSplitting", outputBaseName = "TrackSplitting"): mandatories = ["trackcollection"] defaults = {"subdetector": "BPIX"} self.configBaseName = configBaseName self.scriptBaseName = scriptBaseName self.crabCfgBaseName = crabCfgBaseName self.resultBaseName = resultBaseName self.outputBaseName = outputBaseName self.needParentFiles = False GenericValidationData.__init__(self, valName, alignment, config, "split", addMandatories = mandatories, addDefaults = defaults) validsubdets = self.validsubdets() if self.general["subdetector"] not in validsubdets: raise AllInOneError("'%s' is not a valid subdetector!\n" % self.general["subdetector"] + "The options are: " + ", ".join(validsubdets))
def getRepMap( self, alignment = None ): repMap = GenericValidationData.getRepMap(self, alignment) repMap.update({ "nEvents": self.general["maxevents"] }) repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] ) repMap["resultFile"] = os.path.expandvars( repMap["resultFile"] ) return repMap
def createConfiguration(self, path, configBaseName = "TkAlOfflineValidation"): # if offline validation uses N parallel jobs, we create here N cfg files numberParallelJobs = int( self.general["parallelJobs"] ) # limit maximum number of parallel jobs to 40 # (each output file is approximately 20MB) maximumNumberJobs = 40 if numberParallelJobs > maximumNumberJobs: msg = ("Maximum allowed number of parallel jobs " +str(maximumNumberJobs)+" exceeded!!!") raise AllInOneError(msg) # if maxevents is not specified, cannot calculate number of events for # each parallel job, and therefore running only a single job if int( self.general["maxevents"] ) == -1: msg = ("Maximum number of events (maxevents) not specified: " "cannot use parallel jobs in offline validation") raise AllInOneError(msg) if numberParallelJobs > 1: if self.general["offlineModuleLevelHistsTransient"] == "True": msg = ("To be able to merge results when running parallel jobs," " set offlineModuleLevelHistsTransient to false.") raise AllInOneError(msg) for index in range(numberParallelJobs): cfgName = "%s.%s.%s_%s_cfg.py"%(configBaseName, self.name, self.alignmentToValidate.name, str(index)) repMap = self.getRepMap() # in this parallel job, skip index*(maxEvents/nJobs) events from # the beginning # (first index is zero, so no skipping for a single job) # and use _index_ in the name of the output file 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(".oO[datadir]Oo./AlignmentValidation_" + self.name + "_.oO[name]Oo._.oO[nIndex]Oo..root", repMap ) }) repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] ) repMap["outputFile"] = os.path.abspath( repMap["outputFile"] ) cfgs = {cfgName:replaceByMap(configTemplates.offlineParallelTemplate, repMap)} self.filesToCompare[GenericValidationData.defaultReferenceName] = repMap["resultFile"] GenericValidationData.createConfiguration(self, cfgs, path)
def __init__(self, valName, alignment, config): defaults = { "zmumureference": ("/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN2" "/TMP_EM/ZMuMu/data/MC/BiasCheck_DYToMuMu_Summer" "11_TkAlZMuMu_IDEAL.root") } mandatories = [ "dataset", "maxevents", "etamaxneg", "etaminneg", "etamaxpos", "etaminpos" ] GenericValidationData.__init__(self, valName, alignment, config, "zmumu", addDefaults=defaults, addMandatories=mandatories)
def getRepMap( self, alignment = None ): repMap = GenericValidationData.getRepMap(self) repMap.update({ "nEvents": self.general["maxevents"], "TrackCollection": self.general["trackcollection"] }) # repMap["outputFile"] = os.path.abspath( repMap["outputFile"] ) # if self.jobmode.split( ',' )[0] == "crab": # repMap["outputFile"] = os.path.basename( repMap["outputFile"] ) return repMap
def getRepMap(self, alignment=None): repMap = GenericValidationData.getRepMap(self) repMap.update({ "nEvents": self.general["maxevents"], "TrackCollection": self.general["trackcollection"] }) # repMap["outputFile"] = os.path.abspath( repMap["outputFile"] ) # if self.jobmode.split( ',' )[0] == "crab": # repMap["outputFile"] = os.path.basename( repMap["outputFile"] ) return repMap
def getRepMap(self, alignment = None): repMap = GenericValidationData.getRepMap(self, alignment) repMap.update({ "nEvents": self.general["maxevents"], # "outputFile": "zmumuHisto.root" "outputFile": ("0_zmumuHisto.root" ",genSimRecoPlots.root" ",FitParameters.txt") }) return repMap
def __init__(self, valName, alignment, config, configBaseName="TkAlMcValidate", scriptBaseName="TkAlMcValidate", crabCfgBaseName="TkAlMcValidate", resultBaseName="McValidation", outputBaseName="McValidation"): self.configBaseName = configBaseName self.scriptBaseName = scriptBaseName self.crabCfgBaseName = crabCfgBaseName self.resultBaseName = resultBaseName self.outputBaseName = outputBaseName self.needParentFiles = True GenericValidationData.__init__(self, valName, alignment, config, "mcValidate") if self.NJobs > 1: raise AllInOneError( "Parallel jobs not implemented for the MC validation!\n" "Please set parallelJobs = 1.")
def createScript(self, path): scriptName = "TkAlTrackSplitting.%s.%s.sh"%(self.name, self.alignmentToValidate.name) repMap = self.getRepMap() repMap["CommandLine"]="" for cfg in self.configFiles: repMap["CommandLine"]+= (repMap["CommandLineTemplate"] %{"cfgFile":cfg, "postProcess":""}) scripts = {scriptName: replaceByMap(configTemplates.scriptTemplate, repMap)} return GenericValidationData.createScript(self, scripts, path)
def getRepMap(self, alignment = None): repMap = GenericValidationData.getRepMap(self, alignment) repMap.update({ "nEvents": self.general["maxevents"], "TrackSelectionTemplate": configTemplates.TrackSelectionTemplate, "LorentzAngleTemplate": configTemplates.LorentzAngleTemplate, "offlineValidationMode": "Standalone", "offlineValidationFileOutput": configTemplates.offlineFileOutputTemplate, "TrackCollection": self.general["trackcollection"], }) return repMap
def getRepMap( self, alignment = None ): repMap = GenericValidationData.getRepMap(self, alignment) repMap.update({ "outputFile": replaceByMap((".oO[workdir]Oo./McValidation_" + self.name + "_.oO[name]Oo..root"), repMap ), "nEvents": self.general["maxevents"] }) repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] ) repMap["outputFile"] = os.path.abspath( repMap["outputFile"] ) if self.jobmode.split( ',' )[0] == "crab": repMap["outputFile"] = os.path.basename( repMap["outputFile"] ) return repMap
def __init__(self, valName, alignment, config, configBaseName="TkAlTrackSplitting", scriptBaseName="TkAlTrackSplitting", crabCfgBaseName="TkAlTrackSplitting", resultBaseName="TrackSplitting", outputBaseName="TrackSplitting"): mandatories = ["trackcollection"] self.configBaseName = configBaseName self.scriptBaseName = scriptBaseName self.crabCfgBaseName = crabCfgBaseName self.resultBaseName = resultBaseName self.outputBaseName = outputBaseName self.needParentFiles = False GenericValidationData.__init__(self, valName, alignment, config, "split", addMandatories=mandatories)
def getRepMap(self, alignment=None): repMap = GenericValidationData.getRepMap(self, alignment) repMap.update({ "outputFile": replaceByMap((".oO[workdir]Oo./McValidation_" + self.name + "_.oO[name]Oo..root"), repMap), "nEvents": self.general["maxevents"] }) repMap["outputFile"] = os.path.expandvars(repMap["outputFile"]) repMap["outputFile"] = os.path.abspath(repMap["outputFile"]) if self.jobmode.split(',')[0] == "crab": repMap["outputFile"] = os.path.basename(repMap["outputFile"]) return repMap
def getRepMap(self, alignment = None): if alignment == None: alignment = self.alignmentToValidate repMap = GenericValidationData.getRepMap(self, alignment) repMap.update({ "nEvents": self.general["maxevents"], "outputFile": ("0_zmumuHisto.root" ",genSimRecoPlots.root" ",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
def createConfiguration(self, path): cfgName = "%s.%s.%s_cfg.py" % (self.configBaseName, self.name, self.alignmentToValidate.name) repMap = self.getRepMap() if self.NJobs > 1 and self.general[ "offlineModuleLevelHistsTransient"] == "True": msg = ("To be able to merge results when running parallel jobs," " set offlineModuleLevelHistsTransient to false.") raise AllInOneError(msg) templateToUse = configTemplates.offlineTemplate if self.AutoAlternates: if "Cosmics" in self.general["trackcollection"]: Bfield = self.dataset.magneticFieldForRun() if Bfield > 3.3 and Bfield < 4.3: #Should never be 4.3, but this covers strings, which always compare bigger than ints templateToUse = configTemplates.CosmicsOfflineValidation print( "B field for %s = %sT. Using the template for cosmics at 3.8T.\n" "To override this behavior, specify AutoAlternates = false in the [alternateTemplates] section" ) % (self.dataset.name(), Bfield) elif Bfield < 0.5: templateToUse = configTemplates.CosmicsAt0TOfflineValidation print( "B field for %s = %sT. Using the template for cosmics at 0T.\n" "To override this behavior, specify AutoAlternates = false in the [alternateTemplates] section" ) % (self.dataset.name(), Bfield) else: try: if "unknown " in Bfield: msg = Bfield.replace("unknown ", "", 1) elif "Bfield" is "unknown": msg = "Can't get the B field for %s." % self.dataset.name( ) except TypeError: msg = "B field for %s = %sT. This is not that close to 0T or 3.8T." % ( self.dataset.name(), Bfield) raise AllInOneError( msg + "\n" "To use this data, turn off the automatic alternates using AutoAlternates = false\n" "in the [alternateTemplates] section, and choose the alternate template yourself." ) cfgs = {cfgName: templateToUse} self.filesToCompare[GenericValidationData. defaultReferenceName] = repMap["finalResultFile"] return GenericValidationData.createConfiguration(self, cfgs, path, repMap=repMap)
def getRepMap( self, alignment = None ): repMap = GenericValidationData.getRepMap(self, alignment) repMap.update({ "resultFile": replaceByMap(("/store/caf/user/$USER/.oO[eosdir]Oo." "/McValidation_" + self.name + "_.oO[name]Oo..root"), repMap ), "outputFile": replaceByMap(("McValidation_" + self.name + "_.oO[name]Oo..root"), repMap ), "nEvents": self.general["maxevents"] }) repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] ) repMap["resultFile"] = os.path.expandvars( repMap["resultFile"] ) return repMap
def getRepMap(self, alignment=None): repMap = GenericValidationData.getRepMap(self) if repMap["subdetector"] == "none": subdetselection = "" else: subdetselection = "process.AlignmentTrackSelector.minHitsPerSubDet.in.oO[subdetector]Oo. = 2" repMap.update({ "nEvents": self.general["maxevents"], "TrackCollection": self.general["trackcollection"], "subdetselection": subdetselection, }) # repMap["outputFile"] = os.path.abspath( repMap["outputFile"] ) # if self.jobmode.split( ',' )[0] == "crab": # repMap["outputFile"] = os.path.basename( repMap["outputFile"] ) return repMap
def getRepMap( self, alignment = None ): repMap = GenericValidationData.getRepMap(self) if repMap["subdetector"] == "none": subdetselection = "" else: subdetselection = "process.AlignmentTrackSelector.minHitsPerSubDet.in.oO[subdetector]Oo. = 2" repMap.update({ "nEvents": self.general["maxevents"], "TrackCollection": self.general["trackcollection"], "subdetselection": subdetselection, }) # repMap["outputFile"] = os.path.abspath( repMap["outputFile"] ) # if self.jobmode.split( ',' )[0] == "crab": # repMap["outputFile"] = os.path.basename( repMap["outputFile"] ) return repMap
def createScript(self, path): scriptName = "TkAlTrackSplitting.%s.%s.sh" % ( self.name, self.alignmentToValidate.name) repMap = self.getRepMap() repMap["CommandLine"] = "" for cfg in self.configFiles: repMap["CommandLine"] += (repMap["CommandLineTemplate"] % { "cfgFile": cfg, "postProcess": "" }) scripts = { scriptName: replaceByMap(configTemplates.scriptTemplate, repMap) } return GenericValidationData.createScript(self, scripts, path)
def getRepMap(self, alignment = None): if alignment == None: alignment = self.alignmentToValidate repMap = GenericValidationData.getRepMap(self, alignment) repMap.update({ "nEvents": self.general["maxevents"], "TrackCollection": self.general["trackcollection"], "VertexCollection": self.general["vertexcollection"], "eosdir": os.path.join(self.general["eosdir"]), #"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
def getRepMap( self, alignment = None ): repMap = GenericValidationData.getRepMap(self) repMap.update({ "resultFile": replaceByMap( ("/store/caf/user/$USER/.oO[eosdir]Oo." "/TrackSplitting_" + self.name + "_.oO[name]Oo..root"), repMap ), "outputFile": replaceByMap( ("TrackSplitting_" + self.name + "_.oO[name]Oo..root"), repMap ), "nEvents": self.general["maxevents"], "TrackCollection": self.general["trackcollection"] }) repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] ) repMap["resultFile"] = os.path.expandvars( repMap["resultFile"] ) # repMap["outputFile"] = os.path.abspath( repMap["outputFile"] ) # if self.jobmode.split( ',' )[0] == "crab": # repMap["outputFile"] = os.path.basename( repMap["outputFile"] ) return repMap
def getRepMap(self, alignment = None): repMap = GenericValidationData.getRepMap(self, alignment) repMap.update({ "nEvents": self.general["maxevents"], "outputFile": replaceByMap( ("AlignmentValidation_" + self.name + "_.oO[name]Oo..root"), repMap ), "resultFile": replaceByMap( ("/store/caf/user/$USER/.oO[eosdir]Oo." "/AlignmentValidation_" + self.name + "_.oO[name]Oo..root"), repMap ), "TrackSelectionTemplate": configTemplates.TrackSelectionTemplate, "LorentzAngleTemplate": configTemplates.LorentzAngleTemplate, "offlineValidationMode": "Standalone", "offlineValidationFileOutput": configTemplates.offlineStandaloneFileOutputTemplate, "TrackCollection": self.general["trackcollection"] }) repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] ) repMap["resultFile"] = os.path.expandvars( repMap["resultFile"] ) return repMap