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

External cafanacore, and switch to RecordSource-based loading #85

Draft
wants to merge 152 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
ee73292
Rescue branch feature/ext_cafanacore from sbncode.
cjbacchus Mar 30, 2021
50aff67
Rescue branch feature/ext_cafanacore from sbncode.
cjbacchus Mar 30, 2021
06d99df
Merge branch 'develop' into feature/ext_cafanacore
cjbacchus Apr 13, 2021
0749485
product_deps fixes
cjbacchus Apr 13, 2021
4839f96
Update to latest osclib, srproxy and (branch) cafanacore.
cjbacchus Apr 13, 2021
d85bfb2
Merge branch 'feature/ext_cafanacore' of github.com:SBNSoftware/sbnan…
cjbacchus Apr 13, 2021
5380237
One more include path fix.
cjbacchus Apr 13, 2021
e5edafb
Don't commit a merge conflict...
cjbacchus Apr 13, 2021
78d08dd
Normalize include paths.
cjbacchus Apr 13, 2021
3b418ac
Include changes necessitated by the addition of the sbnana/ prefix in…
cjbacchus Apr 20, 2021
6e6658f
Update to latest cafanacore and osclib releases. The type_erasure bra…
cjbacchus Apr 20, 2021
fce1bf0
Fixes necessitated by osclib changes.
cjbacchus Apr 20, 2021
b34c27b
Merge branch 'feature/ext_cafanacore' of github.com:SBNSoftware/sbnan…
cjbacchus Apr 20, 2021
35c92a5
Merge branch 'develop' into feature/ext_cafanacore
cjbacchus Apr 20, 2021
87c4d18
Update srproxy version to avoid problem with std::isnan/isinf
cjbacchus Apr 20, 2021
be013a2
Crude eigen-ization of code that got enabled in develop.
cjbacchus Apr 20, 2021
a77e823
Automated changes to macros for Spectrum include path and SaveTo syntax.
cjbacchus Apr 22, 2021
dcdf18a
Add sbnana/ prefix in a bunch of places it is required in macros.
cjbacchus Apr 22, 2021
9c34828
Some fixes for these old macros.
cjbacchus Apr 22, 2021
4e0c36c
Update to cafanacore v01.16 to suppress a lot of compilation warnings.
cjbacchus May 6, 2021
97a2264
Merge branch 'develop' into feature/ext_cafanacore
cjbacchus Jun 15, 2021
29ca1f4
Update to cafanacore version that introduces Weight.
cjbacchus Jun 24, 2021
2437253
Use new style loader for OscillatableSpectrum and TrivialExtrap
cjbacchus Jun 25, 2021
2d8049e
Merge branch 'develop' into feature/ext_cafanacore
cjbacchus Jul 21, 2021
78d7db0
Remove SpectrumLoader::AddSpectrum() and last users.
cjbacchus Jul 21, 2021
aa37b6e
Fix some silly divergences from develop
cjbacchus Jul 21, 2021
b591679
Convert a bunch of constructors over.
cjbacchus Jul 22, 2021
b8e6700
It's alive! This version can fill a simple spectrum.
cjbacchus Jul 29, 2021
cd4298e
Remove all the dead code that used to implement SpectrumLoader.
cjbacchus Jul 29, 2021
cebac9f
Implementation that is capable of handling SpillCut subscript followe…
cjbacchus Jul 29, 2021
2e36ebf
Add the ability to subscript Loaders, thus applying the same cuts (et…
cjbacchus Jul 30, 2021
3b9ca6d
Remove some dead code.
cjbacchus Jul 30, 2021
b90d976
Remove more dead code.
cjbacchus Jul 30, 2021
1a5bd23
Remove Instantiations.cxx, no longer needed.
cjbacchus Jul 30, 2021
13dfd02
Merge branch 'develop' into feature/ext_cafanacore
cjbacchus Oct 25, 2021
454a354
Fix mismerge
cjbacchus Oct 25, 2021
c53da75
Update to latest n311 versions of cafanacore and osclib
cjbacchus Oct 27, 2021
52b6289
Set TBB_INTERFACE_NEW variable required by new tbb.
cjbacchus Oct 27, 2021
968f983
Adapt EnsembleSpectrum and EnsembleRatio to cafanacore. SpectrumLoade…
cjbacchus Oct 27, 2021
db88864
Update the EnsembleSpectrum constructors to match cafanacore. This re…
cjbacchus Oct 28, 2021
2e34364
Merge branch 'develop' into feature/ext_cafanacore
cjbacchus Feb 14, 2022
d893b43
Missed conversions to sbnanaobj StandardRecord/Proxy
cjbacchus Feb 14, 2022
d1ed13b
Remove unnecessary cmake directives related to StandardRecord include…
cjbacchus Feb 14, 2022
fd8b218
Adjust CutOptimizer to RecordSource style
cjbacchus Feb 14, 2022
7a81700
Universe weights should now be Weight objects rather than Var.
cjbacchus Feb 15, 2022
1fda40d
Remove DebugHelpers, now provided by cafanacore's SignalHandlers.
cjbacchus Feb 15, 2022
4fb42bc
Re-enable weights in EnsembleSpectrum, and update test macro. Not cur…
cjbacchus Feb 15, 2022
9e7a748
Move to implementation of cafe that actually compiles the input macro…
cjbacchus Feb 15, 2022
96cf7eb
Remove load_cafana_libs.C which is a remnant of the old aclic-based c…
cjbacchus Feb 16, 2022
c58e444
Move FitVars to new INamed style
cjbacchus Feb 17, 2022
db174ed
Inherit our ISyst from cafanacore's version.
cjbacchus Feb 17, 2022
702b936
Make sure to instantiate necessary Registry types.
cjbacchus Feb 17, 2022
cebf81e
Switch over to Registry as implemented in cafanacore.
cjbacchus Feb 17, 2022
fd8507f
Initial support for loading ensembles.
cjbacchus Feb 17, 2022
552f812
The vexed question of where to find the installed rootlogon.C continues.
cjbacchus Feb 18, 2022
45dfdf2
A big simplification in sources/loaders implementation.
cjbacchus Feb 18, 2022
b8dbafc
Move SliceAdaptor into cxx and slight change to how it gets registered.
cjbacchus Feb 18, 2022
2e1a2ee
Update to cafanacore's splitting out of ensemble sources.
cjbacchus Feb 18, 2022
3c50a81
More generic EnsembleSpectrum constructor.
cjbacchus Feb 18, 2022
a4e0483
Merge branch 'develop' into feature/ext_cafanacore
cjbacchus Feb 21, 2022
b138355
Merge branch 'feature/samexperiment_envvar' into feature/ext_cafanacore
cjbacchus Feb 23, 2022
7b0e80b
Clumsily update unfolders to work with Eigen-based cafanacore. These …
cjbacchus Feb 23, 2022
e8722de
Remove grid environment variables functions now provided by cafanacore.
cjbacchus Feb 23, 2022
25b8aa4
Merge branch 'develop' into feature/ext_cafanacore
cjbacchus Mar 7, 2022
f8d1506
Implement a constructor for PredictionNoOsc
cjbacchus Mar 7, 2022
024ace6
Move SliceAdaptor implementation to a more logical file.
cjbacchus Mar 7, 2022
d8b3e97
Add adaptors for tracks, showers, stubs.
cjbacchus Mar 7, 2022
7186cb9
Add specializations for TrackCut etc.
cjbacchus Mar 7, 2022
7e4de26
Implement a SystShifts-based Ensemble function (untested as of yet).
cjbacchus Mar 7, 2022
c8f1e3b
Make IRecordSource header much more readable by moving a lot of imple…
cjbacchus Mar 7, 2022
7160ec8
Save a lot of boilerplate using templates for the adaptors.
cjbacchus Mar 8, 2022
33e52b1
New infrastructure makes it easy to add the missing Slices() for the …
cjbacchus Mar 8, 2022
609c645
Update to proper ups product, located in /sbnd/app/users/bckhouse/pro…
cjbacchus Mar 10, 2022
6daa40e
Bulk rewrite of includes from CAFAnaCore/CAFAna/Core to cafanacore/
cjbacchus Mar 10, 2022
e5477c3
Update HistAxis for Tracks etc
etyley Mar 10, 2022
4339470
Added support for looping over true nus
etyley Mar 10, 2022
b3a2831
Update to alpha3 build which fixes shutdown crash.
cjbacchus Mar 11, 2022
6026fd1
Rename SIMPLENUTRUTHVAR
etyley Mar 11, 2022
1264496
Make Track, Shower and Stub loops work
etyley Mar 11, 2022
2022cb7
Add example macro for looping over tracks
etyley Mar 11, 2022
eccc01c
Merge branch 'develop' into feature/ext_cafanacore
cjbacchus Mar 22, 2022
1c26b2a
Adapt xsec-based flux properly to branch.
cjbacchus Mar 22, 2022
bdb56b1
Rework xsec-based flux in terms of NuTruth objects. This allows us to…
cjbacchus Mar 22, 2022
ead5c86
Finer binning
cjbacchus Mar 22, 2022
bbbbf03
Point to a decaf dataset for vastly faster runtime.
cjbacchus Mar 22, 2022
a110838
Update ensemble syntax in demo macro.
cjbacchus Mar 25, 2022
a0f2d29
Clean up all sinks after SpectrumLoader is complete.
cjbacchus Mar 25, 2022
d9c7a4e
Support for printing the source/sink graph.
cjbacchus Mar 28, 2022
d482c76
Remove dead code specifying the srproxy qualifiers.
cjbacchus Mar 31, 2022
ee90990
Introduce Multiverse class.
cjbacchus Apr 8, 2022
23334a4
Implement ensembles as a single Hist rather than a vector of underlyi…
cjbacchus Apr 8, 2022
36a3537
Implement ErrorBand() function without resorting to histograms.
cjbacchus Apr 8, 2022
143b350
Split Multiverse out into FitMultiverse and _Multiverse<Syst>.
cjbacchus Apr 13, 2022
1715832
Merge branch 'develop' into feature/ext_cafanacore
cjbacchus May 4, 2022
be42070
Remove unnecessary includes
cjbacchus May 4, 2022
c3a0a95
Merge branch 'develop' into feature/ext_cafanacore
cjbacchus May 9, 2022
5e76545
Update to cafanacore alpha7 to pick up IFitSyst.
cjbacchus May 9, 2022
bec5526
Add NuTruthWeight version of Universe Weight
etyley May 9, 2022
cf2bdde
Complete transition to new-style SaveTo/LoadFrom
cjbacchus May 9, 2022
6932b73
Convert macros to new SaveTo/LoadFrom
cjbacchus May 9, 2022
a746718
Merge pull request #72 from SBNSoftware/feature/etyley_ext_cafanacore
cjbacchus May 9, 2022
a892391
Update to cafanacore alpha8 which brings better Ratio errors.
cjbacchus May 10, 2022
834c990
Implement same ratio error logic in EnsembleRatio
cjbacchus May 10, 2022
3792d72
Set errors on Ratio's individual universes, when they are available.
cjbacchus May 10, 2022
b734f62
Thread GetMultiverse() through.
cjbacchus May 11, 2022
ae7b6b4
Split Multiverse file in two.
cjbacchus May 11, 2022
34e166d
Reinstate stan ratios.
cjbacchus May 11, 2022
2f3e738
Remove trailing whitespace
cjbacchus May 11, 2022
1c09585
Merge branch 'develop' into feature/ext_cafanacore
cjbacchus May 19, 2022
d9355ef
Update to v10 to pick up weighting for ensemble sources.
cjbacchus May 19, 2022
e74dc3a
Update to v11 to pick up a compilation fix.
cjbacchus May 20, 2022
5003e9c
Make bin density do something in EnsembleSpectrum
etyley May 20, 2022
d8c0500
Merge pull request #76 from SBNSoftware/feature/etyley_ext_cafanacore…
cjbacchus May 20, 2022
140bd79
Add EnsembleFluxTimesNuceli and enable passing a weight (#77)
etyley May 20, 2022
5b3849b
Add line that somehow got lost in the merge.
cjbacchus May 20, 2022
1569394
Avoid calling src.GetMultiverse(), because it's not guaranteed that s…
cjbacchus May 23, 2022
ac67158
Add MakeTotalFlux
etyley May 26, 2022
d63cac5
Add SaveTo/LoadFrom to EnsembleFluxTimesNuclei
etyley May 26, 2022
1d3af4f
Bring FluxTimesNuclei into line with Ensemble version
etyley May 26, 2022
b8c83aa
Tidy up
etyley May 27, 2022
bc691e0
Update comments
etyley May 27, 2022
a068965
Apply suggestions from code review
etyley May 30, 2022
5f8ca48
PR Suggestions to tidy up
etyley May 30, 2022
55ecb0a
MakeTotalFlux now returns FluxTimesNuceli
etyley May 30, 2022
1a0d8a5
Merge pull request #78 from SBNSoftware/feature/etyley_ext_cafanacore
cjbacchus May 30, 2022
640a359
Update to cafanacore alpha12 to pick up ValuePairEnsemble support.
cjbacchus Jun 8, 2022
4635b3b
First attempt at EnsembleReweightableSpectrum.
cjbacchus Jun 7, 2022
eb1d16c
First attempt at EnsembleOscillatableSpectrum.
cjbacchus Jun 8, 2022
ffe6de1
Fix first bin offset in CalcCovMx and add CalcBiasMx
etyley Jun 8, 2022
d751b4d
Add CalcCovMx to EnsembleSpectrum and EnsembleRatio
etyley Jun 8, 2022
cb41909
Calculate Covariance and Bias Matrices using Eigen rather than ROOT
etyley Jun 9, 2022
a4f2452
Import EigenUtils from nova
etyley Jun 9, 2022
f1b83e2
Undoing accidental cosmetic changes
etyley Jun 9, 2022
a96f552
Handle nominal universe more explicitally
etyley Jun 9, 2022
ea06353
Add enum for multiverse type
etyley Jun 9, 2022
a88d265
Rename GetMultiverseType to GetMultiverse
etyley Jun 9, 2022
f8c1b34
Update documentation
etyley Jun 10, 2022
bc076f5
Merge pull request #80 from SBNSoftware/feature/etyley_ext_cafanacore
cjbacchus Jun 10, 2022
decde33
Add ReplicatedData to EnsembleSpectrum
etyley Jun 10, 2022
7bd4851
Add ReplicatedData to EnsembleFluxTimesNuclei
etyley Jun 10, 2022
f527004
Remove couts
etyley Jun 10, 2022
6de829e
Fix EnsembleReweightableSpectrum copy constructor and operator= to in…
cjbacchus Jun 10, 2022
3c648cf
Tidy up FluxTimesNuclei ptrs
etyley Jun 10, 2022
79c8564
Update documentation
etyley Jun 10, 2022
f13527c
Fix whitespace
etyley Jun 10, 2022
540313a
Merge pull request #81 from SBNSoftware/feature/etyley_ext_cafanacore
cjbacchus Jun 11, 2022
c1df632
Merge branch 'develop' into feature/ext_cafanacore
cjbacchus Jul 22, 2022
a1234fc
Remove beta namespace qualification from everything to keep up with l…
cjbacchus Jul 27, 2022
91862ac
Update to official cafanacore v02.00
cjbacchus Jul 27, 2022
d22c1fc
Simplification by dropping support for the unused multi-tree flatcaf …
cjbacchus Jul 28, 2022
68cf809
Merge branch 'develop' into feature/ext_cafanacore
cjbacchus Aug 31, 2022
096ee4e
Update analysis macros to new-style spectrum constructors.
cjbacchus Aug 31, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ cet_set_compiler_flags(DIAGS CAUTIOUS
WERROR
NO_UNDEFINED
ALLOW_DEPRECATIONS
EXTRA_FLAGS -pedantic -Wno-unused-local-typedefs -Wno-undefined-var-template -I $ENV{CLANG_FQ_DIR}/include/c++/v1
EXTRA_FLAGS -pedantic -Wno-unused-local-typedefs -Wno-undefined-var-template -I $ENV{CLANG_FQ_DIR}/include/c++/v1 -DTBB_INTERFACE_NEW
)

cet_report_compiler_flags()
Expand All @@ -49,6 +49,8 @@ find_ups_root(v6_00_00)
find_ups_product(ifdhc)
find_ups_product( srproxy )
find_ups_product( osclib )
find_ups_product( cafanacore )
find_ups_product( stan_math )
find_ups_product( pygccxml )

#ifdhc
Expand Down
3 changes: 0 additions & 3 deletions sbnana/CAFAna/Analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Allow "StandardRecord/" to find the right directory
include_directories(..)

cet_make(LIBRARY_NAME CAFAnaAnalysis
LIBRARIES CAFAnaCore CAFAnaExperiment
${ROOT_MINUIT2}
Expand Down
8 changes: 4 additions & 4 deletions sbnana/CAFAna/Analysis/Calcs.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace ana
calc->SetTh23(M_PI/4);

// NH from PDG2014 + 2015 update
//http://pdg.lbl.gov/2015/tables/rpp2015-sum-leptons.pdf
//http://pdg.lbl.gov/2015/tables/rpp2015-sum-leptons.pdf
calc->SetDmsq32(2.44e-3); // NB: this is normal hierarchy

// Reactor average from PDG2014 + 2015 update
Expand All @@ -46,11 +46,11 @@ namespace ana
//----------------------------------------------------------------------
void ResetOscCalcToDefaultIH(osc::IOscCalcAdjustable* calc)
{
//Share most defaults
//Share most defaults
ResetOscCalcToDefault(calc);
// IH from PDG2014 + 2015 update
// IH from PDG2014 + 2015 update
// http://pdg.lbl.gov/2015/tables/rpp2015-sum-leptons.pdf
calc->SetDmsq32(-2.49e-3);
calc->SetDmsq32(-2.49e-3);

}

Expand Down
10 changes: 5 additions & 5 deletions sbnana/CAFAna/Analysis/CalcsNuFit_cdr.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace ana

// Uniform throws within +/-3 sigma
if(hie > 0){
ret->SetDmsq32(gRandom->Uniform(kNuFitDmsq32CVNH-3*kNuFitDmsq32ErrNH,
ret->SetDmsq32(gRandom->Uniform(kNuFitDmsq32CVNH-3*kNuFitDmsq32ErrNH,
kNuFitDmsq32CVNH+3*kNuFitDmsq32ErrNH));
ret->SetTh23(gRandom->Uniform(kNuFitTh23CVNH-3*kNuFitTh23ErrNH,
kNuFitTh23CVNH+3*kNuFitTh23ErrNH));
Expand All @@ -64,7 +64,7 @@ namespace ana
kNuFitTh13CVIH+3*kNuFitTh13ErrIH));
}
ret->SetdCP(gRandom->Uniform(-1*TMath::Pi(), TMath::Pi()));

return ret;
}

Expand Down Expand Up @@ -145,9 +145,9 @@ namespace ana
fTh23Err = (hietrue > 0) ? 0.058*fTh23 : 0.048*fTh23;

fRhoErr = 0.02*fRho;

}

double Penalizer_GlbLikeCDR::ChiSq(osc::IOscCalcAdjustable* calc,
const SystShifts& /*syst*/) const {

Expand All @@ -156,7 +156,7 @@ namespace ana

double ret =
util::sqr((calc->GetDmsq21() - fDmsq21)/fDmsq21Err) +
util::sqr((calc->GetTh12() - fTh12)/fTh12Err) +
util::sqr((calc->GetTh12() - fTh12)/fTh12Err) +
util::sqr((calc->GetRho() - fRho)/fRhoErr);

// if fWeakOnly is set, only apply a constraint to the parameter we can only weakly constrain in DUNE
Expand Down
10 changes: 6 additions & 4 deletions sbnana/CAFAna/Analysis/CutOptimizer.cxx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#include "sbnana/CAFAna/Analysis/CutOptimizer.h"

#include "sbnana/CAFAna/Core/SpectrumLoader.h"

#include "TH1.h"

#include <iostream>

namespace ana
{
// --------------------------------------------------------------------------
void MakeNMinusOneSpectra(SpectrumLoader& loader,
void MakeNMinusOneSpectra(ISliceSource& src,
const Cut& sigcut,
const Cut& presel,
const std::vector<HistAxis>& axes,
Expand All @@ -28,8 +30,8 @@ namespace ana
nminusone = nminusone && axes[j].GetVars()[0] > cut_pos[j];
} // end for j

sigs.emplace_back(loader, axes[i], nminusone && sigcut);
bkgs.emplace_back(loader, axes[i], nminusone && !sigcut);
sigs.emplace_back(src[nminusone][ sigcut], axes[i]);
bkgs.emplace_back(src[nminusone][!sigcut], axes[i]);
} // end for i
}

Expand Down Expand Up @@ -64,7 +66,7 @@ namespace ana
{
SpectrumLoader loader(wildcard);
std::vector<Spectrum> sigs, bkgs;
MakeNMinusOneSpectra(loader, sigcut, presel, axes, cut_pos, sigs, bkgs);
MakeNMinusOneSpectra(loader.Slices(), sigcut, presel, axes, cut_pos, sigs, bkgs);
loader.Go();

double best_fom = 0;
Expand Down
9 changes: 5 additions & 4 deletions sbnana/CAFAna/Analysis/CutOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

#include "sbnana/CAFAna/Core/HistAxis.h"
#include "sbnana/CAFAna/Core/Cut.h"
#include "sbnana/CAFAna/Core/Spectrum.h"
#include "sbnana/CAFAna/Core/SpectrumLoader.h"
#include "cafanacore/Spectrum.h"

#include "sbnana/CAFAna/Core/IRecordSource.h"

#include <string>

Expand All @@ -14,14 +15,14 @@ namespace ana
/// This function does *not* call Go() on the loader, allowing you to combine
/// it with other spectra-filling if desired.
///
/// \param loader SpectrumLoader to associate spectra with
/// \param src Source to associate spectra with
/// \param sigcut Definition of signal (inverse defines background)
/// \param presel Cuts that will always be applied
/// \param axes Variables that will be cut on
/// \param cut_pos Cut position for each variable
/// \param[out] sigs Resulting signal spectra
/// \param[out] bkgs Resulting background spectra
void MakeNMinusOneSpectra(SpectrumLoader& loader,
void MakeNMinusOneSpectra(ISliceSource& src,
const Cut& sigcut,
const Cut& presel,
const std::vector<HistAxis>& axes,
Expand Down
2 changes: 1 addition & 1 deletion sbnana/CAFAna/Analysis/ExpInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace ana
const double kPOTuBoone = 1.3e21;
const double kBaselineSBND = 0.11;
const double kBaselineMicroBoone = 0.47;
const double kBaselineIcarus = 0.6;
const double kBaselineIcarus = 0.6;
const int kSBND = 0;
const int kMicroBoone = 1;
const int kICARUS = 2;
Expand Down
8 changes: 4 additions & 4 deletions sbnana/CAFAna/Analysis/Fit.cxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "sbnana/CAFAna/Analysis/Fit.h"

#include "sbnana/CAFAna/Core/Progress.h"
#include "cafanacore/Progress.h"
#include "sbnana/CAFAna/Core/IFitVar.h"
#include "sbnana/CAFAna/Core/Utilities.h"
#include "sbnana/CAFAna/Experiment/IExperiment.h"
Expand Down Expand Up @@ -166,7 +166,7 @@ namespace ana
mnMin->GetMinosError(i, errLow, errHigh);
std::cout << i << "/" << mnMin->NDim() << " " << fParamNames[i] << ": " << errLow << ", +" << errHigh << " (" << mnMin->Errors()[i] << ")" << std::endl;
fTempMinosErrors.push_back(std::make_pair(errLow,errHigh));
}
}
}

return mnMin;
Expand All @@ -191,8 +191,8 @@ namespace ana
// Need to deal with parameters that are not fit values!
SystShifts shift = pt.shift;

// Need to copy over syst values into the seed for this fit
// that were in the input syst shifts, but are not being fit for,
// Need to copy over syst values into the seed for this fit
// that were in the input syst shifts, but are not being fit for,
// and therefore not part of the seedPts list
for(auto s: bestSysts.ActiveSysts()) {
auto fit_systs = shift.ActiveSysts();
Expand Down
5 changes: 4 additions & 1 deletion sbnana/CAFAna/Analysis/Fit.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#pragma once

#include "sbnana/CAFAna/Core/Spectrum.h"
#include "cafanacore/Spectrum.h"
#include "sbnana/CAFAna/Prediction/IPrediction.h"
#include "sbnana/CAFAna/Core/SystShifts.h"
#include "sbnana/CAFAna/Core/Utilities.h"

#include "Math/Minimizer.h"

#include "TMatrixDSym.h"

#include <memory>

class TGraph;
Expand Down
2 changes: 1 addition & 1 deletion sbnana/CAFAna/Analysis/FitAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace ana
FitAxis(const IFitVar* var,
int nbins, double min, double max,
bool islog = false);

const IFitVar* var;
int nbins;
double min;
Expand Down
2 changes: 1 addition & 1 deletion sbnana/CAFAna/Analysis/GradientDescent.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace ana
const unsigned int N = pt.size();
ROOT::Minuit2::MnAlgebraicVector vec(N);
for(unsigned int i = 0; i < N; ++i) vec(i) = pt[i];
ROOT::Minuit2::MinimumParameters params(vec, chi);
ROOT::Minuit2::MinimumParameters params(vec, chi);
ROOT::Minuit2::MinimumState state(params, 0, ncalls);
ROOT::Minuit2::MnUserTransformation trans(pt, std::vector<double>(N));
ROOT::Minuit2::MinimumSeed seed(state, trans);
Expand Down
24 changes: 18 additions & 6 deletions sbnana/CAFAna/Analysis/MedianSurface.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,32 @@ namespace ana
}

//----------------------------------------------------------------------
void MedianSurface::SaveTo(TDirectory* dir) const
void MedianSurface::SaveTo(TDirectory* dir, const std::string& name) const
{
TDirectory* tmp = gDirectory;

dir = dir->mkdir(name.c_str()); // switch to subdir
dir->cd();

TObjString("MedianSurface").Write("type");

for(unsigned int i = 0; i < fThrows.size(); ++i){
fThrows[i].SaveTo(dir->mkdir(TString::Format("surf%d", i)));
fThrows[i].SaveTo(dir, TString::Format("surf%d", i).Data());
}

dir->Write();
delete dir;

tmp->cd();
}

//----------------------------------------------------------------------
std::unique_ptr<MedianSurface> MedianSurface::LoadFrom(TDirectory* dir)
std::unique_ptr<MedianSurface> MedianSurface::LoadFrom(TDirectory* dir,
const std::string& name)
{
dir = dir->GetDirectory(name.c_str()); // switch to subdir
assert(dir);

DontAddDirectory guard;

TObjString* tag = (TObjString*)dir->Get("type");
Expand All @@ -144,9 +154,11 @@ namespace ana

std::vector<Surface> surfs;
for(unsigned int i = 0; ; ++i){
TDirectory* surfdir = dir->GetDirectory(TString::Format("surf%d", i));
if(!surfdir) break; // we got all of them
surfs.push_back(*ana::LoadFrom<Surface>(surfdir));
const std::string subname = TString::Format("surf%d", i).Data();
TDirectory* subdir = dir->GetDirectory(subname.c_str());
if(!subdir) break; // we got all of them
delete subdir;
surfs.push_back(*ana::LoadFrom<Surface>(dir, subname));
}

return std::make_unique<MedianSurface>(surfs);
Expand Down
5 changes: 3 additions & 2 deletions sbnana/CAFAna/Analysis/MedianSurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ namespace ana
void DrawEnsemble(TH2* fc, Color_t color = kGray);
void DrawBand(TH2* fc);

void SaveTo(TDirectory * dir) const;
static std::unique_ptr<MedianSurface> LoadFrom(TDirectory * dir);
void SaveTo(TDirectory* dir, const std::string& name) const;
static std::unique_ptr<MedianSurface> LoadFrom(TDirectory* dir,
const std::string& name);
protected:
std::vector<Surface> fThrows;

Expand Down
Loading