Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TTreePlayer Class Reference

Implement some of the functionality of the class TTree requiring access to extra libraries (Histogram, display, etc).

Definition at line 37 of file TTreePlayer.h.

Public Member Functions

 TTreePlayer ()
 Default Tree constructor.
 
 ~TTreePlayer () override
 Tree destructor.
 
TVirtualIndexBuildIndex (const TTree *T, const char *majorname, const char *minorname) override
 Build the index for the tree (see TTree::BuildIndex)
 
TTreeCopyTree (const char *selection, Option_t *option, Long64_t nentries, Long64_t firstentry) override
 Copy a Tree with selection, make a clone of this Tree header, then copy the selected entries.
 
Long64_t DrawScript (const char *wrapperPrefix, const char *macrofilename, const char *cutfilename, Option_t *option, Long64_t nentries, Long64_t firstentry) override
 Draw the result of a C++ script.
 
Long64_t DrawSelect (const char *varexp, const char *selection, Option_t *option, Long64_t nentries, Long64_t firstentry) override
 Draw expression varexp for specified entries that matches the selection.
 
Int_t Fit (const char *formula, const char *varexp, const char *selection, Option_t *option, Option_t *goption, Long64_t nentries, Long64_t firstentry) override
 Fit a projected item(s) from a Tree.
 
Int_t GetDimension () const override
 
Long64_t GetEntries (const char *selection) override
 Return the number of entries matching the selection.
 
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
 
TH1GetHistogram () const override
 
Int_t GetNfill () const override
 
const char * GetScanFileName () const
 
TTreeFormulaGetSelect () const override
 
Long64_t GetSelectedRows () const override
 
TSelectorGetSelector () const override
 
TSelectorGetSelectorFromFile () const override
 
Double_tGetV1 () const override
 See TSelectorDraw::GetVal.
 
Double_tGetV2 () const override
 See TSelectorDraw::GetVal.
 
Double_tGetV3 () const override
 See TSelectorDraw::GetVal.
 
Double_tGetV4 () const override
 See TSelectorDraw::GetVal.
 
Double_tGetVal (Int_t i) const override
 See TSelectorDraw::GetVal.
 
TTreeFormulaGetVar (Int_t i) const override
 See TSelectorDraw::GetVar.
 
TTreeFormulaGetVar1 () const override
 See TSelectorDraw::GetVar.
 
TTreeFormulaGetVar2 () const override
 See TSelectorDraw::GetVar.
 
TTreeFormulaGetVar3 () const override
 See TSelectorDraw::GetVar.
 
TTreeFormulaGetVar4 () const override
 See TSelectorDraw::GetVar.
 
Double_tGetW () const override
 
TClassIsA () const override
 
Int_t MakeClass (const char *classname, Option_t *option) override
 Generate skeleton analysis class for this Tree.
 
Int_t MakeCode (const char *filename) override
 Generate skeleton function for this Tree.
 
Int_t MakeProxy (const char *classname, const char *macrofilename=nullptr, const char *cutfilename=nullptr, const char *option=nullptr, Int_t maxUnrolling=3) override
 Generate a skeleton analysis class for this Tree using TBranchProxy.
 
Int_t MakeReader (const char *classname, Option_t *option) override
 Generate skeleton selector class for this tree.
 
TPrincipalPrincipal (const char *varexp, const char *selection, Option_t *option, Long64_t nentries, Long64_t firstentry) override
 Interface to the Principal Components Analysis class.
 
Long64_t Process (const char *filename, Option_t *option, Long64_t nentries, Long64_t firstentry) override
 Process this tree executing the TSelector code in the specified filename.
 
Long64_t Process (TSelector *selector, Option_t *option, Long64_t nentries, Long64_t firstentry) override
 Process this tree executing the code in the specified selector.
 
TSQLResultQuery (const char *varexp, const char *selection, Option_t *option, Long64_t nentries, Long64_t firstentry) override
 Loop on Tree and return TSQLResult object containing entries passing selection.
 
void RecursiveRemove (TObject *obj) override
 cleanup pointers in the player pointing to obj
 
Long64_t Scan (const char *varexp, const char *selection, Option_t *option, Long64_t nentries, Long64_t firstentry) override
 Loop on Tree and print entries passing selection.
 
bool ScanRedirected ()
 
void SetEstimate (Long64_t n) override
 Set number of entries to estimate variable limits.
 
void SetScanFileName (const char *name)
 
void SetScanRedirect (bool on=false)
 
void SetTree (TTree *t) override
 
void StartViewer (Int_t ww, Int_t wh) override
 Start the TTreeViewer on this TTree.
 
void Streamer (TBuffer &) override
 Stream an object of class TObject.
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
Int_t UnbinnedFit (const char *formula, const char *varexp, const char *selection, Option_t *option, Long64_t nentries, Long64_t firstentry) override
 Unbinned fit of one or more variable(s) from a Tree.
 
void UpdateFormulaLeaves () override
 this function is called by TChain::LoadTree when a new Tree is loaded.
 
- Public Member Functions inherited from TVirtualTreePlayer
 TVirtualTreePlayer ()
 
 ~TVirtualTreePlayer () override
 Common destructor.
 
