Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-19 23:58:18

0001 PrimaryVertexResolutionTemplate="""
0002 
0003 HLTSel = .oO[doTriggerSelection]Oo.
0004 
0005 ###################################################################
0006 #  Runs and events
0007 ###################################################################
0008 runboundary = .oO[runboundary]Oo.
0009 isMultipleRuns=False
0010 if(isinstance(runboundary, (list, tuple))):
0011      isMultipleRuns=True
0012      print("Multiple Runs are selected")
0013 
0014 if(isMultipleRuns):
0015      process.source.firstRun = cms.untracked.uint32(int(runboundary[0]))
0016 else:
0017      process.source.firstRun = cms.untracked.uint32(int(runboundary))
0018 
0019 
0020 ###################################################################
0021 # The trigger filter module
0022 ###################################################################
0023 from HLTrigger.HLTfilters.triggerResultsFilter_cfi import *
0024 process.theHLTFilter = triggerResultsFilter.clone(
0025     triggerConditions = cms.vstring(.oO[triggerBits]Oo.),
0026     hltResults = cms.InputTag( "TriggerResults", "", "HLT" ),
0027     l1tResults = cms.InputTag( "" ),
0028     throw = cms.bool(False)
0029 )
0030 
0031 ###################################################################
0032 # PV refit
0033 ###################################################################
0034 process.load("TrackingTools.TransientTrack.TransientTrackBuilder_cfi")
0035 
0036 from RecoVertex.PrimaryVertexProducer.OfflinePrimaryVertices_cfi import offlinePrimaryVertices 
0037 process.offlinePrimaryVerticesFromRefittedTrks  = offlinePrimaryVertices.clone()
0038 process.offlinePrimaryVerticesFromRefittedTrks.TrackLabel                                       = cms.InputTag("TrackRefitter") 
0039 process.offlinePrimaryVerticesFromRefittedTrks.vertexCollections.maxDistanceToBeam              = 1
0040 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxNormalizedChi2             = 20
0041 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.minSiliconLayersWithHits      = 5
0042 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxD0Significance             = 5.0
0043 # as it was prior to https://github.com/cms-sw/cmssw/commit/c8462ae4313b6be3bbce36e45373aa6e87253c59
0044 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxD0Error                    = 1.0
0045 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxDzError                    = 1.0
0046 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.minPixelLayersWithHits        = 2   
0047 
0048 # Use compressions settings of TFile
0049 # see https://root.cern.ch/root/html534/TFile.html#TFile:SetCompressionSettings
0050 # settings = 100 * algorithm + level
0051 # level is from 1 (small) to 9 (large compression)
0052 # algo: 1 (ZLIB), 2 (LMZA)
0053 # see more about compression & performance: https://root.cern.ch/root/html534/guides/users-guide/InputOutput.html#compression-and-performance
0054 compressionSettings = 207
0055 
0056 ###################################################################
0057 # The PV resolution module
0058 ###################################################################
0059 process.PrimaryVertexResolution = cms.EDAnalyzer('SplitVertexResolution',
0060                                                  compressionSettings = cms.untracked.int32(compressionSettings),
0061                                                  storeNtuple         = cms.bool(False),
0062                                                  vtxCollection       = cms.InputTag("offlinePrimaryVerticesFromRefittedTrks"),
0063                                                  trackCollection     = cms.InputTag("TrackRefitter"),       
0064                                                  minVertexNdf        = cms.untracked.double(10.),
0065                                                  minVertexMeanWeight = cms.untracked.double(0.5),
0066                                                  runControl = cms.untracked.bool(.oO[runControl]Oo.),
0067                                                  runControlNumber = cms.untracked.vuint32(runboundary),
0068                                                  sumpTStartScale = cms.untracked.double(.oO[startScale]Oo.),
0069                                                  sumpTEndScale = cms.untracked.double(.oO[endScale]Oo.),
0070                                                  nTrackBins = cms.untracked.double(.oO[nTracksBins]Oo.),
0071                                                  nVtxBins = cms.untracked.double(.oO[nVtxBins]Oo.)
0072                                                  )
0073 """
0074 
0075 ####################################################################
0076 ####################################################################
0077 PVResolutionPath="""
0078 
0079 process.theValidSequence = cms.Sequence(process.offlineBeamSpot                        +
0080                                         process.TrackRefitter                          +
0081                                         process.offlinePrimaryVerticesFromRefittedTrks +
0082                                         process.PrimaryVertexResolution)
0083 if (HLTSel):
0084     process.p = cms.Path(process.theHLTFilter + process.theValidSequence)
0085 else:
0086     process.p = cms.Path(process.theValidSequence)
0087 """
0088 
0089 ####################################################################
0090 ####################################################################
0091 PVResolutionScriptTemplate="""#!/bin/bash
0092 source /afs/cern.ch/cms/caf/setup.sh
0093 export X509_USER_PROXY=.oO[scriptsdir]Oo./.user_proxy
0094 
0095 source /afs/cern.ch/cms/caf/setup.sh
0096 
0097 echo  -----------------------
0098 echo  Job started at `date`
0099 echo  -----------------------
0100 
0101 export theLabel=.oO[alignmentName]Oo.
0102 export theDate=.oO[runboundary]Oo.
0103 
0104 cwd=`pwd`
0105 cd .oO[CMSSW_BASE]Oo./src
0106 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo.
0107 eval `scram runtime -sh`
0108 cd $cwd
0109 
0110 mkdir -p .oO[datadir]Oo.
0111 mkdir -p .oO[workingdir]Oo.
0112 mkdir -p .oO[logdir]Oo.
0113 rm -f .oO[logdir]Oo./*.stdout
0114 rm -f .oO[logdir]Oo./*.stderr
0115 
0116 if [[ $HOSTNAME = lxplus[0-9]*[.a-z0-9]* ]] # check for interactive mode
0117 then
0118     mkdir -p .oO[workdir]Oo.
0119     rm -f .oO[workdir]Oo./*
0120     cd .oO[workdir]Oo.
0121 else
0122     mkdir -p $cwd/TkAllInOneTool
0123     cd $cwd/TkAllInOneTool
0124 fi
0125 
0126 .oO[CommandLine]Oo.
0127 
0128 ls -lh .
0129 
0130 eos mkdir -p /store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/
0131 
0132 for RootOutputFile in $(ls *root )
0133 do
0134     xrdcp -f ${RootOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./${RootOutputFile}
0135     cp ${RootOutputFile}  .oO[workingdir]Oo.
0136 done
0137 
0138 cp .oO[Alignment/OfflineValidation]Oo./macros/FitPVResolution.C .
0139 cp .oO[Alignment/OfflineValidation]Oo./macros/CMS_lumi.C .
0140 cp .oO[Alignment/OfflineValidation]Oo./macros/CMS_lumi.h .
0141 
0142  if [[ .oO[pvresolutionreference]Oo. == *store* ]]; then xrdcp -f .oO[pvresolutionreference]Oo. PVValidation_reference.root; else ln -fs .oO[pvresolutionreference]Oo. ./PVResolution_reference.root; fi
0143 
0144 root -b -q "FitPVResolution.C(\\"${PWD}/${RootOutputFile}=${theLabel},${PWD}/PVValidation_reference.root=Design simulation\\",\\"$theDate\\")"
0145 
0146 mkdir -p .oO[plotsdir]Oo.
0147 for PngOutputFile in $(ls *png ); do
0148     xrdcp -f ${PngOutputFile}  root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PngOutputFile}
0149     cp ${PngOutputFile}  .oO[plotsdir]Oo.
0150 done
0151 
0152 for PdfOutputFile in $(ls *pdf ); do
0153     xrdcp -f ${PdfOutputFile}  root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PdfOutputFile}
0154     cp ${PdfOutputFile}  .oO[plotsdir]Oo.
0155 done
0156 
0157 echo  -----------------------
0158 echo  Job ended at `date`
0159 echo  -----------------------
0160 
0161 """
0162 
0163 ######################################################################
0164 ######################################################################
0165 
0166 PVResolutionPlotExecution="""
0167 #make primary vertex validation plots
0168 
0169 cp .oO[plottingscriptpath]Oo. .
0170 root -x -b -q .oO[plottingscriptname]Oo.++
0171 
0172 for PdfOutputFile in $(ls *pdf ); do
0173     xrdcp -f ${PdfOutputFile}  root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PdfOutputFile}
0174     cp ${PdfOutputFile}  .oO[datadir]Oo./.oO[PlotsDirName]Oo.
0175 done
0176 
0177 for PngOutputFile in $(ls *png ); do
0178      xrdcp -f ${PngOutputFile}  root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PngOutputFile}
0179     cp ${PngOutputFile}  .oO[datadir]Oo./.oO[PlotsDirName]Oo.
0180 done
0181 
0182 """
0183 
0184 ######################################################################
0185 ######################################################################
0186 
0187 PVResolutionPlotTemplate="""
0188 /****************************************
0189 This can be run directly in root, or you
0190  can run ./TkAlMerge.sh in this directory
0191 ****************************************/
0192 
0193 #include "Alignment/OfflineValidation/macros/FitPVResolution.C"
0194 
0195 void TkAlPrimaryVertexResolutionPlot()
0196 {
0197 
0198   // initialize the plot y-axis ranges
0199  .oO[PlottingInstantiation]Oo.
0200  FitPVResolution("","");
0201 
0202 }
0203 """
0204 
0205