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 maxD0Error = cms.double(1.0),
98 maxDzError = cms.double(1.0),
99 minPt = cms.double(0.0), # better for softish events
100 maxEta = cms.double(5.0), # as per recommendation in PR #18330
101 trackQuality = cms.string("any")
104 ## MM 04.05.2017 (use settings as in: https://github.com/cms-sw/cmssw/pull/18330)
105 TkClusParameters=cms.PSet(algorithm=cms.string('DA_vect'),
106 TkDAClusParameters = cms.PSet(coolingFactor = cms.double(0.6), # moderate annealing speed
107 zrange = cms.double(4.), # consider only clusters within 4 sigma*sqrt(T) of a track
108 delta_highT = cms.double(1.e-2), # convergence requirement at high T
109 delta_lowT = cms.double(1.e-3), # convergence requirement at low T
110 convergence_mode = cms.int32(0), # 0 = two steps, 1 = dynamic with sqrt(T)
111 Tmin = cms.double(2.0), # end of vertex splitting
112 Tpurge = cms.double(2.0), # cleaning
113 Tstop = cms.double(0.5), # end of annealing
114 vertexSize = cms.double(0.006), # added in quadrature to track-z resolutions
115 d0CutOff = cms.double(3.), # downweight high IP tracks
116 dzCutOff = cms.double(3.), # outlier rejection after freeze-out (T<Tmin)
117 zmerge = cms.double(1e-2), # merge intermediat clusters separated by less than zmerge
118 uniquetrkweight = cms.double(0.8) # require at least two tracks with this weight at T=Tpurge
123 ####################################################################
125 ####################################################################
127 print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: Running GAP Algorithm!")
128 process.PVValidation = cms.EDAnalyzer("PrimaryVertexValidation",
129 TrackCollectionTag = cms.InputTag("FinalTrackRefitter"),
130 VertexCollectionTag = cms.InputTag(".oO[VertexCollection]Oo."),
131 Debug = cms.bool(False),
132 isLightNtuple = cms.bool(True),
133 storeNtuple = cms.bool(False),
134 useTracksFromRecoVtx = cms.bool(False),
135 askFirstLayerHit = cms.bool(False),
136 forceBeamSpot = cms.untracked.bool(.oO[forceBeamSpot]Oo.),
137 probePt = cms.untracked.double(.oO[ptCut]Oo.),
138 probeEta = cms.untracked.double(.oO[etaCut]Oo.),
139 doBPix = cms.untracked.bool(.oO[doBPix]Oo.),
140 doFPix = cms.untracked.bool(.oO[doFPix]Oo.),
141 numberOfBins = cms.untracked.int32(.oO[numberOfBins]Oo.),
142 runControl = cms.untracked.bool(.oO[runControl]Oo.),
143 runControlNumber = cms.untracked.vuint32(int(.oO[runboundary]Oo.)),
145 TkFilterParameters = cms.PSet(algorithm=cms.string('filter'),
146 maxNormalizedChi2 = cms.double(5.0), # chi2ndof < 20
147 minPixelLayersWithHits=cms.int32(2), # PX hits > 2
148 minSiliconLayersWithHits = cms.int32(5), # TK hits > 5
149 maxD0Significance = cms.double(5.0), # fake cut (requiring 1 PXB hit)
150 minPt = cms.double(0.0), # better for softish events
151 maxEta = cms.double(5.0), # as per recommendation in PR #18330
152 trackQuality = cms.string("any")
155 TkClusParameters = cms.PSet(algorithm = cms.string('gap'),
156 TkGapClusParameters = cms.PSet(zSeparation = cms.double(0.2) # 0.2 cm max separation betw. clusters
166 process.p = cms.Path(process.goodvertexSkim*
167 process.seqTrackselRefit*
168 process.PVValidation)
173 PVValidationScriptTemplate=
"""#!/bin/bash
174 source /afs/cern.ch/cms/caf/setup.sh
175 export X509_USER_PROXY=.oO[scriptsdir]Oo./.user_proxy
177 echo -----------------------
178 echo Job started at `date`
179 echo -----------------------
181 export theLabel=.oO[alignmentName]Oo.
182 export theDate=.oO[runboundary]Oo.
185 cd .oO[CMSSW_BASE]Oo./src
186 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo.
187 eval `scram runtime -sh`
190 mkdir -p .oO[datadir]Oo.
191 mkdir -p .oO[workingdir]Oo.
192 mkdir -p .oO[logdir]Oo.
193 rm -f .oO[logdir]Oo./*.stdout
194 rm -f .oO[logdir]Oo./*.stderr
196 if [[ $HOSTNAME = lxplus[0-9]*[.a-z0-9]* ]] # check for interactive mode
198 mkdir -p .oO[workdir]Oo.
199 rm -f .oO[workdir]Oo./*
202 mkdir -p $cwd/TkAllInOneTool
203 cd $cwd/TkAllInOneTool
210 eos mkdir -p /store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/
211 for RootOutputFile in $(ls *root )
213 xrdcp -f ${RootOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./${RootOutputFile}
214 cp ${RootOutputFile} .oO[workingdir]Oo.
217 cp .oO[Alignment/OfflineValidation]Oo./macros/FitPVResiduals.C .
218 cp .oO[Alignment/OfflineValidation]Oo./macros/CMS_lumi.C .
219 cp .oO[Alignment/OfflineValidation]Oo./macros/CMS_lumi.h .
221 if [[ .oO[pvvalidationreference]Oo. == *store* ]]; then xrdcp -f .oO[pvvalidationreference]Oo. PVValidation_reference.root; else ln -fs .oO[pvvalidationreference]Oo. ./PVValidation_reference.root; fi
223 echo "I am going to produce the comparison with IDEAL geometry of ${RootOutputFile}"
224 root -b -q "FitPVResiduals.C++g(\\"${PWD}/${RootOutputFile}=${theLabel},${PWD}/PVValidation_reference.root=Design simulation\\",true,true,\\"$theDate\\")"
226 mkdir -p .oO[plotsdir]Oo.
227 for PngOutputFile in $(ls *png ); do
228 xrdcp -f ${PngOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PngOutputFile}
229 cp ${PngOutputFile} .oO[plotsdir]Oo.
232 for PdfOutputFile in $(ls *pdf ); do
233 xrdcp -f ${PdfOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PdfOutputFile}
234 cp ${PdfOutputFile} .oO[plotsdir]Oo.
237 mkdir .oO[plotsdir]Oo./Biases/
238 mkdir .oO[plotsdir]Oo./Biases/dzPhi
239 mkdir .oO[plotsdir]Oo./Biases/dxyPhi
240 mkdir .oO[plotsdir]Oo./Biases/dzEta
241 mkdir .oO[plotsdir]Oo./Biases/dxyEta
242 mkdir .oO[plotsdir]Oo./Fit
243 mkdir .oO[plotsdir]Oo./dxyVsEta
244 mkdir .oO[plotsdir]Oo./dzVsEta
245 mkdir .oO[plotsdir]Oo./dxyVsPhi
246 mkdir .oO[plotsdir]Oo./dzVsPhi
247 mkdir .oO[plotsdir]Oo./dxyVsEtaNorm
248 mkdir .oO[plotsdir]Oo./dzVsEtaNorm
249 mkdir .oO[plotsdir]Oo./dxyVsPhiNorm
250 mkdir .oO[plotsdir]Oo./dzVsPhiNorm
252 mv .oO[plotsdir]Oo./BiasesCanvas* .oO[plotsdir]Oo./Biases/
253 mv .oO[plotsdir]Oo./dzPhiBiasCanvas* .oO[plotsdir]Oo./Biases/dzPhi
254 mv .oO[plotsdir]Oo./dxyPhiBiasCanvas* .oO[plotsdir]Oo./Biases/dxyPhi
255 mv .oO[plotsdir]Oo./dzEtaBiasCanvas* .oO[plotsdir]Oo./Biases/dzEta
256 mv .oO[plotsdir]Oo./dxyEtaBiasCanvas* .oO[plotsdir]Oo./Biases/dxyEta
257 mv .oO[plotsdir]Oo./dzPhiTrendFit* .oO[plotsdir]Oo./Fit
258 mv .oO[plotsdir]Oo./dxyEtaTrendNorm* .oO[plotsdir]Oo./dxyVsEtaNorm
259 mv .oO[plotsdir]Oo./dzEtaTrendNorm* .oO[plotsdir]Oo./dzVsEtaNorm
260 mv .oO[plotsdir]Oo./dxyPhiTrendNorm* .oO[plotsdir]Oo./dxyVsPhiNorm
261 mv .oO[plotsdir]Oo./dzPhiTrendNorm* .oO[plotsdir]Oo./dzVsPhiNorm
262 mv .oO[plotsdir]Oo./dxyEtaTrend* .oO[plotsdir]Oo./dxyVsEta
263 mv .oO[plotsdir]Oo./dzEtaTrend* .oO[plotsdir]Oo./dzVsEta
264 mv .oO[plotsdir]Oo./dxyPhiTrend* .oO[plotsdir]Oo./dxyVsPhi
265 mv .oO[plotsdir]Oo./dzPhiTrend* .oO[plotsdir]Oo./dzVsPhi
267 wget https://raw.githubusercontent.com/mmusich/PVToolScripts/master/PolishedScripts/index.php
269 cp index.php .oO[plotsdir]Oo./Biases/
270 cp index.php .oO[plotsdir]Oo./Biases/dzPhi
271 cp index.php .oO[plotsdir]Oo./Biases/dxyPhi
272 cp index.php .oO[plotsdir]Oo./Biases/dzEta
273 cp index.php .oO[plotsdir]Oo./Biases/dxyEta
274 cp index.php .oO[plotsdir]Oo./Fit
275 cp index.php .oO[plotsdir]Oo./dxyVsEta
276 cp index.php .oO[plotsdir]Oo./dzVsEta
277 cp index.php .oO[plotsdir]Oo./dxyVsPhi
278 cp index.php .oO[plotsdir]Oo./dzVsPhi
279 cp index.php .oO[plotsdir]Oo./dxyVsEtaNorm
280 cp index.php .oO[plotsdir]Oo./dzVsEtaNorm
281 cp index.php .oO[plotsdir]Oo./dxyVsPhiNorm
282 cp index.php .oO[plotsdir]Oo./dzVsPhiNorm
285 echo -----------------------
286 echo Job ended at `date`
287 echo -----------------------
294 PrimaryVertexPlotExecution=
"""
295 #make primary vertex validation plots
297 cp .oO[plottingscriptpath]Oo. .
298 root -x -b -q .oO[plottingscriptname]Oo.++
300 for PdfOutputFile in $(ls *pdf ); do
301 xrdcp -f ${PdfOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PdfOutputFile}
302 cp ${PdfOutputFile} .oO[datadir]Oo./.oO[PlotsDirName]Oo.
305 for PngOutputFile in $(ls *png ); do
306 xrdcp -f ${PngOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PngOutputFile}
307 cp ${PngOutputFile} .oO[datadir]Oo./.oO[PlotsDirName]Oo.
315 PrimaryVertexPlotTemplate=
"""
316 /****************************************
317 This can be run directly in root, or you
318 can run ./TkAlMerge.sh in this directory
319 ****************************************/
321 #include "Alignment/OfflineValidation/macros/FitPVResiduals.C"
323 void TkAlPrimaryVertexValidationPlot()
326 // initialize the plot y-axis ranges
327 thePlotLimits->init(.oO[m_dxyPhiMax]Oo., // mean of dxy vs Phi
328 .oO[m_dzPhiMax]Oo., // mean of dz vs Phi
329 .oO[m_dxyEtaMax]Oo., // mean of dxy vs Eta
330 .oO[m_dzEtaMax]Oo., // mean of dz vs Eta
331 .oO[m_dxyPhiNormMax]Oo., // mean of dxy vs Phi (norm)
332 .oO[m_dzPhiNormMax]Oo., // mean of dz vs Phi (norm)
333 .oO[m_dxyEtaNormMax]Oo., // mean of dxy vs Eta (norm)
334 .oO[m_dzEtaNormMax]Oo., // mean of dz vs Eta (norm)
335 .oO[w_dxyPhiMax]Oo., // width of dxy vs Phi
336 .oO[w_dzPhiMax]Oo., // width of dz vs Phi
337 .oO[w_dxyEtaMax]Oo., // width of dxy vs Eta
338 .oO[w_dzEtaMax]Oo., // width of dz vs Eta
339 .oO[w_dxyPhiNormMax]Oo., // width of dxy vs Phi (norm)
340 .oO[w_dzPhiNormMax]Oo., // width of dz vs Phi (norm)
341 .oO[w_dxyEtaNormMax]Oo., // width of dxy vs Eta (norm)
342 .oO[w_dzEtaNormMax]Oo. // width of dz vs Eta (norm)
345 .oO[PlottingInstantiation]Oo.
346 FitPVResiduals("",.oO[stdResiduals]Oo.,.oO[doMaps]Oo.,"",.oO[autoLimits]Oo.);