Project
Loading...
Searching...
No Matches
Decoder.h
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
14
15#ifndef ALICEO2_TOF_DECODER_H
16#define ALICEO2_TOF_DECODER_H
17
18#include <fstream>
19#include <string>
20#include <cstdint>
22#include "TOFBase/Geo.h"
23#include "TOFBase/Digit.h"
24#include "TOFBase/Strip.h"
26#include <array>
28
29namespace o2
30{
31namespace tof
32{
33namespace compressed
34{
38class Decoder : public WindowFiller
39{
40
41 public:
42 Decoder();
43 ~Decoder() = default;
44
45 bool open(std::string name);
46
47 bool decode();
48 void readTRM(int icru, int icrate, uint32_t orbit, uint16_t bunchid);
49 void InsertDigit(int icrate, int itrm, int itdc, int ichain, int channel, uint32_t orbit, uint16_t bunchid, int time_ext, int tdc, int tot);
50 void fillWindows();
51 void clear();
52
53 bool close();
54 void setVerbose(bool val) { mVerbose = val; };
55
56 void printRDH() const;
57 void printCrateInfo(int icru) const;
58 void printTRMInfo(int icru) const;
59 void printCrateTrailerInfo(int icru) const;
60 void printHitInfo(int icru) const;
61
62 struct DigitInfo {
63 uint64_t bcAbs;
65 int tdc;
66 int tot;
67 uint32_t orbit;
68 uint16_t bc;
69 };
70
71 static void fromRawHit2Digit(int icrate, int itrm, int itdc, int ichain, int channel, uint32_t orbit, uint16_t bunchid, int tdc, int tot, DigitInfo& dinfo); // convert raw info in digit info (channel, tdc, tot, bc), tdc = packetHit.time + (frameHeader.frameID << 13)
72
73 char* nextPage(void* current, int shift = 8192);
74
75 std::vector<uint64_t>& getErrors() { return mErrors; }
76 void addError(const uint32_t val, int icrate) { mErrors.push_back((uint64_t(icrate) << 32) + val); }
77
78 protected:
79 static const int NCRU = 4;
80
81 // benchmarks
83 double mIntegratedTime = 0.;
84
85 std::ifstream mFile[NCRU];
86 bool mVerbose = false;
87 bool mCruIn[NCRU];
88
89 char* mBuffer[NCRU];
90 std::vector<char> mBufferLocal;
91 long mSize[NCRU];
94
95 int mHitDecoded = 0;
96
98};
99
100} // namespace compressed
101} // namespace tof
102} // namespace o2
103#endif
uint64_t orbit
Definition RawEventData.h:6
Definition of the RAW Data Header.
std::vector< uint64_t > mErrors
Decoder class for TOF.
Definition Decoder.h:39
void printHitInfo(int icru) const
Definition Decoder.cxx:394
void readTRM(int icru, int icrate, uint32_t orbit, uint16_t bunchid)
Definition Decoder.cxx:161
void printTRMInfo(int icru) const
Definition Decoder.cxx:383
std::vector< uint64_t > & getErrors()
Definition Decoder.h:75
static const int NCRU
Definition Decoder.h:79
Union_t * mUnionEnd[NCRU]
Definition Decoder.h:93
char * nextPage(void *current, int shift=8192)
Definition Decoder.cxx:251
void printCrateInfo(int icru) const
Definition Decoder.cxx:364
bool open(std::string name)
Definition Decoder.cxx:41
std::vector< char > mBufferLocal
Definition Decoder.h:90
void setVerbose(bool val)
Definition Decoder.h:54
std::ifstream mFile[NCRU]
Definition Decoder.h:85
static void fromRawHit2Digit(int icrate, int itrm, int itdc, int ichain, int channel, uint32_t orbit, uint16_t bunchid, int tdc, int tot, DigitInfo &dinfo)
Definition Decoder.cxx:233
void printCrateTrailerInfo(int icru) const
Definition Decoder.cxx:374
o2::header::RAWDataHeader * mRDH
Definition Decoder.h:97
void InsertDigit(int icrate, int itrm, int itdc, int ichain, int channel, uint32_t orbit, uint16_t bunchid, int time_ext, int tdc, int tot)
Definition Decoder.cxx:126
void addError(const uint32_t val, int icrate)
Definition Decoder.h:76
Union_t * mUnion[NCRU]
Definition Decoder.h:92
GLuint const GLchar * name
Definition glcorearb.h:781
GLuint GLfloat * val
Definition glcorearb.h:1582
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...