PandaRoot
MaterialEffects.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-2014, Technische Universitaet Muenchen,
14  Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
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 genfit_MaterialEffects_h
37 #define genfit_MaterialEffects_h
38 
39 #include "RKTools.h"
40 #include "AbsMaterialInterface.h"
41 
42 #include <iostream>
43 #include <vector>
44 
45 #include <TObject.h>
46 #include <TVector3.h>
47 
48 namespace genfit {
49 
62 class MaterialEffects : public TObject {
63 
64  private:
66  virtual ~MaterialEffects();
67 
68  static MaterialEffects *instance_;
69 
70  public:
71  static MaterialEffects *getInstance();
72  static void destruct();
73 
75  void init(AbsMaterialInterface *matIfc);
76  bool isInitialized() { return materialInterface_ != nullptr; }
77 
78  void setNoEffects(bool opt = true) { noEffects_ = opt; }
79 
80  void setEnergyLossBetheBloch(bool opt = true)
81  {
82  energyLossBetheBloch_ = opt;
83  noEffects_ = false;
84  }
85  void setNoiseBetheBloch(bool opt = true)
86  {
87  noiseBetheBloch_ = opt;
88  noEffects_ = false;
89  }
90  void setNoiseCoulomb(bool opt = true)
91  {
92  noiseCoulomb_ = opt;
93  noEffects_ = false;
94  }
95  void setEnergyLossBrems(bool opt = true)
96  {
97  energyLossBrems_ = opt;
98  noEffects_ = false;
99  }
100  void setNoiseBrems(bool opt = true)
101  {
102  noiseBrems_ = opt;
103  noEffects_ = false;
104  }
105  void ignoreBoundariesBetweenEqualMaterials(bool opt = true) { ignoreBoundariesBetweenEqualMaterials_ = opt; }
106 
112  void setMscModel(const std::string &modelName);
113 
115  double effects(const std::vector<RKStep> &steps, int materialsFXStart, int materialsFXStop, const double &mom, const int &pdg, M7x7 *noise = nullptr);
116 
122  void stepper(const RKTrackRep *rep, M1x7 &state7,
123  const double &mom, // momentum
124  double &relMomLoss, // relative momloss for the step will be added
125  const int &pdg, MaterialProperties &currentMaterial, StepLimits &limits, bool varField = true);
126 
127  void setDebugLvl(unsigned int lvl = 1);
128 
129  void drawdEdx(int pdg = 11);
130 
131  private:
133  void getParticleParameters();
134 
135  void getMomGammaBeta(double Energy, double &mom, double &gammaSquare, double &gamma, double &betaSquare) const;
136 
138 
141  double momentumLoss(double stepSign, double mom, bool linear);
142 
144  double dEdx(double Energy) const;
145 
147  double dEdxBetheBloch(double betaSquare, double gamma, double gammasquare) const;
148 
150 
158  void noiseBetheBloch(M7x7 &noise, double mom, double betaSquare, double gamma, double gammaSquare) const;
159 
161 
168  void noiseCoulomb(M7x7 &noise, const M1x3 &direction, double momSquare, double betaSquare) const;
169 
171 
175  double dEdxBrems(double mom) const;
176 
178 
180  void noiseBrems(M7x7 &noise, double momSquare, double betaSquare) const;
181 
182  bool noEffects_;
183 
184  bool energyLossBetheBloch_;
185  bool noiseBetheBloch_;
186  bool noiseCoulomb_;
187  bool energyLossBrems_;
188  bool noiseBrems_;
189 
190  bool ignoreBoundariesBetweenEqualMaterials_;
191 
192  const double me_; // electron mass (GeV)
193 
194  double stepSize_; // stepsize
195 
196  // cached values for energy loss and noise calculations
197  double dEdx_; // Runkge Kutta dEdx
198  double E_; // Runge Kutta Energy
199  double matDensity_;
200  double matZ_;
201  double matA_;
202  double radiationLength_;
203  double mEE_; // mean excitation energy
204 
205  int pdg_;
206  int charge_;
207  double mass_;
208 
209  int mscModelCode_;
210 
211  AbsMaterialInterface *materialInterface_;
212 
213  unsigned int debugLvl_;
214 
215  // ClassDef(MaterialEffects, 1);
216 };
217 
218 } /* End of namespace genfit */
221 #endif // genfit_MaterialEffects_h
Helper to store different limits on the stepsize for the RKTRackRep.
Definition: StepLimits.h:64
Abstract base class for geometry interfacing.
double effects(const std::vector< RKStep > &steps, int materialsFXStart, int materialsFXStop, const double &mom, const int &pdg, M7x7 *noise=nullptr)
Calculates energy loss in the traveled path, optional calculation of noise matrix.
Material properties needed e.g. for material effects calculation.
void ignoreBoundariesBetweenEqualMaterials(bool opt=true)
void setEnergyLossBrems(bool opt=true)
void stepper(const RKTrackRep *rep, M1x7 &state7, const double &mom, double &relMomLoss, const int &pdg, MaterialProperties &currentMaterial, StepLimits &limits, bool varField=true)
Returns maximum length so that a specified momentum loss will not be exceeded.
void setEnergyLossBetheBloch(bool opt=true)
void setNoEffects(bool opt=true)
Stepper and energy loss/noise matrix calculation.
static MaterialEffects * getInstance()
void setNoiseBrems(bool opt=true)
double M1x7[1 *7]
Definition: RKTools.h:48
void init(AbsMaterialInterface *matIfc)
set the material interface here. Material interface classes must be derived from AbsMaterialInterface...
void setNoiseBetheBloch(bool opt=true)
static void destruct()
void setNoiseCoulomb(bool opt=true)
void setMscModel(const std::string &modelName)
Select the multiple scattering model that will be used during track fit.
double M1x3[1 *3]
Definition: RKTools.h:45
AbsTrackRep with 5D track parameterization in plane coordinates: (q/p, u&#39;, v&#39;, u, v) ...
void setDebugLvl(unsigned int lvl=1)
double M7x7[7 *7]
Definition: RKTools.h:51
void drawdEdx(int pdg=11)
Matrix inversion tools.
Definition: AbsBField.h:40