MINT2
HyperBinning.h
Go to the documentation of this file.
1 
55 #ifndef HYPERBINNING_HH
56 #define HYPERBINNING_HH
57 
58 // HyperPlot includes
59 #include "Mint/MessageService.h"
60 #include "Mint/HyperPoint.h"
61 #include "Mint/HyperPointSet.h"
62 #include "Mint/HyperCuboid.h"
63 #include "Mint/HyperVolume.h"
64 #include "Mint/RootPlotter1D.h"
65 #include "Mint/RootPlotter2D.h"
66 #include "Mint/HyperName.h"
67 #include "Mint/BinningBase.h"
68 #include "Mint/LoadingBar.h"
69 #include "Mint/CachedVar.h"
70 
71 
72 // Root includes
73 #include "TRandom3.h"
74 #include "TH1D.h"
75 #include "TH2D.h"
76 #include "TMath.h"
77 
78 // std includes
79 #include <algorithm>
80 #include <sstream>
81 
82 class HyperBinning : public BinningBase {
83 
84  private:
85 
86  //mutable bool _changed;
157  protected:
158 
159 
160  int followBinLinks(const HyperPoint& coords, int binNumber) const;
161 
162  void updateCash() const;
163  void updateBinNumbering() const;
164  void updateAverageBinWidth() const;
165  void updateMinMax() const;
166 
167  int getHyperBinningDimFromTree(TTree* tree);
168 
169  void createBranches (TTree* tree, int* binNumber, double* lowCorner, double* highCorner, std::vector<int>** linkedBins) const;
170  void saveHyperVolumeToTree(TTree* tree, double* lowCorner, double* highCorner, const HyperVolume& hyperVolume) const;
171  void savePrimaryVolumeNumbers() const;
172 
173  public:
174 
175  HyperBinning();
176 
177  bool isPrimaryVolume(int volumeNumber) const;
178 
179  //Used for getting between the bin number and HyperVolume numbers
180  int getHyperVolumeNumber(int binNumber) const;
181  int getBinNum(int volumeNumber) const;
182 
183  virtual std::vector<int> getPrimaryVolumeNumbers() const;
184 
185  virtual ~HyperBinning();
186 
187  /* Virtual functions that need to implemented in any derrived class */
188 
189  virtual void setDimension(int dim);
190 
191  virtual std::vector<int> getLinkedHyperVolumes( int volumeNumber ) const = 0;
192  virtual HyperVolume getHyperVolume(int volumeNumber) const = 0;
193  virtual void addPrimaryVolumeNumber(int volumeNumber) = 0;
194  virtual bool addHyperVolume(const HyperVolume& hyperVolume, std::vector<int> linkedVolumes = std::vector<int>(0, 0)) = 0;
195  virtual int getNumHyperVolumes() const = 0;
196 
197  virtual int getNumPrimaryVolumes () const = 0;
198  virtual int getPrimaryVolumeNumber(int i) const = 0;
199 
200  virtual void reserveCapacity(int nElements);
201 
202 
203  /* Virtual functions that need to implemented from BinningBase */
204  /* These will be implemented in the derived classes */
205 
206  virtual void load(TString filename, TString option = "READ") = 0;
207  virtual BinningBase* clone() const = 0;
208 
209  /* These will be implemented in this class */
210 
211  virtual void save(TString filename) const;
212  virtual void save() const;
213 
214  virtual void mergeBinnings( const BinningBase& other );
215 
216  virtual int getNumBins() const;
217  virtual int getBinNum(const HyperPoint& coords) const;
218 
219  /* */
220  virtual std::vector<int> getBinNum(const HyperPointSet& coords) const;
221  std::vector<int> getBinNumAlt(const HyperPointSet& coords) const;
222 
223 
224  virtual HyperVolume getBinHyperVolume(int binNumber) const;
225 
226  virtual HyperPoint getAverageBinWidth() const;
227  virtual HyperCuboid getLimits() const;
228 
229 
230 
231 };
232 
233 
234 
235 #endif
236 
virtual TString filename() const
Definition: BinningBase.cpp:57
bool isPrimaryVolume(int volumeNumber) const
HyperBinning()
The only constructor.
Definition: HyperBinning.cpp:5
CachedVar< std::vector< int > > _hyperVolumeNumFromBinNum
Definition: HyperBinning.h:130
void saveHyperVolumeToTree(TTree *tree, double *lowCorner, double *highCorner, const HyperVolume &hyperVolume) const
virtual void load(TString filename, TString option="READ")=0
int getHyperBinningDimFromTree(TTree *tree)
virtual void mergeBinnings(const BinningBase &other)
int followBinLinks(const HyperPoint &coords, int binNumber) const
virtual bool addHyperVolume(const HyperVolume &hyperVolume, std::vector< int > linkedVolumes=std::vector< int >(0, 0))=0
virtual BinningBase * clone() const =0
void updateMinMax() const
virtual void reserveCapacity(int nElements)
virtual HyperVolume getHyperVolume(int volumeNumber) const =0
virtual std::vector< int > getLinkedHyperVolumes(int volumeNumber) const =0
virtual int getNumHyperVolumes() const =0
void updateCash() const
virtual void addPrimaryVolumeNumber(int volumeNumber)=0
virtual std::vector< int > getPrimaryVolumeNumbers() const
virtual HyperPoint getAverageBinWidth() const
virtual ~HyperBinning()
virtual HyperVolume getBinHyperVolume(int binNumber) const
void createBranches(TTree *tree, int *binNumber, double *lowCorner, double *highCorner, std::vector< int > **linkedBins) const
CachedVar< std::vector< int > > _binNum
Definition: HyperBinning.h:101
virtual void save() const
void savePrimaryVolumeNumbers() const
void updateAverageBinWidth() const
virtual HyperCuboid getLimits() const
std::vector< int > getBinNumAlt(const HyperPointSet &coords) const
virtual int getNumPrimaryVolumes() const =0
CachedVar< HyperCuboid > _minmax
Definition: HyperBinning.h:97
virtual int getNumBins() const
int getHyperVolumeNumber(int binNumber) const
virtual int getPrimaryVolumeNumber(int i) const =0
CachedVar< HyperPoint > _averageBinWidth
Definition: HyperBinning.h:93
virtual void setDimension(int dim)
void updateBinNumbering() const
int getBinNum(int volumeNumber) const