37 if (!currentsContainer.areSameSize()) {
38 LOGP(warning,
"Received data with different size. Returning");
42 if (currentsContainer.isEmpty()) {
43 LOGP(info,
"Empty data received. Returning");
48 const unsigned int entries = currentsContainer.getEntries();
54 if (mRemainingData == 0) {
55 LOGP(warning,
"All packages already received. Returning");
59 if (entries != mNValuesPerTF) {
60 LOGP(info,
"Received data with size {} expected size {} (expected size can be ignored if merging was performed)", entries, mNValuesPerTF);
63 const unsigned int posIndex = (tfID - mTFFirst) * mNValuesPerTF;
64 if (posIndex + entries > mCurrents.getEntries()) {
65 LOGP(warning,
"Index for TF {} is larger {} than expected max index {} with {} values per package", tfID, posIndex, mCurrents.getEntries(), mNValuesPerTF);
70 mCurrents.fill(posIndex, currentsContainer);
72 mRemainingData -= entries;
73 LOGP(
debug,
"Processed TF {} at index {} with first TF {} and {} expected currents per TF. Remaining data {}", tfID, posIndex, mTFFirst, mNValuesPerTF, mRemainingData);
79 LOGP(info,
"Printing last object...");
81 LOGP(info,
"Printing current object...");
84 const auto tfMin = std::min(mTFFirst, prev->mTFFirst);
85 const auto tfMax = std::max(mTFLast, prev->mTFLast);
87 if (prev->mInitialize) {
93 LOGP(info,
"Adding dummy data to front");
94 const unsigned int nDummyValues = mNValuesPerTF * ((prev->mTFLast - prev->mTFFirst) + 1);
95 mCurrents.insert(nDummyValues);
97 LOGP(info,
"Do not merge last object since it was not initialized. Adjusting TF range:");
105 initData(prev->mNValuesPerTF);
109 const unsigned int totalTFs = (tfMax - tfMin) + 1;
110 const unsigned int nTotal = mNValuesPerTF * totalTFs;
112 dataTmp.mInitialize =
false;
113 dataTmp.mNValuesPerTF = mNValuesPerTF;
114 dataTmp.mRemainingData = -1;
115 dataTmp.mCurrents.resize(nTotal);
118 dataTmp.
fill(mTFFirst, mCurrents);
119 dataTmp.
fill(prev->mTFFirst, prev->mCurrents);
121 dataTmp.mRemainingData = mRemainingData;
122 *
this = std::move(dataTmp);
123 LOGP(info,
"Merging done", totalTFs);
136 LOGP(info,
"Init: Expecting {} packages with {} values per package with {} total values", mRemainingData, mNValuesPerTF, nTotal);
163 const TFType startTF = slot.getTFStart();
164 const TFType endTF = slot.getTFEnd();
165 LOGP(info,
"Finalizing slot {} <= TF <= {}", startTF, endTF);
167 auto& integratedClusters = *slot.getContainer();
168 integratedClusters.setStartTime(slot.getStartTimeMS());
170 integratedClusters.dumpToFile(fmt::format(
"IntegratedClusters_TF_{}_{}_TS_{}_{}.root", startTF, endTF, slot.getStartTimeMS(), slot.getEndTimeMS()).data());
172 mCalibs.emplace_back(std::move(integratedClusters).getCurrents());
174 mIntervals.emplace_back(startTF, endTF);
175 mTimeIntervals.emplace_back(slot.getStartTimeMS(), slot.getEndTimeMS());