Skip to content

Displaced Particle Gun#51006

Open
bfonta wants to merge 16 commits into
cms-sw:masterfrom
bfonta:feature/displaced_gun
Open

Displaced Particle Gun#51006
bfonta wants to merge 16 commits into
cms-sw:masterfrom
bfonta:feature/displaced_gun

Conversation

@bfonta

@bfonta bfonta commented May 21, 2026

Copy link
Copy Markdown
Contributor

PR description:

This PR introduces a displaced particle gun producer, and adds corresponding workflows.
The producer is useful for studies considering displaced topologies.

The producer selects a vertex position by randomly generating a set of $R>0$, $\phi_{\text{Vtx}} \in [0;2\pi[$, and $z>0$ coordinates. The momentum of the particle is then randomly generated using $p_{\text{T}}$, $\theta \in [0, \pi[$ and $\phi \in [-\pi; \pi[$ coordinates. The vertex displacement $R$ can be generated uniformly along $R$, or uniformly along the area of an annulus of radius $R_{\text{max}}-R_{\text{min}}$.

The gun can be forced to only generate particles reaching the surface of HGCAL via the PointingToHGCAL flag. In this case, $\theta$ and $\phi$ are generated multiple times until a configuration enables the particle to lie within RminFrontSurfaceHGCAL and RmaxFrontSurfaceHGCAL. Note that, given a displaced vertex, setting only a $\theta$ range is not sufficient to guarantee that a particle is produced in the right direction. By default, RminFrontSurfaceHGCAL and RmaxFrontSurfaceHGCAL delimit the inner third of HGCAL's front surface, ensuring virtually all showers produced up to $R=200\text{cm}$ traverse the entirety of the CE-E. The PointingToHGCAL flag cannot be used with charged particles, since their curved trajectories under the magnetic field breaks the implemented logic.

PR validation

Inspecting the output of step2 with cmsShow shows photons produced at the right $R$ values, and always pointing towards the positive endcap.

Running the workflows produces the intended commands:

$ runTheMatrix.py -l 34554.0 -w upgrade 
...
Preparing to run 34554.0 DisplacedPGun+Run4D121                                                                                                                                                                    
                                                                                                                                                                                                                   
# in: /cms-hlt-nfs/user/bfontana/DisplacedSamples/src going to execute cd 34554.0_DisplacedPGun+Run4D121                                                                                                           
 cmsDriver.py DisplacedParticleGun_cfi  -s GEN,SIM -n 10 --conditions auto:phase2_realistic_T35_13TeV --beamspot DBrealisticHLLHC --datatier GEN-SIM --eventcontent FEVTDEBUG --geometry ExtendedRun4D121 --era Pha
se2C22I13M9 --relval 9000,100 --fileout file:step1.root  > step1_DisplacedPGun+Run4D121.log  2>&1                                                                                                                  
                                                                                                                                                                                                                   
                                                                                                                                                                                                                   
# in: /cms-hlt-nfs/user/bfontana/DisplacedSamples/src going to execute cd 34554.0_DisplacedPGun+Run4D121                                                                                                           
 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 Extended
Run4D121 --era Phase2C22I13M9 --filein  file:step1.root  --fileout file:step2.root  > step2_DisplacedPGun+Run4D121.log  2>&1                                                                                       
                                                                                                                                                                                                                   
                                                                                                                                                                                                                   
# in: /cms-hlt-nfs/user/bfontana/DisplacedSamples/src going to execute cd 34554.0_DisplacedPGun+Run4D121                                                                                                           
 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 --e
ventcontent FEVTDEBUGHLT,MINIAODSIM,DQM --geometry ExtendedRun4D121 --era Phase2C22I13M9 --filein  file:step2.root  --fileout file:step3.root  > step3_DisplacedPGun+Run4D121.log  2>&1                            
                                                                                                                                                                                                                   
                                                                                                                                                                                                                   
# in: /cms-hlt-nfs/user/bfontana/DisplacedSamples/src going to execute cd 34554.0_DisplacedPGun+Run4D121                                                                                                           
 cmsDriver.py step4  -s HARVESTING:@phase2Validation+@phase2+@miniAODValidation+@miniAODDQM --conditions auto:phase2_realistic_T35 --mc  --geometry ExtendedRun4D121 --scenario pp --filetype DQM --era Phase2C22I1
3M9 -n 100  --filein file:step3_inDQM.root --fileout file:step4.root  > step4_DisplacedPGun+Run4D121.log  2>&1                                                                                                     
                                                                                                                                                                                                                   
                                                                                                                                                                                                                   
# in: /cms-hlt-nfs/user/bfontana/DisplacedSamples/src going to execute cd 34554.0_DisplacedPGun+Run4D121                                                                                                           
 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 --filein file:step3.root --fileout file:step5.root  > step5_
DisplacedPGun+Run4D121.log  2>&1                                                                                                                                                                                   
                                                                                                                                                                                                                   
34554.0_DisplacedPGun+Run4D121 Step0-PASSED Step1-PASSED Step2-PASSED Step3-PASSED Step4-PASSED  - time date Thu May 21 01:14:13 2026-date Thu May 21 01:07:37 2026; exit: 0 0 0 0 0                               
1 1 1 1 1 tests passed, 0 0 0 0 0 failed 

Update:

I've also added a HLT-only displaced workflow (with the NGTScouting HLT menu):

$ runTheMatrix.py -l 34554.77 -w upgrade

...

Preparing to run 34554.77 DisplacedPGun+Run4D121_NGTScouting                                                                                                                            
                                                                                                                                                                                        
# in: /cms-hlt-nfs/user/bfontana/DisplacedSamples/src going to execute cd 34554.77_DisplacedPGun+Run4D121_NGTScouting                                                                   
 cmsDriver.py DisplacedParticleGun_cfi  -s GEN,SIM -n 10 --conditions auto:phase2_realistic_T35_13TeV --beamspot DBrealisticHLLHC --datatier GEN-SIM --eventcontent FEVTDEBUG --geometry
 ExtendedRun4D121 --era Phase2C22I13M9 --relval 9000,100 --fileout file:step1.root  > step1_DisplacedPGun+Run4D121_NGTScouting.log  2>&1                                                
                                                                                                                                                                                        
                                                                                                                                                                                        
# in: /cms-hlt-nfs/user/bfontana/DisplacedSamples/src going to execute cd 34554.77_DisplacedPGun+Run4D121_NGTScouting                                                                   
 cmsDriver.py step2  -s DIGI:pdigi_valid,L1TrackTrigger,L1,L1P2GT,DIGI2RAW,HLT:NGTScouting,VALIDATION:@hltValidation --conditions auto:phase2_realistic_T35 --datatier GEN-SIM-DIGI-RAW,
DQMIO -n 10 --eventcontent FEVTDEBUGHLT,DQMIO --geometry ExtendedRun4D121 --era Phase2C22I13M9 --procModifiers ngtScouting --customise SLHCUpgradeSimulations/Configuration/aging.custom
ise_aging_1000 --filein  file:step1.root  --fileout file:step2.root  > step2_DisplacedPGun+Run4D121_NGTScouting.log  2>&1                                                               
                                                                                                                                                                                        
                                                                                                                                                                                        
# in: /cms-hlt-nfs/user/bfontana/DisplacedSamples/src going to execute cd 34554.77_DisplacedPGun+Run4D121_NGTScouting                                                                   
 cmsDriver.py step3  -s HARVESTING:@hltValidation --conditions auto:phase2_realistic_T35 --mc  --geometry ExtendedRun4D121 --scenario pp --filetype DQM --era Phase2C22I13M9 --procModif
iers ngtScouting -n 100  --filein file:step2_inDQM.root --fileout file:step3.root  > step3_DisplacedPGun+Run4D121_NGTScouting.log  2>&1                                                 
                                                                                                                                                                                        
34554.77_DisplacedPGun+Run4D121_NGTScouting Step0-PASSED Step1-PASSED Step2-PASSED  - time date Thu May 28 17:07:11 2026-date Thu May 28 17:03:56 2026; exit: 0 0 0                     
1 1 1 tests passed, 0 0 0 failed 

@bfonta

bfonta commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

type ngt

@cmsbuild

cmsbuild commented May 21, 2026

Copy link
Copy Markdown
Contributor

cms-bot internal usage

@cmsbuild

Copy link
Copy Markdown
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-51006/49427

@cmsbuild

Copy link
Copy Markdown
Contributor

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

It involves the following packages:

  • Configuration/Generator (generators)
  • Configuration/PyReleaseValidation (pdmv)
  • IOMC/ParticleGuns (generators)

@AdrianoDee, @DickyChant, @antoniovagnerini, @cmsbuild, @kfjack, @lviliani, @miquork, @mkirsano, @sensrcn, @sroychow, @theofil can you please review it and eventually sign? Thanks.
@Martin-Grunewald, @fabiocos, @grzanka, @makortel, @slomeo 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

mmusich commented May 21, 2026

Copy link
Copy Markdown
Contributor

test parameters:

  • relval_opts = -w upgrade
  • workflows = 34554.0

@mmusich

mmusich commented May 21, 2026

Copy link
Copy Markdown
Contributor

@cmsbuild, please test

@mmusich mmusich left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

from a first cursory review.

Comment thread IOMC/ParticleGuns/src/DisplacedParticleGunProducer.cc Outdated
Comment thread IOMC/ParticleGuns/src/DisplacedParticleGunProducer.cc Outdated
Comment thread IOMC/ParticleGuns/src/DisplacedParticleGunProducer.cc Outdated
Comment thread IOMC/ParticleGuns/src/DisplacedParticleGunProducer.cc
@cmsbuild

Copy link
Copy Markdown
Contributor

+1

Size: This PR adds an extra 116KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-444934/53402/summary.html
COMMIT: b76569b
CMSSW: CMSSW_17_0_X_2026-05-20-2300/el8_amd64_gcc13
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/51006/53402/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:

  • You potentially added 1 lines to the logs
  • ROOTFileChecks: Some differences in event products or their sizes found
  • Reco comparison results: 10 differences found in the comparisons
  • DQMHistoTests: Total files compared: 53
  • DQMHistoTests: Total histograms compared: 4198477
  • DQMHistoTests: Total failures: 6
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 4198451
  • 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

@cmsbuild

Copy link
Copy Markdown
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-51006/49429

@cmsbuild

Copy link
Copy Markdown
Contributor

Pull request #51006 was updated. @AdrianoDee, @DickyChant, @antoniovagnerini, @cmsbuild, @kfjack, @lviliani, @miquork, @mkirsano, @sensrcn, @sroychow, @theofil can you please check and sign again.

@cmsbuild

cmsbuild commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

@cmsbuild

cmsbuild commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Pull request #51006 was updated. @AdrianoDee, @DickyChant, @antoniovagnerini, @cmsbuild, @kfjack, @lviliani, @miquork, @mkirsano, @sensrcn, @sroychow, @theofil can you please check and sign again.

@bfonta

bfonta commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

The PointingToHGCAL=true flag now defines a region in R located at the back surface of the CE-E (at the 26th layer), ensuring that uncharged particles are aligned with the CE-E. If additionally RestrictRInZPlaneAtZero = true, then the gun verifies that a particle produced at ZVtx is aligned with a user-provided R region at z=0. These options enable the user to produce a displaced photon at the surface of HGCAL, with a shower fully contained within HGCAL, and pointing to a user-defined region, using as reference the plane at Z=0.

@mmusich

mmusich commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

@cmsbuild, please test

@felicepantaleo

Copy link
Copy Markdown
Contributor

@bfonta as this PR is still not what we agreed upon at the last TICL meeting, can you clarify what your plans are?

@bfonta

bfonta commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

@felicepantaleo The logic that ensures the shower is contained within HGCAL and still points to a reasonable R at the Z=0 plane is not trivial, and already depends on quite a few user options. I think keeping the displaced gun separate from the closeby gun simplifies the existing workflows, and also makes it clear for a potential user which gun to use when running displaced studies.
I would be anyways happy to provide some guidance, at a later date, in case you think the close-by gun benefits from the support of non-pointing topologies.

@cmsbuild

cmsbuild commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

+1

Size: This PR adds an extra 52KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-444934/53643/summary.html
COMMIT: 071d6b6
CMSSW: CMSSW_17_0_X_2026-06-01-2300/el8_amd64_gcc13
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/51006/53643/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:

  • You potentially removed 3 lines from the logs
  • Reco comparison results: 8 differences found in the comparisons
  • DQMHistoTests: Total files compared: 53
  • DQMHistoTests: Total histograms compared: 4199113
  • DQMHistoTests: Total failures: 32
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 4199061
  • 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

@bfonta

bfonta commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Could you please merge the PR?

@cmsbuild

cmsbuild commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Milestone for this pull request has been moved to CMSSW_20_0_X. Please open a backport if it should also go in to CMSSW_17_0_X.

@cmsbuild cmsbuild modified the milestones: CMSSW_17_0_X, CMSSW_20_0_X Jun 5, 2026
@makortel

makortel commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

(I assume this PR does not need a backport to 17_0_X (Run 3 legacy))

@cmsbuild

cmsbuild commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Milestone for this pull request has been moved to CMSSW_20_1_X. Please open a backport if it should also go in to CMSSW_20_0_X.

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.

5 participants