Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
ana::FCBin Class Reference

A collection of Feldman-Cousins experiments at the same oscillation parameters. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/CAFAna/FC/FCBin.h"

Public Member Functions

void Add (const FCPoint &pt)
 
double UpValueForSignificance (double sig)
 
double SignificanceForUpValue (double up) const
 
void Draw (double maxx=10) const
 
bool Empty () const
 
void ToTree (TTree *tr) const
 

Static Public Member Functions

static void InitToTree (TTree *tr)
 
static void InitFromTree (TTree *tr)
 
static FCBin FromTree (TTree *tr, int idx)
 

Protected Attributes

std::vector< float > fVals
 

Detailed Description

A collection of Feldman-Cousins experiments at the same oscillation parameters.

Definition at line 13 of file FCBin.h.

Member Function Documentation

void ana::FCBin::Add ( const FCPoint pt)

Definition at line 21 of file FCBin.cxx.

References fVals, and ana::FCPoint::Up().

22  {
23  fVals.push_back(pt.Up());
24  }
std::vector< float > fVals
Definition: FCBin.h:31
void ana::FCBin::Draw ( double  maxx = 10) const

Definition at line 76 of file FCBin.cxx.

References fVals, make_syst_table_plots::h, and registry_explorer::v.

77  {
78  TH1* h = new TH1F("", ";#Delta#chi^{2};Experiments", 200, 0, maxx);
79  for(float v: fVals) h->Fill(v);
80  h->Draw();
81 
82  /*
83  double* integ = h->GetIntegral();
84  for(int n = 0; n < 102; ++n) h->SetBinContent(n, integ[n]);
85  */
86  }
std::vector< float > fVals
Definition: FCBin.h:31
bool ana::FCBin::Empty ( ) const
inline

Definition at line 23 of file FCBin.h.

References FromTree(), fVals, compare_h5_caf::idx, InitFromTree(), InitToTree(), ToTree(), and make_root_from_grid_output::tr.

Referenced by FCCorrectSlice(), and MakeSummaryTable().

23 {return fVals.empty();}
std::vector< float > fVals
Definition: FCBin.h:31
FCBin ana::FCBin::FromTree ( TTree *  tr,
int  idx 
)
static

Definition at line 125 of file FCBin.cxx.

References ana::assert(), fVals, and runNovaSAM::ret.

Referenced by Empty(), and ana::FCSurface::LoadFromFile().

126  {
127  tr->GetEntry(idx);
128 
129  assert(gNVals <= int(gVals.size()));
130 
131  FCBin ret;
132  ret.fVals = std::vector<float>(gVals.begin(), gVals.begin()+gNVals);
133  return ret;
134  }
assert(nhit_max >=nhit_nbins)
void ana::FCBin::InitFromTree ( TTree *  tr)
static

Definition at line 107 of file FCBin.cxx.

References MECModelEnuComparisons::i, and std::max().

Referenced by Empty(), and ana::FCSurface::LoadFromFile().

108  {
109  tr->SetBranchAddress("nvals", &gNVals);
110 
111  // It's a shape we have to run through the tree upfront to determine this,
112  // but TTree doesn't seem to like having the branch address changed
113  // mid-entry as you'd have to do otherwise.
114  int maxN = 0;
115  for(int i = 0; i < tr->GetEntries(); ++i){
116  tr->GetEntry(i);
117  maxN = std::max(maxN, gNVals);
118  }
119 
120  gVals.resize(maxN);
121  tr->SetBranchAddress("vals", &gVals.front());
122  }
T max(const caf::Proxy< T > &a, T b)
void ana::FCBin::InitToTree ( TTree *  tr)
static

Definition at line 89 of file FCBin.cxx.

Referenced by Empty(), and ana::FCSurface::SaveToFile().

90  {
91  tr->Branch("nvals", &gNVals);
92  tr->Branch("vals", &gVals.front(), "vals[nvals]/F");
93  }
double ana::FCBin::SignificanceForUpValue ( double  up) const

Definition at line 59 of file FCBin.cxx.

References ana::assert(), fVals, and it.

Referenced by FCCorrectSlice().

60  {
61  std::sort(fVals.begin(), fVals.end());
62  auto it = std::lower_bound(fVals.begin(), fVals.end(), up);
63 
64  auto v1 = *it;
65  auto v0 = *(it-1);
66 
67  // up value must be covered in range
68  assert(up >= v0 && up <= v1);
69  // should never happen with lower_bound
70  if (v0==v1) return double(it-fVals.begin()-1);
71 
72  return double((up-v0)/(v1-v0) + it-fVals.begin()-1) / fVals.size();
73  }
set< int >::iterator it
std::vector< float > fVals
Definition: FCBin.h:31
assert(nhit_max >=nhit_nbins)
void ana::FCBin::ToTree ( TTree *  tr) const

Definition at line 96 of file FCBin.cxx.

References fVals.

Referenced by Empty().

97  {
98  gNVals = fVals.size();
99 
100  gVals = fVals;
101  tr->SetBranchAddress("vals", &gVals.front());
102 
103  tr->Fill();
104  }
std::vector< float > fVals
Definition: FCBin.h:31
double ana::FCBin::UpValueForSignificance ( double  sig)

Definition at line 27 of file FCBin.cxx.

References ana::assert(), fVals, and compare_h5_caf::idx.

28  {
29  assert(sig > 0 && sig < 1);
30 
31  std::sort(fVals.begin(), fVals.end());
32 
33  const int N = fVals.size();
34 
35  const int idx = sig*(N+1)-1;
36  // Bin must have enough points for this significance
37  assert(idx >= 0);
38  assert(idx < N-1);
39 
40  // Up values for the points either side of this significance
41  const double up0 = fVals[idx];
42  const double up1 = fVals[idx+1];
43  // What significance taking the points themselves would be worth. Consider
44  // some small-N cases. If there is only one point it represents the 50%
45  // mark. If there are two, 50% is halfway between them, and they are 33%
46  // and 67%.
47  const double sig0 = double(idx+1)/(N+1);
48  const double sig1 = double(idx+2)/(N+1);
49  const double dsig = 1./(N+1); //sig1-sig0;
50 
51  // Make sure we picked the right points
52  assert(sig >= sig0 && sig <= sig1);
53 
54  // Linear interpolation
55  return (up0*(sig1-sig)+up1*(sig-sig0))/dsig;
56  }
std::vector< float > fVals
Definition: FCBin.h:31
assert(nhit_max >=nhit_nbins)

Member Data Documentation

std::vector<float> ana::FCBin::fVals
mutableprotected

Definition at line 31 of file FCBin.h.

Referenced by Add(), Draw(), Empty(), FromTree(), SignificanceForUpValue(), ToTree(), and UpValueForSignificance().


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