MINT2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BinFlipChi2 Class Reference

#include <BinFlipChi2.h>

Inheritance diagram for BinFlipChi2:
BinFlipChi2Base MINT::Minimisable MINT::IMinimisable

Public Member Functions

 BinFlipChi2 (BinFlipParSet *, const HadronicParameters &, const TimeBinning &)
 
 BinFlipChi2 (BinFlipParSet *, const std::string &, const std::string &, const std::string &fname="")
 
virtual double getVal () override
 
std::deque< std::deque< TH1F > > plotsVsTime (const std::string &) const
 
void savePlotsVsTime (const std::string &, TFile &) const
 
- Public Member Functions inherited from BinFlipChi2Base
 BinFlipChi2Base (BinFlipParSet *)
 
virtual void parametersChanged () override
 
TH2D scan2D (unsigned, unsigned, float nSigmaRange=5., unsigned nBins=300, bool zeroCentre=true, float scale=1.)
 
BinFlipParSetgetBinFlipParSet ()
 
- Public Member Functions inherited from MINT::Minimisable
 Minimisable (MinuitParameterSet *mps=0)
 
 Minimisable (const Minimisable &other)
 
virtual ~Minimisable ()
 
void setPset (MinuitParameterSet *mps)
 
MinuitParameterSetgetParSet ()
 
virtual void beginFit ()
 
virtual void endFit ()
 
double getNewVal ()
 
- Public Member Functions inherited from MINT::IMinimisable
virtual void Gradient (std::vector< double > &grad)
 
virtual bool useAnalyticGradient ()
 
virtual void setUseAnalyticGradient (bool useAnalyticGradient)
 
virtual ~IMinimisable ()
 

Private Member Functions

void checkPhaseBinning () const
 
void init ()
 

Private Attributes

HadronicParameters m_hadronicPars
 
TimeBinning m_timeBinning
 
double m_lifetime
 

Additional Inherited Members

- Protected Attributes inherited from BinFlipChi2Base
BinFlipParSetm_fitPars
 
std::complex< double > m_zcp
 
std::complex< double > m_dz
 

Detailed Description

Definition at line 50 of file BinFlipChi2.h.

Constructor & Destructor Documentation

◆ BinFlipChi2() [1/2]

BinFlipChi2::BinFlipChi2 ( BinFlipParSet fitPars,
const HadronicParameters hadronicPars,
const TimeBinning timeBins 
)

Definition at line 145 of file BinFlipChi2.cpp.

146  :
147  BinFlipChi2Base(fitPars),
148  m_hadronicPars(hadronicPars),
149  m_timeBinning(timeBins)
150 {
151  init() ;
152 }
TimeBinning m_timeBinning
Definition: BinFlipChi2.h:61
BinFlipChi2Base(BinFlipParSet *)
Definition: BinFlipChi2.cpp:70
HadronicParameters m_hadronicPars
Definition: BinFlipChi2.h:60

◆ BinFlipChi2() [2/2]

BinFlipChi2::BinFlipChi2 ( BinFlipParSet ,
const std::string &  ,
const std::string &  ,
const std::string &  fname = "" 
)

Member Function Documentation

◆ checkPhaseBinning()

void BinFlipChi2::checkPhaseBinning ( ) const
private

Definition at line 168 of file BinFlipChi2.cpp.

168  {
170  throw invalid_argument("The phase binning of the hadronic parameters and binned data don't match!") ;
171 }
TimeBinning m_timeBinning
Definition: BinFlipChi2.h:61
const PhaseBinningBase & binning() const
Get the binning scheme.
HadronicParameters::BinningPtr phaseBinning() const
HadronicParameters m_hadronicPars
Definition: BinFlipChi2.h:60

◆ getVal()

double BinFlipChi2::getVal ( )
overridevirtual

Implements MINT::Minimisable.

Definition at line 173 of file BinFlipChi2.cpp.

