PandaRoot
GFMaterialEffects.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 /* Copyright 2008-2009, Technische Universitaet Muenchen,
14  Authors: Christian Hoeppner & Sebastian Neubert
15 
16  This file is part of GENFIT.
17 
18  GENFIT is free software: you can redistribute it and/or modify
19  it under the terms of the GNU Lesser General Public License as published
20  by the Free Software Foundation, either version 3 of the License, or
21  (at your option) any later version.
22 
23  GENFIT is distributed in the hope that it will be useful,
24  but WITHOUT ANY WARRANTY; without even the implied warranty of
25  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  GNU Lesser General Public License for more details.
27 
28  You should have received a copy of the GNU Lesser General Public License
29  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
30 */
31 
36 #ifndef GFMATERIALEFFECTS_H
37 #define GFMATERIALEFFECTS_H
38 
39 #include <iostream>
40 #include "TObject.h"
41 #include <vector>
42 #include "TVector3.h"
43 #include "TMatrixT.h"
44 
59 class GFMaterialEffects : public TObject {
60  private:
62  virtual ~GFMaterialEffects();
63 
64  static GFMaterialEffects *finstance;
65 
66  public:
68  static void destruct();
69 
70  void setEnergyLossBetheBloch(bool opt = true) { fEnergyLossBetheBloch = opt; }
71  void setNoiseBetheBloch(bool opt = true) { fNoiseBetheBloch = opt; }
72  void setNoiseCoulomb(bool opt = true) { fNoiseCoulomb = opt; }
73  void setEnergyLossBrems(bool opt = true) { fEnergyLossBrems = opt; }
74  void setNoiseBrems(bool opt = true) { fNoiseBrems = opt; }
75 
77  double effects(const std::vector<TVector3> &points, const std::vector<double> &pointPaths, const double &mom, const int &pdg, const bool &doNoise = false,
78  TMatrixT<double> *noise = nullptr, const TMatrixT<double> *jacobian = nullptr, const TVector3 *directionBefore = nullptr,
79  const TVector3 *directionAfter = nullptr);
80 
82 
84  double stepper(const double &maxDist, const double &posx, const double &posy, const double &posz, const double &dirx, const double &diry, const double &dirz, const double &mom,
85  const int &pdg);
86 
87  double stepper(const double &maxDist, const TVector3 &pos, const TVector3 &dir, const double &mom, const int &pdg)
88  {
89  return stepper(maxDist, pos.X(), pos.Y(), pos.Z(), dir.X(), dir.Y(), dir.Z(), mom, pdg);
90  }
91 
92  private:
94  void getParameters();
95 
97  void calcBeta(double mom);
98 
100 
105  double energyLossBetheBloch(const double &mom);
106 
108 
116  void noiseBetheBloch(const double &mom, TMatrixT<double> *noise) const;
117 
119 
308  void noiseCoulomb(const double &mom, TMatrixT<double> *noise, const TMatrixT<double> *jacobian, const TVector3 *directionBefore, const TVector3 *directionAfter) const;
309 
311 
315  double energyLossBrems(const double &mom) const;
316 
318 
321  void noiseBrems(const double &mom, TMatrixT<double> *noise) const;
322 
323  bool fEnergyLossBetheBloch;
324  bool fNoiseBetheBloch;
325  bool fNoiseCoulomb;
326  bool fEnergyLossBrems;
327  bool fNoiseBrems;
328 
329  const double me; // electron mass (GeV)
330 
331  double fstep; // stepsize
332 
333  // cached values for energy loss and noise calculations
334  double fbeta;
335  double fdedx;
336  double fgamma;
337  double fgammaSquare;
338 
339  double fmatDensity;
340  double fmatZ;
341  double fmatA;
342  double fradiationLength;
343  double fmEE; // mean excitation energy
344 
345  int fpdg;
346  double fcharge;
347  double fmass;
348 
349  public:
350  ClassDef(GFMaterialEffects, 1)
351 };
352 
353 #endif
354 
void setNoiseBrems(bool opt=true)
static void destruct()
Contains stepper and energy loss/noise matrix calculation.
void setNoiseCoulomb(bool opt=true)
void setEnergyLossBrems(bool opt=true)
static GFMaterialEffects * getInstance()
void setEnergyLossBetheBloch(bool opt=true)
void setNoiseBetheBloch(bool opt=true)
double stepper(const double &maxDist, const double &posx, const double &posy, const double &posz, const double &dirx, const double &diry, const double &dirz, const double &mom, const int &pdg)
Returns maximum length so that a specified momentum loss will not be exceeded.
double stepper(const double &maxDist, const TVector3 &pos, const TVector3 &dir, const double &mom, const int &pdg)
double effects(const std::vector< TVector3 > &points, const std::vector< double > &pointPaths, const double &mom, const int &pdg, const bool &doNoise=false, TMatrixT< double > *noise=nullptr, const TMatrixT< double > *jacobian=nullptr, const TVector3 *directionBefore=nullptr, const TVector3 *directionAfter=nullptr)
Calculates energy loss in the travelled path, optional calculation of noise matrix.