Re: TTree as a database
Rene Brun (Rene.Brun@cern.ch)
Thu, 16 Apr 1998 16:43:11 +0200
William J Deninger wrote:
>
> Hello,
>
> I understand that the only way to expand an existing TTree database is
> by adding additional. However, how would one add data to a TTree
> which is relevant to a specific data item of a TObjArray (on an
> existing branch) and maintain a data hiarchial organization?
>
> An example: When dealing with particle tracking drift chambers, one
> begins with a set of drift times for each sense wire in a given
> particle track event. These drift times are stored in a drift
> structure which is listed in a TObjArray.
>
> Data stored in first branch (called raw) during first pass of data:
> class TRawData
> {
> Int_t run number,
> Int_t fill number,
> ...
> TClonesArray *wires; // wires("TMpxEvent")
> }
> with
> class TMpxEvent
> {
> Int _t index;
> Int_t time;
> T3DPoint p1;
> T3DPoint p2;
> ...
> }
>
> Once this database of particle track events is create, drift spectrums
> are created using the entire data set which map sense wire drift times
> to distances. Now, how would I incorporate this sense wire distance
> information into the TTree such that I can reference it relative to
> each of the sense wire drift structures?
>
> Following first pass, I can do
> tree->Draw("wires.time"); // works great.
>
> Following the second pass over data, I would like to do the following:
> tree->Draw("wires.distance","time = xxx && index = xxx");
>
> I understand this can be accomplished by moving all the sense wire
> data (TMpxEvent) directly onto the branch and performing a
> tree->Fill() for each wire, but that would require run_number,
> fill_number... etc in TRawData be written up to 50 times more often
> than necessary in the TFile.
No, you can execute commands like:
tree->Draw("wires.distance","wires.time == xxx && wires.index == xxx");
tree->Draw("wires.distance","run_number == yyy && fill_number == zzz");
Note that in the test, you must have
"wires.time == xxx
and not
"wires.time = xxx
Rene Brun