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

make statics const #1428

Merged
merged 4 commits into from Nov 14, 2013
Merged

make statics const #1428

merged 4 commits into from Nov 14, 2013

Conversation

gartung
Copy link
Member

@gartung gartung commented Nov 12, 2013

No description provided.

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @gartung (Patrick Gartung) for CMSSW_7_0_X.

make statics const

It involves the following packages:

RecoMuon/TrackerSeedGenerator

@nclopezo, @cmsbuild, @thspeer, @slava77 can you please review it and eventually sign? Thanks.
You can sign-off by replying to this message having '+1' in the first line of your reply.
You can reject by replying to this message having '-1' in the first line of your reply.
@ktf you are the release manager for this.

@Dr15Jones
Copy link
Contributor

I would think making these const member data would be better.

@cmsbuild
Copy link
Contributor

Pull request #1428 was updated. @nclopezo, @cmsbuild, @thspeer, @slava77 can you please check and sign again.

@cmsbuild
Copy link
Contributor

const double phiErrorScale{theConfig.getParameter<double>("phiErrorScale")};
const double cotThetaErrorScale{theConfig.getParameter<double>("cotThetaErrorScale")};
const double tipErrorScale{theConfig.getParameter<double>("tipErrorScale")};
const double zipErrorScale{theConfig.getParameter<double>("zipErrorScale")};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question here is when this gets executed, and whether theConfig is already assigned. One simple solution would be to put it into the member initialization list in the ctor. Can you please do that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gartung Patrick, this would mean changing the code in .h to

const double invPtErrorScale;
const double phiErrorScale;
...

and then in the .cc

L1MuonPixelTrackFitter::L1MuonPixelTrackFitter(const edm::ParameterSet& cfg)
  : theConfig(cfg),
invPtErrorScale{theConfig.getParameter<double>("invPtErrorScale")},
phiErrorScale{theConfig.getParameter<double>("phiErrorScale")},
cotThetaErrorScale{theConfig.getParameter<double>("cotThetaErrorScale")},
tipErrorScale{theConfig.getParameter<double>("tipErrorScale")},
zipErrorScale{theConfig.getParameter<double>("zipErrorScale")}
{ }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that be then the default ctor in the header has to be changed

  • L1MuonPixelTrackFitter() {}
  • L1MuonPixelTrackFitter();
    or the compiler errors with uninitialized const members.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes.
This has a problem anyway, and also had it before, since theConfig was never assigned! It would have broken also before. We should get rid of that, or, if really needed, move to be private, and so unusable by anyone.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The members are private. They are used in ::run() so need to be set to something.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the default constructor to be private. But if you can remove it, and it causes no problem, better like that. Thanks for the update.

@cmsbuild
Copy link
Contributor

Pull request #1428 was updated. @nclopezo, @cmsbuild, @thspeer, @slava77 can you please check and sign again.

@Dr15Jones
Copy link
Contributor

Your previous change would have caused the default constructor to throw an exception. In fact, it looks like the old code would fail the same way. Try removing the default constructor all together.

@cmsbuild
Copy link
Contributor

Pull request #1428 was updated. @nclopezo, @cmsbuild, @thspeer, @slava77 can you please check and sign again.

@thspeer
Copy link
Contributor

thspeer commented Nov 13, 2013

+1
Tested 5a8e988 in CMSSW_7_0_X_2013-11-13-0200-1428
No change in reco as expected

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next IBs unless changes or unless it breaks tests. @ktf can you please take care of it?

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next IBs unless changes or unless it breaks tests. @ktf can you please take care of it?

ktf added a commit that referenced this pull request Nov 14, 2013
…erator

Multithreading fixes -- Make statics const in RecoMuon/TrackerSeedGenerator
@ktf ktf merged commit 857bf21 into cms-sw:CMSSW_7_0_X Nov 14, 2013
@gartung gartung deleted the statics-RecoMuon-TrackerSeedGenerator branch November 14, 2013 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants