Re:

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jun 23 1997 - 16:29:42 MEST


Maarten Bruinsma wrote:
> 
> Dear ROOT,
> 
> When I want to determine how many entries in my ntuple
> satisfy a certain selection, do I have to give an explicit command that
> the selection-string has to be processed? I have tried the following:
> 
> // Calculate efficiencies:
> 
>  Float_t Ptcut,Pcut;
>  Int_t Nr_Selected;
>  Int_t Nr_NotSelected;
>  Char_t Cuts[80];
>  sprintf(Cuts,"sqrt(Px*Px+Py*Py)>0");
>  TTreeFormula* Selection = new TTreeFormula("selectionform", Cuts,
> muontuple);
>  Nr_NotSelected= muontuple->GetSelectedRows();
> 
>  for(Ptcut=0;Ptcut<2;Ptcut+=0.1)
>  {
>  for(Pcut=0;Pcut<20;Pcut+=1)
>  {
>  sprintf(Cuts," sqrt(Px*Px+Py*Py)> %f &&  sqrt(Px*Px+Py*Py+Pz*Pz) > %f",
> Ptcut, Pcut);
>  Nr_Selected = muontuple->GetSelectedRows();
> 
>  Efficiencies->Fill(Nr_Selected,Ptcut,Pcut);
> 
>  }
>  }
> 
> But somehow the NrSelected is always zero. What should I do?

We do not have a function right now returning the number of events
passing a selection formula. But you can get it with two lines:
   Root > muontuple->Draw("Px","your selection", "goff");
   Root > muontuple->GetSelectedRows();

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:19 MET