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
Use HGCalRecHitMapProducer #30061
Merged
cmsbuild
merged 20 commits into
cms-sw:master
from
lecriste:HGCalRecHitMapProducer-use-merge
Jun 16, 2020
Merged
Use HGCalRecHitMapProducer #30061
Changes from 15 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
49877f0
hitMap in HGCalValidator
lecriste f8aa8b2
hitMap in EgammaTools
lecriste a4e4e2f
hitMap in HGCalShowerSeparation
lecriste 9d1f6c0
hitMap in CaloParticleValidation
lecriste d1bb182
hitMap in FWHeatmapProxyBuilderTemplate
lecriste bb3c42f
Merge branch 'HGCalAssociators-merge' into HGCalRecHitMapProducer-use…
lecriste 2d7e96c
From map to unordered_map
lecriste dc1b5fe
Align to lowercase module instance
lecriste f5f59f9
code-format
lecriste cfcd7da
Move const_cast
lecriste 74ecbe5
Remove unused fillHitMap
lecriste 5eac12b
code-format 2
lecriste f499937
Remove memory leak
lecriste 2750b86
Avoid unnecessary copy
lecriste bacb29a
code-format 3
lecriste 1050d68
Fix dependency in different package
lecriste b634887
Remove now empty destructor
lecriste 40e2735
Move RecHitMap from Validation to Reconstruction
lecriste 97c6ef6
RecHitMap for EGamma
lecriste 7537992
Simplify RecHitMap import sequence
lecriste File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,18 +19,13 @@ EGammaPCAHelper::EGammaPCAHelper() | |
// See RecoLocalCalo.HGCalRecProducers.HGCalRecHit_cfi | ||
invThicknessCorrection_({1. / 1.132, 1. / 1.092, 1. / 1.084}), | ||
pca_(new TPrincipal(3, "D")) { | ||
hitMapOrigin_ = 0; | ||
hitMap_ = new std::map<DetId, const HGCRecHit*>(); | ||
hitMap_ = nullptr; | ||
debug_ = false; | ||
} | ||
|
||
EGammaPCAHelper::~EGammaPCAHelper() { | ||
if (hitMapOrigin_ == 2) | ||
delete hitMap_; | ||
} | ||
EGammaPCAHelper::~EGammaPCAHelper() {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can now use a default destructor |
||
|
||
void EGammaPCAHelper::setHitMap(std::map<DetId, const HGCRecHit*>* hitMap) { | ||
hitMapOrigin_ = 1; | ||
void EGammaPCAHelper::setHitMap(const std::unordered_map<DetId, const HGCRecHit*>* hitMap) { | ||
hitMap_ = hitMap; | ||
pcaIteration_ = 0; | ||
} | ||
|
@@ -40,26 +35,6 @@ void EGammaPCAHelper::setRecHitTools(const hgcal::RecHitTools* recHitTools) { | |
maxlayer_ = recHitTools_->lastLayerBH(); | ||
} | ||
|
||
void EGammaPCAHelper::fillHitMap(const HGCRecHitCollection& rechitsEE, | ||
const HGCRecHitCollection& rechitsFH, | ||
const HGCRecHitCollection& rechitsBH) { | ||
hitMap_->clear(); | ||
for (const auto& hit : rechitsEE) { | ||
hitMap_->emplace_hint(hitMap_->end(), hit.detid(), &hit); | ||
} | ||
|
||
for (const auto& hit : rechitsFH) { | ||
hitMap_->emplace_hint(hitMap_->end(), hit.detid(), &hit); | ||
} | ||
|
||
for (const auto& hit : rechitsBH) { | ||
hitMap_->emplace_hint(hitMap_->end(), hit.detid(), &hit); | ||
} | ||
|
||
pcaIteration_ = 0; | ||
hitMapOrigin_ = 2; | ||
} | ||
|
||
void EGammaPCAHelper::storeRecHits(const reco::HGCalMultiCluster& cluster) { | ||
theCluster_ = &cluster; | ||
std::vector<std::pair<DetId, float>> result; | ||
|
@@ -97,7 +72,7 @@ void EGammaPCAHelper::storeRecHits(const std::vector<std::pair<DetId, float>>& h | |
unsigned int layer = recHitTools_->getLayerWithOffset(hf[j].first); | ||
|
||
const DetId rh_detid = hf[j].first; | ||
std::map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap_->find(rh_detid); | ||
std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap_->find(rh_detid); | ||
if (itcheck == hitMap_->end()) { | ||
edm::LogWarning("EgammaPCAHelper") << " Big problem, unable to find a hit " << rh_detid.rawId() << " " | ||
<< rh_detid.det() << " " << HGCalDetId(rh_detid) << std::endl; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 is one of the cases in which the automatic line breaking provided by the code format checks give weird results. I have no suggestions, nor I do require it gets modified: just noticing it.