Public Member Functions | Protected Attributes | Private Attributes | List of all members
fnex::NuisanceParameter_Experiment Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-02/FNEX/custom/NuisanceParameter_Experiment.h"

Inheritance diagram for fnex::NuisanceParameter_Experiment:
fnex::Experiment

Public Member Functions

 NuisanceParameter_Experiment (fhicl::ParameterSet const &pset)
 
 ~NuisanceParameter_Experiment ()
 
bool Reconfigure (fhicl::ParameterSet const &pset)
 
bool ApplyPoint (InputPoint &pInputPoint)
 
bool ApplyCorrelations (InputPoint &pInputPoint)
 
double FitValue ()
 
int NDOF ()
 
bool SetEventListMap (EventListMap const &pEventListMap)
 
const std::string ToString () const
 
void DrawPlots (art::TFileDirectory *plotDir) const
 
bool IsConfigured ()
 
bool HasPlots ()
 
const std::string ShortName () const
 

Protected Attributes

bool fIsConfigured
 
bool fHasPlots
 
std::string fShortName
 

Private Attributes

std::string fVarKey
 
double fChiSq
 
int fNDOF
 
double fCentralValue
 
double fVariance
 

Detailed Description

Definition at line 11 of file NuisanceParameter_Experiment.h.

Constructor & Destructor Documentation

fnex::NuisanceParameter_Experiment::NuisanceParameter_Experiment ( fhicl::ParameterSet const &  pset)

Definition at line 5 of file NuisanceParameter_Experiment.cxx.

References Reconfigure().

6  : Experiment(pset)
7  {
8  this->Reconfigure(pset);
9  }
bool Reconfigure(fhicl::ParameterSet const &pset)
Experiment(fhicl::ParameterSet const &pset)
Definition: Experiment.cxx:6
fnex::NuisanceParameter_Experiment::~NuisanceParameter_Experiment ( )
inline

Member Function Documentation

bool fnex::NuisanceParameter_Experiment::ApplyCorrelations ( InputPoint pInputPoint)
virtual

Implements fnex::Experiment.

Definition at line 114 of file NuisanceParameter_Experiment.cxx.

Referenced by ~NuisanceParameter_Experiment().

114  {
115  return true;
116  }
bool fnex::NuisanceParameter_Experiment::ApplyPoint ( InputPoint pInputPoint)
virtual
Todo:
Make this line handle either detector

Implements fnex::Experiment.

Definition at line 50 of file NuisanceParameter_Experiment.cxx.

References release_diff::diff, fCentralValue, fChiSq, fNDOF, fVariance, fVarKey, fnex::InputPoint::IsParameterFixed(), novadaq::cnv::kFARDET, novadaq::cnv::kNEARDET, LOG_DEBUG, make_pair(), fnex::InputPoint::ParameterSpaceLocation(), and fnex::InputPoint::SystematicPulls().

Referenced by ~NuisanceParameter_Experiment().

