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

convenience utilities for configuring fftjet jet corrections #3810

Merged

Conversation

igv4321
Copy link
Contributor

@igv4321 igv4321 commented May 12, 2014

Added a convenience class and a number of python configs

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @igv4321 for CMSSW_7_1_X.

convenience utilities for configuring fftjet jet corrections

It involves the following packages:

JetMETCorrections/FFTJetModules
JetMETCorrections/FFTJetObjects

@nclopezo, @vadler, @cmsbuild, @Degano, @monttj can you please review it and eventually sign? Thanks.
@TaiSakuma, @nhanvtran this is something you requested to watch as well.
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.
@nclopezo, @ktf you are the release manager for this.
You can merge this pull request by typing 'merge' in the first line of your comment.

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

double* buf, const unsigned dim) const
{
if (dim != 1)
throw cms::Exception("FFTJetBadConfig")
Copy link

Choose a reason for hiding this comment

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

Please do not throw at run time. An edm::LogError is preferred.
Where is dim determined? Is it possibly known at c'tor time already?
Beside that, it is not used in the function. So, why should the function break due to it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Volker,

"dim" is the dimensionality of a correction function. It is not known
until it is fetched from the database for the first event processed.
The purpose of the "mapFFTJet" method is to map jet variables
into the input variables of that correction function. "mapFFTJet" knows
how to map one variable only. There is no reasonable way in which this
particular mapper can do its job unless dim == 1, that is why
an exception is thrown. Thus dim != 1 is clearly a misconfiguration
problem -- most likely, a wrong correction function configured.

Regards,
Igor

On 05/12/2014 05:18 AM, Volker Adler wrote:

In JetMETCorrections/FFTJetObjects/interface/L2RecoScaleCalculator.h:

+class L2RecoScaleCalculator : public AbsFFTSpecificScaleCalculator
+{
+public:

  • inline explicit L2RecoScaleCalculator(const edm::ParameterSet& ps)
  •    : m_radiusFactor(ps.getParameter<double>("radiusFactor")) {}
    
  • inline virtual ~L2RecoScaleCalculator() {}
  • inline virtual void mapFFTJet(const reco::Jet& /* jet */,
  •                              const reco::FFTJet<float>& fftJet,
    
  •                              const math::XYZTLorentzVector& /\* current */,
    
  •                              double\* buf, const unsigned dim) const
    
  • {
  •    if (dim != 1)
    
  •        throw cms::Exception("FFTJetBadConfig")
    

Please do not throw at run time. An |edm::LogError| is preferred.
Where is |dim| determined? Is it possibly known at c'tor time already?
Beside that, it is not used in the function. So, why should the function break due to it?


Reply to this email directly or view it on GitHub https://github.com/cms-sw/cmssw/pull/3810/files#r12521502.

Copy link

Choose a reason for hiding this comment

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

A possible solution could be to issue an edm::LogError and turn this into a bool function returning false in case of failure with a meaningful assignment to buf[0] -- or let the double be returned directly to be assigned in the calling function, which would also allow for a more flexible usage in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Volker,

In this particular situation, there is nothing calling function
could do to improve the situation. The proper solution is
to fix the configuration file.

Issuing edm::LogError can potentially result in a large amount
of CPU time wasted -- in case it is ignored and the person
running the code only finds out about the problem later.

Regards,
Igor

On 05/12/2014 08:07 AM, Volker Adler wrote:

In JetMETCorrections/FFTJetObjects/interface/L2RecoScaleCalculator.h:

+class L2RecoScaleCalculator : public AbsFFTSpecificScaleCalculator
+{
+public:

  • inline explicit L2RecoScaleCalculator(const edm::ParameterSet& ps)
  •    : m_radiusFactor(ps.getParameter<double>("radiusFactor")) {}
    
  • inline virtual ~L2RecoScaleCalculator() {}
  • inline virtual void mapFFTJet(const reco::Jet& /* jet */,
  •                              const reco::FFTJet<float>& fftJet,
    
  •                              const math::XYZTLorentzVector& /\* current */,
    
  •                              double\* buf, const unsigned dim) const
    
  • {
  •    if (dim != 1)
    
  •        throw cms::Exception("FFTJetBadConfig")
    

A possible solution could be to issue an |edm::LogError| and turn this into a |bool| function returning |false| in case of failure with a meaningful assignment to |buf[0]| -- or let the |double| be
returned directly to be assigned in the calling function, which would also allow for a more flexible usage in the future.


Reply to this email directly or view it on GitHub https://github.com/cms-sw/cmssw/pull/3810/files#r12526899.

Copy link

Choose a reason for hiding this comment

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

Do I understand correctly that dim is supposed to be constant in a given job, depending on its configuration, and that the exception will be thrown at the first event in any case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is correct, "dim" s supposed to be constant in a given job.
In case of misconfiguration the exception will be thrown at the first event.

Regards,
Igor

On 05/12/2014 08:34 AM, Volker Adler wrote:

In JetMETCorrections/FFTJetObjects/interface/L2RecoScaleCalculator.h:

+class L2RecoScaleCalculator : public AbsFFTSpecificScaleCalculator
+{
+public:

  • inline explicit L2RecoScaleCalculator(const edm::ParameterSet& ps)
  •    : m_radiusFactor(ps.getParameter<double>("radiusFactor")) {}
    
  • inline virtual ~L2RecoScaleCalculator() {}
  • inline virtual void mapFFTJet(const reco::Jet& /* jet */,
  •                              const reco::FFTJet<float>& fftJet,
    
  •                              const math::XYZTLorentzVector& /\* current */,
    
  •                              double\* buf, const unsigned dim) const
    
  • {
  •    if (dim != 1)
    
  •        throw cms::Exception("FFTJetBadConfig")
    

Do I understand correctly that |dim| is supposed to be constant in a given job, depending on its configuration, and that the exception will be thrown at the first event in any case?


Reply to this email directly or view it on GitHub https://github.com/cms-sw/cmssw/pull/3810/files#r12528443.

Copy link

Choose a reason for hiding this comment

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

Ok, then we can consider this as thrown at initialisation time, which is "almost" at construction time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, sure.

Igor

On 05/12/2014 09:37 AM, Volker Adler wrote:

In JetMETCorrections/FFTJetObjects/interface/L2RecoScaleCalculator.h:

+class L2RecoScaleCalculator : public AbsFFTSpecificScaleCalculator
+{
+public:

  • inline explicit L2RecoScaleCalculator(const edm::ParameterSet& ps)
  •    : m_radiusFactor(ps.getParameter<double>("radiusFactor")) {}
    
  • inline virtual ~L2RecoScaleCalculator() {}
  • inline virtual void mapFFTJet(const reco::Jet& /* jet */,
  •                              const reco::FFTJet<float>& fftJet,
    
  •                              const math::XYZTLorentzVector& /\* current */,
    
  •                              double\* buf, const unsigned dim) const
    
  • {
  •    if (dim != 1)
    
  •        throw cms::Exception("FFTJetBadConfig")
    

Ok, then we can consider this as thrown at initialisation time, which is "almost" at construction time.


Reply to this email directly or view it on GitHub https://github.com/cms-sw/cmssw/pull/3810/files#r12532045.

@vadler
Copy link

vadler commented May 12, 2014

+1

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_7_1_X IBs unless changes (tests are also fine). @nclopezo, @ktf can you please take care of it?

ktf added a commit that referenced this pull request May 12, 2014
…n-update

AT -- Convenience utilities for configuring fftjet jet corrections.
@ktf ktf merged commit 28b3c71 into cms-sw:CMSSW_7_1_X May 12, 2014
@igv4321 igv4321 deleted the fftjet-corrections-configuration-update branch May 16, 2014 16:24
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

4 participants