ATLAS Offline Software
MultiHisto.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MultiHisto_h
6 #define MultiHisto_h
7 
8 #include <TObject.h>
9 
10 
11 class string;
12 class TCanvas;
13 template < class T, class Allocator > class vector;
14 
15 template <class ht>
16 class MultiHisto: public TObject{
17 
18 public:
19 
20  MultiHisto(const ht &histo_model,const std::vector<std::string> &nameDiv,
21  const std::vector<int> &nDiv,const std::vector<double *> &binsDiv);
22 
23  MultiHisto(const ht &histo_model,const std::vector<std::string> &nameDiv,
24  const std::vector<std::vector <float> > &binsDiv);
25 
27 
28  // function to fill the histograms
29  int Fill(double xvar, double yvar,const std::vector<double> &pars);
30  int Fill(double xvar, double yvar,const std::vector<float> &pars);
31  int FillFromFile(TDirectory *histodir = 0);
32 
33  // funtions to write histograms
34  int Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const;
35  int Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0);
36  int WriteAndCount(int *nhistos, int *nbins) const;
37 
38  // functions to get informations
39  virtual const char *GetTitle() const;
40  virtual const char *GetName() const;
41  unsigned int GetNhistos() const;
42 
43  // functions to draw histograms
44  virtual void Draw(const Option_t* option = "");
45  virtual void Draw(const int color,const Option_t* option = "");
46  virtual void Draw(std::vector <TCanvas*> &c1,const int color, const Option_t* option = "");
47 
48  // functions to get global / detailed indexes
49  int GetGlobalIndex(const std::vector<int> &indexes) const;
50  int GetGlobalIndex(const std::vector<double> &pars) const;
51  int GetGlobalIndex(const std::vector<float> &pars) const;
52  std::vector<int> GetDivisionsIndexes(int globalindex) const;
53  std::vector<int> GetDivisionsIndexes(const std::vector<double> &pars) const;
54  std::vector<int> GetDivisionsIndexes(const std::vector<float> &pars) const;
55 
56  // functions to get histograms
57  ht* GetHisto(int globalindex);
58  ht* GetHisto(const std::vector<int> &indexes);
59 
60 private:
62 
63  // the histograms
64  const ht *m_model;
65  std::vector<ht*> m_myhistos;
66 
67  // std::vector of bins for divisions
68  std::vector<int> m_div_Nbins;
69  std::vector<std::string> m_div_names;
70  std::vector<double*> m_div_bins;
71 
72  // functions to compose titles & names during allocation
73  std::string ComposeName(const std::vector<int> &indexes);
74  std::string ComposeTitle(const std::vector<int> &indexes);
75  std::string TitleString(int idiv, int index);
76  std::string NameString(int idiv, int index);
77 
78 };
79 
80 #endif
81 
MultiHisto::m_div_bins
std::vector< double * > m_div_bins
Definition: MultiHisto.h:70
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
MultiHisto::Write
int Write(const char *name=0, Int_t option=0, Int_t bufsize=0) const
MultiHisto::GetDivisionsIndexes
std::vector< int > GetDivisionsIndexes(const std::vector< float > &pars) const
color
Definition: jFexInputByteStreamTool.cxx:25
MultiHisto::Fill
int Fill(double xvar, double yvar, const std::vector< double > &pars)
MultiHisto::GetGlobalIndex
int GetGlobalIndex(const std::vector< double > &pars) const
MultiHisto::WriteAndCount
int WriteAndCount(int *nhistos, int *nbins) const
MultiHisto::Draw
virtual void Draw(std::vector< TCanvas * > &c1, const int color, const Option_t *option="")
MultiHisto::MultiHisto
MultiHisto()
Definition: MultiHisto.h:61
index
Definition: index.py:1
MultiHisto::GetHisto
ht * GetHisto(int globalindex)
extractSporadic.c1
c1
Definition: extractSporadic.py:134
MultiHisto::ComposeName
std::string ComposeName(const std::vector< int > &indexes)
MultiHisto::Write
int Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
MultiHisto::GetNhistos
unsigned int GetNhistos() const
MultiHisto::GetDivisionsIndexes
std::vector< int > GetDivisionsIndexes(int globalindex) const
MultiHisto::GetDivisionsIndexes
std::vector< int > GetDivisionsIndexes(const std::vector< double > &pars) const
MultiHisto::TitleString
std::string TitleString(int idiv, int index)
MultiHisto
Definition: MultiHisto.h:16
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
MultiHisto::GetGlobalIndex
int GetGlobalIndex(const std::vector< float > &pars) const
MultiHisto::m_div_Nbins
std::vector< int > m_div_Nbins
Definition: MultiHisto.h:68
MultiHisto::ComposeTitle
std::string ComposeTitle(const std::vector< int > &indexes)
vector
Definition: MultiHisto.h:13
MultiHisto::GetTitle
virtual const char * GetTitle() const
MultiHisto::~MultiHisto
~MultiHisto()
MultiHisto::m_div_names
std::vector< std::string > m_div_names
Definition: MultiHisto.h:69
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
MultiHisto::m_myhistos
std::vector< ht * > m_myhistos
Definition: MultiHisto.h:65
MultiHisto::m_model
const ht * m_model
Definition: MultiHisto.h:61
MultiHisto::NameString
std::string NameString(int idiv, int index)
MultiHisto::Draw
virtual void Draw(const int color, const Option_t *option="")
MultiHisto::MultiHisto
MultiHisto(const ht &histo_model, const std::vector< std::string > &nameDiv, const std::vector< std::vector< float > > &binsDiv)
MultiHisto::Draw
virtual void Draw(const Option_t *option="")
MultiHisto::GetHisto
ht * GetHisto(const std::vector< int > &indexes)
MultiHisto::FillFromFile
int FillFromFile(TDirectory *histodir=0)
MultiHisto::GetGlobalIndex
int GetGlobalIndex(const std::vector< int > &indexes) const
MultiHisto::GetName
virtual const char * GetName() const
MultiHisto::MultiHisto
MultiHisto(const ht &histo_model, const std::vector< std::string > &nameDiv, const std::vector< int > &nDiv, const std::vector< double * > &binsDiv)
MultiHisto::Fill
int Fill(double xvar, double yvar, const std::vector< float > &pars)