Skip to content

Rpc digi dev v9#47447

Open
bapavlov wants to merge 13 commits into
cms-sw:masterfrom
bapavlov:rpc_digi_dev_v9
Open

Rpc digi dev v9#47447
bapavlov wants to merge 13 commits into
cms-sw:masterfrom
bapavlov:rpc_digi_dev_v9

Conversation

@bapavlov
Copy link
Copy Markdown
Contributor

PR description:

We would like to introduce some new code for the RPC Phase 2 upgrade.
So far, the digitization for both the currently installed RPCs and the ones planned for the Phase 2 upgrade have used the same data format, which was developed for the Muon upgrade TDR. However, this format is no longer adequate due to the changes planned for the RPC Phase 2 upgrade.
In short, the RPC Phase 2 upgrade includes two major changes:

  • Improved readout electronics for all currently installed RPCs, allowing for more precise timing measurements.
  • Installation of a new type of RPCs, called iRPCs (an abbreviation for “improved RPC”), in the endcap stations RE3/1 and RE4/1.

We would like to introduce these changes into the software as well. We will keep the current digi format intact, but we plan to add two additional digi formats, called RPCDigiPhase2 and IRPCDigi. Below is a brief description of the proposed changes:

  • The readout of signals from all existing RPCs will be modified. Currently, the signal is digitized with a 40 MHz clock, corresponding to exactly 1 Bunch Crossing (BX) or a 25 ns time interval. After the Phase 2 upgrade, the RPCs will be read out with a much finer clock, allowing for sub-BX resolution. Thus, we aim to add a new data format for the RPC Phase 2 upgrade that enables sub-BX resolution. The new digi format is DataFormats/RPCDigi/interface/RPCDigiPhase2.h
  • In addition, the new iRPCs (improved RPCs) will be introduced in the CMS endcaps. The major difference between RPCs and iRPCs is that iRPC strips will be read out from both ends, allowing precise estimation of the muon impact point on the strip and very accurate time measurement. We have also prepared a new format for iRPCs, and the code DataFormats/IRPCDigi
  • We will keep the current digitization code intact, but we would like to add a digitization code for the Phase 2 RPC upgrade and iRPCs. The code is available here SimMuon/RPCDigitizer

PR validation:

At the moment, our colleagues are using the code from my repository and are developing the code for the next steps (e.g., trigger emulators). The code is tested and works as expected. Results have been reported during several RPC DPG and RPC Trigger meetings:
RPC DPG May 8, 2024
RPC Trigger Oct 2, 2024
RPC DPG Jan 22, 2025
RPC DPG Feb 5, 2025

I would like to emphasize again that we have taken special care not to interfere with the present simulation in any way.

@cmsbuild
Copy link
Copy Markdown
Contributor

cmsbuild commented Feb 25, 2025

cms-bot internal usage

@cmsbuild
Copy link
Copy Markdown
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-47447/43859

Code check has found code style and quality issues which could be resolved by applying following patch(s)

@cmsbuild
Copy link
Copy Markdown
Contributor

@cmsbuild
Copy link
Copy Markdown
Contributor

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

It involves the following packages:

  • DataFormats/IRPCDigi (****)
  • DataFormats/RPCDigi (simulation)
  • IOMC/RandomEngine (core)
  • SimMuon/Configuration (simulation)
  • SimMuon/RPCDigitizer (simulation)

The following packages do not have a category, yet:

DataFormats/IRPCDigi
Please create a PR for https://github.com/cms-sw/cms-bot/blob/master/categories_map.py to assign category

@Dr15Jones, @civanch, @cmsbuild, @kpedro88, @makortel, @mdhildreth, @smuzaffar can you please review it and eventually sign? Thanks.
@CeliaFernandez, @Fedespring, @HuguesBrun, @abbiendi, @andrea21z, @battibass, @cericeci, @fabiocos, @giovanni-mocellin, @jhgoh, @makortel, @missirol, @mmusich, @rovere, @slomeo, @trocino, @wddgit this is something you requested to watch as well.
@antoniovilela, @mandrenguyen, @rappoccio, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@kpedro88
Copy link
Copy Markdown
Contributor

@bapavlov some initial questions/comments:

  1. Please create a companion PR to https://github.com/cms-sw/cms-bot to add your new package to categories_map.py
  2. Is there a workflow that executes this code? If not, please add one for testing purposes.

@civanch
Copy link
Copy Markdown
Contributor

civanch commented Feb 26, 2025

@bapavlov , @kpedro88 , I would propose do not create IRPCDigi directory. I may be wrong but in a long term it will create more problems than benefits. At least, please, consider this option.

@kpedro88
Copy link
Copy Markdown
Contributor

I have no strong opinion about the new package either way. To me, it is up to the DPG to decide how they want to organize their code at this level. That said, my detailed code review is waiting on responses to the initial questions above.

