29 std::ifstream fin(
file.c_str());
32 return StatusCode::FAILURE;
38 std::array<unsigned int, 4096> sideALUTHG =
39 data[
"LucrodHighGain"][
"LUTs"][
"sideA"];
41 std::array<unsigned int, 4096> sideCLUTHG =
42 data[
"LucrodHighGain"][
"LUTs"][
"sideC"];
44 std::array<unsigned int, 256> combLUTHG =
45 data[
"LucrodHighGain"][
"LUTs"][
"comb"];
47 std::array<unsigned int, 4096> sideALUTLG =
48 data[
"LucrodLowGain"][
"LUTs"][
"sideA"];
50 std::array<unsigned int, 4096> sideCLUTLG =
51 data[
"LucrodLowGain"][
"LUTs"][
"sideC"];
53 std::array<unsigned int, 256> combLUTLG =
54 data[
"LucrodLowGain"][
"LUTs"][
"comb"];
57 const ZdcID *zdcId =
nullptr;
58 if (
detStore()->retrieve(zdcId).isFailure()) {
60 <<
"execute: Could not retrieve ZdcID object from the detector store"
62 return StatusCode::FAILURE;
64 msg(MSG::DEBUG) <<
"execute: retrieved ZdcID" <<
endmsg;
68 std::array<std::array<unsigned int, 4>, 2> deriv2ndHGThresh;
69 std::array<std::array<unsigned int, 4>, 2> deriv2ndLGThresh;
71 for (
unsigned int side : {0, 1}) {
72 for (
unsigned int module : {0, 1, 2, 3}) {
80 deriv2ndLGThresh[0][0] = 4095;
81 deriv2ndLGThresh[1][0] = 4095;
83 std::cout <<
"Trigger simulation will use sample indices: " <<
m_minSampleAna
102 return StatusCode::SUCCESS;
112 unsigned int trigAvgAHG = 0;
113 unsigned int trigAvgCHG = 0;
114 unsigned int trigAvgALG = 0;
115 unsigned int trigAvgCLG = 0;
118 std::array<std::array<std::array<unsigned int, 24>, 4>, 2> FADCSamplesHG;
119 std::array<std::array<std::array<unsigned int, 24>, 4>, 2> FADCSamplesLG;
124 std::vector<unsigned int> FADCFlattenedHG;
125 std::vector<unsigned int> FADCFlattenedLG;
135 uint32_t lucrod_id = zld->GetLucrodID();
138 for (
size_t i = 0; i < zld->GetChanDataSize(); i++) {
144 uint16_t lucrod_channel = zlc.
id;
149 lucrod_id)[
"type"][lucrod_channel];
159 lucrod_id)[
"side"][lucrod_channel];
161 lucrod_id)[
"module"][lucrod_channel];
163 lucrod_id)[
"gain"][lucrod_channel];
168 for (
const auto &sample : zlc.
waveform) {
170 FADCSamplesLG.at((side == 1)).at(module).at(
counter) = sample;
173 }
else if (gain == 1) {
175 for (
const auto &sample : zlc.
waveform) {
177 FADCSamplesHG.at((side == 1)).at(module).at(
counter) = sample;
183 if (side * gain * module == 3) {
184 trigAvgAHG = zld->GetTrigAvgA();
185 trigAvgCHG = zld->GetTrigAvgC();
186 }
else if (side * module == 3) {
187 trigAvgALG = zld->GetTrigAvgA();
188 trigAvgCLG = zld->GetTrigAvgC();
195 for (
int side : {1, 0}) {
196 for (
int module : {0, 1, 2, 3}) {
197 for (
const auto sample : FADCSamplesLG.at(side).at(module)) {
198 FADCFlattenedLG.push_back(sample);
203 for (
int side : {1, 0}) {
204 for (
int module : {0, 1, 2, 3}) {
205 for (
const auto sample : FADCSamplesHG.at(side).at(module)) {
206 FADCFlattenedHG.push_back(sample);
220 std::bitset<3> binhg(wordOutHG);
223 std::bitset<3> binlg(wordOutLG);
235 unsigned int word0 = 0;
236 word0 += (binhg[0] << 25);
237 word0 += (binhg[1] << 26);
238 word0 += (binhg[2] << 27);
241 unsigned int word1 = 0;
242 word1 += (binlg[0] << 28);
243 word1 += (binlg[1] << 29);
244 word1 += (binlg[2] << 30);
254 "Stored ZDC CTP object with words "
256 << std::hex << word0 <<
" from hgLUTOutput: " << std::dec << wordOutHG
257 <<
" AvgAmpA: " << trigAvgAHG <<
" C: " << trigAvgCHG << std::endl
258 << std::hex << word1 <<
" from lgLUTOutput: " << std::dec << wordOutLG
259 <<
" AvgAmpA: " << trigAvgALG <<
" C: " << trigAvgCLG);
260 return StatusCode::SUCCESS;