Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-13 03:23:09

0001 import os
0002 import FWCore.ParameterSet.Config as cms
0003 
0004 ##
0005 ## Setup command line options
0006 ##
0007 import FWCore.ParameterSet.VarParsing as VarParsing
0008 import sys
0009 options = VarParsing.VarParsing ('standard')
0010 options.register('iteration', 0, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Iteration number")
0011 options.register('isBaseline', False, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.bool, "Set baseline")
0012 options.register('workingArea', None, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Working folder")
0013 options.register('measName', None, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Folder in which to store results")
0014 options.register('baselineName', "Design", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Folder in which baseline-trees are found or stored")
0015 
0016 # get and parse the command line arguments
0017 options.parseArguments()
0018 
0019 ##
0020 ## Process definition
0021 ##
0022 process = cms.Process("ApeEstimatorSummary")
0023 
0024 ##
0025 ## Message Logger
0026 ##
0027 process.load("FWCore.MessageService.MessageLogger_cfi")
0028 process.MessageLogger.CalculateAPE=dict()
0029 process.MessageLogger.cerr.INFO.limit = 0
0030 process.MessageLogger.cerr.default.limit = 0
0031 process.MessageLogger.cerr.CalculateAPE = cms.untracked.PSet(limit = cms.untracked.int32(-1))
0032 process.MessageLogger.cerr.FwkReport.reportEvery = 1000 ## really show only every 1000th
0033 
0034 ##
0035 ## Process options
0036 ##
0037 process.options = cms.untracked.PSet(
0038     wantSummary = cms.untracked.bool(True),
0039 )
0040 
0041 ##
0042 ## Input Files
0043 ##
0044 process.source = cms.Source("EmptySource",
0045                     numberEventsInRun = cms.untracked.uint32(1),
0046                     firstRun = cms.untracked.uint32(1)
0047                     )
0048 
0049 ##
0050 ## Number of Events
0051 ##
0052 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) )
0053 
0054 ### To get default APEs from GT
0055 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0056 from Configuration.AlCa.GlobalTag import GlobalTag
0057 from CondCore.CondDB.CondDB_cfi import *
0058 
0059 # does not really matter here because we dont use anything from conditions anyway
0060 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_design', '')
0061 # except that we could load an APE tag here, which would then be read out and written to allData_defaultApe.root, but there is really no point
0062 
0063 ##
0064 ## ApeEstimatorSummary
0065 ##
0066 from Alignment.APEEstimation.ApeEstimatorSummary_cff import *
0067 process.ApeEstimatorSummarySequence = cms.Sequence()
0068 if options.isBaseline:
0069   process.ApeEstimatorSummary1 = ApeEstimatorSummaryBaseline.clone(
0070     # baseline will be set
0071     BaselineFile = os.path.join(options.workingArea,options.baselineName, "baseline",'allData_baselineApe.root'),
0072     DefaultFile = os.path.join(options.workingArea,options.baselineName, "baseline", 'allData_defaultApe.root'),
0073     InputFile = os.path.join(options.workingArea,options.baselineName, "baseline",'allData.root'),
0074     ResultsFile = os.path.join(options.workingArea,options.baselineName, "baseline",'allData_resultsFile.root'),
0075   )
0076   process.ApeEstimatorSummary2 = ApeEstimatorSummaryIter.clone(
0077     BaselineFile = os.path.join(options.workingArea,options.baselineName, "baseline",'allData_baselineApe.root'),
0078     InputFile = os.path.join(options.workingArea,options.baselineName, "baseline",'allData.root'),
0079     ResultsFile = os.path.join(options.workingArea,options.baselineName, "baseline",'allData_resultsFile.root'),
0080     # files are not in use in baseline mode
0081     IterationFile = os.path.join(options.workingArea,options.baselineName, "baseline", 'allData_iterationApe.root'),
0082     DefaultFile = os.path.join(options.workingArea,options.baselineName, "baseline", 'allData_defaultApe.root'),
0083     ApeOutputFile = os.path.join(options.workingArea,options.baselineName, "baseline", 'allData_apeOutput.txt'),
0084   )
0085   process.ApeEstimatorSummarySequence *= process.ApeEstimatorSummary1
0086   process.ApeEstimatorSummarySequence *= process.ApeEstimatorSummary2
0087 else:
0088   process.ApeEstimatorSummary1 = ApeEstimatorSummaryIter.clone(
0089     # keep the same for all jobs
0090     BaselineFile = os.path.join(options.workingArea,options.baselineName, "baseline",'allData_baselineApe.root'),
0091     # keep the first one on misaligned geometry for iterations on same geometry (or better use copy of it)
0092     IterationFile = os.path.join(options.workingArea,options.measName, 'iter'+str(options.iteration), 'allData_iterationApe.root'),
0093     # change iteration number for these
0094     InputFile = os.path.join(options.workingArea,options.measName, 'iter'+str(options.iteration), 'allData.root'),
0095     ResultsFile = os.path.join(options.workingArea,options.measName, 'iter'+str(options.iteration), 'allData_resultsFile.root'),
0096     ApeOutputFile = os.path.join(options.workingArea,options.measName, 'iter'+str(options.iteration), 'allData_apeOutput.txt'),
0097     DefaultFile = os.path.join(options.workingArea,options.measName, 'iter'+str(options.iteration), 'allData_defaultApe.root'),
0098   )
0099   process.ApeEstimatorSummarySequence *= process.ApeEstimatorSummary1
0100 
0101 
0102 
0103 ##
0104 ## Path
0105 ##
0106 process.p = cms.Path(
0107     process.ApeEstimatorSummarySequence
0108 )
0109 
0110 
0111 
0112 
0113 
0114