Public Member Functions | Private Member Functions | Private Attributes | List of all members
bpfit::ScatteringSurfaces Class Reference

Construct scattering surfaces for Lutz. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-30/BreakPointFitter/func/ScatteringSurfaces.h"

Public Member Functions

 ScatteringSurfaces (int PDG, double dstol, double dxtol, double dttol)
 Construct tool for building scattering surfaces. More...
 
void MakeSurfaces (const geo::GeometryBase &geo, const double *p0, const double *p1, const std::vector< double > &s)
 Build scattering surfaces. More...
 
unsigned int N () const
 The number of scattering planes constructed. More...
 
double S (unsigned int i) const
 The location of the ith scattering plane. More...
 
double SigAlpha (unsigned int i) const
 The predicted RMS scattering angle at plane i. More...
 

Private Member Functions

void CheckLimits (double *beta, double *p)
 Round off near track end can cause the momentum to go to exactly zero or even a little negative. Protect against that. More...
 
void ForceOnePlane (const Path &path, const std::vector< double > &s)
 Make one scattering surface between first and last measurements. More...
 
bool GoodStep (double ds, double dx, double dt)
 Check the step data to see if its within tolerance. More...
 
void GetStepData (const Path &path, const std::vector< double > &s, unsigned int i1, unsigned int i2, double *ds, double *smid, double *dx, double *psi, double *dt)
 Get relevant data about one interval between measurements. More...
 
unsigned int MakeStep (const Path &path, const std::vector< double > &s, unsigned int i1)
 Make the largest step that is within tolerance. More...
 
void MakeSteps (const Path &path, const std::vector< double > &s)
 Find good locations for the scattering surfaces. More...
 

Private Attributes

unsigned int fPDG
 Assumed track PDG code. More...
 
double fdStol
 Largest allowed step (cm) More...
 
double fdXtol
 Largest allowed step (rad. len.) More...
 
double fdTtol
 Largest allowed RMS scatter (cm) More...
 
std::vector< double > fS
 Locations of scattering surfaces. More...
 
std::vector< double > fSigAlpha
 RMS scattering uncertainties. More...
 

Detailed Description

Construct scattering surfaces for Lutz.

Definition at line 14 of file ScatteringSurfaces.h.

Constructor & Destructor Documentation

ScatteringSurfaces::ScatteringSurfaces ( int  PDG,
double  dstol,
double  dxtol,
double  dttol 
)

Construct tool for building scattering surfaces.

Parameters
PDG- Assumed track particle ID (PDG code)
dstol- Largest step size allowed (cm)
dxtol- Largest step size allowed (radiation lengths)
dttol- Largest RMS scatter allowd (cm)

This class will attempt to place scattering surfaces between a set of measurement planes. The distance between scattering planes will be as large as possible subject to the tolerances above:

  • No two planes will be allowed to be more than dstol apart from each other in units of cm. Typical value dstol = 100 cm
  • No two planes will be allowed to be more than dxtol apart from each other in units of radiation lengths. Typical value dxtol = 2.0
  • The predicted RMS scatter between two planes will be kept within dttol. That is, the produce of the estimated RMS scattering angle of the particle times the step size must be smaller than dttol. Typical value dttol = 0.3 cm

The class will try to meet all the criteria above, but it will not insert more than one scattering plane between measurements.

The class will ensure that at least one scattering plane is inserted among the measurements.

Definition at line 13 of file ScatteringSurfaces.cxx.

16  :
17  fPDG(abs(PDG)),
18  fdStol(dstol),
19  fdXtol(dxtol),
20  fdTtol(dttol)
21 { }
double fdStol
Largest allowed step (cm)
void abs(TH1 *hist)
unsigned int fPDG
Assumed track PDG code.
double fdXtol
Largest allowed step (rad. len.)
double fdTtol
Largest allowed RMS scatter (cm)

Member Function Documentation

void ScatteringSurfaces::CheckLimits ( double *  beta,
double *  p 
)
private

Round off near track end can cause the momentum to go to exactly zero or even a little negative. Protect against that.

beta - Input beta value. Possibly modified on return p - Input momentum value. Possibly modified on return

Definition at line 83 of file ScatteringSurfaces.cxx.

References stan::math::fabs(), and bpfit::kBAD_P.

Referenced by GetStepData().

