22 m_ps(0), m_buf(0), m_DEBUG(false), m_rndm(nullptr) {
29 m_ps(ps), m_buf(buf), m_DEBUG(dd_DEBUG) {
47 double y =
y1 +
y2 + pedestal;
66 std::unique_ptr<TileSampleBuffer> bufall(
new TileSampleBuffer(nPul, -25*((nPul-1)/2), 25.));
69 cout <<
"Pileup pulses:" << std::endl;
70 for (std::vector<float>::const_iterator
i = amp_pu.begin();
i != amp_pu.end(); ++
i)
71 std::cout << *
i <<
' ';
72 std::cout << std::endl;
77 double tin, amp_it_out;
78 int nPul = amp_pu.size();
80 vector<float> amp_pu_out(nPul);
82 double amp_total = pedestal;
85 cout <<
"sample to compute: " <<
i <<
" " << amp_total << std::endl;
87 for (
int j = 0; j < nPul ; j++) {
92 cout <<
"pileupsample to compute " << j << std::endl;
94 cout <<
" time in " <<
i <<
" " << j <<
" " << (
x +
i - j) <<
" " <<
" buf " << bufall->
getTime(
x +
i - j) <<
" time_out " <<
t[j] << std::endl;
98 amp_pu_out[j] =
m_ps->
eval(
t[j]) * amp_pu.at(j);
99 amp_total += amp_pu_out[j];
102 cout <<
" amp_pu " << amp_pu.at(j) <<
" ps " <<
m_ps->
eval(
t[j]) <<
" amp_out " << amp_pu_out[j] << std::endl;
104 cout <<
" amp_total " << amp_total << std::endl;
108 amp_it_out =
m_ps->
eval(tin) * amp_it;
109 amp_total += amp_it_out;
112 cout <<
" INTIME amp_it " << amp_it <<
" ps " <<
m_ps->
eval(tin) <<
" amp_it_out " << amp_it_out << std::endl;
114 std::cout <<
" amp_total " << amp_total << std::endl;
122 cout <<
" FINAL " << amp_total << std::endl;
144 float amp_total[7] = { 0, 0, 0, 0, 0, 0, 0 };
146 const float Q_1pe = 17.;
147 const float tail_prob = 0.18;
149 for (
int i = 0;
i < 7;
i++) {
155 tail_Q = Q_1pe *
m_rndm->Binomial((
int) (amp_pu[
i] / Q_1pe), tail_prob);
157 amp_total[
i] += amp_pu[
i] - tail_Q;
159 amp_total[
i + 1] += tail_Q;
163 tail_Q = Q_1pe *
m_rndm->Binomial((
int) amp_it / Q_1pe, tail_prob);
165 amp_total[3] += amp_it - tail_Q;
166 amp_total[4] += tail_Q;
181 for (
unsigned int i = 0;
i < 7;
i++) {