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

[RFC] Cellular Automaton: Add hit-compatibility parameters tunable by layer triplets #27955

Closed
wants to merge 6 commits into from

Conversation

kjpena
Copy link
Contributor

@kjpena kjpena commented Sep 9, 2019

PR description:

This PR adds classes needed for tuning hit-compatibility cuts of Cellular Automaton for each seeding layer triplet. More details in:
https://indico.cern.ch/event/845939/contributions/3552658/attachments/1904226/3144492/CACuts_KPena_2019-09-09.pdf

PR validation:

Workflow 10824.1 was used to check the performance, starting from step3 with RelVal sample
/RelValTTbar_13/CMSSW_11_0_0_pre6-PU25ns_110X_upgrade2018_realistic_v3-v1/GEN-SIM-DIGI-RAW.

Tracking validation plots are available here:
https://kjpena.web.cern.ch/kjpena/trackingTasks/CMSSW_11_0_0_pre6/

Request for comments from @felicepantaleo, @mtosi, @VinInn, @JanFSchulte

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 9, 2019

The code-checks are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 9, 2019

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-27955/11817

  • This PR adds an extra 36KB to repository

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

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 9, 2019

The code-checks are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 9, 2019

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-27955/11819

  • This PR adds an extra 36KB to repository

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 9, 2019

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

It involves the following packages:

RecoPixelVertexing/PixelTriplets

@perrotta, @cmsbuild, @slava77 can you please review it and eventually sign? Thanks.
@makortel, @felicepantaleo, @GiacomoSguazzoni, @rovere, @VinInn, @ebrondol, @dgulhan 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

@felicepantaleo
Copy link
Contributor

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 9, 2019

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-run-pr-tests/2436/console Started: 2019/09/09 16:48

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 9, 2019

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 9, 2019

Comparison job queued.

const float thetaCut,
const float phiCut,
CACut::CAValuesByInnerLayerIds thetaCutByInnerLayer,
CACut::CAValuesByInnerLayerIds phiCutByInnerLayer,
Copy link
Contributor

Choose a reason for hiding this comment

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

These seem to result in copying of 2x2 std::vectors, would passing by const reference work?

const float thetaCut,
const float phiCut,
CACut::CAValuesByInnerLayerIds thetaCutByInnerLayer,
CACut::CAValuesByInnerLayerIds phiCutByInnerLayer,
Copy link
Contributor

Choose a reason for hiding this comment

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

Pass by const reference?

const float thetaCut,
const float phiCut,
CACut::CAValuesByInnerLayerIds thetaCutByInnerLayer,
CACut::CAValuesByInnerLayerIds phiCutByInnerLayer,
Copy link
Contributor

Choose a reason for hiding this comment

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

Pass by const reference?


