Bool_t TSelectorToEventList::Process(Long64_t entry)
{
- if(ProcessCut(entry)) { ProcessFill(entry); return true; }
- return false;
-}
-
-Bool_t TSelectorToEventList::ProcessCut(Long64_t )
-{
- return GetSelect()->EvalInstance(0) != 0;
+ if(GetSelect()->EvalInstance(0) != 0)
+ fEvList->Enter(entry);
+ return kTRUE;
}
/**************************************************************************/
t->Process(&sel, "goff");
return GetN();
}
+
+/**************************************************************************/
+// TPointSelectorConsumer, TPointSelector
+/**************************************************************************/
+
+ClassImp(TPointSelectorConsumer)
+ClassImp(TPointSelector)
+
+TPointSelector::TPointSelector(TTree* t,
+ TPointSelectorConsumer* c,
+ const Text_t* vexp, const Text_t* sel) :
+ TSelectorDraw(),
+
+ fTree (t),
+ fConsumer (c),
+ fVarexp (vexp),
+ fSelection (sel)
+{
+ SetInputList(&fInput);
+}
+
+Long64_t TPointSelector::Select(const Text_t* selection)
+{
+ if(selection != 0)
+ fSelection = selection;
+
+ fInput.Delete();
+ fInput.Add(new TNamed("varexp", fVarexp.Data()));
+ fInput.Add(new TNamed("selection", fSelection.Data()));
+
+ if(fTree)
+ fTree->Process(this, "goff");
+ return fSelectedRows;
+}
+
+Long64_t TPointSelector::Select(TTree* t, const Text_t* selection)
+{
+ fTree = t;
+ return Select(selection);
+}
+
+void TPointSelector::TakeAction()
+{
+ fSelectedRows += fNfill;
+ // printf("TPointSelector::TakeAction nfill=%d, nall=%lld\n", fNfill, fSelectedRows);
+ if(fConsumer) {
+ fConsumer->TakeAction(this);
+ }
+}
public:
TSelectorToEventList(TEventList* evl, const Text_t* sel);
+ virtual Int_t Version() const { return 1; }
virtual Bool_t Process(Long64_t entry);
- virtual Bool_t ProcessCut(Long64_t entry);
- virtual void ProcessFill(Long64_t entry) { fEvList->Enter(entry); }
ClassDef(TSelectorToEventList, 1)
};
ClassDef(TTreeQuery, 1)
};
+/**************************************************************************/
+// TPointSelectorConsumer, TPointSelector
+/**************************************************************************/
+
+class TPointSelector;
+
+class TPointSelectorConsumer
+{
+public:
+ enum TreeVarType_e { TVT_XYZ, TVT_RPhiZ };
+
+protected:
+ TreeVarType_e fSourceCS;
+
+public:
+ TPointSelectorConsumer(TreeVarType_e cs=TVT_XYZ) :fSourceCS(cs) {}
+ virtual ~TPointSelectorConsumer() {}
+
+ virtual void TakeAction(TSelectorDraw*) = 0;
+
+ TreeVarType_e GetSourceCS() const { return fSourceCS; }
+ void SetSourceCS(TreeVarType_e cs) { fSourceCS = cs; }
+
+ ClassDef(TPointSelectorConsumer, 1);
+};
+
+class TPointSelector : public TSelectorDraw
+{
+protected:
+ TTree *fTree;
+ TPointSelectorConsumer *fConsumer;
+
+ TString fVarexp;
+ TString fSelection;
+
+ TList fInput;
+
+public:
+ TPointSelector(TTree* t=0, TPointSelectorConsumer* c=0,
+ const Text_t* vexp="", const Text_t* sel="");
+ virtual ~TPointSelector() {}
+
+ virtual Long64_t Select(const Text_t* selection=0);
+ virtual Long64_t Select(TTree* t, const Text_t* selection=0);
+ virtual void TakeAction();
+
+
+ TTree* GetTree() const { return fTree; }
+ void SetTree(TTree* t) { fTree = t; }
+
+ TPointSelectorConsumer* GetConsumer() const { return fConsumer; }
+ void SetConsumer(TPointSelectorConsumer* c) { fConsumer = c; }
+
+ const Text_t* GetVarexp() const { return fVarexp; }
+ void SetVarexp(const Text_t* v) { fVarexp = v; }
+
+ const Text_t* GetSelection() const { return fSelection; }
+ void SetSelection(const Text_t* s) { fSelection = s; }
+
+ ClassDef(TPointSelector, 1);
+};
+
/**************************************************************************/
/**************************************************************************/