Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BTL simulation: OOT effects #28433

Merged
merged 4 commits into from Nov 28, 2019
Merged

BTL simulation: OOT effects #28433

merged 4 commits into from Nov 28, 2019

Conversation

casarsa
Copy link
Contributor

@casarsa casarsa commented Nov 20, 2019

PR description:

This PR modifies the BTL digitization to include the effects on time resolution due to the photon tails of earlier OOT hits in the same crystal. It implements the model proposed by A. Ledovskoy (slides). (@pmeridian @parbol )

The size of MTDSimHitData had to be increased in order for the information of previous BXs
for both bar sides to be available in the BTLElectronicSim. The premixing configuration has been updated accordingly. (@makortel )

PR validation:

The new code has been tested in CMSSW_11_0_X_2019-11-18-2300 with the TTbar WF 22234 (PU200):

step 2:

MemoryReport> Peak virtual size 6280.26 Mbytes
Key events increasing vsize:
[0] run: 0 lumi: 0 event: 0 vsize = 0 deltaVsize = 0 rss = 0 delta = 0
[1] run: 1 lumi: 1 event: 1 vsize = 4296.21 deltaVsize = 0 rss = 3077.83 delta = 0
[3] run: 1 lumi: 1 event: 3 vsize = 5128.21 deltaVsize = 832 rss = 3166.95 delta = 89.1211
[88] run: 1 lumi: 1 event: 88 vsize = 6280.26 deltaVsize = 640 rss = 3146.59 delta = -20.3594
[12] run: 1 lumi: 1 event: 12 vsize = 5640.25 deltaVsize = 512.008 rss = 3204.43 delta = 37.4727
[90] run: 1 lumi: 1 event: 90 vsize = 6280.26 deltaVsize = 0 rss = 3078.7 delta = -67.8984
[89] run: 1 lumi: 1 event: 89 vsize = 6280.26 deltaVsize = 0 rss = 3203.86 delta = 57.2656
[88] run: 1 lumi: 1 event: 88 vsize = 6280.26 deltaVsize = 640 rss = 3146.59 delta = -34.625
TimeReport> Time report complete in 10911.9 seconds
Time Summary:

  • Min event: 80.4885
  • Max event: 128.658
  • Avg event: 107.631
  • Total loop: 10882.3
  • Total init: 29.3701
  • Total job: 10911.9
  • EventSetup Lock: 0.00013113
  • EventSetup Get: 83.4706
    Event Throughput: 0.00918923 ev/s
    CPU Summary:
  • Total loop: 9314.68
  • Total init: 13.381
  • Total extra: 0
  • Total job: 9328.3

step 3

MemoryReport> Peak virtual size 10161.6 Mbytes
Key events increasing vsize:
[8] run: 1 lumi: 1 event: 8 vsize = 9139.4 deltaVsize = 32.0586 rss = 6650.14 delta = 89.9492
[3] run: 1 lumi: 1 event: 3 vsize = 9107.34 deltaVsize = 900.121 rss = 6560.19 delta = 155.914
[42] run: 1 lumi: 1 event: 42 vsize = 10161.6 deltaVsize = 1022.13 rss = 6870.45 delta = 310.262
[0] run: 0 lumi: 0 event: 0 vsize = 0 deltaVsize = 0 rss = 0 delta = 0
[0] run: 0 lumi: 0 event: 0 vsize = 0 deltaVsize = 0 rss = 0 delta = 0
[44] run: 1 lumi: 1 event: 44 vsize = 10161.6 deltaVsize = 0 rss = 6714.96 delta = -155.488
[43] run: 1 lumi: 1 event: 43 vsize = 10161.6 deltaVsize = 0 rss = 6831.04 delta = -39.4141
[42] run: 1 lumi: 1 event: 42 vsize = 10161.6 deltaVsize = 1022.13 rss = 6870.45 delta = 68.0742
TimeReport> Time report complete in 24287.1 seconds
Time Summary:

  • Min event: 145.066
  • Max event: 412.86
  • Avg event: 237.186
  • Total loop: 24138
  • Total init: 138.612
  • Total job: 24287.1
  • EventSetup Lock: 0.000231981
  • EventSetup Get: 95.3623
    Event Throughput: 0.00414284 ev/s
    CPU Summary:
  • Total loop: 20984.7
  • Total init: 101.39
  • Total extra: 0
  • Total job: 21096.3

@cmsbuild
Copy link
Contributor

The code-checks are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-28433/12836

  • This PR adds an extra 28KB to repository

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @casarsa (Massimo Casarsa) for master.

It involves the following packages:

DataFormats/FTLDigi
SimFastTiming/FastTimingCommon

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

