Project
Loading...
Searching...
No Matches
Encoder.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_ENCODER_H
16#define ALICEO2_TOF_ENCODER_H
17
18#include <fstream>
19#include <string>
20#include <cstdint>
22#include "TOFBase/Geo.h"
23#include "TOFBase/Digit.h"
27
28namespace o2
29{
30namespace tof
31{
32namespace raw
33{
34
39{
40
41 public:
42 Encoder();
43 ~Encoder() = default;
44
45 bool open(const std::string& name, const std::string& path = ".", const std::string& fileFor = "cruendpoint");
46 bool alloc(long size);
47
48 bool encode(std::vector<std::vector<o2::tof::Digit>> digitWindow, int tofwindow = 0);
49 void encodeTRM(const std::vector<Digit>& summary, Int_t icrate, Int_t itrm, int& istart); // return next trm index
50
51 bool flush(int icrate);
52 bool close();
53 void setVerbose(bool val) { mVerbose = val; };
54
55 void setEncoderCRUZEROES(bool val = true) { mOldFormat = val; }
56
57 int getSize(void* first, void* last);
58
59 void nextWord(int icrate);
60
62 bool isContinuous() const { return mIsContinuous; }
63
64 auto& getWriter() { return mFileWriter; };
65
66 static int getNCRU() { return NCRU; }
67
68 protected:
69 // benchmarks
71 double mIntegratedTime = 0.;
72
73 static constexpr int NCRU = 4;
74 static constexpr int NLINKSPERCRU = 72 / NCRU;
75
76 bool mVerbose = false;
77
78 char* mBuffer[72];
79 std::vector<char> mBufferLocal;
80 long mSize;
83 TOFDataHeader_t* mTOFDataHeader[72];
84 DRMDataHeader_t* mDRMDataHeader[72];
86
87 bool mIsContinuous = true;
88
92
93 bool mCrateOn[72];
94
95 bool mStartRun = true;
96 int mFirstBC = 0;
97
98 bool mOldFormat = false;
99
100 // temporary variable for encoding
103};
104
105} // namespace compressed
106} // namespace tof
107} // namespace o2
108#endif
Definition of the RAW Data Header.
TOF raw data format.
Utility class to write detectors data to (multiple) raw data file(s) respecting CRU format.
Encoder class for TOF.
Definition Encoder.h:39
Union_t * mStart[72]
Definition Encoder.h:82
bool encode(std::vector< std::vector< o2::tof::Digit > > digitWindow, int tofwindow=0)
Definition Encoder.cxx:248
bool isContinuous() const
Definition Encoder.h:62
o2::InteractionRecord mIR
Definition Encoder.h:102
static constexpr int NCRU
Definition Encoder.h:73
bool mNextWordStatus[72]
Definition Encoder.h:85
static int getNCRU()
Definition Encoder.h:66
int getSize(void *first, void *last)
Definition Encoder.cxx:411
void setVerbose(bool val)
Definition Encoder.h:53
TOFDataHeader_t * mTOFDataHeader[72]
Definition Encoder.h:83
void setEncoderCRUZEROES(bool val=true)
Definition Encoder.h:55
double mIntegratedAllBytes
Definition Encoder.h:70
bool alloc(long size)
Definition Encoder.cxx:131
char * mBuffer[72]
Definition Encoder.h:78
const o2::raw::HBFUtils & mHBFSampler
Definition Encoder.h:90
std::vector< char > mBufferLocal
Definition Encoder.h:79
void encodeTRM(const std::vector< Digit > &summary, Int_t icrate, Int_t itrm, int &istart)
Definition Encoder.cxx:154
void nextWord(int icrate)
Definition Encoder.cxx:47
o2::raw::RawFileWriter mFileWriter
Definition Encoder.h:91
Union_t * mUnion[72]
Definition Encoder.h:81
o2::header::RAWDataHeader * mRDH[72]
Definition Encoder.h:89
void setContinuous(bool value)
Definition Encoder.h:61
static constexpr int NLINKSPERCRU
Definition Encoder.h:74
DRMDataHeader_t * mDRMDataHeader[72]
Definition Encoder.h:84
bool open(const std::string &name, const std::string &path=".", const std::string &fileFor="cruendpoint")
Definition Encoder.cxx:60
bool flush(int icrate)
Definition Encoder.cxx:111
GLsizeiptr size
Definition glcorearb.h:659
GLuint const GLchar * name
Definition glcorearb.h:781
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLuint GLfloat * val
Definition glcorearb.h:1582
GLsizei const GLchar *const * path
Definition glcorearb.h:3591
constexpr o2::header::DataOrigin gDataOriginTOF
Definition DataHeader.h:575
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...