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
Optimisation a la Chris of HLTrigger/btau/src/L3MumuTrackingRegion. #586
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,15 +18,16 @@ class L3MumuTrackingRegion : public TrackingRegionProducer { | |
public: | ||
|
||
L3MumuTrackingRegion(const edm::ParameterSet& cfg, edm::ConsumesCollector && iC) : L3MumuTrackingRegion(cfg) { | ||
theVertexToken = iC.consumes<reco::VertexCollection>(theVertexTag); | ||
theInputTrkToken= iC.consumes<reco::TrackCollection>(theInputTrkTag); | ||
if (theVertex) theVertexToken = iC.consumes<reco::VertexCollection>(theVertexTag); | ||
if (!(theVertex && useVtxTks)) theInputTrkToken= iC.consumes<reco::TrackCollection>(theInputTrkTag); | ||
} | ||
|
||
L3MumuTrackingRegion(const edm::ParameterSet& cfg) { | ||
|
||
edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet"); | ||
|
||
theVertexTag = regionPSet.getParameter<edm::InputTag>("vertexSrc"); | ||
theVertex = (theVertexTag.label().length()>1); | ||
theInputTrkTag = regionPSet.getParameter<edm::InputTag>("TrkSrc"); | ||
|
||
useVtxTks = regionPSet.getParameter<bool>("UseVtxTks"); | ||
|
@@ -65,7 +66,7 @@ class L3MumuTrackingRegion : public TrackingRegionProducer { | |
// get highest Pt pixel vertex (if existing) | ||
double deltaZVertex = theOriginHalfLength; | ||
double originz = theOriginZPos; | ||
if (theVertexTag.encode().length()>1) { | ||
if (theVertex) { | ||
edm::Handle<reco::VertexCollection> vertices; | ||
if (theVertexToken.isUnitialized() || (!ev.getByToken(theVertexToken,vertices))) ev.getByLabel(theVertexTag,vertices); | ||
const reco::VertexCollection vertCollection = *(vertices.product()); | ||
|
@@ -113,6 +114,7 @@ class L3MumuTrackingRegion : public TrackingRegionProducer { | |
private: | ||
|
||
edm::InputTag theVertexTag; | ||
bool theVertex; | ||
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. If you move all the bool member data to the end if the class you would avoid extra padding the compiler has to generate in this case, i.e you would make the class smaller. In general, it is best to order member data by size starting with the largest (items larger than the size of a pointer are all treated as the size of a pointer for this comparison). That way, the only possible padding would happen at the end if the class and not in its middle. |
||
edm::EDGetTokenT<reco::VertexCollection> theVertexToken; | ||
edm::InputTag theInputTrkTag; | ||
edm::EDGetTokenT<reco::TrackCollection> theInputTrkToken; | ||
|
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.
I know >1 was in the original code but shouldn't this be >0 so one could test with modules who only have a single letter as their module label?