Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ProofFriends.h File Reference

Detailed Description

Selector to process tree friends.

#ifndef ProofFriends_h
#define ProofFriends_h
#include "TChain.h"
#include "TSelector.h"
class TH1F;
class TH2F;
class ProofFriends : public TSelector {
public :
TTree *fChain; //!pointer to the analyzed TTree or TChain
Bool_t fPlot; // Whether to plot the result
Bool_t fDoFriends; // Whether to use the friend tree
// Specific members
TH2F *fXY;
TH1F *fZ;
TH1F *fR;
TH2F *fRZ;
// Declaration of leaf types
Int_t Run;
Float_t r; // The friend
// List of branches
TBranch *b_Run; //!
TBranch *b_Event; //!
TBranch *b_x; //!
TBranch *b_y; //!
TBranch *b_z; //!
TBranch *b_r; //! The friend branch
ProofFriends();
~ProofFriends() override { }
Int_t Version() const override { return 2; }
void Begin(TTree *tree) override;
void SlaveBegin(TTree *tree) override;
void Init(TTree *tree) override;
Bool_t Notify() override;
Bool_t Process(Long64_t entry) override;
Int_t GetEntry(Long64_t entry, Int_t getall = 0) override { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; }
void SetOption(const char *option) override { fOption = option; }
void SetObject(TObject *obj) override { fObject = obj; }
void SetInputList(TList *input) override { fInput = input; }
TList *GetOutputList() const override { return fOutput; }
void SlaveTerminate() override;
void Terminate() override;
ClassDefOverride(ProofFriends,0);
};
#endif
#ifdef ProofFriends_cxx
void ProofFriends::Init(TTree *tree)
{
// The Init() function is called when the selector needs to initialize
// a new tree or chain. Typically here the branch addresses and branch
// pointers of the tree will be set.
// It is normally not necessary to make changes to the generated
// code, but the routine can be extended by the user if needed.
// Init() will be called many times when running on PROOF
// (once per file to be processed).
// Set branch addresses and branch pointers
if (!tree) return;
fChain = tree;
fChain->SetMakeClass(1);
fChain->SetBranchAddress("Run", &Run, &b_Run);
fChain->SetBranchAddress("Event", &Event, &b_Event);
fChain->SetBranchAddress("x", &x, &b_x);
fChain->SetBranchAddress("y", &y, &b_y);
fChain->SetBranchAddress("z", &z, &b_z);
fChain->SetBranchAddress("r", &r, &b_r); // The friend
}
Bool_t ProofFriends::Notify()
{
// The Notify() function is called when a new file is opened. This
// can be either for a new TTree in a TChain or when when a new TTree
// is started when using PROOF. It is normally not necessary to make changes
// to the generated code, but the routine can be extended by the
// user if needed. The return value is currently not used.
return kTRUE;
}
#endif // #ifdef ProofFriends_cxx
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
long long Long64_t
Definition RtypesCore.h:80
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
A TTree is a list of TBranches.
Definition TBranch.h:93
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:621
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:307
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition TSelector.h:31
virtual void SetObject(TObject *obj)
Definition TSelector.h:65
virtual void Init(TTree *)
Definition TSelector.h:53
virtual int Version() const
Definition TSelector.h:52
virtual bool Process(Long64_t)
The Process() function is called for each entry in the tree (or possibly keyed object in the case of ...
TSelectorList * fOutput
! List of objects created during processing
Definition TSelector.h:42
virtual void SlaveBegin(TTree *)
Definition TSelector.h:55
virtual Int_t GetEntry(Long64_t, Int_t=0)
Definition TSelector.h:59
bool Notify() override
This method must be overridden to handle object notification (the base implementation is no-op).
Definition TSelector.h:56
virtual void SetOption(const char *option)
Definition TSelector.h:64
virtual void SetInputList(TList *input)
Definition TSelector.h:66
virtual TList * GetOutputList() const
Definition TSelector.h:69
virtual void SlaveTerminate()
Definition TSelector.h:70
virtual void Begin(TTree *)
Definition TSelector.h:54
virtual void Terminate()
Definition TSelector.h:71
A TTree represents a columnar dataset.
Definition TTree.h:79
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
Definition TTree.cxx:5638
virtual void SetMakeClass(Int_t make)
Set all the branches in this TTree to be in decomposed object mode (also known as MakeClass mode).
Definition TTree.cxx:9177
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=nullptr)
Change branch address, dealing with clone trees properly.
Definition TTree.cxx:8385
virtual TTree * GetTree() const
Definition TTree.h:517
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Author
Gerardo Ganis (gerar.nosp@m.do.g.nosp@m.anis@.nosp@m.cern.nosp@m..ch)

Definition in file ProofFriends.h.