6 binflipChi2::binflipChi2(vector<complex<double> > X, vector<double> r, vector<double> tAv, vector<double> tSqAv, TH2F pHistD0,
7 TH2F pHistD0bar, TH2F nHistD0, TH2F nHistD0bar,
double ReZcp,
double ImZcp,
double ReDz,
double ImDz,
double stepSize,
8 int fakeData, vector<double> Fm, vector<double> Fp,
int verbosity):
16 m_pHistD0bar(pHistD0bar),
18 m_nHistD0bar(nHistD0bar),
19 m_ReZcp(
"ReZcp",
FitParameter::FIT, ReZcp, stepSize, 0, 0, getParSet()),
20 m_ImZcp(
"ImZcp",
FitParameter::FIT, ImZcp, stepSize, 0, 0, getParSet()),
21 m_ReDz(
"ReDz",
FitParameter::FIT, ReDz, stepSize, 0, 0, getParSet()),
22 m_ImDz(
"ImDz",
FitParameter::FIT, ImDz, stepSize, 0, 0, getParSet()),
26 m_verbosity(verbosity)
46 vector<vector<TGraph> > fits(2);
52 double* Rvals_pl = fits[0][b-1].GetY();
53 double* Rvals_mi = fits[1][b-1].GetY();
57 double R_pl = Rvals_pl[j-1];
58 double R_mi = Rvals_mi[j-1];
59 double D0_term = 0, D0bar_term = 0;
60 double D0_num = 0, D0_den = 0, D0bar_num = 0, D0bar_den = 0;
64 D0_den = pow(
m_nHistD0.GetBinError(j,b), 2) + pow(
m_pHistD0.GetBinError(j,b) * R_pl, 2);
66 D0_term = D0_num/D0_den;
74 D0bar_term = D0bar_num/D0bar_den;
78 chi2 += D0_term + D0bar_term;
91 cout <<
"Number of terms contributing to chi2 is: " << count << endl;
100 vector<vector<TGraph> > fits(2);
109 fits[i].push_back( temp );
112 double numerator = 0., denominator = 0.;
114 numerator =
m_r[b-1] * ( 1 + 0.25 *
m_tSqAv[j-1] * ( pow(zcp,2) - pow(deltaz,2) ).real() );
115 numerator += 0.25 *
m_tSqAv[j-1] * pow(abs(zcp + (
double)pow(-1, i) * deltaz), 2);
116 numerator += sqrt(
m_r[b-1]) *
m_tAv[j-1] * ( conj(
m_X[b-1]) * (zcp + (double)pow(-1, i) * deltaz) ).real();
118 denominator = 1 + 0.25 *
m_tSqAv[j-1] * ( pow(zcp,2) - pow(deltaz,2) ).real();
119 denominator +=
m_r[b-1] * 0.25 *
m_tSqAv[j-1] * pow(abs(zcp + (
double)pow(-1, i) * deltaz), 2);
120 denominator += sqrt(
m_r[b-1]) *
m_tAv[j-1] * (
m_X[b-1] * (zcp + (double)pow(-1, i) * deltaz) ).real();
122 double Rval = numerator/denominator;
123 fits[i][b-1].SetPoint(j-1,
m_tAv[j-1], Rval);
138 complex<double> qoverp = sqrt( (zcp + deltaz) / (zcp - deltaz) );
139 complex<double> z = sqrt( pow(zcp,2) - pow(deltaz,2) );
143 complex<double> pqterm;
145 pqterm = ((double)-1)*qoverp;
148 pqterm = ((double)-1)*pow(qoverp, -1);
155 double pval = 0., nval = 0., rNum = 0., err = 0.;
157 pval =
m_Fp[b-1] * ( 1 + 0.25 *
m_tSqAv[j-1] * ( pow(z, 2) ).real() );
158 pval += 0.25 *
m_tSqAv[j-1] * pow(abs(z), 2) * pow(abs(pqterm), 2) *
m_Fm[b-1];
159 pval +=
m_tAv[j-1] * sqrt(
m_Fm[b-1] *
m_Fp[b-1]) * (pqterm *
m_X[b-1] * z).real();
161 nval =
m_Fm[b-1] * ( 1 + 0.25 *
m_tSqAv[j-1] * ( pow(z, 2) ).real() );
162 nval += 0.25 *
m_tSqAv[j-1] * pow(abs(z), 2) * pow(abs(pqterm), 2) *
m_Fp[b-1];
163 nval +=
m_tAv[j-1] * sqrt(
m_Fm[b-1] *
m_Fp[b-1]) * (pqterm * conj(
m_X[b-1]) * z).real();
173 rNum = rndm.Gaus(0, err);
174 m_pHistD0.SetBinContent(j, b, pval + rNum);
185 rNum = rndm.Gaus(0, err);
186 m_nHistD0.SetBinContent(j, b, nval + rNum);
198 rNum = rndm.Gaus(0, err);
210 rNum = rndm.Gaus(0, err);
binflipChi2(vector< complex< double > > X, vector< double > r, vector< double > tAv, vector< double > tSqAv, TH2F pHistD0, TH2F pHistD0bar, TH2F nHistD0, TH2F nHistD0bar, double ReZcp, double ImZcp, double ReDz, double ImDz, double stepSize, int fakeData=0, vector< double > Fm=vector< double >(), vector< double > Fp=vector< double >(), int verbosity=0)
TGraph getFit(int i, int b)
vector< vector< TGraph > > getFits()
MinuitParameterSet * getParSet()
virtual double getCurrentFitVal() const
vector< complex< double > > m_X