Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
calib::EnergyLossVsDistance Class Reference

Integrate energy losses to calculate deposit near a track end. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-01/Calibration/func/EnergyLossVsDistance.h"

Classes

struct  x_pt
 

Public Member Functions

 EnergyLossVsDistance (IBetheBloch *bb, double localDensity, double bulkDensity)
 
double GetEnergyLoss (double dist) const
 
TGraph * GetEnergyLossGraph () const
 
TF1 * GetTF1 ()
 

Protected Member Functions

double Eval (double *xs, double *pars)
 

Protected Attributes

std::vector< x_ptfX_pts
 

Detailed Description

Integrate energy losses to calculate deposit near a track end.

Definition at line 20 of file EnergyLossVsDistance.h.

Constructor & Destructor Documentation

calib::EnergyLossVsDistance::EnergyLossVsDistance ( IBetheBloch bb,
double  localDensity,
double  bulkDensity 
)
Parameters
bbProvider of energy loss calculation
localDensityDensity of material energy is deposited in in g/cm^3
bulkDensityAverage density of material particle is travelling through in g^cm^3

Definition at line 18 of file EnergyLossVsDistance.cxx.

References calib::IBetheBloch::dEdx(), dx, fX_pts, T, and submit_syst::x.

21  {
22  // Start at slightly nonzero energy
23  double T = 2;
24  // up to 100m in 1mm increments
25  const double dx = .1;
26  for(double x = 0; x < 1e6; x += dx){
27  const double dEdx = bb->dEdx(T);
28 
29  fX_pts.push_back(x_pt(x, localDensity*dEdx));
30 
31  T += dEdx*dx*bulkDensity;
32  }
33  }
double dx[NP][NC]
double T
Definition: Xdiff_gwt.C:5

Member Function Documentation

double calib::EnergyLossVsDistance::Eval ( double *  xs,
double *  pars 
)
protected

Definition at line 70 of file EnergyLossVsDistance.cxx.

References GetEnergyLoss(), scale, and submit_syst::x.

Referenced by GetTF1().

71  {
72  const double x = xs[0];
73  const double scale = pars[0];
74 
75  return scale*GetEnergyLoss(x);
76  }
double GetEnergyLoss(double dist) const
Double_t scale
Definition: plot.C:25
std::string pars("Th23Dmsq32")
double calib::EnergyLossVsDistance::GetEnergyLoss ( double  dist) const
Parameters
distDistance from muon end point in cm
Returns
Mean energy loss in MeV/cm

Definition at line 40 of file EnergyLossVsDistance.cxx.

References fX_pts, calib::ltXPt(), submit_syst::x, x1, and y1.

Referenced by Eval(), and GetEnergyLossGraph().

41  {
42  typedef std::vector<x_pt>::const_iterator it_t;
43 
44  // Find the point after x
45  it_t itNext = std::lower_bound(fX_pts.begin(), fX_pts.end(), x, ltXPt);
46  if(itNext == fX_pts.end()) --itNext;
47  if(itNext == fX_pts.begin()) ++itNext;
48  // And the point before
49  it_t itPrev = itNext; --itPrev;
50 
51  // Interpolate
52  const double x0 = itPrev->x; const double y0 = itPrev->dEdx;
53  const double x1 = itNext->x; const double y1 = itNext->dEdx;
54  return ((x1-x)*y0+(x-x0)*y1)/(x1-x0);
55  }
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
bool ltXPt(EnergyLossVsDistance::x_pt pt, double x)
TGraph * calib::EnergyLossVsDistance::GetEnergyLossGraph ( ) const
Returns
Mean energy loss in MeV/cm vs distance to end (negative cm)

Definition at line 58 of file EnergyLossVsDistance.cxx.

References GetEnergyLoss(), runNovaSAM::ret, and submit_syst::x.

Referenced by calib::BetheBlochFit::endJob().

59  {
60  TGraph* ret = new TGraph;
61  // 1mm to 100m
62  for(double x = .1; x < 1e4; x *= 1.05){
63  ret->SetPoint(ret->GetN(), x, GetEnergyLoss(x));
64  }
65 
66  return ret;
67  }
double GetEnergyLoss(double dist) const
TF1 * calib::EnergyLossVsDistance::GetTF1 ( )
Returns
Function with one free scale parameter, the conversion from MeV/cm to whatever you're fitting

Definition at line 79 of file EnergyLossVsDistance.cxx.

References Eval(), and runNovaSAM::ret.

Referenced by calib::BetheBlochFit::endJob().

80  {
81  TF1* ret = new TF1("el", this, &EnergyLossVsDistance::Eval,
82  0, 500, 1);
83  ret->SetParName(0, "energy_scale");
84  ret->SetParameter(0, 1);
85  return ret;
86  }
double Eval(double *xs, double *pars)

Member Data Documentation

std::vector<x_pt> calib::EnergyLossVsDistance::fX_pts
protected

Definition at line 50 of file EnergyLossVsDistance.h.

Referenced by EnergyLossVsDistance(), and GetEnergyLoss().


The documentation for this class was generated from the following files: