14#ifndef HADRONCORRECTION_H
15#define HADRONCORRECTION_H
31#include "TGraphErrors.h"
68 static void minuitFunction(
int& nDim,
double* gout,
double& result,
double* para,
int flg );
70 double D2I(
double cosTheta,
double D,
double alpha,
double gamma,
double delta,
double power,
double ratio )
const;
71 double I2D(
double cosTheta,
double I,
double alpha,
double gamma,
double delta,
double power,
double ratio )
const;
74 double D2I(
double cosTheta,
double D = 1 )
const {
76 double absCosTheta = fabs(cosTheta);
77 double projection = pow(absCosTheta, m_power) + m_delta;
78 double chargeDensity = D / projection;
79 double numerator = 1 + m_alpha * chargeDensity;
80 double denominator = 1 + m_gamma * chargeDensity;
82 double I = D * m_ratio * numerator / denominator;
87 double I2D(
double cosTheta,
double I = 1 )
const {
89 double absCosTheta = fabs(cosTheta);
90 double projection = pow(absCosTheta, m_power) + m_delta;
92 double a = m_alpha/projection;
93 double b = 1 - m_gamma/projection * (
I/m_ratio);
94 double c = -1.0 *
I/m_ratio;
96 if(
b == 0 && a == 0 ){
97 std::cout <<
"both a and b coefficiants for hadron correction are 0" << std::endl;
101 double D = (a != 0) ? (-
b + sqrt(
b *
b - 4.0 * a * c)) / (2.0 * a) : -c /
b;
103 std::cout <<
"D is less 0! will try another solution" << std::endl;
104 D = (a != 0) ? (-
b - sqrt(
b *
b + 4.0 * a * c)) / (2.0 * a) : -c /
b;
106 std::cout <<
"D is still less 0! just return uncorrectecd value" << std::endl;
129 std::vector< double > m_dedx;
130 std::vector< double > m_dedxerror;
131 std::vector< double > m_betagamma;
132 std::vector< double > m_costheta;
void printEvents(int firstevent, int nevents)
double myFunction(double alpha, double gamma, double delta, double power, double ratio)
double I2D(double cosTheta, double I, double alpha, double gamma, double delta, double power, double ratio) const
void setCosBins(int nbins)
void fillSample(TString infilename)
double D2I(double cosTheta, double D, double alpha, double gamma, double delta, double power, double ratio) const
double I2D(double cosTheta, double I=1) const
void setParameters(double par[])
virtual ~HadronSaturation()
double D2I(double cosTheta, double D=1) const
static void minuitFunction(int &nDim, double *gout, double &result, double *para, int flg)