@kpedro88
Copy link
Copy Markdown
Contributor

kpedro88 commented Mar 3, 2025

@bapavlov just to be clear, I am waiting on your replies to #47447 (comment) before further review or testing.

@bapavlov
Copy link
Copy Markdown
Contributor Author

bapavlov commented Mar 3, 2025

@kpedro88, @civanch We discussed your comments #47447 (comment) within the RPC group and decided to follow Vladimir's suggestion to move IRPCDigi to the DataFormats/RPCDigi directory. I assume that, in this case, there is no need of a companion PR to https://github.com/cms-sw/cms-bot.

Regarding your question about the workflow: currently, only the DIGI step for RPCPhase2 and IRPC is implemented, and no dedicated workflow is included yet. I have a technical question about how to proceed with implementing the workflow.

  • Should I create a new Era to include this workflow, or is there another recommended approach?
  • What should the workflow consist of? Should it also include the RECO step?

Your guidance on this would be greatly appreciated.

@kpedro88
Copy link
Copy Markdown
Contributor

kpedro88 commented Mar 3, 2025

@bapavlov indeed, if there is no new package, then no PR to cms-bot is needed.

For now, you should create a new Modifier to enable this change in the DIGI step. Then you can add a special workflow, as documented at https://github.com/cms-sw/cmssw/tree/master/Configuration/PyReleaseValidation. You can follow the phase2_ecal_devel example, which is very similar to yours; they also have removed downstream steps from the special workflow until the development advances and they are ready to run those steps again.

@cmsbuild
Copy link
Copy Markdown
Contributor

cmsbuild commented Mar 3, 2025

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-47447/43939

  • Found files with invalid states:

@cmsbuild
Copy link
Copy Markdown
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-47447/49589

@cmsbuild
Copy link
Copy Markdown
Contributor

cmsbuild commented Jun 1, 2026

@cmsbuild
Copy link
Copy Markdown
Contributor

cmsbuild commented Jun 1, 2026

@bapavlov
Copy link
Copy Markdown
Contributor Author

bapavlov commented Jun 1, 2026

@kpedro88 I removed some commits to fixed the rebase. The only thing that I added after the rebase are:

  • commit a07aa2d
  • commit f28bef1
  • commit 0d3d4ac
    This 3 commits are dealing with the missing token based crossing frame for the new Producers (IRPCDigiProducer and RPCDigiPhase2Producer) - both code and configuration files.

Yesterday cmsbuild reported a conflict, so I also added:

  • commit d5f5934
    Should I remove it and rebase ?

@kpedro88
Copy link
Copy Markdown
Contributor

kpedro88 commented Jun 1, 2026

There are still unrelated commits in this branch (see the "commits" tab in this PR). The recent use of git merge further complicates things (which is why using merge is never recommended).

I have made a version of the branch reset to before merge. Using this branch, please follow these instructions:

export SCRAM_ARCH=el9_amd64_gcc13
cmsrel CMSSW_17_0_X_2026-05-31-2300
cd CMSSW_17_0_X_2026-05-31-2300/src
cmsenv
git cms-rebase-topic -o d1c757246c00fabebf509eba9615272705df9933^ kpedro88:rpc_digi_dev_v9

(where the commit hash is the actual first commit in this branch, "Squashed commit of the following: ..."), the ^ means the first parent of that commit, and -o is the argument for "old base" in the rebase)

bapavlov and others added 13 commits June 1, 2026 21:55
commit 4f66246
Author: Borislav Pavlov <Borislav.Pavlov@cern.ch>
Date:   Mon Mar 3 21:11:40 2025 +0100

    IRPCDigi to DataFormats/RPCDigi directory

commit 2c99471
Author: Borislav Pavlov <Borislav.Pavlov@cern.ch>
Date:   Tue Feb 25 23:16:12 2025 +0100

    applying code-checks patch

commit 2e6e9d4
Merge: 26ffcf1 b2dc087
Author: Borislav Pavlov <Borislav.Pavlov@cern.ch>
Date:   Tue Feb 25 23:04:58 2025 +0100

    Merged rpc_digi_dev_v9 from repository bapavlov with cms-merge-topic

commit b2dc087
Author: Borislav Pavlov <Borislav.Pavlov@cern.ch>
Date:   Wed Feb 5 13:53:59 2025 +0100

    adding changes to the confriguration files

commit fd5c136
Author: Borislav Pavlov <Borislav.Pavlov@cern.ch>
Date:   Wed Feb 5 13:51:51 2025 +0100

    adding the digitization code

commit 7b32d20
Author: Borislav Pavlov <Borislav.Pavlov@cern.ch>
Date:   Wed Feb 5 13:47:32 2025 +0100

    adding the new IRPCDigi format