// Get layer ID
thisCACut.layerIds.emplace_back(caLayers.getLayerId(layerName));
if (thisCACut.layerIds.at(thisLayer) == -1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

thisCACut.layerIds.back() would be more idiomatic

@@ -6,14 +6,19 @@
#include <vector>

struct CALayer {
CALayer(const std::string &layerName, std::size_t numberOfHits) : theName(layerName) {
CALayer(const std::string &layerName, const int &seqNum, std::size_t numberOfHits)
Copy link
Contributor

Choose a reason for hiding this comment

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

Passing ints by const reference is unnecessary, use either int or const int.

const float thetaCut,
const float phiCut,
CACut thetaCut, //const float thetaCut,
CACut phiCut, //const float phiCut,
Copy link
Contributor

Choose a reason for hiding this comment

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

CACut has internal vectors, pass by const reference?

thisCACut.cutValue = thisTriplet.cutValue;

// Add to vector
valuesByLayerIds_.emplace_back(thisCACut);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
valuesByLayerIds_.emplace_back(thisCACut);
valuesByLayerIds_.emplace_back(std::move(thisCACut));

would avoid copying the std::vector inside thisCACut. Alternatively you could add the element to the vector at the very beginning of the for-loop body by

valuesByLayerIds_.emplace_back();
auto& thisCACut = valuesByLayerIds_.back();

Apparently the capacity of valuesByLayerIds_ is known before the loop, so valuesByLayerIds_.reserve(valuesByTripletNames_); would reduce memory allocations. (maybe even resize() and accessing the elements by index would work?)

if (thisCACut.layerIds.at(thisLayer) == -1) {
edm::LogWarning("Configuration")
<< "Layer name '" << layerName
<< "' not found in the CAGraph. Please enter a valid layer name in the CACuts parameter set";
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens later if thisCACut.layerIds holds -1?

I'm just thinking whether this error should be an exception.


// Layer names and id's
std::string layerName;
std::size_t layerPos = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

There seems to be no use of layerName or layerPos outside of the following loop, so the declarations would be better moved inside the loop as well.

cutsByInnerLayer.layerIds.emplace_back(thisCut.layerIds[0]);
cutsByInnerLayer.cutValues.emplace_back(thisCut.cutValue);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

How big can the cutsByInnerLayer grow? If it is relatively small, e.g. edm::VecArray would help to reduce memory allocations (since the getCutsByInnerLayer() seems to be called many times within the CA).

Actually, since for given layerIds1, layerIds2 the cutsByInnerLayer is always the same, and the values are known at the time valuesByLayerIds_ are constructed, how about just creating the structure mapping (layerIds1, layerIds2) to cutsByInnerLayer once and returning it here by const reference? (with either a predefined empty value or an error for "not found" cases)

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 9, 2019

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

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 7058 differences found in the comparisons
  • DQMHistoTests: Total files compared: 34
  • DQMHistoTests: Total histograms compared: 2957224
  • DQMHistoTests: Total failures: 9818
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 2947065
  • DQMHistoTests: Total skipped: 341
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 33 files compared)
  • Checked 145 log files, 15 edm output root files, 34 DQM output files

@@ -42,6 +48,14 @@ struct CALayerPair {
};

struct CAGraph {
int getLayerId(const std::string &layerName) {
for (auto thisLayer = theLayers.begin(); thisLayer != theLayers.end(); thisLayer++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be a range based for

class CAValuesByInnerLayerIds {
public:
float at(int layerId) {
for (size_t thisLayer = 0; thisLayer < layerIds.size(); thisLayer++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be a range based for

@perrotta
Copy link
Contributor

perrotta commented Sep 16, 2019

There are quite a lot of differences in Phase2 outputs, which was not what planned I guess: please have a look

@kjpena kjpena changed the title [RFC] Cellular Automaton: Add hit-compatibility parameters tunable by layer triplets Cellular Automaton: Add hit-compatibility parameters tunable by layer triplets Sep 20, 2019
@perrotta
Copy link
Contributor

@kjpena , which is the status of the checks about the Phase2 related issues, and the plans for updating this PR according to the first sets of comments received?

@perrotta
Copy link
Contributor

perrotta commented Oct 3, 2019

@kjpena: is there any news? any plan?

@perrotta
Copy link
Contributor

-1
(Unattended since more than one month, we will reconsider this once updated and comments answered)

@fabiocos
Copy link
Contributor

@kjpena please clarify the status of this PR, is there work planned in next future?

@kjpena
Copy link
Contributor Author

kjpena commented Nov 4, 2019

@fabiocos @perrotta I need one more week to wrap up another project. Then I'm back to implementing the comments received. My apologies for the long delay.

@smuzaffar smuzaffar modified the milestones: CMSSW_11_0_X, CMSSW_11_1_X Dec 2, 2019
@cmsbuild cmsbuild modified the milestones: CMSSW_11_1_X, CMSSW_11_0_X Dec 10, 2019
@fabiocos
Copy link
Contributor

@kjpena is this PR still active, or may be it is better to close it a restart with a fresh new approach as soon as there is time to work on it?

@fabiocos
Copy link
Contributor

hold

@cmsbuild
Copy link
Contributor

Pull request has been put on hold by @fabiocos
They need to issue an unhold command to remove the hold state or L1 can unhold it for all

@cmsbuild cmsbuild added the hold label Dec 16, 2019
@silviodonato
Copy link
Contributor

I'm closing the PRs with no activity in the last months. @kjpena please open it again as soon as you have news.

@silviodonato
Copy link
Contributor

please close

@cmsbuild cmsbuild closed this Jan 8, 2020
@kjpena kjpena changed the title Cellular Automaton: Add hit-compatibility parameters tunable by layer triplets [RFC] Cellular Automaton: Add hit-compatibility parameters tunable by layer triplets Apr 20, 2020
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.

8 participants