Project
Loading...
Searching...
No Matches
Digits2Raw.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
15
16#ifndef ALICEO2_CTP_DIGITS2RAW_H_
17#define ALICEO2_CTP_DIGITS2RAW_H_
18
19#include <vector>
23#include "TRandom.h"
27
28namespace o2
29{
30namespace ctp
31{
33{
34 public:
35 Digits2Raw() = default;
36 ~Digits2Raw() = default;
37 void init();
38 void setVerbosity(int v) { mVerbosity = v; }
39 void setFilePerLink(bool v) { mOutputPerLink = v; }
40 void setOutDir(std::string& outdir) { mOutDir = outdir; }
41 void setBoardId(uint32_t boardid) { mBoardId = boardid; }
42 void setZeroSuppressedIntRec(bool value) { mZeroSuppressedIntRec = value; }
43 void setZeroSuppressedClassRec(bool value) { mZeroSuppressedClassRec = value; }
44 void setPadding(bool value) { mPadding = value; }
45 bool getFilePerLink() const { return mOutputPerLink; }
46 uint64_t getFEEIDIR() const { return uint64_t(mBoardId + (o2::ctp::GBTLinkIDIntRec << 8)); }
47 uint64_t getFEEIDTC() const { return uint64_t(mBoardId + (o2::ctp::GBTLinkIDClassRec << 8)); }
48 o2::raw::RawFileWriter& getWriter() { return mWriter; }
49 void setOutDir(const std::string& outDir) { mOutDir = outDir; }
50 void processDigits(const std::string& fileDigitsName);
51 void emptyHBFMethod(const header::RDHAny* rdh, std::vector<char>& toAdd) const;
52 std::vector<char> digits2HBTPayload(const gsl::span<gbtword80_t> digits, uint32_t Npld) const;
53 bool makeGBTWord(const gbtword80_t& pld, gbtword80_t& gbtword, uint32_t& size_gbt, uint32_t Npld, gbtword80_t& gbtsend) const;
54 //void makeGBTWordInverse(std::vector<gbtword80_t> diglets, gbtword80_t& GBTWord, gbtword80_t& remnant, uint32_t& size_gbt, uint32_t Npld) const;
55 int digit2GBTdigit(gbtword80_t& gbtdigitIR, gbtword80_t& gbtdigitTR, const CTPDigit& digit);
56 std::vector<gbtword80_t> addEmptyBC(std::vector<gbtword80_t>& hbfIRZS);
57 void printDigit(std::string text, const gbtword80_t& dig) const;
58 void dumpRawData(std::string filename = "ctp.raw");
59
60 private:
61 // Raw Writer
62 o2::raw::RawFileWriter mWriter{"CTP"};
63 int mVerbosity = 0;
64 bool mOutputPerLink = false;
65 uint16_t mCruID = 0;
66 uint32_t mEndPointID = 0;
67
68 std::string mOutDir;
69 uint32_t mActiveLink = -1;
70 // CTP specific (commented are in Digits.h)
71 //const uint32_t mGBTLinkIR = 0; // Interaction record CTP GBT link
72 //const uint32_t mGBTLinkTC = 1; // Trigger Class Record CTP GBT link
73 //const uint32_t mGBTLinkMisc = 2; // HBrecord, Counters, ...
74 uint32_t mBoardId = 33;
75 bool mZeroSuppressedIntRec = true;
76 bool mZeroSuppressedClassRec = true;
77 bool mPadding = true;
78 //constexpr uint32_t CTPCRULinkIDMisc = 2;
79 std::string mCTPRawDataFileName = "CTP_alio2-cr1-flp163_cru1111_0";
80};
81} // namespace ctp
82} // namespace o2
83#endif //_CTP_DIGITS2RAW_H_
definition of CTPConfiguration and related CTP structures
definition of CTPDigit, CTPInputDigit
unsigned short int uint16_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
Utility class to write detectors data to (multiple) raw data file(s) respecting CRU format.
void processDigits(const std::string &fileDigitsName)
void setOutDir(std::string &outdir)
Definition Digits2Raw.h:40
void setBoardId(uint32_t boardid)
Definition Digits2Raw.h:41
void dumpRawData(std::string filename="ctp.raw")
std::vector< gbtword80_t > addEmptyBC(std::vector< gbtword80_t > &hbfIRZS)
void setZeroSuppressedIntRec(bool value)
Definition Digits2Raw.h:42
int digit2GBTdigit(gbtword80_t &gbtdigitIR, gbtword80_t &gbtdigitTR, const CTPDigit &digit)
void setZeroSuppressedClassRec(bool value)
Definition Digits2Raw.h:43
uint64_t getFEEIDIR() const
Definition Digits2Raw.h:46
std::vector< char > digits2HBTPayload(const gsl::span< gbtword80_t > digits, uint32_t Npld) const
void emptyHBFMethod(const header::RDHAny *rdh, std::vector< char > &toAdd) const
void setFilePerLink(bool v)
Definition Digits2Raw.h:39
void setOutDir(const std::string &outDir)
Definition Digits2Raw.h:49
uint64_t getFEEIDTC() const
Definition Digits2Raw.h:47
bool getFilePerLink() const
Definition Digits2Raw.h:45
bool makeGBTWord(const gbtword80_t &pld, gbtword80_t &gbtword, uint32_t &size_gbt, uint32_t Npld, gbtword80_t &gbtsend) const
void setPadding(bool value)
Definition Digits2Raw.h:44
void setVerbosity(int v)
Definition Digits2Raw.h:38
o2::raw::RawFileWriter & getWriter()
Definition Digits2Raw.h:48
void printDigit(std::string text, const gbtword80_t &dig) const
const GLdouble * v
Definition glcorearb.h:832
GLsizei const GLfloat * value
Definition glcorearb.h:819
std::bitset< NGBT > gbtword80_t
Definition Digits.h:36
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string filename()
std::vector< Digit > digits