1 from alternateValidationTemplates
import *
2 from offlineValidationTemplates
import *
3 from primaryVertexValidationTemplates
import *
4 from geometryComparisonTemplates
import *
5 from monteCarloValidationTemplates
import *
6 from trackSplittingValidationTemplates
import *
7 from zMuMuValidationTemplates
import *
8 from TkAlExceptions
import AllInOneError
20 loadGlobalTagTemplate=
""" 22 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") 23 from Configuration.AlCa.GlobalTag import GlobalTag 24 process.GlobalTag = GlobalTag(process.GlobalTag,".oO[GlobalTag]Oo.") 30 conditionsTemplate=
""" 31 process.conditionsIn.oO[rcdName]Oo. = CalibTracker.Configuration.Common.PoolDBESSource_cfi.poolDBESSource.clone( 32 connect = cms.string('.oO[connectString]Oo.'), 33 toGet = cms.VPSet(cms.PSet(record = cms.string('.oO[rcdName]Oo.'), 34 tag = cms.string('.oO[tagName]Oo.') 38 process.prefer_conditionsIn.oO[rcdName]Oo. = cms.ESPrefer("PoolDBESSource", "conditionsIn.oO[rcdName]Oo.") 49 #export STAGE_SVCCLASS=cmscafuser 50 #save path to the LSF batch working directory (/pool/lsf) 52 export LSFWORKDIR=`pwd -P` 53 echo LSF working directory is $LSFWORKDIR 54 source /afs/cern.ch/cms/caf/setup.sh 55 export X509_USER_PROXY=.oO[scriptsdir]Oo./.user_proxy 56 cd .oO[CMSSW_BASE]Oo./src 57 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo. 59 #rfmkdir -p .oO[datadir]Oo. &>! /dev/null 61 #remove possible result file from previous runs 62 previous_results=$(ls /eos/cms/store/caf/user/$USER/.oO[eosdir]Oo.) 63 for file in ${previous_results} 65 if [ ${file} = /eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./.oO[outputFile]Oo. ] 67 xrdcp -f root://eoscms//eos/cms${file} root://eoscms//eos/cms${file}.bak 71 if [[ $HOSTNAME = lxplus[0-9]*[.a-z0-9]* ]] # check for interactive mode 73 rfmkdir -p .oO[workdir]Oo. 74 rm -f .oO[workdir]Oo./* 77 mkdir -p $LSFWORKDIR/TkAllInOneTool 78 cd $LSFWORKDIR/TkAllInOneTool 81 # rm -f .oO[workdir]Oo./* 89 echo "List of files in $(pwd):" 96 rfmkdir -p .oO[logdir]Oo. >&! /dev/null 97 gzip -f LOGFILE_*_.oO[name]Oo..log 98 find . -maxdepth 1 -name "LOGFILE*.oO[alignmentName]Oo.*" -print | xargs -I {} bash -c "rfcp {} .oO[logdir]Oo." 100 #copy root files to eos 101 mkdir -p /eos/cms/store/caf/user/$USER/.oO[eosdir]Oo. 102 if [ .oO[parallelJobs]Oo. -eq 1 ] 104 root_files=$(ls --color=never -d *.oO[alignmentName]Oo.*.root) 106 root_files=$(ls --color=never -d *.oO[alignmentName]Oo._.oO[nIndex]Oo.*.root) 110 for file in ${root_files} 112 xrdcp -f ${file} root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo. 117 if [[ $HOSTNAME = lxplus[0-9]*[.a-z0-9]* ]] # check for interactive mode 119 rm -rf .oO[workdir]Oo. 128 import FWCore.ParameterSet.Config as cms 130 process = cms.Process(".oO[ProcessName]Oo.") 132 .oO[datasetDefinition]Oo. 134 .oO[LoadBasicModules]Oo. 135 .oO[TrackSelectionRefitting]Oo. 136 .oO[LoadGlobalTagTemplate]Oo. 138 .oO[ValidationConfig]Oo. 139 .oO[FileOutputTemplate]Oo. 148 process.options = cms.untracked.PSet( 149 wantSummary = cms.untracked.bool(False), 150 Rethrow = cms.untracked.vstring("ProductNotFound"), # make this exception fatal 151 fileMode = cms.untracked.string('NOMERGE') # no ordering needed, but calls endRun/beginRun etc. at file boundaries 154 process.load("FWCore.MessageLogger.MessageLogger_cfi") 155 process.MessageLogger.destinations = ['cout', 'cerr'] 156 process.MessageLogger.cerr.FwkReport.reportEvery = 1000 157 process.MessageLogger.statistics.append('cout') 163 CommonTrackSelectionRefitting =
""" 164 import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit 165 process.seqTrackselRefit = trackselRefit.getSequence(process, '.oO[trackcollection]Oo.', 166 TTRHBuilder='.oO[ttrhbuilder]Oo.', 167 usePixelQualityFlag=.oO[usepixelqualityflag]Oo., 168 openMassWindow=.oO[openmasswindow]Oo., 169 cosmicsDecoMode=.oO[cosmicsdecomode]Oo., 170 cosmicsZeroTesla=.oO[cosmics0T]Oo., 171 momentumConstraint=.oO[momentumconstraint]Oo., 172 cosmicTrackSplitting=.oO[istracksplitting]Oo., 173 use_d0cut=.oO[use_d0cut]Oo., 176 .oO[trackhitfiltercommands]Oo. 182 SingleTrackRefitter =
""" 183 process.load("RecoTracker.TrackProducer.TrackRefitters_cff") 184 process.TrackRefitter.src = ".oO[TrackCollection]Oo." 185 process.TrackRefitter.TTRHBuilder = ".oO[ttrhbuilder]Oo." 186 process.TrackRefitter.NavigationSchool = "" 192 LoadBasicModules =
""" 193 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff") 194 process.load("Configuration.Geometry.GeometryDB_cff") 195 process.load('Configuration.StandardSequences.Services_cff') 196 process.load("Configuration.StandardSequences..oO[magneticField]Oo._cff") 202 FileOutputTemplate =
""" 203 process.TFileService = cms.Service("TFileService", 204 fileName = cms.string('.oO[outputFile]Oo.') 211 DefinePath_CommonSelectionRefitting =
""" 212 process.p = cms.Path( 213 process.seqTrackselRefit*.oO[ValidationSequence]Oo.) 221 cd .oO[CMSSW_BASE]Oo./src 222 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo. 223 eval `scramv1 ru -sh` 226 .oO[createResultsDirectory]Oo. 228 if [[ $HOSTNAME = lxplus[0-9]*[.a-z0-9]* ]] # check for interactive mode 230 mkdir -p .oO[workdir]Oo. 235 echo "Working directory: $(pwd -P)" 237 ############################################################################### 238 # download root files from eos 239 root_files=$(ls /eos/cms/store/caf/user/$USER/.oO[eosdir]Oo. \ 240 | grep ".root$" | grep -v "result.root$") 241 #for file in ${root_files} 243 # xrdcp -f root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./${file} . 250 .oO[CompareAlignments]Oo. 252 .oO[RunValidationPlots]Oo. 258 #zip stdout and stderr from the farm jobs 260 find . -name "*.stderr" -exec gzip -f {} \; 261 find . -name "*.stdout" -exec gzip -f {} \; 268 mergeParallelOfflineTemplate=
""" 271 cd .oO[CMSSW_BASE]Oo./src 272 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo. 273 eval `scramv1 ru -sh` 275 if [[ $HOSTNAME = lxplus[0-9]*[.a-z0-9]* ]] # check for interactive mode 277 mkdir -p .oO[workdir]Oo. 282 echo "Working directory: $(pwd -P)" 284 ############################################################################### 285 # download root files from eos 286 root_files=$(ls /eos/cms/store/caf/user/$USER/.oO[eosdir]Oo. \ 287 | grep ".root$" | grep -v "result.root$") 288 #for file in ${root_files} 290 # xrdcp -f root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./${file} . 301 createResultsDirectoryTemplate=
""" 302 #create results-directory and copy used configuration there 303 rfmkdir -p .oO[datadir]Oo. 304 rfcp .oO[logdir]Oo./usedConfiguration.ini .oO[datadir]Oo. 310 mergeParallelResults=
""" 316 ls -al .oO[mergeParallelFilePrefixes]Oo. > .oO[datadir]Oo./log_rootfilelist.txt 318 # Remove parallel job files 325 compareAlignmentsExecution=
""" 326 #merge for .oO[validationId]Oo. if it does not exist or is not up-to-date 327 echo -e "\n\nComparing validations" 328 mkdir -p /eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./ 329 cp .oO[Alignment/OfflineValidation]Oo./scripts/compareFileAges.C . 330 root -x -q -b -l "compareFileAges.C(\\\"root://eoscms.cern.ch//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./.oO[validationId]Oo._result.root\\\", \\\".oO[compareStringsPlain]Oo.\\\")" 331 comparisonNeeded=${?} 333 if [[ ${comparisonNeeded} -eq 1 ]] 335 cp .oO[compareAlignmentsPath]Oo. . 336 root -x -q -b -l '.oO[compareAlignmentsName]Oo.++(\".oO[compareStrings]Oo.\", ".oO[legendheader]Oo.", ".oO[customtitle]Oo.", ".oO[customrighttitle]Oo.", .oO[bigtext]Oo.)' 337 mv result.root .oO[validationId]Oo._result.root 338 xrdcp -f .oO[validationId]Oo._result.root root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo. 340 echo ".oO[validationId]Oo._result.root is up-to-date, no need to compare again." 341 xrdcp -f root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./.oO[validationId]Oo._result.root . 355 datasetpath = .oO[dataset]Oo. 356 pset = .oO[cfgFile]Oo. 357 total_number_of_.oO[McOrData]Oo. 358 number_of_jobs = .oO[numberOfJobs]Oo. 359 output_file = .oO[outputFile]Oo. 360 runselection = .oO[runRange]Oo. 361 lumi_mask = .oO[JSON]Oo. 366 storage_element = T2_CH_CERN 367 user_remote_dir = .oO[eosdir]Oo. 368 ui_working_dir = .oO[crabWorkingDir]Oo. 369 # script_exe = .oO[script]Oo. 373 queue = .oO[queue]Oo. 390 if not templateName
in globals().
keys():
391 msg =
"unknown template to replace %s"%templateName
393 if not alternateTemplateName
in globals().
keys():
394 msg =
"unknown template to replace %s"%alternateTemplateName
396 globals()[ templateName ] = globals()[ alternateTemplateName ]
def alternateTemplate(templateName, alternateTemplateName)
Alternate Templates ###