Garfield++ 5.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
GarfieldPhysics.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26/// \file GarfieldPhysics.hh
27/// \brief Definition of the GarfieldPhysics class
28/// \author D. Pfeiffer
29//
30#ifndef GarfieldPhysics_h
31#define GarfieldPhysics_h 1
32
33#include <iostream>
34#include <map>
35#include <vector>
36
39#include "Garfield/Sensor.hh"
40#include "Garfield/TrackHeed.hh"
41
42typedef std::pair<double, double> EnergyRange_MeV;
43typedef std::map<const std::string, EnergyRange_MeV> MapParticlesEnergy;
44
46 public:
47 GarfieldParticle(std::string particleName, double ekin_eV, double time,
48 double x_cm, double y_cm, double z_cm, double dx, double dy,
49 double dz)
50 : fParticleName(particleName),
51 fEkin_MeV(ekin_eV / 1000000),
52 fTime(time),
53 fx_mm(10 * x_cm),
54 fy_mm(10 * y_cm),
55 fz_mm(10 * z_cm),
56 fdx(dx),
57 fdy(dy),
58 fdz(dz) {}
60
61 std::string getParticleName() const { return fParticleName; }
62 double getX_mm() const { return fx_mm; }
63 double getY_mm() const { return fy_mm; }
64 double getZ_mm() const { return fz_mm; }
65 double getEkin_MeV() const { return fEkin_MeV; }
66 double getTime() const { return fTime; }
67 double getDX() const { return fdx; }
68 double getDY() const { return fdy; }
69 double getDZ() const { return fdz; }
70
71 private:
72 std::string fParticleName;
73 double fEkin_MeV, fTime, fx_mm, fy_mm, fz_mm, fdx, fdy, fdz;
74};
75
76class GarfieldPhysics {
77 public:
78 static GarfieldPhysics* GetInstance();
79 static void Dispose();
80
81 void InitializePhysics();
82
83 void DoIt(std::string particleName, double ekin_MeV, double time, double x_cm,
84 double y_cm, double z_cm, double dx, double dy, double dz);
85
86 void AddParticleName(const std::string particleName, double ekin_min_MeV,
87 double ekin_max_MeV, std::string program);
88 bool FindParticleName(const std::string name,
89 std::string program = "garfield");
90 bool FindParticleNameEnergy(std::string name, double ekin_MeV,
91 std::string program = "garfield");
92 double GetMinEnergyMeVParticle(std::string name,
93 std::string program = "garfield");
94 double GetMaxEnergyMeVParticle(std::string name,
95 std::string program = "garfield");
96 void SetIonizationModel(std::string model, bool useDefaults = true);
97 std::string GetIonizationModel();
98 const std::vector<GarfieldParticle>& GetSecondaryParticles() const {
99 return fSecondaryParticles;
100 }
102 createSecondariesInGeant4 = flag;
103 }
105 return createSecondariesInGeant4;
106 }
107 double GetEnergyDeposit_MeV() const { return fEnergyDeposit / 1000000; }
108 double GetAvalancheSize() const { return fAvalancheSize; }
109 double GetGain() const { return fGain; }
110 void Clear() {
111 fEnergyDeposit = 0;
112 fAvalancheSize = 0;
113 fGain = 0;
114 nsum = 0;
115 }
116
117 private:
118 GarfieldPhysics() = default;
120
121 std::string fIonizationModel = "PAIPhot";
122
123 static GarfieldPhysics* fGarfieldPhysics;
124
125 MapParticlesEnergy fMapParticlesEnergyGeant4;
126 MapParticlesEnergy fMapParticlesEnergyGarfield;
127 Garfield::MediumMagboltz* fMediumMagboltz = nullptr;
128 Garfield::Sensor* fSensor = nullptr;
129 Garfield::TrackHeed* fTrackHeed = nullptr;
130 Garfield::ComponentAnalyticField* fComponentAnalyticField = nullptr;
131
132 std::vector<GarfieldParticle> fSecondaryParticles;
133
134 bool createSecondariesInGeant4 = false;
135 double fEnergyDeposit = 0.;
136 double fAvalancheSize = 0.;
137 double fGain = 0.;
138 int nsum = 0;
139};
140#endif /* GARFIELDMODELCONFIG_HH_ */
std::pair< double, double > EnergyRange_MeV
std::map< const std::string, EnergyRange_MeV > MapParticlesEnergy
double getDY() const
double getTime() const
double getX_mm() const
double getY_mm() const
std::string getParticleName() const
double getDX() const
double getEkin_MeV() const
double getDZ() const
double getZ_mm() const
GarfieldParticle(std::string particleName, double ekin_eV, double time, double x_cm, double y_cm, double z_cm, double dx, double dy, double dz)
double GetEnergyDeposit_MeV() const
double GetAvalancheSize() const
static void Dispose()
double GetMaxEnergyMeVParticle(std::string name, std::string program="garfield")
static GarfieldPhysics * GetInstance()
void SetIonizationModel(std::string model, bool useDefaults=true)
double GetMinEnergyMeVParticle(std::string name, std::string program="garfield")
double GetGain() const
void AddParticleName(const std::string particleName, double ekin_min_MeV, double ekin_max_MeV, std::string program)
std::string GetIonizationModel()
bool GetCreateSecondariesInGeant4() const
const std::vector< GarfieldParticle > & GetSecondaryParticles() const
void DoIt(std::string particleName, double ekin_MeV, double time, double x_cm, double y_cm, double z_cm, double dx, double dy, double dz)
bool FindParticleNameEnergy(std::string name, double ekin_MeV, std::string program="garfield")
void EnableCreateSecondariesInGeant4(bool flag)
bool FindParticleName(const std::string name, std::string program="garfield")
Generate tracks using Heed++.
Definition TrackHeed.hh:35