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

Optimisation a la Chris of HLTrigger/btau/src/L3MumuTrackingRegion. #586

Merged
merged 1 commit into from Aug 22, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions HLTrigger/btau/src/L3MumuTrackingRegion.h
Expand Up @@ -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);
Copy link
Contributor

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?

theInputTrkTag = regionPSet.getParameter<edm::InputTag>("TrkSrc");

useVtxTks = regionPSet.getParameter<bool>("UseVtxTks");
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -113,6 +114,7 @@ class L3MumuTrackingRegion : public TrackingRegionProducer {
private:

edm::InputTag theVertexTag;
bool theVertex;
Copy link
Contributor

Choose a reason for hiding this comment

The 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;
Expand Down