TClassIsA () const override
 
void Streamer (TBuffer &) override
 Stream an object of class TObject.
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
- Public Member Functions inherited from TObject
 TObject ()
 TObject constructor.
 
 TObject (const TObject &object)
 TObject copy ctor.
 
virtual ~TObject ()
 TObject destructor.
 
void AbstractMethod (const char *method) const
 Use this method to implement an "abstract" method that you don't want to leave purely abstract.
 
virtual void AppendPad (Option_t *option="")
 Append graphics object to current pad.
 
virtual void Browse (TBrowser *b)
 Browse object. May be overridden for another default action.
 
ULong_t CheckedHash ()
 Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object.
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs.
 
virtual void Clear (Option_t *="")
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility.
 
virtual Int_t Compare (const TObject *obj) const
 Compare abstract method.
 
virtual void Copy (TObject &object) const
 Copy this to obj.
 
virtual void Delete (Option_t *option="")
 Delete this object.
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Computes distance from point (px,py) to the object.
 
virtual void Draw (Option_t *option="")
 Default Draw method for all objects.
 
virtual void DrawClass () const
 Draw class inheritance tree of the class to which this object belongs.
 
virtual TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1).
 
virtual void Dump () const
 Dump contents of object on stdout.
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message.
 
virtual void Execute (const char *method, const char *params, Int_t *error=nullptr)
 Execute method on this object with the given parameter string, e.g.
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr)
 Execute method on this object with parameters stored in the TObjArray.
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Execute action corresponding to an event at (px,py).
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message.
 
virtual TObjectFindObject (const char *name) const
 Must be redefined in derived classes.
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes.
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object.
 
virtual const char * GetIconName () const
 Returns mime type name of object.
 
virtual const char * GetName () const
 Returns name of object.
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Returns string containing info about the object at position (px,py).
 
virtual Option_tGetOption () const
 
virtual const char * GetTitle () const
 Returns title of object.
 
virtual UInt_t GetUniqueID () const
 Return the unique object id.
 
virtual Bool_t HandleTimer (TTimer *timer)
 Execute action in response of a timer timing out.
 
virtual ULong_t Hash () const
 Return hash value for this object.
 
Bool_t HasInconsistentHash () const
 Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e.
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message.
 
virtual Bool_t InheritsFrom (const char *classname) const
 Returns kTRUE if object inherits from class "classname".
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 Returns kTRUE if object inherits from TClass cl.
 
virtual void Inspect () const
 Dump contents of this object in a graphics canvas.
 
void InvertBit (UInt_t f)
 
Bool_t IsDestructed () const
 IsDestructed.
 
virtual Bool_t IsEqual (const TObject *obj) const
 Default equal comparison (objects are equal if they have the same address in memory).
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
virtual Bool_t IsSortable () const
 
R__ALWAYS_INLINE Bool_t IsZombie () const
 
virtual void ls (Option_t *option="") const
 The ls function lists the contents of a class on stdout.
 
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).
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification (the base implementation is no-op).
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete.
 
void operator delete (void *ptr)
 Operator delete.
 
void operator delete[] (void *ptr)
 Operator delete [].
 
void * operator new (size_t sz)
 
void * operator new (size_t sz, void *vp)
 
void * operator new[] (size_t sz)
 
void * operator new[] (size_t sz, void *vp)
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator.
 
virtual void Paint (Option_t *option="")
 This method must be overridden if a class wants to paint itself.
 
virtual void Pop ()
 Pop on object drawn in a pad to the top of the display list.
 
virtual void Print (Option_t *option="") const
 This method must be overridden when a class wants to print itself.
 
virtual Int_t Read (const char *name)
 Read contents of object with specified name from the current directory.
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 Save this object in the file specified by filename.
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 Save a primitive as a C++ statement(s) on output stream "out".
 
void SetBit (UInt_t f)
 
