MINT2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DalitzHistoStackSet Class Reference

#include <DalitzHistoStackSet.h>

Inheritance diagram for DalitzHistoStackSet:
DalitzSet< THStack > MINT::PolymorphMap< DalitzCoordSet, MINT::counted_ptr< THStack > >

Public Member Functions

 DalitzHistoStackSet ()
 
 DalitzHistoStackSet (const DalitzHistoStackSet &other)
 
virtual void add (const DalitzCoordSet &coord, const MINT::counted_ptr< TH1 > &histo)
 
virtual void add (const DalitzHistogram &histo)
 
virtual void add (const DalitzHistoSet &hL)
 
bool draw (const std::string &baseName="", const std::string &drawOpt="HIST", const std::string &format="eps") const
 
void setColourPalette (int nCol, int *pal, double max, double min=0.000001)
 
virtual ~DalitzHistoStackSet ()
 
- Public Member Functions inherited from DalitzSet< THStack >
 DalitzSet ()
 
 DalitzSet (const DalitzSet< THStack > &other)
 
const std::string & name () const
 
virtual ~DalitzSet ()
 
- Public Member Functions inherited from MINT::PolymorphMap< DalitzCoordSet, MINT::counted_ptr< THStack > >
 PolymorphMap ()
 
 PolymorphMap (const PolymorphMap &other)
 
 PolymorphMap (const typename std::map< DalitzCoordSet, MINT::counted_ptr< THStack > > &other)
 
virtual ~PolymorphMap ()
 
std::map< DalitzCoordSet, MINT::counted_ptr< THStack > > & theMap ()
 
const std::map< DalitzCoordSet, MINT::counted_ptr< THStack > > & theMap () const
 
MINT::counted_ptr< THStack > & operator[] (const DalitzCoordSet &k)
 
const MINT::counted_ptr< THStack > & operator[] (const DalitzCoordSet &k) const
 
std::map< DalitzCoordSet, MINT::counted_ptr< THStack > >::iterator begin ()
 
std::map< DalitzCoordSet, MINT::counted_ptr< THStack > >::const_iterator begin () const
 
std::map< DalitzCoordSet, MINT::counted_ptr< THStack > >::iterator end ()
 
std::map< DalitzCoordSet, MINT::counted_ptr< THStack > >::const_iterator end () const
 
std::map< DalitzCoordSet, MINT::counted_ptr< THStack > >::iterator find (const DalitzCoordSet &c)
 
std::map< DalitzCoordSet, MINT::counted_ptr< THStack > >::const_iterator find (const DalitzCoordSet &c) const
 
void insert (typename std::map< DalitzCoordSet, MINT::counted_ptr< THStack > >::const_iterator first, typename std::map< DalitzCoordSet, MINT::counted_ptr< THStack > >::const_iterator last)
 
unsigned int size () const
 
bool empty () const
 
PolymorphMap< DalitzCoordSet, MINT::counted_ptr< THStack > > & operator= (const PolymorphMap &other)
 
void clear ()
 
void resize (unsigned int N)
 
void resize (unsigned int N, const MINT::counted_ptr< THStack > &c)
 
 operator const typename std::map< DalitzCoordSet, MINT::counted_ptr< THStack > > & () const
 
 operator typename std::map< DalitzCoordSet, MINT::counted_ptr< THStack > > & ()
 
bool operator== (const MINT::PolymorphMap< DalitzCoordSet, MINT::counted_ptr< THStack > > &v2) const
 
bool operator!= (const MINT::PolymorphMap< DalitzCoordSet, MINT::counted_ptr< THStack > > &v2) const
 
bool operator< (const MINT::PolymorphMap< DalitzCoordSet, MINT::counted_ptr< THStack > > &v2) const
 
bool operator> (const MINT::PolymorphMap< DalitzCoordSet, MINT::counted_ptr< THStack > > &v2) const
 

Private Member Functions

MINT::counted_ptr< THStack > makeHStack (const DalitzCoordSet &coord) const
 
void makeH2ForPalette () const
 
MINT::counted_ptr< TH2F > getH2ForPalette () const
 
TPaletteAxis * getPaletteAxis () const
 

Private Attributes

std::vector< MINT::counted_ptr< TH1 * > > _histograms
 
int _ncol
 
int * _palette
 
double _max
 
double _min
 
MINT::counted_ptr< TH2F > _h2ForPalette
 

Additional Inherited Members

- Protected Attributes inherited from MINT::PolymorphMap< DalitzCoordSet, MINT::counted_ptr< THStack > >
std::map< DalitzCoordSet, MINT::counted_ptr< THStack > > _map
 

Detailed Description

Definition at line 14 of file DalitzHistoStackSet.h.

Constructor & Destructor Documentation

◆ DalitzHistoStackSet() [1/2]

DalitzHistoStackSet::DalitzHistoStackSet ( )

Definition at line 10 of file DalitzHistoStackSet.cpp.

12  , _ncol(0)
13  , _palette(0)
14  , _max(0)
15  , _min(0)
16  , _h2ForPalette(0)
17 {
18 }
MINT::counted_ptr< TH2F > _h2ForPalette

◆ DalitzHistoStackSet() [2/2]

DalitzHistoStackSet::DalitzHistoStackSet ( const DalitzHistoStackSet other)

Definition at line 20 of file DalitzHistoStackSet.cpp.

21  : DalitzSet<THStack>(other)
22  , _histograms(other._histograms)
24 {
25  setColourPalette(other._ncol, other._palette, other._max);
26 }
MINT::counted_ptr< TH2F > _h2ForPalette
std::vector< MINT::counted_ptr< TH1 * > > _histograms
void setColourPalette(int nCol, int *pal, double max, double min=0.000001)

◆ ~DalitzHistoStackSet()

DalitzHistoStackSet::~DalitzHistoStackSet ( )
virtual

Definition at line 132 of file DalitzHistoStackSet.cpp.

132  {
133  if(0 != _palette) delete[] _palette;
134 }

Member Function Documentation

◆ add() [1/3]

void DalitzHistoStackSet::add ( const DalitzCoordSet coord,
const MINT::counted_ptr< TH1 > &  histo 
)
virtual

Definition at line 35 of file DalitzHistoStackSet.cpp.

36  {
37  if(0 == histo) return;
38  if(0 == (*this)[coord]){
39  (*this)[coord] = makeHStack(coord);
40  }
41  _histograms.push_back(histo);
42  ((*this)[coord])->Add(histo.get());
43 }
MINT::counted_ptr< THStack > makeHStack(const DalitzCoordSet &coord) const
std::vector< MINT::counted_ptr< TH1 * > > _histograms
X * get() const
Definition: counted_ptr.h:123

◆ add() [2/3]

void DalitzHistoStackSet::add ( const DalitzHistogram histo)
virtual

Definition at line 44 of file DalitzHistoStackSet.cpp.

44  {
45  add(histo.coord(), histo.histo());
46 }
MINT::const_counted_ptr< TH1 > histo() const
virtual void add(const DalitzCoordSet &coord, const MINT::counted_ptr< TH1 > &histo)
const DalitzCoordSet & coord() const

◆ add() [3/3]

void DalitzHistoStackSet::add ( const DalitzHistoSet hL)
virtual

Definition at line 47 of file DalitzHistoStackSet.cpp.

47  {
48  for(map< DalitzCoordSet, DalitzHistogram>::const_iterator it = hL.begin();
49  it != hL.end();
50  it++){
51  this->add(it->second);
52  }
53  return;
54 }
std::map< Key, Val >::iterator end()
Definition: PolymorphMap.h:29
virtual void add(const DalitzCoordSet &coord, const MINT::counted_ptr< TH1 > &histo)
std::map< Key, Val >::iterator begin()
Definition: PolymorphMap.h:26

◆ draw()

bool DalitzHistoStackSet::draw ( const std::string &  baseName = "",
const std::string &  drawOpt = "HIST",
const std::string &  format = "eps" 
) const

Definition at line 87 of file DalitzHistoStackSet.cpp.

90  {
91  bool sc=true;
92 
93  TPaletteAxis* pa = getPaletteAxis();
94 
95  cout << "Hello from DalitzHistoStackSet::draw"
96  << " with " << this->size() << " histo stacks" << endl;
97 
98  for(map< DalitzCoordSet, counted_ptr<THStack> >::const_iterator
99  it = this->begin();
100  it != this->end();
101  it++){
102  if(0 == it->second){
103  cout << "it->second is 0" << endl;
104  continue;
105  }
106  TCanvas can;
107  DalitzCoordSet c(it->first);
108  string fname = baseName + c.nameFileSave() + "." + format;
109 
110  it->second->Draw(drawOpt.c_str());
111  cout << "drew histostack of size " << it->second->GetHists()->GetSize()
112  << endl;
113  if(0 != pa) pa->Draw("SAME");
114  can.Print(fname.c_str());
115  cout << "printed histo to file " << fname << endl;
116  }
117  return sc;
118 }
TPaletteAxis * getPaletteAxis() const
std::map< DalitzCoordSet, MINT::counted_ptr< THStack > >::iterator end()
Definition: PolymorphMap.h:29
std::map< DalitzCoordSet, MINT::counted_ptr< THStack > >::iterator begin()
Definition: PolymorphMap.h:26

