1 PrimaryVertexValidationTemplate=
""" 6 ################################################################### 8 ################################################################### 9 runboundary = .oO[runboundary]Oo. 11 if(isinstance(runboundary, (list, tuple))): 13 print "Multiple Runs are selected" 16 process.source.firstRun = cms.untracked.uint32(int(runboundary[0])) 18 process.source.firstRun = cms.untracked.uint32(int(runboundary)) 20 ################################################################### 22 ################################################################### 24 print ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: This is simulation!" 27 print ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: This is real DATA!" 28 if ('.oO[lumilist]Oo.'): 29 print ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: JSON filtering with: .oO[lumilist]Oo. " 30 import FWCore.PythonUtilities.LumiList as LumiList 31 process.source.lumisToProcess = LumiList.LumiList(filename ='.oO[lumilist]Oo.').getVLuminosityBlockRange() 33 #################################################################### 34 # Produce the Transient Track Record in the event 35 #################################################################### 36 process.load("TrackingTools.TransientTrack.TransientTrackBuilder_cfi") 38 #################################################################### 39 # Load and Configure event selection 40 #################################################################### 41 process.primaryVertexFilter = cms.EDFilter("VertexSelector", 42 src = cms.InputTag(".oO[VertexCollection]Oo."), 43 cut = cms.string("!isFake && ndof > 4 && abs(z) <= 24 && position.Rho <= 2"), 44 filter = cms.bool(True) 47 process.noscraping = cms.EDFilter("FilterOutScraping", 48 applyfilter = cms.untracked.bool(True), 49 src = cms.untracked.InputTag(".oO[TrackCollection]Oo."), 50 debugOn = cms.untracked.bool(False), 51 numtrack = cms.untracked.uint32(10), 52 thresh = cms.untracked.double(0.25) 56 process.load("Alignment.CommonAlignment.filterOutLowPt_cfi") 57 process.filterOutLowPt.src = ".oO[TrackCollection]Oo." 58 process.filterOutLowPt.ptmin = .oO[ptCut]Oo. 59 process.filterOutLowPt.runControl = .oO[runControl]Oo. 61 process.filterOutLowPt.runControlNumber.extend((runboundary)) 63 process.filterOutLowPt.runControlNumber = [runboundary] 66 process.goodvertexSkim = cms.Sequence(process.noscraping + process.filterOutLowPt) 68 process.goodvertexSkim = cms.Sequence(process.primaryVertexFilter + process.noscraping + process.filterOutLowPt) 70 #################################################################### 71 # Deterministic annealing clustering 72 #################################################################### 74 print ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: Running DA Algorithm!" 75 process.PVValidation = cms.EDAnalyzer("PrimaryVertexValidation", 76 TrackCollectionTag = cms.InputTag("FinalTrackRefitter"), 77 VertexCollectionTag = cms.InputTag(".oO[VertexCollection]Oo."), 78 Debug = cms.bool(False), 79 storeNtuple = cms.bool(False), 80 useTracksFromRecoVtx = cms.bool(False), 81 isLightNtuple = cms.bool(True), 82 askFirstLayerHit = cms.bool(False), 83 forceBeamSpot = cms.untracked.bool(.oO[forceBeamSpot]Oo.), 84 probePt = cms.untracked.double(.oO[ptCut]Oo.), 85 probeEta = cms.untracked.double(.oO[etaCut]Oo.), 86 doBPix = cms.untracked.bool(.oO[doBPix]Oo.), 87 doFPix = cms.untracked.bool(.oO[doFPix]Oo.), 88 numberOfBins = cms.untracked.int32(.oO[numberOfBins]Oo.), 89 runControl = cms.untracked.bool(.oO[runControl]Oo.), 90 runControlNumber = cms.untracked.vuint32(runboundary), 92 TkFilterParameters = cms.PSet(algorithm=cms.string('filter'), 93 maxNormalizedChi2 = cms.double(5.0), # chi2ndof < 5 94 minPixelLayersWithHits = cms.int32(2), # PX hits > 2 95 minSiliconLayersWithHits = cms.int32(5), # TK hits > 5 96 maxD0Significance = cms.double(5.0), # fake cut (requiring 1 PXB hit) 97 minPt = cms.double(0.0), # better for softish events 98 maxEta = cms.double(5.0), # as per recommendation in PR #18330 99 trackQuality = cms.string("any") 102 ## MM 04.05.2017 (use settings as in: https://github.com/cms-sw/cmssw/pull/18330) 103 TkClusParameters=cms.PSet(algorithm=cms.string('DA_vect'), 104 TkDAClusParameters = cms.PSet(coolingFactor = cms.double(0.6), # moderate annealing speed 105 Tmin = cms.double(2.0), # end of vertex splitting 106 Tpurge = cms.double(2.0), # cleaning 107 Tstop = cms.double(0.5), # end of annealing 108 vertexSize = cms.double(0.006), # added in quadrature to track-z resolutions 109 d0CutOff = cms.double(3.), # downweight high IP tracks 110 dzCutOff = cms.double(3.), # outlier rejection after freeze-out (T<Tmin) 111 zmerge = cms.double(1e-2), # merge intermediat clusters separated by less than zmerge 112 uniquetrkweight = cms.double(0.8) # require at least two tracks with this weight at T=Tpurge 117 #################################################################### 119 #################################################################### 121 print ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: Running GAP Algorithm!" 122 process.PVValidation = cms.EDAnalyzer("PrimaryVertexValidation", 123 TrackCollectionTag = cms.InputTag("FinalTrackRefitter"), 124 VertexCollectionTag = cms.InputTag(".oO[VertexCollection]Oo."), 125 Debug = cms.bool(False), 126 isLightNtuple = cms.bool(True), 127 storeNtuple = cms.bool(False), 128 useTracksFromRecoVtx = cms.bool(False), 129 askFirstLayerHit = cms.bool(False), 130 forceBeamSpot = cms.untracked.bool(.oO[forceBeamSpot]Oo.), 131 probePt = cms.untracked.double(.oO[ptCut]Oo.), 132 probeEta = cms.untracked.double(.oO[etaCut]Oo.), 133 doBPix = cms.untracked.bool(.oO[doBPix]Oo.), 134 doFPix = cms.untracked.bool(.oO[doFPix]Oo.), 135 numberOfBins = cms.untracked.int32(.oO[numberOfBins]Oo.), 136 runControl = cms.untracked.bool(.oO[runControl]Oo.), 137 runControlNumber = cms.untracked.vuint32(int(.oO[runboundary]Oo.)), 139 TkFilterParameters = cms.PSet(algorithm=cms.string('filter'), 140 maxNormalizedChi2 = cms.double(5.0), # chi2ndof < 20 141 minPixelLayersWithHits=cms.int32(2), # PX hits > 2 142 minSiliconLayersWithHits = cms.int32(5), # TK hits > 5 143 maxD0Significance = cms.double(5.0), # fake cut (requiring 1 PXB hit) 144 minPt = cms.double(0.0), # better for softish events 145 maxEta = cms.double(5.0), # as per recommendation in PR #18330 146 trackQuality = cms.string("any") 149 TkClusParameters = cms.PSet(algorithm = cms.string('gap'), 150 TkGapClusParameters = cms.PSet(zSeparation = cms.double(0.2) # 0.2 cm max separation betw. clusters 160 process.p = cms.Path(process.goodvertexSkim* 161 process.seqTrackselRefit* 162 process.PVValidation) 167 PVValidationScriptTemplate=
"""#!/bin/bash 168 source /afs/cern.ch/cms/caf/setup.sh 169 export X509_USER_PROXY=.oO[scriptsdir]Oo./.user_proxy 171 echo ----------------------- 172 echo Job started at `date` 173 echo ----------------------- 175 export theLabel=.oO[alignmentName]Oo. 176 export theDate=.oO[runboundary]Oo. 179 cd .oO[CMSSW_BASE]Oo./src 180 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo. 181 eval `scram runtime -sh` 184 mkdir -p .oO[datadir]Oo. 185 mkdir -p .oO[workingdir]Oo. 186 mkdir -p .oO[logdir]Oo. 187 rm -f .oO[logdir]Oo./*.stdout 188 rm -f .oO[logdir]Oo./*.stderr 190 if [[ $HOSTNAME = lxplus[0-9]*[.a-z0-9]* ]] # check for interactive mode 192 mkdir -p .oO[workdir]Oo. 193 rm -f .oO[workdir]Oo./* 196 mkdir -p $cwd/TkAllInOneTool 197 cd $cwd/TkAllInOneTool 204 eos mkdir -p /store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/ 205 for RootOutputFile in $(ls *root ) 207 xrdcp -f ${RootOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./${RootOutputFile} 208 cp ${RootOutputFile} .oO[workingdir]Oo. 211 cp .oO[Alignment/OfflineValidation]Oo./macros/FitPVResiduals.C . 212 cp .oO[Alignment/OfflineValidation]Oo./macros/CMS_lumi.C . 213 cp .oO[Alignment/OfflineValidation]Oo./macros/CMS_lumi.h . 215 if [[ .oO[pvvalidationreference]Oo. == *store* ]]; then xrdcp -f .oO[pvvalidationreference]Oo. PVValidation_reference.root; else ln -fs .oO[pvvalidationreference]Oo. ./PVValidation_reference.root; fi 217 root -b -q "FitPVResiduals.C(\\"${PWD}/${RootOutputFile}=${theLabel},${PWD}/PVValidation_reference.root=Design simulation\\",true,true,\\"$theDate\\")" 219 mkdir -p .oO[plotsdir]Oo. 220 for PngOutputFile in $(ls *png ); do 221 xrdcp -f ${PngOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PngOutputFile} 222 cp ${PngOutputFile} .oO[plotsdir]Oo. 225 for PdfOutputFile in $(ls *pdf ); do 226 xrdcp -f ${PdfOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PdfOutputFile} 227 cp ${PdfOutputFile} .oO[plotsdir]Oo. 230 mkdir .oO[plotsdir]Oo./Biases/ 231 mkdir .oO[plotsdir]Oo./Biases/dzPhi 232 mkdir .oO[plotsdir]Oo./Biases/dxyPhi 233 mkdir .oO[plotsdir]Oo./Biases/dzEta 234 mkdir .oO[plotsdir]Oo./Biases/dxyEta 235 mkdir .oO[plotsdir]Oo./Fit 236 mkdir .oO[plotsdir]Oo./dxyVsEta 237 mkdir .oO[plotsdir]Oo./dzVsEta 238 mkdir .oO[plotsdir]Oo./dxyVsPhi 239 mkdir .oO[plotsdir]Oo./dzVsPhi 240 mkdir .oO[plotsdir]Oo./dxyVsEtaNorm 241 mkdir .oO[plotsdir]Oo./dzVsEtaNorm 242 mkdir .oO[plotsdir]Oo./dxyVsPhiNorm 243 mkdir .oO[plotsdir]Oo./dzVsPhiNorm 245 mv .oO[plotsdir]Oo./BiasesCanvas* .oO[plotsdir]Oo./Biases/ 246 mv .oO[plotsdir]Oo./dzPhiBiasCanvas* .oO[plotsdir]Oo./Biases/dzPhi 247 mv .oO[plotsdir]Oo./dxyPhiBiasCanvas* .oO[plotsdir]Oo./Biases/dxyPhi 248 mv .oO[plotsdir]Oo./dzEtaBiasCanvas* .oO[plotsdir]Oo./Biases/dzEta 249 mv .oO[plotsdir]Oo./dxyEtaBiasCanvas* .oO[plotsdir]Oo./Biases/dxyEta 250 mv .oO[plotsdir]Oo./dzPhiTrendFit* .oO[plotsdir]Oo./Fit 251 mv .oO[plotsdir]Oo./dxyEtaTrendNorm* .oO[plotsdir]Oo./dxyVsEtaNorm 252 mv .oO[plotsdir]Oo./dzEtaTrendNorm* .oO[plotsdir]Oo./dzVsEtaNorm 253 mv .oO[plotsdir]Oo./dxyPhiTrendNorm* .oO[plotsdir]Oo./dxyVsPhiNorm 254 mv .oO[plotsdir]Oo./dzPhiTrendNorm* .oO[plotsdir]Oo./dzVsPhiNorm 255 mv .oO[plotsdir]Oo./dxyEtaTrend* .oO[plotsdir]Oo./dxyVsEta 256 mv .oO[plotsdir]Oo./dzEtaTrend* .oO[plotsdir]Oo./dzVsEta 257 mv .oO[plotsdir]Oo./dxyPhiTrend* .oO[plotsdir]Oo./dxyVsPhi 258 mv .oO[plotsdir]Oo./dzPhiTrend* .oO[plotsdir]Oo./dzVsPhi 260 wget https://raw.githubusercontent.com/mmusich/PVToolScripts/master/PolishedScripts/index.php 262 cp index.php .oO[plotsdir]Oo./Biases/ 263 cp index.php .oO[plotsdir]Oo./Biases/dzPhi 264 cp index.php .oO[plotsdir]Oo./Biases/dxyPhi 265 cp index.php .oO[plotsdir]Oo./Biases/dzEta 266 cp index.php .oO[plotsdir]Oo./Biases/dxyEta 267 cp index.php .oO[plotsdir]Oo./Fit 268 cp index.php .oO[plotsdir]Oo./dxyVsEta 269 cp index.php .oO[plotsdir]Oo./dzVsEta 270 cp index.php .oO[plotsdir]Oo./dxyVsPhi 271 cp index.php .oO[plotsdir]Oo./dzVsPhi 272 cp index.php .oO[plotsdir]Oo./dxyVsEtaNorm 273 cp index.php .oO[plotsdir]Oo./dzVsEtaNorm 274 cp index.php .oO[plotsdir]Oo./dxyVsPhiNorm 275 cp index.php .oO[plotsdir]Oo./dzVsPhiNorm 278 echo ----------------------- 279 echo Job ended at `date` 280 echo ----------------------- 287 PrimaryVertexPlotExecution=
""" 288 #make primary vertex validation plots 290 cp .oO[plottingscriptpath]Oo. . 291 root -x -b -q .oO[plottingscriptname]Oo.++ 293 for PdfOutputFile in $(ls *pdf ); do 294 xrdcp -f ${PdfOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PdfOutputFile} 295 cp ${PdfOutputFile} .oO[datadir]Oo./.oO[PlotsDirName]Oo. 298 for PngOutputFile in $(ls *png ); do 299 xrdcp -f ${PngOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PngOutputFile} 300 cp ${PngOutputFile} .oO[datadir]Oo./.oO[PlotsDirName]Oo. 308 PrimaryVertexPlotTemplate=
""" 309 /**************************************** 310 This can be run directly in root, or you 311 can run ./TkAlMerge.sh in this directory 312 ****************************************/ 314 #include "Alignment/OfflineValidation/macros/FitPVResiduals.C" 316 void TkAlPrimaryVertexValidationPlot() 319 // initialize the plot y-axis ranges 320 thePlotLimits->init(.oO[m_dxyPhiMax]Oo., // mean of dxy vs Phi 321 .oO[m_dzPhiMax]Oo., // mean of dz vs Phi 322 .oO[m_dxyEtaMax]Oo., // mean of dxy vs Eta 323 .oO[m_dzEtaMax]Oo., // mean of dz vs Eta 324 .oO[m_dxyPhiNormMax]Oo., // mean of dxy vs Phi (norm) 325 .oO[m_dzPhiNormMax]Oo., // mean of dz vs Phi (norm) 326 .oO[m_dxyEtaNormMax]Oo., // mean of dxy vs Eta (norm) 327 .oO[m_dzEtaNormMax]Oo., // mean of dz vs Eta (norm) 328 .oO[w_dxyPhiMax]Oo., // width of dxy vs Phi 329 .oO[w_dzPhiMax]Oo., // width of dz vs Phi 330 .oO[w_dxyEtaMax]Oo., // width of dxy vs Eta 331 .oO[w_dzEtaMax]Oo., // width of dz vs Eta 332 .oO[w_dxyPhiNormMax]Oo., // width of dxy vs Phi (norm) 333 .oO[w_dzPhiNormMax]Oo., // width of dz vs Phi (norm) 334 .oO[w_dxyEtaNormMax]Oo., // width of dxy vs Eta (norm) 335 .oO[w_dzEtaNormMax]Oo. // width of dz vs Eta (norm) 338 .oO[PlottingInstantiation]Oo. 339 FitPVResiduals("",.oO[stdResiduals]Oo.,.oO[doMaps]Oo.,"",.oO[autoLimits]Oo.);