commit e6f63fa
Author: Borislav Pavlov <Borislav.Pavlov@cern.ch>
Date:   Wed Feb 5 13:46:19 2025 +0100

    adding RPCDigiPhase2 format
Co-authored-by: Matti Kortelainen <matti.kortelainen@cern.ch>
Co-authored-by: Matti Kortelainen <matti.kortelainen@cern.ch>
@cmsbuild
Copy link
Copy Markdown
Contributor

cmsbuild commented Jun 1, 2026

@bapavlov
Copy link
Copy Markdown
Contributor Author

bapavlov commented Jun 1, 2026

@kpedro88 Thank you very much !!! I followed your instructions - the code compiles and runs successfully with runTheMatrix.py -l 34434.62 -w upgrade

@cmsbuild
Copy link
Copy Markdown
Contributor

cmsbuild commented Jun 1, 2026

@kpedro88
Copy link
Copy Markdown
Contributor

kpedro88 commented Jun 1, 2026

please test

@@ -0,0 +1,44 @@
#ifndef IRPCDigi_IRPCDigi_h
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.

Please follow code rule 4.1: this should be #ifndef DataFormats_RPCDigi_IRPCDigi_h (& similar for all other header files in this PR)

Comment on lines +18 to +20
if (strip_ != digi.strip() || bxLR_ != digi.bx())
return false;
return true;
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.

simplify:

return strip_ == digi.strip() && bxLR_ = digi.bx();

Comment on lines +17 to +19
if (strip_ != digi.strip() || bx_ != digi.bx())
return false;
return true;
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.

simplify as above


float IRPCDigiTime::coordinateY() {
const double signal_speed = 0.66 * 299792458e-7; //signal propagation speed [cm/ns]
return signal_speed * (timeLR() - timeHR()) / 2.;
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.

return signal_speed * time(); to avoid duplication

float IRPCDigiTime::time() { return (timeLR() + timeHR()) / 2.; }

float IRPCDigiTime::coordinateY() {
const double signal_speed = 0.66 * 299792458e-7; //signal propagation speed [cm/ns]
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.

in principle, physical constants like speed of light should be taken from a central source, but I'm not sure if e.g. CLHEP usage is recommended in DataFormats

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.

CLHEP dependence is allowed in DataFormats (we even have DataFormats/CLHEP).

@@ -0,0 +1,267 @@
#include "Geometry/RPCGeometry/interface/RPCRoll.h"
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.

propagate all comments on IRPCSimModelTiming.cc to this very similar file/class

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.

do these really need to be two separate classes duplicating hundreds of lines of code?

Comment on lines +43 to +67
double aveEff;
double aveCls;
double resRPC;
double timOff;
double dtimCs;
double resEle;
double sspeed;
double lbGate;
bool rpcdigiprint;
bool eledig;

int N_hits;
int nbxing;
double rate;
double gate;
double frate;
bool do_Y;
double sigmaY;

std::map<int, std::vector<double> > clsMap;
std::vector<double> sum_clsize;
std::vector<double> clsForDetId;
std::ifstream* infile;

RPCSynchronizer* _rpcSync;
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.

end in underscore


float prop_time = distanceFromEdge / sspeed;

// double rr_tim1 = CLHEP::RandGaussQ::shoot(engine, 0.,resRPC);
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.

delete commented-out code

Comment on lines +335 to +336
tdc.first = BX;
tdc.second = SBX;
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.

can use make_pair()

std::pair<float, float> getDoubleTiming(const PSimHit* simhit, CLHEP::HepRandomEngine* engine, float StripLength);
int getBX(float time);
std::pair<int, int> getBX_SBX(float time);
//std::pair<int,int> getFineTime(const PSimHit* simhit, CLHEP::HepRandomEngine* engine,float StripLength);
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.

delete commented-out code

@cmsbuild
Copy link
Copy Markdown
Contributor

cmsbuild commented Jun 1, 2026

+1

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

Comparison Summary

Summary:

  • You potentially removed 5 lines from the logs
  • ROOTFileChecks: Some differences in event products or their sizes found
  • Reco comparison results: 814 differences found in the comparisons
  • DQMHistoTests: Total files compared: 53
  • DQMHistoTests: Total histograms compared: 4199113
  • DQMHistoTests: Total failures: 107
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 4198986
  • 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

cmsbuild commented Jun 5, 2026

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.

@makortel
Copy link
Copy Markdown
Contributor

makortel commented Jun 5, 2026

Just checking, is this PR intended for Phase 2 (20_1_X) or Run 3 legacy (17_0_X) or both?

@kpedro88
Copy link
Copy Markdown
Contributor

kpedro88 commented Jun 5, 2026

This is a Phase 2 development.

@makortel
Copy link
Copy Markdown
Contributor

makortel commented Jun 5, 2026

Thanks, then no further action is needed regarding the release cycle change.

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.