8 #include "CLHEP/Random/RandGaussQ.h" 9 #include "CLHEP/Random/RandPoissonQ.h" 10 #include "CLHEP/Units/GlobalPhysicalConstants.h" 76 const float ts2 = 10.;
77 const float ts3 = 29.3;
78 const float thpd = 4.;
79 const float tpre = 5.;
82 const float wd2 = 0.7;
87 int j, hpd_siz = (
int)(thpd);
88 std::vector<double> hpd_drift(hpd_siz);
89 for (
j = 0;
j < hpd_siz;
j++) {
90 double tmp = (double)
j + 0.5;
91 hpd_drift[
j] = 1.0 +
tmp / thpd;
95 for (
j = 0;
j < hpd_siz;
j++) {
100 int preamp_siz = (
int)(6 * tpre);
101 std::vector<double> preamp(preamp_siz);
103 for (
j = 0;
j < preamp_siz;
j++) {
104 double tmp = (double)
j + 0.5;
109 for (
j = 0;
j < preamp_siz;
j++) {
118 std::vector<double> scnt_decay(
tmax);
121 double tmp = (double)
j + 0.5;
123 norm += scnt_decay[
j];
127 scnt_decay[
j] /= norm;
130 int nsiz =
tmax + hpd_siz + preamp_siz + 1;
131 std::vector<double>
pulse(nsiz, 0.0);
136 for (
j = 0;
j < hpd_siz;
j++) {
138 for (
k = 0;
k < preamp_siz;
k++) {
140 float tmp = scnt_decay[
i] * hpd_drift[
j] * preamp[
k];
148 edm::LogVerbatim(
"HcalSim") <<
"HcalQie: Convoluted Shape ============== Normalisation " << norm;
149 for (
i = 0;
i < nsiz;
i++) {
160 unsigned int CodeFADCdata[122] = {
161 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
162 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
163 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66,
164 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
165 88, 89, 90, 91, 92, 93, 94, 95, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
166 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127};
168 std::vector<int>
temp(122);
170 for (
i = 0;
i < 122;
i++)
171 temp[
i] = (
int)CodeFADCdata[
i];
174 int siz =
temp.size();
176 for (
i = 0;
i < siz;
i++)
183 double ChargeFADCdata[122] = {
184 -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5,
185 12.5, 13.5, 14.5, 16.5, 18.5, 20.5, 22.5, 24.5, 26.5, 28.5, 31.5, 34.5, 37.5, 40.5,
186 44.5, 48.5, 52.5, 57.5, 62.5, 67.5, 72.5, 77.5, 82.5, 87.5, 92.5, 97.5, 102.5, 107.5,
187 112.5, 117.5, 122.5, 127.5, 132.5, 142.5, 152.5, 162.5, 172.5, 182.5, 192.5, 202.5, 217.5, 232.5,
188 247.5, 262.5, 282.5, 302.5, 322.5, 347.5, 372.5, 397.5, 422.5, 447.5, 472.5, 497.5, 522.5, 547.5,
189 572.5, 597.5, 622.5, 647.5, 672.5, 697.5, 722.5, 772.5, 822.5, 872.5, 922.5, 972.5, 1022.5, 1072.5,
190 1147.5, 1222.5, 1297.5, 1372.5, 1472.5, 1572.5, 1672.5, 1797.5, 1922.5, 2047.5, 2172.5, 2297.5, 2422.5, 2547.5,
191 2672.5, 2797.5, 2922.5, 3047.5, 3172.5, 3397.5, 3422.5, 3547.5, 3672.5, 3922.5, 4172.5, 4422.5, 4672.5, 4922.5,
192 5172.5, 5422.5, 5797.5, 6172.5, 6547.5, 6922.5, 7422.5, 7922.5, 8422.5, 9047.5};
194 std::vector<double>
temp(122);
196 for (
i = 0;
i < 122;
i++)
197 temp[
i] = (
double)(ChargeFADCdata[
i]);
200 int siz =
temp.size();
202 for (
i = 0;
i < siz;
i++)
203 edm::LogVerbatim(
"HcalSim") <<
"HcalQie: Charge[" << std::setw(3) <<
i <<
"] " << std::setw(8) <<
temp[
i];
209 std::vector<double>
temp(bucket, 0);
214 for (
i = 0;
i < npre;
i++) {
221 int siz =
temp.size();
222 edm::LogVerbatim(
"HcalSim") <<
"HcalQie: Weights in array of size " << siz <<
" and Npre " << npre;
223 for (
i = 0;
i < siz;
i++)
231 for (
unsigned int i = 0;
i <
code_.size();
i++) {
234 if (
i ==
code_.size() - 1)
248 for (
unsigned int i = 0;
i <
charge_.size();
i++) {
262 if (
k >= 0 &&
k < ((
int)(
shape_.size()) - 1))
268 std::vector<int>
HcalQie::getCode(
int nht,
const std::vector<CaloHit>& hitbuf, CLHEP::HepRandomEngine* engine) {
269 const double bunchSpace = 25.;
271 std::vector<double>
work(nmax);
283 double etot = 0, esum = 0,
photons = 0;
286 std::vector<const CaloHit*>
hits(nht);
287 std::vector<const CaloHit*>::iterator k1, k2;
289 for (
kk = 0;
kk < nht;
kk++) {
295 for (
kk = 0, k1 =
hits.begin(); k1 !=
hits.end();
kk++, k1++) {
296 double ehit = (**k1).e();
297 double jitter = (**k1).t();
299 for (k2 = k1 + 1; k2 !=
hits.end() && (jitter - (**k2).t()) < 1. && (jitter - (**k2).t()) > -1.; k2++) {
305 CLHEP::RandPoissonQ randPoissonQ(*engine, avpe);
306 double photo = randPoissonQ.fire();
310 edm::LogVerbatim(
"HcalSim") <<
"HcalQie::getCode: Hit " <<
kk <<
":" <<
kk + jump <<
" Energy deposit " << ehit
311 <<
" Time " << jitter <<
" Average and true no of PE " << avpe <<
" " << photo;
317 std::vector<double> binsum(nmax, 0);
318 double norm = 0, sum = 0.;
320 bintime += bunchSpace;
321 for (
int j = 0;
j < (
int)(bunchSpace);
j++) {
322 double tim = bintime +
j;
330 norm = (photo / (sum *
qToPE));
332 edm::LogVerbatim(
"HcalSim") <<
"HcalQie::getCode: PE " << photo <<
" Sum " << sum <<
" Norm. " << norm;
335 work[
i] += binsum[
i] * norm;
348 edm::LogVerbatim(
"HcalSim") <<
"HcalQie::getCode: Input " << etot <<
" GeV; Photons " <<
photons <<
"; Output " Log< level::Info, true > LogVerbatim
std::vector< double > shape()
T getParameter(std::string const &) const
HcalQie(edm::ParameterSet const &p)
double getShape(double time)
std::vector< double > weight_
double getEnergy(const std::vector< int > &)
std::vector< double > charge()
std::vector< double > charge_
static const double tmax[3]
double pulse(double x, double y, double z, double t)
std::vector< int > getCode(int, const std::vector< CaloHit > &, CLHEP::HepRandomEngine *)
std::vector< double > shape_
std::vector< double > weight(int binofmax, int mode, int npre, int numbucket)
std::vector< int > code()