Skip to content

Uniform vertex distribution in a R and ϕ range.#50904

Merged
cmsbuild merged 3 commits into
cms-sw:masterfrom
bfonta:feature/constant_r_vertexing
May 14, 2026
Merged

Uniform vertex distribution in a R and ϕ range.#50904
cmsbuild merged 3 commits into
cms-sw:masterfrom
bfonta:feature/constant_r_vertexing

Conversation

@bfonta
Copy link
Copy Markdown
Contributor

@bfonta bfonta commented May 8, 2026

PR description

Enables the uniform distribution of vertices along $R=\sqrt{x^2+y^2}$.
The user can also control the location of the vertices along the azimuthal angle and the $z$ coordinate (cylindrical coordinates).
Useful for generating particle guns with a displaced vertex, in order to e.g. study the performance of reconstruction algorithms as a function of $R$.

Resolves #50895.

PR validation:

Run the GEN-SIM of the 34402.0 SingleElectronPt35+Run4D121 workflow, but modify its configuration file by adding:

from IOMC.EventVertexGenerators.VtxSmearedParameters_cfi import VtxSmearedCommon
process.VtxSmeared = cms.EDProducer("FlatEvtVtxGenerator",
                                    VtxSmearedCommon,
                                    FixedR = cms.bool(True),
                                    MinR = cms.double(20.0),
                                    MaxR = cms.double(20.1),
)

Then run the step (cmsRun SingleElectronPt35_pythia8_cfi_GEN_SIM.py), and inspect its output with:

import ROOT
from DataFormats.FWLite import Events, Handle

events = Events("34402.0_SingleElectronPt35+Run4D121/step1.root")

handle = Handle("std::vector<SimVertex>")
label = ("g4SimHits")

for eventId, event in enumerate(events):
    print(eventId)
    event.getByLabel(label, handle)

    simvertices = handle.product()
    print("Number of SimVertices: ", len(simvertices))
    for v in simvertices: # the first vertex originates from the hard-scatter
        pos = v.position()
        print(pos.R(), pos.x(), pos.y(), pos.z()) # distances are printed in millimeters

Then run the second step:

cmsDriver.py step2  -s DIGI:pdigi_valid,L1TrackTrigger,L1,L1P2GT,DIGI2RAW,HLT:@relvalRun4 --conditions auto:phase2_realistic_T35 --datatier GEN-SIM-DIGI-RAW -n ${NEVENTS} --eventcontent FEVTDEBUGHLT --geometry ExtendedRun4D121 --era Phase2C22I13M9 --filein  file:step1.root  --fileout file:step2.root

and visualize its output with cmsShow (link). I did it for $R=10$ and $R=20$, and the primary vertex was located at the expected distance from the centre of the detector (for instance, for $R=20$ it was always located just beyond the last pixel barrel layer).

Update:

I've added a new workflow class (_displacedVertex) for the workflow to be directly testable in this PR plus being easily accessible by all users. The displaced vertex is now available for all SingleGamma and SingleElectron workflows. The vertex is changed via the --beamspot option.
Example: 34401.82 SingleElectronPt10+Run4D121_displacedVertex:

# in: /cms-hlt-nfs/user/bfontana/SinglePhotonTESTS/src going to execute cd 34401.82_SingleElectronPt10+Run4D121_displacedVertex
 cmsDriver.py SingleElectronPt10_pythia8_cfi  -s GEN,SIM -n 10 --conditions auto:phase2_realistic_T35_13TeV --beamspot Displaced --datatier GEN-SIM --eventcontent FEVTDEBUG --geometry ExtendedRun4D121 --era Phase2C22I13M9 --relval 9000,100 --no_exec --fileout file:step1.root  > step1_SingleElectronPt10+Run4D121_displacedVertex.log  2>&1
 

