ATLAS Offline Software
InducedChargeModel.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef SIDIGITIZATION_INDUCEDCHARGEDMODEL_H
6 #define SIDIGITIZATION_INDUCEDCHARGEDMODEL_H
7 
8 //-----------------------------------------------
9 // 2020.8.12 Implementation in Athena by Manabu Togawa
10 // 2017.7.24 update for the case of negative VD (type-P)
11 // 2017.7.17 updated
12 // 2016.4.3 for ICM (induced charge model) by Taka Kondo (KEK)
13 //-----------------------------------------------
14 
15 // Athena
23 
24 // Gaudi
25 #include "GaudiKernel/PhysicalConstants.h"
26 #include "GaudiKernel/ToolHandle.h"
27 #include "GaudiKernel/ServiceHandle.h"
28 
29 // Random number
30 #include "CLHEP/Random/RandFlat.h"
31 #include "CLHEP/Random/RandGaussZiggurat.h" // for RandGaussZiggurat
32 #include "CLHEP/Random/RandPoisson.h"
33 #include "CLHEP/Units/SystemOfUnits.h"
34 
35 // C++ Standard Library
36 #include <array>
37 #include <memory>
38 #include <mutex>
39 #include <string>
40 #include <utility>
41 #include <vector>
42 
44 
45  public:
50 
52  float m_VD; // full depletion voltage [Volt] negative for type-P
53  float m_VB; // applied bias voltage [Volt]
54  float m_T; // temperature
59  CLHEP::HepRandomEngine* m_rndmEngine;
60  std::array<std::array<double, NDepthPoints>, NEFieldPoints> m_ExValue;
61  std::array<std::array<double, NDepthPoints>, NEFieldPoints> m_EyValue;
62 
63  SCT_InducedChargeModelData(const float vdepl,
64  const float vbias,
66  const Amg::Vector3D& magneticField, // in kTesla
67  const float bulk_depth,
68  const EFieldModel model,
69  const ToolHandle<ISiliconConditionsTool> siConditionsTool,
70  CLHEP::HepRandomEngine* rndmEngine,
71  const EventContext& ctx) :
72  m_VD (vdepl), // full depletion voltage [Volt] negative for type-P
73  m_VB (vbias), // applied bias voltage [Volt]
74  m_element (element),
75  m_magneticField (magneticField)
76  {
77  //------------ find delepletion deph for model=0 and 1 -------------
78  m_depletion_depth = bulk_depth;
79  // for type N (before type inversion)
80  if (m_VD >= 0.) {
81  if (m_VB < m_VD) m_depletion_depth = std::sqrt(m_VB/m_VD) * bulk_depth;
82  } else {
83  // for type P
84  if (m_VB <= std::abs(m_VD)) m_depletion_depth = 0.;
85  }
86 
88  m_T = siConditionsTool->temperature(m_element->identifyHash(), ctx) + Gaudi::Units::STP_Temperature;
89  m_rndmEngine = rndmEngine;
90  }
91  };
92 
94 
95  SCT_InducedChargeModelData*
96  setWaferData(const float vdepl,
97  const float vbias,
99  const AtlasFieldCacheCondObj* fieldCondObj,
100  const ToolHandle<ISiliconConditionsTool>& siConditionsTool,
101  CLHEP::HepRandomEngine* rndmEngine,
102  const EventContext& ctx) const;
103 
104  void setEField(SCT_InducedChargeModelData& data) const;
105 
106  void transport(const SCT_InducedChargeModelData& data,
107  const bool isElectron,
108  const double x0, const double y0,
109  double* Q_m2, double* Q_m1, double* Q_00, double* Q_p1, double* Q_p2,
110  const IdentifierHash hashId,
111  const ToolHandle<ISiPropertiesTool>& siPropertiesTool,
112  const EventContext& ctx) const;
113  void holeTransport(const SCT_InducedChargeModelData& data,
114  const double x0, const double y0,
115  double* Q_m2, double* Q_m1, double* Q_00, double* Q_p1, double* Q_p2,
116  const IdentifierHash hashId,
117  const ToolHandle<ISiPropertiesTool>& siPropertiesTool,
118  const EventContext& ctx) const;
119  void electronTransport(const SCT_InducedChargeModelData& data,
120  const double x0, const double y0,
121  double* Q_m2, double* Q_m1, double* Q_00, double* Q_p1, double* Q_p2,
122  const IdentifierHash hashId,
123  const ToolHandle<ISiPropertiesTool>& siPropertiesTool,
124  const EventContext& ctx) const;
125 
126  private:
127 
128  void loadICMParameters();
129 
130  bool getVxVyD(const SCT_InducedChargeModelData& data,
131  const bool isElectron,
132  const double x, const double y, double& vx, double& vy, double& D,
133  const IdentifierHash hashId,
134  const ToolHandle<ISiPropertiesTool>& siPropertiesTool,
135  const EventContext& ctx) const;
136  double induced(const SCT_InducedChargeModelData& data,
137  const int istrip, const double x, const double y) const;
138  void getEField(const SCT_InducedChargeModelData& data,
139  const double x, const double y, double& Ex, double& Ey) const;
140 
141  static size_t getFEMIndex(SCT_InducedChargeModelData& data) ;
142 
143  //-------- parameters for e, h transport --------------------------------
144  static const double s_kB; // [m^2*kg/s^2/K]
145  static const double s_e; // [Coulomb]
146 
147  //------parameters given externally by jobOptions ------------------
148  EFieldModel m_EFieldModel; // 0 (flat diode model), 1 (FEM solusions), 2 (uniform E)
149  double m_transportTimeStep = 0.50; // one step side in time [nsec]
150  double m_transportTimeMax = m_transportTimeStep*NTransportSteps; // maximun tracing time [nsec]
151 
152  //------parameters mostly fixed but can be changed externally ------------
153  double m_bulk_depth = 0.0285; // in [cm]
154  double m_strip_pitch = 0.0080; // in [cm]
155  double m_y_origin_min = 0.;
156 
157  //---------- arrays of FEM analysis -----------------------------------
158  // Storages for Ramo potential and Electric field.
159  // In strip pitch directions :
160  // Ramo potential : 80 divisions (81 points) with 5 um intervals from 40-440 um.
161  // Electric field : 16 divisions (17 points) with 2.5 um intervals from 0-40 um.
162  // In sensor depth directions (for both potential and Electric field):
163  // 114 divisions (115 points) with 2.5 nm intervals for 285 um.
164 
165  std::vector<std::array<std::array<double, NDepthPoints>, NRamoPoints>> m_PotentialValue;
166  std::vector<std::array<std::array<double, NDepthPoints>, NEFieldPoints>> m_ExValue;
167  std::vector<std::array<std::array<double, NDepthPoints>, NEFieldPoints>> m_EyValue;
168 
169  // Cache of SCT_InducedChargeModelData for each wafer.
170  // Assuming wafer parameters do not change during a job.
171  // This should be almost always satisfied.
172  mutable std::vector<std::unique_ptr<SCT_InducedChargeModelData>> m_data ATLAS_THREAD_SAFE; // Guarded by m_mutex
173  // To protect concurrent access to m_data
175 
176  static const std::vector<float> s_VFD0;
177  static const std::vector<std::string> s_VFD0str;
178 };
179 
180 #endif // SIDIGITIZATION_INDUCEDCHARGEDMODEL_H
InducedChargeModel::EndStrip
@ EndStrip
Definition: InducedChargeModel.h:49
InducedChargeModel::NTransportSteps
@ NTransportSteps
Definition: InducedChargeModel.h:47
InducedChargeModel::UniformE
@ UniformE
Definition: InducedChargeModel.h:46
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
SolidStateDetectorElementBase.h
InducedChargeModel::SCT_InducedChargeModelData::m_magneticField
Amg::Vector3D m_magneticField
Definition: InducedChargeModel.h:57
InducedChargeModel::SCT_InducedChargeModelData
Definition: InducedChargeModel.h:51
AtlasFieldCacheCondObj
Definition: AtlasFieldCacheCondObj.h:19
python.PhysicalConstants.STP_Temperature
float STP_Temperature
Definition: PhysicalConstants.py:119
InDetDD::SolidStateDetectorElementBase
Definition: SolidStateDetectorElementBase.h:132
InducedChargeModel::getEField
void getEField(const SCT_InducedChargeModelData &data, const double x, const double y, double &Ex, double &Ey) const
Definition: InducedChargeModel.cxx:308
InducedChargeModel::m_EyValue
std::vector< std::array< std::array< double, NDepthPoints >, NEFieldPoints > > m_EyValue
Definition: InducedChargeModel.h:167
InducedChargeModel::s_VFD0
static const std::vector< float > s_VFD0
Definition: InducedChargeModel.h:176
InducedChargeModel::setWaferData
SCT_InducedChargeModelData * setWaferData(const float vdepl, const float vbias, const InDetDD::SolidStateDetectorElementBase *element, const AtlasFieldCacheCondObj *fieldCondObj, const ToolHandle< ISiliconConditionsTool > &siConditionsTool, CLHEP::HepRandomEngine *rndmEngine, const EventContext &ctx) const
Definition: InducedChargeModel.cxx:40
AtlasFieldCacheCondObj.h
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
m_data
std::vector< T > m_data
Definition: TrackTruthMatchingBaseAlg.cxx:660
InducedChargeModel::EFieldModel
EFieldModel
Definition: InducedChargeModel.h:46
InducedChargeModel::m_y_origin_min
double m_y_origin_min
Definition: InducedChargeModel.h:155
InducedChargeModel::setEField
void setEField(SCT_InducedChargeModelData &data) const
Definition: InducedChargeModel.cxx:458
InducedChargeModel::ATLAS_THREAD_SAFE
std::vector< std::unique_ptr< SCT_InducedChargeModelData > > m_data ATLAS_THREAD_SAFE
Definition: InducedChargeModel.h:172
ISiPropertiesTool.h
InducedChargeModel::m_mutex
std::mutex m_mutex
Definition: InducedChargeModel.h:174
InducedChargeModel::NEFieldPoints
@ NEFieldPoints
Definition: InducedChargeModel.h:48
InducedChargeModel::getVxVyD
bool getVxVyD(const SCT_InducedChargeModelData &data, const bool isElectron, const double x, const double y, double &vx, double &vy, double &D, const IdentifierHash hashId, const ToolHandle< ISiPropertiesTool > &siPropertiesTool, const EventContext &ctx) const
Definition: InducedChargeModel.cxx:231
InducedChargeModel::InducedStrips
InducedStrips
Definition: InducedChargeModel.h:49
InducedChargeModel::m_strip_pitch
double m_strip_pitch
Definition: InducedChargeModel.h:154
x
#define x
InDetDD::SolidStateDetectorElementBase::identifyHash
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
InducedChargeModel::StartStrip
@ StartStrip
Definition: InducedChargeModel.h:49
InducedChargeModel::SCT_InducedChargeModelData::m_depletion_depth
float m_depletion_depth
Definition: InducedChargeModel.h:55
InducedChargeModel::SCT_InducedChargeModelData::m_EyValue
std::array< std::array< double, NDepthPoints >, NEFieldPoints > m_EyValue
Definition: InducedChargeModel.h:61
InducedChargeModel::Offset
@ Offset
Definition: InducedChargeModel.h:49
InducedChargeModel::m_transportTimeStep
double m_transportTimeStep
Definition: InducedChargeModel.h:149
InducedChargeModel::getFEMIndex
static size_t getFEMIndex(SCT_InducedChargeModelData &data)
Definition: InducedChargeModel.cxx:377
InducedChargeModel::transport
void transport(const SCT_InducedChargeModelData &data, const bool isElectron, const double x0, const double y0, double *Q_m2, double *Q_m1, double *Q_00, double *Q_p1, double *Q_p2, const IdentifierHash hashId, const ToolHandle< ISiPropertiesTool > &siPropertiesTool, const EventContext &ctx) const
Definition: InducedChargeModel.cxx:104
xAOD::EgammaHelpers::isElectron
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
Definition: EgammaxAODHelpers.cxx:13
InducedChargeModel::SCT_InducedChargeModelData::m_element
const InDetDD::SolidStateDetectorElementBase * m_element
Definition: InducedChargeModel.h:56
InducedChargeModel::SCT_InducedChargeModelData::m_VB
float m_VB
Definition: InducedChargeModel.h:53
InducedChargeModel::m_ExValue
std::vector< std::array< std::array< double, NDepthPoints >, NEFieldPoints > > m_ExValue
Definition: InducedChargeModel.h:166
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
InducedChargeModel::TransportStep
TransportStep
Definition: InducedChargeModel.h:47
InducedChargeModel::SCT_InducedChargeModelData::m_ExValue
std::array< std::array< double, NDepthPoints >, NEFieldPoints > m_ExValue
Definition: InducedChargeModel.h:60
InducedChargeModel::holeTransport
void holeTransport(const SCT_InducedChargeModelData &data, const double x0, const double y0, double *Q_m2, double *Q_m1, double *Q_00, double *Q_p1, double *Q_p2, const IdentifierHash hashId, const ToolHandle< ISiPropertiesTool > &siPropertiesTool, const EventContext &ctx) const
Definition: InducedChargeModel.cxx:191
InducedChargeModel::NDepthPoints
@ NDepthPoints
Definition: InducedChargeModel.h:48
InducedChargeModel::m_EFieldModel
EFieldModel m_EFieldModel
Definition: InducedChargeModel.h:148
PathResolver.h
InducedChargeModel::s_e
static const double s_e
Definition: InducedChargeModel.h:145
IdentifierHash.h
InducedChargeModel::SCT_InducedChargeModelData::m_rndmEngine
CLHEP::HepRandomEngine * m_rndmEngine
Definition: InducedChargeModel.h:59
InducedChargeModel::NRamoPoints
@ NRamoPoints
Definition: InducedChargeModel.h:48
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
InducedChargeModel::NStrips
@ NStrips
Definition: InducedChargeModel.h:49
InducedChargeModel::s_VFD0str
static const std::vector< std::string > s_VFD0str
Definition: InducedChargeModel.h:177
InducedChargeModel::m_transportTimeMax
double m_transportTimeMax
Definition: InducedChargeModel.h:150
y
#define y
InducedChargeModel::electronTransport
void electronTransport(const SCT_InducedChargeModelData &data, const double x0, const double y0, double *Q_m2, double *Q_m1, double *Q_00, double *Q_p1, double *Q_p2, const IdentifierHash hashId, const ToolHandle< ISiPropertiesTool > &siPropertiesTool, const EventContext &ctx) const
Definition: InducedChargeModel.cxx:211
correlationModel::model
model
Definition: AsgElectronEfficiencyCorrectionTool.cxx:46
AthMessaging.h
ISiliconConditionsTool.h
InducedChargeModel::loadICMParameters
void loadICMParameters()
Definition: InducedChargeModel.cxx:395
InducedChargeModel::SCT_InducedChargeModelData::m_T
float m_T
Definition: InducedChargeModel.h:54
InducedChargeModel::InducedChargeModel
InducedChargeModel(size_t maxHash, EFieldModel model=FEMsolutions)
Definition: InducedChargeModel.cxx:31
IdentifierHash
Definition: IdentifierHash.h:38
InducedChargeModel::induced
double induced(const SCT_InducedChargeModelData &data, const int istrip, const double x, const double y) const
Definition: InducedChargeModel.cxx:276
InducedChargeModel::SCT_InducedChargeModelData::m_VD
float m_VD
Definition: InducedChargeModel.h:52
InducedChargeModel::m_bulk_depth
double m_bulk_depth
Definition: InducedChargeModel.h:153
InducedChargeModel::FEMNums
FEMNums
Definition: InducedChargeModel.h:48
InducedChargeModel::FEMsolutions
@ FEMsolutions
Definition: InducedChargeModel.h:46
InducedChargeModel::m_PotentialValue
std::vector< std::array< std::array< double, NDepthPoints >, NRamoPoints > > m_PotentialValue
Definition: InducedChargeModel.h:165
InducedChargeModel::SCT_InducedChargeModelData::m_EFieldModel
EFieldModel m_EFieldModel
Definition: InducedChargeModel.h:58
InducedChargeModel
Definition: InducedChargeModel.h:43
InducedChargeModel::s_kB
static const double s_kB
Definition: InducedChargeModel.h:144
InducedChargeModel::SCT_InducedChargeModelData::SCT_InducedChargeModelData
SCT_InducedChargeModelData(const float vdepl, const float vbias, const InDetDD::SolidStateDetectorElementBase *element, const Amg::Vector3D &magneticField, const float bulk_depth, const EFieldModel model, const ToolHandle< ISiliconConditionsTool > siConditionsTool, CLHEP::HepRandomEngine *rndmEngine, const EventContext &ctx)
Definition: InducedChargeModel.h:63
InducedChargeModel::FlatDiodeModel
@ FlatDiodeModel
Definition: InducedChargeModel.h:46