-
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
Add energy regression and particle identification to RecoHGCal/TICL (reopened) #27917
Add energy regression and particle identification to RecoHGCal/TICL (reopened) #27917
Conversation
The code-checks are being triggered in jenkins. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-27917/11736
|
A new Pull Request was created by @riga (Marcel R.) for master. It involves the following packages: DataFormats/HGCalReco @perrotta, @cmsbuild, @kpedro88, @slava77 can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
please test workflow 20493.52 with cms-sw/cmsdist#5120, cms-data/RecoHGCal-TICL#1 |
The tests are being triggered in jenkins. |
std::array<float, 8> id_probabilities; | ||
|
||
// convenience method to return the ID probability for a certain particle type | ||
inline float id_probability(ParticleType type) { |
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.
add const
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.
✔︎
} | ||
|
||
void TrackstersProducer::globalEndJob(TrackstersCache* cache) { | ||
if (cache->eidGraphDef != nullptr) { |
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.
no need to protect a delete
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 TrackstersCache *trackstersCache = dynamic_cast<const TrackstersCache *>(cache); | ||
if (trackstersCache->eidGraphDef != nullptr) { | ||
eidSession_ = tensorflow::createSession(trackstersCache->eidGraphDef); | ||
} |
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.
else ???
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.
When the eidGraphDef
in the cache is not set (which happens when no graph path was set) the eidSession_
should not be set as well and the inference is not performed.
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 does this distinguish a bug upstream from a desired silent do nothing behavior?
The code should not be allowed to silently skip when it was expected to do something.
|
||
// mount the tensorflow graph onto the session when set | ||
const TrackstersCache *trackstersCache = dynamic_cast<const TrackstersCache *>(cache); | ||
if (trackstersCache->eidGraphDef != nullptr) { |
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.
actually one has to test if the dynamic_cast failed...
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.
✔︎
theGraph_ = std::make_unique<HGCGraph>(); | ||
min_cos_theta_ = conf.getParameter<double>("min_cos_theta"); | ||
min_cos_pointing_ = conf.getParameter<double>("min_cos_pointing"); | ||
missing_layers_ = conf.getParameter<int>("missing_layers"); | ||
min_clusters_per_ntuplet_ = conf.getParameter<int>("min_clusters_per_ntuplet"); | ||
max_delta_time_ = conf.getParameter<double>("max_delta_time"); | ||
eidInputName_ = conf.getParameter<std::string>("eid_input_name"); |
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.
all configurable data members should be declared const
and initialized as
theGraph_(std::make_unique<HGCGraph>()),
etc
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.
Please make const all all configurable data members
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 (int k = seenClusters[j]; k < eidNClusters_; k++) { | ||
float *features = &input.tensor<float, 4>()(i, j, k, 0); | ||
for (int l = 0; l < eidNFeatures_; l++, features++) { | ||
*features = 0.f; |
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.
why not
*(features++)
as everywhere else?
just for consistency...
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.
✔︎
Comparison job queued. |
@perrotta I made all members Fyi: Running igprof-navigator on an lxplus machine (in a CMSSW env) returned an empty page in my browser and the process complains about a "SQLite header and source version mismatch". In the end, I used docker run --rm -ti -p 8080:8080 -v `pwd`/thefile.sql3:/thefile.sql3 igprof/igprof igprof-navigator /thefile.sql3 Maybe this can go on the Twiki page you pointed me to in case other people have the same issue. |
please test workflow 20493.52 with cms-sw/cmsdist#5120, cms-data/RecoHGCal-TICL#1 |
The tests are being triggered in jenkins. |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
+1
|
@kpedro88 could you please check this PR? |
+upgrade |
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) |
+1 |
PR description
This PR adds energy regression and particle identification for trackster objects to the TrackstersProducer of the RecoHGCal/TICL package. Both the regressed energy and ID probabilities for different types of particles are the outputs of a single neural network, stored as a TensorFlow model. The first version of this model is proposed in
cms-data/RecoHGCal-TICL#1.
This PR is a clean version of #27634. The changes since the last review comments can be found here.
Performance
Tested with workflow 20634.0 (
TTbar_14TeV_TuneCUETP8M1_2026D41PU
with 200 PU).The CPU runtime for inference scales linearly with the batch size, i.e., the number of tracksters, as expected for the
no_threads
TensorFlow session. The average runtime per trackster is ~0.6 ms (see slope below). The time includes trackster selection, preprocessing and filling of input data, the actual inference, and handling of results (==PatternRecognitionbyCA::energyRegressionAndID
).The memory consumption, obtained using the
SimpleMemoryCheck
with and without running the regression and ID, is 178 MB for a maximum batch size of ~750 tracksters.To get an estimate of the memory used per event, I queried
VmRSS
of/proc/self/status
(link) at the beginning and at the end ofPatternRecognitionbyCA::energyRegressionAndID
, and also before and after loading the graph and setting up the session.energyRegressionAndID
: