ROOTPWA
pwaPlotter.h
Go to the documentation of this file.
1 
2 //
3 // Copyright 2009 Sebastian Neubert
4 //
5 // This file is part of rootpwa
6 //
7 // rootpwa is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // rootpwa is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with rootpwa. If not, see <http://www.gnu.org/licenses/>.
19 //
21 
22 
23 #ifndef PWAPLOTTER_HH
24 #define PWAPLOTTER_HH
25 
26 // Base Class Headers ----------------
27 
28 
29 // Collaborating Class Headers -------
30 #include <vector>
31 #include <map>
32 #include <set>
33 #include <string>
34 #include "Rtypes.h"
35 
36 #include "TGraphErrors.h"
37 
38 // Collaborating Class Declarations --
39 
40 class TFile;
41 class TH2D;
42 class TMultiGraph;
43 
44 namespace rpwa {
45 
46  typedef std::pair<std::string,std::string> strpair;
47 
48 
52 
54  public:
56  fitResultMetaInfo(const std::string& filename,
57  const std::string& title,
58  unsigned int colour = 1,
59  const std::string& treename="pwa",
60  const std::string& branchname="fitResult_v2"):
61  mfilename(filename),mtitle(title),mcolour(colour),mtreename(treename),mbranchname(branchname){}
62 
63 
64  std::string mfilename;
65  std::string mtitle;
66  unsigned int mcolour;
67  std::string mtreename;
68  std::string mbranchname;
69 
70 
71  void setLikelihoods(double logli,double logliperevt,
72  double evi, double eviperevt){
73  mTotalLogLikelihood=logli;
74  mTotalPerEventLogLikelihood=logliperevt;
75  mTotalEvidence=evi;
76  mTotalPerEventEvidence=eviperevt;
77  }
82 
83  void setBinRange(double min, double max, unsigned int n){
84  mMin=min; mMax=max; mNumBins=n;
85  }
86  double mMin; // minimum mass bin in fit
87  double mMax; // maximum mass bin in fit
88  unsigned int mNumBins;
89  void setNWaves(unsigned int n){nWaves=n;}
90  unsigned int nWaves;
91 
92 
93  };
94 
95 
98  class TPwaFitGraphErrors : public TGraphErrors {
99  public:
100  TPwaFitGraphErrors() : TGraphErrors(), fitindex(0){}
101  TPwaFitGraphErrors(unsigned int n, unsigned int i): TGraphErrors(n),fitindex(i){}
102  virtual ~TPwaFitGraphErrors(){};
103  unsigned int fitindex;
104 
106  };
107 
108 
111 class pwaPlotter {
112 public:
113 
114  // Constructors/Destructors ---------
115  pwaPlotter();
116  virtual ~pwaPlotter();
117 
118  // Accessors -----------------------
119  const std::set<std::string>& wavesNames(){return mWavenames;}
120  const std::set<std::string>& listJPCME(){return mJPCME;}
121 
122 
123  // Modifiers -----------------------
126 
127  void addFit(const std::string& filename,
128  const std::string& title,
129  const unsigned int colour=1,
130  const std::string& treename="pwa",
131  const std::string& branchname="fitResult_v2",
132  const unsigned int numb_bins=0);
133 
134 
135 
139  void produceDensityPlots();
140 
141  // Operations ----------------------
142  void writeAllIntensities(std::string filename);
143  void writeAllIntensities(TFile* outfile);
144 
145 // void writeSpinTotals(std::string filename, std::string opt="");
146 // void writeSpinTotals(TFile* outfile, std::string opt="");
147 
148  void writeAll(std::string filename);
149  void writeAll(TFile* outfile);
150 
151  void printStats();
152 
153 
154 private:
155 
156  // Private Data Members ------------
157  std::set<std::string> mWavenames;
158  std::set<std::string> mJPCME;
159  std::vector<fitResultMetaInfo> mResultMetaInfo;
160 
162  std::map<std::string,TH2D*> mIntensityDensityPlots;
163 
164 
166  std::map<std::string,TMultiGraph*> mIntensities;
167  std::map<strpair,TMultiGraph*> mPhases;
168 
169  std::map<std::string,TGraph*> mPhaseSpace;
170  std::map<std::string,double> mWaveEvidence;
171 
172  TMultiGraph* mLogLikelihood;
174  TMultiGraph* mEvidence;
175  TMultiGraph* mEvidencePerEvent;
176 
177 
178  double mMinEvidence; // minimal evidence for a fit -- used to renormalize weighting
179 
180  // Private Methods -----------------
181 
182  bool registerWave(const std::string& wavename);
183 
184  ClassDef(pwaPlotter,2);
185 
186 };
187 
188 } // end namespace
189 
190 #endif
191 
192 //--------------------------------------------------------------
193 // $Log$
194 //--------------------------------------------------------------