-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
[HGCal] TICL v3 major upgrade #31906
Conversation
The code-checks are being triggered in jenkins. |
enable profiling |
@cmsbuild please test |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-31906/19329
|
The tests are being triggered in jenkins.
|
A new Pull Request was created by @felicepantaleo (Felice Pantaleo) for master. It involves the following packages: DataFormats/HGCalReco @perrotta, @andrius-k, @kmaeshima, @ErnestaP, @kpedro88, @cmsbuild, @jfernan2, @fioriNTU, @slava77, @jpata can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
Thanks @felicepantaleo. |
+1 |
Comparison job queued. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This review includes some suggestions to reduce CPU usage and code duplication, as well as a few other minor points. The performance profile from the PR test may provide more direction re: reducing CPU usage (if necessary).
@@ -44,6 +52,9 @@ PatternRecognitionbyCA<TILES>::PatternRecognitionbyCA(const edm::ParameterSet &c | |||
<< "PatternRecognitionbyCA received an empty graph definition from the global cache"; | |||
} | |||
eidSession_ = tensorflow::createSession(trackstersCache->eidGraphDef); | |||
if (max_missing_layers_in_trackster_ < 100) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100 seems like a magic number here - how it is obtained?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this could be done in the constructor initializer list:
check_missing_layers(max_missing_layers_in_trackster_ < 100),
@@ -137,29 +155,105 @@ void PatternRecognitionbyCA<TILES>::makeTracksters( | |||
<< input.layerClusters[outerCluster].z() << " " << tracksterId << std::endl; | |||
} | |||
} | |||
unsigned showerMinLayerId = 99999; | |||
std::vector<unsigned int> layerIds; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it appears this variable is never used
lcIdAndLayer.emplace_back(i, layerId); | ||
} | ||
std::sort(uniqueLayerIds.begin(), uniqueLayerIds.end()); | ||
uniqueLayerIds.erase(std::unique(uniqueLayerIds.begin(), uniqueLayerIds.end()), uniqueLayerIds.end()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How fast is this procedure (push_back, sort, erase unique) compared to inserting into std::set
for typical occupancies and number of duplicates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the fastest is to build a heap while pushing and then do the erase(unique());
std::set is by definition slower then a vector as it allocated node on the fly (no reserve)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for a very small number of elements, the vector is the fastest option. We are talking of 20-30 elements here
int numberOfMissingLayers = 0; | ||
unsigned int j = showerMinLayerId; | ||
unsigned int indexInVec = 0; | ||
for (auto &layer : uniqueLayerIds) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const auto&
} | ||
} | ||
|
||
bool selected = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
temporary is unnecessary
tmpCandidate.setRawEnergy(energy); | ||
math::XYZTLorentzVector p4(track.momentum().x(), track.momentum().y(), track.momentum().z(), energy); | ||
tmpCandidate.setP4(p4); | ||
resultCandidates->push_back(tmpCandidate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy could be avoided by using emplace_back()
and then back()
cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[mclId].second = FLT_MAX; | ||
//cpsInMultiCluster[multicluster][CPids] | ||
//Connects a multi cluster with all related caloparticles. | ||
cpsInMultiCluster[mclId].emplace_back(std::make_pair<int, float>(h.clusterId, FLT_MAX)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make_pair
is unnecessary with emplace_back
occurrencesCPinMCL[c]++; | ||
//Loop through all rechits to count how many of them are noise and how many are matched. | ||
//In case of matched rechit-simhit, he counts and saves the number of rechits related to the maximum energy CaloParticle. | ||
for (auto& c : hitsToCaloParticleId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto
(get primitive types by value)
maxCPNumberOfHitsInMCL = c.second; | ||
//Below from all maximum energy CaloParticles, he saves the one with the largest amount | ||
//of related rechits. | ||
for (auto& c : occurrencesCPinMCL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use structured binding e.g. auto [id, nhits] : occurrencesCPinMCL
for (unsigned int j = 0; j < layers * 2; ++j) { | ||
totalCPEnergyFromLayerCP = totalCPEnergyFromLayerCP + cPOnLayer[maxCPId_byEnergy][j].energy; | ||
//Find the CaloParticle that has the maximum energy shared with the multicluster under study. | ||
for (auto& c : CPEnergyInMCL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use structured binding
Comparison is ready Comparison Summary:
|
One minor correction: the HLT-JME plots linked above by Felice include updates up to 4da60d8 (from the |
Thank you @missirol. There were several updates and bug fixes applied to this PR, and I think some final check and validation should be allowed based on the very final version before merging it. Also the plots in the PR description seems to correspond to a supposed 9b855f6 commit, which I am not able to retrieve neither here or in the backport PR. I expect that the authors and the HGCal team can provide some kind of green light based on it. The same for the performance, which should be better re-computed with the very final version (by the way, has this PR settled down by now?) |
Thanks @missirol |
Testing with just 20 events from the wf 23234.0 (TTbar with 2026 D49 geometry) the overall event size reductions are
|
@slava77 the new products created in output by this PR are the following:
|
Trying to summarize the discussion happened yestreday in this thread: please let me know whether you intend to provide updated validations and comparisons, and if so when they can be ready, so that the review can get finalized here. |
@perrotta no further validation would be produced in this PR. I think you can proceed with the finalization of the review. |
+upgrade |
min_clusters_per_ntuplet_(conf.getParameter<int>("min_clusters_per_ntuplet")), | ||
skip_layers_(conf.getParameter<int>("skip_layers")), | ||
max_missing_layers_in_trackster_(conf.getParameter<int>("max_missing_layers_in_trackster")), | ||
check_missing_layers_(max_missing_layers_in_trackster_ < 100), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have found more intuitutive using a negative number to identify the max number which corresponds to "do not check". But ok, the behaviour doesn't change anyhow
+1
|
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. @silviodonato, @dpiparo, @qliphy (and backports should be raised in the release meeting by the corresponding L2) |
As expected we see changes in the Phase-2 workflows
Do you know why we see many more difference in Another question: are these (small) differences in the tau ID expected? |
I'm beginning to suspect that this workflow is broken in some way |
I'm also suspicious that something funny is happening with |
+1 |
auto thisPt = tracksterTotalRawPt + trackstersMergedHandle->at(otherTracksterIdx).raw_pt() - t.raw_pt(); | ||
closestTrackster = std::abs(thisPt - track.pt()) < minPtDiff ? otherTracksterIdx : closestTrackster; | ||
} | ||
tracksterTotalRawPt += trackstersMergedHandle->at(closestTrackster).raw_pt() - t.raw_pt(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felicepantaleo this line (also pointed out by the static analyzer) escaped my review of the PR: this increment is completely useless here. Either the line can/should be removed, or it was originally intended to do something different and it has to be fixed then. Please check and provide the fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @perrotta that line can be erased safely. I will make a pr now
reco monitoring now covers these (sorry, it took a while for me to get to updating the script). |
PR description:
This PR updates the TICL reconstruction to make it more robust against pile-up.
In particular the following actions have been taken:
PR validation:
This is the electron reconstruction with PU200 before this PR:
This is after the PR:
Single Particle noPU
All samples with 6 energy steps = 10, 20, 50, 100, 200, 300 GeV, eta = 1.8 (HGCAL center)
More info
you can find the latest physics results with this pull request described in the talks by HGCAL and Jets/MET at the HLT Upgrade workshop:
https://indico.cern.ch/event/962025/#4-hgcal
https://indico.cern.ch/event/962025/#6-jetsmet
Timing Report
Timing with PR:
https://fpantale.web.cern.ch/fpantale/circles/web/piechart.html?local=false&dataset=TICLv3_PR31906&resource=time_thread&colours=default&groups=reco_PhaseII&threshold=0