Fill three of four TTree branches using ReadFile() and the remaining one with Fill()

Suppose I want to fill TTree tree which I want to have 4 branches A1, A2, A3 and B1.
I have text files in which I have 3 values in a row — for A1, A2, A3 and value of branch B1 depends on file name itself.

So I tried

std::string mode;
tree->Branch( "mode", &mode );

for( file_iterator )
{
    mode = file_name;

    if( the_first_file ) { tree->ReadFile( file_name, "A1 : A2 : A3" ); }
    else { tree->ReadFile( file_name ); }
}

I do not know how to fill (if possible) mode branch in this case?

Thanks in advance.

One way to solve this: remember how many entries you have read from each file. Add the filename branch only after reading all files.

Should work like this:

auto t = new TTree("t", "t");
vector<pair<Long64_t, TString>> filenameAndLengths;
for (const char *fn : {"t1.csv", "t2.csv", "t3.csv"}) {
    filenameAndLengths.emplace_back(t->ReadFile(fn, "A1:A2:A3"), fn);
}
Char_t fnc[PATH_MAX];
auto filenameBr = t->Branch("filename", fnc, "filename/C");
for (const auto &p : filenameAndLengths) {
    strlcpy(fnc, p.second, sizeof(fnc));
    auto n = p.first;
    while(n--) filenameBr->Fill();
}

Thank you. Did not know that after reading all files it will be possible to add branch though it is pretty natural.