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"
9 
10 #include "Geant4/G4ParticleTypes.hh"
11 #include "Geant4/G4LossTableManager.hh"
12 #include "Geant4/G4EmSaturation.hh"
13 
19 
21 #include "cetlib_except/exception.h"
22 
23 
24 namespace larg4{
25 
26  //----------------------------------------------------------------------------
28  {
29  }
30 
31  //----------------------------------------------------------------------------
33  {
34  }
35 
36  //----------------------------------------------------------------------------
38  {
40  const detinfo::LArProperties* larp = lar::providerFrom<detinfo::LArPropertiesService>();
41  const detinfo::DetectorProperties* detprop = lar::providerFrom<detinfo::DetectorPropertiesService>();
42 
43  double density = detprop->Density(detprop->Temperature());
44  fEfield = detprop->Efield();
46  fGeVToElectrons = lgpHandle->GeVToElectrons();
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 = lgpHandle->RecombA();
56  fRecombk = lgpHandle->Recombk()/density;
57  fModBoxA = lgpHandle->ModBoxA();
58  fModBoxB = lgpHandle->ModBoxB()/density;
59  fUseModBoxRecomb = lgpHandle->UseModBoxRecomb();
60 
61  // Use Birks Correction in the Scintillation process
62  fEMSaturation = G4LossTableManager::Instance()->EmSaturation();
63 
64  // determine the step size using the voxel sizes
66  double maxsize = std::max(lvc->VoxelSizeX(), std::max(lvc->VoxelSizeY(), lvc->VoxelSizeZ())) * CLHEP::cm;
67 
68  fStepSize = 0.1 * maxsize;
69 
70  return;
71  }
72 
73  //----------------------------------------------------------------------------
74  // fNumIonElectrons returns a value that is not corrected for life time effects
76  {
77  fEnergyDeposit = 0.;
78  fNumScintPhotons = 0.;
79  fNumIonElectrons = 0.;
80 
81  return;
82  }
83 
84  //----------------------------------------------------------------------------
85  // fNumIonElectrons returns a value that is not corrected for life time effects
87  {
88 
89  fEnergyDeposit = step->GetTotalEnergyDeposit()/CLHEP::MeV;
90 
91  // Get the recombination factor for this voxel - Nucl.Instrum.Meth.A523:275-286,2004
92  // R = A/(1 + (dE/dx)*k)
93  // dE/dx is given by the voxel energy deposition, but have to convert it to MeV/cm
94  // from GeV/voxel width
95  // A = 0.800 +/- 0.003
96  // k = (0.097+/-0.001) g/(MeVcm^2)
97  // the dx depends on the trajectory of the step
98  // k should be divided by the density as our dE/dx is in MeV/cm,
99  // the division is handled in the constructor when we set fRecombk
100  // B.Baller: Add Modified Box recombination - ArgoNeuT result submitted to JINST
101 
102  G4ThreeVector totstep = step->GetPostStepPoint()->GetPosition();
103  totstep -= step->GetPreStepPoint()->GetPosition();
104 
105  double dx = totstep.mag()/CLHEP::cm;
106  double recomb = 0.;
107  double dEdx = (dx == 0.0)? 0.0: fEnergyDeposit/dx;
108  double EFieldStep = EFieldAtStep(fEfield,step);
109 
110  // Guard against spurious values of dE/dx. Note: assumes density of LAr
111  if(dEdx < 1.) dEdx = 1.;
112 
113  if(fUseModBoxRecomb) {
114  if (dx){
115  double Xi = fModBoxB * dEdx / EFieldStep;
116  recomb = log(fModBoxA + Xi) / Xi;
117  }
118  else
119  recomb = 0;
120  }
121  else{
122  recomb = fRecombA/(1. + dEdx * fRecombk / EFieldStep);
123  }
124 
125 
126  // 1.e-3 converts fEnergyDeposit to GeV
127  fNumIonElectrons = fGeVToElectrons * 1.e-3 * fEnergyDeposit * recomb;
128 
129  LOG_DEBUG("ISCalculationSeparate") << " Electrons produced for " << fEnergyDeposit
130  << " MeV deposited with " << recomb
131  << " recombination: " << fNumIonElectrons;
132 
133  // Now do the scintillation
134  G4MaterialPropertiesTable* mpt = step->GetTrack()->GetMaterial()->GetMaterialPropertiesTable();
135  if( !mpt)
136  throw cet::exception("ISCalculationSeparate") << "Cannot find materials property table"
137  << " for this step! "
138  << step->GetTrack()->GetMaterial() << "\n";
139 
140  // if not doing the scintillation by particle type, use the saturation
141  double scintYield = mpt->GetConstProperty("SCINTILLATIONYIELD");
142 
144 
145  LOG_DEBUG("ISCalculationSeparate") << "scintillating by particle type";
146 
147  // Get the definition of the current particle
148  G4ParticleDefinition *pDef = step->GetTrack()->GetDynamicParticle()->GetDefinition();
149  //G4MaterialPropertyVector *Scint_Yield_Vector = NULL;
150 
151  // Obtain the G4MaterialPropertyVectory containing the
152  // scintillation light yield as a function of the deposited
153  // energy for the current particle type
154 
155  // Protons
156  if(pDef == G4Proton::ProtonDefinition()){
157  scintYield = mpt->GetConstProperty("PROTONSCINTILLATIONYIELD");
158  }
159  // Muons
160  else if(pDef == G4MuonPlus::MuonPlusDefinition() ||
161  pDef == G4MuonMinus::MuonMinusDefinition()){
162  scintYield = mpt->GetConstProperty("MUONSCINTILLATIONYIELD");
163  }
164  // Pions
165  else if(pDef == G4PionPlus::PionPlusDefinition() ||
166  pDef == G4PionMinus::PionMinusDefinition()){
167  scintYield = mpt->GetConstProperty("PIONSCINTILLATIONYIELD");
168  }
169  // Kaons
170  else if(pDef == G4KaonPlus::KaonPlusDefinition() ||
171  pDef == G4KaonMinus::KaonMinusDefinition()){
172  scintYield = mpt->GetConstProperty("KAONSCINTILLATIONYIELD");
173  }
174  // Alphas
175  else if(pDef == G4Alpha::AlphaDefinition()){
176  scintYield = mpt->GetConstProperty("ALPHASCINTILLATIONYIELD");
177  }
178  // Electrons (must also account for shell-binding energy
179  // attributed to gamma from standard PhotoElectricEffect)
180  else if(pDef == G4Electron::ElectronDefinition() ||
181  pDef == G4Gamma::GammaDefinition()){
182  scintYield = mpt->GetConstProperty("ELECTRONSCINTILLATIONYIELD");
183  }
184  // Default for particles not enumerated/listed above
185  else{
186  scintYield = mpt->GetConstProperty("ELECTRONSCINTILLATIONYIELD");
187  }
188 
189  // If the user has not specified yields for (p,d,t,a,carbon)
190  // then these unspecified particles will default to the
191  // electron's scintillation yield
192 
193  // Throw an exception if no scintillation yield is found
194  if (!scintYield)
195  throw cet::exception("ISCalculationSeparate") << "Request for scintillation yield for energy "
196  << "deposit and particle type without correct "
197  << "entry in MaterialPropertiesTable\n"
198  << "ScintillationByParticleType requires at "
199  << "minimum that ELECTRONSCINTILLATIONYIELD is "
200  << "set by the user\n";
201 
202  fNumScintPhotons = scintYield * fEnergyDeposit;
203  }
204  else if(fEMSaturation){
205  // The default linear scintillation process
206  //fEMSaturation->SetVerbose(1);
207  fVisibleEnergyDeposition = fEMSaturation->VisibleEnergyDepositionAtAStep(step);
209  //fNumScintPhotons = fScintYieldFactor * scintYield * fEMSaturation->VisibleEnergyDepositionAtAStep(step);
210  //I need a dump here
211  //mf::LogInfo("EMSaturation") <<"\n\nfEMSaturation VisibleEnergyDepositionAtAStep(step): "<<fEMSaturation->VisibleEnergyDepositionAtAStep(step)<<"\n" <<"BirksCoefs: \n";
212  // fEMSaturation->DumpBirksCoefficients();
213  //mf::LogInfo("EMSaturation")<<"\n" <<"G4Birks: \n";
214  //fEMSaturation->DumpG4BirksCoefficients();
215  //mf::LogInfo("EMSaturation")<<"fScintYieldFactor: "<<fScintYieldFactor <<"\nscintYield: "<<scintYield<<"\nfEMVisAtStep: "<<fEMSaturation->VisibleEnergyDepositionAtAStep(step)<<"\nfNumScintPhotons: "<<fNumScintPhotons<<"\n";
216  //mf::LogInfo("EMSaturation")<<"fTotalEnergyDeposit: "<< step->GetTotalEnergyDeposit()/CLHEP::MeV<<"\nfNumIonElectrons: "<<fNumIonElectrons<<"\n";
217  }
218  else{
220  fVisibleEnergyDeposition = 0.0; //This is set to zero because I have not made a correct implimentation of this value for anything but EMSaturation.
221  }
222 
223  LOG_DEBUG("ISCalculationSeparate") << "number photons: " << fNumScintPhotons
224  << " energy: " << fEnergyDeposit/CLHEP::MeV
225  << " saturation: "
226  << fEMSaturation->VisibleEnergyDepositionAtAStep(step)
227  << " step length: " << step->GetStepLength()/CLHEP::cm;
228 
229 
230  return;
231  }
232 
233 
234 }// namespace
Store parameters for running LArG4.
double VoxelSizeX() const
Access to voxel dimensions and offsets.
double ModBoxA() const
bool fUseModBoxRecomb
from LArG4Parameters service
double fEnergyDeposit
total energy deposited in the step
G4EmSaturation * fEMSaturation
pointer to EM saturation
double fScintYieldFactor
scintillation yield factor
Encapsulates calculation of LArVoxelID and LArVoxel parameters.
double fGeVToElectrons
conversion factor from LArProperties service
bool UseModBoxRecomb() const
Geant4 interface.
double fRecombA
from LArG4Parameters service
double fNumIonElectrons
number of ionization electrons for this step
double fNumScintPhotons
number of scintillation photons for this step
double fEfield
value of electric field from LArProperties service
double EFieldAtStep(double efield, sim::SimEnergyDeposit const &edep)
Int_t max
Definition: plot.C:27
double fModBoxB
from LArG4Parameters service
bool fScintByParticleType
from LArProperties service
void CalculateIonizationAndScintillation(sim::SimEnergyDeposit const &edep)
double RecombA() const
double fStepSize
maximum step to take
virtual double Density(double temperature) const =0
Returns argon density at a given temperature.
double fRecombk
from LArG4Parameters service
double ModBoxB() const
double Recombk() const
#define LOG_DEBUG(id)
double fVisibleEnergyDeposition
Definition: ISCalculation.h:42
double fModBoxA
from LArG4Parameters service
virtual bool ScintByParticleType() const =0
double GeVToElectrons() const
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33