9 #include <framework/datastore/StoreArray.h>
10 #include <framework/gearbox/Unit.h>
12 #include <ecl/geometry/ECLGeometryPar.h>
13 #include <ecl/dataobjects/ECLSimHit.h>
14 #include <ecl/dataobjects/ECLHit.h>
16 #include "trg/ecl/TrgEclDigitizer.h"
19 #include "trg//ecl/dataobjects/TRGECLDigi0.h"
20 #include "trg/ecl/dataobjects/TRGECLWaveform.h"
32 TrgEclDigitizer::TrgEclDigitizer():
33 TimeRange(0), _waveform(0), _FADC(1), _BeambkgTag(0)
41 for (
int iTCIdm = 0; iTCIdm < 576; iTCIdm++) {
44 for (
int iTime = 0; iTime < 80; iTime++) {
52 for (
int iii = 0; iii < 60 ; iii++) {
57 for (
int iii = 0; iii < 64 ; iii++) {
97 std::vector< std::vector<float> > E_cell(8736, std::vector<float>(80, 0.0));
98 std::vector< std::vector<float> > T_ave(8736, std::vector<float>(80, 0.0));
99 std::vector< std::vector<float> > Tof_ave(8736, std::vector<float>(80, 0.0));
100 std::vector< std::vector<float> > beambkg_tag(8736, std::vector<float>(80, 0.0));
107 if (TableFlag == 1) {
111 for (
int iHits = 0; iHits < nHits_hit; iHits++) {
113 ECLHit* aECLHit = eclHitArray[iHits];
117 int hitCellId = aECLHit->
getCellId() - 1;
120 if (aveT < - TimeRange || aveT >
TimeRange) {
continue;}
121 int TimeIndex = (int)((aveT +
TimeRange) / 100);
124 TCEnergy[iTCIdm][TimeIndex] += hitE;
125 TCTiming[iTCIdm][TimeIndex] += hitE * aveT;
130 for (
int iTCIdm = 0; iTCIdm < 576; iTCIdm++) {
131 for (
int iTime = 0; iTime < nBinTime; iTime++) {
132 if (
TCEnergy[iTCIdm][iTime] < 1e-9) {
continue;}
142 for (
int iXtalIdm = 0; iXtalIdm < 8736; iXtalIdm++) {
144 if (iTCIdm != iTCId) {
continue;}
145 if (maxbkgE < E_cell[iXtalIdm][iTime]) {
146 maxbkgE = E_cell[iXtalIdm][iTime];
147 maxbkgtag = beambkg_tag[iXtalIdm][iTime];
158 if (TableFlag == 2) {
166 for (
int iHits = 0; iHits < nHits; iHits++) {
170 int hitCellId = aECLSimHit->
getCellId() - 1;
174 G4ThreeVector t = aECLSimHit->
getPosIn();
175 ROOT::Math::XYZVector HitInPos(t.x(), t.y(), t.z());
176 ROOT::Math::XYZVector PosCell = eclp->
GetCrystalPos(hitCellId);
177 ROOT::Math::XYZVector VecCell = eclp->
GetCrystalVec(hitCellId);
178 float local_pos_r = 15.0 - (HitInPos - PosCell).Dot(VecCell);
179 if (hitTOF < - TimeRange || hitTOF >
TimeRange) {
continue;}
180 int TimeIndex = (int)((hitTOF +
TimeRange) / 100);
181 E_cell[hitCellId][TimeIndex] = E_cell[hitCellId][TimeIndex] + hitE;
182 T_ave[hitCellId][TimeIndex] = T_ave[hitCellId][TimeIndex] + hitE * local_pos_r;
183 Tof_ave[hitCellId][TimeIndex] = Tof_ave[hitCellId][TimeIndex] + hitE * hitTOF;
191 for (
int iECLCell = 0; iECLCell < 8736; iECLCell++) {
192 for (
int TimeIndex = 0; TimeIndex < nBinTime; TimeIndex++) {
194 if (E_cell[iECLCell][TimeIndex] < 1e-9) {
continue;}
196 T_ave[iECLCell][TimeIndex] = T_ave[iECLCell][TimeIndex] / E_cell[iECLCell][TimeIndex];
197 T_ave[iECLCell][TimeIndex] =
199 0.0749 * T_ave[iECLCell][TimeIndex] -
200 0.00112 * T_ave[iECLCell][TimeIndex] * T_ave[iECLCell][TimeIndex];
201 Tof_ave[iECLCell][TimeIndex] = Tof_ave[iECLCell][TimeIndex] / E_cell[iECLCell][TimeIndex];
208 for (
int iXtalIdm = 0; iXtalIdm < 8736; iXtalIdm++) {
210 for (
int iTime = 0; iTime < nBinTime; iTime++) {
211 if (E_cell[iXtalIdm][iTime] < 1e-9) {
continue;}
212 TCEnergy[iTCIdm][iTime] += E_cell[iXtalIdm][iTime];
213 TCTiming[iTCIdm][iTime] += E_cell[iXtalIdm][iTime] * (T_ave[iXtalIdm][iTime]);
214 if (beambkg_tag[iXtalIdm][iTime] > 0) {
TCBkgContribution[iTCIdm][iTime] += E_cell[iXtalIdm][iTime];}
215 if (beambkg_tag[iXtalIdm][iTime] == 0) {
TCSigContribution[iTCIdm][iTime] += E_cell[iXtalIdm][iTime];}
219 for (
int iTCIdm = 0; iTCIdm < 576; iTCIdm++) {
220 for (
int iTime = 0; iTime < nBinTime; iTime++) {
225 if (
TCEnergy[iTCIdm][iTime] < 1e-9) {
continue;}
231 for (
int iXtalIdm = 0; iXtalIdm < 8736; iXtalIdm++) {
233 if (iTCIdm != iTCId) {
continue;}
234 if (maxbkgE < E_cell[iXtalIdm][iTime]) {
235 maxbkgE = E_cell[iXtalIdm][iTime];
236 maxbkgtag = beambkg_tag[iXtalIdm][iTime];
250 if (TableFlag == 3) {
254 for (
int iHits = 0; iHits < nHits_hit; iHits++) {
256 ECLHit* aECLHit = eclHitArray[iHits];
258 int hitCellId = aECLHit->
getCellId() - 1;
262 if (aveT < - TimeRange || aveT >
TimeRange) {
continue;}
264 int TimeIndex = (int)((aveT +
TimeRange) / 100);
267 TCEnergy[iTCIdm][TimeIndex] += hitE;
268 TCTiming[iTCIdm][TimeIndex] += hitE * aveT;
274 double tcbg_t = ttt.getTimeAve();
278 int TimeIndex = (int)((tcbg_t +
TimeRange) / 100);
280 double tcbg_e = ttt.getEnergyDep();
282 int iTCIdm = ttt.getTCId() - 1;
284 double tc_e =
TCEnergy[iTCIdm][TimeIndex];
285 double tc_t =
TCTiming[iTCIdm][TimeIndex];
286 TCEnergy[iTCIdm][TimeIndex] += tcbg_e;
287 TCTiming[iTCIdm][TimeIndex] += (tcbg_e * tcbg_t + tc_e * tc_t) /
TCEnergy[iTCIdm][TimeIndex];
293 for (
int iTCIdm = 0; iTCIdm < 576; iTCIdm++) {
294 for (
int iTime = 40; iTime < 50; iTime++) {
307 std::vector<std::vector<double>>& TCDigiT)
310 TCDigiE.resize(576, vector<double>(64, 0));
312 TCDigiT.resize(576, vector<double>(64, 0));
315 double cut_energy_tot = 0.03;
316 int nbin_pedestal = 4;
317 double fam_sampling_interval = 125;
321 std::vector< std::vector<float> > noise_pileup(576, std::vector<float>(64, 0.0));
322 std::vector< std::vector<float> > noise_parallel(576, std::vector<float>(64, 0.0));
323 std::vector< std::vector<float> > noise_serial(576, std::vector<float>(64, 0.0));
324 std::vector<float> X_pr(64, 0.0);
325 std::vector<float> X_sr(64, 0.0);
329 double random_sampling_correction = 0;
330 random_sampling_correction = gRandom->Rndm() * fam_sampling_interval;
334 for (
int iTCIdm = 0; iTCIdm < 576; iTCIdm++) {
336 for (
int iTimeBin = 0; iTimeBin < 80; iTimeBin++) {
337 if (
TCEnergy[iTCIdm][iTimeBin] < 0.0001) {
continue;}
338 for (
int iSampling = 0; iSampling < NSampling; iSampling++) {
341 = (-
TCTiming[iTCIdm][iTimeBin] -
TimeRange + (-nbin_pedestal + iSampling) * fam_sampling_interval) * 0.001;
342 inputTiming += random_sampling_correction * 0.001;
343 if (inputTiming < 0 || inputTiming > 2.0) {
continue;}
346 TCDigiE[iTCIdm][iSampling] +=
interFADC(inputTiming) *
TCEnergy[iTCIdm][iTimeBin];
352 for (
int iSampling = 0; iSampling < NSampling; iSampling++) {
353 TCDigiT[iTCIdm][iSampling] = (-nbin_pedestal + iSampling -
TimeRange / fam_sampling_interval) * fam_sampling_interval;
354 TCDigiT[iTCIdm][iSampling] += random_sampling_correction;
362 FILE* f_out_dat = fopen(
"ztsim.no_noise.dat",
"w");
363 for (
int iTCIdm = 0; iTCIdm < 576; iTCIdm++) {
364 if (
TCEnergy_tot[iTCIdm] < cut_energy_tot) {
continue; }
365 fprintf(f_out_dat,
"%5i %8.5f %8.5f %8.1f ",
367 for (
int iSampling = 0; iSampling < NSampling; iSampling++) {
368 fprintf(f_out_dat,
"%7.4f ", TCDigiE[iTCIdm][iSampling]);
370 fprintf(f_out_dat,
"\n");
377 double tmin_noise = -4;
379 int bkg_level = 1030;
386 double frac_pileup = 0.035;
387 double frac_parallel = 0.023;
388 double frac_serial = 0.055;
389 double times_pileup = 1;
390 double times_parallel = 3.15;
391 double times_serial = 3.15;
393 double corr_pileup = times_pileup * frac_pileup *
sqrt(fam_sampling_interval * 0.001);
394 double corr_parallel = times_parallel * frac_parallel *
sqrt(fam_sampling_interval * 0.001);
395 double corr_serial = times_serial * frac_serial *
sqrt(fam_sampling_interval * 0.001);
399 for (
int iTCIdm = 0; iTCIdm < 576; iTCIdm++) {
400 if (
TCEnergy_tot[iTCIdm] < cut_energy_tot) {
continue; }
401 for (
int jjj = 0; jjj < bkg_level; jjj++) {
402 ttt0 = -(tmin_noise + tgen * gRandom->Rndm());
403 ttt1 = -(tmin_noise + tgen * gRandom->Rndm());
404 ttt2 = -(tmin_noise + tgen * gRandom->Rndm());
405 for (
int iSampling = 0; iSampling < NSampling; iSampling++) {
407 if (ttt0 > 0) { TCDigiE[iTCIdm][iSampling] +=
SimplifiedFADC(0, ttt0) * corr_pileup * 0.001; }
409 if (ttt1 > 0) { TCDigiE[iTCIdm][iSampling] +=
SimplifiedFADC(1, ttt1) * corr_parallel; }
411 if (ttt2 > 0) { TCDigiE[iTCIdm][iSampling] +=
SimplifiedFADC(2, ttt2) * corr_serial; }
412 ttt0 += fam_sampling_interval * 0.001;
413 ttt1 += fam_sampling_interval * 0.001;
414 ttt2 += fam_sampling_interval * 0.001;
420 for (
int iTCIdm = 0; iTCIdm < 576; iTCIdm++) {
422 if (
TCEnergy_tot[iTCIdm] < cut_energy_tot) {
continue; }
424 for (
int iSampling = 0; iSampling < NSampling; iSampling++) {
425 X_pr[iSampling] = gRandom ->Gaus(0, 1);
426 X_sr[iSampling] = gRandom ->Gaus(0, 1);
429 for (
int iSampling = 0; iSampling < NSampling; iSampling++) {
430 for (
int jSampling = 0; jSampling < NSampling; jSampling++) {
431 noise_parallel[iTCIdm][iSampling] += 10 * corr_parallel *
MatrixParallel[iSampling][jSampling] * X_pr[jSampling];
432 noise_serial[iTCIdm][iSampling] += 10 * corr_serial *
MatrixSerial[iSampling][jSampling] * X_sr[jSampling];
436 for (
int iSampling = 0; iSampling < NSampling; iSampling++) {
438 TCDigiE[iTCIdm][iSampling] += noise_pileup[iTCIdm][iSampling] + noise_parallel[iTCIdm][iSampling] +
439 noise_serial[iTCIdm][iSampling];
443 for (
int iTCIdm = 0; iTCIdm < 576; iTCIdm++) {
444 if (
TCEnergy_tot[iTCIdm] < cut_energy_tot) {
continue; }
445 for (
int jjj = 0; jjj < bkg_level; jjj++) {
446 ttt0 = -(tmin_noise + tgen * gRandom->Rndm());
447 for (
int iSampling = 0; iSampling < NSampling; iSampling++) {
449 if (ttt0 > 0) { TCDigiE[iTCIdm][iSampling] +=
SimplifiedFADC(0, ttt0) * corr_pileup * 0.001; }
450 ttt0 += fam_sampling_interval * 0.001;
459 for (
int iTCIdm = 0; iTCIdm < 576; iTCIdm++) {
460 for (
int iSampling = 0; iSampling < NSampling; iSampling++) {
461 WaveForm[iTCIdm][iSampling] = TCDigiE[iTCIdm][iSampling];
475 TCDigiE.resize(576, vector<double>(666, 0));
477 TCDigiT.resize(576, vector<double>(666, 0));
478 double cut_energy_tot = 0.03;
479 int nbin_pedestal = 100;
480 float fam_sampling_interval = 12;
482 std::vector< std::vector<float> > TCDigiEnergy(576, std::vector<float>(666, 0.0));
483 std::vector< std::vector<float> > TCDigiTiming(576, std::vector<float>(666, 0.0));
487 float random_sampling_correction = 0;
488 random_sampling_correction = gRandom->Rndm() * fam_sampling_interval;
489 for (
int iTCIdm = 0; iTCIdm < 576; iTCIdm++) {
491 for (
int iTimeBin = 0; iTimeBin < 80; iTimeBin++) {
492 if (
TCEnergy[iTCIdm][iTimeBin] < 0.0001) {
continue; }
493 for (
int iSampling = 0; iSampling < NSampling; iSampling++) {
496 = (-
TCTiming[iTCIdm][iTimeBin] -
TimeRange + (-nbin_pedestal + iSampling) * fam_sampling_interval) * 0.001;
498 inputTiming += random_sampling_correction * 0.001;
499 if (inputTiming < 0 || inputTiming > 2.0) {
continue;}
501 TCDigiEnergy[iTCIdm][iSampling] +=
FADC(0, inputTiming) *
TCEnergy[iTCIdm][iTimeBin];
504 for (
int iSampling = 0; iSampling < NSampling; iSampling++) {
505 TCDigiTiming[iTCIdm][iSampling] = (-nbin_pedestal + iSampling -
TimeRange / fam_sampling_interval) * fam_sampling_interval;
506 TCDigiTiming[iTCIdm][iSampling] += random_sampling_correction;
513 double tmin_noise = -4;
515 int bkg_level = 1030;
528 double corr_pileup = 0.011068;
529 double corr_parallel = 0.00727324;
530 double corr_serial = 0.0173925;
533 for (
int iTCIdm = 0; iTCIdm < 576; iTCIdm++) {
534 if (
TCEnergy_tot[iTCIdm] < cut_energy_tot) {
continue; }
535 for (
int jjj = 0; jjj < bkg_level; jjj++) {
536 ttt0 = -(tmin_noise + tgen * gRandom->Rndm());
537 ttt1 = -(tmin_noise + tgen * gRandom->Rndm());
538 ttt2 = -(tmin_noise + tgen * gRandom->Rndm());
539 for (
int iSampling = 0; iSampling < NSampling; iSampling++) {
541 if (ttt0 > 0) { TCDigiEnergy[iTCIdm][iSampling] +=
FADC(0, ttt0) * corr_pileup * 0.001; }
543 if (ttt1 > 0) { TCDigiEnergy[iTCIdm][iSampling] +=
FADC(1, ttt1) * corr_parallel; }
545 if (ttt2 > 0) { TCDigiEnergy[iTCIdm][iSampling] +=
FADC(2, ttt2) * corr_serial; }
546 ttt0 += fam_sampling_interval * 0.001;
547 ttt1 += fam_sampling_interval * 0.001;
548 ttt2 += fam_sampling_interval * 0.001;
564 for (
int iTCIdm = 0; iTCIdm < 576; iTCIdm++) {
565 for (
int iBinTime = 0; iBinTime < 80; iBinTime++) {
566 if (
TCEnergy[iTCIdm][iBinTime] < 0.001) {
continue;}
571 TCDigiArray[m_hitNum]->setEventId(m_nEvent);
572 TCDigiArray[m_hitNum]->setTCId(iTCIdm + 1);
573 TCDigiArray[m_hitNum]->setiBinTime(iBinTime);
574 TCDigiArray[m_hitNum]->setRawEnergy(
TCEnergy[iTCIdm][iBinTime]);
575 TCDigiArray[m_hitNum]->setRawTiming(
TCTiming[iTCIdm][iBinTime]);
576 TCDigiArray[m_hitNum]->setBeamBkgTag(
TCBeambkgTag[iTCIdm][iBinTime]);
582 for (
int iTCIdm = 0; iTCIdm < 576; iTCIdm++) {
583 if (iTCIdm == 80) iTCIdm = 512;
603 std::vector<double> SignalAmp;
604 std::vector<double> SignalTime;
609 timing = timing * 1000;
610 int startbin = (int)(timing) / 12;
611 int endbin = startbin + 1;
613 SignalAmp = { 0, 3.47505e-06, 0.000133173, 0.000939532, 0.00337321, 0.00845977, 0.0170396, 0.0296601, 0.0465713, 0.0677693, 0.0930545, 0.122086, 0.154429, 0.189595, 0.227068, 0.266331, 0.306882, 0.348243, 0.389971, 0.431664, 0.472959, 0.513539, 0.553127, 0.59149, 0.628431, 0.663791, 0.697445, 0.729297, 0.759281, 0.787354, 0.813494, 0.837698, 0.859982, 0.880372, 0.898908, 0.915639, 0.930622, 0.943919, 0.955598, 0.965731, 0.97439, 0.98165, 0.987587, 0.992275, 0.995788, 0.9982, 0.999581, 1, 0.999525, 0.998219, 0.996143, 0.993356, 0.989846, 0.985364, 0.979439, 0.971558, 0.961304, 0.948421, 0.932809, 0.914509, 0.893664, 0.870494, 0.845267, 0.818279, 0.789837, 0.76025, 0.729815, 0.698815, 0.667511, 0.636141, 0.604919, 0.574035, 0.543654, 0.513915, 0.484939, 0.456822, 0.429643, 0.403462, 0.378324, 0.354259, 0.331286, 0.309412, 0.288633, 0.26894, 0.250316, 0.232736, 0.216174, 0.200597, 0.185972, 0.172262, 0.159428, 0.147431, 0.136232, 0.12579, 0.116067, 0.107022, 0.0986191, 0.0908193, 0.0835871, 0.0768874, 0.0706867, 0.0649528, 0.0596551, 0.0547641, 0.0502523, 0.0460932, 0.042262, 0.0387353, 0.0354909, 0.0325082, 0.0297677, 0.0272511, 0.0249416, 0.0228232, 0.020881, 0.0191014, 0.0174714, 0.0159792, 0.0146138, 0.0133649, 0.012223, 0.0111793, 0.0102258, 0.00935504, 0.00856, 0.00783438, 0.00717232, 0.00656842, 0.00601773, 0.00551567, 0.00505807, 0.00464106, 0.00426114, 0.00391506, 0.00359985, 0.0033128, 0.00305143, 0.00281346, 0.00259681, 0.00239957, 0.00222002, 0.00205655, 0.00190773, 0.00177223, 0.00164885, 0.00153648, 0.00143413, 0.00134087, 0.00125589, 0.00117842, 0.00110777, 0.00104332, 0.000984488, 0.000930766, 0.000881678, 0.000836798, 0.000795734, 0.000758134, 0.000723677, 0.00069207, 0.000663051, 0.000636377, 0.000611832, 0.000589219, 0.000568358, 0.000549086, 0.000531258, 0.000514738, 0.000499407, 0.000485156, 0.000471884, 0.000459502, 0.00044793, 0.000437092, 0.000426923, 0.000417363, 0.000408356, 0.000399853, 0.000391811, 0.000384187, 0.000376946, 0.000370055, 0.000363483, 0.000357203, 0.000351192, 0.000345426, 0.000339886, 0.000334554, 0.000329413, 0.000324448, 0.000319645, 0.000314993, 0.000310481, 0.000306098, 0.000301836, 0.000297686, 0.00029364, 0.000289693, 0.000285837, 0.000282068, 0.00027838, 0.000274768, 0.000271229, 0.000267759, 0.000264354, 0.000261011, 0.000257727, 0.000254499, 0.000251326, 0.000248204, 0.000245132, 0.000242108, 0.000239131, 0.000236198, 0.000233308, 0.00023046, 0.000227653, 0.000224885, 0.000222155, 0.000219463, 0.000216807, 0.000214187, 0.000211602, 0.00020905, 0.000206532, 0.000204046, 0.000201593, 0.00019917, 0.000196779, 0.000194417, 0.000192085, 0.000189782, 0.000187508, 0.000185262, 0.000183044, 0.000180853, 0.000178689, 0.000176552, 0.000174441, 0.000172355, 0.000170295, 0.00016826, 0.000166249, 0.000164263, 0.000162301, };
615 SignalTime = { 0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 168, 180, 192, 204, 216, 228, 240, 252, 264, 276, 288, 300, 312, 324, 336, 348, 360, 372, 384, 396, 408, 420, 432, 444, 456, 468, 480, 492, 504, 516, 528, 540, 552, 564, 576, 588, 600, 612, 624, 636, 648, 660, 672, 684, 696, 708, 720, 732, 744, 756, 768, 780, 792, 804, 816, 828, 840, 852, 864, 876, 888, 900, 912, 924, 936, 948, 960, 972, 984, 996, 1008, 1020, 1032, 1044, 1056, 1068, 1080, 1092, 1104, 1116, 1128, 1140, 1152, 1164, 1176, 1188, 1200, 1212, 1224, 1236, 1248, 1260, 1272, 1284, 1296, 1308, 1320, 1332, 1344, 1356, 1368, 1380, 1392, 1404, 1416, 1428, 1440, 1452, 1464, 1476, 1488, 1500, 1512, 1524, 1536, 1548, 1560, 1572, 1584, 1596, 1608, 1620, 1632, 1644, 1656, 1668, 1680, 1692, 1704, 1716, 1728, 1740, 1752, 1764, 1776, 1788, 1800, 1812, 1824, 1836, 1848, 1860, 1872, 1884, 1896, 1908, 1920, 1932, 1944, 1956, 1968, 1980, 1992, 2004, 2016, 2028, 2040, 2052, 2064, 2076, 2088, 2100, 2112, 2124, 2136, 2148, 2160, 2172, 2184, 2196, 2208, 2220, 2232, 2244, 2256, 2268, 2280, 2292, 2304, 2316, 2328, 2340, 2352, 2364, 2376, 2388, 2400, 2412, 2424, 2436, 2448, 2460, 2472, 2484, 2496, 2508, 2520, 2532, 2544, 2556, 2568, 2580, 2592, 2604, 2616, 2628, 2640, 2652, 2664, 2676, 2688, 2700, 2712, 2724, 2736, 2748, 2760, 2772, 2784, 2796, 2808, 2820, 2832, 2844, 2856, 2868, 2880, 2892, 2904, 2916, 2928, };
619 if (timing < 0 || timing > 2928) {
return E_out;}
621 if (timing > SignalTime[startbin] && timing < SignalTime[endbin]) {
622 E_out = (((SignalAmp[endbin] - SignalAmp[startbin])) / (SignalTime[endbin] - SignalTime[startbin])) *
623 (timing - SignalTime[startbin]) + SignalAmp[startbin];
649 static double tc, tc2, tsc, tris, b1, b2;
650 static double amp, dft, as;
651 static double td, t1, t2;
676 while (flag_once == 0) {
677 double dt = tt / 1000;
679 for (
int j = 1; j <= 1000; j++) {
682 (
ShapeF(tc, t1, b1, t2, b2, td, tsc) -
683 ShapeF(tc, t1, b1, t2, b2, td, tris) * 0.01) -
684 (
ShapeF(tc2, t1, b1, t2, b2, td, tsc) -
685 ShapeF(tc2, t1, b1, t2, b2, td, tris) * 0.01) * as;
701 dt = tm * 0.02 / 1000;
717 (
ShapeF(timing, t1, b1, t2, b2, td, tsc) -
718 ShapeF(timing, t1, b1, t2, b2, td, tris) * 0.01) -
719 (
ShapeF(tc2, t1, b1, t2, b2, td, tsc) -
720 ShapeF(tc2, t1, b1, t2, b2, td, tris) * 0.01) * as);
721 }
else if (flag_gen == 1) {
726 ShapeF(timing, t1, b1, t2, b2, td, tsh) -
727 ShapeF(tc2, t1, b1, t2, b2, td, tsh) * as);
734 ShapeF(timing, t1, b1, t2, b2, td, tsh) -
735 ShapeF(tc2, t1, b1, t2, b2, td, tsh) * as);
738 if (tc < 0) { tc = 0; }
742 ShapeF(tc, t1, b1, t2, b2, td, tsh) -
743 ShapeF(tc2, t1, b1, t2, b2, td, tsh) * as) - pdf) / dd;
763 double das1, das0, dac0;
764 double dcs0s, dsn0s, dcs0d, dsn0d;
765 double dcs1s, dsn1s, dcs1d, dsn1d;
768 if (t00 < 0)
return 0;
770 dr = (ts1 - td1) / td1;
771 if (fabs(dr) <= 1.0e-5) {
772 if (ts1 > td1) { ts1 = td1 * 1.00001; }
773 else { ts1 = td1 * 0.99999; }
776 dr = (pow((t01 - t02), 2) + pow((tb1 - tb2), 2)) / (pow((t01), 2) + pow((tb1), 2));
778 if (t01 < t02) { t01 = t02 / 1.00001; }
779 else { t01 = t02 / 0.99999; }
781 if (t00 <= 0.0)
return 0;
792 das0 = b2 * (pow((b1 - a1), 2) + (b2 + a2) * (b2 - a2));
793 dac0 = -2 * (b1 - a1) * a2 * b2;
794 das1 = a2 * (pow((b1 - a1), 2) - (b2 + a2) * (b2 - a2));
796 dsn0s = ((c2 - a1) * das0 - (-a2) * dac0) / (pow(a2, 2) + pow((c2 - a1), 2));
797 dcs0s = ((-a2) * das0 + (c2 - a1) * dac0) / (pow(a2, 2) + pow((c2 - a1), 2));
799 dsn1s = ((c2 - b1) * das1 - (-b2) * (-dac0)) / (pow(b2, 2) + pow((c2 - b1), 2));
800 dcs1s = ((-b2) * das1 + (c2 - b1) * (-dac0)) / (pow(b2, 2) + pow((c2 - b1), 2));
802 dsn0d = ((c1 - a1) * das0 - (-a2) * dac0) / (pow(a2, 2) + pow((c1 - a1), 2));
803 dcs0d = ((-a2) * das0 + (c1 - a1) * dac0) / (pow(a2, 2) + pow((c1 - a1), 2));
805 dsn1d = ((c1 - b1) * das1 - (-b2) * (-dac0)) / (pow(b2, 2) + pow((c1 - b1), 2));
806 dcs1d = ((-b2) * das1 + (c1 - b1) * (-dac0)) / (pow(b2, 2) + pow((c1 - b1), 2));
810 dzna = (pow((b1 - a1), 2) + pow((b2 - a2), 2)) * (pow((b1 - a1), 2) + pow((a2 + b2), 2));
813 (dcs0s + dcs1s) * exp(-c2 * t00) * (-1) +
814 (dcs0d + dcs1d) * exp(-c1 * t00) +
815 ((dsn0s - dsn0d) * sin(a2 * t00) + (dcs0s - dcs0d) * cos(a2 * t00)) * exp(-a1 * t00) +
816 ((dsn1s - dsn1d) * sin(b2 * t00) + (dcs1s - dcs1d) * cos(b2 * t00)) * exp(-b1 * t00)
818 / dzna / (1 / c2 - 1 / c1);
843 static double tc, tc2, tsc, tris;
844 static double amp, dft, as;
853 const double td = 0.10;
854 const double t1 = 0.10;
856 const double t2 = 0.01;
873 while (flag_once == 0) {
874 double dt = tt / 1000;
877 for (
int j = 1; j <= 1000; j++) {
881 ShapeF(tc, tris) * 0.01) -
883 ShapeF(tc2, tris) * 0.01) * as;
899 dt = tm * 0.02 / 1000;
916 ShapeF(timing, tris) * 0.01) -
918 ShapeF(tc2, tris) * 0.01) * as);
919 }
else if (flag_gen == 1) {
936 if (tc < 0) { tc = 0; }
941 ShapeF(tc2, tsh) * as) - pdf) / dd;
951 static const double realNaN = std::numeric_limits<double>::quiet_NaN();
957 double a1, a2, b1, b2, c1, c2 =
realNaN;
960 if (t00 <= 0.0)
return 0;
989 dcs0s = -0.000204983;
1006 (dcs0s + dcs1s) * exp(-c2 * t00) * (-1) +
1007 (dcs0d + dcs1d) * exp(-c1 * t00) +
1008 ((dsn0s - dsn0d) * sin(a2 * t00) + (dcs0s - dcs0d) * cos(a2 * t00)) * exp(-a1 * t00) +
1009 ((dsn1s - dsn1d) * sin(b2 * t00) + (dcs1s - dcs1d) * cos(b2 * t00)) * exp(-b1 * t00)
1011 / dzna / (1 / c2 - 1 / c1);
1021 if (aaa > bbb) {
return aaa; }
1022 else {
return bbb; }
Class to store simulated hits which equate to average of ECLSImHit on crystals input for digitization...
double getTimeAve() const
Get average time.
int getCellId() const
Get Cell ID.
double getEnergyDep() const
Get deposit energy.
ClassECLSimHit - Geant4 simulated hit for the ECL.
int getCellId() const
Get Cell ID.
double getFlightTime() const
Get Flight time from IP.
double getEnergyDep() const
Get Deposit energy.
G4ThreeVector getPosIn() const
Get Position.
The Class for ECL Geometry Parameters.
static ECLGeometryPar * Instance()
Static method to get a reference to the ECLGeometryPar instance.
ROOT::Math::XYZVector GetCrystalPos(int cid)
The Position of crystal.
ROOT::Math::XYZVector GetCrystalVec(int cid)
The direction of crystal.
virtual unsigned short getBackgroundTag() const
Get background tag.
Accessor to arrays stored in the data store.
T * appendNew()
Construct a new T object at the end of the array.
int getEntries() const
Get the number of objects in the array.
int _FADC
Flag of choosing the method of waveform generation function 0: use simplifiedFADC,...
double TCTiming_tot[576]
TC Timing converted from Xtarl Timing [GeV].
virtual ~TrgEclDigitizer()
Destructor.
void save(int)
save fitting result into tables
double TCBkgContribution[576][80]
Beambackground contribution.
double WaveForm[576][64]
TC Energy converted from Xtarl Energy [GeV].
double TCRawTiming[576][60]
Input TC timing[ns]
double TCEnergy[576][80]
TC Energy converted from Xtarl Energy [GeV].
double TCSigContribution[576][80]
Signal contribution.
void setup()
setup fam module
std::vector< std::vector< double > > MatrixParallel
Noise Matrix of Parallel and Serial Noise.
TrgEclDataBase * _DataBase
Object of DataBase.
double TCTiming[576][80]
TC Timing converted from Xtarl Timing [GeV].
double TCRawBkgTag[576][60]
Input Beambackground tag
double interFADC(double)
Faster FADC using interpolation.
std::vector< std::vector< double > > MatrixSerial
Noise Low triangle Matrix of Serial noise
double TCRawEnergy[576][60]
Input TC energy[GeV].
double TimeRange
time range(default : -4000 ~ 4000 ns )
int _BeambkgTag
Flag of saving beam background tag or not.
double FADC(int, double)
FADC
double SimplifiedFADC(int, double)
FADC.
void digitization01(std::vector< std::vector< double >> &, std::vector< std::vector< double >> &)
fit method, digi with 125ns interval
double u_max(double, double)
Find max value between 2 vals;.
int _waveform
Flag of waveform table.
int TCBeambkgTag[576][80]
Beambackground tag.
double ShapeF(double, double, double, double, double, double, double)
return shape using FADC function
void getTCHit(int)
get TC Hits from Xtal hits
TrgEclMapping * _TCMap
Object of TC Mapping.
double TCEnergy_tot[576]
TC Energy converted from Xtarl Energy [GeV].
void digitization02(std::vector< std::vector< double >> &, std::vector< std::vector< double >> &)
original no fit method, digi with 12ns interval
int getTCThetaIdFromTCId(int)
get [TC Theta ID] from [TC ID]
int getTCIdFromXtalId(int)
get [TC ID] from [Xtal ID]
int getTCPhiIdFromTCId(int)
get [TC Phi ID] from [TC ID]
static const double ns
Standard of [time].
static const double GeV
Standard of [energy, momentum, mass].
static const double realNaN
constant for double NaN
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.