17 #include "Math/ProbFuncMathCore.h" 28 void phspContour(
unsigned int SysX,
unsigned int SysY,
unsigned int n,
29 double *CoordX,
double *CoordY) {
34 LOG(INFO) <<
"DalitzKinematics::phspContour() | " 35 "Setting size to a even number. Assure that the size of " 37 << num * 2 + 1 <<
"!";
44 : Name(Name), Kinematics(Kinematics), Bins(Bins), GlobalScale(1.0) {
47 gStyle->SetOptStat(10);
48 gStyle->SetOptTitle(0);
49 gStyle->SetLineWidth(3);
50 gStyle->SetMarkerStyle(20);
54 const std::string &
Name,
const std::string &Title,
62 Histogram.
fill(DataSet);
71 bool Normalize,
const std::string &
Name,
72 const std::string &Title, Color_t Color) {
77 Histogram.
fill(DataSet, Intensities);
90 double PointsX[4001], PointsY[4001];
92 TGraph ContourM23M13(4001, PointsX, PointsY);
93 ContourM23M13.SetMarkerStyle(1);
94 ContourM23M13.SetLineColor(kRed);
95 ContourM23M13.SetMarkerColor(kRed);
96 ContourM23M13.SetMarkerSize(0.0);
97 ContourM23M13.SetTitle(
"phspContour");
98 ContourM23M13.SetFillColor(kWhite);
100 TGraph ContourM23M12(4001, PointsX, PointsY);
101 ContourM23M12.SetMarkerStyle(1);
102 ContourM23M12.SetLineColor(kRed);
103 ContourM23M12.SetMarkerColor(kRed);
104 ContourM23M12.SetMarkerSize(0.0);
105 ContourM23M12.SetTitle(
"phspContour");
106 ContourM23M12.SetFillColor(kWhite);
108 TGraph ContourM12M13(4001, PointsX, PointsY);
109 ContourM12M13.SetMarkerStyle(1);
110 ContourM12M13.SetLineColor(kRed);
111 ContourM12M13.SetMarkerColor(kRed);
112 ContourM12M13.SetMarkerSize(0.0);
113 ContourM12M13.SetTitle(
"phspContour");
114 ContourM12M13.SetFillColor(kWhite);
117 TCanvas *Canvas =
new TCanvas(
"invmass",
"invmass", 50, 50, 2400, 800);
118 Canvas->Divide(3, 1);
127 TFile *File =
new TFile(
Name +
".root",
"recreate");
128 if (File->IsZombie()) {
129 std::cout <<
"Error opening output file" << std::endl;
132 ContourM12M13.Write(
"m12m13_contour", TObject::kOverwrite, 0);
133 ContourM23M12.Write(
"m23m12_contour", TObject::kOverwrite, 0);
134 ContourM23M13.Write(
"m23m13_contour", TObject::kOverwrite, 0);
135 Canvas->Write(
"invmass", TObject::kOverwrite, 0);
140 for (
auto &Plot : PlotHistograms)
144 Canvas->Print(
Name +
"-invmass.pdf");
153 std::vector<TH1D *> Histograms;
154 std::vector<TString> Options;
156 Options.push_back(
"E1");
159 Options.push_back(
"Sames,Hist");
167 std::string Title,
unsigned int Bins, Color_t Color)
168 : Name(Name), Title(Title), NumBins(Bins), Integral(0.0) {
171 Tree = std::unique_ptr<TTree>(
new TTree(TString(Name), TString(Title)));
183 double m23sq_min = m23sq_limit.first;
184 double m23sq_max = m23sq_limit.second;
185 TH1D hist = TH1D(TString(Name +
"m23sq"), TString(Title),
NumBins, m23sq_min,
187 double binWidth = (double)(m23sq_min - m23sq_max) /
NumBins;
188 sprintf(label,
"Entries /%f.3", binWidth);
189 hist.GetYaxis()->SetTitle(
"# [" + TString(label) +
"]");
190 hist.GetXaxis()->SetTitle(
"m_{23}^{2} [GeV/c^{2}]");
192 Hists1D.insert(std::make_pair(std::get<0>(sys23), hist));
197 double m13sq_min = m13sq_limit.first;
198 double m13sq_max = m13sq_limit.second;
199 hist = TH1D(TString(Name +
"m13sq"), TString(Title),
NumBins, m13sq_min,
201 binWidth = (double)(m13sq_min - m13sq_max) /
NumBins;
202 sprintf(label,
"Entries /%f.3", binWidth);
203 hist.GetYaxis()->SetTitle(
"# [" + TString(label) +
"]");
204 hist.GetXaxis()->SetTitle(
"m_{13}^{2} [GeV/c^{2}]");
206 Hists1D.insert(std::make_pair(std::get<0>(sys13), hist));
211 double m12sq_min = m12sq_limit.first;
212 double m12sq_max = m12sq_limit.second;
213 hist = TH1D(TString(Name +
"m12sq"), TString(Title),
NumBins, m12sq_min,
215 binWidth = (double)(m12sq_min - m12sq_max) /
NumBins;
216 sprintf(label,
"Entries /%f.3", binWidth);
217 hist.GetYaxis()->SetTitle(
"# [" + TString(label) +
"]");
218 hist.GetXaxis()->SetTitle(
"m_{12}^{2} [GeV/c^{2}]");
220 Hists1D.insert(std::make_pair(std::get<0>(sys12), hist));
222 TH2D hist2d = TH2D(TString(Name +
"_m23sqm13sq"), TString(Title),
NumBins,
223 m23sq_min, m23sq_max,
NumBins, m13sq_min, m13sq_max);
224 hist2d.GetXaxis()->SetTitle(
"m_{KK}^{2} [GeV^{2}/c^{4}]");
225 hist2d.GetYaxis()->SetTitle(
"m_{K_{S}K^{+}}^{2} [GeV^{2}/c^{4}]");
227 std::make_pair(std::get<0>(sys23), std::get<0>(sys13)), hist2d));
229 hist2d = TH2D(TString(Name +
"_m23sqm12sq"), TString(Title),
NumBins,
230 m23sq_min, m23sq_max,
NumBins, m12sq_min, m12sq_max);
231 hist2d.GetXaxis()->SetTitle(
"m_{KK}^{2} [GeV^{2}/c^{4}");
232 hist2d.GetYaxis()->SetTitle(
"m_{K_{S}K^{-}}^{2} [GeV^{2}/c^{4}]");
234 std::make_pair(std::get<0>(sys23), std::get<0>(sys12)), hist2d));
236 hist2d = TH2D(TString(Name +
"_m12sqm13sq"), TString(Title),
NumBins,
237 m12sq_min, m12sq_max,
NumBins, m13sq_min, m13sq_max);
238 hist2d.GetXaxis()->SetTitle(
"m_{K_{S}K^{-}}^{2} [GeV^{2}/c^{4}]");
239 hist2d.GetYaxis()->SetTitle(
"m_{K_{S}K^{+}}^{2} [GeV^{2}/c^{4}]");
241 std::make_pair(std::get<0>(sys12), std::get<0>(sys13)), hist2d));
243 hist2d = TH2D(TString(Name +
"_m23sqCosTheta"), TString(Title),
NumBins,
244 m23sq_min, m23sq_max,
NumBins, -1, 1);
245 hist2d.GetXaxis()->SetTitle(
"m_{KK}^{2} [GeV^{2}/c^{4}]");
246 hist2d.GetYaxis()->SetTitle(
"#cos(#Theta)_{KK}");
248 std::make_pair(std::get<0>(sys12), std::get<0>(sys12)), hist2d));
251 x.second.GetXaxis()->SetNdivisions(508);
252 x.second.GetZaxis()->SetTitle(
"Entries");
260 std::vector<double> Intensities) {
261 if (Intensities.size() == 0) {
262 Intensities = std::vector<double>(sample.
Weights.size(), 1.0);
264 if (!sample.
Data.size())
265 throw std::runtime_error(
"DalitzHist::fill() | Empty data sample.");
266 if (Intensities.size() != sample.
Weights.size())
267 throw std::runtime_error(
"DalitzHist::fill() | Vector of weights and " 268 "sample do not have the same length");
271 std::accumulate(sample.
Weights.begin(), sample.
Weights.end(), 0.0);
275 std::vector<double> weights;
276 for (
size_t i = 0; i < Intensities.size(); ++i) {
277 weights.push_back(sample.
Weights[i] * Intensities[i]);
281 auto const &data = sample.
Data.at(h1.first);
282 for (
size_t i = 0; i < data.size(); ++i) {
283 h1.second.Fill(data[i], weights[i]);
288 auto const &data1 = sample.
Data.at(h2.first.first);
289 auto const &data2 = sample.
Data.at(h2.first.second);
290 for (
size_t i = 0; i < data1.size(); ++i) {
291 h2.second.Fill(data1[i], data2[i], weights[i]);
295 auto const &m23sq = sample.
Data.at(
"mSq_(1,2)");
296 auto const &m13sq = sample.
Data.at(
"mSq_(0,2)");
297 auto const &m12sq = sample.
Data.at(
"mSq_(0,1)");
298 for (
size_t i = 0; i < weights.size(); ++i) {
308 x.second.SetStats(b);
311 x.second.SetStats(b);
326 x.second.SetLineColor(color);
327 x.second.SetMarkerColor(color);
338 Tree->Write(TString(
Name) +
"Tree");
339 gDirectory->mkdir(TString(
Name) +
"_hist");
340 gDirectory->cd(TString(
Name) +
"_hist");
341 for (
auto const &x :
Hists1D) {
344 for (
auto const &x :
Hists2D) {
347 gDirectory->cd(
"../");
virtual ComPWA::Data::DataSet convert(const EventCollection &Events) const =0
cmplx FADDEEVA() w(cmplx z, double relerr)
std::vector< double > Weights
virtual OutputType evaluate(const InputTypes &... args) noexcept=0
The Kinematics interface defines the conversion of Events to a DataSet.
Interface template for a general Function of the form OutputType Function(InputTypes) The concept clo...