1 PrimaryVertexValidationTemplate=
"""
2 import FWCore.ParameterSet.Config as cms
8 process = cms.Process("PrimaryVertexValidation")
10 ###################################################################
11 # Event source and run selection
12 ###################################################################
13 .oO[datasetDefinition]Oo.
15 ###################################################################
17 ###################################################################
18 runboundary = .oO[runboundary]Oo.
19 process.source.firstRun = cms.untracked.uint32(int(runboundary))
21 ###################################################################
23 ###################################################################
25 print ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: This is simulation!"
28 print ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: This is real dATA!"
29 if ('.oO[lumilist]Oo.'):
30 print ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: JSON filtering with: .oO[lumilist]Oo. "
31 import FWCore.PythonUtilities.LumiList as LumiList
32 process.source.lumisToProcess = LumiList.LumiList(filename ='.oO[lumilist]Oo.').getVLuminosityBlockRange()
34 ###################################################################
36 ###################################################################
37 process.load("FWCore.MessageService.MessageLogger_cfi")
38 process.MessageLogger.destinations = ['cout', 'cerr']
39 process.MessageLogger.cerr.FwkReport.reportEvery = 1000
41 ####################################################################
42 # Produce the Transient Track Record in the event
43 ####################################################################
44 process.load("TrackingTools.TransientTrack.TransientTrackBuilder_cfi")
46 ####################################################################
47 # Get the Magnetic Field
48 ####################################################################
49 process.load("Configuration.StandardSequences..oO[magneticField]Oo._cff")
51 ###################################################################
53 ###################################################################
54 process.load("Configuration.Geometry.GeometryRecoDB_cff")
56 ####################################################################
58 ####################################################################
59 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
61 ####################################################################
63 ####################################################################
64 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
65 from Configuration.AlCa.GlobalTag import GlobalTag
66 process.GlobalTag = GlobalTag(process.GlobalTag, '.oO[GlobalTag]Oo.', '')
70 ####################################################################
71 # Load and Configure event selection
72 ####################################################################
73 process.primaryVertexFilter = cms.EDFilter("VertexSelector",
74 src = cms.InputTag(".oO[VertexCollection]Oo."),
75 cut = cms.string("!isFake && ndof > 4 && abs(z) <= 24 && position.Rho <= 2"),
76 filter = cms.bool(True)
79 process.noscraping = cms.EDFilter("FilterOutScraping",
80 applyfilter = cms.untracked.bool(True),
81 src = cms.untracked.InputTag(".oO[TrackCollection]Oo."),
82 debugOn = cms.untracked.bool(False),
83 numtrack = cms.untracked.uint32(10),
84 thresh = cms.untracked.double(0.25)
88 process.load("Alignment.CommonAlignment.filterOutLowPt_cfi")
89 process.filterOutLowPt.src = ".oO[TrackCollection]Oo."
90 process.filterOutLowPt.ptmin = .oO[ptCut]Oo.
91 process.filterOutLowPt.runControl = .oO[runControl]Oo.
92 process.filterOutLowPt.runControlNumber = [runboundary]
95 process.goodvertexSkim = cms.Sequence(process.noscraping + process.filterOutLowPt)
97 process.goodvertexSkim = cms.Sequence(process.primaryVertexFilter + process.noscraping + process.filterOutLowPt)
99 ####################################################################
100 # Load and Configure Measurement Tracker Event
101 # (would be needed in case NavigationSchool is set != from null
102 ####################################################################
103 #process.load("RecoTracker.MeasurementDet.MeasurementTrackerEventProducer_cfi")
104 #process.MeasurementTrackerEvent.pixelClusterProducer = '.oO[TrackCollection]Oo.'
105 #process.MeasurementTrackerEvent.stripClusterProducer = '.oO[TrackCollection]Oo.'
106 #process.MeasurementTrackerEvent.inactivePixelDetectorLabels = cms.VInputTag()
107 #process.MeasurementTrackerEvent.inactiveStripDetectorLabels = cms.VInputTag()
109 ####################################################################
110 # Load and Configure TrackRefitter
111 ####################################################################
112 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
113 import RecoTracker.TrackProducer.TrackRefitters_cff
114 process.TrackRefitter = RecoTracker.TrackProducer.TrackRefitter_cfi.TrackRefitter.clone()
115 process.TrackRefitter.src = ".oO[TrackCollection]Oo."
116 process.TrackRefitter.TrajectoryInEvent = True
117 process.TrackRefitter.NavigationSchool = ''
118 process.TrackRefitter.TTRHBuilder = "WithAngleAndTemplate"
120 ####################################################################
122 ####################################################################
123 process.TFileService = cms.Service("TFileService",
124 fileName=cms.string(".oO[outputFile]Oo.")
127 ####################################################################
128 # Deterministic annealing clustering
129 ####################################################################
131 print ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: Running DA Algorithm!"
132 process.PVValidation = cms.EDAnalyzer("PrimaryVertexValidation",
133 TrackCollectionTag = cms.InputTag("TrackRefitter"),
134 VertexCollectionTag = cms.InputTag(".oO[VertexCollection]Oo."),
135 Debug = cms.bool(False),
136 storeNtuple = cms.bool(False),
137 useTracksFromRecoVtx = cms.bool(False),
138 isLightNtuple = cms.bool(True),
139 askFirstLayerHit = cms.bool(False),
140 probePt = cms.untracked.double(.oO[ptCut]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 < 5
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 trackQuality = cms.string("any")
154 TkClusParameters=cms.PSet(algorithm=cms.string('DA'),
155 TkDAClusParameters = cms.PSet(coolingFactor = cms.double(0.8), # moderate annealing speed
156 Tmin = cms.double(4.), # end of annealing
157 vertexSize = cms.double(0.05), # ~ resolution / sqrt(Tmin)
158 d0CutOff = cms.double(3.), # downweight high IP tracks
159 dzCutOff = cms.double(4.) # outlier rejection after freeze-out (T<Tmin)
164 ####################################################################
166 ####################################################################
168 print ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: Running GAP Algorithm!"
169 process.PVValidation = cms.EDAnalyzer("PrimaryVertexValidation",
170 TrackCollectionTag = cms.InputTag("TrackRefitter"),
171 VertexCollectionTag = cms.InputTag(".oO[VertexCollection]Oo."),
172 Debug = cms.bool(False),
173 isLightNtuple = cms.bool(True),
174 storeNtuple = cms.bool(False),
175 useTracksFromRecoVtx = cms.bool(False),
176 askFirstLayerHit = cms.bool(False),
177 probePt = cms.untracked.double(.oO[ptCut]Oo.),
178 numberOfBins = cms.untracked.int32(.oO[numberOfBins]Oo.),
179 runControl = cms.untracked.bool(.oO[runControl]Oo.),
180 runControlNumber = cms.untracked.vuint32(int(.oO[runboundary]Oo.)),
182 TkFilterParameters = cms.PSet(algorithm=cms.string('filter'),
183 maxNormalizedChi2 = cms.double(5.0), # chi2ndof < 20
184 minPixelLayersWithHits=cms.int32(2), # PX hits > 2
185 minSiliconLayersWithHits = cms.int32(5), # TK hits > 5
186 maxD0Significance = cms.double(5.0), # fake cut (requiring 1 PXB hit)
187 minPt = cms.double(0.0), # better for softish events
188 trackQuality = cms.string("any")
191 TkClusParameters = cms.PSet(algorithm = cms.string('gap'),
192 TkGapClusParameters = cms.PSet(zSeparation = cms.double(0.2) # 0.2 cm max separation betw. clusters
197 ####################################################################
199 ####################################################################
200 process.p = cms.Path(process.goodvertexSkim*
201 process.offlineBeamSpot*
202 #process.MeasurementTrackerEvent*
203 process.TrackRefitter*
204 process.PVValidation)
210 PVValidationScriptTemplate=
"""
212 source /afs/cern.ch/cms/caf/setup.sh
213 eos='/afs/cern.ch/project/eos/installation/cms/bin/eos.select'
215 echo -----------------------
216 echo Job started at `date`
217 echo -----------------------
219 export theLabel=.oO[alignmentName]Oo.
220 export theDate=.oO[runboundary]Oo.
223 cd .oO[CMSSW_BASE]Oo./src
224 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo.
225 eval `scram runtime -sh`
228 rfmkdir -p .oO[datadir]Oo.
229 rfmkdir -p .oO[workingdir]Oo.
230 rfmkdir -p .oO[logdir]Oo.
231 rm -f .oO[logdir]Oo./*.stdout
232 rm -f .oO[logdir]Oo./*.stderr
234 if [[ $HOSTNAME = lxplus[0-9]*\.cern\.ch ]] # check for interactive mode
236 rfmkdir -p .oO[workdir]Oo.
237 rm -f .oO[workdir]Oo./*
240 mkdir -p $cwd/TkAllInOneTool
241 cd $cwd/TkAllInOneTool
248 $eos mkdir -p /store/caf/user/$USER/.oO[eosdir]Oo./plots/
249 for RootOutputFile in $(ls *root )
251 xrdcp -f ${RootOutputFile} root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./
252 rfcp ${RootOutputFile} .oO[workingdir]Oo.
255 cp .oO[Alignment/OfflineValidation]Oo./macros/FitPVResiduals.C .
256 cp .oO[Alignment/OfflineValidation]Oo./macros/CMS_lumi.C .
257 cp .oO[Alignment/OfflineValidation]Oo./macros/CMS_lumi.h .
259 if [[ .oO[pvvalidationreference]Oo. == *store* ]]; then xrdcp -f .oO[pvvalidationreference]Oo. PVValidation_reference.root; else ln -fs .oO[pvvalidationreference]Oo. ./PVValidation_reference.root; fi
261 root -b -q "FitPVResiduals.C(\\"${PWD}/${RootOutputFile}=${theLabel},${PWD}/PVValidation_reference.root=Design simulation\\",true,true,\\"$theDate\\")"
263 mkdir -p .oO[plotsdir]Oo.
264 for PngOutputFile in $(ls *png ); do
265 xrdcp -f ${PngOutputFile} root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./plots/
266 rfcp ${PngOutputFile} .oO[plotsdir]Oo.
269 for PdfOutputFile in $(ls *pdf ); do
270 xrdcp -f ${PdfOutputFile} root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./plots/
271 rfcp ${PdfOutputFile} .oO[plotsdir]Oo.
274 mkdir .oO[plotsdir]Oo./Biases/
275 mkdir .oO[plotsdir]Oo./Biases/dzPhi
276 mkdir .oO[plotsdir]Oo./Biases/dxyPhi
277 mkdir .oO[plotsdir]Oo./Biases/dzEta
278 mkdir .oO[plotsdir]Oo./Biases/dxyEta
279 mkdir .oO[plotsdir]Oo./Fit
280 mkdir .oO[plotsdir]Oo./dxyVsEta
281 mkdir .oO[plotsdir]Oo./dzVsEta
282 mkdir .oO[plotsdir]Oo./dxyVsPhi
283 mkdir .oO[plotsdir]Oo./dzVsPhi
284 mkdir .oO[plotsdir]Oo./dxyVsEtaNorm
285 mkdir .oO[plotsdir]Oo./dzVsEtaNorm
286 mkdir .oO[plotsdir]Oo./dxyVsPhiNorm
287 mkdir .oO[plotsdir]Oo./dzVsPhiNorm
289 mv .oO[plotsdir]Oo./BiasesCanvas* .oO[plotsdir]Oo./Biases/
290 mv .oO[plotsdir]Oo./dzPhiBiasCanvas* .oO[plotsdir]Oo./Biases/dzPhi
291 mv .oO[plotsdir]Oo./dxyPhiBiasCanvas* .oO[plotsdir]Oo./Biases/dxyPhi
292 mv .oO[plotsdir]Oo./dzEtaBiasCanvas* .oO[plotsdir]Oo./Biases/dzEta
293 mv .oO[plotsdir]Oo./dxyEtaBiasCanvas* .oO[plotsdir]Oo./Biases/dxyEta
294 mv .oO[plotsdir]Oo./dzPhiTrendFit* .oO[plotsdir]Oo./Fit
295 mv .oO[plotsdir]Oo./dxyEtaTrendNorm* .oO[plotsdir]Oo./dxyVsEtaNorm
296 mv .oO[plotsdir]Oo./dzEtaTrendNorm* .oO[plotsdir]Oo./dzVsEtaNorm
297 mv .oO[plotsdir]Oo./dxyPhiTrendNorm* .oO[plotsdir]Oo./dxyVsPhiNorm
298 mv .oO[plotsdir]Oo./dzPhiTrendNorm* .oO[plotsdir]Oo./dzVsPhiNorm
299 mv .oO[plotsdir]Oo./dxyEtaTrend* .oO[plotsdir]Oo./dxyVsEta
300 mv .oO[plotsdir]Oo./dzEtaTrend* .oO[plotsdir]Oo./dzVsEta
301 mv .oO[plotsdir]Oo./dxyPhiTrend* .oO[plotsdir]Oo./dxyVsPhi
302 mv .oO[plotsdir]Oo./dzPhiTrend* .oO[plotsdir]Oo./dzVsPhi
304 wget https://raw.githubusercontent.com/mmusich/PVToolScripts/master/PolishedScripts/index.php
306 cp index.php .oO[plotsdir]Oo./Biases/
307 cp index.php .oO[plotsdir]Oo./Biases/dzPhi
308 cp index.php .oO[plotsdir]Oo./Biases/dxyPhi
309 cp index.php .oO[plotsdir]Oo./Biases/dzEta
310 cp index.php .oO[plotsdir]Oo./Biases/dxyEta
311 cp index.php .oO[plotsdir]Oo./Fit
312 cp index.php .oO[plotsdir]Oo./dxyVsEta
313 cp index.php .oO[plotsdir]Oo./dzVsEta
314 cp index.php .oO[plotsdir]Oo./dxyVsPhi
315 cp index.php .oO[plotsdir]Oo./dzVsPhi
316 cp index.php .oO[plotsdir]Oo./dxyVsEtaNorm
317 cp index.php .oO[plotsdir]Oo./dzVsEtaNorm
318 cp index.php .oO[plotsdir]Oo./dxyVsPhiNorm
319 cp index.php .oO[plotsdir]Oo./dzVsPhiNorm
322 echo -----------------------
323 echo Job ended at `date`
324 echo -----------------------
331 PrimaryVertexPlotExecution=
"""
332 #make primary vertex validation plots
334 cp .oO[Alignment/OfflineValidation]Oo./macros/CMS_lumi.C .
335 cp .oO[Alignment/OfflineValidation]Oo./macros/CMS_lumi.h .
336 rfcp .oO[PrimaryVertexPlotScriptPath]Oo. .
337 root -x -b -q TkAlPrimaryVertexValidationPlot.C++
339 for PdfOutputFile in $(ls *pdf ); do
340 xrdcp -f ${PdfOutputFile} root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./plots/
341 rfcp ${PdfOutputFile} .oO[datadir]Oo.
344 for PngOutputFile in $(ls *png ); do
345 xrdcp -f ${PngOutputFile} root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./plots/
346 rfcp ${PngOutputFile} .oO[datadir]Oo.
354 PrimaryVertexPlotTemplate=
"""
355 /****************************************
356 This can be run directly in root, or you
357 can run ./TkAlMerge.sh in this directory
358 It can be run as is, or adjusted to fit
359 for misalignments or to only make
361 ****************************************/
363 #include "Alignment/OfflineValidation/macros/FitPVResiduals.C"
365 void TkAlPrimaryVertexValidationPlot()
368 thePlotLimits->init(.oO[m_dxyPhiMax]Oo.,
372 .oO[m_dxyPhiNormMax]Oo.,
373 .oO[m_dzPhiNormMax]Oo.,
374 .oO[m_dxyEtaNormMax]Oo.,
375 .oO[m_dzEtaNormMax]Oo.,
380 .oO[w_dxyPhiNormMax]Oo.,
381 .oO[w_dzPhiNormMax]Oo.,
382 .oO[w_dxyEtaNormMax]Oo.,
383 .oO[w_dzEtaNormMax]Oo.
386 FitPVResiduals(".oO[PrimaryVertexPlotInstantiation]Oo.",.oO[stdResiduals]Oo.,.oO[doMaps]Oo.,"",.oO[autoLimits]Oo.);