12 #include <klm/dbobjects/bklm/BKLMSimulationPar.h>
15 #include <framework/gearbox/GearDir.h>
16 #include <framework/logging/Logger.h>
24 BKLMSimulationPar::BKLMSimulationPar(
const GearDir& content)
29 BKLMSimulationPar::~BKLMSimulationPar()
33 void BKLMSimulationPar::read(
const GearDir& content)
36 B2FATAL(
"The GearDir to look for BKLM simulation parameters is not valid.");
40 double weight[c_MAX_NHIT];
42 for (
int div = 0; div <= c_NDIV; ++div) {
43 for (
int j = 0; j < c_MAX_NHIT; ++j) {
44 m_PhiMultiplicityCDF[div][j] = 1.0;
45 m_ZMultiplicityCDF[div][j] = 1.0;
49 m_HitTimeMax = content.getWithUnit(
"/HitTimeMax");
52 phiContent.
append(
"/RPCStripMultiplicity/Phi");
54 int nDiv = min(phiContent.
getNumberNodes(
"/Division"), c_NDIV + 1);
55 for (
int div = 0; div < nDiv; ++div) {
56 sprintf(name,
"/Division[@id=\"%d\"]", div);
60 int nWeight = min(divContent.
getNumberNodes(
"/Weight"), c_MAX_NHIT - 1);
62 for (
int j = 1; j <= nWeight; ++j) {
63 sprintf(name,
"/Weight[@multiplicity=\"%d\"]", j);
64 m_PhiWeight[div][j] = divContent.
getDouble(name);
65 weight[j] = divContent.
getDouble(name) + weight[j - 1];
66 weight[0] = weight[j];
68 for (
int j = 1; j < c_MAX_NHIT; ++j) {
69 m_PhiMultiplicityCDF[div][j] = (j <= nWeight ? weight[j] / weight[0] : 1.0);
74 zContent.
append(
"/RPCStripMultiplicity/Z");
77 for (
int div = 0; div < nDiv; ++div) {
78 sprintf(name,
"/Division[@id=\"%d\"]", div);
81 int nWeight = min(divContent.
getNumberNodes(
"/Weight"), c_MAX_NHIT - 1);
84 for (
int j = 1; j <= nWeight; ++j) {
85 sprintf(name,
"/Weight[@multiplicity=\"%d\"]", j);
86 m_ZWeight[div][j] = divContent.
getDouble(name);
87 weight[j] = divContent.
getDouble(name) + weight[j - 1];
88 weight[0] = weight[j];
90 for (
int j = 1; j < c_MAX_NHIT; ++j) {
91 m_ZMultiplicityCDF[div][j] = (j <= nWeight ? weight[j] / weight[0] : 1.0);
96 double BKLMSimulationPar::getPhiMultiplicityCDF(
double stripDiv,
int mult)
const
100 if (mult >= c_MAX_NHIT)
102 int stripIndex = (int) fabs(stripDiv * c_NDIV / 0.5);
103 if (stripIndex > c_NDIV)
105 return m_PhiMultiplicityCDF[stripIndex][mult];
108 double BKLMSimulationPar::getZMultiplicityCDF(
double stripDiv,
int mult)
const
112 if (mult >= c_MAX_NHIT)
114 int stripIndex = (int) fabs(stripDiv * c_NDIV / 0.5);
115 if (stripIndex > c_NDIV)
117 return m_ZMultiplicityCDF[stripIndex][mult];