GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DecodingScripts/macro/run_rawdecoding_mft.C at main · MFTDecoding/DecodingScripts

Expand file tree

/

run_rawdecoding_mft.C

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
137 lines (109 loc) · 4.56 KB
/

run_rawdecoding_mft.C

Copy path

File metadata and controls

137 lines (109 loc) · 4.56 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
if !defined(__CLING__) || defined(__ROOTCLING__)
#include <TROOT.h>
#include <TTree.h>
#include <TFile.h>
#include <TStopwatch.h>
#include <FairLogger.h>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include "ITSMFTReconstruction/ChipMappingMFT.h"
#include "ITSMFTReconstruction/RUDecodeData.h"
#include "ITSMFTReconstruction/GBTWord.h"
#include "ITSMFTReconstruction/PayLoadCont.h"
#include "ITSMFTReconstruction/PixelData.h"
#include "DataFormatsITSMFT/ROFRecord.h"
#include "ITSMFTReconstruction/RawPixelReader.h"
#include "CommonDataFormat/InteractionRecord.h"
#endif
// example of MFT raw data decoding
// Data can be prepared from the MC digits using run_digi2raw_mft.C
// The padding parameter should be set to "true" for CRU data and to "false" for
// the data obtained by the removing the 128 bit padding from GBT words
void run_rawdecoding_mft(std::string inpName = "06282019_1854_output.bin", // input binary data file name
std::string outDigName = "raw2mftdigits.root", // name for optinal digits tree
bool padding = true, // payload in raw data comes in 128 bit CRU words
bool page8kb = true, // full 8KB CRU pages are provided (no skimming applied)
int nTriggersToCache = 1025, // number of triggers per link to cache (> N 8KB CRU pages per superpage)
int verbose = 0)
{
o2::itsmft::RawPixelReader<o2::itsmft::ChipMappingMFT> rawReader;
rawReader.openInput(inpName);
rawReader.setPadding128(padding); // payload GBT words are padded to 16B
rawReader.imposeMaxPage(page8kb); // pages are 8kB in size (no skimming)
rawReader.setMinTriggersToCache(nTriggersToCache);
rawReader.setVerbosity(verbose);
o2::itsmft::ChipPixelData chipData;
TStopwatch sw;
sw.Start();
uint32_t roFrame = 0;
o2::InteractionRecord irHB, irTrig;
std::vector<o2::itsmft::Digit> digits, *digitsPtr = &digits;
std::vector<o2::itsmft::ROFRecord> rofRecVec, *rofRecVecPtr = &rofRecVec;
int rofEntry = 0, nrofdig = 0;
std::unique_ptr<TFile> outFileDig;
std::unique_ptr<TTree> outTreeDig; // output tree with digits
std::vector<int> tab_ID;
if (!outDigName.empty()) { // output to digit is requested
outFileDig = std::make_unique<TFile>(outDigName.c_str(), "recreate");
outTreeDig = std::make_unique<TTree>("o2sim", "Digits tree");
outTreeDig->Branch("MFTDigit", &digitsPtr);
outTreeDig->Branch("MFTDigitROF", &rofRecVecPtr);
}
while (rawReader.getNextChipData(chipData)) {
if (verbose >= 10) {
chipData.print();
}
if (outTreeDig) { // >> store digits
if (irHB != rawReader.getInteractionRecordHB() || irTrig != rawReader.getInteractionRecord()) {
if (!irTrig.isDummy()) {
rofRecVec.emplace_back(irHB, roFrame, rofEntry, nrofdig); // registed finished ROF
roFrame++;
}
irHB = rawReader.getInteractionRecordHB();
irTrig = rawReader.getInteractionRecord();
rofEntry = digits.size();
nrofdig = 0;
}
const auto& pixdata = chipData.getData();
for (const auto& pix : pixdata) {
digits.emplace_back(chipData.getChipID(), pix.getRowDirect(), pix.getCol());
nrofdig++;
}
printf("ROF %7d ch: %5d IR: ", roFrame, chipData.getChipID());
irHB.print();
int iterChip=0;
if(find (tab_ID.begin(), tab_ID.end(), chipData.getChipID()) == tab_ID.end()){ // ChipID not found in tab_ID
tab_ID.push_back(chipData.getChipID());
}
} // << store digits
//
} // END : Loop over the Chip Data
std::fstream output;
output.open("/home/alice/alice/output/Chip_ID.txt", std::ios::out);
for(int n=0;n<(int)tab_ID.size();n++)
output << tab_ID[n] << std::endl;
output.close();
if (outTreeDig) {
// register last ROF
rofRecVec.emplace_back(irHB, roFrame, rofEntry, nrofdig); // registed finished ROF
// fill last (and the only one?) entry
outTreeDig->Fill();
// and store tree
outTreeDig->Write();
}
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();
sw.Print();
}
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.