Re: Saving/Retrieving vector, map in root file

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Tue, 5 Oct 2010 14:57:37 +0200


Hi Hovhannes,

Instead of the expensive/inefficient C++ map, I recommend one of the 2 following solutions
 -Solution 1: Create a TBits object + a TObjString. You mark the TBits(i) for the entries passing (or not) your cut and in the TObjString you give a name to your cut. If you have many cuts, you can group your TBits in a TObjArray mybits and same for the TObjString mycuts. At the end of your job, add your 2 TObjArrays to mytree.GetUserInfo()

    mytree->GetUserInfo()->Add(mybits)
    mytree->GetUserInfo()->Add(mycuts)

 -Solution 2: Create one TEntryList for each cut (a TEntryList uses internally TBits for passing (or not) cuts and add yout TEntryList to mytree.GetUserInfo().

Generally speaking you can add as many objects (meta data, etc) to the GetUserInfo list. This has the advantage to keep a close contact between your Tree and the associated meta data.

Rene Brun

 Khandanyan wrote:
>
> Dear ROOTers,
>
> I am running my analysis over N events applying m cuts in my event
> selection. While running over events I fill TTree leaves per parameter
> of interest for the analysis (Pt, Met etc.) Each leaf hence has N
> entries. Along with this I define a C++ map associating cut name with
> the number of events that passed given cut (hence map of size m). So
> what would be the best way to store this map, so that I can later on
> retrieve it for further analysis?
>
> Thank you,
> Hovhannes
Received on Tue Oct 05 2010 - 14:57:41 CEST

This archive was generated by hypermail 2.2.0 : Tue Oct 05 2010 - 17:50:01 CEST