Code Monkey home page Code Monkey logo

brufit's People

Contributors

bgrube avatar c-dilks avatar dglazier avatar rwishart1 avatar s6pepaul avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

brufit's Issues

Fitting data with true histogram pdf does not yield perfect agreement

I modified the tutorial in FitHSMCModel.C such that the data that are used to create the template histogram pdf and the data that are fitted are identical (see FitHSMCModel2.py). Consequently, when fixing all fudge parameters to their nominal values, the fit result should match the data perfectly.
This works nicely, if I fit the signal pdf to the signal data: ResultsHSMinuit2
or the background pdf to the background data: ResultsHSMinuit2
To achieve the above I had to change a few things (see branch fitWithTrueTemplate):

  • switch off averaging when plotting pdfs and increase precision when plotting pdfs (see a05a16c)
  • disable the smoothing of the template histograms (see 75e17eb)

However, when I fit the sum of signal and background pdfs to the corresponding true distribution, the fit result deviates from the data, although also in this case the pdf is in principle able to reproduce the data exactly: ResultsHSMinuit2
The reason seems to be that the yields found by the fit are off by 45 counts, which corresponds to about 15% of the uncertainty.

Performing the same study for the data I use to measure the proton-track efficiency, the effect is even more pronounced: ResultsHSMinuit2

It is unclear to me why this happens and I'm unsure whether this may hint at a deeper problem. Any thoughts on how to debug this would be welcome.

MCMC sPlot

Produce sWeights for N MCMC samples. These can be used to propogate uncertainty in sPlot fit parameters.

noID

When performing sPlot, do not continue if no valid ID branch

Warnings from -Wdefaulted-function-deleted

Building brufit with a newer version of root (6.24/02) causes several -Wdefaulted-function-deleted. I think this is because of a cling update, where -Wdefaulted-function-deleted is now on by default. I've only tested this on the dev branch.

Here are a couple sample warnings:

In file included from input_line_9:14:
/home/dilks/j/dispin/deps/brufit/core/Setup.h:61:14: warning: explicitly defaulted move assignment operator is implicitly deleted [-Wdefaulted-function-deleted]
      Setup& operator=(Setup&& other) = default;
             ^
/home/dilks/j/dispin/deps/brufit/core/Setup.h:211:20: note: move assignment operator of 'Setup' is implicitly deleted because field 'fWS' has a deleted move assignment operator
      RooWorkspace fWS;
                   ^
/home/dilks/builds/root-6.24.02-install/include/RooWorkspace.h:278:39: note: copy assignment operator of 'RooWorkspace' is implicitly deleted because field '_factory' has a deleted copy assignment operator
    std::unique_ptr<RooFactoryWSTool> _factory; //! Factory tool associated with workspace
                                      ^
/usr/include/c++/7/bits/unique_ptr.h:384:19: note: 'operator=' has been explicitly marked deleted here
      unique_ptr& operator=(const unique_ptr&) = delete;
                  ^
In file included from input_line_9:15:
/home/dilks/j/dispin/deps/brufit/core/Binner.h:27:7: warning: explicitly defaulted copy constructor is implicitly deleted [-Wdefaulted-function-deleted]
      Binner(const Binner&)=default;
      ^
/home/dilks/j/dispin/deps/brufit/core/Binner.h:74:12: note: copy constructor of 'Binner' is implicitly deleted because field 'fBins' has multiple copy constructors
      Bins fBins;
           ^

A common solution seems to be changing default to delete

CrossSection: Uncertainty from nuisance parameters in sPlot

Problem:
Nuisance parameters are used in sPlot fits to account for small differences between MC and data. These are currently not applied to the accepted MC in the acceptance correction. This might result in problems when cutting on the inv. mass.

Possible strategy:
Apply nuisance parameters to accepted MC to emulate their effect in the fit.

Bootstrapping files are created in wrong directory.

It seems that

fBootStrap->SetOutDir(fSetup->GetOutDir());
sets the wrong directory for those bootstrap files that belong to kinematic bins. This can be seen when running tutorials/sPlotEventsPDF/FitPeakHistBinsBoot.C: The script defines bins in the Eg variable and Binner creates the directories

 Eg3.100000_
 Eg3.300000_
 Eg3.500000_
 Eg3.700000_
 Eg3.900000_

However, the Boot*.root files for the Eg bins are not created in these directories but in the parent directory.

As a consequence,

fBootStrap->DivideData(tname,filename);
overwrites the Boot*.root for the lower Eg bins and only the ones for Eg3.900000_ remain.

Unfortunately fixing this is not straight-forward. Binner would need an accessor to get the bin directory and this info would need to be passed down to FitManager::fData in FitManager::LoadData() and FitManager::ReloadData() and maybe other places as well.

CrossSection: Uncertainty from acceptance correction

Problem:
Uncertainty from acceptance correction is currently not propagated.

Possible strategy:
Take results in MCMCTree and calculate acceptance for each step. This produces a distribution of acceptances. This is basically a sampled likelihood of the acceptance.

Remaining issues:
What to do if fit wasn't done with MCMC?

add ROOT cmake components RooStats and MathMore

I'm having trouble building analysis code that depends on Brufit, unless I require the ROOT components RooStats and MathMore (see linked PR). Without these components, when building my analysis code I get errors such as

brufit/lib/libbrufit.so: undefined reference to `RooStats::ModelConfig::GetWS() const'
brufit/lib/libbrufit.so: undefined reference to `RooStats::SPlot::~SPlot()'
brufit/lib/libbrufit.so: undefined reference to `vtable for RooStats::MetropolisHastings'
brufit/lib/libbrufit.so: undefined reference to `RooStats::MarkovChain::MarkovChain()'
...

I'm running:

  • ROOT Version: 6.24/02
  • cmake version 3.22.0
  • g++ 7.5.0 (for building my analysis code)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.