31 std::ifstream fin(
file.c_str());
34 return StatusCode::FAILURE;
41 std::array<unsigned int, 4096> sideALUTHG =
42 data[
"LucrodHighGain"][
"LUTs"][
"sideA"];
45 std::array<unsigned int, 4096> sideCLUTHG =
46 data[
"LucrodHighGain"][
"LUTs"][
"sideC"];
48 std::array<unsigned int, 256> combLUTHG =
49 data[
"LucrodHighGain"][
"LUTs"][
"comb"];
52 std::array<unsigned int, 4096> sideALUTLG =
53 data[
"LucrodLowGain"][
"LUTs"][
"sideA"];
56 std::array<unsigned int, 4096> sideCLUTLG =
57 data[
"LucrodLowGain"][
"LUTs"][
"sideC"];
59 std::array<unsigned int, 256> combLUTLG =
60 data[
"LucrodLowGain"][
"LUTs"][
"comb"];
63 const ZdcID *zdcId =
nullptr;
64 if (
detStore()->retrieve(zdcId).isFailure()) {
66 <<
"execute: Could not retrieve ZdcID object from the detector store"
68 return StatusCode::FAILURE;
70 msg(MSG::DEBUG) <<
"execute: retrieved ZdcID" <<
endmsg;
74 std::array<std::array<unsigned int, 4>, 2> deriv2ndHGThresh;
75 std::array<std::array<unsigned int, 4>, 2> deriv2ndLGThresh;
77 for (
unsigned int side : {0, 1}) {
78 for (
unsigned int module : {0, 1, 2, 3}) {
86 deriv2ndLGThresh[0][0] = 4095;
87 deriv2ndLGThresh[1][0] = 4095;
89 std::cout <<
"Trigger simulation will use sample indices: " <<
m_minSampleAna
95 sideALUTHG, sideCLUTHG, combLUTHG, deriv2ndHGThresh,
99 sideALUTLG, sideCLUTLG, combLUTLG, deriv2ndLGThresh,
108 return StatusCode::SUCCESS;
118 unsigned int trigAvgAHG = 0;
119 unsigned int trigAvgCHG = 0;
120 unsigned int trigAvgALG = 0;
121 unsigned int trigAvgCLG = 0;
124 std::array<std::array<std::array<unsigned int, 24>, 4>, 2> FADCSamplesHG;
125 std::array<std::array<std::array<unsigned int, 24>, 4>, 2> FADCSamplesLG;
130 std::vector<unsigned int> FADCFlattenedHG;
131 std::vector<unsigned int> FADCFlattenedLG;
141 uint32_t lucrod_id = zld->GetLucrodID();
144 for (
size_t i = 0; i < zld->GetChanDataSize(); i++) {
150 uint16_t lucrod_channel = zlc.
id;
155 lucrod_id)[
"type"][lucrod_channel];
165 lucrod_id)[
"side"][lucrod_channel];
167 lucrod_id)[
"module"][lucrod_channel];
169 lucrod_id)[
"gain"][lucrod_channel];
174 for (
const auto &sample : zlc.
waveform) {
176 FADCSamplesLG.at((side == 1)).at(module).at(
counter) = sample;
179 }
else if (gain == 1) {
181 for (
const auto &sample : zlc.
waveform) {
183 FADCSamplesHG.at((side == 1)).at(module).at(
counter) = sample;
189 if (side * gain * module == 3) {
190 trigAvgAHG = zld->GetTrigAvgA();
191 trigAvgCHG = zld->GetTrigAvgC();
192 }
else if (side * module == 3) {
193 trigAvgALG = zld->GetTrigAvgA();
194 trigAvgCLG = zld->GetTrigAvgC();
201 for (
int side : {1, 0}) {
202 for (
int module : {0, 1, 2, 3}) {
203 for (
const auto sample : FADCSamplesLG.at(side).at(module)) {
204 FADCFlattenedLG.push_back(sample);
209 for (
int side : {1, 0}) {
210 for (
int module : {0, 1, 2, 3}) {
211 for (
const auto sample : FADCSamplesHG.at(side).at(module)) {
212 FADCFlattenedHG.push_back(sample);
226 std::bitset<3> binhg(wordOutHG);
229 std::bitset<3> binlg(wordOutLG);
241 unsigned int word0 = 0;
242 word0 += (binhg[0] << 25);
243 word0 += (binhg[1] << 26);
244 word0 += (binhg[2] << 27);
247 unsigned int word1 = 0;
248 word1 += (binlg[0] << 28);
249 word1 += (binlg[1] << 29);
250 word1 += (binlg[2] << 30);
260 "Stored ZDC CTP object with words "
262 << std::hex << word0 <<
" from hgLUTOutput: " << std::dec << wordOutHG
263 <<
" AvgAmpA: " << trigAvgAHG <<
" C: " << trigAvgCHG << std::endl
264 << std::hex << word1 <<
" from lgLUTOutput: " << std::dec << wordOutLG
265 <<
" AvgAmpA: " << trigAvgALG <<
" C: " << trigAvgCLG);
266 return StatusCode::SUCCESS;