laura is hosted by Hepforge, IPPP Durham
Laura++  v3r2
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauGenNtuple.hh
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2006 - 2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 // Authors:
7 // Thomas Latham
8 // John Back
9 // Paul Harrison
10 
21 #ifndef LAU_GEN_NTUPLE
22 #define LAU_GEN_NTUPLE
23 
24 #include <map>
25 
26 #include "TString.h"
27 
28 class TFile;
29 class TTree;
30 
31 
32 class LauGenNtuple {
33 
34  public:
36 
40  LauGenNtuple(const TString& rootFileName, const TString& rootTreeName);
41 
43  virtual ~LauGenNtuple();
44 
45 
47 
50  const TString& fileName() const {return rootFileName_;}
51 
53 
56  const TString& treeName() const {return rootTreeName_;}
57 
59 
62  void addIntegerBranch(const TString& name);
63 
65 
68  void addDoubleBranch(const TString& name);
69 
71 
75  void setIntegerBranchValue(const TString& name, Int_t value);
76 
78 
82  void setDoubleBranchValue(const TString& name, Double_t value);
83 
85 
89  Int_t getIntegerBranchValue(const TString& name) const;
90 
92 
96  Double_t getDoubleBranchValue(const TString& name) const;
97 
99  void fillBranches();
100 
102  void deleteAndRecreateTree();
103 
105 
110  Int_t buildIndex(const TString& majorName, const TString& minorName = "0");
111 
113  void writeOutGenResults();
114 
115 
117 
121  void addFriendTree(const TString& rootFileName, const TString& rootTreeName);
122 
123  protected:
125  void createFileAndTree();
126 
128  void defineBranches();
129 
131 
134  Bool_t definedBranches() const {return definedBranches_;}
135 
137 
140  void definedBranches(Bool_t defined) {definedBranches_ = defined;}
141 
142  private:
144  LauGenNtuple(const LauGenNtuple& rhs);
145 
147  LauGenNtuple& operator=(const LauGenNtuple& rhs);
148 
150  TString rootFileName_;
152  TString rootTreeName_;
154  TFile* rootFile_;
156  TTree* rootTree_;
157 
160 
162  typedef std::map<TString, Int_t> IntVarMap;
164  typedef std::map<TString, Double_t> DoubleVarMap;
165 
170 
171  ClassDef(LauGenNtuple,0) // Generated toyMC ntuple
172 
173 };
174 
175 #endif
LauGenNtuple & operator=(const LauGenNtuple &rhs)
Copy assignment operator (not implemented)
Int_t buildIndex(const TString &majorName, const TString &minorName="0")
Create an index table using leaves of the tree.
const TString & treeName() const
Ntuple tree name.
Definition: LauGenNtuple.hh:56
Int_t getIntegerBranchValue(const TString &name) const
Get value of an integer branch.
void deleteAndRecreateTree()
Delete and recreate tree.
void addFriendTree(const TString &rootFileName, const TString &rootTreeName)
Add a friend tree.
Double_t getDoubleBranchValue(const TString &name) const
Get value of a double branch.
void fillBranches()
Fill branches in the ntuple.
Bool_t definedBranches() const
Flags whether branches have been defined.
DoubleVarMap doubleVars_
Double variables.
void createFileAndTree()
Create ntuple file and the tree.
Definition: LauGenNtuple.cc:48
void addIntegerBranch(const TString &name)
Add integer branch to tree.
Definition: LauGenNtuple.cc:73
const TString & fileName() const
Ntuple file name.
Definition: LauGenNtuple.hh:50
virtual ~LauGenNtuple()
Destructor.
Definition: LauGenNtuple.cc:38
void defineBranches()
Define branches of the tree.
Class to store the results from the toy MC generation into an ntuple.
Definition: LauGenNtuple.hh:32
std::map< TString, Int_t > IntVarMap
Type to hold integer variables.
TFile * rootFile_
Root file.
void setIntegerBranchValue(const TString &name, Int_t value)
Set value of an integer branch.
Definition: LauGenNtuple.cc:91
TTree * rootTree_
Root tree.
Bool_t definedBranches_
Flags whether branches are defined.
void writeOutGenResults()
Write out the results from the generation.
LauGenNtuple(const TString &rootFileName, const TString &rootTreeName)
Constructor.
Definition: LauGenNtuple.cc:28
TString rootTreeName_
Name of root tree.
void definedBranches(Bool_t defined)
Flags whether branches have been defined.
IntVarMap intVars_
Integer variables.
void addDoubleBranch(const TString &name)
Add double branch to tree.
Definition: LauGenNtuple.cc:82
std::map< TString, Double_t > DoubleVarMap
Type to hold double precision floating point variables.
TString rootFileName_
Name of root file.
void setDoubleBranchValue(const TString &name, Double_t value)
Set value of a double branch.
Definition: LauGenNtuple.cc:96