|
Crombie Tools
|
Can be called from the CrombieTools.CommonTools.TreeContainer module. More...
#include <TreeContainer.h>
Public Member Functions | |
| TreeContainer (TString fileName="") | |
| TreeContainer Constructor. More... | |
| virtual | ~TreeContainer () |
| void | AddDirectory (TString directoryName, TString searchFor=".root") |
| Adds all of the files located in a particular directory. More... | |
| void | AddFile (TString fileName) |
| Adds another file to the list of files contained in TreeContainer. More... | |
| void | AddFriendName (TString name) |
| Add a friend to look for in each file. More... | |
| void | AddKeepBranch (TString name) |
| Use this to keep only certain branches when trees are returned. More... | |
| void | MakeFile (TString fileName="", TString treeName="") |
| Write a single TTree into a TFile. More... | |
| std::vector< TFile * > | ReturnFileList () |
| Return vector of TFile pointers read by the TreeContainer. More... | |
| std::vector< TString > | ReturnFileNames () |
| Return vector of file names read by the TreeContainer. More... | |
| TTree * | ReturnTree (TString Name="", TFile *inFile=NULL) |
| Return all of the trees contained as a single TTree pointer. More... | |
| std::vector< TTree * > | ReturnTreeList (TString Name="") |
| Return all of the trees contained as a vector of TTree pointers. More... | |
| void | SetOutputFileName (TString name) |
| Use this to set an output file to place a single tree. More... | |
| void | SetPrinting (Bool_t printing) |
| Set the printing level for debugging. More... | |
| void | SetSkimmingCut (TCut cut) |
| Set a cut to apply to returned trees. More... | |
| void | SetTreeName (TString TreeName) |
| Sets the name of the tree searched for in the input files. More... | |
Private Member Functions | |
| TTree * | SkimTree (TTree *tree, TFile *inFile) |
Private Attributes | |
| std::vector< TFile * > | fFileList |
| List of files. More... | |
| std::vector< TString > | fFileNames |
| Used to track names of files where tree list come from. More... | |
| std::vector< TString > | fFriendNames |
| std::vector< TString > | fKeepBranches |
| Branches kept in the event of skimming. More... | |
| TString | fOutputFileName = "output.root" |
| Potential output file name of skim. More... | |
| Bool_t | fPrinting = false |
| Printer for debugging. More... | |
| TCut | fSkimmingCut = "" |
| Cut to return only branches meeting given conditions. More... | |
| TTree * | fTree = NULL |
| Keep pointer to be deleted at end. More... | |
| std::vector< TTree * > | fTreeList |
| List of trees. More... | |
| TString | fTreeName = "events" |
| Name of Trees looking for. More... | |
| TFile * | tempFile = NULL |
| Pointer to File. More... | |
| TTree * | tempFriend = NULL |
| TTree * | tempTree = NULL |
| Pointer to Tree. More... | |
Can be called from the CrombieTools.CommonTools.TreeContainer module.
Capable of holding many trees and skimming them. Probably just a poor reimplementation of TChain, but I have code that depends on this now.
Definition at line 26 of file TreeContainer.h.
| TreeContainer::TreeContainer | ( | TString | fileName = "" | ) |
TreeContainer Constructor.
| fileName | can either be the name of a single file or a directory. If it's a file, that file is opened. If it's a directory, all the .root files in that directory are opened |
|
virtual |
Definition at line 29 of file TreeContainer.cc.
| void TreeContainer::AddDirectory | ( | TString | directoryName, |
| TString | searchFor = ".root" |
||
| ) |
Adds all of the files located in a particular directory.
Definition at line 54 of file TreeContainer.cc.
References crombie_completion::dir, fFileList, fFileNames, fPrinting, and tempFile.
Referenced by TmvaClassifier::Apply().
| void TreeContainer::AddFile | ( | TString | fileName | ) |
Adds another file to the list of files contained in TreeContainer.
Definition at line 41 of file TreeContainer.cc.
References fFileList, fFileNames, fPrinting, and tempFile.
|
inline |
Add a friend to look for in each file.
Definition at line 54 of file TreeContainer.h.
References fFriendNames.
|
inline |
Use this to keep only certain branches when trees are returned.
Definition at line 59 of file TreeContainer.h.
References fKeepBranches.
| void TreeContainer::MakeFile | ( | TString | fileName = "", |
| TString | treeName = "" |
||
| ) |
Write a single TTree into a TFile.
Definition at line 166 of file TreeContainer.cc.
References fOutputFileName, fTree, fTreeName, dojob::outFile, ReturnTree(), SetOutputFileName(), and SetTreeName().
|
inline |
Return vector of TFile pointers read by the TreeContainer.
Definition at line 68 of file TreeContainer.h.
References fFileList.
|
inline |
Return vector of file names read by the TreeContainer.
Definition at line 66 of file TreeContainer.h.
References fFileNames.
Referenced by TmvaClassifier::Apply().
| TTree * TreeContainer::ReturnTree | ( | TString | Name = "", |
| TFile * | inFile = NULL |
||
| ) |
Return all of the trees contained as a single TTree pointer.
Definition at line 101 of file TreeContainer.cc.
References fTree, fTreeList, ReturnTreeList(), SetTreeName(), and tempTree.
Referenced by TmvaClassifier::Apply(), MakeFile(), and TmvaClassifier::TmvaClassify().
| std::vector< TTree * > TreeContainer::ReturnTreeList | ( | TString | Name = "" | ) |
Return all of the trees contained as a vector of TTree pointers.
Definition at line 131 of file TreeContainer.cc.
References fFileList, fFriendNames, fKeepBranches, fPrinting, fSkimmingCut, fTreeList, fTreeName, SetTreeName(), SkimTree(), tempFriend, and tempTree.
Referenced by TmvaClassifier::Apply(), and ReturnTree().
|
inline |
Use this to set an output file to place a single tree.
Definition at line 61 of file TreeContainer.h.
References fOutputFileName.
Referenced by MakeFile().
|
inline |
Set the printing level for debugging.
Definition at line 56 of file TreeContainer.h.
References fPrinting.
|
inline |
Set a cut to apply to returned trees.
Definition at line 63 of file TreeContainer.h.
References fSkimmingCut.
Referenced by TmvaClassifier::Apply(), and TmvaClassifier::TmvaClassify().
|
inline |
Sets the name of the tree searched for in the input files.
Definition at line 52 of file TreeContainer.h.
References fTreeName, and oldmaketree::TreeName.
Referenced by MakeFile(), ReturnTree(), and ReturnTreeList().
|
private |
Definition at line 78 of file TreeContainer.cc.
References fKeepBranches, and fSkimmingCut.
Referenced by ReturnTreeList().
|
private |
List of files.
Definition at line 78 of file TreeContainer.h.
Referenced by AddDirectory(), AddFile(), ReturnFileList(), ReturnTreeList(), and ~TreeContainer().
|
private |
Used to track names of files where tree list come from.
Definition at line 86 of file TreeContainer.h.
Referenced by AddDirectory(), AddFile(), and ReturnFileNames().
|
private |
Definition at line 77 of file TreeContainer.h.
Referenced by AddFriendName(), and ReturnTreeList().
|
private |
Branches kept in the event of skimming.
Definition at line 82 of file TreeContainer.h.
Referenced by AddKeepBranch(), ReturnTreeList(), and SkimTree().
|
private |
Potential output file name of skim.
Definition at line 83 of file TreeContainer.h.
Referenced by MakeFile(), and SetOutputFileName().
|
private |
Printer for debugging.
Definition at line 72 of file TreeContainer.h.
Referenced by AddDirectory(), AddFile(), ReturnTreeList(), and SetPrinting().
|
private |
Cut to return only branches meeting given conditions.
Definition at line 84 of file TreeContainer.h.
Referenced by ReturnTreeList(), SetSkimmingCut(), and SkimTree().
|
private |
Keep pointer to be deleted at end.
Definition at line 80 of file TreeContainer.h.
Referenced by MakeFile(), ReturnTree(), and ~TreeContainer().
|
private |
List of trees.
Definition at line 79 of file TreeContainer.h.
Referenced by ReturnTree(), and ReturnTreeList().
|
private |
Name of Trees looking for.
Definition at line 76 of file TreeContainer.h.
Referenced by MakeFile(), ReturnTreeList(), and SetTreeName().
|
private |
Pointer to File.
Definition at line 73 of file TreeContainer.h.
Referenced by AddDirectory(), and AddFile().
|
private |
Definition at line 75 of file TreeContainer.h.
Referenced by ReturnTreeList().
|
private |
Pointer to Tree.
Definition at line 74 of file TreeContainer.h.
Referenced by ReturnTree(), and ReturnTreeList().