Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ana::TrivialSignalEstimator Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-28/CAFAna/XSec/TrivialSignalEstimator.h"

Inheritance diagram for ana::TrivialSignalEstimator:
ana::ISignalEstimator

Public Member Functions

 TrivialSignalEstimator (SpectrumLoaderBase *loader_mc, const HistAxis *axis, const Cut &sel, std::vector< Cut > trueBkgds, const SystShifts &shift=kNoShift, const Var &weight=kUnweighted)
 
const SpectrumSignal (const Spectrum *) const override
 
const SpectrumBackground () const override
 
const SpectrumBackgroundComponent (int) const override
 
int GetNBkgdComponents () const override
 
ISignalEstimatorClone () override
 
void SaveTo (TDirectory *, const std::string &name) const override
 
 TrivialSignalEstimator (TrivialSignalEstimator &&)
 
 TrivialSignalEstimator (const TrivialSignalEstimator &)
 
TrivialSignalEstimatoroperator= (const TrivialSignalEstimator &)
 
TrivialSignalEstimatoroperator= (TrivialSignalEstimator &&)
 
 ~TrivialSignalEstimator ()
 

Static Public Member Functions

static std::unique_ptr< TrivialSignalEstimatorLoadFrom (TDirectory *, const std::string &name)
 

Private Member Functions

 TrivialSignalEstimator (TrivialBkgdEstimator *)
 

Private Attributes

TrivialBkgdEstimatorfBkgdEst
 

Detailed Description

Signal estimator using TrivialBkgdEstimator Signal is selected MC minus total bkdgs

Definition at line 14 of file TrivialSignalEstimator.h.

Constructor & Destructor Documentation

ana::TrivialSignalEstimator::TrivialSignalEstimator ( SpectrumLoaderBase loader_mc,
const HistAxis axis,
const Cut sel,
std::vector< Cut trueBkgds,
const SystShifts shift = kNoShift,
const Var weight = kUnweighted 
)

Definition at line 25 of file TrivialSignalEstimator.cxx.

Referenced by Clone(), LoadFrom(), and TrivialSignalEstimator().

31  : fBkgdEst(new TrivialBkgdEstimator(*loader_mc,
32  *axis,
33  selection,
34  trueBkgds,
35  shift,
36  weight))
37  {}
const Var weight
TrivialBkgdEstimator * fBkgdEst
ana::TrivialSignalEstimator::TrivialSignalEstimator ( TrivialSignalEstimator &&  rhs)

Definition at line 112 of file TrivialSignalEstimator.cxx.

References fBkgdEst.

113  {
114  this->fBkgdEst = rhs.fBkgdEst;
115  rhs.fBkgdEst = NULL;
116  }
TrivialBkgdEstimator * fBkgdEst
ana::TrivialSignalEstimator::TrivialSignalEstimator ( const TrivialSignalEstimator rhs)

Definition at line 105 of file TrivialSignalEstimator.cxx.

References fBkgdEst, and TrivialSignalEstimator().

106  {
107  this->fBkgdEst = new TrivialBkgdEstimator(*rhs.fBkgdEst);
108  }
TrivialBkgdEstimator * fBkgdEst
ana::TrivialSignalEstimator::~TrivialSignalEstimator ( )

Definition at line 140 of file TrivialSignalEstimator.cxx.

References fBkgdEst.

141  {
142  delete fBkgdEst;
143  }
TrivialBkgdEstimator * fBkgdEst
ana::TrivialSignalEstimator::TrivialSignalEstimator ( TrivialBkgdEstimator bkgd)
private

Definition at line 99 of file TrivialSignalEstimator.cxx.

References TrivialSignalEstimator().

100  : fBkgdEst(bkgd)
101  {}
TrivialBkgdEstimator * fBkgdEst

Member Function Documentation

const Spectrum * ana::TrivialSignalEstimator::Background ( ) const
overridevirtual

Implements ana::ISignalEstimator.

Definition at line 48 of file TrivialSignalEstimator.cxx.

References ana::TrivialBkgdEstimator::Background(), and fBkgdEst.

49  {
50  return new Spectrum(fBkgdEst->Background());
51  }
Spectrum Background() const override
TrivialBkgdEstimator * fBkgdEst
std::vector< float > Spectrum
Definition: Constants.h:610
const Spectrum * ana::TrivialSignalEstimator::BackgroundComponent ( int  n) const
overridevirtual

Implements ana::ISignalEstimator.

Definition at line 19 of file TrivialSignalEstimator.cxx.

References fBkgdEst, and ana::TrivialBkgdEstimator::GetComponent().

20  {
21  return fBkgdEst->GetComponent(n);
22  }
const Spectrum * GetComponent(int) const
TrivialBkgdEstimator * fBkgdEst
ISignalEstimator * ana::TrivialSignalEstimator::Clone ( )
overridevirtual

Implements ana::ISignalEstimator.

Definition at line 73 of file TrivialSignalEstimator.cxx.

References TrivialSignalEstimator().

74  {
75  return new TrivialSignalEstimator(*this);
76  }
TrivialSignalEstimator(SpectrumLoaderBase *loader_mc, const HistAxis *axis, const Cut &sel, std::vector< Cut > trueBkgds, const SystShifts &shift=kNoShift, const Var &weight=kUnweighted)
int ana::TrivialSignalEstimator::GetNBkgdComponents ( ) const
overridevirtual

Implements ana::ISignalEstimator.

Definition at line 12 of file TrivialSignalEstimator.cxx.

References fBkgdEst, and ana::TrivialBkgdEstimator::GetNComponents().

13  {
14  return fBkgdEst->GetNComponents();
15  }
TrivialBkgdEstimator * fBkgdEst
std::unique_ptr< TrivialSignalEstimator > ana::TrivialSignalEstimator::LoadFrom ( TDirectory *  dir,
const std::string name 
)
static

Definition at line 80 of file TrivialSignalEstimator.cxx.

References ana::assert(), dir, ana::TrivialBkgdEstimator::LoadFrom(), getGoodRuns4SAM::tag, and TrivialSignalEstimator().

Referenced by ana::ISignalEstimator::LoadFrom().

81  {
82  dir = dir->GetDirectory(name.c_str()); // switch to subdir
83  assert(dir);
84 
85  TObjString * tag = (TObjString*) dir->Get("type");
86  assert(tag);
87  assert(tag->GetString() == "TrivialSignalEstimator" && "Type does not match TrivialSignalEstimator");
88  delete tag;
89 
90  TrivialBkgdEstimator* bkgd = TrivialBkgdEstimator::LoadFrom(dir, "fBkgdEst").release();
91 
92  delete dir;
93 
94  return std::unique_ptr<TrivialSignalEstimator>
95  ( new TrivialSignalEstimator(bkgd) );
96  }
const XML_Char * name
Definition: expat.h:151
static std::unique_ptr< TrivialBkgdEstimator > LoadFrom(TDirectory *dir, const std::string &name)
TrivialSignalEstimator(SpectrumLoaderBase *loader_mc, const HistAxis *axis, const Cut &sel, std::vector< Cut > trueBkgds, const SystShifts &shift=kNoShift, const Var &weight=kUnweighted)
TDirectory * dir
Definition: macro.C:5
assert(nhit_max >=nhit_nbins)
TrivialSignalEstimator & ana::TrivialSignalEstimator::operator= ( const TrivialSignalEstimator rhs)

Definition at line 120 of file TrivialSignalEstimator.cxx.

References fBkgdEst.

121  {
122  if ( this == &rhs )
123  return *this;
124  this->fBkgdEst = new TrivialBkgdEstimator(*rhs.fBkgdEst);
125  return *this;
126  }
TrivialBkgdEstimator * fBkgdEst
TrivialSignalEstimator & ana::TrivialSignalEstimator::operator= ( TrivialSignalEstimator &&  rhs)

Definition at line 130 of file TrivialSignalEstimator.cxx.

References fBkgdEst.

131  {
132  if ( this == &rhs )
133  return *this;
134  this->fBkgdEst = rhs.fBkgdEst;
135  rhs.fBkgdEst = NULL;
136  return *this;
137  }
TrivialBkgdEstimator * fBkgdEst
void ana::TrivialSignalEstimator::SaveTo ( TDirectory *  dir,
const std::string name 
) const
overridevirtual

Implements ana::ISignalEstimator.

Definition at line 54 of file TrivialSignalEstimator.cxx.

References dir, fBkgdEst, ana::TrivialBkgdEstimator::SaveTo(), and tmp.

55  {
56  TDirectory * tmp = gDirectory;
57 
58  dir = dir->mkdir(name.c_str()); // switch to subdir
59  dir->cd();
60 
61  TObjString("TrivialSignalEstimator").Write("type");
62 
63  fBkgdEst->SaveTo(dir, "fBkgdEst");
64 
65  dir->Write();
66  delete dir;
67 
68  tmp->cd();
69  }
const XML_Char * name
Definition: expat.h:151
Float_t tmp
Definition: plot.C:36
TrivialBkgdEstimator * fBkgdEst
TDirectory * dir
Definition: macro.C:5
void SaveTo(TDirectory *dir, const std::string &name) const override
const Spectrum * ana::TrivialSignalEstimator::Signal ( const Spectrum sel_data) const
overridevirtual

Implements ana::ISignalEstimator.

Definition at line 41 of file TrivialSignalEstimator.cxx.

References ana::TrivialBkgdEstimator::Background(), and fBkgdEst.

42  {
43  return new Spectrum(*sel_data - fBkgdEst->Background());
44  }
Spectrum Background() const override
TrivialBkgdEstimator * fBkgdEst
std::vector< float > Spectrum
Definition: Constants.h:610

Member Data Documentation

TrivialBkgdEstimator* ana::TrivialSignalEstimator::fBkgdEst
private

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