ComPWA
Common Partial-Wave-Analysis Framework
DalitzPlot.hpp
Go to the documentation of this file.
1 // Copyright (c) 2013, 2017 The ComPWA Team.
2 // This file is part of the ComPWA framework, check
3 // https://github.com/ComPWA/ComPWA/license.txt for details.
4 
5 #ifndef PLOTDATA_HPP_
6 #define PLOTDATA_HPP_
7 
8 #include <map>
9 #include <vector>
10 
11 #include <TGraph.h>
12 #include <TH1D.h>
13 #include <TH2D.h>
14 #include <TH2Poly.h>
15 #include <TTree.h>
16 
17 #include "Core/Event.hpp"
18 #include "Core/FitParameter.hpp"
19 #include "Core/FourMomentum.hpp"
20 #include "Core/Function.hpp"
22 
23 namespace ComPWA {
24 struct DataPoint;
25 struct Event;
26 namespace Data {
27 struct DataSet;
28 }
29 namespace Physics {
30 namespace HelicityFormalism {
31 class HelicityKinematics;
32 }
33 } // namespace Physics
34 namespace Tools {
35 namespace Plotting {
36 
42 class DalitzHisto {
43 public:
45  DalitzHisto(const DalitzHisto &that) = delete;
46 
48  DalitzHisto(DalitzHisto &&other) = default;
49 
52  std::string Name, std::string Title, unsigned int Bins,
53  Color_t Color = kBlack);
55  void setStats(bool b);
56 
57  void fill(const ComPWA::Data::DataSet &DataSet,
58  std::vector<double> Intensities = {});
59 
61  void scale(double w);
63  TH1D *getHistogram(std::string Name);
65  TH2D *getHistogram2D(std::pair<std::string, std::string> Names);
67  void setColor(Color_t Color);
69  void write();
71  double integral() { return Integral; }
72 
73 private:
74  std::map<std::string, TH1D> Hists1D;
75  std::map<std::pair<std::string, std::string>, TH2D> Hists2D;
76  std::string Name, Title;
77  unsigned int NumBins;
78 
79  std::unique_ptr<TTree> Tree;
80 
81  // tree branches
82  std::vector<double> BranchPoint;
83  double BranchEff, BranchWeight;
84  double Integral;
85 };
86 
87 class DalitzPlot {
88 public:
90  const std::string &Name, int bins = 100);
91 
92  virtual ~DalitzPlot() = default;
93 
94  void setGlobalScale(double Scale) { GlobalScale = Scale; }
95 
96  void fill(const ComPWA::EventCollection &Data, bool Normalize = false,
97  const std::string &Name = "", const std::string &Title = "",
98  Color_t Color = kBlack);
99  void fill(const ComPWA::EventCollection &data, Intensity &intens,
100  bool Normalize = false, const std::string &Name = "",
101  const std::string &Title = "", Color_t Color = kBlack);
102  void plot();
103 
104 private:
105  TString Name;
107  unsigned int Bins;
108  double GlobalScale;
109 
110  void CreateHist(std::string Name);
111 
112  std::vector<DalitzHisto> PlotHistograms;
113 };
114 
115 } // namespace Plotting
116 } // namespace Tools
117 } // namespace ComPWA
118 #endif
std::vector< double > BranchPoint
Definition: DalitzPlot.hpp:82
cmplx FADDEEVA() w(cmplx z, double relerr)
Definition: Faddeeva.cc:668
std::map< std::pair< std::string, std::string >, TH2D > Hists2D
Definition: DalitzPlot.hpp:75
Implementation of the ComPWA::Kinematics interface for amplitude models using the helicity formalism...
Physics::HelicityFormalism::HelicityKinematics & Kinematics
Definition: DalitzPlot.hpp:106
Simple class to create and fill Dalitz plots.
Definition: DalitzPlot.hpp:42
std::vector< DalitzHisto > PlotHistograms
Definition: DalitzPlot.hpp:112
The Kinematics interface defines the conversion of Events to a DataSet.
Definition: Kinematics.hpp:19
double integral()
GetIntegral.
Definition: DalitzPlot.hpp:71
std::map< std::string, TH1D > Hists1D
Definition: DalitzPlot.hpp:74
Interface template for a general Function of the form OutputType Function(InputTypes) The concept clo...
Definition: Function.hpp:24
std::unique_ptr< TTree > Tree
Definition: DalitzPlot.hpp:79