HeatMap.h
Go to the documentation of this file.
1 #ifndef LARRECO_QUADVTX_HEATMAP_H
2 #define LARRECO_QUADVTX_HEATMAP_H
3 
4 #include <vector>
5 #include <memory>
6 
7 class TH2F;
8 
9 namespace quad
10 {
11  class HeatMap
12  {
13  public:
14  HeatMap(int _Nz, double _minz, double _maxz,
15  int _Nx, double _minx, double _maxx);
16 
17  std::unique_ptr<TH2F> AsTH2() const;
18 
19  double ZBinCenter(int iz) const {return minz + (iz+.5)*(maxz-minz)/Nz;}
20  double XBinCenter(int ix) const {return minx + (ix+.5)*(maxx-minx)/Nx;}
21  int ZToBin(double z) const {return fast_floor((z-minz)/(maxz-minz)*Nz);}
22  int XToBin(double x) const {return fast_floor((x-minx)/(maxx-minx)*Nx);}
23 
24  const double minz, minx, maxz, maxx;
25  const int Nx, Nz;
26 
27  std::vector<float> map;
28 
29  private:
30  // The rounding functions in std:: are surprisingly slow
31  inline int fast_floor(double x) const {return int(x+100000)-100000;}
32  };
33 }
34 
35 #endif
int XToBin(double x) const
Definition: HeatMap.h:22
const double minz
Definition: HeatMap.h:24
int ZToBin(double z) const
Definition: HeatMap.h:21
const double minx
Definition: HeatMap.h:24
const int Nx
Definition: HeatMap.h:25
double ZBinCenter(int iz) const
Definition: HeatMap.h:19
const double maxx
Definition: HeatMap.h:24
HeatMap(int _Nz, double _minz, double _maxz, int _Nx, double _minx, double _maxx)
Definition: HeatMap.cxx:8
int fast_floor(double x) const
Definition: HeatMap.h:31
list x
Definition: train.py:276
double XBinCenter(int ix) const
Definition: HeatMap.h:20
const int Nz
Definition: HeatMap.h:25
std::unique_ptr< TH2F > AsTH2() const
Definition: HeatMap.cxx:16
const double maxz
Definition: HeatMap.h:24
std::vector< float > map
Definition: HeatMap.h:27