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

Extended Multifit functionality #17205

Merged
merged 9 commits into from
Jan 23, 2017
Merged

Conversation

bendavid
Copy link
Contributor

Extends ecal multifit functionality with possibility for

  1. Dynamic pedestals
  2. Inflated pedestal uncertainty at level of python configuration
  3. Better handling of noise covariance matrix for gain switch rechits
  4. Ability to remove single sample from the fit to mitigate slew rate limitation

More information and background in
https://indico.cern.ch/event/600314/contributions/2441465/attachments/1398120/2132187/multifit-Jan18-2017.pdf

All of the new options are disabled by default, and therefore this pull request is expected to give 1:1 identical results for all standard workflows (including HLT). There may be a small cpu and/or memory increase as the size on the stack of some of the matrix types have been increased to accommodate the new functionality.

This should not necessarily be merged yet, pending further tests and understanding of plans for 2017 data/mc, but want to at least run through the automated tests and verify 1:1 identity with present settings.

@emanueledimarco @amassiro @lgray @VinInn

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @bendavid (Josh Bendavid) for CMSSW_9_0_X.

It involves the following packages:

RecoLocalCalo/EcalRecAlgos
RecoLocalCalo/EcalRecProducers

@cmsbuild, @cvuosalo, @slava77, @davidlange6 can you please review it and eventually sign? Thanks.
@argiro this is something you requested to watch as well.
@davidlange6, @smuzaffar you are the release manager for this.

cms-bot commands are listed here #13028

@slava77
Copy link
Contributor

slava77 commented Jan 19, 2017

@cmsbuild please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 19, 2017

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/17322/console Started: 2017/01/19 01:27

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Comparison job queued.

@cmsbuild
Copy link
Contributor

void disableErrorCalculation() { _computeErrors = false; }
void setDoPrefit(bool b) { _doPrefit = b; }
void setPrefitMaxChiSq(double x) { _prefitMaxChiSq = x; }
void setDynamicPedestals(bool b=true) { _dynamicPedestals = b; }
void setMitigateBadSamples(bool b=true) { _mitigateBadSamples = b; }
void setSelectiveBadSampleCriteria(bool b=true) { _selectiveBadSampleCriteria = b; }
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove default values or introduce set and unset methods if no-argument calls are desired.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok will do that.

@@ -1,16 +1,30 @@
#ifndef EigenMatrixTypes_h
#define EigenMatrixTypes_h
Copy link
Contributor

Choose a reason for hiding this comment

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

please use a more specific include guard RecoLocalCalo_EcalRecAlgos_EigenMatrixTypes_h

Copy link
Contributor

@VinInn VinInn Jan 19, 2017

Choose a reason for hiding this comment

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

or move them to DataFormats/Math
ok, no. too specifics (at least the naming)

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 ok I'll leave them here and just change the ifndef as suggested.
The actual numbers which are here are pretty detector and algorithm specific, so I think it makes sense to keep them here anyways.

@@ -0,0 +1,2 @@
#include "RecoLocalCalo/EcalRecAlgos/interface/EigenMatrixTypes.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

is this file actually needed? EigenMatrixTypes.h contains only typedefs and constexpr.

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, agreed that it is not needed, will remove it.