84 {
85  static const double betatol = 1.0E-6;
86  static const double ptol = 1.0E-5;
87  if (*p<=ptol) {
88  if (fabs(*p)<ptol) *p = ptol;
89  else
90  throw BPException(__FILE__, __LINE__, kBAD_P, *p);
91  }
92  if (*beta<betatol) {
93  if (fabs(*beta)<betatol) *beta = betatol;
94  else
95  throw BPException(__FILE__, __LINE__, kBAD_P, *beta);
96  }
97 }
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
const unsigned int kBAD_P
negative value for p
Definition: BPException.h:25
const char * p
Definition: xmltok.h:285
Double_t beta
void ScatteringSurfaces::ForceOnePlane ( const Path path,
const std::vector< double > &  s 
)
private

Make one scattering surface between first and last measurements.

Parameters
path- The track data
s- Measurement plane locations

Definition at line 47 of file ScatteringSurfaces.cxx.

References makeHTMLView::dt, dx, fS, fSigAlpha, GetStepData(), and push_back().

Referenced by MakeSurfaces().

49 {
50  unsigned int i1=0;
51  unsigned int i2=s.size()-1;
52  double ds, smid, dx, psi, dt;
53  this->GetStepData(path, s, i1, i2, &ds, &smid, &dx, &psi, &dt);
54  fS. push_back(smid);
55  fSigAlpha.push_back(psi);
56 }
const XML_Char * s
Definition: expat.h:262
void GetStepData(const Path &path, const std::vector< double > &s, unsigned int i1, unsigned int i2, double *ds, double *smid, double *dx, double *psi, double *dt)
Get relevant data about one interval between measurements.
double dx[NP][NC]
base_types push_back(int_type())
std::vector< double > fSigAlpha
RMS scattering uncertainties.
A very simple service to remember what detector we&#39;re working in.
std::vector< double > fS
Locations of scattering surfaces.
void ScatteringSurfaces::GetStepData ( const Path path,
const std::vector< double > &  s,
unsigned int  i1,
unsigned int  i2,
double *  ds,
double *  smid,
double *  dx,
double *  psi,
double *  dt 
)
private

Get relevant data about one interval between measurements.

Parameters
path- The track parameters
s- Locations of measurement planes (cm)
i1- step starts at s[i1]
i2- step ends at s[i2]
ds- on return, path length between i2 and i2 in cm
dx- on return, ds in units of radiation lengths
psi- RMS in-plane scattering angle (radians)
dt- RMS in-place scattering distance (cm)

Definition at line 112 of file ScatteringSurfaces.cxx.

References beta, CheckLimits(), om::cout, E, allTimeWatchdog::endl, fPDG, test_ParserArtEvents::log, bpfit::Path::MuonParams(), bpfit::Path::PionParams(), bpfit::Path::ProtonParams(), std::sqrt(), and bpfit::Path::X0().

Referenced by ForceOnePlane(), MakeStep(), and MakeSteps().

121 {
122  static const double psi0 = 13.6E-3;
123  double s1 = s[i1];
124  double s2 = s[i2];
125 
126  *smid = 0.5*(s1+s2);
127 
128  double beta=0;
129  double p =0;
130  if (fPDG==13) path.MuonParams (*smid, 0, &p, &beta, 0);
131  else if (fPDG==211) path.PionParams (*smid, 0, &p, &beta, 0);
132  else if (fPDG==2212) path.ProtonParams(*smid, 0, &p, &beta, 0);
133  else {
134  std::cout << "\n\n\nERROR: BreakPointFitter is unable to fit under the assumption PDG = "
135  << fPDG
136  << ". Aborting...\n\n\n";
137  abort();
138  }
139  this->CheckLimits(&beta, &p);
140 
141  *ds = s2-s1;
142  *dx = path.X0(s2)-path.X0(s1);
143 
144  if (*dx>1.0E-6) *psi = (psi0/beta/p)*sqrt(*dx)*(1.0+0.038*log(*dx));
145  else{
146  *psi = 1.0E-6;
147  }
148  *dt = (*psi)*(*ds);
149 
150  if(*psi < 0.0){
151  std::cout<<"\n beta: "<<beta
152  <<"\n p: "<<p
153  <<"\n dx: "<<*dx
154  <<std::endl;
155  }
156 
157 }
double X0(double s) const
Return the number of radiation lengths crossed by the path.
Definition: Path.cxx:112
const char * p
Definition: xmltok.h:285
T sqrt(T number)
Definition: d0nt_math.hpp:156
void ProtonParams(double s, double *T=0, double *p=0, double *beta=0, double *gamma=0) const
Definition: Path.cxx:462
Double_t beta
const XML_Char * s
Definition: expat.h:262
Definition: Cand.cxx:23
double dx[NP][NC]
void CheckLimits(double *beta, double *p)
Round off near track end can cause the momentum to go to exactly zero or even a little negative...
void PionParams(double s, double *T=0, double *p=0, double *beta=0, double *gamma=0) const
Definition: Path.cxx:449
Float_t E
Definition: plot.C:20
A very simple service to remember what detector we&#39;re working in.
void MuonParams(double s, double *T=0, double *p=0, double *beta=0, double *gamma=0) const
Return the estimated muon parameters at path length s.
Definition: Path.cxx:436
OStream cout
Definition: OStream.cxx:6
unsigned int fPDG
Assumed track PDG code.
bool ScatteringSurfaces::GoodStep ( double  ds,
double  dx,
double  dt 
)
private

