Re: vectors in selection cuts in TTrees

From: suvayu ali <fatkasuvayu_at_gmail.com>
Date: Thu, 30 Sep 2010 13:39:56 -0700


Hi Philippe,

On 30 September 2010 13:10, Philippe Canal <pcanal_at_fnal.gov> wrote:
>  Hi,
>
>>  I am not clear about something though, the above formula
>>  would mean the effective loop looks something like this:
>
>>  for(int i=0; i<mc_n;i++) {
>>  ....
>>       for (int j=0; j<mc_parent_index->size(); j++) {
>
> This is not correct.  The implied look in your case really has
> only _one_ running index which is used for both array dereferencing.
> (There would be a 2nd implied look if you replace the
>   mc_pdgId[ mc_parent_index[][0] ]
> by
>   mc_pdgId[ mc_parent_index[][] ]
>

Thank you soo much! This makes it much clearer. I think this is mentioned in the documentation, but I guess I didn't understand it properly until now.

>>  I don't want to lose any of the branches. I want to copy the entire
>>  event (meaning all branches for the matching entry).
>
> You don't lose any branches.   My point is that you copy the _entire_
> event whenever at least one of the muon matches the criteria.
> (and hence the resulting file with have both muons that do match
> and muon that do not matches the criteria).
>

Yes, that is my intention. If there is one match I don't want to exclude any of the other muons in the same event. I am actually trying to separate events with muons from events with taus. And in the sample, they are mutually exclusive.

>>  It might not work if there were more muons from other sources.
>
> I think it should still work.
>

Yes, after your explanation about the running index this is very clear.

> Cheers,
> Philippe.
>

Thanks a lot, the whole discussion was extremely helpful. :)

-- 
Suvayu

Open source is the future. It sets us free.
Received on Thu Sep 30 2010 - 22:40:21 CEST

This archive was generated by hypermail 2.2.0 : Fri Oct 01 2010 - 11:50:02 CEST