Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:44:23

0001 from __future__ import print_function
0002 import os
0003 
0004 import FWCore.ParameterSet.Config as cms
0005 
0006 
0007 
0008 ##
0009 ## Setup command line options
0010 ##
0011 import FWCore.ParameterSet.VarParsing as VarParsing
0012 import sys
0013 options = VarParsing.VarParsing ('standard')
0014 options.register('iterNumber', 0, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Iteration number")
0015 options.register('setBaseline', False, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.bool, "Set baseline")
0016 options.register('measurementName', "workingArea", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Folder in which to store results")
0017 options.register('baselineName', "Design", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Folder in which baseline-trees are found or stored")
0018 
0019 # get and parse the command line arguments
0020 options.parseArguments()
0021 
0022 print("Iteration number: ", options.iterNumber)
0023 print("Set baseline: ", options.setBaseline)
0024 
0025 
0026 
0027 ##
0028 ## Process definition
0029 ##
0030 process = cms.Process("ApeEstimatorSummary")
0031 
0032 
0033 
0034 ##
0035 ## Message Logger
0036 ##
0037 process.load("FWCore.MessageService.MessageLogger_cfi")
0038 process.MessageLogger.CalculateAPE=dict()
0039 process.MessageLogger.cerr.INFO.limit = 0
0040 process.MessageLogger.cerr.default.limit = 0
0041 process.MessageLogger.cerr.CalculateAPE = cms.untracked.PSet(limit = cms.untracked.int32(-1))
0042 process.MessageLogger.cerr.FwkReport.reportEvery = 1000 ## really show only every 1000th
0043 
0044 
0045 
0046 ##
0047 ## Process options
0048 ##
0049 process.options = cms.untracked.PSet(
0050     wantSummary = cms.untracked.bool(True),
0051 )
0052 
0053 
0054 
0055 ##
0056 ## Input Files
0057 ##
0058 process.source = cms.Source("EmptySource",
0059                     numberEventsInRun = cms.untracked.uint32(1),
0060                     firstRun = cms.untracked.uint32(246994)
0061                     )
0062 
0063 
0064 
0065 ##
0066 ## Number of Events
0067 ##
0068 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) )
0069 
0070 ### To get default APEs from GT
0071 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0072 from Configuration.AlCa.GlobalTag import GlobalTag
0073 from CondCore.CondDB.CondDB_cfi import *
0074 
0075 
0076 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_design', '')
0077 
0078 # Load a certain APE payload to write into allData_defaultApe.root 
0079 CondDBAlignmentError = CondDB.clone(connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS'))
0080 process.myTrackerAlignmentErr = cms.ESSource("PoolDBESSource",
0081     CondDBAlignmentError,
0082     timetype = cms.string("runnumber"),
0083     toGet = cms.VPSet(
0084         cms.PSet(
0085             record = cms.string('TrackerAlignmentErrorExtendedRcd'),
0086             tag = cms.string('TrackerAlignmentExtendedErr_2009_v2_express_IOVs')
0087         )
0088     )
0089 )
0090 process.es_prefer_trackerAlignmentErr = cms.ESPrefer("PoolDBESSource","myTrackerAlignmentErr")
0091 
0092 
0093 ##
0094 ## ApeEstimatorSummary
0095 ##
0096 from Alignment.APEEstimation.ApeEstimatorSummary_cff import *
0097 process.ApeEstimatorSummarySequence = cms.Sequence()
0098 if options.setBaseline:
0099   process.ApeEstimatorSummary1 = ApeEstimatorSummaryBaseline.clone(
0100     # baseline will be set
0101     BaselineFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.baselineName+'/baseline/allData_baselineApe.root',
0102     DefaultFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.baselineName+'/baseline/allData_defaultApe.root',
0103     InputFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.baselineName+'/baseline/allData.root',
0104     ResultsFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.baselineName+'/baseline/allData_resultsFile.root',
0105   )
0106   process.ApeEstimatorSummary2 = ApeEstimatorSummaryIter.clone(
0107     BaselineFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.baselineName+'/baseline/allData_baselineApe.root',
0108     InputFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.baselineName+'/baseline/allData.root',
0109     ResultsFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.baselineName+'/baseline/allData_resultsFile.root',
0110     # files are not in use in baseline mode
0111     IterationFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.baselineName+'/baseline/allData_iterationApe.root',
0112     DefaultFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.baselineName+'/baseline/allData_defaultApe.root',
0113     ApeOutputFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.baselineName+'/baseline/allData_apeOutput.txt',
0114   )
0115   process.ApeEstimatorSummarySequence *= process.ApeEstimatorSummary1
0116   process.ApeEstimatorSummarySequence *= process.ApeEstimatorSummary2
0117 else:
0118   process.ApeEstimatorSummary1 = ApeEstimatorSummaryIter.clone(
0119     # keep the same for all jobs
0120     BaselineFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.baselineName+'/baseline/allData_baselineApe.root',
0121     # keep the first one on misaligned geometry for iterations on same geometry (or better use copy of it)
0122     IterationFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.measurementName+'/iter'+str(options.iterNumber)+'/allData_iterationApe.root',
0123     # change iteration number for these
0124     InputFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.measurementName+'/iter'+str(options.iterNumber)+'/allData.root',
0125     ResultsFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.measurementName+'/iter'+str(options.iterNumber)+'/allData_resultsFile.root',
0126     ApeOutputFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.measurementName+'/iter'+str(options.iterNumber)+'/allData_apeOutput.txt',
0127     DefaultFile = os.environ['CMSSW_BASE'] + '/src/Alignment/APEEstimation/hists/'+options.measurementName+'/iter'+str(options.iterNumber)+'/allData_defaultApe.root',
0128   )
0129   process.ApeEstimatorSummarySequence *= process.ApeEstimatorSummary1
0130 
0131 
0132 
0133 ##
0134 ## Path
0135 ##
0136 process.p = cms.Path(
0137     process.ApeEstimatorSummarySequence
0138 )
0139 
0140 
0141 
0142 
0143 
0144