Pid Framework
Loading...
Searching...
No Matches
Fitter.h
Go to the documentation of this file.
1
8#ifndef PidFitter_H
9#define PidFitter_H 1
10
11#include <utility>
12#include <vector>
13
14#include "TH1.h"
15#include "TH2.h"
16#include "TString.h"
17
18#include "ParticleFit.h"
19
20namespace Pid {
21
22class Fitter {
23
24 public:
25 // Fitter( std::vector <ParticleFit> &&particles ) : particles_(particles) {};
26 Fitter() = default;
27 ;
28
29 void Fit();
30 TF1* ConstructFit1DFunction(double p);
31 double Fit1D(const std::shared_ptr<TH1>& h, std::vector<double>& par, std::vector<double>& par_err, double p);
32 void Clear();
33
34 void AddParticle(const ParticleFit& particle, uint id) {
35 particles_.push_back(particle);
36 particles_id_.push_back(id);
37 }
38 void SetHisto2D(std::shared_ptr<TH2> histo2D) { histo2D_ = std::move(histo2D); }
39 void SetRangeX(double min, double max) { minx_ = min, maxx_ = max; }
40 void SetRangeY(double min, double max) { miny_ = min, maxy_ = max; }
41 void SetOutputFileName(TString name) { outfilename_ = std::move(name); }
42
43 ParticleFit GetParticle(uint i) const { return particles_.at(i); };
44 ParticleFit GetParticleSpecie(uint i) const {
45 return particles_.at(std::find(particles_id_.begin(), particles_id_.end(), i) - particles_id_.begin());
46 };
47
48 void SetChi2Max(double chi2) { chi2_max_ = chi2; }
49
50 private:
51 std::vector<ParticleFit> particles_;
52 std::vector<uint> particles_id_;
53 std::shared_ptr<TH2> histo2D_{nullptr};
54
55 TString outfilename_{"out.root"};
56
57 double minx_{-1.};
58 double maxx_{-1.};
59
60 double miny_{-1.};
61 double maxy_{-1.};
62
63 double chi2_max_{100.};
64
65 // ClassDef(Fitter, 2);
66};
67
68}// namespace Pid
69#endif// PidFitter_H
Class to fit 2D histograms.
Definition Fitter.h:22
double Fit1D(const std::shared_ptr< TH1 > &h, std::vector< double > &par, std::vector< double > &par_err, double p)
Definition Fitter.cpp:71
void Clear()
Definition Fitter.cpp:155
TF1 * ConstructFit1DFunction(double p)
Definition Fitter.cpp:97
void Fit()
Definition Fitter.cpp:16
Class to store fit resuls for particle specie.
Definition ParticleFit.h:19