#ifndef MySel_h #define MySel_h #include "headers.h" class MySel: public TSelector { private : TTree *outTree; public : TChain *inTree; Float_t inVariable; Float_t outVariable; Long64_t nbytes, nb; Int_t fCurrent; TBranch *b_event_branch_inVariable; MySel(TTree * /*tree*/ =0) { } virtual ~MySel() { } virtual void Begin(TChain *inTree); virtual void SlaveBegin(); virtual void inTreeInit(TChain *inTree); virtual Bool_t Notify(); virtual void Show(Long64_t entry = -1); virtual Bool_t Process(Long64_t entry); virtual Int_t GetEntry(Long64_t entry); virtual Long64_t LoadTree(Long64_t entry); virtual TList *GetOutputList() const { return fOutput; } virtual void SlaveTerminate(); virtual void Terminate(); ClassDef(MySel,2); }; #endif #ifdef MySel_cxx void MySel::Show(Long64_t entry){ // Print contents of entry. // If entry is not specified, print current entry if (!inTree) return; inTree->Show(entry); } Int_t MySel::GetEntry(Long64_t entry){ // Read contents of entry. if (!inTree) return 0; Int_t getall=1; return inTree->GetEntry(entry, getall); } Long64_t MySel::LoadTree(Long64_t entry){ // Set the environment to read one entry if (!inTree) return -5; Long64_t centry = inTree->LoadTree(entry); if (centry < 0) return centry; if (!inTree->InheritsFrom(TChain::Class())) return centry; TChain *chain = (TChain*)inTree; if (chain->GetTreeNumber() != fCurrent) { fCurrent = chain->GetTreeNumber(); Notify(); } return centry; } Bool_t MySel::Notify() { return kTRUE; } void MySel::inTreeInit(TChain *intree) { // Set branch addresses and branch pointers fCurrent=-1; if (!intree) return; inTree = intree; inTree->SetMakeClass(1); inTree->SetBranchAddress("inVariable", &inVariable, &b_event_branch_inVariable); Notify(); } #endif