Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions tree/treeplayer/src/TTreePlayer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2456,6 +2456,7 @@ Long64_t TTreePlayer::Scan(const char *varexp, const char *selection,
UInt_t ui;
UInt_t lenmax = 0;
UInt_t colDefaultSize = 9;
UInt_t colMaxResizeWidth = 20;
UInt_t colPrecision = 9;
std::vector<TString> colFormats;
std::vector<Int_t> colSizes;
Expand All @@ -2481,6 +2482,7 @@ Long64_t TTreePlayer::Scan(const char *varexp, const char *selection,
opt.Remove(start,length("size")+numlen);

colDefaultSize = atoi(num.Data());
colMaxResizeWidth = colDefaultSize;
colPrecision = colDefaultSize;
if (colPrecision>18) colPrecision = 18;
}
Expand Down Expand Up @@ -2632,9 +2634,10 @@ Long64_t TTreePlayer::Scan(const char *varexp, const char *selection,
}
var = new TTreeFormula* [ncols];

for(ui=colFormats.size();ui<ncols;++ui) {
for (ui = colFormats.size(); ui < ncols; ++ui) {
colFormats.push_back(defFormat);
colSizes.push_back(colDefaultSize);
UInt_t nameWidth = cnames[ui].size();
colSizes.push_back(std::clamp(nameWidth, colDefaultSize, colMaxResizeWidth));
}

//*-*- Create the TreeFormula objects corresponding to each column
Expand Down Expand Up @@ -2691,7 +2694,13 @@ Long64_t TTreePlayer::Scan(const char *varexp, const char *selection,
if (hasArray) onerow += "* Instance ";
for (ui=0;ui<ncols;ui++) {
TString numbFormat = Form("* %%%d.%ds ",colSizes[ui],colSizes[ui]);
onerow += Form(numbFormat.Data(),var[ui]->PrintValue(-1));
TString varName = var[ui]->PrintValue(-1);
if (Int_t(varName.size()) > colSizes[ui]) {
varName.Resize(std::max(1, colSizes[ui] - 3));
varName += "...";
}
// varName will be truncated further if necessary here (ie if colSizes[ui]<=3)
onerow += Form(numbFormat.Data(), varName.Data());
}
if (fScanRedirect)
out<<onerow.Data()<<"*"<<std::endl;
Expand Down
Loading