Check the step data to see if its within tolerance.

Parameters
ds- step size in cm
dx- step size in radiation lengths
dt- RMS transverse scattering distance in cm
Returns
true=good step, false=step out of tolerance.

Definition at line 67 of file ScatteringSurfaces.cxx.

References fdStol, fdTtol, and fdXtol.

Referenced by MakeStep().

68 {
69  if (ds>fdStol) return false;
70  if (dx>fdXtol) return false;
71  if (dt>fdTtol) return false;
72  return true;
73 }
double fdStol
Largest allowed step (cm)
Definition: Cand.cxx:23
double dx[NP][NC]
A very simple service to remember what detector we&#39;re working in.
double fdXtol
Largest allowed step (rad. len.)
double fdTtol
Largest allowed RMS scatter (cm)
unsigned int ScatteringSurfaces::MakeStep ( const Path path,
const std::vector< double > &  s,
unsigned int  i1 
)
private

Make the largest step that is within tolerance.

Parameters
path- Track parameters
s- Measurement plane locations
i1- step starts at s[i1]
Returns
i2 - end point of step if s[i2]

Definition at line 168 of file ScatteringSurfaces.cxx.

References makeHTMLView::dt, dx, GetStepData(), and GoodStep().

Referenced by MakeSteps().

171 {
172  unsigned int i2; // Index of end of step
173  double ds; // Step size in cm
174  double smid; // Midpoint of step
175  double psi; // RMS in-plane scattering angle
176  double dx; // Step size in radiation lengths
177  double dt; // Predicted RMS transverse scatter for step
178  //
179  // Increase i2 until the step data goes out of tolerance
180  //
181  for (i2=i1+1;i2+1<s.size();++i2) {
182  this->GetStepData(path, s, i1, i2, &ds, &smid, &dx, &psi, &dt);
183  if (this->GoodStep(ds, dx, dt)==false) {
184  //
185  // Last step took us out of tolerance, back up if we can
186  //
187  if (i2-i1>1) --i2;
188  break;
189  }
190  }
191  return i2;
192 }
bool GoodStep(double ds, double dx, double dt)
Check the step data to see if its within tolerance.
const XML_Char * s
Definition: expat.h:262
void GetStepData(const Path &path, const std::vector< double > &s, unsigned int i1, unsigned int i2, double *ds, double *smid, double *dx, double *psi, double *dt)
Get relevant data about one interval between measurements.
double dx[NP][NC]
A very simple service to remember what detector we&#39;re working in.
void ScatteringSurfaces::MakeSteps ( const Path path,
const std::vector< double > &  s 
)
private

Find good locations for the scattering surfaces.

Parameters
path- Track parameters
s- Measurement plane locations (cm)

Definition at line 201 of file ScatteringSurfaces.cxx.

References makeHTMLView::dt, dx, fS, fSigAlpha, GetStepData(), MakeStep(), and push_back().

Referenced by MakeSurfaces().

203 {
204  unsigned int i1;
205  unsigned int i2;
206  double ds; // Step size in cm
207  double smid; // Path length at middle of step
208  double dx; // Step size in radiation lengths
209  double psi; // RMS in-plane scattering angle
210  double dt; // RMS transvers scattering at end of step in cm
211  for (i1=0;(i1+1)<s.size();i1=i2) {
212  i2 = this->MakeStep(path, s, i1);
213  this->GetStepData(path, s, i1, i2, &ds, &smid, &dx, &psi, &dt);
214  if(ds==0) continue;
215 
216  fS. push_back(smid);
217  fSigAlpha.push_back(psi);
218 
219  }
220 }
unsigned int MakeStep(const Path &path, const std::vector< double > &s, unsigned int i1)
Make the largest step that is within tolerance.
const XML_Char * s
Definition: expat.h:262
void GetStepData(const Path &path, const std::vector< double > &s, unsigned int i1, unsigned int i2, double *ds, double *smid, double *dx, double *psi, double *dt)
Get relevant data about one interval between measurements.
double dx[NP][NC]
base_types push_back(int_type())
std::vector< double > fSigAlpha
RMS scattering uncertainties.
A very simple service to remember what detector we&#39;re working in.
std::vector< double > fS
Locations of scattering surfaces.
void ScatteringSurfaces::MakeSurfaces ( const geo::GeometryBase geo,
const double *  p0,
const double *  p1,
const std::vector< double > &  s 
)

Build scattering surfaces.

Parameters
geo- Detector geometry
p0- Track start point (x/y/z cm)
p1- Track end point (x/y/z cm)
s- list of measurement plane locations

All of the measurement planes s are candidates for locations of scattering surfaces. In the interests of optimization, some surfaces will be dropped if the expected scattering is rather small.

Definition at line 25 of file ScatteringSurfaces.cxx.

References clear, ForceOnePlane(), fS, fSigAlpha, MakeSteps(), and path.

Referenced by bpfit::BreakPoint::FitTracks(), and bpfit::DimuonFitter::FitView().

29 {
30  fS. clear();
31  fSigAlpha.clear();
32 
33  Path path(geo, p0, p1, s[0]);
34  this->MakeSteps(path, s);
35 
36  if (fS.size()==0) this->ForceOnePlane(path, s);
37 }
void MakeSteps(const Path &path, const std::vector< double > &s)
Find good locations for the scattering surfaces.
vector< vector< double > > clear
const XML_Char * s
Definition: expat.h:262
Track parameters (s, X0, KE, beta, ...) along a particular path in the detector.
Definition: Path.h:18
std::vector< double > fSigAlpha
RMS scattering uncertainties.
const std::string path
Definition: plot_BEN.C:43
std::vector< double > fS
Locations of scattering surfaces.
void ForceOnePlane(const Path &path, const std::vector< double > &s)
Make one scattering surface between first and last measurements.
unsigned int ScatteringSurfaces::N ( ) const

The number of scattering planes constructed.

Definition at line 224 of file ScatteringSurfaces.cxx.

References fS.

Referenced by bpfit::BreakPoint::DebugScatSurf(), bpfit::BreakPoint::FitTracks(), bpfit::DimuonFitter::FitView(), and bpfit::BreakPoint::LogResiduals().

224 { return fS.size(); }
std::vector< double > fS
Locations of scattering surfaces.
double ScatteringSurfaces::S ( unsigned int  i) const

The location of the ith scattering plane.

Definition at line 228 of file ScatteringSurfaces.cxx.

References fS, and MECModelEnuComparisons::i.

Referenced by bpfit::BreakPoint::DebugScatSurf(), bpfit::BreakPoint::FitTracks(), bpfit::DimuonFitter::FitView(), and bpfit::BreakPoint::LogResiduals().

228 { return fS[i]; }
std::vector< double > fS
Locations of scattering surfaces.
double ScatteringSurfaces::SigAlpha ( unsigned int  i) const

The predicted RMS scattering angle at plane i.

Definition at line 232 of file ScatteringSurfaces.cxx.

References fSigAlpha, and MECModelEnuComparisons::i.

Referenced by bpfit::BreakPoint::DebugScatSurf(), bpfit::BreakPoint::FitTracks(), bpfit::DimuonFitter::FitView(), and bpfit::BreakPoint::LogResiduals().

233 {
234  return fSigAlpha[i];
235 }
std::vector< double > fSigAlpha
RMS scattering uncertainties.

Member Data Documentation

double bpfit::ScatteringSurfaces::fdStol
private

Largest allowed step (cm)

Definition at line 105 of file ScatteringSurfaces.h.

Referenced by GoodStep().

double bpfit::ScatteringSurfaces::fdTtol
private

Largest allowed RMS scatter (cm)

Definition at line 107 of file ScatteringSurfaces.h.

Referenced by GoodStep().

double bpfit::ScatteringSurfaces::fdXtol
private

Largest allowed step (rad. len.)

Definition at line 106 of file ScatteringSurfaces.h.

Referenced by GoodStep().

unsigned int bpfit::ScatteringSurfaces::fPDG
private

Assumed track PDG code.

Definition at line 104 of file ScatteringSurfaces.h.

Referenced by GetStepData().

std::vector<double> bpfit::ScatteringSurfaces::fS
private

Locations of scattering surfaces.

Definition at line 108 of file ScatteringSurfaces.h.

Referenced by ForceOnePlane(), MakeSteps(), MakeSurfaces(), N(), and S().

std::vector<double> bpfit::ScatteringSurfaces::fSigAlpha
private

RMS scattering uncertainties.

Definition at line 109 of file ScatteringSurfaces.h.

Referenced by ForceOnePlane(), MakeSteps(), MakeSurfaces(), and SigAlpha().


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