Hi Rene,
Can you please comment on the efficiency of the follow solution, which I normally use and would've recommended to Hovhannes?
Since you're already filling in information, why not add pass/fail fields to the tree, one for each cut?
This has the advantage that you can then easily combine cuts using the usual ROOT tools. It should be efficient on disk and in I/O since ROOT compresses each leaf separately, so will use only a bit for each pass/fail entry.
At least, that's what I thought until I saw Rene's answer :-)
cheers,
Amnon
-----Original Message-----
From: owner-roottalk_at_root.cern.ch on behalf of Rene Brun
Sent: Tue 05-Oct-10 6:57 AM
To: Hovhannes Khandanyan
Cc: roottalk (Mailing list discussing all aspects of the ROOT system.)
Subject: Re: [ROOT] Saving/Retrieving vector, map in root file
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 - 15:19:06 CEST
This archive was generated by hypermail 2.2.0 : Tue Oct 05 2010 - 17:50:01 CEST