# in: /cms-hlt-nfs/user/bfontana/SinglePhotonTESTS/src going to execute cd 34401.82_SingleElectronPt10+Run4D121_displacedVertex
 cmsDriver.py step2  -s DIGI:pdigi_valid,L1TrackTrigger,L1,L1P2GT,DIGI2RAW,HLT:@relvalRun4 --conditions auto:phase2_realistic_T35 --datatier GEN-SIM-DIGI-RAW -n 10 --eventcontent FEVTDEBUGHLT --geometry ExtendedRun4D121 --era Phase2C22I13M9 --no_exec --filein  file:step1.root  --fileout file:step2.root  > step2_SingleElectronPt10+Run4D121_displacedVertex.log  2>&1
 

# in: /cms-hlt-nfs/user/bfontana/SinglePhotonTESTS/src going to execute cd 34401.82_SingleElectronPt10+Run4D121_displacedVertex
 cmsDriver.py step3  -s RAW2DIGI,RECO,RECOSIM,PAT,VALIDATION:@phase2Validation+@miniAODValidation,DQM:@phase2+@miniAODDQM --conditions auto:phase2_realistic_T35 --datatier GEN-SIM-RECO,MINIAODSIM,DQMIO -n 10 --eventcontent FEVTDEBUGHLT,MINIAODSIM,DQM --geometry ExtendedRun4D121 --era Phase2C22I13M9 --no_exec --filein  file:step2.root  --fileout file:step3.root  > step3_SingleElectronPt10+Run4D121_displacedVertex.log  2>&1
 

# in: /cms-hlt-nfs/user/bfontana/SinglePhotonTESTS/src going to execute cd 34401.82_SingleElectronPt10+Run4D121_displacedVertex
 cmsDriver.py step4  -s HARVESTING:@phase2Validation+@phase2+@miniAODValidation+@miniAODDQM --conditions auto:phase2_realistic_T35 --mc  --geometry ExtendedRun4D121 --scenario pp --filetype DQM --era Phase2C22I13M9 -n 100  --no_exec --filein file:step3_inDQM.root --fileout file:step4.root  > step4_SingleElectronPt10+Run4D121_displacedVertex.log  2>&1
 

# in: /cms-hlt-nfs/user/bfontana/SinglePhotonTESTS/src going to execute cd 34401.82_SingleElectronPt10+Run4D121_displacedVertex
 cmsDriver.py step5  -s ALCA:SiPixelCalSingleMuonLoose+SiPixelCalSingleMuonTight+TkAlMuonIsolated+TkAlMinBias+MuAlOverlaps+EcalESAlign+TkAlZMuMu+TkAlDiMuonAndVertex+HcalCalHBHEMuonProducerFilter+TkAlUpsilonMuMu+TkAlJpsiMuMu --conditions auto:phase2_realistic_T35 --datatier ALCARECO -n 10 --eventcontent ALCARECO --geometry ExtendedRun4D121 --era Phase2C22I13M9 --no_exec --filein file:step3.root --fileout file:step5.root  > step5_SingleElectronPt10+Run4D121_displacedVertex.log  2>&1
 
34401.82_SingleElectronPt10+Run4D121_displacedVertex Step0-PASSED Step1-PASSED Step2-PASSED Step3-PASSED Step4-PASSED  - time date Tue May 12 15:33:58 2026-date Tue May 12 15:33:19 2026; exit: 0 0 0 0 0
1 1 1 1 1 tests passed, 0 0 0 0 0 failed

@bfonta
Copy link
Copy Markdown
Contributor Author

bfonta commented May 8, 2026

type ngt

@cmsbuild
Copy link
Copy Markdown
Contributor

cmsbuild commented May 8, 2026

cms-bot internal usage

@cmsbuild
Copy link
Copy Markdown
Contributor

cmsbuild commented May 8, 2026

@cmsbuild
Copy link
Copy Markdown
Contributor

cmsbuild commented May 8, 2026

A new Pull Request was created by @bfonta for master.

It involves the following packages:

  • IOMC/EventVertexGenerators (simulation)

@civanch, @cmsbuild, @kpedro88, @mdhildreth can you please review it and eventually sign? Thanks.
@fabiocos, @grzanka this is something you requested to watch as well.
@ftenchini, @mandrenguyen, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@mmusich
Copy link
Copy Markdown
Contributor

mmusich commented May 8, 2026

@cmsbuild, please test

@cmsbuild
Copy link
Copy Markdown
Contributor

cmsbuild commented May 8, 2026

+1

Size: This PR adds an extra 16KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-35bfb7/53149/summary.html
COMMIT: fb1e0a9
CMSSW: CMSSW_17_0_X_2026-05-08-1100/el8_amd64_gcc13
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/50904/53149/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially removed 1 lines from the logs
  • Reco comparison results: 2 differences found in the comparisons
  • DQMHistoTests: Total files compared: 53
  • DQMHistoTests: Total histograms compared: 4187168
  • DQMHistoTests: Total failures: 10
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 4187138
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 52 files compared)
  • Checked 227 log files, 197 edm output root files, 53 DQM output files
  • TriggerResults: no differences found

Comment thread IOMC/EventVertexGenerators/src/FlatEvtVtxGenerator.cc Outdated
@cmsbuild
Copy link
Copy Markdown
Contributor

@bfonta
Copy link
Copy Markdown
Contributor Author

bfonta commented May 12, 2026

I've updated the description with the addition of new displaced workflows.

@mmusich
Copy link
Copy Markdown
Contributor

mmusich commented May 12, 2026

test parameters:

  • relval_opts = -w upgrade
  • workflow = 34401.82

@mmusich
Copy link
Copy Markdown
Contributor

mmusich commented May 12, 2026

@cmsbuild, please test

@cmsbuild
Copy link
Copy Markdown
Contributor

+1

Size: This PR adds an extra 60KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-35bfb7/53204/summary.html
COMMIT: df1fed0
CMSSW: CMSSW_17_0_X_2026-05-12-1100/el8_amd64_gcc13
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/50904/53204/install.sh to create a dev area with all the needed externals and cmssw changes.

DAS Queries: The DAS query tests failed, see the summary page for details.

Comparison Summary

Summary:

@antoniovagnerini
Copy link
Copy Markdown

+pdmv

@civanch
Copy link
Copy Markdown
Contributor

civanch commented May 14, 2026

+1

@cmsbuild
Copy link
Copy Markdown
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @mandrenguyen, @ftenchini, @sextonkennedy (and backports should be raised in the release meeting by the corresponding L2)

@ftenchini
Copy link
Copy Markdown

+1

@cmsbuild cmsbuild merged commit 16e7ed2 into cms-sw:master May 14, 2026
11 checks passed
@smuzaffar
Copy link
Copy Markdown
Contributor

smuzaffar commented May 15, 2026

@bfonta , some relvals are failing in latest 17.0.X Ibs with error [a]. Could the change in this PR is causing (or added checks to capture ) those failures?

[a] https://cmssdt.cern.ch/SDT/html/cmssdt-ib/#/relVal/CMSSW_17_0/2026-05-14-1700?selectedArchs=el8_amd64_gcc13&selectedFlavors=X&selectedStatus=failed

----- Begin Fatal Exception 14-May-2026 21:03:53 CEST-----------------------
An exception of category 'Configuration' occurred while
   [0] Constructing the EventProcessor
   [1] Constructing module: class=FlatEvtVtxGenerator label='VtxSmeared'
Exception Message:
Error in FlatEvtVtxGenerator: MinR is greater than MaxR
----- End Fatal Exception -------------------------------------------------

@mmusich
Copy link
Copy Markdown
Contributor

mmusich commented May 15, 2026

some relvals are failing in latest 17.0.X Ibs with error [a]. Could the change in this PR is causing (or added checks to capture ) those failures?

it should be fixed at #50946

Copy link
Copy Markdown
Contributor

@mmusich mmusich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while reading the class I have a couple of other comments.

Comment thread IOMC/EventVertexGenerators/src/FlatEvtVtxGenerator.cc
Comment thread IOMC/EventVertexGenerators/src/FlatEvtVtxGenerator.cc
@bfonta bfonta deleted the feature/constant_r_vertexing branch May 15, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Secondary vertex pointing in particle guns

8 participants