16#include <fairlogger/Logger.h>
29TRUElectronics::TRUElectronics(
int patchSize,
int whichSide,
int whichSuperModuleSize) : mPatchSize(patchSize), mWhichSide(whichSide), mWhichSuperModuleSize(whichSuperModuleSize)
71 int rowSeed = patchID / 7;
72 int columnSeed = patchID % 7;
73 int SeedID = rowSeed + patchID;
77 int rowSeed = patchID / 7;
78 int columnSeed = patchID % 7;
79 int SeedID = 95 - (rowSeed + patchID);
88 int rowSeed = patchID / 23;
89 int columnSeed = patchID % 23;
90 int SeedID = rowSeed + patchID;
94 int rowSeed = patchID / 23;
95 int columnSeed = patchID % 23;
96 int SeedID = 95 - (rowSeed + patchID);
105 for (
int i = 0;
i < 77;
i++) {
111 for (
int i = 0;
i < 69;
i++) {
122 for (
int i = 0;
i < 77;
i++) {
127 mIndexMapPatchID =
i;
128 mFiredFastOrIndexMapPatchID =
i;
130 mPreviousTimebinADCvalueID =
i;
135 for (
int iRow = 0; iRow <
mPatchSize; iRow++) {
136 for (
int iColumn = 0; iColumn <
mPatchSize; iColumn++) {
138 IndexMapPatch.push_back(SeedID + iRow + iColumn * 8);
144 for (
int iRow = 0; iRow <
mPatchSize; iRow++) {
145 for (
int iColumn = 0; iColumn <
mPatchSize; iColumn++) {
147 IndexMapPatch.push_back(SeedID - iRow - iColumn * 8);
155 for (
int i = 0;
i < 69;
i++) {
160 mIndexMapPatchID =
i;
161 mFiredFastOrIndexMapPatchID =
i;
163 mPreviousTimebinADCvalueID =
i;
168 for (
int iRow = 0; iRow <
mPatchSize; iRow++) {
169 for (
int iColumn = 0; iColumn <
mPatchSize; iColumn++) {
171 IndexMapPatch.push_back(SeedID + iRow + iColumn * 24);
177 for (
int iRow = 0; iRow <
mPatchSize; iRow++) {
178 for (
int iColumn = 0; iColumn <
mPatchSize; iColumn++) {
180 IndexMapPatch.push_back(SeedID - iRow - iColumn * 8);
193 auto& ADCvalues = std::get<1>(patch);
194 auto& PatchID = std::get<0>(patch);
195 if (ADCvalues.size() == 4) {
198 ADCvalues.erase(ADCvalues.begin());
200 if (ADCvalues.size() > 4) {
201 LOG(
debug) <<
"DIG TRU updateADC in TRUElectronics: ERROR!!!!! ";
204 double integralADCnew = 0;
209 auto elem =
mFastOrs[FastOrs].mADCvalues;
210 if (elem.size() == 0) {
213 auto it = elem.end() - 1;
214 auto pointedvalue = *it;
215 integralADCnew += pointedvalue;
217 ADCvalues.push_back(integralADCnew);
220 auto& CurrentPatchTimesum = std::get<1>(
mTimesum[PatchID]);
221 if (CurrentPatchTimesum.size() == 4) {
222 CurrentPatchTimesum.erase(CurrentPatchTimesum.begin());
224 double IntegralADCvalues = 0;
225 for (
auto ADC : ADCvalues) {
226 IntegralADCvalues += ADC;
228 CurrentPatchTimesum.push_back(IntegralADCvalues);
EMCAL TRUElectronics for the LZEROElectronics.
int mPatchSize
! patch size (2x2 or 4x4 typically)
std::vector< std::tuple< int, std::vector< double > > > mTimesum
! Time sums for peak finding
std::vector< std::tuple< int, std::vector< int > > > mFiredFastOrIndexMapPatch
! mask of the FastOrs above threshold in each patch
void assignSeedModuleToPatchWithSTUIndexingFullModule(int &patchID)
Assign seed module to a Full SM.
int mWhichSuperModuleSize
! Either Full/2/3 = 0 or 1/3 = 1 size
TRUElectronics()
Default constructor.
void init()
Initialise internal members.
void updateADC()
Updates the patches.
void assignSeedModuleToAllPatches()
Assign seed module to all patches.
std::vector< FastOrStruct > mFastOrs
! FastOr objects
void assignModulesToAllPatches()
Assign modules to all patches.
std::vector< std::tuple< int, std::vector< int > > > mIndexMapPatch
! mask of the FastOrs assigned to each patch
std::vector< std::tuple< int, int > > mPatchIDSeedFastOrIDs
! mask containing Patch IDs, their seed FastOrs
void clear()
Clear internal members.
std::vector< std::tuple< int, std::vector< double > > > mADCvalues
! ADC values for peak finding
std::vector< std::tuple< int, double > > mPreviousTimebinADCvalue
! ADC that was just removed from the time bins
int mWhichSide
! Either A = 0 or C = 1 side
void assignSeedModuleToPatchWithSTUIndexingOneThirdModule(int &patchID)
Assign seed module to a 1/3 SM.
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"