Public Member Functions | Public Attributes | Private Member Functions | List of all members
quad::HeatMap Class Reference

#include <HeatMap.h>

Public Member Functions

 HeatMap (int _Nz, double _minz, double _maxz, int _Nx, double _minx, double _maxx)
 
std::unique_ptr< TH2F > AsTH2 () const
 
double ZBinCenter (int iz) const
 
double XBinCenter (int ix) const
 
int ZToBin (double z) const
 
int XToBin (double x) const
 

Public Attributes

const double minz
 
const double minx
 
const double maxz
 
const double maxx
 
const int Nx
 
const int Nz
 
std::vector< float > map
 

Private Member Functions

int fast_floor (double x) const
 

Detailed Description

Definition at line 11 of file HeatMap.h.

Constructor & Destructor Documentation

quad::HeatMap::HeatMap ( int  _Nz,
double  _minz,
double  _maxz,
int  _Nx,
double  _minx,
double  _maxx 
)

Definition at line 8 of file HeatMap.cxx.

10  : minz(_minz), minx(_minx), maxz(_maxz), maxx(_maxx), Nx(_Nx), Nz(_Nz),
11  map(Nz*Nx, 0)
12  {
13  }
const double minz
Definition: HeatMap.h:24
const double minx
Definition: HeatMap.h:24
const int Nx
Definition: HeatMap.h:25
const double maxx
Definition: HeatMap.h:24
const int Nz
Definition: HeatMap.h:25
const double maxz
Definition: HeatMap.h:24
std::vector< float > map
Definition: HeatMap.h:27

Member Function Documentation

std::unique_ptr< TH2F > quad::HeatMap::AsTH2 ( ) const

Definition at line 16 of file HeatMap.cxx.

17  {
18  auto h = std::make_unique<TH2F>("", "", Nz, minz, maxz, Nx, minx, maxx);
19  for(unsigned int i = 0; i < map.size(); ++i){
20  h->SetBinContent((i/Nx)+1, (i%Nx)+1, map[i]);
21  }
22 
23  double maxz = 0;
24  for(int i = 0; i < (h->GetNbinsX()+2)*(h->GetNbinsY()+2); ++i){
25  maxz = std::max(maxz, h->GetBinContent(i));
26  }
27 
28  // Slim out bins with low population (reduces output file size)
29  for(int i = 0; i < (h->GetNbinsX()+2)*(h->GetNbinsY()+2); ++i){
30  if(h->GetBinContent(i) < .05*maxz) h->SetBinContent(i, 0);
31  }
32 
33  h->Sumw2(false); // Drop all the errors
34 
35  return h;
36  }
const double minz
Definition: HeatMap.h:24
const double minx
Definition: HeatMap.h:24
const int Nx
Definition: HeatMap.h:25
static int max(int a, int b)
const double maxx
Definition: HeatMap.h:24
const int Nz
Definition: HeatMap.h:25
const double maxz
Definition: HeatMap.h:24
std::vector< float > map
Definition: HeatMap.h:27
int quad::HeatMap::fast_floor ( double  x) const
inlineprivate

Definition at line 31 of file HeatMap.h.

31 {return int(x+100000)-100000;}
list x
Definition: train.py:276
double quad::HeatMap::XBinCenter ( int  ix) const
inline

Definition at line 20 of file HeatMap.h.

20 {return minx + (ix+.5)*(maxx-minx)/Nx;}
const double minx
Definition: HeatMap.h:24
const int Nx
Definition: HeatMap.h:25
const double maxx
Definition: HeatMap.h:24
int quad::HeatMap::XToBin ( double  x) const
inline

Definition at line 22 of file HeatMap.h.

22 {return fast_floor((x-minx)/(maxx-minx)*Nx);}
const double minx
Definition: HeatMap.h:24
const int Nx
Definition: HeatMap.h:25
const double maxx
Definition: HeatMap.h:24
int fast_floor(double x) const
Definition: HeatMap.h:31
list x
Definition: train.py:276
double quad::HeatMap::ZBinCenter ( int  iz) const
inline

Definition at line 19 of file HeatMap.h.

19 {return minz + (iz+.5)*(maxz-minz)/Nz;}
const double minz
Definition: HeatMap.h:24
const int Nz
Definition: HeatMap.h:25
const double maxz
Definition: HeatMap.h:24
int quad::HeatMap::ZToBin ( double  z) const
inline

Definition at line 21 of file HeatMap.h.

21 {return fast_floor((z-minz)/(maxz-minz)*Nz);}
const double minz
Definition: HeatMap.h:24
int fast_floor(double x) const
Definition: HeatMap.h:31
const int Nz
Definition: HeatMap.h:25
const double maxz
Definition: HeatMap.h:24

Member Data Documentation

std::vector<float> quad::HeatMap::map

Definition at line 27 of file HeatMap.h.

const double quad::HeatMap::maxx

Definition at line 24 of file HeatMap.h.

const double quad::HeatMap::maxz

Definition at line 24 of file HeatMap.h.

const double quad::HeatMap::minx

Definition at line 24 of file HeatMap.h.

const double quad::HeatMap::minz

Definition at line 24 of file HeatMap.h.

const int quad::HeatMap::Nx

Definition at line 25 of file HeatMap.h.

const int quad::HeatMap::Nz

Definition at line 25 of file HeatMap.h.


The documentation for this class was generated from the following files: