TChain, AddFriends and variable lengths of trees in a file

Hi,

We have a file format which contains (among others) a tree called Header which contains the parameters that are unique per file (trigger information and such) and a tree called Events which contains the parameters that change per event (energy, etc) for a large number of events.

So far I have been creating chains containing the Events-tree for multiple files to extract information and this has been working very well. However, now I need to incorporate some information from the header into my chain of Events. I started by friending the Header and Event chain, but obviously that doesn’t work. (Event 1 will have the right Header information, but Event 2 will get the header information from file 2 and so on).

What I would need to do is to assign each event in a file the same value from the header. So that I can select events based on their header information. My first question is: Is this even possible. My second question would be: If yes, how do I do it?

EDIT: To clarify, what I would like to be able to do in the end is: tree->Draw(“Energy”,“TriggerCondition==3”);
So that only the energy of the events get plotted, which were taken with a certain trigger condition.

Thanks!
myrti