25template <
typename DataT>
28 TFile fOut(outFileName,
"RECREATE");
29 fOut.WriteObject(
this, outName);
33template <
typename DataT>
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");
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);
73 LOGP(
debug,
"Processed TF {} at index {} with first TF {} and {} expected currents per TF. Remaining data {}", tfID, posIndex, mTFFirst, mNValuesPerTF, mRemainingData);
76template <
typename DataT>
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);
127template <
typename DataT>
131 const unsigned int totalTFs = (mTFLast - mTFFirst) + 1;
132 mNValuesPerTF = valuesPerTF;
133 const unsigned int nTotal = mNValuesPerTF * totalTFs;
134 mCurrents.resize(nTotal);
135 mRemainingData = nTotal;
136 LOGP(info,
"Init: Expecting {} packages with {} values per package with {} total values", mRemainingData, mNValuesPerTF, nTotal);
139template <
typename DataT>
144 <<
"currents=" << mCurrents
145 <<
"firstTF=" << mTFFirst
146 <<
"lastTF=" << mTFLast
147 <<
"remainingData=" << mRemainingData
148 <<
"valuesPerTF=" << mNValuesPerTF
152template <
typename DataT>
157 mTimeIntervals.clear();
160template <
typename DataT>
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());
179template <
typename DataT>
182 auto& cont = this->getSlots();
183 auto& slot = front ? cont.emplace_front(tstart, tend) : cont.emplace_back(tstart, tend);
std::vector< long > entries
calibrator class for accumulating integrated clusters
void initOutput() final
clearing all calibration objects in the output buffer
Slot & emplaceNewSlot(bool front, TFType tstart, TFType tend) final
Creates new time slot.
void finalizeSlot(Slot &slot) final
storing the integrated currents for given slot
class for accumulating integrated currents
void dumpToTree(const char *outFileName="ICTree.root")
void merge(const IntegratedClusters *prev)
merging TOF currents with previous interval
void print() const
print summary informations
void fill(const o2::calibration::TFType tfID, const DataT ¤tsContainer)
void dumpToFile(const char *outFileName="IntegratedClusters.root", const char *outName="IC") const
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...