19#include "CLHEP/Random/RandGaussZiggurat.h"
20#include "CLHEP/Random/RandomEngine.h"
35#include "GaudiKernel/IChronoStatSvc.h"
36#include "GaudiKernel/IIncidentSvc.h"
43using CLHEP::RandGaussZiggurat;
46constexpr double crossingTime = 25 ;
47constexpr double crossingRate = 1. / crossingTime;
62 ATH_MSG_INFO(
"***********************************************");
63 ATH_MSG_INFO(
"* Steering options for LArTTL1Maker algorithm *");
64 ATH_MSG_INFO(
"***********************************************");
70 "Electronic noise will be added in each TT for selected "
101 "NO calibration mode chosen for EM towers "
102 <<
" == technical option. Should not be used for physics !!! ");
109 "NO calibration mode chosen for HEC towers "
110 <<
" == technical option. Should not be used for physics !!! ");
112 ATH_MSG_DEBUG(
"standard calibration mode chosen for HEC towers ");
120 " In case of pileup, the trigger time subtraction is done in "
122 ATH_MSG_INFO(
" => LArTTL1Maker will not apply Trigger Time ");
144 return StatusCode::FAILURE;
151 ATH_MSG_DEBUG(
"Successfully retrieved LArEM helper from DetectorStore");
156 ATH_MSG_DEBUG(
"Successfully retrieved LArHEC helper from DetectorStore");
160 ATH_MSG_DEBUG(
"Successfully retrieved LArFCAL helper from DetectorStore");
165 SmartIF<IIncidentSvc> incSvc{service(
"IncidentSvc")};
185 return StatusCode::SUCCESS;
219 CLHEP::HepRandomEngine* rndmEngine = *rngWrapper;
252 ATH_CHECK(ttL1ContainerEm.
record(std::make_unique<LArTTL1Container>()));
255 ATH_CHECK(ttL1ContainerHad.
record(std::make_unique<LArTTL1Container>()));
257 std::unique_ptr<LArTTL1Container> truth_ttL1ContainerEm;
258 std::unique_ptr<LArTTL1Container> truth_ttL1ContainerHad;
260 truth_ttL1ContainerEm = std::make_unique<LArTTL1Container>();
261 truth_ttL1ContainerHad = std::make_unique<LArTTL1Container>();
266 unsigned int nbTT = (
unsigned int)
m_lvl1Helper->tower_hash_max();
268 std::vector<std::vector<float> >
270 std::vector<std::vector<float> >
272 sumEnergy.resize(nbTT);
273 sumEnergy2.resize(nbTT);
274 std::vector<float> ttSumE;
275 int ttSumEvecSize = 0;
278 ttSumEvecSize = 2 * crossingTime - 1;
279 refTime = crossingTime - 1;
285 << ttSumEvecSize <<
" reference time= " << refTime);
286 ttSumE.resize(ttSumEvecSize);
287 for (
unsigned int iTT = 0; iTT < nbTT; iTT++) {
288 sumEnergy[iTT] = ttSumE;
289 sumEnergy2[iTT] = ttSumE;
292 m_chronSvc->chronoStart(
"LArTTL1Mk hit loop ");
295 int it_end = hitmap->GetNbCells();
303 float outOfTimeE = 0.;
307 float printEthresh = 20.;
308 int nMissingGain = 0;
309 for (; it != it_end; ++it) {
310 const LArHitList& hitlist = hitmap->GetCell(it);
311 const std::vector<std::pair<float, float> >& timeE = hitlist.
getData();
312 if (!timeE.empty()) {
315 bool skipCell =
false;
320 if (!
m_ttSvc->is_in_lvl1(cellId))
337 const float cellSampFraction = fSampl->
FSAMPL(cellId);
338 const float inv_cellSampFraction = 1. / cellSampFraction;
352 std::vector<float> vecRG;
383 if (relGain < 0.001) {
386 <<
m_emHelper->show_to_string(cellId) <<
" (index "
387 << fcalHash <<
"), setting default value 1. ");
405 for (
const auto& first : timeE) {
406 float hitEnergy = first.first;
407 float hitTime = first.second - trigtime;
409 if (hitEnergy > printEthresh) {
413 <<
" energy= " << hitEnergy);
421 if (fabs(hitEnergy) > 1e+9) {
424 <<
" energy= " << hitEnergy);
435 iShift =
static_cast<int>(floor(
hitTime + 0.5));
439 iShift =
static_cast<int>(floor(
hitTime * crossingRate + 0.5));
444 int iTime = iShift + refTime;
448 if (iTime >= 0 && iTime < ttSumEvecSize) {
453 ttSumE = sumEnergy[ttHash];
455 hitEnergy * inv_cellSampFraction * sinTheta * relGain;
456 sumEnergy[ttHash] = ttSumE;
460 ttSumE = sumEnergy2[ttHash];
462 hitEnergy * inv_cellSampFraction * sinTheta * relGain;
463 sumEnergy2[ttHash] = ttSumE;
469 inTimeE += hitEnergy;
473 outOfTimeE += hitEnergy;
475 if (hitEnergy > printEthresh) {
477 ATH_MSG_DEBUG(
"Found a hit out of the timing window, hitTime= "
478 <<
hitTime <<
" with more than " << printEthresh
479 <<
" MeV: hitEnergy= " << hitEnergy <<
" MeV");
482 "Found a hit out of the timing window, hitTime= "
483 <<
hitTime <<
" with more than " << printEthresh
484 <<
" MeV: hitEnergy= " << hitEnergy <<
" MeV");
494 ATH_MSG_DEBUG(
"Number of missing relative FCAL gains for this event = "
496 if (inTimeE == 0 || nInTime == 0)
500 << outOfTimeE <<
" MeV"
501 <<
" represents " << 100. * outOfTimeE / inTimeE
502 <<
" % of in time energy for " << nOutOfTime <<
" ("
503 << 100. * nOutOfTime / nInTime <<
" %) hits");
504 if (outOfTimeE > 0.02 * inTimeE) {
506 << outOfTimeE <<
" MeV"
507 <<
" larger than 2% of in time energy = " << inTimeE
508 <<
" MeV; nb of out of time hits = " << nInTime <<
" ("
509 << (nInTime > 0 ? 100. * nOutOfTime / nInTime : 0)
514 m_chronSvc->chronoStop(
"LArTTL1Mk hit loop ");
515 m_chronSvc->chronoPrint(
"LArTTL1Mk hit loop ");
516 m_chronSvc->chronoStart(
"LArTTL1Mk TT loop ");
519 std::vector<std::string> emHadString(2);
520 emHadString[0] =
"ElectroMagnetic";
521 emHadString[1] =
"Hadronic";
523 std::vector<Identifier>::const_iterator itTt =
m_lvl1Helper->tower_begin();
524 std::vector<Identifier>::const_iterator itEnd =
m_lvl1Helper->tower_end();
531 for (; itTt != itEnd; ++itTt) {
555 std::vector<float> sumTTE = sumEnergy[ttHash];
556 std::vector<float> sumTTE2 = sumEnergy2[ttHash];
557 int nSpecialCase = 0;
560 for (
unsigned int i = 0; i < sumTTE.size(); ++i) {
561 if (fabs(sumTTE[i]) > 0.) {
568 for (
unsigned int i = 0; i < sumTTE2.size(); ++i) {
569 if (fabs(sumTTE2[i]) > 0.) {
580 analogSum =
computeSignal(towerId, Ieta, 0, sumTTE, refTime);
589 if (nSpecialCase > 1) {
591 " more than 1 special case, current Trigger Tower is "
592 << emHadString[emHad] <<
": "
593 <<
m_emHelper->show_to_string(towerId) <<
" ");
595 analogSum2 =
computeSignal(towerId, Ieta, 1, sumTTE2, refTime);
596 for (
int isamp = 0; isamp <
s_NBSAMPLES; isamp++) {
597 analogSum[isamp] += analogSum2[isamp];
603 << emHadString[emHad] <<
": "
604 <<
m_emHelper->show_to_string(towerId) <<
" ");
606 " transverse E (i.e. sum E / sampling fraction * sin_theta * rel "
607 "gain)= (at ref. time, before calib)"
608 << sumTTE[refTime] <<
" + " << sumTTE2[refTime]
609 <<
" (special cases) ");
610 }
else if (sumTTE[refTime] > 0.) {
612 << emHadString[emHad] <<
": "
613 <<
m_emHelper->show_to_string(towerId) <<
" ");
615 " [very low] transverse E (i.e. sum E / sampling fraction * "
616 "sin_theta * rel gain)= (at ref. time, before calib)"
617 << sumTTE[refTime] <<
" + " << sumTTE2[refTime]
618 <<
" (special cases) ");
634 fullSignal =
computeNoise(towerId, Ieta, analogSum, rndmEngine);
636 fullSignal = analogSum;
645 ATH_MSG_DEBUG(
" uncalibrated amplitudes around peak (+-3 time slots): "
646 << sumTTE[refTime - 3] <<
", " << sumTTE[refTime - 2]
647 <<
", " << sumTTE[refTime - 1] <<
", " << sumTTE[refTime]
648 <<
", " << sumTTE[refTime + 1] <<
", "
649 << sumTTE[refTime + 2] <<
", " << sumTTE[refTime + 3]);
651 << analogSum[0] <<
", " << analogSum[1] <<
", "
652 << analogSum[2] <<
", " << analogSum[3] <<
", "
653 << analogSum[4] <<
", " << analogSum[5] <<
", "
656 << analogSum[0] / analogSum[3] <<
", "
657 << analogSum[1] / analogSum[3] <<
", "
658 << analogSum[2] / analogSum[3] <<
", "
659 << analogSum[3] / analogSum[3] <<
", "
660 << analogSum[4] / analogSum[3] <<
", "
661 << analogSum[5] / analogSum[3] <<
", "
662 << analogSum[6] / analogSum[3]);
664 << fullSignal[0] <<
", " << fullSignal[1] <<
", "
665 << fullSignal[2] <<
", " << fullSignal[3] <<
", "
666 << fullSignal[4] <<
", " << fullSignal[5] <<
", "
668 if (
msgLvl(MSG::VERBOSE)) {
669 for (
unsigned int iTime = 0; iTime < sumTTE.size(); iTime++) {
671 << iTime <<
" hit energy = " << sumTTE[iTime]);
674 }
else if (sumTTE[refTime] > 0.) {
676 " uncalibrated amplitudes around peak (+-3 time slots): "
677 << sumTTE[refTime - 3] <<
", " << sumTTE[refTime - 2] <<
", "
678 << sumTTE[refTime - 1] <<
", " << sumTTE[refTime] <<
", "
679 << sumTTE[refTime + 1] <<
", " << sumTTE[refTime + 2] <<
", "
680 << sumTTE[refTime + 3]);
682 << analogSum[0] <<
", " << analogSum[1] <<
", "
683 << analogSum[2] <<
", " << analogSum[3] <<
", "
684 << analogSum[4] <<
", " << analogSum[5] <<
", "
687 << analogSum[0] / analogSum[3] <<
", "
688 << analogSum[1] / analogSum[3] <<
", "
689 << analogSum[2] / analogSum[3] <<
", "
690 << analogSum[3] / analogSum[3] <<
", "
691 << analogSum[4] / analogSum[3] <<
", "
692 << analogSum[5] / analogSum[3] <<
", "
693 << analogSum[6] / analogSum[3]);
695 << fullSignal[0] <<
", " << fullSignal[1] <<
", "
696 << fullSignal[2] <<
", " << fullSignal[3] <<
", "
697 << fullSignal[4] <<
", " << fullSignal[5] <<
", "
708 ttL1 =
new LArTTL1(ttChannel, towerId, fullSignal);
710 ttL1ContainerHad->push_back(ttL1);
712 ttL1ContainerEm->push_back(ttL1);
716 std::vector<float>
et(3);
717 et[0] = sumTTE[refTime - 1];
718 et[1] = sumTTE[refTime];
719 et[2] = sumTTE[refTime + 1];
722 truth_ttL1ContainerHad->push_back(truth_ttL1);
724 truth_ttL1ContainerEm->push_back(truth_ttL1);
733 m_chronSvc->chronoPrint(
"LArTTL1Mk TT loop ");
737 << ttL1ContainerEm->size() <<
" , "
738 << ttL1ContainerHad->size());
740 return StatusCode::SUCCESS;
754 ATH_MSG_INFO(
" LArTTL1Maker finalize completed successfully");
756 m_chronSvc->chronoPrint(
"LArTTL1Mk hit loop ");
757 m_chronSvc->chronoPrint(
"LArTTL1Mk TT loop ");
759 return StatusCode::SUCCESS;
764 const int specialCase,
765 std::vector<float> ttSumEnergy,
766 const int refTime)
const
785 int visEvecSize = std::ssize(ttSumEnergy);
791 if (emb || barrelEnd || emec) {
795 float calibCoeff = 0.;
807 if (calibCoeff < 0.001) {
810 <<
" setting default value 6. ");
817 for (
int iTime = 0; iTime < visEvecSize; iTime++) {
818 if (fabs(ttSumEnergy[iTime]) > 0.) {
821 ttSumEnergy[iTime] *= calibCoeff;
823 " ComputeSignal: applied EM calibration coefficient (iTime) "
824 << calibCoeff <<
" (" << iTime <<
") ");
829 float theEnergy = ttSumEnergy[iTime];
849 for (
int iSamp = 0; iSamp <
s_NBSAMPLES; iSamp++) {
856 static_cast<int>(floor(
hitTime * crossingRate + 0.5));
858 float dTime = (float)(
hitTime - crossingTime * time);
859 int j = iSamp - time;
862 (pulseShape[j] - pulseShapeDer[j] * dTime) * theEnergy;
865 int j = iSamp - iTime + refTime;
867 bareSignal[iSamp] += pulseShape[j] * theEnergy;
887 for (
int iTime = 0; iTime < visEvecSize; iTime++) {
888 float theEnergy = ttSumEnergy[iTime];
895 for (
int iSamp = 0; iSamp <
s_NBSAMPLES; iSamp++) {
901 int time =
static_cast<int>(floor(
hitTime * crossingRate + 0.5));
903 float dTime = (float)(
hitTime - crossingTime * time);
904 int j = iSamp - time;
907 (pulseShape[j] - pulseShapeDer[j] * dTime) * theEnergy;
910 int j = iSamp - iTime + refTime;
912 bareSignal[iSamp] += pulseShape[j] * theEnergy;
916 if (bareSignal[iSamp] > satEt) {
917 bareSignal[iSamp] = satEt;
928 int module = emOrHad + 1;
930 if (emOrHad && (Ieta == 3 || Ieta == 4)) {
939 for (
int iTime = 0; iTime < visEvecSize; iTime++) {
940 float theEnergy = ttSumEnergy[iTime];
944 theEnergy *= calibCoeff2[Ieta - 1];
948 for (
int iSamp = 0; iSamp <
s_NBSAMPLES; iSamp++) {
954 int time =
static_cast<int>(floor(
hitTime * crossingRate + 0.5));
956 float dTime = (float)(
hitTime - crossingTime * time);
957 int j = iSamp - time;
960 (pulseShape[j] - pulseShapeDer[j] * dTime) * theEnergy;
963 int j = iSamp - iTime + refTime;
965 bareSignal[iSamp] += pulseShape[j] * theEnergy;
980 const Identifier towerId,
const int Ieta, std::vector<float>& inputV,
981 CLHEP::HepRandomEngine* rndmEngine) {
996 float sigmaNoise = 0;
997 std::vector<float>* autoC =
nullptr;
998 std::vector<float> noiseRms(4);
1006 if (emb || barrelEnd || emec) {
1035 int module = emOrHad + 1;
1036 if (emOrHad && (Ieta == 3 || Ieta == 4)) {
1042 sigmaNoise = noiseRms[Ieta - 1];
1044 << sigmaNoise <<
" module= " << module <<
"Ieta= " << Ieta);
1051 if (fabs((*autoC)[0]) < 0.001) {
1053 <<
m_emHelper->show_to_string(towerId) <<
" "
1054 <<
"setting default values 1.00 0.10 -0.30 -0.20 "
1055 "-0.05 -0.01 -0.01 ");
1058 (*autoC)[2] = -0.30;
1059 (*autoC)[3] = -0.20;
1060 (*autoC)[4] = -0.05;
1061 (*autoC)[5] = -0.01;
1062 (*autoC)[6] = -0.01;
1064 if (sigmaNoise < 0.001) {
1066 <<
m_emHelper->show_to_string(towerId) <<
" "
1067 <<
"setting default value 300 MeV ");
1075 const float c11 = sigmaNoise * (*autoC)[0];
1076 const float c21 = sigmaNoise * (*autoC)[1];
1077 const float c31 = sigmaNoise * (*autoC)[2];
1078 const float c41 = sigmaNoise * (*autoC)[3];
1079 const float c51 = sigmaNoise * (*autoC)[4];
1080 const float c61 = sigmaNoise * (*autoC)[5];
1081 const float c71 = sigmaNoise * (*autoC)[6];
1083 const float c22 = sqrt(c11 * c11 - c21 * c21);
1084 const float inv_c22 = 1. / c22;
1085 const float c32 = (c21 * c11 - c21 * c31) * inv_c22;
1086 const float c33 = sqrt(c11 * c11 - c31 * c31 - c32 * c32);
1087 const float inv_c33 = 1. / c33;
1088 const float c42 = (c31 * c11 - c21 * c41) * inv_c22;
1089 const float c43 = (c21 * c11 - c31 * c41 - c32 * c42) * inv_c33;
1090 const float c44 = sqrt(c11 * c11 - c41 * c41 - c42 * c42 - c43 * c43);
1091 const float inv_c44 = 1. / c44;
1092 const float c52 = (c41 * c11 - c21 * c51) * inv_c22;
1093 const float c53 = (c31 * c11 - c31 * c51 - c32 * c52) * inv_c33;
1094 const float c54 = (c21 * c11 - c41 * c51 - c42 * c52 - c43 * c53) * inv_c44;
1096 sqrt(c11 * c11 - c51 * c51 - c52 * c52 - c53 * c53 - c54 * c54);
1097 const float inv_c55 = 1. / c55;
1098 const float c62 = (c51 * c11 - c21 * c61) * inv_c22;
1099 const float c63 = (c41 * c11 - c31 * c61 - c32 * c62) * inv_c33;
1100 const float c64 = (c31 * c11 - c41 * c61 - c42 * c62 - c43 * c63) * inv_c44;
1102 (c21 * c11 - c51 * c61 - c52 * c62 - c53 * c63 - c54 * c64) * inv_c55;
1103 const float c66 = sqrt(c11 * c11 - c61 * c61 - c62 * c62 - c63 * c63 -
1104 c64 * c64 - c65 * c65);
1105 const float c72 = (c61 * c11 - c21 * c71) * inv_c22;
1106 const float c73 = (c51 * c11 - c31 * c71 - c32 * c72) * inv_c33;
1107 const float c74 = (c41 * c11 - c41 * c71 - c42 * c72 - c43 * c73) * inv_c44;
1109 (c31 * c11 - c51 * c71 - c52 * c72 - c53 * c73 - c54 * c74) * inv_c55;
1111 (c21 * c11 - c61 * c71 - c62 * c72 - c63 * c73 - c64 * c74 - c65 * c75) /
1113 const float c77 = sqrt(c11 * c11 - c71 * c71 - c72 * c72 - c73 * c73 -
1114 c74 * c74 - c75 * c75 - c76 * c76);
1117 RandGaussZiggurat::shootArray(rndmEngine,
static_cast<int>(
s_NBSAMPLES), rndm,
1119 outputV[0] = inputV[0] + c11 * rndm[0];
1120 outputV[1] = inputV[1] + c21 * rndm[0] + c22 * rndm[1];
1121 outputV[2] = inputV[2] + c31 * rndm[0] + c32 * rndm[1] + c33 * rndm[2];
1123 inputV[3] + c41 * rndm[0] + c42 * rndm[1] + c43 * rndm[2] + c44 * rndm[3];
1124 outputV[4] = inputV[4] + c51 * rndm[0] + c52 * rndm[1] + c53 * rndm[2] +
1125 c54 * rndm[3] + c55 * rndm[4];
1126 outputV[5] = inputV[5] + c61 * rndm[0] + c62 * rndm[1] + c63 * rndm[2] +
1127 c64 * rndm[3] + c65 * rndm[4] + c66 * rndm[5];
1128 outputV[6] = inputV[6] + c71 * rndm[0] + c72 * rndm[1] + c73 * rndm[2] +
1129 c74 * rndm[3] + c75 * rndm[4] + c76 * rndm[5] + c77 * rndm[6];
1144 std::string barrel_endcap;
1146 float sinTheta = 0.;
1148 std::vector<float> noiseRms(3);
1149 std::vector<float> noiseRms4(4);
1152 std::string pulsedataname =
1154 if (pulsedataname.empty()) {
1156 return StatusCode::FAILURE;
1158 const char* pulsedatafile = pulsedataname.c_str();
1159 std::ifstream infile(pulsedatafile);
1163 return StatusCode::FAILURE;
1171 infile >> refEnergy >> pulseShape[0] >> pulseShape[1] >> pulseShape[2] >>
1172 pulseShape[3] >> pulseShape[4] >> pulseShape[5] >> pulseShape[6] >>
1173 pulseShape[7] >> pulseShape[8] >> pulseShape[9] >> pulseShape[10] >>
1174 pulseShape[11] >> pulseShape[12] >> pulseShape[13] >> pulseShape[14] >>
1175 pulseShape[15] >> pulseShape[16] >> pulseShape[17] >> pulseShape[18] >>
1176 pulseShape[19] >> pulseShape[20] >> pulseShape[21] >> pulseShape[22] >>
1180 infile >> pulseShapeDer[0] >> pulseShapeDer[1] >> pulseShapeDer[2] >>
1181 pulseShapeDer[3] >> pulseShapeDer[4] >> pulseShapeDer[5] >>
1182 pulseShapeDer[6] >> pulseShapeDer[7] >> pulseShapeDer[8] >>
1183 pulseShapeDer[9] >> pulseShapeDer[10] >> pulseShapeDer[11] >>
1184 pulseShapeDer[12] >> pulseShapeDer[13] >> pulseShapeDer[14] >>
1185 pulseShapeDer[15] >> pulseShapeDer[16] >> pulseShapeDer[17] >>
1186 pulseShapeDer[18] >> pulseShapeDer[19] >> pulseShapeDer[20] >>
1187 pulseShapeDer[21] >> pulseShapeDer[22] >> pulseShapeDer[23];
1198 infile >> barrel_endcap;
1203 infile >> Ieta >> sinTheta;
1205 infile >> noiseRms[0] >> noiseRms[1] >> noiseRms[2];
1213 infile >> barrel_endcap;
1218 infile >> Ieta >> sinTheta;
1220 infile >> noiseRms[0] >> noiseRms[1] >> noiseRms[2];
1230 ATH_MSG_INFO(
" 1 pulse shape per energy for EMB+EMEC : ");
1259 " Finished reading 1 calib coeff + 1 noise value per eta bin for EM: ");
1266 ATH_MSG_INFO(
"Ieta= " << ieta + 1 <<
", noise rms EMB: "
1277 if (pulsedataname.empty()) {
1279 return StatusCode::FAILURE;
1281 pulsedatafile = pulsedataname.c_str();
1282 infile.open(pulsedatafile);
1286 return StatusCode::FAILURE;
1330 infile >> autoCorr[0] >> autoCorr[1] >> autoCorr[2] >> autoCorr[3] >>
1331 autoCorr[4] >> autoCorr[5] >> autoCorr[6];
1351 "Finished reading calib coeff, noise rms, sat ene, auto corr for each "
1352 "eta bin for HEC: ");
1358 ATH_MSG_INFO(
" Ieta= " << ieta + 1 <<
", noise rms HEC: "
1377 if (pulsedataname.empty()) {
1379 return StatusCode::FAILURE;
1381 pulsedatafile = pulsedataname.c_str();
1382 infile.open(pulsedatafile);
1386 return StatusCode::FAILURE;
1395 for (
int iMod = 0; iMod < nMod; iMod++) {
1399 infile >> imod >> noiseRms4[0] >> noiseRms4[1] >> noiseRms4[2] >>
1404 infile >> pulseShape[0] >> pulseShape[1] >> pulseShape[2] >>
1405 pulseShape[3] >> pulseShape[4] >> pulseShape[5] >> pulseShape[6] >>
1406 pulseShape[7] >> pulseShape[8] >> pulseShape[9] >> pulseShape[10] >>
1407 pulseShape[11] >> pulseShape[12] >> pulseShape[13] >> pulseShape[14] >>
1408 pulseShape[15] >> pulseShape[16] >> pulseShape[17] >> pulseShape[18] >>
1409 pulseShape[19] >> pulseShape[20] >> pulseShape[21] >> pulseShape[22] >>
1414 infile >> pulseShapeDer[0] >> pulseShapeDer[1] >> pulseShapeDer[2] >>
1415 pulseShapeDer[3] >> pulseShapeDer[4] >> pulseShapeDer[5] >>
1416 pulseShapeDer[6] >> pulseShapeDer[7] >> pulseShapeDer[8] >>
1417 pulseShapeDer[9] >> pulseShapeDer[10] >> pulseShapeDer[11] >>
1418 pulseShapeDer[12] >> pulseShapeDer[13] >> pulseShapeDer[14] >>
1419 pulseShapeDer[15] >> pulseShapeDer[16] >> pulseShapeDer[17] >>
1420 pulseShapeDer[18] >> pulseShapeDer[19] >> pulseShapeDer[20] >>
1421 pulseShapeDer[21] >> pulseShapeDer[22] >> pulseShapeDer[23];
1434 std::vector<float> auxV(3);
1439 "Finished reading noise, calib coeff and pulse shape for each module for "
1441 for (
int iMod = 0; iMod < nMod; iMod++) {
1443 ATH_MSG_INFO(
" iMod= " << iMod <<
", noise rms FCAL (eta bin 1,2,3,4): "
1446 ATH_MSG_INFO(
" iMod= " << iMod <<
", calib coeff FCAL (eta bin 1,2,3,4): "
1481 if (pulsedataname.empty()) {
1482 ATH_MSG_ERROR(
"Could not locate Fcal_ptweights_table7.data file");
1483 return StatusCode::FAILURE;
1485 pulsedatafile = pulsedataname.c_str();
1486 infile.open(pulsedatafile);
1490 return StatusCode::FAILURE;
1499 const unsigned int colNum = 14;
1501 const unsigned int maxCell = 4;
1502 std::vector<std::string> TTlabel;
1503 TTlabel.resize(colNum);
1504 std::vector<float> gain;
1505 gain.resize(colNum);
1509 while (infile >> TTlabel[0] >> gain[0] >> TTlabel[1] >> gain[1] >>
1510 TTlabel[2] >> gain[2] >> TTlabel[3] >> gain[3] >> TTlabel[4] >>
1511 gain[4] >> TTlabel[5] >> gain[5] >> TTlabel[6] >> gain[6] >>
1512 TTlabel[7] >> gain[7] >> TTlabel[8] >> gain[8] >> TTlabel[9] >>
1513 gain[9] >> TTlabel[10] >> gain[10] >> TTlabel[11] >> gain[11] >>
1514 TTlabel[12] >> gain[12] >> TTlabel[13] >> gain[13]) {
1516 ATH_MSG_DEBUG(
" TTlabel[0], gain[0]= " << TTlabel[0] <<
", " << gain[0]);
1518 ATH_MSG_DEBUG(
" TTlabel[13], gain[13]= " << TTlabel[13] <<
", "
1528 for (
unsigned int icol = 0; icol < colNum; icol++) {
1540 std::string TTlab = TTlabel[icol];
1543 int eta = int(TTlab[0]) - 49;
1544 int phi = int(TTlab[1]) - 65;
1547 phi = (
phi < nPhi / 2 ? nPhi / 2 - 1 -
phi : 3 * nPhi / 2 - 1 -
phi);
1551 if (TTlab.size() > 3) {
1552 group = int(TTlab[3]) - 48;
1561 if ((layer == 1 && detZside > 0) || (layer == 0 && detZside < 0)) {
1562 if (
eta == 0 ||
eta == 2) {
1574 if (
eta == 1 ||
eta == 3) {
1595 std::vector<Identifier> cellIdVec =
m_ttSvc->createCellIDvecLayer(ttId);
1600 std::vector<unsigned int> hashVec;
1602 unsigned int nCell = 0;
1603 for (
unsigned int ichan = 0; ichan < cellIdVec.size(); ichan++) {
1618 hashVec.push_back(fcalHash);
1628 for (
unsigned int iCell = 0; iCell <
maxCell; iCell++) {
1629 unsigned int index0 = (group - 1) *
maxCell + iCell;
1630 if (index0 < nCell) {
1632 unsigned int index = hashVec[index0];
1645 ATH_MSG_INFO(
" FCAL gains file closed, extracted " << ngain <<
" gains");
1647 return StatusCode::SUCCESS;
1666 }
else if (region == 1 || region == 2) {
1672 }
else if (region == 3) {
float hitTime(const AFP_SIDSimHit &hit)
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
float et(const xAOD::jFexSRJetRoI *j)
A wrapper class for event-slot-local random engines.
SeedingOptionType
Options for seeding option=0 is setSeed as in MC20 option=1 is setSeedLegacy as in MC16 option=2 is s...
void setSeedLegacy(const std::string &algName, size_t slot, uint64_t ev, uint64_t run, uint64_t offset, SeedingOptionType seeding, EventContext::ContextEvt_t evt=EventContext::INVALID_CONTEXT_EVT)
Set the random seed using a string (e.g.
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
This class initializes the Calo (LAr and Tile) offline identifiers.
const CaloLVL1_ID * getLVL1_ID(void) const
virtual const float & FSAMPL(const HWIdentifier &id) const =0
This is a "hash" representation of an Identifier.
const LARLIST & getData() const
std::vector< std::vector< float > > m_noiseRmsFcal
auxiliary FCAL data: noise rms
std::vector< float > m_sinThetaEmec
auxiliary EMEC data: sin(theta)
std::vector< std::vector< float > > m_calibCoeffFcal
auxiliary FCAL data: calibration coefficients
SG::WriteHandleKey< LArTTL1Container > m_HadTTL1ContainerName
algorithm property: container name for the HAD TTL1s
SG::WriteHandleKey< LArTTL1Container > m_EmTTL1ContainerName
algorithm property: container name for the EM TTL1s
Gaudi::Property< bool > m_useLegacyRandomSeeds
virtual StatusCode finalize() override
Gaudi::Property< bool > m_useTriggerTime
Alorithm property: use trigger time or not.
std::vector< std::vector< float > > m_pulseShapeDerEm
auxiliary EM data: pulse shape derivative
std::vector< float > m_sinThetaEmb
auxiliary EMBarrel data: sin(theta)
virtual void handle(const Incident &) override
IChronoStatSvc * m_chronSvc
std::vector< float > computeNoise(const Identifier towerId, const int Ieta, std::vector< float > &inputV, CLHEP::HepRandomEngine *rndmEngine)
std::vector< std::vector< float > > m_pulseShapeDerFcal
auxiliary FCAL data: pulse shape derivatives
std::vector< std::vector< float > > m_pulseShapeFcal
auxiliary FCAL data: pulse shapes
std::vector< float > m_satEnergyHec
auxiliary HEC data: saturation energy
std::vector< float > computeSignal(const Identifier towerId, const int Ieta, const int specialCase, std::vector< float > visEnergy, const int refTime) const
initialize hit map
Gaudi::Property< std::string > m_truthHitsContainer
key for saving truth
const LArHEC_ID * m_hecHelper
pointer to the offline HEC helper
PublicToolHandle< CaloTriggerTowerService > m_ttSvc
const LArEM_ID * m_emHelper
pointer to the offline EM helper
SG::ReadHandleKey< LArHitEMap > m_hitMapKey
hit map
std::vector< std::vector< float > > m_autoCorrHec
auxiliary HEC data: auto-correlation matrix
std::vector< float > m_noiseRmsEmec
auxiliary EMEC data: noise rms
Gaudi::Property< std::vector< float > > m_calibCoeffFcalHad
auxiliary FCAL data: calibration coefficients
virtual StatusCode initialize() override
Read ascii files for auxiliary data (puslse shapes, noise, etc...)
std::vector< float > m_autoCorrEm
auxiliary EM data: auto-correlation matrix
const CaloLVL1_ID * m_lvl1Helper
pointer to the offline TT helper
static const short s_NBDEPTHS
number of sampling (in depth)
static const short s_MAXSAMPLES
max number of samples in pulse shape
std::vector< std::vector< float > > m_pulseShapeEm
auxiliary EM data: pulse shapes
Gaudi::Property< bool > m_PileUp
algorithm property: pile up or not
std::vector< float > m_sinThetaHec
auxiliary HEC data: sin(theta)
std::vector< float > m_refEnergyEm
auxiliary EM data: reference energies for saturation simulation
const LArFCAL_ID * m_fcalHelper
pointer to the offline FCAL helper
PublicToolHandle< ITriggerTime > m_triggerTimeTool
Alorithm property: name of the TriggerTimeTool.
std::vector< float > m_noiseRmsHec
auxiliary HEC data: noise rms
std::vector< float > m_pulseShapeDerHec
auxiliary HEC data: pulse shape derivative
Gaudi::Property< float > m_debugThresh
algorithm property: debug threshold
Gaudi::Property< std::string > m_randomStreamName
const CaloCell_ID * m_OflHelper
pointer to the offline id helper
StatusCode readAuxiliary()
method called at the begining of execute() to fill the hit map
Gaudi::Property< bool > m_chronoTest
algorithm property: switch chrono on
Gaudi::Property< bool > m_noEmCalibMode
algorithm property: no calibration mode for EM towers
std::vector< float > m_pulseShapeHec
auxiliary HEC data: pulse shape
static const short s_NBETABINS
number of eta bins
Gaudi::Property< std::vector< float > > m_calibCoeffEmec
auxiliary EMEC data: calibration coeeficient
Gaudi::Property< bool > m_NoiseOnOff
algorithm property: noise (in all sub-detectors) is on if true
Gaudi::Property< uint32_t > m_randomSeedOffset
std::array< SG::ReadHandleKey< LArHitContainer >, 4 > m_xxxHitContainerName
ServiceHandle< IAthRNGSvc > m_RandomSvc
Gaudi::Property< bool > m_noHadCalibMode
algorithm property: no calibration mode for had towers
std::vector< float > m_noiseRmsEmb
auxiliary EMBarrel data: noise rms
std::vector< float > m_cellRelGainFcal
auxiliary FCAL data: relative gains
static const short s_NBENERGIES
number of energies at which saturation is described (em)
SG::ReadCondHandleKey< ILArfSampl > m_fSamplKey
Sampling fractions retrieved from DB.
static const short s_NBSAMPLES
number of samples in TTL1s
std::vector< float > m_autoCorrFcal
auxiliary FCAL data: auto-correlation matrix
static const short s_PEAKPOS
peak position
virtual StatusCode execute() override
Create LArTTL1 object save in TES (2 containers: 1 EM, 1 hadronic)
Gaudi::Property< std::vector< float > > m_calibCoeffEmb
auxiliary EMBarrel data: calibration coefficient
Gaudi::Property< std::vector< float > > m_calibCoeffFcalEm
auxiliary FCAL data: calibration coefficients
int decodeInverse(int region, int eta)
Gaudi::Property< std::vector< float > > m_calibCoeffHec
auxiliary HEC data: calibration coefficients
Liquid Argon TT L1 sum class.
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Extra patterns decribing particle interation process.