forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_CRUDataSkimming_its.C
More file actions
67 lines (56 loc) · 2.18 KB
/
Copy pathrun_CRUDataSkimming_its.C
File metadata and controls
67 lines (56 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#if !defined(__CLING__) || defined(__ROOTCLING__)
#include <TFile.h>
#include <TStopwatch.h>
#include <fairlogger/Logger.h>
#include <fstream>
#include <string>
#include "ITSMFTReconstruction/ChipMappingITS.h"
#include "ITSMFTReconstruction/RUDecodeData.h"
#include "ITSMFTReconstruction/GBTWord.h"
#include "ITSMFTReconstruction/PayLoadCont.h"
#include "DataFormatsITSMFT/ROFRecord.h"
#include "DataFormatsITSMFT/Digit.h"
#include "ITSMFTReconstruction/RawPixelReader.h"
#endif
// example of skimming of the CRU data with 128b-padded GBT words and fixed 8KB page
// to 80b GBT words in the pages size corresponding to the real payload
// Initial raw can be prepared from the MC digits using run_digi2raw_its.C
void run_CRUDataSkimming_its(std::string inpName = "rawits.bin",
std::string outName = "rawits_skimmed.bin",
int nTriggersToCache = 1025, // number of triggers per link to cache (> N 8KB CRU pages per superpage)
int verbose = 0)
{
o2::itsmft::RawPixelReader<o2::itsmft::ChipMappingITS> rawReader;
rawReader.openInput(inpName);
rawReader.setPadding128(false);
rawReader.setMinTriggersToCache(nTriggersToCache);
rawReader.setVerbosity(verbose);
std::fstream outFile(outName, std::ios::out | std::ios::binary);
o2::itsmft::PayLoadCont outBuffer(1000000); // book 1 MB buffer
TStopwatch sw, swIO;
sw.Start();
swIO.Stop();
while (rawReader.skimNextRUData(outBuffer)) {
swIO.Start(false);
outFile.write((const char*)outBuffer.data(), outBuffer.getSize());
swIO.Stop();
outBuffer.clear();
}
outFile.close();
sw.Stop();
const auto& MAP = rawReader.getMapping();
for (int ir = 0; ir < MAP.getNRUs(); ir++) {
for (int il = 0; il < o2::itsmft::RUDecodeData::MaxLinksPerRU; il++) {
const auto ruStat = rawReader.getRUDecodingStatSW(ir, il);
if (ruStat && ruStat->nPackets) {
printf("\nStatistics for RU%3d (HWID:0x%4x) GBTLink%d\n", ir, MAP.RUSW2FEEId(ir, il), il);
ruStat->print();
}
}
}
rawReader.getDecodingStat().print();
printf("Total time spent on skimming: ");
sw.Print();
printf("Time spent on writing output: ");
swIO.Print();
}