74 LOG(debug) << fName <<
"::initParSetAsic - ";
80 LOG(debug) <<
"Nr. of Tof GDPBs: " << uNrOfGdpbs;
83 LOG(debug) <<
"Nr. of FEEs per Psd GDPB: " << uNrOfFeePerGdpb;
86 LOG(debug) <<
"Nr. of channels per FEE: " << uNrOfChannelsPerFee;
88 auto uNrOfChannelsPerGdpb = uNrOfChannelsPerFee * uNrOfFeePerGdpb;
89 LOG(debug) <<
"Nr. of channels per GDPB: " << uNrOfChannelsPerGdpb;
92 for (UInt_t i = 0; i < uNrOfGdpbs; ++i) {
94 LOG(debug) <<
"GDPB Id of PSD " << i <<
" : " << std::hex << parset->
GetGdpbId(i) << std::dec;
103 UInt_t uNrOfChannels = uNrOfModules * uNrOfSections;
104 LOG(debug) <<
"Nr. of possible Psd channels: " << uNrOfChannels;
108 for (UInt_t iModule = 0; iModule < uNrOfModules; ++iModule) {
109 for (UInt_t iSection = 0; iSection < uNrOfSections; ++iSection) {
110 iCh = iModule * uNrOfSections + iSection;
115 for (
size_t ichannel = 0; ichannel <
fviPsdChUId.size(); ++ichannel) {
138 auto msDescriptor = ts->descriptor(icomp, imslice);
139 auto eqid = msDescriptor.eq_id;
141 const uint8_t* msContent =
reinterpret_cast<const uint8_t*
>(ts->content(icomp, imslice));
143 uint32_t uSize = msDescriptor.size;
144 auto mstime = msDescriptor.idx;
146 LOG(debug4) <<
"Microslice: " << mstime <<
" from EqId " << std::hex << eqid << std::dec <<
" has size: " << uSize;
150 auto dpbid =
static_cast<uint16_t
>(eqid & 0xFFFF);
156 LOG(info) <<
"---------------------------------------------------------------";
157 LOG(warning) <<
"Could not find the gDPB index for AFCK id 0x" << std::hex << dpbid << std::dec
158 <<
" in timeslice " << ts->index() <<
" in microslice " << imslice <<
" component " << icomp <<
"\n"
159 <<
"If valid this index has to be added in the PSD "
160 "parameter file in the DbpIdArray field";
178 LOG(error) <<
"The input microslice buffer does NOT "
179 <<
"contain only complete nDPB messages!";
183 Double_t dMsRelativeTime = mstime - fTsStartTime;
189 const uint64_t* pInBuff =
reinterpret_cast<const uint64_t*
>(msContent);
192 if (!(uNbMessages > 1))
return kTRUE;
195 if (fair::Logger::Logging(fair::Severity::debug)) PsdReader.
SetPrintOutMode(
true);
198 int ReadResult = PsdReader.
ReadMs();
199 if (fair::Logger::Logging(fair::Severity::debug)) {
201 printf(
"\nMicroslice idx: %lu\n",
static_cast<size_t>(mstime));
204 if (ReadResult == 0) {
206 double prev_hit_time =
210 for (uint64_t hit_iter = 0; hit_iter < PsdReader.
VectHitHdr.size(); hit_iter++) {
212 LOG(error) <<
"Different vector headers sizes!"
213 <<
" in VectPackHdr " << PsdReader.
VectPackHdr.size() <<
" in VectHitHdr "
218 uint8_t uHitChannel = PsdReader.
VectHitHdr.at(hit_iter).uHitChannel;
220 LOG(error) <<
"hit channel number out of range! channel index: " << uHitChannel
232 UInt_t uZL = PsdReader.
VectHitHdr.at(hit_iter).uZeroLevel;
233 Double_t dAccum = (double) PsdReader.
VectHitHdr.at(hit_iter).uFeeAccum;
234 Double_t dAdcTime = (double) PsdReader.
VectPackHdr.at(hit_iter).uAdcTime;
236 Double_t dEdepWfm = 0.;
240 std::vector<uint16_t> uWfm = PsdReader.
VectHitData.at(hit_iter).uWfm;
242 Double_t dFitAmpl = 0.;
243 Double_t dFitZL = 0.;
244 Double_t dFitEdep = 0.;
245 Double_t dFitR2 = 999.;
246 Double_t dFitTimeMax = -1.;
247 std::vector<uint16_t> uFitWfm;
251 int32_t iHitChargeWfm = std::accumulate(uWfm.begin(), uWfm.end(), -uZL * uWfm.size());
252 auto const max_iter = std::max_element(uWfm.begin(), uWfm.end());
253 assert(max_iter != uWfm.end());
254 if (max_iter == uWfm.end())
break;
255 uint8_t uHitTimeMax = std::distance(uWfm.begin(), max_iter);
256 int32_t iHitAmlpitude = *max_iter - uZL;
257 auto const min_iter = std::min_element(uWfm.begin(), uWfm.end());
258 uint32_t uHitMinimum = *min_iter;
261 dAmpl = (double) iHitAmlpitude / 16.5;
262 uTimeMax = uHitTimeMax;
263 uMinimum = uHitMinimum;
266 int gate_end = (int) uWfm.size() - 1;
272 std::complex<float> first_fit_harmonic = {0.72, 0.0};
273 std::complex<float> second_fit_harmonic = {0.38, -0.0};
281 dFitR2 = Pfitter.
GetRSquare(gate_beg, gate_end);
287 CbmPsdDsp dsp =
CbmPsdDsp(uChanUId, dTime, fTsStartTime, dEdep, uZL, dAccum, dAdcTime,
289 dEdepWfm, dAmpl, uMinimum, uTimeMax, uWfm,
291 dFitAmpl, dFitZL, dFitEdep, dFitR2, dFitTimeMax, uFitWfm);
296 if (dTime < prev_hit_time) printf(
"negative time btw hits! %f after %f \n", dTime, prev_hit_time);
298 prev_hit_time = dTime;
302 else if (ReadResult == 1) {
303 LOG(error) <<
"no pack headers in message!";
305 else if (ReadResult == 2) {
308 else if (ReadResult == 3) {
309 LOG(error) <<
"check number of waveform points! In header: " << PsdReader.
HitHdr.
uWfmWords - 1;
312 LOG(error) <<
"PsdGbtReader.ReadEventFles() didn't return expected values";
319 LOG(error) <<
"Wrong amount of messages read!"
320 <<
" in microslice " << uNbMessages <<
" by PsdReader " << PsdReader.
GetTotalGbtWordsRead() <<
"\n";