MultiExperiment.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include <memory>
6 #include <vector>
7 
8 namespace ana
9 {
10  /// Combine multiple component experiments
12  {
13  public:
14  MultiExperiment(std::vector<const IExperiment*> expts = {}) : fExpts(expts)
15  {
16  fSystCorrelations.resize(expts.size());
17  }
18 
19  void Add(const IExperiment* expt)
20  {
21  fExpts.push_back( expt );
22  fSystCorrelations.resize( fExpts.size() );
23  }
24 
25  virtual double ChiSq(osc::IOscCalcAdjustable* osc,
26  const SystShifts& syst = SystShifts::Nominal()) const override;
27 
28  const std::vector<const IExperiment*>& GetExperiments() const { return fExpts; }
29 
30  /// Sum up log-likelihoods of sub-expts.
32  const SystShifts& syst) const override;
33 
34  /// For the subexperiment \a idx, set up a mapping between systematics
35  ///
36  /// Each element in the vector is a pair from a "primary" systematic to a
37  /// "secondary". When this MultiExperiment is called with a primary
38  /// systematic shifted, the sub-experiment will be called with the
39  /// secondary systematic set to the same value (and the primary unset).
40  ///
41  /// You can pass NULL for a secondary to indicate that the systematic
42  /// simply has no effect on the experiment in question and should be
43  /// filtered out.
44  void SetSystCorrelations(int idx,
45  const std::vector<std::pair<const ISyst*,
46  const ISyst*>>& corrs);
47 
48  void Reset() const override;
49 
50  virtual void SaveTo(TDirectory* dir, const std::string& name) const override;
51  static std::unique_ptr<MultiExperiment> LoadFrom(TDirectory* dir, const std::string& name);
52 
53  protected:
54  /// Get a new SystShifts, applying the specified correlations to it
55  SystShifts ApplySystCorrs(const SystShifts& shiftsIn,
56  const std::vector<std::pair<const ISyst*, const ISyst*>>& corrs) const;
57 
58  std::vector<const IExperiment*> fExpts;
59 
60  std::vector<std::vector<std::pair<const ISyst*, const ISyst*>>> fSystCorrelations;
61  };
62 }
const XML_Char * name
Definition: expat.h:151
std::vector< const IExperiment * > fExpts
void Reset() const override
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
var_value< double > var
Definition: StanTypedefs.h:14
static SystShifts Nominal()
Definition: SystShifts.h:34
Encapsulate code to systematically shift a caf::SRProxy.
Definition: ISyst.h:14
void Add(const IExperiment *expt)
std::vector< std::vector< std::pair< const ISyst *, const ISyst * > > > fSystCorrelations
expt
Definition: demo5.py:34
stan::math::var LogLikelihood(osc::IOscCalcAdjustableStan *osc, const SystShifts &syst) const override
Sum up log-likelihoods of sub-expts.
virtual double ChiSq(osc::IOscCalcAdjustable *osc, const SystShifts &syst=SystShifts::Nominal()) const override
Oscillation probability calculators.
Definition: Calcs.h:5
Combine multiple component experiments.
SystShifts ApplySystCorrs(const SystShifts &shiftsIn, const std::vector< std::pair< const ISyst *, const ISyst * >> &corrs) const
Get a new SystShifts, applying the specified correlations to it.
TDirectory * dir
Definition: macro.C:5
const std::vector< const IExperiment * > & GetExperiments() const
Base class defining interface for experiments.
Definition: IExperiment.h:14
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
static std::unique_ptr< MultiExperiment > LoadFrom(TDirectory *dir, const std::string &name)
MultiExperiment(std::vector< const IExperiment * > expts={})
void SetSystCorrelations(int idx, const std::vector< std::pair< const ISyst *, const ISyst * >> &corrs)
enum BeamMode string