9 #include "TFitResult.h"
29 static const char*
const electron =
"electron";
30 static const char*
const positron =
"positron";
31 static const char*
const muon =
"muon";
32 static const char*
const tau =
"tau";
47 JFormFactor(
const double a,
60 double operator()(
const double T)
const
62 return c + T*(b + T*
a);
100 const double K = 0.307075;
102 const double gamma = E / M;
103 const double beta = sqrt((1.0 - 1.0/gamma) * (1.0 + 1.0/gamma));
105 const double a = 0.5/(E*
E);
106 const double b = beta*beta/Tmax;
107 const double c = 1.0;
109 const double W = 0.5 * K * (Z/
A) * (1.0/(beta*beta));
111 const double dT = Tmax - Tmin;
112 const double rT = Tmax / Tmin;
113 const double mT = Tmax * Tmin;
141 template<
class JFormFactor_t>
142 inline double getCount(
const double E,
148 const JFormFactor_t&
F,
149 const int N = 1000000)
155 const double K = 0.307075;
157 const double gamma = E / M;
158 const double beta = sqrt((1.0 + 1.0/gamma) * (1 - 1.0/gamma));
160 const double W = 0.5 * K * (Z/
A) * (1.0/(beta*beta));
162 const double xmin = 1.0/Tmax;
163 const double xmax = 1.0/Tmin;
164 const double dx = (xmax -
xmin) / ((
double)
N);
168 for (
double x = xmin;
x <=
xmax;
x += dx) {
170 const double T = 1.0/
x;
171 const double y = W *
F(T) * dx;
194 int main(
int argc,
char **argv)
214 JParser<> zap(
"Program to determine the energy loss due to visible delta-rays.");
218 zap[
'N'] =
make_field(use_numerical,
"perform numeric integration");
221 zap[
'A'] =
make_field(A,
"atomic mass") = 18.0;
222 zap[
'Z'] =
make_field(Z,
"atomic number") = 10.0;
229 catch(
const exception &error) {
230 FATAL(error.what() << endl);
233 if (option.find(
'R') == string::npos) { option +=
'R'; }
234 if (option.find(
'S') == string::npos) { option +=
'S'; }
241 else if (lepton == tau)
243 else if (lepton == positron)
248 FATAL(
"Invalid lepton " << lepton << endl);
250 const double Tmin = (T_GeV.is_valid() ?
255 const double error = 1.0e-12;
257 const double xmin =
log10(MASS_LEPTON);
258 const double xmax = 9.25;
260 TH1D h0(
"h0", NULL, 320, xmin, xmax);
261 TH1D h1(
"h1", NULL, 320, xmin, xmax);
263 for (
int i = 1;
i <= h0.GetNbinsX(); ++
i) {
265 const double x = h0.GetBinCenter(
i);
266 const double E =
pow(10.0,x);
272 if (T_GeV.is_valid()) { Tmax = T_GeV.constrain(Tmax); }
279 const double gamma = E / MASS_LEPTON;
280 const double beta = sqrt((1.0 + 1.0/gamma) * (1 - 1.0/gamma));
282 const JFormFactor
F(0.5/(E*E), -beta*beta/Tmax, 1.0);
296 DEBUG(
"dE/dx [MeV g^-1 cm^2] " <<
FIXED(5,4) << dEdx << endl);
297 DEBUG(
"dE/dx [g^-1 cm^2] " <<
FIXED(5,2) << dNdx << endl);
299 h0.SetBinContent(
i, dEdx);
300 h0.SetBinError (
i, error);
301 h1.SetBinContent(
i, dNdx);
306 TF1
f1(
"f1",
"[0] + [1]*x + [2]*x*x + [3]*x*x*x");
308 if (option.find(
'W') == string::npos) {
312 f1.SetParameter(0, h0.GetMinimum());
313 f1.SetParameter(1, (h0.GetMaximum() - h0.GetMinimum()) / (h0.GetXaxis()->GetXmax() - h0.GetXaxis()->GetXmin()));
314 f1.SetParameter(2, 0.0);
315 f1.SetParameter(3, 0.0);
317 f1.SetLineColor(kRed);
321 const TFitResultPtr
result = h0.Fit(&f1, option.c_str(),
"same",
xmin,
xmax);
323 cout <<
"chi2/NDF " << result->Chi2() <<
'/' << result->Ndf() << endl;
325 cout <<
"\t// " << lepton << endl;
326 cout <<
"\t// dE/dX = a + bx + cx^2 + dx^3; // [MeV g^-1 cm^2]; x = log10(E/GeV);" << endl;
328 for (
int i = 0;
i != 4; ++
i) {
329 cout <<
"\tstatic const double " << (char) (
'a' +
i) <<
" = " <<
SCIENTIFIC(10,3) << f1.GetParameter(
i) <<
";" << endl;
332 double Emin = 1 * MASS_LEPTON;
333 double Emax = 5 * MASS_LEPTON;
335 for (
double E = 0.5 * (Emin + Emax); ; E = 0.5 * (Emin + Emax)) {
339 if (fabs(Tmax - Tmin) < precision) {
340 cout <<
"\tstatic const double Emin = " <<
FIXED(7,5) << E <<
"; // [GeV]" << endl;
Utility class to parse command line options.
int main(int argc, char *argv[])
static const uint32_t K[64]
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
size_t getCount(const array_type< T > &buffer, const JCompare_t &compare)
Count number of unique values.
double getDeltaRayTmax(const double E, const double M)
Get maximum delta-ray kinetic energy for given lepton energy and mass.
double getDeltaRayTmin()
Get minimum delta-ray kinetic energy.
static const double MASS_MUON
muon mass [GeV]
then usage $script< input file >[option] nPossible options count
static const double DENSITY_SEA_WATER
Fixed environment values.
Auxiliary data structure for floating point format specification.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
Type definition of range.
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
set_variable E_E log10(E_{fit}/E_{#mu})"
static const double MASS_TAU
tau mass [GeV]
do set_variable OUTPUT_DIRECTORY $WORKDIR T
T pow(const T &x, const double y)
Power .
double getDeltaRays(const double E, const double M, const double Tmin, const double Tmax, const double Z, const double A)
Get equivalent EM-shower energy due to delta-rays per unit track length for an ionising particle with...
static const double MASS_ELECTRON
electron mass [GeV]
double getKineticEnergy(const Trk &trk)
Get track kinetic energy.
General purpose messaging.
$WORKDIR ev_configure_dqsimulator txt echo process $DQ_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DQ_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Auxiliary class to define a range between two values.
Utility class to parse command line options.
do set_variable MODULE getModule a $WORKDIR detector_a datx L $STRING JEditDetector a $WORKDIR detector_a datx M $MODULE setz o $WORKDIR detector_a datx JEditDetector a $WORKDIR detector_b datx M $MODULE setz o $WORKDIR detector_b datx done echo Output stored at $WORKDIR detector_a datx and $WORKDIR tripod_a txt JDrawDetector2D a $WORKDIR detector_a datx a $WORKDIR detector_b datx L BL o detector $FORMAT $BATCH JDrawDetector2D T $WORKDIR tripod_a txt T $WORKDIR tripod_b txt L BL o tripod $FORMAT $BATCH JCompareDetector a $WORKDIR detector_a datx b $WORKDIR detector_b datx o $WORKDIR abc root &dev null for KEY in X Y Z
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
Auxiliary data structure for floating point format specification.
then for LEPTON in muon tau positron electron
#define DEBUG(A)
Message macros.