Project
Loading...
Searching...
No Matches
RawWriter.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
12#ifndef ALICEO2_CPV_RAWWRITER_H
13#define ALICEO2_CPV_RAWWRITER_H
14
15#include <gsl/span>
16
17#include <array>
18#include <fstream>
19#include <memory>
20#include <string>
21#include <map>
22#include <vector>
23
24#include "Rtypes.h"
25
33
34namespace o2
35{
36
37namespace cpv
38{
39
40static constexpr short kNcc = 24;
41static constexpr short kNPAD = 48;
42static constexpr short kNDilogic = 4;
43static constexpr short kNGasiplex = 5;
44static constexpr short kNRow = 48;
45
47 short linkId;
48 short feeId;
49 short cruId;
51 std::string flpId;
52};
53static constexpr short kNGBTLinks = 3;
54const GBTLinkAttributes links[kNGBTLinks] =
55 {
56 {0, 0, 0, 0, "alio2-cr1-flp162"},
57 {1, 1, 0, 0, "alio2-cr1-flp162"},
58 {2, 2, 0, 0, "alio2-cr1-flp162"}};
59
60struct padCharge {
61 short charge;
62 short pad;
63 padCharge() : charge(0), pad(0) {}
64 padCharge(short a, short b) : charge(a),
65 pad(b)
66 {
67 } // for std::vector::emplace_back functionality
68};
69
71{
72 public:
73 enum class FileFor_t {
75 kLink
76 };
77 RawWriter() = default;
78 RawWriter(const char* outputdir) { setOutputLocation(outputdir); }
79 ~RawWriter() = default;
80
81 o2::raw::RawFileWriter& getWriter() const { return *mRawWriter; }
82
83 void setOutputLocation(const char* outputdir) { mOutputLocation = outputdir; }
84 void setCcdbUrl(const char* ccdbUrl) { mCcdbUrl = ccdbUrl; }
85 void setFileFor(FileFor_t filefor) { mFileFor = filefor; }
86 void setRDHVersion(int v) {}
87 void setDataFormat(unsigned char v) { mDataFormat = v; }
88
89 void init();
90 void digitsToRaw(gsl::span<o2::cpv::Digit> digits, gsl::span<o2::cpv::TriggerRecord> triggers);
91 bool processOrbit(const gsl::span<o2::cpv::Digit> digitsbranch, const gsl::span<o2::cpv::TriggerRecord> trgs);
92
93 int carryOverMethod(const header::RDHAny* rdh, const gsl::span<char> data,
94 const char* ptr, int maxSize, int splitID,
95 std::vector<char>& trailer, std::vector<char>& header) const;
96
97 private:
98 std::vector<padCharge> mPadCharge[kNcc][kNDilogic][kNGasiplex];
100 std::string mOutputLocation = "./";
101 std::string mCcdbUrl = o2::base::NameConf::getCCDBServer();
102 CalibParams* mCalibParams = nullptr;
103 Pedestals* mPedestals = nullptr;
104 BadChannelMap* mBadMap = nullptr;
105 int64_t mLM_L0_delay = 15;
106 unsigned char mDataFormat = 0;
107 int mRDHVersion = 7;
108 std::vector<char> mPayload[kNGBTLinks];
109 gsl::span<o2::cpv::Digit> mDigits;
110 std::unique_ptr<o2::raw::RawFileWriter> mRawWriter;
111
112 ClassDefNV(RawWriter, 3);
113};
114
115} // namespace cpv
116
117} // namespace o2
118
119#endif
Definition of the Names Generator class.
Utility class to write detectors data to (multiple) raw data file(s) respecting CRU format.
TBranch * ptr
static std::string getCCDBServer()
Definition NameConf.cxx:110
CCDB container for bad (masked) channels in CPV.
bool processOrbit(const gsl::span< o2::cpv::Digit > digitsbranch, const gsl::span< o2::cpv::TriggerRecord > trgs)
void setFileFor(FileFor_t filefor)
Definition RawWriter.h:85
void setDataFormat(unsigned char v)
Definition RawWriter.h:87
void setOutputLocation(const char *outputdir)
Definition RawWriter.h:83
o2::raw::RawFileWriter & getWriter() const
Definition RawWriter.h:81
void setRDHVersion(int v)
Definition RawWriter.h:86
RawWriter(const char *outputdir)
Definition RawWriter.h:78
void digitsToRaw(gsl::span< o2::cpv::Digit > digits, gsl::span< o2::cpv::TriggerRecord > triggers)
void setCcdbUrl(const char *ccdbUrl)
Definition RawWriter.h:84
int carryOverMethod(const header::RDHAny *rdh, const gsl::span< char > data, const char *ptr, int maxSize, int splitID, std::vector< char > &trailer, std::vector< char > &header) const
~RawWriter()=default
const GLdouble * v
Definition glcorearb.h:832
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLboolean * data
Definition glcorearb.h:298
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
const GBTLinkAttributes links[kNGBTLinks]
Definition RawWriter.h:54
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
padCharge(short a, short b)
Definition RawWriter.h:64
std::string ccdbUrl
std::vector< Digit > digits