-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Conversation
The code-checks are being triggered in jenkins. |
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-27955/11817
Code check has found code style and quality issues which could be resolved by applying following patch(s)
|
The code-checks are being triggered in jenkins. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-27955/11819
|
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. cms-bot commands are listed here |
please test |
The tests are being triggered in jenkins. |
Comparison job queued. |
const float thetaCut, | ||
const float phiCut, | ||
CACut::CAValuesByInnerLayerIds thetaCutByInnerLayer, | ||
CACut::CAValuesByInnerLayerIds phiCutByInnerLayer, |
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.
These seem to result in copying of 2x2 std::vector
s, would passing by const reference work?
const float thetaCut, | ||
const float phiCut, | ||
CACut::CAValuesByInnerLayerIds thetaCutByInnerLayer, | ||
CACut::CAValuesByInnerLayerIds phiCutByInnerLayer, |
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.
Pass by const reference?
const float thetaCut, | ||
const float phiCut, | ||
CACut::CAValuesByInnerLayerIds thetaCutByInnerLayer, | ||
CACut::CAValuesByInnerLayerIds phiCutByInnerLayer, |
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.
Pass by const reference?
|
||
// Get layer ID | ||
thisCACut.layerIds.emplace_back(caLayers.getLayerId(layerName)); | ||
if (thisCACut.layerIds.at(thisLayer) == -1) { |
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.
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) |
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.
Passing int
s 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, |
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.
CACut
has internal vectors, pass by const reference?
thisCACut.cutValue = thisTriplet.cutValue; | ||
|
||
// Add to vector | ||
valuesByLayerIds_.emplace_back(thisCACut); |
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.
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"; |
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.
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; |
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.
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); | ||
} | ||
} |
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 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)
Comparison is ready Comparison Summary:
|
@@ -42,6 +48,14 @@ struct CALayerPair { | |||
}; | |||
|
|||
struct CAGraph { | |||
int getLayerId(const std::string &layerName) { | |||
for (auto thisLayer = theLayers.begin(); thisLayer != theLayers.end(); thisLayer++) { |
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 can be a range based for
class CAValuesByInnerLayerIds { | ||
public: | ||
float at(int layerId) { | ||
for (size_t thisLayer = 0; thisLayer < layerIds.size(); thisLayer++) { |
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 can be a range based for
There are quite a lot of differences in Phase2 outputs, which was not what planned I guess: please have a look |
@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? |
@kjpena: is there any news? any plan? |
-1 |
@kjpena please clarify the status of this PR, is there work planned in next future? |
@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? |
hold |
Pull request has been put on hold by @fabiocos |
I'm closing the PRs with no activity in the last months. @kjpena please open it again as soon as you have news. |
please close |
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