Writing global information to TTree

Hello,

I have a TTree storing different parameters for each event.
The events are filled into the TTree after passing through a preselection module which accepts or rejects events based on certain criteria, say whether a muon above 10GeV is present or not.

My question is, how can I store the actual number of events processed by the preselection module and its efficiency, i.e. (number of events written to tree)/(number of events processed) ?

This is in a sense a global variable for the entire analysis and should be in the Tree header. However, I did not come across any suitable example to do this. How do I go about writing this info to my Tree?

Thanks,

Devdatta.

Hi,

you can put any TObject-derived class into the TList attached to a TTree which is accessible through TTree::GetUsetInfo(). You could e.g. wrap that efficiency into a TParameter.

Cheers, Axel.

Hi,

Thanks.

Once I have the Tree, how do I access the TList stored in the header? For example, if I do MakeClass to read the event records, I would like to read the TParameter stored in the TList in the constructor.

Best regards,

Devdatta.

Hi,

You can simply get the list by calling fChain->GetTree()->GetUserInfo().

Philippe.