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
Make ClusterMultiplicityFilter multithread safe #12024
Merged
cmsbuild
merged 4 commits into
cms-sw:CMSSW_7_6_X
from
nickmccoll:Make_ClusterMultiplicityFilter_MultiThreadSafe
Oct 22, 2015
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
4 changes: 2 additions & 2 deletions
4
RecoLocalTracker/SubCollectionProducers/python/ClusterMultiplicityFilter_cfi.py
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
tifClusterFilter = cms.EDFilter("ClusterMultiplicityFilter", | ||
MaxNumberOfClusters = cms.untracked.uint32(300), | ||
ClusterCollectionLabel = cms.untracked.string('siStripClusters') | ||
MaxNumberOfClusters = cms.uint32(300), | ||
ClusterCollection = cms.InputTag('siStripClusters') | ||
) | ||
|
||
|
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 |
---|---|---|
|
@@ -15,19 +15,15 @@ | |
#include <memory> | ||
|
||
#include "RecoLocalTracker/SubCollectionProducers/interface/ClusterMultiplicityFilter.h" | ||
|
||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
|
||
#include "DataFormats/SiStripCluster/interface/SiStripCluster.h" | ||
#include "DataFormats/Common/interface/DetSetVector.h" | ||
|
||
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" | ||
|
||
|
||
ClusterMultiplicityFilter::ClusterMultiplicityFilter(const edm::ParameterSet& iConfig) | ||
ClusterMultiplicityFilter::ClusterMultiplicityFilter(const edm::ParameterSet& iConfig) : | ||
maxNumberOfClusters_(iConfig.getParameter<unsigned int>("MaxNumberOfClusters")), | ||
clusterCollectionTag_(iConfig.getParameter<edm::InputTag>("ClusterCollection")) | ||
{ | ||
maxNumberOfClusters_ = iConfig.getUntrackedParameter<unsigned int>("MaxNumberOfClusters"); | ||
clusterCollectionLabel_ = iConfig.getUntrackedParameter<std::string>("ClusterCollectionLabel"); | ||
clusters_ = consumes<edmNew::DetSetVector<SiStripCluster> >(clusterCollectionTag_); | ||
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 could make this const as well if you move its initialization to before the |
||
} | ||
|
||
|
||
|
@@ -40,22 +36,22 @@ bool ClusterMultiplicityFilter::filter(edm::Event& iEvent, const edm::EventSetup | |
|
||
bool result = true; | ||
|
||
const edm::DetSetVector<SiStripCluster> *clusters = 0; | ||
edm::Handle<edm::DetSetVector<SiStripCluster> > clusterHandle; | ||
iEvent.getByLabel(clusterCollectionLabel_,clusterHandle); | ||
const edmNew::DetSetVector<SiStripCluster> *clusters = 0; | ||
edm::Handle<edmNew::DetSetVector<SiStripCluster> > clusterHandle; | ||
iEvent.getByToken(clusters_,clusterHandle); | ||
if( !clusterHandle.isValid() ) { | ||
throw cms::Exception("CorruptData") | ||
<< "ClusterMultiplicityFilter requires collection <edm::DetSetVector<SiStripCluster> with label " << clusterCollectionLabel_ << std::endl; | ||
<< "ClusterMultiplicityFilter requires collection <edm::DetSetVector<SiStripCluster> with label " << clusterCollectionTag_.label() << std::endl; | ||
} | ||
|
||
clusters = clusterHandle.product(); | ||
const edm::DetSetVector<SiStripCluster>& input = *clusters; | ||
const edmNew::DetSetVector<SiStripCluster>& input = *clusters; | ||
|
||
unsigned int totalClusters = 0; | ||
|
||
//loop over detectors | ||
for (edm::DetSetVector<SiStripCluster>::const_iterator DSViter=input.begin(); DSViter!=input.end();DSViter++ ) { | ||
totalClusters+=DSViter->data.size(); | ||
for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter=input.begin(); DSViter!=input.end();DSViter++ ) { | ||
totalClusters+=DSViter->size(); | ||
} | ||
|
||
|
||
|
@@ -66,13 +62,3 @@ bool ClusterMultiplicityFilter::filter(edm::Event& iEvent, const edm::EventSetup | |
|
||
return result; | ||
} | ||
|
||
|
||
void ClusterMultiplicityFilter::beginJob() { | ||
} | ||
|
||
|
||
// ------------ method called once each job just after ending the event loop ------------ | ||
void ClusterMultiplicityFilter::endJob() { | ||
} | ||
|
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 could easily be converted to a
edm::global::EDFilter<>
which would safe memory and be faster for the framework.