50  {
51 
52  // Sanity check
53  if(fVariance == 0.0)
54  throw cet::exception("NuisanceParameter_Experiment")
55  << "Error in NuisanceParameter_Experiment::ApplyPoint -- sigma should not be 0.0 : "
56  << fVariance;
57 
58  // Use input point and fCentralValues, fVariances,
59  // to modify value of fChiSq
60  auto parameterSpaceLocations = pInputPoint.ParameterSpaceLocation();
61  auto systematicPulls = pInputPoint.SystematicPulls();
62 
63  /// \todo Make this line handle either detector
64  std::vector< fnex::ParameterDet > parDets({std::make_pair(fVarKey, novadaq::cnv::kFARDET),
66 
67  //std::cout << "Looking for fVarKey: " << fVarKey << std::endl;
68 
69  fChiSq = 0.0;
70  fNDOF = 1;
71  double diff = 0.0;
72 
73  for(auto pd : parDets){
74 
75  // do nothing if this parameter is fixed
76  if( pInputPoint.IsParameterFixed(pd) ) continue;
77 
78  if(parameterSpaceLocations.count(pd) != 0){
79  diff = parameterSpaceLocations[pd] - fCentralValue;
80  }
81  else if(systematicPulls.count(pd) != 0){
82  diff = systematicPulls[pd] - fCentralValue;
83  }
84  else continue;
85 
86  fChiSq = (diff * diff) / (fVariance * fVariance);
87 
88  // TEST: TODO: Remove following lines after tests on the chisq values
89  LOG_DEBUG("NuisanceParameter_Experiment::ApplyPoint")
90  << "Inside NuisanceParameter_Experiment::ApplyPoint"
91  << " Parameter: "
92  << pd.first
93  << " Central Value: "
94  << fCentralValue
95  << " parameterSpaceLocations: "
96  << parameterSpaceLocations[pd]
97  << " systematicPulls: "
98  << systematicPulls[pd]
99  << " diff: "
100  << diff
101  << " Variance: "
102  << fVariance
103  << " Chisq: "
104  << fChiSq;
105  }
106  // I guess we have just one DOF, right?
107  fNDOF = 1;
108 
109  return true;
110  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
Far Detector at Ash River, MN.
Near Detector in the NuMI cavern.
void fnex::NuisanceParameter_Experiment::DrawPlots ( art::TFileDirectory plotDir) const
virtual

Implements fnex::Experiment.

Definition at line 19 of file NuisanceParameter_Experiment.cxx.

Referenced by ~NuisanceParameter_Experiment().

19  {
20  return;
21  }
double fnex::NuisanceParameter_Experiment::FitValue ( )
virtual

Implements fnex::Experiment.

Definition at line 119 of file NuisanceParameter_Experiment.cxx.

References fChiSq.

Referenced by ~NuisanceParameter_Experiment().

119  {
120 
121  // Just return stored value of fChiSq
122  // (calculated at ApplyPoint stage)
123  return fChiSq;
124 
125  }
bool fnex::Experiment::HasPlots ( )
inlineinherited
bool fnex::Experiment::IsConfigured ( )
inlineinherited

Definition at line 40 of file Experiment.h.

References fnex::Experiment::fIsConfigured.

40 { return fIsConfigured; }
int fnex::NuisanceParameter_Experiment::NDOF ( )
virtual

Implements fnex::Experiment.

Definition at line 128 of file NuisanceParameter_Experiment.cxx.

References fNDOF.

Referenced by ~NuisanceParameter_Experiment().

128  {
129 
130  // Just return stored value of fChiSq
131  // (calculated at ApplyPoint stage)
132  return fNDOF;
133  }
bool fnex::NuisanceParameter_Experiment::Reconfigure ( fhicl::ParameterSet const &  pset)
virtual

Implements fnex::Experiment.

Definition at line 24 of file NuisanceParameter_Experiment.cxx.

References fCentralValue, fChiSq, fnex::Experiment::fHasPlots, fnex::Experiment::fIsConfigured, fNDOF, fnex::Experiment::fShortName, fVariance, fVarKey, fhicl::ParameterSet::get(), and string.

Referenced by NuisanceParameter_Experiment(), and ~NuisanceParameter_Experiment().

24  {
25 
26  // Does this experiment have descriptive plots?
27  fHasPlots = false;
28 
29  // Grab values from pset
30  fShortName = pset.get< std::string >("ShortName");
31  fVarKey = pset.get< std::string >("VarKey");
32  fCentralValue = pset.get< double >("CentralValue", 0.0);
33  fVariance = pset.get< double >("Variance", 1.0);
34  fIsConfigured = true;
35  fChiSq = 0.0;
36  fNDOF = 1;
37 
38  // We're done here
39  return fIsConfigured;
40 
41  }
std::string fShortName
Definition: Experiment.h:65
enum BeamMode string
bool fnex::NuisanceParameter_Experiment::SetEventListMap ( EventListMap const &  pEventListMap)
virtual

Implements fnex::Experiment.

Definition at line 44 of file NuisanceParameter_Experiment.cxx.

Referenced by ~NuisanceParameter_Experiment().

44  {
45  return true;
46  }
const std::string fnex::Experiment::ShortName ( ) const
inlineinherited

Definition at line 50 of file Experiment.h.

References fnex::Experiment::DrawPlots(), and fnex::Experiment::fShortName.

Referenced by fnex::NOvA_Experiment::SetEventListMap().

50 { return fShortName; }
std::string fShortName
Definition: Experiment.h:65
const std::string fnex::NuisanceParameter_Experiment::ToString ( ) const
virtual

Implements fnex::Experiment.

Definition at line 12 of file NuisanceParameter_Experiment.cxx.

References fVarKey, r(), and string.

Referenced by ~NuisanceParameter_Experiment().

12  {
13  std::string r = "NuisancePar_";
14  r+=fVarKey;
15  return r;
16  }
TRandom3 r(0)
enum BeamMode string

Member Data Documentation

double fnex::NuisanceParameter_Experiment::fCentralValue
private

Definition at line 53 of file NuisanceParameter_Experiment.h.

Referenced by ApplyPoint(), and Reconfigure().

double fnex::NuisanceParameter_Experiment::fChiSq
private

Definition at line 49 of file NuisanceParameter_Experiment.h.

Referenced by ApplyPoint(), FitValue(), and Reconfigure().

bool fnex::Experiment::fHasPlots
protectedinherited
bool fnex::Experiment::fIsConfigured
protectedinherited
int fnex::NuisanceParameter_Experiment::fNDOF
private

Definition at line 50 of file NuisanceParameter_Experiment.h.

Referenced by ApplyPoint(), NDOF(), and Reconfigure().

std::string fnex::Experiment::fShortName
protectedinherited
double fnex::NuisanceParameter_Experiment::fVariance
private

Definition at line 54 of file NuisanceParameter_Experiment.h.

Referenced by ApplyPoint(), and Reconfigure().

std::string fnex::NuisanceParameter_Experiment::fVarKey
private

Definition at line 46 of file NuisanceParameter_Experiment.h.

Referenced by ApplyPoint(), Reconfigure(), and ToString().


The documentation for this class was generated from the following files: