laura is hosted by Hepforge, IPPP Durham
Laura++  3.6.0
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 "TString.h"
39 
40 #include <map>
41 
42 class TFile;
43 class TTree;
44 
45 class LauGenNtuple {
46 
47  public:
49 
53  LauGenNtuple( const TString& rootFileName, const TString& rootTreeName );
54 
56  virtual ~LauGenNtuple();
57 
59 
62  const TString& fileName() const { return rootFileName_; }
63 
65 
68  const TString& treeName() const { return rootTreeName_; }
69 
71 
74  void addIntegerBranch( const TString& name );
75 
77 
80  void addDoubleBranch( const TString& name );
81 
83 
87  void setIntegerBranchValue( const TString& name, Int_t value );
88 
90 
94  void setDoubleBranchValue( const TString& name, Double_t value );
95 
97 
101  Int_t getIntegerBranchValue( const TString& name ) const;
102 
104 
108  Double_t getDoubleBranchValue( const TString& name ) const;
109 
111  void fillBranches();
112 
114  void deleteAndRecreateTree();
115 
117 
122  Int_t buildIndex( const TString& majorName, const TString& minorName = "0" );
123 
125  void writeOutGenResults();
126 
128 
132  void addFriendTree( const TString& rootFileName, const TString& rootTreeName );
133 
134  protected:
136  void createFileAndTree();
137 
139  void defineBranches();
140 
142 
145  Bool_t definedBranches() const { return definedBranches_; }
146 
148 
151  void definedBranches( Bool_t defined ) { definedBranches_ = defined; }
152 
153  private:
155  LauGenNtuple( const LauGenNtuple& rhs );
156 
159 
161  TString rootFileName_;
163  TString rootTreeName_;
165  TFile* rootFile_;
167  TTree* rootTree_;
168 
171 
173  typedef std::map<TString, Int_t> IntVarMap;
175  typedef std::map<TString, Double_t> DoubleVarMap;
176 
181 
182  ClassDef( LauGenNtuple, 0 ) // Generated toyMC ntuple
183 };
184 
185 #endif
virtual ~LauGenNtuple()
Destructor.
Definition: LauGenNtuple.cc:49
Bool_t definedBranches() const
Flags whether branches have been defined.
const TString & fileName() const
Ntuple file name.
Definition: LauGenNtuple.hh:62
void setDoubleBranchValue(const TString &name, Double_t value)
Set value of a double branch.
Int_t getIntegerBranchValue(const TString &name) const
Get value of an integer branch.
TString rootTreeName_
Name of root tree.
TString rootFileName_
Name of root file.
std::map< TString, Double_t > DoubleVarMap
Type to hold double precision floating point variables.
LauGenNtuple(const LauGenNtuple &rhs)
Copy constructor (not implemented)
TTree * rootTree_
Root tree.
void addDoubleBranch(const TString &name)
Add double branch to tree.
Definition: LauGenNtuple.cc:98
void writeOutGenResults()
Write out the results from the generation.
LauGenNtuple & operator=(const LauGenNtuple &rhs)
Copy assignment operator (not implemented)
const TString & treeName() const
Ntuple tree name.
Definition: LauGenNtuple.hh:68
void defineBranches()
Define branches of the tree.
LauGenNtuple(const TString &rootFileName, const TString &rootTreeName)
Constructor.
Definition: LauGenNtuple.cc:39
void setIntegerBranchValue(const TString &name, Int_t value)
Set value of an integer branch.
void fillBranches()
Fill branches in the ntuple.
std::map< TString, Int_t > IntVarMap
Type to hold integer variables.
void addFriendTree(const TString &rootFileName, const TString &rootTreeName)
Add a friend tree.
TFile * rootFile_
Root file.
Double_t getDoubleBranchValue(const TString &name) const
Get value of a double branch.
void definedBranches(Bool_t defined)
Flags whether branches have been defined.
Int_t buildIndex(const TString &majorName, const TString &minorName="0")
Create an index table using leaves of the tree.
DoubleVarMap doubleVars_
Double variables.
void createFileAndTree()
Create ntuple file and the tree.
Definition: LauGenNtuple.cc:61
void addIntegerBranch(const TString &name)
Add integer branch to tree.
Definition: LauGenNtuple.cc:88
IntVarMap intVars_
Integer variables.
Bool_t definedBranches_
Flags whether branches are defined.
void deleteAndRecreateTree()
Delete and recreate tree.
Class to store the results from the toy MC generation into an ntuple.
Definition: LauGenNtuple.hh:45