LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ISCalculationSeparate.cxx
Go to the documentation of this file.
1 #include "CLHEP/Vector/ThreeVector.h"
13 
19 
21 #include "cetlib_except/exception.h"
22 
24 
25 namespace larg4{
26 
27  //----------------------------------------------------------------------------
29  {
30  }
31 
32  //----------------------------------------------------------------------------
34  {
35  }
36 
37  //----------------------------------------------------------------------------
39  const detinfo::DetectorProperties* detp,
40  const sim::LArG4Parameters* lgp,
41  const spacecharge::SpaceCharge* sce)
42  {
43  fLArProp = larp;
44  fSCE = sce;
45  fDetProp = detp;
46  fLArG4Prop = lgp;
47 
48  // \todo get scintillation yield from LArG4Parameters or LArProperties
49  fScintYieldFactor = 1.;
50 
51  // the recombination coefficient is in g/(MeVcm^2), but
52  // we report energy depositions in MeV/cm, need to divide
53  // Recombk from the LArG4Parameters service by the density
54  // of the argon we got above.
55  fRecombA = (double)lgp->RecombA();
56  fRecombk = (double)lgp->Recombk()/detp->Density(detp->Temperature());
57  fModBoxA = (double)lgp->ModBoxA();
58  fModBoxB = (double)lgp->ModBoxB()/detp->Density(detp->Temperature());
59  fUseModBoxRecomb = (bool)lgp->UseModBoxRecomb();
60 
61  this->Reset();
62 
63  return;
64  }
65 
66  //----------------------------------------------------------------------------
68  {
69  fEnergyDeposit = 0.;
70  fNumScintPhotons = 0.;
71  fNumIonElectrons = 0.;
72 
73  return;
74  }
75 
76  //----------------------------------------------------------------------------
77  // fNumIonElectrons returns a value that is not corrected for life time effects
79  float x, float y, float z){
80  double recomb = 0.;
81  double dEdx = e/ds;
82  double EFieldStep = EFieldAtStep(fDetProp->Efield(),x,y,z);
83 
84  // Guard against spurious values of dE/dx. Note: assumes density of LAr
85  if(dEdx < 1.) dEdx = 1.;
86 
87  if(fUseModBoxRecomb) {
88  if(ds){
89  double Xi = fModBoxB * dEdx / EFieldStep;
90  recomb = log(fModBoxA + Xi) / Xi;
91  }
92  else
93  recomb = 0;
94  }
95  else{
96  recomb = fLArG4Prop->RecombA() / (1. + dEdx * fRecombk / EFieldStep);
97  }
98 
99 
100  // 1.e-3 converts fEnergyDeposit to GeV
101  fNumIonElectrons = fLArG4Prop->GeVToElectrons() * 1.e-3 * e * recomb;
102 
103  LOG_DEBUG("ISCalculationSeparate")
104  << " Electrons produced for " << fEnergyDeposit
105  << " MeV deposited with " << recomb
106  << " recombination: " << fNumIonElectrons << std::endl;
107  }
108 
109 
110  //----------------------------------------------------------------------------
112  CalculateIonization(edep.Energy(),edep.StepLength(),
113  edep.MidPointX(),edep.MidPointY(),edep.MidPointZ());
114  }
115 
116  //----------------------------------------------------------------------------
118  {
119  double scintYield = fLArProp->ScintYield(true);
121 
122  LOG_DEBUG("ISCalculationSeparate") << "scintillating by particle type";
123 
124  switch(pdg) {
125 
126  case 2212:
127  scintYield = fLArProp->ProtonScintYield(true);
128  break;
129  case 13:
130  case -13:
131  scintYield = fLArProp->MuonScintYield(true);
132  break;
133  case 211:
134  case -211:
135  scintYield = fLArProp->PionScintYield(true);
136  break;
137  case 321:
138  case -321:
139  scintYield = fLArProp->KaonScintYield(true);
140  break;
141  case 1000020040:
142  scintYield = fLArProp->AlphaScintYield(true);
143  break;
144  case 11:
145  case -11:
146  case 22:
147  scintYield = fLArProp->ElectronScintYield(true);
148  break;
149  default:
150  scintYield = fLArProp->ElectronScintYield(true);
151 
152  }
153 
154  fNumScintPhotons = scintYield * e;
155  }
156  else
157  fNumScintPhotons = fScintYieldFactor * scintYield * e;
158 
159  }
160 
161  //----------------------------------------------------------------------------
163  {
164  CalculateScintillation(edep.Energy(),edep.PdgCode());
165  }
166 
167  //----------------------------------------------------------------------------
169  {
170  fEnergyDeposit = edep.Energy();
171  CalculateIonization(edep);
173  }
174 
176  {
177  return EFieldAtStep(efield,
178  edep.MidPointX(),edep.MidPointY(),edep.MidPointZ());
179  }
180 
181  double ISCalculationSeparate::EFieldAtStep(double efield, float x, float y, float z)
182  {
183  double EField = efield;
184  if (fSCE->EnableSimEfieldSCE())
185  {
187  EField = std::sqrt( (efield + efield*fEfieldOffsets.X())*(efield + efield*fEfieldOffsets.X()) +
188  (efield*fEfieldOffsets.Y()+efield*fEfieldOffsets.Y()) +
189  (efield*fEfieldOffsets.Z()+efield*fEfieldOffsets.Z()) );
190  }
191  return EField;
192  }
193 
194 }// namespace
Float_t x
Definition: compare.C:6
virtual bool EnableSimEfieldSCE() const =0
Store parameters for running LArG4.
virtual double AlphaScintYield(bool prescale=false) const =0
geo::Length_t StepLength() const
const detinfo::DetectorProperties * fDetProp
double ModBoxA() const
bool fUseModBoxRecomb
from LArG4Parameters service
double fEnergyDeposit
total energy deposited in the step
const spacecharge::SpaceCharge * fSCE
double fScintYieldFactor
scintillation yield factor
Float_t y
Definition: compare.C:6
const detinfo::LArProperties * fLArProp
Double_t z
Definition: plot.C:279
bool UseModBoxRecomb() const
Geant4 interface.
void CalculateScintillation(float e, int pdg)
double fRecombA
from LArG4Parameters service
double fNumIonElectrons
number of ionization electrons for this step
double fNumScintPhotons
number of scintillation photons for this step
virtual double ProtonScintYield(bool prescale=false) const =0
double EFieldAtStep(double efield, sim::SimEnergyDeposit const &edep)
virtual double Temperature() const =0
virtual double ElectronScintYield(bool prescale=false) const =0
double fModBoxB
from LArG4Parameters service
virtual double PionScintYield(bool prescale=false) const =0
void CalculateIonizationAndScintillation(sim::SimEnergyDeposit const &edep)
double RecombA() const
const sim::LArG4Parameters * fLArG4Prop
virtual double Density(double temperature) const =0
Returns argon density at a given temperature.
Double_t edep
Definition: macro.C:13
geo::Length_t MidPointX() const
geo::Length_t MidPointY() const
virtual geo::Vector_t GetEfieldOffsets(geo::Point_t const &point) const =0
double fRecombk
from LArG4Parameters service
double ModBoxB() const
virtual double MuonScintYield(bool prescale=false) const =0
virtual double KaonScintYield(bool prescale=false) const =0
contains information for a single step in the detector simulation
geo::Length_t MidPointZ() const
double Recombk() const
virtual double ScintYield(bool prescale=false) const =0
void CalculateIonization(float e, float ds, float x, float y, float z)
#define LOG_DEBUG(id)
double fModBoxA
from LArG4Parameters service
virtual double Efield(unsigned int planegap=0) const =0
Returns the nominal electric field in the specified volume.
double Energy() const
Float_t e
Definition: plot.C:34
virtual bool ScintByParticleType() const =0
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:187
double GeVToElectrons() const