laura is hosted by Hepforge, IPPP Durham
Laura++  v3r5
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauGenNtuple.hh
Go to the documentation of this file.
1 
2 /*
3 Copyright 2006 University of Warwick
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 */
17 
18 /*
19 Laura++ package authors:
20 John Back
21 Paul Harrison
22 Thomas Latham
23 */
24 
35 #ifndef LAU_GEN_NTUPLE
36 #define LAU_GEN_NTUPLE
37 
38 #include <map>
39 
40 #include "TString.h"
41 
42 class TFile;
43 class TTree;
44 
45 
46 class LauGenNtuple {
47 
48  public:
50 
54  LauGenNtuple(const TString& rootFileName, const TString& rootTreeName);
55 
57  virtual ~LauGenNtuple();
58 
59 
61 
64  const TString& fileName() const {return rootFileName_;}
65 
67 
70  const TString& treeName() const {return rootTreeName_;}
71 
73 
76  void addIntegerBranch(const TString& name);
77 
79 
82  void addDoubleBranch(const TString& name);
83 
85 
89  void setIntegerBranchValue(const TString& name, Int_t value);
90 
92 
96  void setDoubleBranchValue(const TString& name, Double_t value);
97 
99 
103  Int_t getIntegerBranchValue(const TString& name) const;
104 
106 
110  Double_t getDoubleBranchValue(const TString& name) const;
111 
113  void fillBranches();
114 
116  void deleteAndRecreateTree();
117 
119 
124  Int_t buildIndex(const TString& majorName, const TString& minorName = "0");
125 
127  void writeOutGenResults();
128 
129 
131 
135  void addFriendTree(const TString& rootFileName, const TString& rootTreeName);
136 
137  protected:
139  void createFileAndTree();
140 
142  void defineBranches();
143 
145 
148  Bool_t definedBranches() const {return definedBranches_;}
149 
151 
154  void definedBranches(Bool_t defined) {definedBranches_ = defined;}
155 
156  private:
158  LauGenNtuple(const LauGenNtuple& rhs);
159 
161  LauGenNtuple& operator=(const LauGenNtuple& rhs);
162 
164  TString rootFileName_;
166  TString rootTreeName_;
168  TFile* rootFile_;
170  TTree* rootTree_;
171 
174 
176  typedef std::map<TString, Int_t> IntVarMap;
178  typedef std::map<TString, Double_t> DoubleVarMap;
179 
184 
185  ClassDef(LauGenNtuple,0) // Generated toyMC ntuple
186 
187 };
188 
189 #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:70
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:62
void addIntegerBranch(const TString &name)
Add integer branch to tree.
Definition: LauGenNtuple.cc:87
const TString & fileName() const
Ntuple file name.
Definition: LauGenNtuple.hh:64
virtual ~LauGenNtuple()
Destructor.
Definition: LauGenNtuple.cc:52
void defineBranches()
Define branches of the tree.
Class to store the results from the toy MC generation into an ntuple.
Definition: LauGenNtuple.hh:46
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.
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:42
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:96
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.