Project
Loading...
Searching...
No Matches
PadDecoder.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include <cstdint>
13#include <cstdio>
14#include <iostream>
15#include <vector>
16
17#include <gsl/span>
18
19#include <fairlogger/Logger.h>
22
23using namespace o2::focal;
24
26{
27 mData.reset();
28}
29
30void PadDecoder::decodeEvent(gsl::span<const PadGBTWord> gbtdata)
31{
32 LOG(debug) << "decoding pad data of size " << gbtdata.size() << " GBT words - " << gbtdata.size() * sizeof(PadGBTWord) / sizeof(uint64_t) << " 64 bit words";
33 // first 39 GBT words : ASIC data
34 // Other words: Trigger data
35 std::size_t asicsize = 39 * PadData::NASICS;
36 auto asicwords = gbtdata.subspan(0, asicsize);
37 auto triggerwords = gbtdata.subspan(asicsize, gbtdata.size() - asicsize);
38 for (int iasic = 0; iasic < PadData::NASICS; iasic++) {
39 // First part: ASIC words
40 auto& asicdata = mData[iasic].getASIC();
41 auto wordsthisAsic = asicwords.subspan(iasic * 39, 39);
42 auto headerwords = wordsthisAsic[0].getASICData<ASICHeader>();
43 asicdata.setFirstHeader(headerwords[0]);
44 asicdata.setSecondHeader(headerwords[1]);
45 int nchannels = 0;
46 for (auto& datawords : wordsthisAsic.subspan(1, 36)) {
47 for (auto& channelword : datawords.getASICData<ASICChannel>()) {
48 asicdata.setChannel(channelword, nchannels);
49 nchannels++;
50 }
51 }
52 asicdata.setCMNs(wordsthisAsic[37].getASICData<ASICChannel>());
53 asicdata.setCalibs(wordsthisAsic[38].getASICData<ASICChannel>());
54
55 // Second part: Trigger words
56 auto wordsTriggerThisAsic = triggerwords.subspan(iasic * mWin_dur, mWin_dur);
57 auto& asiccont = mData[iasic];
58 for (const auto trgword : wordsTriggerThisAsic) {
59 asiccont.appendTriggerWord(trgword.getTriggerData());
60 }
61 }
62}
std::ostringstream debug
static constexpr int NASICS
Definition PadData.h:150
void decodeEvent(gsl::span< const PadGBTWord > padpayload)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"