1 from __future__
import absolute_import
2 from .alternateValidationTemplates
import *
3 from .offlineValidationTemplates
import *
4 from .primaryVertexValidationTemplates
import *
5 from .geometryComparisonTemplates
import *
6 from .monteCarloValidationTemplates
import *
7 from .trackSplittingValidationTemplates
import *
8 from .zMuMuValidationTemplates
import *
9 from .TkAlExceptions
import AllInOneError
10 from .overlapValidationTemplates
import *
22 loadGlobalTagTemplate=
""" 24 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") 25 from Configuration.AlCa.GlobalTag import GlobalTag 26 process.GlobalTag = GlobalTag(process.GlobalTag,".oO[GlobalTag]Oo.") 32 conditionsTemplate=
""" 33 process.conditionsIn.oO[rcdName]Oo. = CalibTracker.Configuration.Common.PoolDBESSource_cfi.poolDBESSource.clone( 34 connect = cms.string('.oO[connectString]Oo.'), 35 toGet = cms.VPSet(cms.PSet(record = cms.string('.oO[rcdName]Oo.'), 36 tag = cms.string('.oO[tagName]Oo.') 40 process.prefer_conditionsIn.oO[rcdName]Oo. = cms.ESPrefer("PoolDBESSource", "conditionsIn.oO[rcdName]Oo.") 47 scriptTemplate=
"""#!/bin/bash 50 #export STAGE_SVCCLASS=cmscafuser 51 #save path to the condor batch working directory (/pool/condor) 53 export CONDORWORKDIR=`pwd -P` 54 echo CONDOR working directory is $CONDORWORKDIR 55 source /afs/cern.ch/cms/caf/setup.sh 56 export X509_USER_PROXY=.oO[scriptsdir]Oo./.user_proxy 57 cd .oO[CMSSW_BASE]Oo./src 58 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo. 60 #mkdir -p .oO[datadir]Oo. &>! /dev/null 62 #remove possible result file from previous runs 63 previous_results=$(ls /eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo.) 64 for file in ${previous_results} 66 if [ ${file} = /eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./.oO[outputFile]Oo. ] 68 xrdcp -f root://eoscms//eos/cms${file} root://eoscms//eos/cms${file}.bak 72 if [[ $HOSTNAME = lxplus[0-9]*[.a-z0-9]* ]] # check for interactive mode 74 mkdir -p .oO[workdir]Oo. 75 rm -f .oO[workdir]Oo./* 78 mkdir -p $CONDORWORKDIR/TkAllInOneTool 79 cd $CONDORWORKDIR/TkAllInOneTool 82 # rm -f .oO[workdir]Oo./* 91 echo "List of files in $(pwd):" 98 mkdir -p .oO[logdir]Oo. >&! /dev/null 99 gzip -f LOGFILE_*_.oO[name]Oo..log 100 find . -maxdepth 1 -name "LOGFILE*.oO[alignmentName]Oo.*" -print | xargs -I {} bash -c "cp {} .oO[logdir]Oo." 102 #copy root files to eos 103 mkdir -p /eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo. 104 if [ .oO[parallelJobs]Oo. -eq 1 ] 106 root_files=$(ls --color=never -d *.oO[alignmentName]Oo.*.root) 108 root_files=$(ls --color=never -d *.oO[alignmentName]Oo._.oO[nIndex]Oo.*.root) 112 for file in ${root_files} 114 xrdcp -f ${file} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo. 119 if [[ $HOSTNAME = lxplus[0-9]*[.a-z0-9]* ]] # check for interactive mode 121 rm -rf .oO[workdir]Oo. 130 import FWCore.ParameterSet.Config as cms 132 process = cms.Process(".oO[ProcessName]Oo.") 134 .oO[datasetDefinition]Oo. 136 .oO[LoadBasicModules]Oo. 137 .oO[TrackSelectionRefitting]Oo. 138 .oO[LoadGlobalTagTemplate]Oo. 140 .oO[ValidationConfig]Oo. 141 .oO[FileOutputTemplate]Oo. 152 process.options = cms.untracked.PSet( 153 wantSummary = cms.untracked.bool(False), 154 Rethrow = cms.untracked.vstring("ProductNotFound"), # make this exception fatal 155 fileMode = cms.untracked.string('NOMERGE') # no ordering needed, but calls endRun/beginRun etc. at file boundaries 158 process.load("FWCore.MessageLogger.MessageLogger_cfi") 159 process.MessageLogger.destinations = ['cout', 'cerr'] 160 process.MessageLogger.cerr.FwkReport.reportEvery = 1000 161 process.MessageLogger.statistics.append('cout') 167 CommonTrackSelectionRefitting =
""" 168 import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit 169 process.seqTrackselRefit = trackselRefit.getSequence(process, '.oO[trackcollection]Oo.', 170 isPVValidation=.oO[ispvvalidation]Oo., 171 TTRHBuilder='.oO[ttrhbuilder]Oo.', 172 usePixelQualityFlag=.oO[usepixelqualityflag]Oo., 173 openMassWindow=.oO[openmasswindow]Oo., 174 cosmicsDecoMode=.oO[cosmicsdecomode]Oo., 175 cosmicsZeroTesla=.oO[cosmics0T]Oo., 176 momentumConstraint=.oO[momentumconstraint]Oo., 177 cosmicTrackSplitting=.oO[istracksplitting]Oo., 178 use_d0cut=.oO[use_d0cut]Oo., 181 .oO[trackhitfiltercommands]Oo. 187 SingleTrackRefitter =
""" 188 process.load("RecoTracker.TrackProducer.TrackRefitters_cff") 189 process.TrackRefitter.src = ".oO[TrackCollection]Oo." 190 process.TrackRefitter.TTRHBuilder = ".oO[ttrhbuilder]Oo." 191 process.TrackRefitter.NavigationSchool = "" 197 LoadBasicModules =
""" 198 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff") 199 process.load("Configuration.Geometry.GeometryDB_cff") 200 process.load('Configuration.StandardSequences.Services_cff') 201 process.load("Configuration.StandardSequences..oO[magneticField]Oo._cff") 207 FileOutputTemplate =
""" 208 process.TFileService = cms.Service("TFileService", 209 fileName = cms.string('.oO[outputFile]Oo.') 216 DefinePath_CommonSelectionRefitting =
""" 217 process.p = cms.Path( 218 process.seqTrackselRefit*.oO[ValidationSequence]Oo.) 223 mergeTemplate=
"""#!/bin/bash 225 cd .oO[CMSSW_BASE]Oo./src 226 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo. 227 eval `scramv1 ru -sh` 230 .oO[createResultsDirectory]Oo. 232 if [[ $HOSTNAME = lxplus[0-9]*[.a-z0-9]* ]] # check for interactive mode 234 mkdir -p .oO[workdir]Oo. 239 echo "Working directory: $(pwd -P)" 241 ############################################################################### 242 # download root files from eos 243 root_files=$(ls /eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo. \ 244 | grep ".root$" | grep -v "result.root$") 245 #for file in ${root_files} 247 # xrdcp -f root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./${file} . 254 .oO[CompareAlignments]Oo. 256 .oO[RunValidationPlots]Oo. 262 #zip stdout and stderr from the farm jobs 264 find . -name "*.stderr" -exec gzip -f {} \; 265 find . -name "*.stdout" -exec gzip -f {} \; 272 mergeParallelOfflineTemplate=
"""#!/bin/bash 274 cd .oO[CMSSW_BASE]Oo./src 275 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo. 276 eval `scramv1 ru -sh` 278 if [[ $HOSTNAME = lxplus[0-9]*[.a-z0-9]* ]] # check for interactive mode 280 mkdir -p .oO[workdir]Oo. 285 echo "Working directory: $(pwd -P)" 287 ############################################################################### 288 # download root files from eos 289 root_files=$(ls /eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo. \ 290 | grep ".root$" | grep -v "result.root$") 291 #for file in ${root_files} 293 # xrdcp -f root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./${file} . 304 createResultsDirectoryTemplate=
""" 305 #create results-directory and copy used configuration there 306 mkdir -p .oO[datadir]Oo. 307 cp .oO[logdir]Oo./usedConfiguration.ini .oO[datadir]Oo. 313 mergeParallelResults=
""" 319 ls -al .oO[mergeParallelFilePrefixes]Oo. > .oO[datadir]Oo./log_rootfilelist.txt 321 # Remove parallel job files 328 compareAlignmentsExecution=
""" 329 #merge for .oO[validationId]Oo. if it does not exist or is not up-to-date 330 echo -e "\n\nComparing validations" 331 mkdir -p /eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./ 332 cp .oO[Alignment/OfflineValidation]Oo./scripts/compareFileAges.C . 333 root -x -q -b -l "compareFileAges.C(\\\"root://eoscms.cern.ch//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./.oO[validationId]Oo._result.root\\\", \\\".oO[compareStringsPlain]Oo.\\\")" 334 comparisonNeeded=${?} 336 if [[ ${comparisonNeeded} -eq 1 ]] 338 cp .oO[compareAlignmentsPath]Oo. . 339 root -x -q -b -l '.oO[compareAlignmentsName]Oo.++(\".oO[compareStrings]Oo.\", ".oO[legendheader]Oo.", ".oO[customtitle]Oo.", ".oO[customrighttitle]Oo.", .oO[bigtext]Oo.)' 340 mv result.root .oO[validationId]Oo._result.root 341 xrdcp -f .oO[validationId]Oo._result.root root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo. 343 echo ".oO[validationId]Oo._result.root is up-to-date, no need to compare again." 344 xrdcp -f root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./.oO[validationId]Oo._result.root . 358 datasetpath = .oO[dataset]Oo. 359 pset = .oO[cfgFile]Oo. 360 total_number_of_.oO[McOrData]Oo. 361 number_of_jobs = .oO[numberOfJobs]Oo. 362 output_file = .oO[outputFile]Oo. 363 runselection = .oO[runRange]Oo. 364 lumi_mask = .oO[JSON]Oo. 369 storage_element = T2_CH_CERN 370 user_remote_dir = .oO[eosdir]Oo. 371 ui_working_dir = .oO[crabWorkingDir]Oo. 372 # script_exe = .oO[script]Oo. 376 queue = .oO[queue]Oo. 393 if not templateName
in globals().
keys():
394 msg =
"unknown template to replace %s"%templateName
396 if not alternateTemplateName
in globals().
keys():
397 msg =
"unknown template to replace %s"%alternateTemplateName
399 globals()[ templateName ] = globals()[ alternateTemplateName ]
def alternateTemplate(templateName, alternateTemplateName)
Alternate Templates ###