43 mSkipEmptyEvents =
true;
45 mUPayloadBufferPtr = std::make_unique<uint32_t[]>(
mNumberOfEquipments * mPayloadBufferDimPerEquipment);
47 mPayloadBufferPtr = mUPayloadBufferPtr.get();
48 mPadMap = mUPadMap.get();
64 mHmpidErrorFlag = Error;
65 mHmpidFrwVersion = Version;
72void HmpidCoder2::setRDHFields(
int eq)
75 uint32_t wr = (mBusyTime << 9) | ((mHmpidErrorFlag & 0x01F) << 4) | (mHmpidFrwVersion & 0x0F);
78 for (
int l =
st; l < en; l++) {
81 if (RDHptr !=
nullptr) {
99int HmpidCoder2::getEquipmentPadIndex(
int eq,
int col,
int dil,
int cha)
107void HmpidCoder2::fillTheOutputBuffer(
uint32_t* padMap)
109 uint32_t rowMarker, segMarker, eoeMarker, padWord;
117 mEventSizePerEquipment[
i] = 0;
134 if (padMap[idx] > 0) {
142 segSize += (rowSize + 1);
143 rowMarker = 0x000036A8 | ((rowSize << 16) & 0x03ff0000);
146 mPayloadBufferPtr[
ptr++] = rowMarker;
151 if (padMap[idx] > 0) {
152 padWord = ((
col << 22) & 0x07c00000) | ((
d << 18) & 0x003C0000) | ((
p << 12) & 0x0003F000) | (padMap[
idx] & 0x00000FFF);
153 mPayloadBufferPtr[
ptr++] = padWord;
156 eoeMarker = 0x08000080 | ((
col << 22) & 0x07c00000) | (
d << 18 & 0x003C0000) | (pads[
d - 1] & 0x0000007F);
157 mPayloadBufferPtr[
ptr++] = eoeMarker;
161 segMarker = 0xAB000000 | ((segSize << 8) & 0x000fff00) | (
s & 0x0000000F);
162 mPayloadBufferPtr[
ptr++] = segMarker;
164 mPadsCoded += padsCount;
165 mEventPadsPerEquipment[eq] = padsCount;
166 mEventSizePerEquipment[eq] =
ptr - startPtr;
179 uint32_t* ptrStartEquipment = mPayloadBufferPtr;
181 int EventSize = mEventSizePerEquipment[eq];
182 LOG(
debug) <<
"writePaginatedEvent() Eq=" << eq <<
" Size:" << EventSize <<
" Pads:" << mEventPadsPerEquipment[eq] <<
" Orbit:" <<
orbit <<
" BC:" <<
bc;
183 if (mEventPadsPerEquipment[eq] > 0 || !mSkipEmptyEvents) {
189 gsl::span<char>(
reinterpret_cast<char*
>(ptrStartEquipment),
193 (
uint32_t)((mBusyTime << 9) | ((mHmpidErrorFlag & 0x01F) << 4) | (mHmpidFrwVersion & 0x0F)));
199 ptrStartEquipment += EventSize;
213 int eq,
col, dil, cha, mo,
x,
y, idx;
222 idx = getEquipmentPadIndex(eq,
col, dil, cha);
223 if (mPadMap[idx] != 0) {
224 LOG(warning) <<
"Duplicated DIGIT =" <<
d <<
" (" << eq <<
"," <<
col <<
"," << dil <<
"," << cha <<
")" << idx;
226 mPadMap[idx] =
d.getCharge();
230 fillTheOutputBuffer(mPadMap);
231 writePaginatedEvent(
orbit,
bc);
250 std::string outfname;
251 if (fileFor ==
"link") {
253 }
else if (fileFor ==
"flp") {
255 }
else if (fileFor ==
"all") {
256 outfname = fmt::format(
"{}.raw", outputFileName);
257 }
else if (fileFor ==
"crorcendpoint") {
260 throw std::runtime_error(fmt::format(
"unknown raw file grouping option {}", fileFor));
265 mTheRFWLinks[eq] = ap;
280 std::cout <<
" **** HMPID RawFile Coder : results ****" << std::endl;
281 std::cout <<
" Created files : " << outputFileName << std::endl;
282 std::cout <<
" Number of Pads coded : " << mPadsCoded << std::endl;
283 std::cout <<
" ----------------------------------------" << std::endl;
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 s
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 d
Header of the General Run Parameters object.
constexpr int p1()
constexpr to accelerate the coordinates changing
Utility class to write detectors data to (multiple) raw data file(s) respecting CRU format.
static void pad2Equipment(uint32_t pad, int *Equi, int *Colu, int *Dilo, int *Chan)
static constexpr int N_HMPIDTOTALPADS
static constexpr int N_COLXSEGMENT
static constexpr int N_SEGMENTS
static constexpr int N_DILOGICS
static constexpr int N_CHANNELS
static constexpr int MAXEQUIPMENTS
void codeEventChunkDigits(std::vector< o2::hmpid::Digit > &digits, InteractionRecord ir)
void dumpResults(const std::string &outputFileName)
Dumps the results of the last coding.
void setDetectorSpecificFields(float BusyTime=0.001, int Error=0, int Version=9)
void openOutputStream(const std::string &outputFileName, const std::string &fileFor)
HmpidCoder2(int numOfEquipments)
void closeOutputStream()
Close and flush the output streams.
static std::string_view FlpHostName(unsigned int idx)
static int FeeId(unsigned int idx)
static int CruId(unsigned int idx)
static int LnkId(unsigned int idx)
void addData(uint16_t feeid, uint16_t cru, uint8_t lnk, uint8_t endpoint, const IR &ir, const gsl::span< char > data, bool preformatted=false, uint32_t trigger=0, uint32_t detField=0)
LinkData & registerLink(uint16_t fee, uint16_t cru, uint8_t link, uint8_t endpoint, std::string_view outFileName)
LinkData & getLinkWithSubSpec(LinkSubSpec_t ss)
uint16_t bc
bunch crossing ID of interaction
static LinkSubSpec_t getSubSpec(uint16_t cru, uint8_t link, uint8_t endpoint, uint16_t feeId, o2::header::DAQID::ID srcid=o2::header::DAQID::INVALID)
static void setDetectorField(H &rdh, uint32_t v, NOTPTR(H))
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
o2::InteractionRecord ir(0, 0)
std::vector< Digit > digits