◆ getH2ForPalette()

MINT::counted_ptr< TH2F > DalitzHistoStackSet::getH2ForPalette ( ) const
private

Definition at line 76 of file DalitzHistoStackSet.cpp.

76  {
78  return _h2ForPalette;
79 }
MINT::counted_ptr< TH2F > _h2ForPalette

◆ getPaletteAxis()

TPaletteAxis * DalitzHistoStackSet::getPaletteAxis ( ) const
private

Definition at line 82 of file DalitzHistoStackSet.cpp.

82  {
83  if(0 == getH2ForPalette()) return 0;
84  return (TPaletteAxis*) getH2ForPalette()->GetListOfFunctions()->FindObject("palette");
85 }
MINT::counted_ptr< TH2F > getH2ForPalette() const

◆ makeH2ForPalette()

void DalitzHistoStackSet::makeH2ForPalette ( ) const
private

Definition at line 56 of file DalitzHistoStackSet.cpp.

56  {
57  if(_ncol <= 0 || 0 == _palette){
58  counted_ptr<TH2F> ptr(0);
59  _h2ForPalette = ptr;
60  }
61  gStyle->SetPalette(_ncol, _palette);
62  gStyle->SetNumberContours(_ncol);
63 
64 
65  counted_ptr<TH2F> h2(new TH2F("blub", "bla", 2, 0, 2, 2, 0, 2));
66  h2->Fill(0.5, 0.5, 0.5*_min);
67  h2->Fill(1.5, 1.5, _min);
68  h2->Fill(0.5, 1.5, 0.5*_max);
69  h2->Fill(1.5, 0.5, _max);
70  TCanvas can;
71  h2->Draw("COLZ");
72  can.Print("colourScale.eps");
73  _h2ForPalette = h2;
74 }
MINT::counted_ptr< TH2F > _h2ForPalette

◆ makeHStack()

MINT::counted_ptr< THStack > DalitzHistoStackSet::makeHStack ( const DalitzCoordSet coord) const
private

Definition at line 29 of file DalitzHistoStackSet.cpp.

29  {
30  std::string thisName = name() + "_stack " + coord.name();
31  counted_ptr<THStack> ptr(new THStack(thisName.c_str(),thisName.c_str()));
32  return ptr;
33 }
std::string name() const
const std::string & name() const
Definition: DalitzSet.h:60

◆ setColourPalette()

void DalitzHistoStackSet::setColourPalette ( int  nCol,
int *  pal,
double  max,
double  min = 0.000001 
)

Definition at line 120 of file DalitzHistoStackSet.cpp.

120  {
121  if(0 == pal) return;
122  if(0 == nCol) return;
123 
124  if(0 != _palette) delete[] _palette;
125  _ncol=nCol;
126  _palette = new int[_ncol];
127  for(int i=0; i < _ncol; i++) _palette[i] = pal[i];
128  _max = max;
129  _min = min;
130 }

Member Data Documentation

◆ _h2ForPalette

MINT::counted_ptr<TH2F> DalitzHistoStackSet::_h2ForPalette
mutableprivate

Definition at line 24 of file DalitzHistoStackSet.h.

◆ _histograms

std::vector< MINT::counted_ptr<TH1*> > DalitzHistoStackSet::_histograms
private

Definition at line 16 of file DalitzHistoStackSet.h.

◆ _max

double DalitzHistoStackSet::_max
private

Definition at line 21 of file DalitzHistoStackSet.h.

◆ _min

double DalitzHistoStackSet::_min
private

Definition at line 22 of file DalitzHistoStackSet.h.

◆ _ncol

int DalitzHistoStackSet::_ncol
private

Definition at line 19 of file DalitzHistoStackSet.h.

◆ _palette

int* DalitzHistoStackSet::_palette
private

Definition at line 20 of file DalitzHistoStackSet.h.


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