Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-04-05 08:12:17

0001 #ifndef GLOBALDEDXFITTER_H
0002 #define GLOBALDEDXFITTER_H
0003 
0004 #include "bethe_bloch.h"
0005 #include "TF1.h"
0006 #include "TF2.h"
0007 #include "TF3.h"
0008 #include "TChain.h"
0009 #include "TGraph.h"
0010 #include "Math/Minimizer.h"
0011 #include "Math/Functor.h"
0012 #include "Math/Factory.h"
0013 
0014 class GlobaldEdxFitter
0015 {
0016   public:
0017   explicit GlobaldEdxFitter(double xmin = 10., double xmax = 50.) 
0018   : min_norm(xmin), max_norm(xmax) 
0019   {};
0020   void processResidualData(const std::string& infile, 
0021                   size_t ntracks = 200000, 
0022                   size_t skip = 0);
0023   void addTrack(double trk_dEdx, double trk_p);
0024   size_t getNtracks()
0025   {
0026     return dEdx.size();
0027   }
0028 
0029   double get_fitquality(double norm, double ZS_loss = 0.);
0030   double get_fitquality_new(double A);
0031   TF1* create_TF1(const std::string& name);
0032   TF2* create_TF2(const std::string& name);
0033   TF3* create_TF3_new(const std::string& name);
0034   double get_minimum();
0035   double get_minimum_new();
0036   std::pair<double,double> get_minimum_ZS();
0037   void set_range(double xmin, double xmax, double ZSmin, double ZSmax) 
0038   {
0039     min_norm = xmin;
0040     max_norm = xmax;
0041     min_ZS = ZSmin;
0042     max_ZS = ZSmax;
0043   }
0044   void reset()
0045   {
0046     p.clear();
0047     dEdx.clear();
0048   }
0049   std::vector<double> get_betagamma(double A);
0050   TGraph* graph_vsbetagamma(double A);
0051   TGraph* graph_vsp();
0052   private:
0053   std::vector<double> p;
0054   std::vector<double> dEdx;
0055 
0056   double get_fitquality_functor(const double* x);
0057 
0058   double get_fitquality_wrapper(double* x, double* par);
0059   double get_fitquality_wrapper_ZS(double* x, double* par);
0060   double get_fitquality_wrapper_new(double* x, double* par);
0061   double min_norm = 10.;
0062   double max_norm = 50.;
0063   double min_ZS = 0.;
0064   double max_ZS = 200.;
0065   double min_B = 8.;
0066   double max_B = 12.;
0067 };
0068 
0069 #endif // GLOBALDEDXFITTER_H