GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CorrelatedSpaceTH2.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Olivier Stezowski *
3  * Copyright (C) 2010 by Christian Finck *
4  * stezow(AT)ipnl.in2p3.fr *
5  * *
6  * This program is free software; you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License as published by *
8  * the Free Software Foundation; either version 2 of the License, or *
9  * (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this program; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
20  ***************************************************************************/
21 
25 #ifndef Gw_CorrelatedSpaceTH2
26 #define Gw_CorrelatedSpaceTH2
27 
28 #include "GwLogMessage.h"
29 
30 #ifndef Gw_SymCorrelatedSpace
31 #include "ASymCorrelatedSpace.h"
32 #endif
33 
34 #ifndef ROOT_TObject
35 #include "TObject.h"
36 #endif
37 
38 class TBrowser;
39 class TFile;
40 class TH2;
41 
42 namespace Gw {
43 
44 class CSFilter;
45 
51 {
52 
53 protected:
54 
55  TH2* fHisto; // TH2 that contains the matrix
56  UChar_t fType; // Type of data: float, integer, etc
57  Bool_t fAdopted; // flag on when TH2 comes from outside
58 
59  mutable LogMessage fLog;
60 
61 public:
62  CorrelatedSpaceTH2(const char* name = CorrelatedSpace::GetDefaultName(), const char* title = "TH2", Option_t* type = "float");
63  virtual ~CorrelatedSpaceTH2();
64 
66  void Fill(const Double_t* Xn, const Double_t weight = 1.);
67 
69  void FillRandom(Int_t dimX, Int_t dimY);
70 
72  void FillFromH2(TH2* h2);
73 
75  void Adopt(TH2* h2);
76 
78  void Project(CSFilter* filter, Option_t* axis = "X");
79 
81  virtual void Project(Option_t* axis, Option_t* gateName = "Gate0");
82 
84  virtual void Browse(TBrowser* b);
85 
87  void AssertHisto();
88 
90  const Char_t* GetHistoName() const;
91 
93  const Char_t* GetHistoTitle() const;
94 
96  Double_t GetContent(Int_t i, Int_t j);
97 
99  Double_t GetCellContent(Int_t iCell);
100 
102  void SetCellContent(Int_t iCell, Double_t weight);
103 
105  Int_t GetNbin(Int_t axis) const;
106 
107  ClassDef(CorrelatedSpaceTH2,1) // Correlated Space Tree in 2 dim
108 };
109 
110 
111 
112 } // end namespace
113 
114 #endif
const Char_t * GetHistoName() const
Get histo name.
TBrowser * b
void Adopt(TH2 *h2)
Adopt TH2, do not delete the matrix when destroying CS !
CorrelatedSpaceTH2 class that manages a 2D symmetrical correlated space stored in a TH2...
const Char_t * GetHistoTitle() const
Get histo title.
Base class for a Log message.
Definition: GwLogMessage.h:94
virtual void Browse(TBrowser *b)
Browser method.
header file for all type of ASymCorrelatedSpace
header file for GwLogMessage.cpp
CorrelatedSpaceTH2(const char *name=CorrelatedSpace::GetDefaultName(), const char *title="TH2", Option_t *type="float")
log message
void FillRandom(Int_t dimX, Int_t dimY)
fill random
ASymCorrelatedSpace base class that contains correlated informations.
CSFilter base class for filter.
Definition: CSFilter.h:56
void FillFromH2(TH2 *h2)
fill correlated space from H2
Double_t GetContent(Int_t i, Int_t j)
Get content.
static const Char_t * GetDefaultName()
Get default name for CS.
Int_t GetNbin(Int_t axis) const
Get bin.
void Project(CSFilter *filter, Option_t *axis="X")
Project.
void SetCellContent(Int_t iCell, Double_t weight)
Set cell content.
Double_t GetCellContent(Int_t iCell)
Get cell content.
void Fill(const Double_t *Xn, const Double_t weight=1.)
fill correlated space