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 # Imports of parameters
72 ####################################################################
73 from RecoVertex.PrimaryVertexProducer.OfflinePrimaryVertices_cfi import offlinePrimaryVertices
74 ## modify the parameters which differ
75 FilteringParams = offlinePrimaryVertices.TkFilterParameters.clone(
76 maxNormalizedChi2 = 5.0, # chi2ndof < 5
77 maxD0Significance = 5.0, # fake cut (requiring 1 PXB hit)
78 maxEta = 5.0, # as per recommendation in PR #18330
81 ## MM 04.05.2017 (use settings as in: https://github.com/cms-sw/cmssw/pull/18330)
82 from RecoVertex.PrimaryVertexProducer.TkClusParameters_cff import DA_vectParameters
83 DAClusterizationParams = DA_vectParameters.clone()
85 GapClusterizationParams = cms.PSet(algorithm = cms.string('gap'),
86 TkGapClusParameters = cms.PSet(zSeparation = cms.double(0.2)) # 0.2 cm max separation betw. clusters
89 ####################################################################
90 # Deterministic annealing clustering or Gap clustering
91 ####################################################################
92 def switchClusterizerParameters(da):
94 print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: Running DA Algorithm!")
95 return DAClusterizationParams
97 print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: Running GAP Algorithm!")
98 return GapClusterizationParams
100 # Use compressions settings of TFile
101 # see https://root.cern.ch/root/html534/TFile.html#TFile:SetCompressionSettings
102 # settings = 100 * algorithm + level
103 # level is from 1 (small) to 9 (large compression)
104 # algo: 1 (ZLIB), 2 (LMZA)
105 # see more about compression & performance: https://root.cern.ch/root/html534/guides/users-guide/InputOutput.html#compression-and-performance
106 compressionSettings = 207
108 ####################################################################
109 # Configure the PVValidation Analyzer module
110 ####################################################################
111 process.PVValidation = cms.EDAnalyzer("PrimaryVertexValidation",
112 compressionSettings = cms.untracked.int32(compressionSettings),
113 TrackCollectionTag = cms.InputTag("FinalTrackRefitter"),
114 VertexCollectionTag = cms.InputTag(".oO[VertexCollection]Oo."),
115 Debug = cms.bool(False),
116 storeNtuple = cms.bool(False),
117 useTracksFromRecoVtx = cms.bool(False),
118 isLightNtuple = cms.bool(True),
119 askFirstLayerHit = cms.bool(False),
120 forceBeamSpot = cms.untracked.bool(.oO[forceBeamSpot]Oo.),
121 probePt = cms.untracked.double(.oO[ptCut]Oo.),
122 probeEta = cms.untracked.double(.oO[etaCut]Oo.),
123 doBPix = cms.untracked.bool(.oO[doBPix]Oo.),
124 doFPix = cms.untracked.bool(.oO[doFPix]Oo.),
125 numberOfBins = cms.untracked.int32(.oO[numberOfBins]Oo.),
126 runControl = cms.untracked.bool(.oO[runControl]Oo.),
127 runControlNumber = cms.untracked.vuint32(runboundary),
128 TkFilterParameters = FilteringParams,
129 TkClusParameters = switchClusterizerParameters(isDA)
136 process.p = cms.Path(process.goodvertexSkim*
137 process.seqTrackselRefit*
138 process.PVValidation)
143 PVValidationScriptTemplate=
"""#!/bin/bash
144 source /afs/cern.ch/cms/caf/setup.sh
145 export X509_USER_PROXY=.oO[scriptsdir]Oo./.user_proxy
147 echo -----------------------
148 echo Job started at `date`
149 echo -----------------------
151 export theLabel=.oO[alignmentName]Oo.
152 export theDate=.oO[runboundary]Oo.
155 cd .oO[CMSSW_BASE]Oo./src
156 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo.
157 eval `scram runtime -sh`
160 mkdir -p .oO[datadir]Oo.
161 mkdir -p .oO[workingdir]Oo.
162 mkdir -p .oO[logdir]Oo.
163 rm -f .oO[logdir]Oo./*.stdout
164 rm -f .oO[logdir]Oo./*.stderr
166 if [[ $HOSTNAME = lxplus[0-9]*[.a-z0-9]* ]] # check for interactive mode
168 mkdir -p .oO[workdir]Oo.
169 rm -f .oO[workdir]Oo./*
172 mkdir -p $cwd/TkAllInOneTool
173 cd $cwd/TkAllInOneTool
180 eos mkdir -p /store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/
181 for RootOutputFile in $(ls *root )
183 xrdcp -f ${RootOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./${RootOutputFile}
184 cp ${RootOutputFile} .oO[workingdir]Oo.
187 cp .oO[Alignment/OfflineValidation]Oo./macros/FitPVResiduals.C .
188 cp .oO[Alignment/OfflineValidation]Oo./macros/CMS_lumi.C .
189 cp .oO[Alignment/OfflineValidation]Oo./macros/CMS_lumi.h .
191 if [[ .oO[pvvalidationreference]Oo. == *store* ]]; then xrdcp -f .oO[pvvalidationreference]Oo. PVValidation_reference.root; else ln -fs .oO[pvvalidationreference]Oo. ./PVValidation_reference.root; fi
193 echo "I am going to produce the comparison with IDEAL geometry of ${RootOutputFile}"
194 root -b -q "FitPVResiduals.C++g(\\"${PWD}/${RootOutputFile}=${theLabel},${PWD}/PVValidation_reference.root=Design simulation\\",true,true,\\"$theDate\\")"
196 mkdir -p .oO[plotsdir]Oo.
197 for PngOutputFile in $(ls *png ); do
198 xrdcp -f ${PngOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PngOutputFile}
199 cp ${PngOutputFile} .oO[plotsdir]Oo.
202 for PdfOutputFile in $(ls *pdf ); do
203 xrdcp -f ${PdfOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PdfOutputFile}
204 cp ${PdfOutputFile} .oO[plotsdir]Oo.
207 mkdir .oO[plotsdir]Oo./Biases/
208 mkdir .oO[plotsdir]Oo./Biases/dzPhi
209 mkdir .oO[plotsdir]Oo./Biases/dxyPhi
210 mkdir .oO[plotsdir]Oo./Biases/dzEta
211 mkdir .oO[plotsdir]Oo./Biases/dxyEta
212 mkdir .oO[plotsdir]Oo./Fit
213 mkdir .oO[plotsdir]Oo./dxyVsEta
214 mkdir .oO[plotsdir]Oo./dzVsEta
215 mkdir .oO[plotsdir]Oo./dxyVsPhi
216 mkdir .oO[plotsdir]Oo./dzVsPhi
217 mkdir .oO[plotsdir]Oo./dxyVsEtaNorm
218 mkdir .oO[plotsdir]Oo./dzVsEtaNorm
219 mkdir .oO[plotsdir]Oo./dxyVsPhiNorm
220 mkdir .oO[plotsdir]Oo./dzVsPhiNorm
222 mv .oO[plotsdir]Oo./BiasesCanvas* .oO[plotsdir]Oo./Biases/
223 mv .oO[plotsdir]Oo./dzPhiBiasCanvas* .oO[plotsdir]Oo./Biases/dzPhi
224 mv .oO[plotsdir]Oo./dxyPhiBiasCanvas* .oO[plotsdir]Oo./Biases/dxyPhi
225 mv .oO[plotsdir]Oo./dzEtaBiasCanvas* .oO[plotsdir]Oo./Biases/dzEta
226 mv .oO[plotsdir]Oo./dxyEtaBiasCanvas* .oO[plotsdir]Oo./Biases/dxyEta
227 mv .oO[plotsdir]Oo./dzPhiTrendFit* .oO[plotsdir]Oo./Fit
228 mv .oO[plotsdir]Oo./dxyEtaTrendNorm* .oO[plotsdir]Oo./dxyVsEtaNorm
229 mv .oO[plotsdir]Oo./dzEtaTrendNorm* .oO[plotsdir]Oo./dzVsEtaNorm
230 mv .oO[plotsdir]Oo./dxyPhiTrendNorm* .oO[plotsdir]Oo./dxyVsPhiNorm
231 mv .oO[plotsdir]Oo./dzPhiTrendNorm* .oO[plotsdir]Oo./dzVsPhiNorm
232 mv .oO[plotsdir]Oo./dxyEtaTrend* .oO[plotsdir]Oo./dxyVsEta
233 mv .oO[plotsdir]Oo./dzEtaTrend* .oO[plotsdir]Oo./dzVsEta
234 mv .oO[plotsdir]Oo./dxyPhiTrend* .oO[plotsdir]Oo./dxyVsPhi
235 mv .oO[plotsdir]Oo./dzPhiTrend* .oO[plotsdir]Oo./dzVsPhi
237 wget https://raw.githubusercontent.com/mmusich/PVToolScripts/master/PolishedScripts/index.php
239 cp index.php .oO[plotsdir]Oo./Biases/
240 cp index.php .oO[plotsdir]Oo./Biases/dzPhi
241 cp index.php .oO[plotsdir]Oo./Biases/dxyPhi
242 cp index.php .oO[plotsdir]Oo./Biases/dzEta
243 cp index.php .oO[plotsdir]Oo./Biases/dxyEta
244 cp index.php .oO[plotsdir]Oo./Fit
245 cp index.php .oO[plotsdir]Oo./dxyVsEta
246 cp index.php .oO[plotsdir]Oo./dzVsEta
247 cp index.php .oO[plotsdir]Oo./dxyVsPhi
248 cp index.php .oO[plotsdir]Oo./dzVsPhi
249 cp index.php .oO[plotsdir]Oo./dxyVsEtaNorm
250 cp index.php .oO[plotsdir]Oo./dzVsEtaNorm
251 cp index.php .oO[plotsdir]Oo./dxyVsPhiNorm
252 cp index.php .oO[plotsdir]Oo./dzVsPhiNorm
255 echo -----------------------
256 echo Job ended at `date`
257 echo -----------------------
264 PrimaryVertexPlotExecution=
"""
265 #make primary vertex validation plots
267 cp .oO[plottingscriptpath]Oo. .
268 root -x -b -q .oO[plottingscriptname]Oo.++
270 for PdfOutputFile in $(ls *pdf ); do
271 xrdcp -f ${PdfOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PdfOutputFile}
272 cp ${PdfOutputFile} .oO[datadir]Oo./.oO[PlotsDirName]Oo.
275 for PngOutputFile in $(ls *png ); do
276 xrdcp -f ${PngOutputFile} root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/${PngOutputFile}
277 cp ${PngOutputFile} .oO[datadir]Oo./.oO[PlotsDirName]Oo.
285 PrimaryVertexPlotTemplate=
"""
286 /****************************************
287 This can be run directly in root, or you
288 can run ./TkAlMerge.sh in this directory
289 ****************************************/
291 #include "Alignment/OfflineValidation/macros/FitPVResiduals.C"
293 void TkAlPrimaryVertexValidationPlot()
296 // initialize the plot y-axis ranges
297 thePlotLimits->init(.oO[m_dxyPhiMax]Oo., // mean of dxy vs Phi
298 .oO[m_dzPhiMax]Oo., // mean of dz vs Phi
299 .oO[m_dxyEtaMax]Oo., // mean of dxy vs Eta
300 .oO[m_dzEtaMax]Oo., // mean of dz vs Eta
301 .oO[m_dxyPhiNormMax]Oo., // mean of dxy vs Phi (norm)
302 .oO[m_dzPhiNormMax]Oo., // mean of dz vs Phi (norm)
303 .oO[m_dxyEtaNormMax]Oo., // mean of dxy vs Eta (norm)
304 .oO[m_dzEtaNormMax]Oo., // mean of dz vs Eta (norm)
305 .oO[w_dxyPhiMax]Oo., // width of dxy vs Phi
306 .oO[w_dzPhiMax]Oo., // width of dz vs Phi
307 .oO[w_dxyEtaMax]Oo., // width of dxy vs Eta
308 .oO[w_dzEtaMax]Oo., // width of dz vs Eta
309 .oO[w_dxyPhiNormMax]Oo., // width of dxy vs Phi (norm)
310 .oO[w_dzPhiNormMax]Oo., // width of dz vs Phi (norm)
311 .oO[w_dxyEtaNormMax]Oo., // width of dxy vs Eta (norm)
312 .oO[w_dzEtaNormMax]Oo. // width of dz vs Eta (norm)
315 .oO[PlottingInstantiation]Oo.
316 FitPVResiduals("",.oO[stdResiduals]Oo.,.oO[doMaps]Oo.,"",.oO[autoLimits]Oo.);