LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ISCalcSeparate.cxx
Go to the documentation of this file.
1 #include "CLHEP/Vector/ThreeVector.h"
13 
19 
21 #include "cetlib_except/exception.h"
22 
25 
26 
27 // Wes did this for TRACE debugging
28 //#include "trace.h"
29 //#define TNAME "ISCalcSeparate"
30 
31 
32 namespace larg4{
33 
34  //----------------------------------------------------------------------------
36  {
37  }
38 
39  //----------------------------------------------------------------------------
41  {
42  }
43 
44  //----------------------------------------------------------------------------
46  const detinfo::DetectorProperties* detp,
47  const sim::LArG4Parameters* lgp,
48  const spacecharge::SpaceCharge* sce)
49  {
50  //TRACEN(TNAME,3,"Initializing called.");
51 
52  fLArProp = larp;
53  fSCE = sce;
54  fDetProp = detp;
55  fLArG4Prop = lgp;
56 
57  // \todo get scintillation yield from LArG4Parameters or LArProperties
58  fScintYieldFactor = 1.;
59 
60  // the recombination coefficient is in g/(MeVcm^2), but
61  // we report energy depositions in MeV/cm, need to divide
62  // Recombk from the LArG4Parameters service by the density
63  // of the argon we got above.
64  fRecombA = lgp->RecombA();
65  fRecombk = lgp->Recombk()/detp->Density(detp->Temperature());
66  fModBoxA = lgp->ModBoxA();
67  fModBoxB = lgp->ModBoxB()/detp->Density(detp->Temperature());
68  fUseModBoxRecomb = (bool)lgp->UseModBoxRecomb();
70 
71  this->Reset();
72 
73  //TRACEN(TNAME,3,"Initialize: RecombA=%f, Recombk=%f, ModBoxA=%f, ModBoxB=%f, UseModBoxRecomb=%d",
74  // fRecombA, fRecombk, fModBoxA, fModBoxB, fUseModBoxRecomb);
75 
76  return;
77  }
78 
79  //----------------------------------------------------------------------------
81  {
82  fEnergyDeposit = 0.;
83  fNumScintPhotons = 0.;
84  fNumIonElectrons = 0.;
85 
86  return;
87  }
88 
89  //----------------------------------------------------------------------------
90  // fNumIonElectrons returns a value that is not corrected for life time effects
91  void ISCalcSeparate::CalculateIonization(float e, float ds,
92  float x, float y, float z){
93 
94  //TRACEN(TNAME,3,"Calculate ionization called with e=%f, ds=%f, (x,y,z)=(%f,%f,%f)",
95  // e,ds,x,y,z);
96  //TRACEN(TNAME,3,"Initialized values: RecombA=%lf, Recombk=%lf, ModBoxA=%lf, ModBoxB=%lf, UseModBoxRecomb=%d",
97  // fRecombA, fRecombk, fModBoxA, fModBoxB, fUseModBoxRecomb);
98 
99  double recomb = 0.;
100  double dEdx = (ds<=0.0)? 0.0: e/ds;
101  double EFieldStep = EFieldAtStep(fDetProp->Efield(),x,y,z);
102 
103  // Guard against spurious values of dE/dx. Note: assumes density of LAr
104  if(dEdx < 1.) dEdx = 1.;
105 
106  //TRACEN(TNAME,3,"dEdx=%f, EFieldStep=%f",dEdx,EFieldStep);
107 
108  if(fUseModBoxRecomb) {
109  if(ds>0){
110  double Xi = fModBoxB * dEdx / EFieldStep;
111  recomb = log(fModBoxA + Xi) / Xi;
112  }
113  else
114  recomb = 0;
115  }
116  else{
117  recomb = fRecombA / (1. + dEdx * fRecombk / EFieldStep);
118  }
119 
120  //TRACEN(TNAME,3,"recomb=%f",recomb);
121 
122  // 1.e-3 converts fEnergyDeposit to GeV
123  fNumIonElectrons = fGeVToElectrons * 1.e-3 * e * recomb;
124 
125  //TRACEN(TNAME,3,"n_electrons=%f",fNumIonElectrons);
126 
127  LOG_DEBUG("ISCalcSeparate")
128  << " Electrons produced for " << fEnergyDeposit
129  << " MeV deposited with " << recomb
130  << " recombination: " << fNumIonElectrons << std::endl;
131  }
132 
133 
134  //----------------------------------------------------------------------------
136  CalculateIonization(edep.Energy(),edep.StepLength(),
137  edep.MidPointX(),edep.MidPointY(),edep.MidPointZ());
138  }
139 
140  //----------------------------------------------------------------------------
142  {
143  double scintYield = fLArProp->ScintYield(true);
145 
146  LOG_DEBUG("ISCalcSeparate") << "scintillating by particle type";
147 
148  switch(pdg) {
149 
150  case 2212:
151  scintYield = fLArProp->ProtonScintYield(true);
152  break;
153  case 13:
154  case -13:
155  scintYield = fLArProp->MuonScintYield(true);
156  break;
157  case 211:
158  case -211:
159  scintYield = fLArProp->PionScintYield(true);
160  break;
161  case 321:
162  case -321:
163  scintYield = fLArProp->KaonScintYield(true);
164  break;
165  case 1000020040:
166  scintYield = fLArProp->AlphaScintYield(true);
167  break;
168  case 11:
169  case -11:
170  case 22:
171  scintYield = fLArProp->ElectronScintYield(true);
172  break;
173  default:
174  scintYield = fLArProp->ElectronScintYield(true);
175 
176  }
177 
178  fNumScintPhotons = scintYield * e;
179  }
180  else
181  fNumScintPhotons = fScintYieldFactor * scintYield * e;
182 
183  }
184 
185  //----------------------------------------------------------------------------
187  {
188  CalculateScintillation(edep.Energy(),edep.PdgCode());
189  }
190 
191  //----------------------------------------------------------------------------
193  {
194  fEnergyDeposit = edep.Energy();
195  CalculateIonization(edep);
197  }
198 
200  {
201  return EFieldAtStep(efield,
202  edep.MidPointX(),edep.MidPointY(),edep.MidPointZ());
203  }
204 
205  double ISCalcSeparate::EFieldAtStep(double efield, float x, float y, float z)
206  {
207  double EField = efield;
208  if (fSCE->EnableSimEfieldSCE())
209  {
211  EField = std::sqrt( (efield + efield*fEfieldOffsets.X())*(efield + efield*fEfieldOffsets.X()) +
212  (efield*fEfieldOffsets.Y()*efield*fEfieldOffsets.Y()) +
213  (efield*fEfieldOffsets.Z()*efield*fEfieldOffsets.Z()) );
214  }
215  return EField;
216  }
217 
218 }// namespace
Float_t x
Definition: compare.C:6
virtual bool EnableSimEfieldSCE() const =0
Store parameters for running LArG4.
double fNumScintPhotons
number of scintillation photons for this step
const detinfo::LArProperties * fLArProp
void Initialize(const detinfo::LArProperties *larp, const detinfo::DetectorProperties *detp, const sim::LArG4Parameters *lgp, const spacecharge::SpaceCharge *sce)
virtual double AlphaScintYield(bool prescale=false) const =0
geo::Length_t StepLength() const
double ModBoxA() const
geo::Vector_t fEfieldOffsets
void CalculateIonizationAndScintillation(sim::SimEnergyDeposit const &edep)
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:279
double fModBoxA
from LArG4Parameters service
bool UseModBoxRecomb() const
Geant4 interface.
double fRecombk
from LArG4Parameters service
double fEnergyDeposit
total energy deposited in the step
const sim::LArG4Parameters * fLArG4Prop
virtual double ProtonScintYield(bool prescale=false) const =0
const detinfo::DetectorProperties * fDetProp
void CalculateIonization(float e, float ds, float x, float y, float z)
virtual double Temperature() const =0
void CalculateScintillation(float e, int pdg)
double fNumIonElectrons
number of ionization electrons for this step
double fRecombA
from LArG4Parameters service
virtual double ElectronScintYield(bool prescale=false) const =0
virtual double PionScintYield(bool prescale=false) const =0
double RecombA() const
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
double fScintYieldFactor
scintillation yield factor
virtual geo::Vector_t GetEfieldOffsets(geo::Point_t const &point) const =0
const spacecharge::SpaceCharge * fSCE
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
double fGeVToElectrons
from LArG4Parameters service
#define LOG_DEBUG(id)
double fModBoxB
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
double EFieldAtStep(double efield, sim::SimEnergyDeposit const &edep)
bool fUseModBoxRecomb
from LArG4Parameters service