Public Member Functions | Protected Attributes | List of all members
fnex::FitEval_Counting Class Referenceabstract

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

Inheritance diagram for fnex::FitEval_Counting:
fnex::FitEvaluation

Public Member Functions

 FitEval_Counting (fhicl::ParameterSet const &pset)
 
 ~FitEval_Counting ()
 
void Reconfigure (fhicl::ParameterSet const &pset)
 
double FitValue (const TH1D &hData, const TH1D &hMC, std::vector< double > const &pDataVals=std::vector< double >(0), std::vector< double > const &pDataWeights=std::vector< double >(0))
 
int NDOF (const TH1D &hData, const TH1D &hMC, std::vector< double > const &pDataVals=std::vector< double >(0), std::vector< double > const &pDataWeights=std::vector< double >(0))
 
virtual double FitValue (TH1D const &hData, TH1D const &hMC, std::vector< double > const &pDataVals=std::vector< double >(0), std::vector< double > const &pDataWeights=std::vector< double >(0))=0
 
virtual int NDOF (TH1D const &hData, TH1D const &hMC, std::vector< double > const &pDataVals=std::vector< double >(0), std::vector< double > const &pDataWeights=std::vector< double >(0))=0
 
bool IsConfigured ()
 
void SetRange (double pRangeMin, double pRangeMax)
 
void SetRangeMin (double p)
 
void SetRangeMax (double p)
 
double GetRangeMin ()
 
double GetRangeMax ()
 
void EnforceSanity ()
 

Protected Attributes

bool fIsConfigured
 
double fRangeMin
 
double fRangeMax
 

Detailed Description

Definition at line 11 of file FitEval_Counting.h.

Constructor & Destructor Documentation

fnex::FitEval_Counting::FitEval_Counting ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 5 of file FitEval_Counting.cxx.

References Reconfigure().

6  : FitEvaluation(pset)
7  {
8  this->Reconfigure(pset);
9  }
void Reconfigure(fhicl::ParameterSet const &pset)
FitEvaluation(fhicl::ParameterSet const &pset)
fnex::FitEval_Counting::~FitEval_Counting ( )
inline

Definition at line 17 of file FitEval_Counting.h.

References FitValue(), NDOF(), and Reconfigure().

17 {};

Member Function Documentation

void fnex::FitEvaluation::EnforceSanity ( )
inherited
virtual double fnex::FitEvaluation::FitValue ( TH1D const &  hData,
TH1D const &  hMC,
std::vector< double > const &  pDataVals = std::vector< double >(0),
std::vector< double > const &  pDataWeights = std::vector< double >(0) 
)
pure virtualinherited
double fnex::FitEval_Counting::FitValue ( const TH1D &  hData,
const TH1D &  hMC,
std::vector< double > const &  pDataVals = std::vector<double>(0),
std::vector< double > const &  pDataWeights = std::vector<double>(0) 
)

Definition at line 17 of file FitEval_Counting.cxx.

References fnex::FitEvaluation::fRangeMax, fnex::FitEvaluation::fRangeMin, Integral(), and test_ParserArtEvents::log.

Referenced by ~FitEval_Counting().

20  {
21 
22  // Get min/max bins based on fit range
23  unsigned int binMin = hData.GetXaxis()->FindBin(fRangeMin);
24  unsigned int binMax = hData.GetXaxis()->FindBin(fRangeMax)-1;
25 
26  // Get number of predicted and observed events.
27  // By default, Integral() includes contents only of
28  // bins in range (no overflow/underflow content)
29 
30  double npredicted = hMC. Integral(binMin, binMax);
31  double nobserved = hData.Integral(binMin, binMax);
32 
33  // Find chisq
34  double chisq = 0.0;
35  if(npredicted != 0){
36  chisq += npredicted-nobserved;
37  if(nobserved != 0) chisq += nobserved*log(nobserved/npredicted);
38  }
39  chisq*=2.0;
40 
41  // Return chisq
42  return chisq;
43 
44  }
double Integral(const Spectrum &s, const double pot, int cvnregion)
double fnex::FitEvaluation::GetRangeMax ( )
inlineinherited

Definition at line 41 of file FitEvaluation.h.

References fnex::FitEvaluation::EnforceSanity(), and fnex::FitEvaluation::fRangeMax.

41 { return fRangeMax; }
double fnex::FitEvaluation::GetRangeMin ( )
inlineinherited

Definition at line 40 of file FitEvaluation.h.

References fnex::FitEvaluation::fRangeMin.

40 { return fRangeMin; }
bool fnex::FitEvaluation::IsConfigured ( )
inherited

Definition at line 12 of file FitEvaluation.cxx.

References fnex::FitEvaluation::fIsConfigured.

Referenced by fnex::FitEvaluation::~FitEvaluation().

12  {
13  return fIsConfigured;
14  }
int fnex::FitEval_Counting::NDOF ( const TH1D &  hData,
const TH1D &  hMC,
std::vector< double > const &  pDataVals = std::vector<double>(0),
std::vector< double > const &  pDataWeights = std::vector<double>(0) 
)

Definition at line 46 of file FitEval_Counting.cxx.

Referenced by ~FitEval_Counting().

49  {
50 
51  return 1;
52 
53  }
virtual int fnex::FitEvaluation::NDOF ( TH1D const &  hData,
TH1D const &  hMC,
std::vector< double > const &  pDataVals = std::vector< double >(0),
std::vector< double > const &  pDataWeights = std::vector< double >(0) 
)
pure virtualinherited
void fnex::FitEval_Counting::Reconfigure ( fhicl::ParameterSet const &  pset)
virtual

Implements fnex::FitEvaluation.

Definition at line 12 of file FitEval_Counting.cxx.

References fnex::FitEvaluation::fIsConfigured.

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

12  {
13  fIsConfigured = true;
14  return;
15  }
void fnex::FitEvaluation::SetRange ( double  pRangeMin,
double  pRangeMax 
)
inherited

Definition at line 16 of file FitEvaluation.cxx.

References fnex::FitEvaluation::EnforceSanity(), fnex::FitEvaluation::fRangeMax, and fnex::FitEvaluation::fRangeMin.

Referenced by fnex::FitEvaluation::~FitEvaluation().

16  {
17  fRangeMin = pRangeMin;
18  fRangeMax = pRangeMax;
19  this->EnforceSanity();
20  }
void fnex::FitEvaluation::SetRangeMax ( double  p)
inherited

Definition at line 27 of file FitEvaluation.cxx.

References fnex::FitEvaluation::EnforceSanity(), and fnex::FitEvaluation::fRangeMax.

Referenced by fnex::FitEvaluation::~FitEvaluation().

27  {
28  fRangeMax = p;
29  this->EnforceSanity();
30  }
const char * p
Definition: xmltok.h:285
void fnex::FitEvaluation::SetRangeMin ( double  p)
inherited

Definition at line 22 of file FitEvaluation.cxx.

References fnex::FitEvaluation::EnforceSanity(), and fnex::FitEvaluation::fRangeMin.

Referenced by fnex::FitEvaluation::~FitEvaluation().

22  {
23  fRangeMin = p;
24  this->EnforceSanity();
25  }
const char * p
Definition: xmltok.h:285

Member Data Documentation

bool fnex::FitEvaluation::fIsConfigured
protectedinherited
double fnex::FitEvaluation::fRangeMax
protectedinherited
double fnex::FitEvaluation::fRangeMin
protectedinherited

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