173  {
174  double chi2 = 0. ;
175  for(unsigned iTimeBin = 0 ; iTimeBin < m_timeBinning.nBinsTime() ; ++iTimeBin){
176  for(unsigned iPhaseBin = 1 ; iPhaseBin < m_timeBinning.nBinsPhase() + 1; ++iPhaseBin){
177  // Needs the unmixed time.
178  double Rplus = m_hadronicPars.bin(iPhaseBin).R(m_timeBinning.meanUnmixedTime(iTimeBin),
181  double Rminus = m_hadronicPars.bin(iPhaseBin).Rbar(m_timeBinning.meanUnmixedTime(iTimeBin),
184  chi2 += m_timeBinning.chiSquared(iTimeBin, iPhaseBin, Rplus, Rminus) ;
185  }
186  }
187  return chi2 ;
188 }
unsigned nBinsPhase() const
TimeBinning m_timeBinning
Definition: BinFlipChi2.h:61
std::complex< double > m_zcp
Definition: BinFlipChi2.h:46
double meanUnmixedTime(unsigned) const
double meanUnmixedTime2(unsigned) const
const Bin & bin(IDalitzEvent &) const
Get the bin for a DalitzEvent.
double chiSquared(unsigned, unsigned, double, double) const
std::complex< double > m_dz
Definition: BinFlipChi2.h:47
double getLifetime() const
double Rbar(double, double, double, const std::complex< double > &, const std::complex< double > &) const
HadronicParameters m_hadronicPars
Definition: BinFlipChi2.h:60
unsigned nBinsTime() const
double R(double, double, double, const std::complex< double > &, const std::complex< double > &) const
Get expected ratio of events (suppressed)/(favoured) at the given time for the given mixing parameter...

◆ init()

void BinFlipChi2::init ( )
private

Definition at line 164 of file BinFlipChi2.cpp.

164  {
166 }
void checkPhaseBinning() const

◆ plotsVsTime()

deque< deque< TH1F > > BinFlipChi2::plotsVsTime ( const std::string &  ) const

Definition at line 190 of file BinFlipChi2.cpp.

190  {
191  deque<deque<TH1F> > histos = m_timeBinning.plotsVsTime(name) ;
192  unsigned iPhaseBin = 1 ;
193  for(auto& binhistos : histos) {
194  TH1F& rminus = binhistos[2] ;
195  TH1F& rplus = binhistos[5] ;
196  TH1F& rdiff = binhistos[6] ;
197  TH1F rminusfit = TH1F(rminus) ;
198  rminusfit.SetName((string(rminus.GetName()) + "_fit").c_str()) ;
199  TH1F rplusfit = TH1F(rplus) ;
200  rplusfit.SetName((string(rplus.GetName()) + "_fit").c_str()) ;
201  TH1F rdifffit = TH1F(rdiff) ;
202  rdifffit.SetName((string(rdiff.GetName()) + "_fit").c_str()) ;
203  for(unsigned iTimeBin = 0 ; iTimeBin < m_timeBinning.nBinsTime() ; ++iTimeBin){
204  double t = m_timeBinning.meanUnmixedTime(iTimeBin) ;
205  double t2 = m_timeBinning.meanUnmixedTime2(iTimeBin) ;
206  double rplus = m_hadronicPars.bin(iPhaseBin).R(t, t2, m_timeBinning.getLifetime(), m_zcp, m_dz) ;
207  double rminus = m_hadronicPars.bin(iPhaseBin).Rbar(t, t2, m_timeBinning.getLifetime(), m_zcp, m_dz) ;
208  double rdiff = rplus-rminus ;
209  rminusfit.SetBinContent(iTimeBin+1, rminus) ;
210  rminusfit.SetBinError(iTimeBin+1, 0.) ;
211  rplusfit.SetBinContent(iTimeBin+1, rplus) ;
212  rplusfit.SetBinError(iTimeBin+1, 0.) ;
213  rdifffit.SetBinContent(iTimeBin+1, rdiff) ;
214  rdifffit.SetBinError(iTimeBin+1, 0.) ;
215  }
216  binhistos.push_back(rminusfit) ;
217  binhistos.push_back(rplusfit) ;
218  binhistos.push_back(rdifffit) ;
219  ++iPhaseBin ;
220  }
221  return histos ;
222 }
TimeBinning m_timeBinning
Definition: BinFlipChi2.h:61
std::complex< double > m_zcp
Definition: BinFlipChi2.h:46
double meanUnmixedTime(unsigned) const
double meanUnmixedTime2(unsigned) const
const Bin & bin(IDalitzEvent &) const
Get the bin for a DalitzEvent.
std::complex< double > m_dz
Definition: BinFlipChi2.h:47
double getLifetime() const
std::deque< std::deque< TH1F > > plotsVsTime(const std::string &) const
double Rbar(double, double, double, const std::complex< double > &, const std::complex< double > &) const
HadronicParameters m_hadronicPars
Definition: BinFlipChi2.h:60
unsigned nBinsTime() const
double R(double, double, double, const std::complex< double > &, const std::complex< double > &) const
Get expected ratio of events (suppressed)/(favoured) at the given time for the given mixing parameter...

◆ savePlotsVsTime()

void BinFlipChi2::savePlotsVsTime ( const std::string &  ,
TFile &   
) const

Definition at line 224 of file BinFlipChi2.cpp.

224  {
225  outputfile.cd() ;
226  deque<deque<TH1F> > histos = plotsVsTime(name) ;
227  for(auto& binhistos : histos)
228  for(auto& histo : binhistos)
229  histo.Write() ;
230 }
std::deque< std::deque< TH1F > > plotsVsTime(const std::string &) const

Member Data Documentation

◆ m_hadronicPars

HadronicParameters BinFlipChi2::m_hadronicPars
private

Definition at line 60 of file BinFlipChi2.h.

◆ m_lifetime

double BinFlipChi2::m_lifetime
private

Definition at line 62 of file BinFlipChi2.h.

◆ m_timeBinning

TimeBinning BinFlipChi2::m_timeBinning
private

Definition at line 61 of file BinFlipChi2.h.


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