24 (qoverpt > 0. ? 1. : -1.);
50 const double residual = (*resiter)[
kResidual];
53 if (fabs(residual) < 0.1) {
55 sum_xx += residual * residual;
72 const double residual = (*resiter)[
kResidual];
75 sum_xx += residual * residual;
86 const double residual = (*resiter)[
kResidual];
89 sum_xx += residual * residual;
96 std::vector<int> parNum;
97 std::vector<std::string> parName;
98 std::vector<double>
start;
99 std::vector<double>
step;
100 std::vector<double>
low;
101 std::vector<double>
high;
121 parNum.push_back(
kdEdx);
146 std::stringstream raw_name, narrowed_name, qoverpt_name, qoverpz_name, psquared_name;
147 raw_name <<
name <<
"_raw";
148 narrowed_name <<
name <<
"_narrowed";
149 qoverpt_name <<
name <<
"_qoverpt";
150 qoverpz_name <<
name <<
"_qoverpz";
151 psquared_name <<
name <<
"_psquared";
154 dir->make<TH1F>(raw_name.str().c_str(), (raw_name.str() +
std::string(
" (mrad)")).c_str(), 100, -100., 100.);
155 TH1F *narrowed_hist =
dir->make<TH1F>(
156 narrowed_name.str().c_str(), (narrowed_name.str() +
std::string(
" (mrad)")).c_str(), 100, -100., 100.);
157 TProfile *qoverpt_hist =
dir->make<TProfile>(
158 qoverpt_name.str().c_str(), (qoverpt_name.str() +
std::string(
" (mrad)")).c_str(), 100, -0.05, 0.05);
159 TProfile *qoverpz_hist =
dir->make<TProfile>(
160 qoverpz_name.str().c_str(), (qoverpz_name.str() +
std::string(
" (mrad)")).c_str(), 100, -0.05, 0.05);
161 TProfile *psquared_hist =
dir->make<TProfile>(
162 psquared_name.str().c_str(), (psquared_name.str() +
std::string(
" (mrad)")).c_str(), 100, -0.05, 0.05);
164 narrowed_name <<
"fit";
165 qoverpt_name <<
"fit";
166 qoverpz_name <<
"fit";
167 psquared_name <<
"fit";
169 double scale_factor = double(
numResiduals()) * (100. - -100.) / 100;
171 TF1 *narrowed_fit =
nullptr;
175 narrowed_fit->Write();
179 narrowed_fit->Write();
183 narrowed_fit->Write();
187 narrowed_fit->Write();
190 TF1 *qoverpt_fit =
new TF1(qoverpt_name.str().c_str(),
"[0]+x*[1]", -0.05, 0.05);
192 qoverpt_fit->Write();
194 TF1 *qoverpz_fit =
new TF1(qoverpz_name.str().c_str(),
"[0]+x*[1]", -0.05, 0.05);
196 qoverpz_fit->Write();
198 TF1 *psquared_fit =
new TF1(psquared_name.str().c_str(),
"[0]+[1]*x**2", -0.05, 0.05);
200 psquared_fit->Write();
203 const double raw_residual = (*resiter)[
kResidual];
204 const double qoverpt = (*resiter)[
kQoverPt];
205 const double qoverpz = (*resiter)[
kQoverPz];
206 const double psquared = (1. / qoverpt / qoverpt + 1. / qoverpz / qoverpz) * (qoverpt > 0. ? 1. : -1.);
210 double dEdx_correction =
value(
kdEdx) * psquared;
211 double corrected_residual = raw_residual - qoverpt_correction - qoverpz_correction - dEdx_correction;
213 raw_hist->Fill(raw_residual * 1000.);
214 narrowed_hist->Fill(corrected_residual * 1000.);
216 qoverpt_hist->Fill(qoverpt, (raw_residual - qoverpz_correction - dEdx_correction) * 1000.);
217 qoverpz_hist->Fill(qoverpz, (raw_residual - qoverpt_correction - dEdx_correction) * 1000.);
218 psquared_hist->Fill(psquared, (raw_residual - qoverpt_correction - qoverpz_correction) * 1000.);
double MuonResidualsFitter_logGaussPowerTails(double residual, double center, double sigma)
Double_t MuonResidualsFitter_powerLawTails_TF1(Double_t *xvec, Double_t *par)
int residualsModel() const
std::vector< double * >::const_iterator residuals_begin() const
MuonResidualsFitter * fitter()
long numResiduals() const
bool fit(Alignable *ali) override
std::vector< double * >::const_iterator residuals_end() const
bool dofit(void(*fcn)(int &, double *, double &, double *, int), std::vector< int > &parNum, std::vector< std::string > &parName, std::vector< double > &start, std::vector< double > &step, std::vector< double > &low, std::vector< double > &high)
double MuonResidualsFitter_logROOTVoigt(double residual, double center, double sigma, double gamma)
void inform(TMinuit *tMinuit) override
double plot(std::string name, TFileDirectory *dir, Alignable *ali) override
double MuonResidualsFitter_logPowerLawTails(double residual, double center, double sigma, double gamma)
Double_t MuonResidualsFitter_GaussPowerTails_TF1(Double_t *xvec, Double_t *par)
Double_t MuonResidualsFitter_pureGaussian_TF1(Double_t *xvec, Double_t *par)
static TMinuit * MuonResidualsBfieldAngleFitter_TMinuit
Double_t MuonResidualsFitter_ROOTVoigt_TF1(Double_t *xvec, Double_t *par)
void MuonResidualsBfieldAngleFitter_FCN(int &npar, double *gin, double &fval, double *par, int iflag)
int sum_x
More diagnostics.
double MuonResidualsFitter_logPureGaussian(double residual, double center, double sigma)