ROOT
6.06/09
Reference Guide
|
Implement some of the functionality of the class TTree requiring access to extra libraries (Histogram, display, etc).
Definition at line 43 of file TTreePlayer.h.
Public Member Functions | |
TTreePlayer () | |
virtual | ~TTreePlayer () |
Tree destructor. More... | |
virtual TVirtualIndex * | BuildIndex (const TTree *T, const char *majorname, const char *minorname) |
Build the index for the tree (see TTree::BuildIndex) More... | |
virtual TTree * | CopyTree (const char *selection, Option_t *option, Long64_t nentries, Long64_t firstentry) |
Copy a Tree with selection, make a clone of this Tree header, then copy the selected entries. More... | |
virtual Long64_t | DrawScript (const char *wrapperPrefix, const char *macrofilename, const char *cutfilename, Option_t *option, Long64_t nentries, Long64_t firstentry) |
Draw the result of a C++ script. More... | |
virtual Long64_t | DrawSelect (const char *varexp, const char *selection, Option_t *option, Long64_t nentries, Long64_t firstentry) |
Draw expression varexp for specified entries that matches the selection. More... | |
virtual Int_t | Fit (const char *formula, const char *varexp, const char *selection, Option_t *option, Option_t *goption, Long64_t nentries, Long64_t firstentry) |
Fit a projected item(s) from a Tree. More... | |
virtual Int_t | GetDimension () const |
TH1 * | GetHistogram () const |
virtual Long64_t | GetEntries (const char *selection) |
Return the number of entries matching the selection. More... | |
virtual Long64_t | GetEntriesToProcess (Long64_t firstentry, Long64_t nentries) const |
return the number of entries to be processed this function checks that nentries is not bigger than the number of entries in the Tree or in the associated TEventlist More... | |
virtual Int_t | GetNfill () const |
const char * | GetScanFileName () const |
TTreeFormula * | GetSelect () const |
virtual Long64_t | GetSelectedRows () const |
TSelector * | GetSelector () const |
TSelector * | GetSelectorFromFile () const |
TTreeFormula * | GetVar (Int_t i) const |
TTreeFormula * | GetVar1 () const |
TTreeFormula * | GetVar2 () const |
TTreeFormula * | GetVar3 () const |
TTreeFormula * | GetVar4 () const |
virtual Double_t * | GetVal (Int_t i) const |
virtual Double_t * | GetV1 () const |
virtual Double_t * | GetV2 () const |
virtual Double_t * | GetV3 () const |
virtual Double_t * | GetV4 () const |
virtual Double_t * | GetW () const |
virtual Int_t | MakeClass (const char *classname, Option_t *option) |
Generate skeleton analysis class for this Tree. More... | |
virtual Int_t | MakeCode (const char *filename) |
Generate skeleton function for this Tree. More... | |
virtual Int_t | MakeProxy (const char *classname, const char *macrofilename=0, const char *cutfilename=0, const char *option=0, Int_t maxUnrolling=3) |
Generate a skeleton analysis class for this Tree using TBranchProxy. More... | |
virtual Int_t | MakeReader (const char *classname, Option_t *option) |
Generate skeleton selector class for this tree. More... | |
TPrincipal * | Principal (const char *varexp, const char *selection, Option_t *option, Long64_t nentries, Long64_t firstentry) |
Interface to the Principal Components Analysis class. More... | |
virtual Long64_t | Process (const char *filename, Option_t *option, Long64_t nentries, Long64_t firstentry) |
Process this tree executing the TSelector code in the specified filename. More... | |
virtual Long64_t | Process (TSelector *selector, Option_t *option, Long64_t nentries, Long64_t firstentry) |
Process this tree executing the code in the specified selector. More... | |
virtual void | RecursiveRemove (TObject *obj) |
cleanup pointers in the player pointing to obj More... | |
virtual Long64_t | Scan (const char *varexp, const char *selection, Option_t *option, Long64_t nentries, Long64_t firstentry) |
Loop on Tree and print entries passing selection. More... | |
Bool_t | ScanRedirected () |
virtual TSQLResult * | Query (const char *varexp, const char *selection, Option_t *option, Long64_t nentries, Long64_t firstentry) |
Loop on Tree and return TSQLResult object containing entries passing selection. More... | |
virtual void | SetEstimate (Long64_t n) |
Set number of entries to estimate variable limits. More... | |
void | SetScanRedirect (Bool_t on=kFALSE) |
void | SetScanFileName (const char *name) |
virtual void | SetTree (TTree *t) |
virtual void | StartViewer (Int_t ww, Int_t wh) |
Start the TTreeViewer on this TTree. More... | |
virtual Int_t | UnbinnedFit (const char *formula, const char *varexp, const char *selection, Option_t *option, Long64_t nentries, Long64_t firstentry) |
virtual void | UpdateFormulaLeaves () |
ClassDef (TTreePlayer, 3) | |
Public Member Functions inherited from TVirtualTreePlayer | |
TVirtualTreePlayer () | |
virtual | ~TVirtualTreePlayer () |
Common destructor. More... | |
ClassDef (TVirtualTreePlayer, 0) | |
Public Member Functions inherited from TObject | |
TObject () | |
TObject (const TObject &object) | |
TObject copy ctor. More... | |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. More... | |
virtual | ~TObject () |
TObject destructor. More... | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. More... | |
virtual void | Browse (TBrowser *b) |
Browse object. May be overridden for another default action. More... | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. More... | |
virtual void | Clear (Option_t *="") |
virtual TObject * | Clone (const char *newname="") const |
Make a clone of an object using the Streamer facility. More... | |
virtual Int_t | Compare (const TObject *obj) const |
Compare abstract method. More... | |
virtual void | Copy (TObject &object) const |
Copy this to obj. More... | |
virtual void | Delete (Option_t *option="") |
Delete this object. More... | |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Computes distance from point (px,py) to the object. More... | |
virtual void | Draw (Option_t *option="") |
Default Draw method for all objects. More... | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. More... | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current pad. More... | |
virtual void | Dump () const |
Dump contents of object on stdout. More... | |
virtual void | Execute (const char *method, const char *params, Int_t *error=0) |
Execute method on this object with the given parameter string, e.g. More... | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=0) |
Execute method on this object with parameters stored in the TObjArray. More... | |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute action corresponding to an event at (px,py). More... | |
virtual TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. More... | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. More... | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. More... | |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. More... | |
virtual const char * | GetName () const |
Returns name of object. More... | |
virtual const char * | GetIconName () const |
Returns mime type name of object. More... | |
virtual Option_t * | GetOption () const |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Returns string containing info about the object at position (px,py). More... | |
virtual const char * | GetTitle () const |
Returns title of object. More... | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. More... | |
virtual ULong_t | Hash () const |
Return hash value for this object. More... | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". More... | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. More... | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. More... | |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More... | |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). More... | |
virtual Bool_t | IsSortable () const |
Bool_t | IsOnHeap () const |
Bool_t | IsZombie () const |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification. More... | |
virtual void | ls (Option_t *option="") const |
The ls function lists the contents of a class on stdout. More... | |
virtual void | Paint (Option_t *option="") |
This method must be overridden if a class wants to paint itself. More... | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. More... | |
virtual void | Print (Option_t *option="") const |
This method must be overridden when a class wants to print itself. More... | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. More... | |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. More... | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save a primitive as a C++ statement(s) on output stream "out". More... | |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. More... | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. More... | |
virtual void | UseCurrentStyle () |
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. More... | |
void * | operator new (size_t sz) |
void * | operator new[] (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz, void *vp) |
void | operator delete (void *ptr) |
Operator delete. More... | |
void | operator delete[] (void *ptr) |
Operator delete []. More... | |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. More... | |
void | SetBit (UInt_t f) |
void | ResetBit (UInt_t f) |
Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
void | InvertBit (UInt_t f) |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. More... | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. More... | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. More... | |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. More... | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. More... | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. More... | |
void | MayNotUse (const char *method) const |
Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More... | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. More... | |
Protected Member Functions | |
const char * | GetNameByIndex (TString &varexp, Int_t *index, Int_t colindex) |
Set to the selector address when it's entry list needs to be updated by the UpdateFormulaLeaves function. More... | |
void | TakeAction (Int_t nfill, Int_t &npoints, Int_t &action, TObject *obj, Option_t *option) |
void | TakeEstimate (Int_t nfill, Int_t &npoints, Int_t action, TObject *obj, Option_t *option) |
void | DeleteSelectorFromFile () |
Delete any selector created by this object. More... | |
Protected Member Functions inherited from TObject | |
void | MakeZombie () |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). More... | |
Protected Attributes | |
TTree * | fTree |
Bool_t | fScanRedirect |
Pointer to current Tree. More... | |
const char * | fScanFileName |
Int_t | fDimension |
Long64_t | fSelectedRows |
TH1 * | fHistogram |
TSelectorDraw * | fSelector |
Pointer to histogram used for the projection. More... | |
TSelector * | fSelectorFromFile |
Pointer to current selector. More... | |
TClass * | fSelectorClass |
Pointer to a user defined selector created by this TTreePlayer object. More... | |
TList * | fInput |
Pointer to the actual class of the TSelectorFromFile. More... | |
TList * | fFormulaList |
input list to the selector More... | |
TSelector * | fSelectorUpdate |
Pointer to a list of coordinated list TTreeFormula (used by Scan and Query) More... | |
Private Member Functions | |
TTreePlayer (const TTreePlayer &) | |
TTreePlayer & | operator= (const TTreePlayer &) |
Additional Inherited Members | |
Public Types inherited from TObject | |
enum | EStatusBits { kCanDelete = BIT(0), kMustCleanup = BIT(3), kObjInCanvas = BIT(3), kIsReferenced = BIT(4), kHasUUID = BIT(5), kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13) } |
enum | { kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kBitMask = 0x00ffffff } |
enum | { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) } |
Static Public Member Functions inherited from TVirtualTreePlayer | |
static TVirtualTreePlayer * | GetCurrentPlayer () |
Static function: return the current player (if any) More... | |
static TVirtualTreePlayer * | TreePlayer (TTree *obj) |
static void | SetPlayer (const char *player) |
Static function to set an alternative Tree player. More... | |
Static Public Member Functions inherited from TObject | |
static Long_t | GetDtorOnly () |
Return destructor only flag. More... | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. More... | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. More... | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. More... | |
Static Public Attributes inherited from TVirtualTreePlayer | |
static constexpr Long64_t | kMaxEntries = std::numeric_limits<Long64_t>::max() |
#include <TTreePlayer.h>
|
private |
TTreePlayer::TTreePlayer | ( | ) |
|
virtual |
Tree destructor.
Definition at line 122 of file TTreePlayer.cxx.
|
virtual |
Build the index for the tree (see TTree::BuildIndex)
Implements TVirtualTreePlayer.
Definition at line 135 of file TTreePlayer.cxx.
TTreePlayer::ClassDef | ( | TTreePlayer | , |
3 | |||
) |
|
virtual |
Copy a Tree with selection, make a clone of this Tree header, then copy the selected entries.
IMPORTANT: The copied tree stays connected with this tree until this tree is deleted. In particular, any changes in branch addresses in this tree are forwarded to the clone trees. Any changes made to the branch addresses of the copied trees are over-ridden anytime this tree changes its branch addresses. Once this tree is deleted, all the addresses of the copied tree are reset to their default values.
The following example illustrates how to copy some events from the Tree generated in $ROOTSYS/test/Event
Implements TVirtualTreePlayer.
Definition at line 180 of file TTreePlayer.cxx.
|
protected |
Delete any selector created by this object.
The selector has been created using TSelector::GetSelector(file)
Definition at line 245 of file TTreePlayer.cxx.
Referenced by Process(), and ~TTreePlayer().
|
virtual |
Draw the result of a C++ script.
The macrofilename and optionally cutfilename are assumed to contain at least a method with the same name as the file. The method should return a value that can be automatically cast to respectively a double and a boolean.
Both methods will be executed in a context such that the branch names can be used as C++ variables. This is accomplished by generating a TTreeProxy (see MakeProxy) and including the files in the proper location.
If the branch name can not be used a proper C++ symbol name, it will be modified as follow:
If a cutfilename is specified, for each entry, we execute
If no cutfilename is specified, for each entry we execute
The default for the histogram are the same as for TTreePlayer::DrawSelect
Implements TVirtualTreePlayer.
Definition at line 288 of file TTreePlayer.cxx.
Referenced by DrawSelect().
|
virtual |
Draw expression varexp for specified entries that matches the selection.
Returns -1 in case of error or number of selected events in case of succss.
See the documentation of TTree::Draw for the complete details.
Implements TVirtualTreePlayer.
Definition at line 332 of file TTreePlayer.cxx.
Referenced by Fit().
|
virtual |
Fit a projected item(s) from a Tree.
Returns -1 in case of error or number of selected events in case of success.
The formula is a TF1 expression.
See TTree::Draw for explanations of the other parameters.
By default the temporary histogram created is called htemp. If varexp contains >>hnew , the new histogram created is called hnew and it is kept in the current directory. Example:
The function returns the status of the histogram fit (see TH1::Fit) If no entries were selected, the function returns -1; (i.e. fitResult is null if the fit is OK)
Implements TVirtualTreePlayer.
Definition at line 557 of file TTreePlayer.cxx.
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 82 of file TTreePlayer.h.
Referenced by TFitEditor::DoFit().
|
virtual |
Return the number of entries matching the selection.
Return -1 in case of errors.
If the selection uses any arrays or containers, we return the number of entries where at least one element match the selection. GetEntries is implemented using the selector class TSelectorEntries, which can be used directly (see code in TTreePlayer::GetEntries) for additional option. If SetEventList was used on the TTree or TChain, only that subset of entries will be considered.
Implements TVirtualTreePlayer.
Definition at line 587 of file TTreePlayer.cxx.
return the number of entries to be processed this function checks that nentries is not bigger than the number of entries in the Tree or in the associated TEventlist
Definition at line 600 of file TTreePlayer.cxx.
Referenced by CopyTree(), Principal(), Process(), Query(), and Scan().
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 83 of file TTreePlayer.h.
Referenced by TH1Editor::DoBinLabel1(), TH2Editor::DoBinLabel1(), TH1Editor::DoBinOffset(), TH2Editor::DoBinOffset(), TH1Editor::DoBinReleased1(), TH2Editor::DoBinReleased1(), TH1Editor::DoOffsetMoved(), TH2Editor::DoOffsetMoved(), TH1Editor::DoOffsetReleased(), TH2Editor::DoOffsetReleased(), TH1Editor::DoSliderMoved(), TH1Editor::DoSliderReleased(), TH2Editor::DoSliderXReleased(), TH2Editor::DoSliderYReleased(), TH1Editor::SetModel(), and TH2Editor::SetModel().
|
protected |
Set to the selector address when it's entry list needs to be updated by the UpdateFormulaLeaves function.
Return name corresponding to colindex in varexp.
Definition at line 620 of file TTreePlayer.cxx.
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 86 of file TTreePlayer.h.
Referenced by TH1Editor::SetModel(), and TH2Editor::SetModel().
|
inline |
Definition at line 87 of file TTreePlayer.h.
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 88 of file TTreePlayer.h.
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 89 of file TTreePlayer.h.
Referenced by TFitEditor::DoFit().
|
inline |
Definition at line 90 of file TTreePlayer.h.
Referenced by TH1Editor::DoBinLabel1(), TH2Editor::DoBinLabel1(), TH1Editor::DoBinOffset(), TH2Editor::DoBinOffset(), TH1Editor::DoBinReleased1(), TH2Editor::DoBinReleased1(), TFitEditor::DoFit(), TH1Editor::DoOffsetMoved(), TH2Editor::DoOffsetMoved(), TH1Editor::DoOffsetReleased(), and TH2Editor::DoOffsetReleased().
|
inline |
Definition at line 91 of file TTreePlayer.h.
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 105 of file TTreePlayer.h.
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 107 of file TTreePlayer.h.
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 109 of file TTreePlayer.h.
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 111 of file TTreePlayer.h.
Implements TVirtualTreePlayer.
Definition at line 103 of file TTreePlayer.h.
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 93 of file TTreePlayer.h.
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 95 of file TTreePlayer.h.
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 97 of file TTreePlayer.h.
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 99 of file TTreePlayer.h.
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 101 of file TTreePlayer.h.
|
inlinevirtual |
Implements TVirtualTreePlayer.
Definition at line 112 of file TTreePlayer.h.
Generate skeleton analysis class for this Tree.
The following files are produced: classname.h and classname.C If classname is 0, classname will be called "nameoftree.
The generated code in classname.h includes the following:
The generated code in classname.C includes only the main analysis function Loop.
To use this function:
where T is the name of the Tree in file myfile.root and MyClass.h, MyClass.C the name of the files created by this function. In a ROOT session, you can do:
NOTE: Do not use the code generated for one Tree in case of a TChain. Maximum dimensions calculated on the basis of one TTree only might be too small when processing all the TTrees in one TChain. Instead of myTree.MakeClass(.., use myChain.MakeClass(..
Implements TVirtualTreePlayer.
Definition at line 716 of file TTreePlayer.cxx.
|
virtual |
Generate skeleton function for this Tree.
The function code is written on filename. If filename is 0, filename will be called nameoftree.C
The generated code includes the following:
To use this function:
NOTE: Since the implementation of this function, a new and better function TTree::MakeClass() has been developed.
Implements TVirtualTreePlayer.
Definition at line 1546 of file TTreePlayer.cxx.
|
virtual |
Generate a skeleton analysis class for this Tree using TBranchProxy.
TBranchProxy is the base of a class hierarchy implementing an indirect access to the content of the branches of a TTree.
"proxyClassname" is expected to be of the form:
The skeleton will then be generated in the file:
located in the current directory or in 'path/' if it is specified. The class generated will be named 'fileprefix'. If the fileprefix contains a period, the right side of the period will be used as the extension (instead of 'h') and the left side will be used as the classname.
"macrofilename" and optionally "cutfilename" are expected to point to source file which will be included in by the generated skeletong. Method of the same name as the file(minus the extension and path) will be called by the generated skeleton's Process method as follow:
"option" can be used select some of the optional features during the code generation. The possible options are:
'maxUnrolling' controls how deep in the class hierarchy does the system 'unroll' class that are not split. 'unrolling' a class will allow direct access to its data members a class (this emulates the behavior of TTreeFormula).
The main features of this skeleton are:
For example with Event.root, if
is executed by one of the method of the skeleton, somepx will be updated with the current value of fPx of the 3rd track.
Both macrofilename and the optional cutfilename are expected to be the name of source files which contain at least a free standing function with the signature:
and
x_t and y_t needs to be types that can convert respectively to a double and a bool (because the skeleton uses:
This 2 functions are run in a context such that the branch names are available as local variables of the correct (read-only) type.
Note that if you use the same 'variable' twice, it is more efficient to 'cache' the value. For example
is more efficient than
Access to TClonesArray.
If a branch (or member) is a TClonesArray (let's say fTracks), you can access the TClonesArray itself by using ->:
However this will load the full TClonesArray object and its content. To quickly read the size of the TClonesArray use (note the dot):
This will read only the size from disk if the TClonesArray has been split. To access the content of the TClonesArray, use the [] operator:
Warning:
The variable actually use for access are 'wrapper' around the real data type (to add autoload for example) and hence getting to the data involves the implicit call to a C++ conversion operator. This conversion is automatic in most case. However it is not invoked in a few cases, in particular in variadic function (like printf). So when using printf you should either explicitly cast the value or use any intermediary variable:
Also, optionally, the generated selector will also call methods named macrofilename_methodname in each of 6 main selector methods if the method macrofilename_methodname exist (Where macrofilename is stripped of its extension).
Concretely, with the script named h1analysisProxy.C,
If a file name macrofilename.h (or .hh, .hpp, .hxx, .hPP, .hXX) exist it is included before the declaration of the proxy class. This can be used in particular to insure that the include files needed by the macro file are properly loaded.
The default histogram is accessible via the variable named 'htemp'.
If the library of the classes describing the data in the branch is loaded, the skeleton will add the needed #include statements and give the ability to access the object stored in the branches.
To draw px using the file hsimple.root (generated by the hsimple.C tutorial), we need a file named hsimple.cxx:
MakeProxy can then be used indirectly via the TTree::Draw interface as follow:
A more complete example is available in the tutorials directory: h1analysisProxy.cxx , h1analysProxy.h and h1analysisProxyCut.C which reimplement the selector found in h1analysis.C
Implements TVirtualTreePlayer.
Definition at line 1910 of file TTreePlayer.cxx.
Generate skeleton selector class for this tree.
The following files are produced: classname.h and classname.C. If classname is 0, the selector will be called "nameoftree". The option can be used to specify the branches that will have a data member.
The generated code in classname.h includes the following:
The selector derives from TSelector. The generated code in classname.C includes empty functions defined above.
To use this function:
Implements TVirtualTreePlayer.
Definition at line 1967 of file TTreePlayer.cxx.
|
private |
|
virtual |
Interface to the Principal Components Analysis class.
Create an instance of TPrincipal Fill it with the selected variables
return a pointer to the TPrincipal object. It is the user responsibility to delete this object.
The option default value is "np"
See TTreePlayer::DrawSelect for explanation of the other parameters.
Implements TVirtualTreePlayer.
Definition at line 1997 of file TTreePlayer.cxx.
|
virtual |
Process this tree executing the TSelector code in the specified filename.
The return value is -1 in case of error and TSelector::GetStatus() in in case of success.
The code in filename is loaded (interpreted or compiled, see below), filename must contain a valid class implementation derived from TSelector, where TSelector has the following member functions:
If filename is of the form file.C, the file will be interpreted. If filename is of the form file.C++, the file file.C will be compiled and dynamically loaded.
If filename is of the form file.C+, the file file.C will be compiled and dynamically loaded. At next call, if file.C is older than file.o and file.so, the file.C is not compiled, only file.so is loaded.
It may be more interesting to invoke directly the other Process function accepting a TSelector* as argument.eg
One should not call this function twice with the same selector file in the same script. If this is required, proceed as indicated in NOTE1, by getting a pointer to the corresponding TSelector,eg ### workaround 1
or use ACLIC to compile the selector
Implements TVirtualTreePlayer.
Definition at line 2179 of file TTreePlayer.cxx.
Referenced by DrawSelect().
|
virtual |
Process this tree executing the code in the specified selector.
The return value is -1 in case of error and TSelector::GetStatus() in in case of success.
The TSelector class has the following member functions:
Terminate(): called at the end of the loop on the tree, a convenient place to draw/fit your histograms.
If the Tree (Chain) has an associated EventList, the loop is on the nentries of the EventList, starting at firstentry, otherwise the loop is on the specified Tree entries.
Implements TVirtualTreePlayer.
Definition at line 2219 of file TTreePlayer.cxx.
|
virtual |
Loop on Tree and return TSQLResult object containing entries passing selection.
If varexp is 0 (or "") then print only first 8 columns. If varexp = "*" print all columns. Otherwise a columns selection can be made using "var1:var2:var3". In case of error 0 is returned otherwise a TSQLResult object which must be deleted by the user.
Implements TVirtualTreePlayer.
Definition at line 2789 of file TTreePlayer.cxx.
cleanup pointers in the player pointing to obj
Reimplemented from TObject.
Definition at line 2333 of file TTreePlayer.cxx.
|
virtual |
Loop on Tree and print entries passing selection.
If varexp is 0 (or "") then print only first 8 columns. If varexp = "*" print all columns. Otherwise a columns selection can be made using "var1:var2:var3". The function returns the number of entries passing the selection.
By default 50 rows are shown and you are asked for <CR> to see the next 50 rows.
You can change the default number of rows to be shown before <CR> via mytree->SetScanField(maxrows) where maxrows is 50 by default. if maxrows is set to 0 all rows of the Tree are shown.
This option is interesting when dumping the contents of a Tree to an ascii file, eg from the command line
will create a file tree.log
Arrays (within an entry) are printed in their linear forms. If several arrays with multiple dimensions are printed together, they will NOT be synchronized. For example print arr1[4][2] and arr2[2][3] will results in a printing similar to:
However, if there is a selection criterion which is an array, then all the formulas will be synchronized with the selection criterion (see TTreePlayer::DrawSelect for more information).
The options string can contains the following parameters:
For example:
Will print 3 columns, the first 2 columns will be 30 characters long, the third columns will be 20 characters long. The printing format used for the columns (assuming they are numbers) will be respectively: %30.3g %30.3g %20.10g %x %5ld
Implements TVirtualTreePlayer.
Definition at line 2409 of file TTreePlayer.cxx.
|
inline |
Definition at line 126 of file TTreePlayer.h.
Set number of entries to estimate variable limits.
Implements TVirtualTreePlayer.
Definition at line 2922 of file TTreePlayer.cxx.
|
inline |
Definition at line 131 of file TTreePlayer.h.
Definition at line 130 of file TTreePlayer.h.
Implements TVirtualTreePlayer.
Definition at line 132 of file TTreePlayer.h.
Start the TTreeViewer on this TTree.
Implements TVirtualTreePlayer.
Definition at line 2933 of file TTreePlayer.cxx.
|
protected |
|
protected |
|
virtual |
Implements TVirtualTreePlayer.
|
virtual |
Implements TVirtualTreePlayer.
|
protected |
Definition at line 53 of file TTreePlayer.h.
Referenced by DrawSelect(), and GetDimension().
|
protected |
input list to the selector
Definition at line 60 of file TTreePlayer.h.
Referenced by CopyTree(), Principal(), Query(), Scan(), and ~TTreePlayer().
|
protected |
Definition at line 55 of file TTreePlayer.h.
Referenced by DrawSelect(), Fit(), GetHistogram(), and RecursiveRemove().
|
protected |
Pointer to the actual class of the TSelectorFromFile.
Definition at line 59 of file TTreePlayer.h.
Referenced by DrawSelect(), and ~TTreePlayer().
|
protected |
Definition at line 52 of file TTreePlayer.h.
Referenced by GetScanFileName(), and Scan().
|
protected |
Pointer to current Tree.
Definition at line 51 of file TTreePlayer.h.
Referenced by Scan(), and ScanRedirected().
|
protected |
Definition at line 54 of file TTreePlayer.h.
Referenced by DrawSelect(), GetSelectedRows(), Principal(), Query(), and Scan().
|
protected |
Pointer to histogram used for the projection.
Definition at line 56 of file TTreePlayer.h.
Referenced by DrawSelect(), GetSelector(), Principal(), Query(), Scan(), SetEstimate(), and ~TTreePlayer().
|
protected |
Pointer to a user defined selector created by this TTreePlayer object.
Definition at line 58 of file TTreePlayer.h.
Referenced by DeleteSelectorFromFile(), and Process().
|
protected |
Pointer to current selector.
Definition at line 57 of file TTreePlayer.h.
Referenced by DeleteSelectorFromFile(), GetSelectorFromFile(), and Process().
|
protected |
Pointer to a list of coordinated list TTreeFormula (used by Scan and Query)
Definition at line 61 of file TTreePlayer.h.
Referenced by Process().
|
protected |
Definition at line 50 of file TTreePlayer.h.
Referenced by CopyTree(), DrawScript(), DrawSelect(), GetEntries(), GetEntriesToProcess(), MakeClass(), MakeCode(), MakeProxy(), MakeReader(), Principal(), Process(), Query(), Scan(), and StartViewer().