[Halld-offline] Issue with TChain in DSelector

Sean Dobbs sdobbs at fsu.edu
Thu Jan 24 15:15:31 EST 2019


Hi Beni,

Indeed, DSelector::Init() is called every time a new file is
encountered, so you might want to move your initialization code to
after the line with

if(locInitializedPriorFlag)

You probably want to make sure you use some global lock when writing
out individual events.

Another possible solution which has worked for me is creating an empty
file, and including in DSelector_ThreePiP::Process() something like
the following code to append to the file:

std::ofstream skimfile;
skimfile.open("FILENAME", std::ios_base::app);
skimfile << locRunNumber << " " << locEventNumber << endl;
skimfile.close();

Cheers,
Sean


On Thu, Jan 24, 2019 at 1:37 PM Beni Zihlmann <zihlmann at jlab.org> wrote:
>
> Hi All,
>
> I use the DSelector to analyze some trees.
> The trees are put into a TChain object for every tree like this:
>  chain.Add(f.c_str());
> in my script where f is the tree file.
>
> In my DSelector Init() method I open a file stream like this:
>   OUTF.open("eta_event_list.dat", ios::out);
>
> And in DSelector Process() method at the end of the method I write a string to the file
>     OUTF<<ofline<<endl;
>
> and In DSelector Finalize() method I close the file.
>
> the issue I see is that only my first Tree ends up in the output file OUTF all other trees/files
> do not. In other words writing to the output stream OUTF stops after the end of the first tree.
>
> Any idea what I do wrong?
> PS: The code is on the work disk at /w/halld-scifs17exp/halld2/home/zihlmann/HallD/work/tmp
> The script that creates the chain and launches the DSelector is doanal.C
> the DSelector files *.h and *.C are there too.
>
> cheers,
> Beni
> _______________________________________________
> Halld-offline mailing list
> Halld-offline at jlab.org
> https://mailman.jlab.org/mailman/listinfo/halld-offline




More information about the Halld-offline mailing list