9#include <cdc/utilities/CDCDedxHadSat.h>
16 B2INFO(
"\n\t Hadron Saturation: Using parameters from file --> " << infile);
19 fin.open(infile.c_str());
21 if (!fin.good()) B2FATAL(
"\tWARNING: CANNOT FIND parameters.txt!");
36 B2FATAL(
"No hadron correction parameters!");
51 double absCosTheta = fabs(cosTheta);
54 if (projection == 0) {
55 B2WARNING(
"Something wrong with dE/dx hadron constants!");
59 double chargeDensity = D / projection;
60 double numerator = 1 +
m_alpha * chargeDensity;
61 double denominator = 1 +
m_gamma * chargeDensity;
62 if (denominator == 0) {
63 B2WARNING(
"Something wrong with dE/dx hadron constants!");
66 double I = D *
m_ratio * numerator / denominator;
74 double absCosTheta = fabs(cosTheta);
77 if (projection == 0 ||
m_ratio == 0) {
78 B2WARNING(
"Something wrong with dE/dx hadron constants!");
81 double a =
m_alpha / projection;
85 if (b == 0 && a == 0) {
86 B2WARNING(
"both a and b coefficients for hadron correction are 0");
90 double discr = b * b - 4.0 * a * c;
92 B2WARNING(
"negative discriminant; return uncorrected value");
96 double D = (a != 0) ? (-b +
sqrt(discr)) / (2.0 * a) : -c / b;
98 B2WARNING(
"D is less 0! will try another solution");
99 D = (a != 0) ? (-b -
sqrt(discr)) / (2.0 * a) : -c / b;
101 B2WARNING(
"D is still less 0! just return uncorrected value");
109CDCDedxHadSat::D2I(
double cosTheta,
double D,
double alpha,
double gamma,
double delta,
double power,
double ratio)
const
112 double absCosTheta = fabs(cosTheta);
113 double projection = pow(absCosTheta, power) + delta;
114 if (projection == 0) {
115 B2INFO(
"\t HadronSaturation: D2I Something wrong with dE/dx hadron constants!");
119 double chargeDensity = D / projection;
120 double numerator = 1 + alpha * chargeDensity;
121 double denominator = 1 + gamma * chargeDensity;
122 if (denominator == 0) {
123 B2INFO(
"\t HadronSaturation: D2I Something wrong with dE/dx hadron constants!");
127 double I = D * ratio * numerator / denominator;
133CDCDedxHadSat::I2D(
double cosTheta,
double I,
double alpha,
double gamma,
double delta,
double power,
double ratio)
const
136 double absCosTheta = fabs(cosTheta);
137 double projection = pow(absCosTheta, power) + delta;
139 if (projection == 0 || ratio == 0) {
140 B2INFO(
"\t HadronSaturation: I2D Something wrong with dE/dx hadron constants!");
144 double a = alpha / projection;
145 double b = 1 - (gamma / projection) * (I / ratio);
146 double c = -1.0 * I / ratio;
148 if (b == 0 && a == 0) {
149 B2INFO(
"\t HadronSaturation: both a and b coefficients for hadron correction are 0");
153 double discr = b * b - 4.0 * a * c;
155 B2INFO(
"negative discriminant; return uncorrected value");
159 double D = (a != 0) ? (-b +
sqrt(discr)) / (2.0 * a) : -c / b;
162 B2INFO(
"D is less 0! will try another solution");
163 D = (a != 0) ? (-b -
sqrt(discr)) / (2.0 * a) : -c / b;
165 B2INFO(
"D is still less 0! just return uncorrected value");
double I2D(double cosTheta, double I) const
hadron saturation parameterization part 2
double D2I(double cosTheta, double D) const
hadron saturation parameterization part 1
void setParameters()
set the parameters
double m_delta
the delta parameter for the hadron saturation correction
DBObjPtr< CDCDedxHadronCor > m_DBHadronCor
db object for dE/dx hadron saturation parameters
double m_ratio
the ratio parameter for the hadron saturation correction
double m_gamma
the gamma parameter for the hadron saturation correction
double m_alpha
the alpha parameter for the hadron saturation correction
double m_power
the power parameter for the hadron saturation correction
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.