laura is hosted by Hepforge, IPPP Durham
Laura++  v3r5
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauFitDataTree.hh
Go to the documentation of this file.
1 
2 /*
3 Copyright 2004 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_FIT_DATA_TREE
36 #define LAU_FIT_DATA_TREE
37 
38 #include <vector>
39 #include <map>
40 
41 #include "TEventList.h"
42 #include "TTree.h"
43 
44 class TFile;
45 class TLeaf;
46 
48 typedef std::map<TString,Double_t> LauFitData;
49 
50 
52 
53  public:
55 
59  LauFitDataTree(const TString& rootFileName, const TString& rootTreeName);
60 
62  virtual ~LauFitDataTree();
63 
65 
68  const TString& fileName() const {return rootFileName_;}
69 
71 
74  const TString& treeName() const {return rootTreeName_;}
75 
77 
80  Bool_t findBranches();
81 
83  void readAllData();
84 
86 
89  void readExperimentData( UInt_t iExpt );
90 
92 
98  void appendFakePoints(const std::vector<Double_t>& xCoords, const std::vector<Double_t>& yCoords);
99 
101 
104  UInt_t nBranches() const;
105 
107 
110  UInt_t nTreeEvents() const {return rootTree_ ? static_cast<UInt_t>(rootTree_->GetEntries()) : 0;}
111 
113 
116  UInt_t nEvents() const {return eventList_ ? static_cast<UInt_t>(eventList_->GetN()) : this->nTreeEvents();}
117 
119 
122  UInt_t nFakeEvents() const {return fakeEvents_.size();}
123 
125 
128  UInt_t nTotalEvents() const {return this->nTreeEvents()+this->nFakeEvents();}
129 
131 
135  Bool_t haveBranch(const TString& name) const;
136 
138 
142  const LauFitData& getData(UInt_t iEvt) const;
143 
145  void disableAllBranches() const;
146 
148  void enableAllBranches() const;
149 
151 
154  void enableBranch(const TString& name) const;
155 
157 
160  void disableBranch(const TString& name) const;
161 
162  protected:
164  void openFileAndTree();
165 
167 
170  void loadData();
171 
172  private:
174  LauFitDataTree(const LauFitDataTree& rhs);
175 
178 
180  typedef std::map<TString,UInt_t> LauNameIndexMap;
181 
183  typedef std::vector<Double_t> LauEventData;
184 
186  typedef std::vector<TLeaf*> LauLeafList;
187 
189  TString rootFileName_;
190 
192  TString rootTreeName_;
193 
195  TFile* rootFile_;
196 
198  TTree* rootTree_;
199 
201  TEventList* eventList_;
202 
205 
208 
211 
214 
216  std::vector<LauEventData> treeEvents_;
217 
219  std::vector<LauEventData> fakeEvents_;
220 
221  ClassDef(LauFitDataTree, 0)
222 };
223 
224 #endif
Bool_t findBranches()
Find all of the branches in the tree.
void loadData()
Load events from the tree.
LauEventData eventData_
Stores the current event.
std::map< TString, UInt_t > LauNameIndexMap
The type used to map the leaf names to the vector indices.
void openFileAndTree()
Open the file and tree.
std::vector< LauEventData > fakeEvents_
The fake events, which are not from the tree.
void readAllData()
Read all events from the tree.
TFile * rootFile_
The file containing the data.
TString rootFileName_
The name of the file containing the data.
LauFitData eventDataOut_
Stores the current event (for external use)
void enableAllBranches() const
Enable all branches.
std::map< TString, Double_t > LauFitData
Type for holding event data.
std::vector< LauEventData > treeEvents_
The events read from the tree.
UInt_t nBranches() const
Obtain the number of branches in the tree.
TString rootTreeName_
The name of the tree ocntaining the data.
void readExperimentData(UInt_t iExpt)
Read events only for the given experiment.
LauNameIndexMap leafNames_
Stores the mapping from the leaf names to the vector indices.
UInt_t nTotalEvents() const
Retrieve the total number of events.
TEventList * eventList_
A list of the events in the current experiment.
std::vector< TLeaf * > LauLeafList
The type used to hold the leaves.
const TString & treeName() const
Retrieve the tree name.
void disableAllBranches() const
Disable all branches.
TTree * rootTree_
The tree containing the data.
LauFitDataTree & operator=(const LauFitDataTree &rhs)
Copy assignment operator (not implemented)
virtual ~LauFitDataTree()
Destructor.
const TString & fileName() const
Retrieve the file name.
LauFitDataTree(const TString &rootFileName, const TString &rootTreeName)
Constructor.
void appendFakePoints(const std::vector< Double_t > &xCoords, const std::vector< Double_t > &yCoords)
Add fake events to the data.
const LauFitData & getData(UInt_t iEvt) const
Retrieve the data for a given event.
UInt_t nTreeEvents() const
Retrieve the number of events in the tree.
UInt_t nFakeEvents() const
Retrieve the number of fake events.
std::vector< Double_t > LauEventData
The type used to contain the data for each event.
Bool_t haveBranch(const TString &name) const
Check if the named branch is stored.
UInt_t nEvents() const
Retrieve the number of events.
void enableBranch(const TString &name) const
Enable the named branch.
void disableBranch(const TString &name) const
Disable the named branch.
LauLeafList leaves_
The leaf objects.
Class to store the input fit variables.