void SetBit (UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f.
 
virtual void SetDrawOption (Option_t *option="")
 Set drawing option for object.
 
virtual void SetUniqueID (UInt_t uid)
 Set the unique object id.
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message.
 
R__ALWAYS_INLINE Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
virtual void UseCurrentStyle ()
 Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked.
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message.
 
virtual Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
 Write this object to the current directory.
 
virtual Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const
 Write this object to the current directory.
 

Static Public Member Functions

static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
- Static Public Member Functions inherited from TVirtualTreePlayer
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static TVirtualTreePlayerGetCurrentPlayer ()
 Static function: return the current player (if any)
 
static void SetPlayer (const char *player)
 Static function to set an alternative Tree player.
 
static TVirtualTreePlayerTreePlayer (TTree *obj)
 Static function returning a pointer to a Tree player.
 
- Static Public Member Functions inherited from TObject
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static Longptr_t GetDtorOnly ()
 Return destructor only flag.
 
static Bool_t GetObjectStat ()
 Get status of object stat flag.
 
static void SetDtorOnly (void *obj)
 Set destructor only flag.
 
static void SetObjectStat (Bool_t stat)
 Turn on/off tracking of objects in the TObjectTable.
 

Protected Member Functions

void DeleteSelectorFromFile ()
 Delete any selector created by this object.
 
const char * GetNameByIndex (TString &varexp, Int_t *index, Int_t colindex)
 Return name corresponding to colindex in varexp.
 
- Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 Interface to ErrorHandler (protected).
 
void MakeZombie ()
 

Protected Attributes

Int_t fDimension
 Dimension of the current expression.
 
TListfFormulaList
 ! Pointer to a list of coordinated list TTreeFormula (used by Scan and Query)
 
TH1fHistogram
 ! Pointer to histogram used for the projection
 
TListfInput
 ! input list to the selector
 
const char * fScanFileName
 Name of the file where Scan is redirected.
 
bool fScanRedirect
 Switch to redirect TTree::Scan output to a file.
 
Long64_t fSelectedRows
 Number of selected entries.
 
TSelectorDrawfSelector
 ! Pointer to current selector
 
TClassfSelectorClass
 ! Pointer to the actual class of the TSelectorFromFile
 
TSelectorfSelectorFromFile
 ! Pointer to a user defined selector created by this TTreePlayer object
 
TSelectorfSelectorUpdate
 ! Set to the selector address when it's entry list needs to be updated by the UpdateFormulaLeaves function
 
TTreefTree
 ! Pointer to current Tree
 

Private Member Functions

 TTreePlayer (const TTreePlayer &)=delete
 
TTreePlayeroperator= (const TTreePlayer &)=delete
 

Additional Inherited Members

- Public Types inherited from TObject
enum  {
  kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 ,
  kBitMask = 0x00ffffff
}
 
enum  { kSingleKey = (1ULL << ( 0 )) , kOverwrite = (1ULL << ( 1 )) , kWriteDelete = (1ULL << ( 2 )) }
 
enum  EDeprecatedStatusBits { kObjInCanvas = (1ULL << ( 3 )) }
 
enum  EStatusBits {
  kCanDelete = (1ULL << ( 0 )) , kMustCleanup = (1ULL << ( 3 )) , kIsReferenced = (1ULL << ( 4 )) , kHasUUID = (1ULL << ( 5 )) ,
  kCannotPick = (1ULL << ( 6 )) , kNoContextMenu = (1ULL << ( 8 )) , kInvalidObject = (1ULL << ( 13 ))
}
 
- Static Public Attributes inherited from TVirtualTreePlayer
static constexpr Long64_t kMaxEntries = std::numeric_limits<Long64_t>::max()
 
- Protected Types inherited from TObject
enum  { kOnlyPrepStep = (1ULL << ( 3 )) }
 

#include <TTreePlayer.h>

Inheritance diagram for TTreePlayer:
[legend]

Constructor & Destructor Documentation

◆ TTreePlayer() [1/2]

TTreePlayer::TTreePlayer ( const TTreePlayer )
privatedelete

◆ TTreePlayer() [2/2]

TTreePlayer::TTreePlayer ( )

Default Tree constructor.

Definition at line 99 of file TTreePlayer.cxx.

◆ ~TTreePlayer()

TTreePlayer::~TTreePlayer ( )
override

Tree destructor.

Definition at line 128 of file TTreePlayer.cxx.

Member Function Documentation

◆ BuildIndex()

TVirtualIndex * TTreePlayer::BuildIndex ( const TTree T,
const char *  majorname,
const char *  minorname 
)
overridevirtual

Build the index for the tree (see TTree::BuildIndex)

Implements TVirtualTreePlayer.

Definition at line 142 of file TTreePlayer.cxx.

◆ Class()

static TClass * TTreePlayer::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

static const char * TTreePlayer::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

static constexpr Version_t TTreePlayer::Class_Version ( )
inlinestaticconstexpr
Returns
Version of this class

Definition at line 130 of file TTreePlayer.h.

◆ CopyTree()

TTree * TTreePlayer::CopyTree ( const char *  selection,
Option_t option,
Long64_t  nentries,
Long64_t  firstentry 
)
overridevirtual

Copy a Tree with selection, make a clone of this Tree header, then copy the selected entries.

  • selection is a standard selection expression (see TTreePlayer::Draw)
  • option is reserved for possible future use
  • nentries is the number of entries to process (default is all)
  • first is the first entry to process (default is 0)

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

gSystem->Load("libEvent");
TFile f("Event.root");
TTree *T = (TTree*)f.Get("T");
Event *event = new Event();
T->SetBranchAddress("event",&event);
TFile f2("Event2.root","recreate");
TTree *T2 = T->CopyTree("fNtrack<595");
T2->Write();
#define f(i)
Definition RSha256.hxx:104
R__EXTERN TSystem * gSystem
Definition TSystem.h:560
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
Definition TFile.h:53
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition TSystem.cxx:1845
A TTree represents a columnar dataset.
Definition TTree.h:79
#define T2
Definition md5.inl:147

Implements TVirtualTreePlayer.

Definition at line 187 of file TTreePlayer.cxx.

◆ DeclFileName()

static const char * TTreePlayer::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 130 of file TTreePlayer.h.

◆ DeleteSelectorFromFile()

void TTreePlayer::DeleteSelectorFromFile ( )
protected

Delete any selector created by this object.

The selector has been created using TSelector::GetSelector(file)

Definition at line 252 of file TTreePlayer.cxx.

◆ DrawScript()

Long64_t TTreePlayer::DrawScript ( const char *  wrapperPrefix,
const char *  macrofilename,
const char *  cutfilename,
Option_t option,
Long64_t  nentries,
Long64_t  firstentry 
)
overridevirtual

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:

  • white spaces are removed
  • if the leading character is not a letter, an underscore is inserted
  • < and > are replace by underscores
  • * is replaced by st
  • & is replaced by rf

If a cutfilename is specified, for each entry, we execute

if (cutfilename()) htemp->Fill(macrofilename());

If no cutfilename is specified, for each entry we execute

htemp(macrofilename());

The default for the histogram are the same as for TTreePlayer::DrawSelect

Implements TVirtualTreePlayer.

Definition at line 295 of file TTreePlayer.cxx.

◆ DrawSelect()

Long64_t TTreePlayer::DrawSelect ( const char *  varexp0,
const char *  selection,
Option_t option,
Long64_t  nentries,
Long64_t  firstentry 
)
overridevirtual

Draw expression varexp for specified entries that matches the selection.

Returns -1 in case of error or number of selected events in case of success.

See the documentation of TTree::Draw for the complete details.

Implements TVirtualTreePlayer.

Definition at line 339 of file TTreePlayer.cxx.

◆ Fit()

Int_t TTreePlayer::Fit ( const char *  formula,
const char *  varexp,
const char *  selection,
Option_t option,
Option_t goption,
Long64_t  nentries,
Long64_t  firstentry 
)
overridevirtual

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:

tree.Fit("pol4","sqrt(x)>>hsqrt","y>0")
will fit sqrt(x) and save the histogram as "hsqrt" in the current
directory.
Double_t x[n]
Definition legend1.C:17

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 561 of file TTreePlayer.cxx.

◆ GetDimension()

Int_t TTreePlayer::GetDimension ( ) const
inlineoverridevirtual

Implements TVirtualTreePlayer.

Definition at line 74 of file TTreePlayer.h.

◆ GetEntries()

Long64_t TTreePlayer::GetEntries ( const char *  selection)
overridevirtual

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 591 of file TTreePlayer.cxx.

◆ GetEntriesToProcess()

Long64_t TTreePlayer::GetEntriesToProcess ( Long64_t  firstentry,
Long64_t  nentries 
) const
virtual

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 604 of file TTreePlayer.cxx.

◆ GetHistogram()

TH1 * TTreePlayer::GetHistogram ( ) const
inlineoverridevirtual

Implements TVirtualTreePlayer.

Definition at line 75 of file TTreePlayer.h.

◆ GetNameByIndex()

const char * TTreePlayer::GetNameByIndex ( TString varexp,
Int_t index,
Int_t  colindex 
)
protected

Return name corresponding to colindex in varexp.

  • varexp is a string of names separated by :
  • index is an array with pointers to the start of name[i] in varexp

Definition at line 624 of file TTreePlayer.cxx.

◆ GetNfill()

Int_t TTreePlayer::GetNfill ( ) const
inlineoverridevirtual

Implements TVirtualTreePlayer.

Definition at line 78 of file TTreePlayer.h.

◆ GetScanFileName()

const char * TTreePlayer::GetScanFileName ( ) const
inline

Definition at line 79 of file TTreePlayer.h.

◆ GetSelect()

TTreeFormula * TTreePlayer::GetSelect ( ) const
inlineoverridevirtual

Implements TVirtualTreePlayer.

Definition at line 80 of file TTreePlayer.h.

◆ GetSelectedRows()

Long64_t TTreePlayer::GetSelectedRows ( ) const
inlineoverridevirtual

Implements TVirtualTreePlayer.

Definition at line 81 of file TTreePlayer.h.

◆ GetSelector()

TSelector * TTreePlayer::GetSelector ( ) const
inlineoverridevirtual

Implements TVirtualTreePlayer.

Definition at line 82 of file TTreePlayer.h.

◆ GetSelectorFromFile()

TSelector * TTreePlayer::GetSelectorFromFile ( ) const
inlineoverridevirtual

Implements TVirtualTreePlayer.

Definition at line 83 of file TTreePlayer.h.

◆ GetV1()

Double_t * TTreePlayer::GetV1 ( ) const
inlineoverridevirtual

See TSelectorDraw::GetVal.

Implements TVirtualTreePlayer.

Definition at line 97 of file TTreePlayer.h.

◆ GetV2()

Double_t * TTreePlayer::GetV2 ( ) const
inlineoverridevirtual

See TSelectorDraw::GetVal.

Implements TVirtualTreePlayer.

Definition at line 99 of file TTreePlayer.h.

◆ GetV3()

Double_t * TTreePlayer::GetV3 ( ) const
inlineoverridevirtual

See TSelectorDraw::GetVal.

Implements TVirtualTreePlayer.

Definition at line 101 of file TTreePlayer.h.

◆ GetV4()

Double_t * TTreePlayer::GetV4 ( ) const
inlineoverridevirtual

See TSelectorDraw::GetVal.

Implements TVirtualTreePlayer.

Definition at line 103 of file TTreePlayer.h.

◆ GetVal()

Double_t * TTreePlayer::GetVal ( Int_t  i) const
inlineoverridevirtual

See TSelectorDraw::GetVal.

Implements TVirtualTreePlayer.

Definition at line 95 of file TTreePlayer.h.

◆ GetVar()

TTreeFormula * TTreePlayer::GetVar ( Int_t  i) const
inlineoverridevirtual

See TSelectorDraw::GetVar.

Implements TVirtualTreePlayer.

Definition at line 85 of file TTreePlayer.h.

◆ GetVar1()

TTreeFormula * TTreePlayer::GetVar1 ( ) const
inlineoverridevirtual

See TSelectorDraw::GetVar.

Implements TVirtualTreePlayer.

Definition at line 87 of file TTreePlayer.h.

◆ GetVar2()

TTreeFormula * TTreePlayer::GetVar2 ( ) const
inlineoverridevirtual

See TSelectorDraw::GetVar.

Implements TVirtualTreePlayer.

Definition at line 89 of file TTreePlayer.h.

◆ GetVar3()

TTreeFormula * TTreePlayer::GetVar3 ( ) const
inlineoverridevirtual

See TSelectorDraw::GetVar.

Implements TVirtualTreePlayer.

Definition at line 91 of file TTreePlayer.h.

◆ GetVar4()

TTreeFormula * TTreePlayer::GetVar4 ( ) const
inlineoverridevirtual

See TSelectorDraw::GetVar.

Implements TVirtualTreePlayer.

Definition at line 93 of file TTreePlayer.h.

◆ GetW()

Double_t * TTreePlayer::GetW ( ) const
inlineoverridevirtual

Implements TVirtualTreePlayer.

Definition at line 104 of file TTreePlayer.h.

◆ IsA()

TClass * TTreePlayer::IsA ( ) const
inlineoverridevirtual
Returns
TClass describing current object

Reimplemented from TObject.

Definition at line 130 of file TTreePlayer.h.

◆ MakeClass()

Int_t TTreePlayer::MakeClass ( const char *  classname,
Option_t option 
)
overridevirtual

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: - Identification of the original Tree and Input file name - Definition of analysis class (data and functions) - the following class functions: - constructor (connecting by default the Tree file) - GetEntry(Long64_t entry) - Init(TTree *tree) to initialize a new TTree - Show(Long64_t entry) to read and Dump entry The generated code in classname.C includes only the main analysis function Loop. To use this function: - connect your Tree file (eg: TFile f("myfile.root");) - T->MakeClass("MyClass");

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:

root> .L MyClass.C
root> MyClass t
root> t.GetEntry(12); // Fill t data members with entry number 12
root> t.Show(); // Show values of entry 12
root> t.Show(16); // Read and show values of entry 16
root> t.Loop(); // Loop on all entries

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 720 of file TTreePlayer.cxx.

◆ MakeCode()

Int_t TTreePlayer::MakeCode ( const char *  filename)
overridevirtual

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:

  • Identification of the original Tree and Input file name
  • Connection of the Tree file
  • Declaration of Tree variables
  • Setting of branches addresses
  • A skeleton for the entry loop

To use this function:

  • connect your Tree file (eg: TFile f("myfile.root");)
  • T->MakeCode("anal.C"); where T is the name of the Tree in file myfile.root and anal.C the name of the file created by this function.

NOTE: Since the implementation of this function, a new and better function TTree::MakeClass() has been developed.

Implements TVirtualTreePlayer.

Definition at line 1550 of file TTreePlayer.cxx.

◆ MakeProxy()

Int_t TTreePlayer::MakeProxy ( const char *  proxyClassname,
const char *  macrofilename = nullptr,
const char *  cutfilename = nullptr,
const char *  option = nullptr,
Int_t  maxUnrolling = 3 
)
overridevirtual

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:

[path/]fileprefix

The skeleton will then be generated in the file:

fileprefix.h

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:

[if (cutfilename())] htemp->Fill(macrofilename());

"option" can be used select some of the optional features during the code generation. The possible options are:

  • nohist : indicates that the generated ProcessFill should not fill the histogram.

'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:

  • on-demand loading of branches
  • ability to use the 'branchname' as if it was a data member
  • protection against array out-of-bound
  • ability to use the branch data as object (when the user code is available)

For example with Event.root, if

Double_t somepx = fTracks.fPx[2];

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:

x_t macrofilename(); // i.e function with the same name as the file

and

y_t cutfilename(); // i.e function with the same name as the file

x_t and y_t needs to be types that can convert respectively to a double and a bool (because the skeleton uses:

if (cutfilename()) htemp->Fill(macrofilename());

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

Int_t n = fEventNumber; // Read fEventNumber
if (n<10 || n>10) { ... }
const Int_t n
Definition legend1.C:16

is more efficient than

if (fEventNumber<10 || fEventNumber>10)

Access to TClonesArray.

If a branch (or member) is a TClonesArray (let's say fTracks), you can access the TClonesArray itself by using ->:

fTracks->GetLast();

However this will load the full TClonesArray object and its content. To quickly read the size of the TClonesArray use (note the dot):

fTracks.GetEntries();

This will read only the size from disk if the TClonesArray has been split. To access the content of the TClonesArray, use the [] operator:

float px = fTracks[i].fPx; // fPx of the i-th track

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:

fprintf(stdout,"trs[%d].a = %d\n",i,(int)trs.a[i]);

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,

  • The method calls the method (if it exist)
  • Begin -> void h1analysisProxy_Begin(TTree*);
  • SlaveBegin -> void h1analysisProxy_SlaveBegin(TTree*);
  • Notify -> bool h1analysisProxy_Notify();
  • Process -> bool h1analysisProxy_Process(Long64_t);
  • SlaveTerminate -> void h1analysisProxy_SlaveTerminate();
  • Terminate -> void h1analysisProxy_Terminate();

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:

double hsimple() {
return px;
}

MakeProxy can then be used indirectly via the TTree::Draw interface as follow:

new TFile("hsimple.root")
ntuple->Draw("hsimple.cxx");
th1 Draw()

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 1915 of file TTreePlayer.cxx.

◆ MakeReader()

Int_t TTreePlayer::MakeReader ( const char *  classname,
Option_t option 
)
overridevirtual

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.

  • If option is empty, readers will be generated for each leaf.
  • If option is "@", readers will be generated for the topmost branches.
  • Individual branches can also be picked by their name:
    • "X" generates readers for leaves of X.
    • "@X" generates a reader for X as a whole.
    • "@X;Y" generates a reader for X as a whole and also readers for the leaves of Y.
  • For further examples see the figure below.

The generated code in classname.h includes the following:

  • Identification of the original Tree and Input file name
  • Definition of selector class (data and functions)
  • The following class functions:
    • constructor and destructor
    • void Begin(TTree *tree)
    • void SlaveBegin(TTree *tree)
    • void Init(TTree *tree)
    • bool Notify()
    • bool Process(Long64_t entry)
    • void Terminate()
    • void SlaveTerminate()

The selector derives from TSelector. The generated code in classname.C includes empty functions defined above.

To use this function:

  • connect your Tree file (eg: TFile f("myfile.root");)
  • T->MakeSelector("myselect"); where T is the name of the Tree in file myfile.root and myselect.h, myselect.C the name of the files created by this function.

In a ROOT session, you can do:

root > T->Process("myselect.C")

Implements TVirtualTreePlayer.

Definition at line 1975 of file TTreePlayer.cxx.

◆ operator=()

TTreePlayer & TTreePlayer::operator= ( const TTreePlayer )
privatedelete

◆ Principal()

TPrincipal * TTreePlayer::Principal ( const char *  varexp,
const char *  selection,
Option_t option,
Long64_t  nentries,
Long64_t  firstentry 
)
overridevirtual

Interface to the Principal Components Analysis class.

Create an instance of TPrincipal Fill it with the selected variables

  • if option "n" is specified, the TPrincipal object is filled with normalized variables.
  • If option "p" is specified, compute the principal components
  • If option "p" and "d" print results of analysis
  • If option "p" and "h" generate standard histograms
  • If option "p" and "c" generate code of conversion functions

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 2005 of file TTreePlayer.cxx.

◆ Process() [1/2]

Long64_t TTreePlayer::Process ( const char *  filename,
Option_t option,
Long64_t  nentries,
Long64_t  firstentry 
)
overridevirtual

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:

  • Begin(): called every time a loop on the tree starts, a convenient place to create your histograms.
  • SlaveBegin(): called after Begin(), when on PROOF called only on the slave servers.
  • Process(): called for each event, in this function you decide what to read and fill your histograms.
  • SlaveTerminate: called at the end of the loop on the tree, when on PROOF called only on the slave servers.
  • Terminate(): called at the end of the loop on the tree, a convenient place to draw/fit your histograms.

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.

NOTE 1

It may be more interesting to invoke directly the other Process function accepting a TSelector* as argument.eg

MySelector *selector = (MySelector*)TSelector::GetSelector(filename);
selector->CallSomeFunction(..);
mytree.Process(selector,..);
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
virtual bool Process(Long64_t)
The Process() function is called for each entry in the tree (or possibly keyed object in the case of ...
static TSelector * GetSelector(const char *filename)
The code in filename is loaded (interpreted or compiled, see below), filename must contain a valid cl...

NOTE 2

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

void stubs1() {
TSelector *selector = TSelector::GetSelector("h1test.C");
TFile *f1 = new TFile("stubs_nood_le1.root");
TTree *h1 = (TTree*)f1->Get("h1");
h1->Process(selector);
TFile *f2 = new TFile("stubs_nood_le1_coarse.root");
TTree *h2 = (TTree*)f2->Get("h1");
h2->Process(selector);
}
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition TSelector.h:31
TH1F * h1
Definition legend1.C:5
TF1 * f1
Definition legend1.C:11

or use ACLIC to compile the selector

workaround 2

void stubs2() {
TFile *f1 = new TFile("stubs_nood_le1.root");
TTree *h1 = (TTree*)f1->Get("h1");
h1->Process("h1test.C+");
TFile *f2 = new TFile("stubs_nood_le1_coarse.root");
TTree *h2 = (TTree*)f2->Get("h1");
h2->Process("h1test.C+");
}

Implements TVirtualTreePlayer.

Definition at line 2187 of file TTreePlayer.cxx.

◆ Process() [2/2]

Long64_t TTreePlayer::Process ( TSelector selector,
Option_t option,
Long64_t  nentries,
Long64_t  firstentry 
)
overridevirtual

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:

  • Begin(): called every time a loop on the tree starts, a convenient place to create your histograms.
  • SlaveBegin(): called after Begin(), when on PROOF called only on the slave servers.
  • Process(): called for each event, in this function you decide what to read and fill your histograms.
  • SlaveTerminate: called at the end of the loop on the tree, when on PROOF called only on the slave servers.
  • 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 2227 of file TTreePlayer.cxx.

◆ Query()

TSQLResult * TTreePlayer::Query ( const char *  varexp,
const char *  selection,
Option_t option,
Long64_t  nentries,
Long64_t  firstentry 
)
overridevirtual

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 2808 of file TTreePlayer.cxx.

◆ RecursiveRemove()

void TTreePlayer::RecursiveRemove ( TObject obj)
overridevirtual

cleanup pointers in the player pointing to obj

Reimplemented from TObject.

Definition at line 2343 of file TTreePlayer.cxx.

◆ Scan()

Long64_t TTreePlayer::Scan ( const char *  varexp,
const char *  selection,
Option_t option,
Long64_t  nentries,
Long64_t  firstentry 
)
overridevirtual

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.

with ROOT 5

root [0] tree->SetScanField(0);
root [1] tree->Scan("*"); >tree.log

with ROOT 6

root [0] tree->SetScanField(0);
root [1] .> tree.log
tree->Scan("*");
.>

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:

***********************************************
* Row * Instance * arr1 * arr2 *
***********************************************
* x * 0 * arr1[0][0]* arr2[0][0]*
* x * 1 * arr1[0][1]* arr2[0][1]*
* x * 2 * arr1[1][0]* arr2[0][2]*
* x * 3 * arr1[1][1]* arr2[1][0]*
* x * 4 * arr1[2][0]* arr2[1][1]*
* x * 5 * arr1[2][1]* arr2[1][2]*
* x * 6 * arr1[3][0]* *
* x * 7 * arr1[3][1]* *

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:

  • lenmax=dd Where 'dd' is the maximum number of elements per array that should be printed. If 'dd' is 0, all elements are printed (this is the default)
  • colsize=ss Where 'ss' will be used as the default size for all the column If this options is not specified, the default column size is 9
  • precision=pp Where 'pp' will be used as the default 'precision' for the printing format.
  • col=xxx Where 'xxx' is colon (:) delimited list of printing format for each column. The format string should follow the printf format specification. The value given will be prefixed by % and, if no conversion specifier is given, will be suffixed by the letter g. before being passed to fprintf. If no format is specified for a column, the default is used (aka ${colsize}.${precision}g )

For example:

tree->Scan("a:b:c","","colsize=30 precision=3 col=::20.10:#x:5ld");

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
#define d(i)
Definition RSha256.hxx:102
#define g(i)
Definition RSha256.hxx:105

Implements TVirtualTreePlayer.

Definition at line 2429 of file TTreePlayer.cxx.

◆ ScanRedirected()

bool TTreePlayer::ScanRedirected ( )
inline

Definition at line 118 of file TTreePlayer.h.

◆ SetEstimate()

void TTreePlayer::SetEstimate ( Long64_t  n)
overridevirtual

Set number of entries to estimate variable limits.

Implements TVirtualTreePlayer.

Definition at line 2941 of file TTreePlayer.cxx.

◆ SetScanFileName()

void TTreePlayer::SetScanFileName ( const char *  name)
inline

Definition at line 123 of file TTreePlayer.h.

◆ SetScanRedirect()

void TTreePlayer::SetScanRedirect ( bool  on = false)
inline

Definition at line 122 of file TTreePlayer.h.

◆ SetTree()

void TTreePlayer::SetTree ( TTree t)
inlineoverridevirtual

Implements TVirtualTreePlayer.

Definition at line 124 of file TTreePlayer.h.

◆ StartViewer()

void TTreePlayer::StartViewer ( Int_t  ww,
Int_t  wh 
)
overridevirtual

Start the TTreeViewer on this TTree.

  • ww is the width of the canvas in pixels
  • wh is the height of the canvas in pixels

Implements TVirtualTreePlayer.

Definition at line 2952 of file TTreePlayer.cxx.

◆ Streamer()

void TTreePlayer::Streamer ( TBuffer R__b)
overridevirtual

Stream an object of class TObject.

Reimplemented from TObject.

◆ StreamerNVirtual()

void TTreePlayer::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 130 of file TTreePlayer.h.

◆ UnbinnedFit()

Int_t TTreePlayer::UnbinnedFit ( const char *  funcname,
const char *  varexp,
const char *  selection,
Option_t option,
Long64_t  nentries,
Long64_t  firstentry 
)
overridevirtual

Unbinned fit of one or more variable(s) from a Tree.

funcname is a TF1 function.

See TTree::Draw for explanations of the other parameters.

Fit the variable varexp using the function funcname using the selection cuts given by selection.

The list of fit options is given in parameter option.

  • option = "Q" Quiet mode (minimum printing)
  • option = "V" Verbose mode (default is between Q and V)
  • option = "E" Perform better Errors estimation using Minos technique
  • option = "M" More. Improve fit results
  • option = "D" Draw the projected histogram with the fitted function normalized to the number of selected rows and multiplied by the bin width

You can specify boundary limits for some or all parameters via

func->SetParLimits(p_number, parmin, parmax);

if parmin>=parmax, the parameter is fixed

Note that you are not forced to fix the limits for all parameters. For example, if you fit a function with 6 parameters, you can do:

func->SetParameters(0,3.1,1.e-6,0.1,-8,100);
func->SetParLimits(4,-10,-4);
func->SetParLimits(5, 1,1);

With this setup, parameters 0->3 can vary freely

  • Parameter 4 has boundaries [-10,-4] with initial value -8
  • Parameter 5 is fixed to 100.

    For the fit to be meaningful, the function must be self-normalized.

i.e. It must have the same integral regardless of the parameter settings. Otherwise the fit will effectively just maximize the area.

It is mandatory to have a normalization variable which is fixed for the fit. e.g.

TF1* f1 = new TF1("f1", "gaus(0)/sqrt(2*3.14159)/[2]", 0, 5);
f1->SetParameters(1, 3.1, 0.01);
f1->SetParLimits(0, 1, 1); // fix the normalization parameter to 1
data->UnbinnedFit("f1", "jpsimass", "jpsipt>3.0");
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
1-Dim function class
Definition TF1.h:233
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
Set lower and upper limits for parameter ipar.
Definition TF1.cxx:3507
virtual void SetParameters(const Double_t *params)
Definition TF1.h:670

1, 2 and 3 Dimensional fits are supported. See also TTree::Fit

Return status

The function return the status of the fit in the following form

fitResult = migradResult + 10*minosResult + 100*hesseResult + 1000*improveResult
  • The fitResult is 0 is the fit is OK.
  • The fitResult is negative in case of an error not connected with the fit.
  • The number of entries used in the fit can be obtained via
    mytree.GetSelectedRows();
  • If the number of selected entries is null the function returns -1

new implementation using new Fitter classes

Implements TVirtualTreePlayer.

Definition at line 3052 of file TTreePlayer.cxx.

◆ UpdateFormulaLeaves()

void TTreePlayer::UpdateFormulaLeaves ( )
overridevirtual

this function is called by TChain::LoadTree when a new Tree is loaded.

Because Trees in a TChain may have a different list of leaves, one must update the leaves numbers in the TTreeFormula used by the TreePlayer.

Implements TVirtualTreePlayer.

Definition at line 3149 of file TTreePlayer.cxx.

Member Data Documentation

◆ fDimension

Int_t TTreePlayer::fDimension
protected

Dimension of the current expression.

Definition at line 47 of file TTreePlayer.h.

◆ fFormulaList

TList* TTreePlayer::fFormulaList
protected

! Pointer to a list of coordinated list TTreeFormula (used by Scan and Query)

Definition at line 54 of file TTreePlayer.h.

◆ fHistogram

TH1* TTreePlayer::fHistogram
protected

! Pointer to histogram used for the projection

Definition at line 49 of file TTreePlayer.h.

◆ fInput

TList* TTreePlayer::fInput
protected

! input list to the selector

Definition at line 53 of file TTreePlayer.h.

◆ fScanFileName

const char* TTreePlayer::fScanFileName
protected

Name of the file where Scan is redirected.

Definition at line 46 of file TTreePlayer.h.

◆ fScanRedirect

bool TTreePlayer::fScanRedirect
protected

Switch to redirect TTree::Scan output to a file.

Definition at line 45 of file TTreePlayer.h.

◆ fSelectedRows

Long64_t TTreePlayer::fSelectedRows
protected

Number of selected entries.

Definition at line 48 of file TTreePlayer.h.

◆ fSelector

TSelectorDraw* TTreePlayer::fSelector
protected

! Pointer to current selector

Definition at line 50 of file TTreePlayer.h.

◆ fSelectorClass

TClass* TTreePlayer::fSelectorClass
protected

! Pointer to the actual class of the TSelectorFromFile

Definition at line 52 of file TTreePlayer.h.

◆ fSelectorFromFile

TSelector* TTreePlayer::fSelectorFromFile
protected

! Pointer to a user defined selector created by this TTreePlayer object

Definition at line 51 of file TTreePlayer.h.

◆ fSelectorUpdate

TSelector* TTreePlayer::fSelectorUpdate
protected

! Set to the selector address when it's entry list needs to be updated by the UpdateFormulaLeaves function

Definition at line 55 of file TTreePlayer.h.

◆ fTree

TTree* TTreePlayer::fTree
protected

! Pointer to current Tree

Definition at line 44 of file TTreePlayer.h.

Libraries for TTreePlayer:

The documentation for this class was generated from the following files: