5 #include "CLHEP/Random/RandFlat.h"
28 chain().shrink_to_fit();
43 float Ekin = truth->
Ekin();
48 float rnd = CLHEP::RandFlat::shoot(simulstate.
randomEngine());
65 int prevbin =
bin - 1;
71 if (!first_in_prevbin)
74 float logEkin = TMath::Log(Ekin);
75 float logEkin_nominal = TMath::Log(first_in_bin->
Ekin_nominal());
76 float logEkin_previous = TMath::Log(first_in_prevbin->
Ekin_nominal());
77 float numerator = logEkin - logEkin_previous;
78 float denominator = logEkin_nominal - logEkin_previous;
85 << logEkin <<
" logEkin_previous=" << logEkin_previous
86 <<
" logEkin_nominal=" << logEkin_nominal
87 <<
" (rnd=" << 1 - rnd
88 <<
" < p(previous)=" << (1 - numerator /
denominator)
89 <<
")? => orgbin=" << prevbin + 1 <<
" selbin=" <<
bin);
93 int nextbin =
bin + 1;
99 if (!first_in_nextbin)
102 float logEkin = TMath::Log(Ekin);
103 float logEkin_nominal = TMath::Log(first_in_bin->
Ekin_nominal());
104 float logEkin_next = TMath::Log(first_in_nextbin->
Ekin_nominal());
105 float numerator = logEkin - logEkin_nominal;
106 float denominator = logEkin_next - logEkin_nominal;
113 << logEkin <<
" logEkin_nominal=" << logEkin_nominal
114 <<
" logEkin_next=" << logEkin_next <<
" (rnd=" << rnd
116 <<
")? => orgbin=" << nextbin - 1 <<
" selbin=" <<
bin);
125 return std::string(Form(
"Ekin=%1.1f", truth->
Ekin()));
131 return std::string(Form(
"bin=%d not in [%1.1f<=Ekin<%1.1f)",
bin,
136 return std::string(Form(
"bin=%d, %1.1f<=Ekin(+random)<%1.1f",
bin,
163 chain.push_before_first_bin(param);
169 chain.push_back(param);
171 const int n_params = 5;
172 for (
int i = 2;
i < n_params; ++
i) {
178 chain.push_back_in_bin(param);
180 for (
int i = n_params;
i >= 1; --
i) {
186 chain.push_back_in_bin(param);
194 chain.push_back(param);
197 chain.push_before_first_bin(param);
202 truth->SetPtEtaPhiM(0.3, 0, 0, 0);
204 for (
double E = 1;
E < 10.1;
E += 1) {
206 truth->SetPtEtaPhiM(
E, 0, 0, 0);
210 truth->SetPtEtaPhiM(100, 0, 0, 0);
214 chain.set_DoRandomInterpolation();
215 for (
double E = 15;
E < 35.1;
E += 4) {
217 truth->SetPtEtaPhiM(
E, 0, 0, 0);
218 for (
int i = 0;
i < 10; ++
i)