ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
LArSamples::ShapeFitter Class Reference

#include <ShapeFitter.h>

Collaboration diagram for LArSamples::ShapeFitter:

Public Member Functions

 ShapeFitter (Chi2Params chi2Params=DefaultChi2)
 
bool fit (const LArSamples::AbsShape &data, const AbsShape &reference, double &k, double &deltaT, double &chi2, const ScaledErrorData *sed=0) const
 
const Chi2Calcchi2Calc () const
 

Static Public Member Functions

static void adjusted_reference (Int_t &nPar, Double_t *grad, Double_t &f, Double_t *par, Int_t iflag)
 

Private Attributes

Chi2Calc m_c2c
 

Detailed Description

Definition at line 24 of file ShapeFitter.h.

Constructor & Destructor Documentation

◆ ShapeFitter()

LArSamples::ShapeFitter::ShapeFitter ( Chi2Params  chi2Params = DefaultChi2)
inline

Definition at line 28 of file ShapeFitter.h.

28 : m_c2c(chi2Params) { }

Member Function Documentation

◆ adjusted_reference()

void ShapeFitter::adjusted_reference ( Int_t &  nPar,
Double_t *  grad,
Double_t &  f,
Double_t *  par,
Int_t  iflag 
)
static

Definition at line 77 of file ShapeFitter.cxx.

78 {
79  double deltaT = par[0], k = 1;
80  //std::cout << "Eval at " << deltaT << std::endl;
81  if (!FitterData::fitter->chi2Calc().bestRescale(*FitterData::data, *FitterData::reference, k, f, deltaT,
83  //std::cout << "-> " << k << " " << deltaT << " " << f << std::endl;
84 }

◆ chi2Calc()

const Chi2Calc& LArSamples::ShapeFitter::chi2Calc ( ) const
inline

Definition at line 36 of file ShapeFitter.h.

36 { return m_c2c; }

◆ fit()

bool ShapeFitter::fit ( const LArSamples::AbsShape data,
const AbsShape reference,
double &  k,
double &  deltaT,
double &  chi2,
const ScaledErrorData sed = 0 
) const

Definition at line 32 of file ShapeFitter.cxx.

34 {
35  TMinuit* minuit = new TMinuit(1); //initialize TMinuit with 1 param
36  gMinuit->SetFCN(adjusted_reference);
37 
38  FitterData::fitter = this;
42 
43  double nData = (data.time(data.nPoints() - 1) - data.time(0))/Definitions::samplingInterval;
44  double nRef = (reference.time(data.nPoints() - 1) - reference.time(0))/Definitions::samplingInterval;
45 
46  FitterData::minNDof = (nData < nRef ? ((unsigned int)nData+1)/2 : ((unsigned int)nRef+1)/2); // we want at least n/2 samples in range
47  //std::cout << minNDof << std::endl;
48  Double_t arglist[10];
49  Int_t ierflg = 0;
50 
51  arglist[0] = -1;
52  gMinuit->mnexcm("SET PRINT",arglist,1,ierflg);
53  arglist[0] = 0;
54  gMinuit->mnexcm("SET NOW", arglist,0,ierflg);
55 
56  arglist[0] = 1;
57  minuit->mnexcm("SET ERR", arglist, 1, ierflg);
58  minuit->mnparm(0, "deltaT", 0, Definitions::samplingInterval/24, -5*(double)Definitions::samplingInterval, 5*(double)Definitions::samplingInterval, ierflg);
59 
60  arglist[0] = 500;
61  arglist[1] = 1.;
62  minuit->mnexcm("MIGRAD", arglist, 2, ierflg);
63 
64  Double_t edm, errdef;
65  Int_t nvpar, nparx, icstat;
66  minuit->mnstat(chi2, edm, errdef, nvpar, nparx, icstat);
67 
68  double err, low, high;
69  int iuint;
70  TString name;
71  minuit->mnpout(0, name, deltaT, err, low, high, iuint);
72  delete minuit;
73  return m_c2c.bestRescale(data, reference, k, chi2, deltaT, sed);
74 }

Member Data Documentation

◆ m_c2c

Chi2Calc LArSamples::ShapeFitter::m_c2c
private

Definition at line 40 of file ShapeFitter.h.


The documentation for this class was generated from the following files:
LArSamples::FitterData::fitter
const ShapeFitter * fitter
Definition: ShapeFitter.cxx:23
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
reference
Definition: hcg.cxx:437
LArSamples::ShapeFitter::adjusted_reference
static void adjusted_reference(Int_t &nPar, Double_t *grad, Double_t &f, Double_t *par, Int_t iflag)
Definition: ShapeFitter.cxx:77
python.compareTCTs.nRef
nRef
Definition: compareTCTs.py:115
LArSamples::Chi2Calc::bestRescale
bool bestRescale(const AbsShape &data, const AbsShape &reference, double &k, double &chi2, double deltaT=0, const ScaledErrorData *sed=0, unsigned int minNDof=0) const
Definition: Chi2Calc.cxx:88
LArSamples::FitterData::data
const AbsShape * data
Definition: ShapeFitter.cxx:24
LArSamples::FitterData::reference
const AbsShape * reference
Definition: ShapeFitter.cxx:25
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:522
hist_file_dump.f
f
Definition: hist_file_dump.py:135
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
LArSamples::FitterData::minNDof
unsigned int minNDof
Definition: ShapeFitter.cxx:27
LArSamples::ShapeFitter::m_c2c
Chi2Calc m_c2c
Definition: ShapeFitter.h:40
LArSamples::ShapeFitter::chi2Calc
const Chi2Calc & chi2Calc() const
Definition: ShapeFitter.h:36
LArSamples::FitterData::sed
const ScaledErrorData * sed
Definition: ShapeFitter.cxx:26
LArSamples::Definitions::samplingInterval
static const unsigned int samplingInterval
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:15
fitman.k
k
Definition: fitman.py:528