@@ -79,51 +79,82 @@ PulseChiSqSNNLS::PulseChiSqSNNLS() :
_maxiterwarnings(true)
{

Eigen::initParallel();
Copy link
Contributor

Choose a reason for hiding this comment

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

https://eigen.tuxfamily.org/dox/TopicMultiThreading.html

In the case your own application is multithreaded, and multiple threads make calls to Eigen, then you have to initialize Eigen by calling the following routine before creating the threads

Is removal justified?

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 can be removed as per the discussion at https://hypernews.cern.ch/HyperNews/CMS/get/swDevelopment/3290/1/1/1/1/1/1/1/1.html and the change here cms-externals/eigen#1

@Dr15Jones can comment further

Copy link
Contributor

Choose a reason for hiding this comment

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

It appears @bendavid is correct.

@cmsbuild
Copy link
Contributor

Pull request #17205 was updated. @cmsbuild, @cvuosalo, @slava77, @davidlange6 can you please check and sign again.

@bendavid
Copy link
Contributor Author

Minor cleanup added according to comments.

@slava77
Copy link
Contributor

slava77 commented Jan 19, 2017

@cmsbuild please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 19, 2017

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/17335/console Started: 2017/01/19 22:46

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Comparison job queued.

@cmsbuild
Copy link
Contributor


const unsigned int nsample = SampleVector::RowsAtCompileTime;
const unsigned int npulse = _bxs.rows();

const double pederr2 = pederr*pederr;
_invcov = pederr2*samplecor; //
_invcov = samplecov; //
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks like this part and the way samplecov is now computed upstream lead to some differences at numerical precision level observed in DQM comparisons.

pederr2 was (pederr*gainratio)*(pederr*gainratio), while now it is (pederr* pederr* gainratio* gainratio)

the other part of the logic that appears different is abs(bx)>=100 added in a few places, but IIUC, this never happens with the current defaults.
@bendavid
please confirm

@slava77
Copy link
Contributor

slava77 commented Jan 22, 2017

looking at jenkins DQM plots: there are changes starting from ECAL energies with differences at the level of float math precision

I ran 136.761 with 200 events locally and see
e.g.

en->Scan("EcalRecHitsSorted_ecalRecHit_EcalRecHitsEE_reRECO.obj.obj.energy():\
eo.EcalRecHitsSorted_ecalRecHit_EcalRecHitsEE_reRECO.obj.obj.energy():\
EcalRecHitsSorted_ecalRecHit_EcalRecHitsEE_reRECO.obj.obj.energy()-eo.EcalRecHitsSorted_ecalRecHit_EcalRecHitsEE_reRECO.obj.obj.energy()",\
 "EcalRecHitsSorted_ecalRecHit_EcalRecHitsEE_reRECO.obj.obj.energy()!=eo.EcalRecHitsSorted_ecalRecHit_EcalRecHitsEE_reRECO.obj.obj.energy()")
***********************************************************
*    Row   * Instance * EcalRecHi * eo.EcalRe * EcalRecHi *
***********************************************************
*       10 *      477 * 0.0106320 * 0.0106320 * 9.313e-10 *
*       11 *      464 * 2.8491241 * 2.8491237 * 4.768e-07 *
*       16 *      940 * 0.0003039 * 0.0003039 * -2.91e-11 *
*       17 *      353 * 0.0058631 * 0.0058631 * 4.656e-10 *
*       20 *      392 * 0.3206158 * 0.3206158 * -2.98e-08 *
*       21 *      537 * 6.178e-05 * 6.178e-05 * 7.275e-12 *
*       22 *       28 * 0.0018613 * 0.0018613 * 2.328e-10 *

there are 43 hits with different energies in EE and 123 in EB.
These differences propagate downstream: ~12 pfCandidates have different momentum.

If this is all just from pederr2 (noisecov) computed with a semantically different formula #17205 (comment)
I can sign off on this.

If there is some other logic change that might create larger differences for some rare hits (e.g. the ones with gainswitch), then it would be better to understand what the effect on those would be.

@bendavid
Copy link
Contributor Author

Agreed that changes at the level of numerical precision are possible/expected. Also confirmed that abs(bx)>=100 never occurs presently (this only happens if dynamic pedestals are enabled)

The effect on gain switch rechits should be visible in an eg. 1tev electron/photon gun or very high mass Zprime->ee sample, but here also differences for standard workflows should be only at the level of numerical precision. (To be checked whether there are already dqm plots which isolate the gain switch rechits, otherwise we probably need to explicitly check by hand, since there are some technical changes here which only affect the gain switch case, even if they should not change anything beyond numerical precision with present settings as said.)

@slava77
Copy link
Contributor

slava77 commented Jan 23, 2017

+1

for #17205 f4837b2

  • code changes are in line with the description
  • jenkins tests pass and comparisons with the baseline show differences in ECAL energies at the level of numerical precision (expected from the changes done) which are also visible in downstream objects
  • local test with 1TeV ele gun shows only differences at numerical precision level

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_9_0_X IBs (tests are also fine). This pull request requires discussion in the ORP meeting before it's merged. @davidlange6, @smuzaffar

@davidlange6
Copy link
Contributor

+1

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

6 participants