StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtHistoCollector.cxx
1 /***************************************************************************
2  *
3  * $Id: StHbtHistoCollector.cxx,v 1.3 2001/04/25 18:03:41 perev Exp $
4  *
5  * Author: Frank Laue, Ohio State, laue@bnl.gov
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package
9  * Class to keep a list of all histograms
10  *
11  ***************************************************************************
12  *
13  * $Log: StHbtHistoCollector.cxx,v $
14  * Revision 1.3 2001/04/25 18:03:41 perev
15  * HPcorrs
16  *
17  * Revision 1.2 2000/09/05 14:43:21 laue
18  * cast changed from TH1D to TH1D&
19  *
20  * Revision 1.1 2000/09/05 14:21:10 laue
21  * NEW !! A histogram class (CTH, inherited from TH?Ds) that puts itself into
22  * a list (StHbtHistoCollector) at instantiation time. This provides an easy
23  * way to write out all the histograms.
24  *
25  **************************************************************************/
26 
27 #include "StHbtMaker/Infrastructure/StHbtHistoCollector.h"
28 #include "StHbtMaker/Infrastructure/StHbtTypes.hh"
29 
30 
31 #ifdef __ROOT__
32 ClassImp(StHbtHistoCollector)
33 #endif
34 
35 StHbtHistoCollector* StHbtHistoCollector::_instance=0;
36 
37 StHbtHistoCollector* StHbtHistoCollector::Instance() {
38  if (_instance == 0 ) _instance = new StHbtHistoCollector();
39  return _instance;
40 }
41 
42 StHbtHistoCollector::StHbtHistoCollector() {
43  cout << " StHbtHistoCollector::StHbtHistoCollector() " << endl;
44 }
45 
46 
47 void StHbtHistoCollector::Add(CTH1D* h) { m1DList.push_back(h); }
48 void StHbtHistoCollector::Add(CTH2D* h) { m2DList.push_back(h); }
49 void StHbtHistoCollector::Add(CTH3D* h) { m3DList.push_back(h); }
50 
51 
52 void StHbtHistoCollector::Clear() {
53  m1DList.clear();
54  m2DList.clear();
55  m3DList.clear();
56 }
57 
58 void StHbtHistoCollector::Write() {
59  {for (CTH1DIterator iter=m1DList.begin(); iter!=m1DList.end(); iter++) {
60  TH1D temp( (TH1D&)(**iter) );
61  temp.SetDirectory(0);
62  temp.Write();
63  }}
64  {for (CTH2DIterator iter=m2DList.begin(); iter!=m2DList.end(); iter++) {
65  TH2D temp( (TH2D&)(**iter) );
66  temp.SetDirectory(0);
67  temp.Write();
68  }}
69  {for (CTH3DIterator iter=m3DList.begin(); iter!=m3DList.end(); iter++) {
70  TH3D temp( (TH3D&)(**iter) );
71  temp.SetDirectory(0);
72  temp.Write();
73  }}
74 }
75 
Definition: CTH.hh:45
Definition: CTH.hh:74
Definition: CTH.hh:59