30 int iSampaVersion = -1;
34 TString rorcType =
"cru";
35 auto arrData = fileInfo.Tokenize(
"; ");
37 std::shared_ptr<RawReaderEventSync> eventSync = std::make_shared<RawReaderEventSync>();
39 for (
auto o : *arrData) {
40 const TString&
data =
static_cast<TObjString*
>(
o)->
String();
42 std::cout <<
" data: " <<
data <<
"\n";
43 if (
data.Contains(
".root")) {
45 std::cout <<
"Setting digits\n";
49 auto arrDataInfo =
data.Tokenize(
":");
50 if (arrDataInfo->GetEntriesFast() == 1) {
51 TString& rorcTypeTmp =
static_cast<TObjString*
>(arrDataInfo->At(0))->
String();
52 if (rorcTypeTmp ==
"grorc") {
53 rorcType = rorcTypeTmp;
54 }
else if (rorcTypeTmp ==
"trorc") {
55 rorcType = rorcTypeTmp;
56 }
else if (rorcTypeTmp ==
"trorc2") {
57 rorcType = rorcTypeTmp;
58 }
else if (rorcTypeTmp ==
"raw") {
59 rorcType = rorcTypeTmp;
60 }
else if (rorcTypeTmp ==
"cru") {
61 rorcType = rorcTypeTmp;
63 printf(
"Error, unrecognized option: %s\n", rorcTypeTmp.Data());
65 std::cout <<
"Found decoder type: " << rorcType <<
"\n";
68 }
else if (rorcType ==
"cru") {
69 TString files = gSystem->GetFromPipe(TString::Format(
"ls %s", arrDataInfo->At(0)->GetName()));
70 const int timeBins =
static_cast<TObjString*
>(arrDataInfo->At(1))->
String().Atoi();
71 std::unique_ptr<TObjArray> arr(files.Tokenize(
"\n"));
72 mRawReaderCRUManager.
reset();
73 mPresentEventNumber = 0;
77 mProcessedTimeBins = std::max(mProcessedTimeBins,
size_t(timeBins));
80 mRawReaderCRUManager.
setLinkZSCallback([
this](
int cru,
int rowInSector,
int padInRow,
int timeBin,
float adcValue) ->
bool {
82 updateROC(cruID.
roc(), rowInSector - (rowInSector > 62) * 63, padInRow, timeBin, adcValue);
88 for (
auto file : *arr) {
92 reader.setDebugLevel(debugLevel);
93 reader.setFillADCdataMap(
false);
94 printf(
"Adding file: %s\n",
file->GetName());
95 if (arrDataInfo->GetEntriesFast() == 3) {
96 const int cru =
static_cast<TObjString*
>(arrDataInfo->At(2))->
String().Atoi();
98 printf(
"Forcing CRU %03d\n", cru);
101 mRawReaderCRUManager.
init();
102 }
else if (rorcType ==
"digits") {
103 const TString
name = arrDataInfo->At(0)->GetName();
105 if (
name.EndsWith(
".list")) {
108 TString files = gSystem->GetFromPipe(TString::Format(
"%s %s", cmd.Data(),
name.Data()));
110 std::unique_ptr<TObjArray> arr(files.Tokenize(
"\n"));
111 mDigitTree = std::make_unique<TChain>(
"o2sim",
"Digit chain");
113 for (
auto file : *arr) {
114 if (TString(
file->GetName()).BeginsWith(
"alien://") && !gGrid) {
115 TGrid::Connect(
"alien");
117 mDigitTree->AddFile(
file->GetName());
118 LOGP(info,
"Adding file {}",
file->GetName());
120 }
else if (arrDataInfo->GetEntriesFast() < 3) {
121 printf(
"Error, badly formatte input data string: %s, expected format is <filename:cru:link[:sampaVersion]>\n",
127 if (rorcType ==
"raw") {
130 rawReader->addInputFile(
data.Data());
133 }
else if ((rorcType !=
"cru") && (rorcType !=
"digits")) {
134 TString&
filename =
static_cast<TObjString*
>(arrDataInfo->At(0))->
String();
135 iCRU =
static_cast<TObjString*
>(arrDataInfo->At(1))->
String().Atoi();
136 iLink =
static_cast<TObjString*
>(arrDataInfo->At(2))->
String().Atoi();
137 if (arrDataInfo->GetEntriesFast() > 3) {
138 iSampaVersion =
static_cast<TObjString*
>(arrDataInfo->At(3))->
String().Atoi();
143 cont->setEnableAdcClockWarning(
false);
144 cont->setEnableSyncPatternWarning(
false);
145 cont->setEnableStoreGBTFrames(
false);
146 cont->setEnableCompileAdcValues(
true);
148 std::cout <<
"Read digits from file " <<
filename <<
" with cru " << iCRU <<
", link " << iLink <<
", rorc type "
149 << rorcType <<
", SAMPA Version " << iSampaVersion <<
"...\n";
150 cont->addGBTFramesFromBinaryFile(
filename.Data(), rorcType.Data(), -1);
151 std::cout <<
" ... done. Read " << cont->getSize() <<
"\n";
RawReaderCRU & createReader(const std::string_view inputFileName, uint32_t numTimeBins=0, uint32_t link=0, uint32_t stream=0, uint32_t debugLevel=0, uint32_t verbosity=0, const std::string_view outputFilePrefix="")
create a new raw reader