#define testSel_cxx // The class definition in testSel.h has been generated automatically // by the Root utility TTree::MakeSelector. // // This class is derived from the Root class TSelector. // The following members functions are called by the TTree::Process functions. // Begin: called everytime a loop on the tree starts. // a convenient place to create your histograms. // Notify(): This function is called at the first entry of a new Tree // in a chain. // ProcessCut: called at the beginning of each entry to return a flag // true if the entry must be analyzed. // ProcessFill: called in the entry loop for all entries accepted // by Select. // Terminate: called at the end of a loop on a TTree. // a convenient place to draw/fit your histograms. // // To use this file, try the following session on your Tree T // // Root > T.Process("testSel.C") // Root > T.Process("testSel.C,"some options"") // Root > T.Process("testSel.C+") // #include "testSel.h" #include "TH2.h" #include "TStyle.h" #include "TCanvas.h" void testSel::Begin(TTree *tree) { // function called before starting the event loop // initialize the tree branches Init(tree); TString option = GetOption(); } Bool_t testSel::ProcessCut(Int_t entry) { // Selection function // entry is the entry number in the current Tree // Read only the necessary branches to select entries. // return as soon as a bad entry is detected. // to read complete event, call fChain->GetTree()->GetEntry(entry) b_p->GetEntry(entry); printf("p=%f\n",p); return kTRUE; } void testSel::ProcessFill(Int_t entry) { // function called for selected entries only // entry is the entry number in the current Tree // read branches not processed in ProcessCut and fill histograms // to read complete event, call fChain->GetTree()->GetEntry(entry) } void testSel::Terminate() { // function called at the end of the event loop }