cms-bot commands are listed here

@kpedro88
Copy link
Contributor

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 20, 2019

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-run-pr-tests/3554/console Started: 2019/11/20 15:04

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Comparison job queued.

@makortel
Copy link
Contributor

The premixing configuration has been updated accordingly.

The changes themselves look fine. Did you check the impact on the pileup library disk size?

@cmsbuild
Copy link
Contributor

Comparison is ready
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-54131d/3554/summary.html

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 9242 differences found in the comparisons
  • DQMHistoTests: Total files compared: 34
  • DQMHistoTests: Total histograms compared: 2936360
  • DQMHistoTests: Total failures: 5416
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 2930603
  • DQMHistoTests: Total skipped: 341
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 33 files compared)
  • Checked 147 log files, 16 edm output root files, 34 DQM output files

double tL = std::get<2>(hitRef) + LightCollSlopeL_ * distL;

// --- Accumulate in 15 buckets of 25ns (9 pre-samples, 1 in-time, 5 post-samples)
const int iBXR = std::floor(tR / bxTime_) + 9;
Copy link
Contributor

Choose a reason for hiding this comment

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

magic number 9 should be named constant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've introduced a named constant

if ((simHitIt->second).hit_info[1][0] == 0 || tR < (simHitIt->second).hit_info[1][0])
(simHitIt->second).hit_info[1][0] = tR;
// --- Right side
if (iBXR > 0 && iBXR < 15) {
Copy link
Contributor

Choose a reason for hiding this comment

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

magic number 15 should be named constant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've replaced 15 with a named constant

if (smearTimeForOOTtails_) {
float rate_oot = 0.;
// Loop on earlier OOT hits
for (unsigned int ibx = 0; ibx < 9; ++ibx) {
Copy link
Contributor

Choose a reason for hiding this comment

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

magic number 9

Copy link
Contributor Author

Choose a reason for hiding this comment

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

9 has been replaced with a named constant

for (unsigned int ibx = 0; ibx < 9; ++ibx) {
if ((it->second).hit_info[2 * iside][ibx] > 0.) {
float npe_oot = CLHEP::RandPoissonQ::shoot(hre, (it->second).hit_info[2 * iside][ibx]);
rate_oot += npe_oot * exp((it->second).hit_info[1 + 2 * iside][ibx] / ScintillatorDecayTime_) /
Copy link
Contributor

Choose a reason for hiding this comment

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

can slightly speed up the math here by storing ScintillatorDecayTimeInv_ = 1./ScintillatorDecayTime_ once and then multiplying by ScintillatorDecayTimeInv_ (rather than dividing, which is slower)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -84,14 +84,16 @@ void BTLTileDeviceSim::getHitsResponse(const std::vector<std::tuple<int, uint32_
if (smearLightCollTime_ > 0.)
toa += CLHEP::RandGaussQ::shoot(hre, 0., smearLightCollTime_);

if (toa > bxTime_ || toa < 0) //just consider BX==0
// Accumulate in 15 buckets of 25ns (9 pre-samples, 1 in-time, 5 post-samples)
const int iBX = std::floor(toa / bxTime_) + 9;
Copy link
Contributor

Choose a reason for hiding this comment

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

magic number 9

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Introduced named constant.

if (toa > bxTime_ || toa < 0) //just consider BX==0
// Accumulate in 15 buckets of 25ns (9 pre-samples, 1 in-time, 5 post-samples)
const int iBX = std::floor(toa / bxTime_) + 9;
if (iBX < 0 || iBX > 14)
Copy link
Contributor

Choose a reason for hiding this comment

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

magic number 14 = 15 - 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rewritten with a named constant

@cmsbuild
Copy link
Contributor

Comparison is ready
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-54131d/3620/summary.html

@slava77 comparisons for the following workflows were not done due to missing matrix map:

  • /data/cmsbld/jenkins/workspace/compare-root-files-short-matrix/results/JR-comparison/PR-54131d/20634.21_TTbar_14TeV+TTbar_14TeV_TuneCUETP8M1_2026D41PU_GenSimHLBeamSpotFull14+DigiFullTriggerPU_2026D41PU+RecoFullGlobalPU_ProdLike_2026D41PU+MiniAODFullGlobalPU_ProdLike_2026D41PU

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 9171 differences found in the comparisons
  • DQMHistoTests: Total files compared: 34
  • DQMHistoTests: Total histograms compared: 2787584
  • DQMHistoTests: Total failures: 5422
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 2781821
  • DQMHistoTests: Total skipped: 341
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 33 files compared)
  • Checked 147 log files, 16 edm output root files, 34 DQM output files

@casarsa
Copy link
Contributor Author

casarsa commented Nov 26, 2019

From 100 events of WF 22261.97 with PU 200 I get:
Branch Name | Average Uncompressed Size (Bytes/Event) | Average Compressed Size (Bytes/Event)
PMTDSimAccumulator_mix_FTLBarrel_DIGI. 2.96946e+06 2.39309e+06
PMTDSimAccumulator_mix_FTLEndcap_DIGI. 1.33048e+06 775614

Thanks, so in total 3 MB/event (compressed). Could you also check the sizes without this PR? My previous estimate from 10_4_0_mtd5 is 1.1 MB/event, but that could be already out of date.

@makortel The estimate on 100 TTbar PU200 events with 11_0_X_2019-11-18-2300 w/o this PR is consistent with what you got:
PMTDSimAccumulator_mix_FTLEndcap_DIGI. 1.33048e+06 796149
PMTDSimAccumulator_mix_FTLBarrel_DIGI. 640898 393317

@fabiocos
Copy link
Contributor

@pmeridian @parbol comments about this update? If we want it for the HLT TDR it should enter now.
In case there is the possibility to switch it off keeping the updated code.

@kpedro88
Copy link
Contributor

Is it possible to tune the size of the premixed library? Without MTD and without truth information, the size was previously estimated at 12.7 MB/evt (source). This change from 1 MB to 3 MB for MTD amounts to a ~15% increase in the overall library size, which is substantial.

@makortel
Copy link
Contributor

From 100 events of WF 22261.97 with PU 200 I get:
Branch Name | Average Uncompressed Size (Bytes/Event) | Average Compressed Size (Bytes/Event)
PMTDSimAccumulator_mix_FTLBarrel_DIGI. 2.96946e+06 2.39309e+06
PMTDSimAccumulator_mix_FTLEndcap_DIGI. 1.33048e+06 775614

Thanks, so in total 3 MB/event (compressed). Could you also check the sizes without this PR? My previous estimate from 10_4_0_mtd5 is 1.1 MB/event, but that could be already out of date.

The estimate on 100 TTbar PU200 events with 11_0_X_2019-11-18-2300 w/o this PR is consistent with what you got:
PMTDSimAccumulator_mix_FTLEndcap_DIGI. 1.33048e+06 796149
PMTDSimAccumulator_mix_FTLBarrel_DIGI. 640898 393317

@casarsa Thanks! Increasing the compressed event size on disk from 1.1 MB to 3 MB is probably fine now. The total now is 45 MB, dominated by MC truth whose inclusion should become unnecessary. At that point the 3 MB/event could become something to be optimized (to compare, in 10_4_0_mtd5 HGCal consumed 8.5 MB/event (to be optimized as well), and tracker 2.8 MB/event. Run2 premixing at PU50 is 3.2 MB/event).

Ok, I see @kpedro88 already asked about reducing the size.

@kpedro88
Copy link
Contributor

+upgrade
size reduction in the premix library should be attempted in a followup PR

@fabiocos
Copy link
Contributor

@civanch any further comment?

@civanch
Copy link
Contributor

civanch commented Nov 27, 2019

+1

@cmsbuild
Copy link
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. @davidlange6, @slava77, @smuzaffar, @fabiocos (and backports should be raised in the release meeting by the corresponding L2)

@fabiocos
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit d6ac250 into cms-sw:master Nov 28, 2019
@fabiocos
Copy link
Contributor

@casarsa @kpedro88 @makortel strictly speaking this PR causes the premix library to be backward incompatible as far as MTD is concerned. I doubt this is a real practical issue, especially when moving from 10_6_X to 11_0_X, but it is important to have it clear

@casarsa casarsa deleted the mc-simBTL-OOT branch November 28, 2019 09:30
@kpedro88
Copy link
Contributor

@fabiocos indeed, that should be fine because phase 2 premix libraries have not been centrally generated yet

@fabiocos
Copy link
Contributor

@kpedro88 moving to a completely new release should be fine as well in my view, at the end of the day it is not a final data format but an intermediate technical one, to be discussed at least. Anyway I am afraid we have an issue with this PR and premix, as it is again crashing in the IB, I am making a cross check.

@fabiocos
Copy link
Contributor

@casarsa @kpedro88 This is causing a crash in premixing workflow 20634.99 whose solution does not look entirely trivial. At this point, in order not to hold anymore the pre13 validation, I revert this PR to be possibly considered in a fix round after further careful validation.

@casarsa casarsa restored the mc-simBTL-OOT branch November 29, 2019 09:01
@casarsa casarsa deleted the mc-simBTL-OOT branch February 6, 2020 14:24
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.

None yet

6 participants