TH1::Project ---Cuts

Hi,

im trying to implement the project function using cuts over vector variables. Im trying different things, and they all run, but im not sure what are they doing. For example:

float n_events = tree-> Project(“histo_name”,“pT”,“cuts”);

Does the project function return the number of entries that satisfied the cuts, or the number of events?? (I guess that dependes on the variable being project…)

the next issue is related with the cuts over vector variables.
Is it valid to use: TString cut = “vector_variable[0]==1” ??
meaning that i want only the first position of the vector variable to be equal to one (independtly of the others positions…)

And what if i put TString cut = “vector_variable==1” ??
it means that if at least one of the positions of the array is equal to one…the event passes the cut?? if so…only the positions that are equal to one are filled on the histograms…or the hole event??

I hope my doubt is clear,
Thanks
Xabier

Hi,

The semantic of Project is similar to TTree::Draw, so you can find a complete description at root.cern.ch/root/html/TTree.html#TTree:Draw.

[quote]Does the project function return the number of entries that satisfied the cuts, or the number of events?? (I guess that dependes on the variable being project…) [/quote]It returns the number of entries in the resulting histograms (i.e. the sum of the number of array elements that pass the cut if any array is involved).

[quote]Is it valid to use: TString cut = “vector_variable[0]==1” ??
meaning that i want only the first position of the vector variable to be equal to one (independtly of the others positions…) [/quote]Yes it is valid and does what you expect.

[quote]And what if i put TString cut = “vector_variable==1” ??
it means that if at least one of the positions of the array is equal to one…the event passes the cut?? if so…only the positions that are equal to one are filled on the histograms…or the hole event?? [/quote]This means that each element of the vector will be looked at individually [and hence only the position that are equal to one are filled on the histogram].

Cheers,
Philippe.