Dear,
I have been trying to use TEventList to select events from a Tree, but I am getting the full collection of data. For instance, I am getting the total number of entries, instead of the desired selection. Could you please indicate me what I am doing wrong in this piece of code:
TTree OptData = (TTree)gDirectory->Get(“Hits”);
OptData->SetBranchAddress(“edep”,&edep);
OptData->SetBranchAddress(“time”,&time);
OptData->SetBranchAddress(“posX”,&posX);
OptData->SetBranchAddress(“posY”,&posY);
OptData->SetBranchAddress(“pixelID”,&pixelID);
OptData->SetBranchAddress(“eventID”,&eventID);
OptData->SetBranchAddress(“PDGEncoding”,&PDGEncoding);
OptData->Draw(">>elist",“PDGEncoding==-22 && pixelID == 0 && eventID==0”);
TEventList* tel = (TEventList*)gDirectory->Get(“elist”);
OptData->SetEventList(tel);
nEntries = OptData->GetEntries();
cout<<" nEntries= “<< nEntries << endl;
if (nEntries>0)
{
tMinimum = OptData->GetMinimum(“time”);
cout<<” Arrival time of the first fóton = “<< tMinimum << endl;
for(int n=0;n<nEntries;n++)
{
OptData->GetEntry(n);
// Do something
nHits++;
}
cout<<” nHits= "<< nHits << endl;
nHits = 0;
}
regards,
Daniel
Please read tips for efficient and successful posting and posting code
ROOT Version: 6.24.06
Platform: Linux
Compiler: g++