35template <
typename RDH>
38 LOG(info) <<
"CompressedInspector init";
40 auto verbose = ic.
options().
get<
bool>(
"tof-compressed-inspector-decoder-verbose");
45 if (mFile && mFile->IsOpen()) {
46 LOG(warning) <<
"a file was already open, closing";
50 mFile = TFile::Open(
filename.c_str(),
"RECREATE");
51 if (!mFile || !mFile->IsOpen()) {
52 LOG(error) <<
"cannot open output file: " <<
filename;
57 mHistos1D[
"hHisto"] =
new TH1F(
"hHisto",
"", 1000, 0., 1000.);
58 mHistos1D[
"time"] =
new TH1F(
"hTime",
";time (24.4 ps)", 2097152, 0., 2097152.);
59 mHistos1D[
"timebc"] =
new TH1F(
"hTimeBC",
";time (24.4 ps)", 1024, 0., 1024.);
60 mHistos1D[
"tot"] =
new TH1F(
"hTOT",
";ToT (48.8 ps)", 2048, 0., 2048.);
61 mHistos1D[
"indexE"] =
new TH1F(
"hIndexE",
";index EO", 172800, 0., 172800.);
62 mHistos2D[
"slotPartMask"] =
new TH2F(
"hSlotPartMask",
";crate;slot", 72, 0., 72., 12, 1., 13.);
63 mHistos2D[
"diagnostic"] =
new TH2F(
"hDiagnostic",
";crate;slot", 72, 0., 72., 13, 0., 13.);
64 mHistos1D[
"Nerror"] =
new TH1F(
"hNError",
";number of error", 1000, 0., 1000.);
65 mHistos1D[
"Ntest"] =
new TH1F(
"hNTest",
";number of test", 1000, 0., 1000.);
66 mHistos1D[
"errorBit"] =
new TH1F(
"hErrorBit",
";TDC error bit", 15, 0., 15.);
67 mHistos2D[
"error"] =
new TH2F(
"hError",
";slot;TDC", 24, 1., 13., 15, 0., 15.);
68 mHistos2D[
"test"] =
new TH2F(
"hTest",
";slot;TDC", 24, 1., 13., 15, 0., 15.);
69 mHistos2D[
"crateBC"] =
new TH2F(
"hCrateBC",
";crate;BC", 72, 0., 72., 4096, 0., 4096.);
70 mHistos2D[
"crateOrbit"] =
new TH2F(
"hCrateOrbit",
";crate;orbit", 72, 0., 72., 4096, 0., 4096.);
72 auto finishFunction = [
this]() {
73 LOG(info) <<
"CompressedInspector finish";
74 for (
auto& histo : mHistos1D) {
75 histo.second->Write();
77 for (
auto& histo : mHistos2D) {
78 histo.second->Write();
85template <
typename RDH>
88 LOG(
debug) <<
"CompressedInspector run";
103 for (
auto const&
ref : iit) {
105 const auto* headerIn = DataRefUtils::getHeader<o2::header::DataHeader*>(
ref);
106 auto payloadIn =
ref.payload;
116template <
typename RDH>
119 mHistos2D[
"crateBC"]->Fill(crateHeader->
drmID, crateHeader->
bunchID);
120 mHistos2D[
"crateOrbit"]->Fill(crateHeader->
drmID, crateOrbit->
orbitID % 4096);
122 for (
int ibit = 0; ibit < 11; ++ibit) {
124 mHistos2D[
"slotPartMask"]->Fill(crateHeader->
drmID, ibit + 2);
129template <
typename RDH>
130void CompressedInspectorTask<RDH>::frameHandler(
const CrateHeader_t* crateHeader,
const CrateOrbit_t* crateOrbit,
131 const FrameHeader_t* frameHeader,
const PackedHit_t* packedHits)
133 mHistos1D[
"hHisto"]->Fill(frameHeader->numberOfHits);
134 for (
int i = 0;
i < frameHeader->numberOfHits; ++
i) {
135 auto packedHit = packedHits +
i;
136 auto indexE = packedHit->channel +
137 8 * packedHit->tdcID +
138 120 * packedHit->chain +
139 240 * (frameHeader->trmID - 3) +
140 2400 * crateHeader->drmID;
141 int time = packedHit->time;
142 int timebc =
time % 1024;
143 time += (frameHeader->frameID << 13);
145 mHistos1D[
"indexE"]->Fill(indexE);
146 mHistos1D[
"time"]->Fill(
time);
147 mHistos1D[
"timebc"]->Fill(timebc);
148 mHistos1D[
"tot"]->Fill(packedHit->tot);
152template <
typename RDH>
153void CompressedInspectorTask<RDH>::trailerHandler(
const CrateHeader_t* crateHeader,
const CrateOrbit_t* crateOrbit,
154 const CrateTrailer_t* crateTrailer,
const Diagnostic_t* diagnostics,
155 const Error_t* errors)
157 mHistos2D[
"diagnostic"]->Fill(crateHeader->drmID, 0);
158 for (
int i = 0;
i < crateTrailer->numberOfDiagnostics; ++
i) {
159 auto diagnostic = diagnostics +
i;
160 mHistos2D[
"diagnostic"]->Fill(crateHeader->drmID, diagnostic->slotID);
162 int nError = 0, nTest = 0;
163 for (
int i = 0;
i < crateTrailer->numberOfErrors; ++
i) {
164 auto error = errors +
i;
165 if (error->undefined) {
167 mHistos2D[
"test"]->Fill(error->slotID + 0.5 * error->chain, error->tdcID);
170 mHistos2D[
"error"]->Fill(error->slotID + 0.5 * error->chain, error->tdcID);
171 for (
int ibit = 0; ibit < 15; ++ibit) {
172 if (error->errorFlags & (1 << ibit)) {
173 mHistos1D[
"errorBit"]->Fill(ibit);
178 mHistos1D[
"Nerror"]->Fill(nError);
179 mHistos1D[
"Ntest"]->Fill(nTest);
182template class CompressedInspectorTask<o2::header::RAWDataHeaderV4>;
183template class CompressedInspectorTask<o2::header::RAWDataHeaderV6>;
184template class CompressedInspectorTask<o2::header::RAWDataHeaderV7>;
TOF compressed data inspector task.
T get(const char *key) const
ServiceRegistryRef services()
ConfigParamRegistry const & options()
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
void init(InitContext &ic) final
void setDecoderBuffer(const char *val)
void setDecoderBufferSize(long val)
void setDecoderVerbose(bool val)
Defining PrimaryVertex explicitly as messageable.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static o2::header::DataHeader::PayloadSizeType getPayloadSize(const DataRef &ref)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"