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

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

Inheritance diagram for calib::BetheBlochTables:
calib::IBetheBloch

Classes

struct  T_pt
 

Public Member Functions

 BetheBlochTables (Material mat)
 
virtual double dEdx (double T) const
 
virtual double MIP () const
 
virtual double MPV (double T, double dist, double localDensity) const
 
TGraph * GetdEdxGraph (double localDensity) const
 
TGraph * GetMPVGraph (double localDensity, double dist) const
 

Protected Attributes

std::vector< T_ptfT_pts
 

Detailed Description

Definition at line 49 of file BetheBloch.h.

Constructor & Destructor Documentation

calib::BetheBlochTables::BetheBlochTables ( Material  mat)

Definition at line 59 of file BetheBloch.cxx.

References ana::assert(), calib::IBetheBloch::dEdx(), MakeMiniprodValidationCuts::f, fclose(), cet::search_path::find_file(), plot_validation_datamc::fname, calib::kPolyethylene, runNovaSAM::ret, string, and T.

60  {
61  char junkStr[1024];
62  double junk;
63 
64  // Load the points from the file
66  cet::search_path sp("FW_SEARCH_PATH");
67  switch(mat){
68  case kPolyethylene:
69  // http://pdg.lbl.gov/2010/AtomicNuclearProperties/MUON_ELOSS_TABLES/muonloss_221.dat
70  sp.find_file("Calibration/func/muonloss_221.dat", fname);
71  break;
72  default:
73  assert(0 && "Unknown material");
74  }
75  FILE* f = fopen(fname.c_str(), "r");
76  assert(f);
77 
78  while(!feof(f)){
79  double T, dEdx;
80  int ret = fscanf(f, "%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf",
81  &T, &junk, &junk, &junk, &junk, &junk, &junk,
82  &dEdx, &junk, &junk, &junk);
83  if(ret == 11){
84  fT_pts.push_back(T_pt(T, dEdx));
85  }
86  else{
87  // We couldn't parse it properly. Either preamble or a special line.
88  fgets(junkStr, 1024, f);
89  }
90  }
91  fclose(f);
92  }
virtual double dEdx(double T) const
Definition: BetheBloch.cxx:99
fclose(fg1)
std::vector< T_pt > fT_pts
Definition: BetheBloch.h:63
assert(nhit_max >=nhit_nbins)
double T
Definition: Xdiff_gwt.C:5
Eigen::MatrixXd mat
enum BeamMode string

Member Function Documentation

double calib::BetheBlochTables::dEdx ( double  T) const
virtual
Parameters
TKinetic energy in MeV
Returns
Mean energy loss in MeV/g cm^2

Implements calib::IBetheBloch.

Definition at line 99 of file BetheBloch.cxx.

References calib::ltTPt(), T, T0, and y1.

100  {
101  typedef std::vector<T_pt>::const_iterator it_t;
102 
103  // Find the point after T
104  it_t itNext = std::lower_bound(fT_pts.begin(), fT_pts.end(), T, ltTPt);
105  if(itNext == fT_pts.end()) --itNext;
106  if(itNext == fT_pts.begin()) ++itNext;
107  // And the point before
108  it_t itPrev = itNext; --itPrev;
109 
110  // Interpolate
111  const double T0 = itPrev->T; const double y0 = itPrev->dEdx;
112  const double T1 = itNext->T; const double y1 = itNext->dEdx;
113  return ((T1-T)*y0+(T-T0)*y1)/(T1-T0);
114  }
Float_t y1[n_points_granero]
Definition: compare.C:5
const double T0
bool ltTPt(BetheBlochTables::T_pt pt, double T)
Definition: BetheBloch.cxx:94
std::vector< T_pt > fT_pts
Definition: BetheBloch.h:63
double T
Definition: Xdiff_gwt.C:5
TGraph * calib::IBetheBloch::GetdEdxGraph ( double  localDensity) const
inherited
Parameters
locaDensityDensity of material in g/cm^3
Returns
Mean dE/dx in MeV/cm vs. kinetic energy in MeV

Definition at line 33 of file BetheBloch.cxx.

References calib::IBetheBloch::dEdx(), runNovaSAM::ret, and T.

Referenced by calib::BetheBlochFit::endJob(), and calib::IBetheBloch::MPV().

34  {
35  TGraph* ret = new TGraph;
36  // 1MeV to 100GeV
37  for(double T = 1; T < 1e5; T *= 1.05){
38  ret->SetPoint(ret->GetN(), T, dEdx(T)*localDensity);
39  }
40 
41  return ret;
42  }
virtual double dEdx(double T) const =0
double T
Definition: Xdiff_gwt.C:5
TGraph * calib::IBetheBloch::GetMPVGraph ( double  localDensity,
double  dist 
) const
inherited
Parameters
localDensityDensity of material in g/cm^3
distThickness of each layer in cm
Returns
Most probable dE/dx in MeV/cm vs. KE in MeV

Definition at line 45 of file BetheBloch.cxx.

References dist, calib::IBetheBloch::MPV(), runNovaSAM::ret, and T.

Referenced by calib::BetheBlochFit::endJob(), and calib::IBetheBloch::MPV().

46  {
47  TGraph* ret = new TGraph;
48  // 1MeV to 100GeV
49  for(double T = 1; T < 1e5; T *= 1.05){
50  ret->SetPoint(ret->GetN(), T,
51  MPV(T, dist, localDensity)*localDensity/dist);
52  }
53 
54  return ret;
55  }
virtual double MPV(double T, double dist, double localDensity) const
Definition: BetheBloch.h:31
double dist
Definition: runWimpSim.h:113
double T
Definition: Xdiff_gwt.C:5
double calib::BetheBlochTables::MIP ( ) const
virtual
Returns
Mean energy loss of mininum ionizing particle in MeV/g cm^2

Implements calib::IBetheBloch.

Definition at line 117 of file BetheBloch.cxx.

References calib::IBetheBloch::dEdx(), and getGoodRuns4SAM::n.

118  {
119  double mip = 1e10;
120  for(unsigned int n = 0; n < fT_pts.size(); ++n){
121  if(fT_pts[n].dEdx < mip) mip = fT_pts[n].dEdx;
122  }
123  return mip;
124  }
virtual double dEdx(double T) const
Definition: BetheBloch.cxx:99
std::vector< T_pt > fT_pts
Definition: BetheBloch.h:63
virtual double calib::IBetheBloch::MPV ( double  T,
double  dist,
double  localDensity 
) const
inlinevirtualinherited
Parameters
TKinetic energy in MeV
distThickness of the layer in cm
localDensityDensity of the layer in g/cm^3
Returns
Most probable energy loss in MeV/g cm^3

Reimplemented in calib::BetheBlochAnalytic.

Definition at line 31 of file BetheBloch.h.

References dist, calib::IBetheBloch::GetdEdxGraph(), calib::IBetheBloch::GetMPVGraph(), and calib::IBetheBloch::MIP().

Referenced by calib::IBetheBloch::GetMPVGraph().

32  {
33  return 0;
34  }

Member Data Documentation

std::vector<T_pt> calib::BetheBlochTables::fT_pts
protected

Definition at line 63 of file BetheBloch.h.


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