Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/optical/src/G4OpWLS2.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/optical/src/G4OpWLS2.cc (Version 11.3.0) and /processes/optical/src/G4OpWLS2.cc (Version 11.1.1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
 27 //                                                 27 //
 28 //////////////////////////////////////////////     28 ////////////////////////////////////////////////////////////////////////
 29 // Optical Photon WaveLength Shifting (WLS) Cl     29 // Optical Photon WaveLength Shifting (WLS) Class Implementation
 30 //////////////////////////////////////////////     30 ////////////////////////////////////////////////////////////////////////
 31 //                                                 31 //
 32 // File:        G4OpWLS2.cc                        32 // File:        G4OpWLS2.cc
 33 // Description: Discrete Process -- Wavelength     33 // Description: Discrete Process -- Wavelength Shifting of Optical Photons
 34 // Version:     1.0                                34 // Version:     1.0
 35 // Created:     2003-05-13                         35 // Created:     2003-05-13
 36 // Author:      John Paul Archambault              36 // Author:      John Paul Archambault
 37 //              (Adaptation of G4Scintillation     37 //              (Adaptation of G4Scintillation and G4OpAbsorption)
 38 // Updated:     2005-07-28 - add G4ProcessType     38 // Updated:     2005-07-28 - add G4ProcessType to constructor
 39 //              2006-05-07 - add G4VWLSTimeGen     39 //              2006-05-07 - add G4VWLSTimeGeneratorProfile
 40 //                                                 40 //
 41 //////////////////////////////////////////////     41 ////////////////////////////////////////////////////////////////////////
 42                                                    42 
 43 #include "G4OpWLS2.hh"                             43 #include "G4OpWLS2.hh"
 44 #include "G4ios.hh"                                44 #include "G4ios.hh"
 45 #include "G4PhysicalConstants.hh"                  45 #include "G4PhysicalConstants.hh"
 46 #include "G4SystemOfUnits.hh"                      46 #include "G4SystemOfUnits.hh"
 47 #include "G4OpProcessSubType.hh"                   47 #include "G4OpProcessSubType.hh"
 48 #include "G4Poisson.hh"                            48 #include "G4Poisson.hh"
 49 #include "G4OpticalParameters.hh"                  49 #include "G4OpticalParameters.hh"
 50 #include "G4WLSTimeGeneratorProfileDelta.hh"       50 #include "G4WLSTimeGeneratorProfileDelta.hh"
 51 #include "G4WLSTimeGeneratorProfileExponential     51 #include "G4WLSTimeGeneratorProfileExponential.hh"
 52                                                    52 
 53 //....oooOO0OOooo........oooOO0OOooo........oo     53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 54 G4OpWLS2::G4OpWLS2(const G4String& processName     54 G4OpWLS2::G4OpWLS2(const G4String& processName, G4ProcessType type)
 55   : G4VDiscreteProcess(processName, type)          55   : G4VDiscreteProcess(processName, type)
 56 {                                                  56 {
 57   WLSTimeGeneratorProfile = nullptr;               57   WLSTimeGeneratorProfile = nullptr;
 58   Initialise();                                    58   Initialise();
 59   SetProcessSubType(fOpWLS2);                  <<  59   SetProcessSubType(fOpWLS);
 60   theIntegralTable = nullptr;                      60   theIntegralTable = nullptr;
 61                                                    61 
 62   if(verboseLevel > 0)                             62   if(verboseLevel > 0)
 63     G4cout << GetProcessName() << " is created     63     G4cout << GetProcessName() << " is created " << G4endl;
 64 }                                                  64 }
 65                                                    65 
 66 //....oooOO0OOooo........oooOO0OOooo........oo     66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 67 G4OpWLS2::~G4OpWLS2()                              67 G4OpWLS2::~G4OpWLS2()
 68 {                                                  68 {
 69   if(theIntegralTable)                             69   if(theIntegralTable)
 70   {                                                70   {
 71     theIntegralTable->clearAndDestroy();           71     theIntegralTable->clearAndDestroy();
 72     delete theIntegralTable;                       72     delete theIntegralTable;
 73   }                                                73   }
 74   delete WLSTimeGeneratorProfile;                  74   delete WLSTimeGeneratorProfile;
 75 }                                                  75 }
 76                                                    76 
 77 //....oooOO0OOooo........oooOO0OOooo........oo     77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 78 void G4OpWLS2::PreparePhysicsTable(const G4Par     78 void G4OpWLS2::PreparePhysicsTable(const G4ParticleDefinition&)
 79 {                                                  79 {
 80   Initialise();                                    80   Initialise();
 81 }                                                  81 }
 82                                                    82 
 83 //....oooOO0OOooo........oooOO0OOooo........oo     83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 84 void G4OpWLS2::Initialise()                        84 void G4OpWLS2::Initialise()
 85 {                                                  85 {
 86   G4OpticalParameters* params = G4OpticalParam     86   G4OpticalParameters* params = G4OpticalParameters::Instance();
 87   SetVerboseLevel(params->GetWLS2VerboseLevel(     87   SetVerboseLevel(params->GetWLS2VerboseLevel());
 88   UseTimeProfile(params->GetWLS2TimeProfile())     88   UseTimeProfile(params->GetWLS2TimeProfile());
 89 }                                                  89 }
 90                                                    90 
 91 //....oooOO0OOooo........oooOO0OOooo........oo     91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 92 G4VParticleChange* G4OpWLS2::PostStepDoIt(cons     92 G4VParticleChange* G4OpWLS2::PostStepDoIt(const G4Track& aTrack,
 93                                           cons     93                                           const G4Step& aStep)
 94 {                                                  94 {
 95   std::vector<G4Track*> proposedSecondaries;       95   std::vector<G4Track*> proposedSecondaries;
 96   aParticleChange.Initialize(aTrack);              96   aParticleChange.Initialize(aTrack);
 97   aParticleChange.ProposeTrackStatus(fStopAndK     97   aParticleChange.ProposeTrackStatus(fStopAndKill);
 98                                                    98 
 99   if(verboseLevel > 1)                             99   if(verboseLevel > 1)
100   {                                               100   {
101     G4cout << "\n** G4OpWLS2: Photon absorbed!    101     G4cout << "\n** G4OpWLS2: Photon absorbed! **" << G4endl;
102   }                                               102   }
103                                                   103 
104   G4StepPoint* pPostStepPoint = aStep.GetPostS    104   G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
105   G4MaterialPropertiesTable* MPT =                105   G4MaterialPropertiesTable* MPT =
106     aTrack.GetMaterial()->GetMaterialPropertie    106     aTrack.GetMaterial()->GetMaterialPropertiesTable();
107   if(!MPT)                                        107   if(!MPT)
108   {                                               108   {
109     return G4VDiscreteProcess::PostStepDoIt(aT    109     return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
110   }                                               110   }
111   if(!MPT->GetProperty(kWLSCOMPONENT2))           111   if(!MPT->GetProperty(kWLSCOMPONENT2))
112   {                                               112   {
113     return G4VDiscreteProcess::PostStepDoIt(aT    113     return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
114   }                                               114   }
115                                                   115 
116   G4int NumPhotons = 1;                           116   G4int NumPhotons = 1;
117   if(MPT->ConstPropertyExists(kWLSMEANNUMBERPH    117   if(MPT->ConstPropertyExists(kWLSMEANNUMBERPHOTONS2))
118   {                                               118   {
119     G4double MeanNumberOfPhotons =                119     G4double MeanNumberOfPhotons =
120       MPT->GetConstProperty(kWLSMEANNUMBERPHOT    120       MPT->GetConstProperty(kWLSMEANNUMBERPHOTONS2);
121     NumPhotons = G4int(G4Poisson(MeanNumberOfP    121     NumPhotons = G4int(G4Poisson(MeanNumberOfPhotons));
122     if(NumPhotons <= 0)                           122     if(NumPhotons <= 0)
123     {                                             123     {
124       // return unchanged particle and no seco    124       // return unchanged particle and no secondaries
125       aParticleChange.SetNumberOfSecondaries(0    125       aParticleChange.SetNumberOfSecondaries(0);
126       return G4VDiscreteProcess::PostStepDoIt(    126       return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
127     }                                             127     }
128   }                                               128   }
129                                                   129 
130   // Retrieve the WLS Integral for this materi    130   // Retrieve the WLS Integral for this material
131   // new G4PhysicsFreeVector allocated to hold    131   // new G4PhysicsFreeVector allocated to hold CII's
132   G4double primaryEnergy = aTrack.GetDynamicPa    132   G4double primaryEnergy = aTrack.GetDynamicParticle()->GetKineticEnergy();
133   G4double WLSTime       = 0.;                    133   G4double WLSTime       = 0.;
134   G4PhysicsFreeVector* WLSIntegral = nullptr;     134   G4PhysicsFreeVector* WLSIntegral = nullptr;
135                                                   135 
136   WLSTime     = MPT->GetConstProperty(kWLSTIME    136   WLSTime     = MPT->GetConstProperty(kWLSTIMECONSTANT2);
137   WLSIntegral = (G4PhysicsFreeVector*) ((*theI    137   WLSIntegral = (G4PhysicsFreeVector*) ((*theIntegralTable)(
138     aTrack.GetMaterial()->GetIndex()));           138     aTrack.GetMaterial()->GetIndex()));
139                                                   139 
140   // Max WLS Integral                             140   // Max WLS Integral
141   G4double CIImax       = WLSIntegral->GetMaxV    141   G4double CIImax       = WLSIntegral->GetMaxValue();
142   G4int NumberOfPhotons = NumPhotons;             142   G4int NumberOfPhotons = NumPhotons;
143                                                   143 
144   for(G4int i = 0; i < NumPhotons; ++i)           144   for(G4int i = 0; i < NumPhotons; ++i)
145   {                                               145   {
146     G4double sampledEnergy;                       146     G4double sampledEnergy;
147     // Make sure the energy of the secondary i    147     // Make sure the energy of the secondary is less than that of the primary
148     for(G4int j = 1; j <= 100; ++j)               148     for(G4int j = 1; j <= 100; ++j)
149     {                                             149     {
150       // Determine photon energy                  150       // Determine photon energy
151       G4double CIIvalue = G4UniformRand() * CI    151       G4double CIIvalue = G4UniformRand() * CIImax;
152       sampledEnergy     = WLSIntegral->GetEner    152       sampledEnergy     = WLSIntegral->GetEnergy(CIIvalue);
153       if(sampledEnergy <= primaryEnergy)          153       if(sampledEnergy <= primaryEnergy)
154         break;                                    154         break;
155     }                                             155     }
156     // If no such energy can be sampled, retur    156     // If no such energy can be sampled, return one less secondary, or none
157     if(sampledEnergy > primaryEnergy)             157     if(sampledEnergy > primaryEnergy)
158     {                                             158     {
159       if(verboseLevel > 1)                        159       if(verboseLevel > 1)
160       {                                           160       {
161         G4cout << " *** G4OpWLS2: One less WLS    161         G4cout << " *** G4OpWLS2: One less WLS2 photon will be returned ***"
162                << G4endl;                         162                << G4endl;
163       }                                           163       }
164       NumberOfPhotons--;                          164       NumberOfPhotons--;
165       if(NumberOfPhotons == 0)                    165       if(NumberOfPhotons == 0)
166       {                                           166       {
167         if(verboseLevel > 1)                      167         if(verboseLevel > 1)
168         {                                         168         {
169           G4cout << " *** G4OpWLS2: No WLS2 ph    169           G4cout << " *** G4OpWLS2: No WLS2 photon can be sampled for this "
170                     "primary ***"                 170                     "primary ***"
171                  << G4endl;                       171                  << G4endl;
172         }                                         172         }
173         // return unchanged particle and no se    173         // return unchanged particle and no secondaries
174         aParticleChange.SetNumberOfSecondaries    174         aParticleChange.SetNumberOfSecondaries(0);
175         return G4VDiscreteProcess::PostStepDoI    175         return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
176       }                                           176       }
177       continue;                                   177       continue;
178     }                                             178     }
179     else if(verboseLevel > 1)                     179     else if(verboseLevel > 1)
180     {                                             180     {
181       G4cout << "G4OpWLS2: Created photon with    181       G4cout << "G4OpWLS2: Created photon with energy: " << sampledEnergy
182              << G4endl;                           182              << G4endl;
183     }                                             183     }
184                                                   184 
185     // Generate random photon direction           185     // Generate random photon direction
186     G4double cost = 1. - 2. * G4UniformRand();    186     G4double cost = 1. - 2. * G4UniformRand();
187     G4double sint = std::sqrt((1. - cost) * (1    187     G4double sint = std::sqrt((1. - cost) * (1. + cost));
188     G4double phi  = twopi * G4UniformRand();      188     G4double phi  = twopi * G4UniformRand();
189     G4double sinp = std::sin(phi);                189     G4double sinp = std::sin(phi);
190     G4double cosp = std::cos(phi);                190     G4double cosp = std::cos(phi);
191     G4ParticleMomentum photonMomentum(sint * c    191     G4ParticleMomentum photonMomentum(sint * cosp, sint * sinp, cost);
192                                                   192 
193     G4ThreeVector photonPolarization(cost * co    193     G4ThreeVector photonPolarization(cost * cosp, cost * sinp, -sint);
194     G4ThreeVector perp = photonMomentum.cross(    194     G4ThreeVector perp = photonMomentum.cross(photonPolarization);
195                                                   195 
196     phi                = twopi * G4UniformRand    196     phi                = twopi * G4UniformRand();
197     sinp               = std::sin(phi);           197     sinp               = std::sin(phi);
198     cosp               = std::cos(phi);           198     cosp               = std::cos(phi);
199     photonPolarization = (cosp * photonPolariz    199     photonPolarization = (cosp * photonPolarization + sinp * perp).unit();
200                                                   200 
201     // Generate a new photon:                     201     // Generate a new photon:
202     auto sec_dp =                                 202     auto sec_dp =
203       new G4DynamicParticle(G4OpticalPhoton::O    203       new G4DynamicParticle(G4OpticalPhoton::OpticalPhoton(), photonMomentum);
204     sec_dp->SetPolarization(photonPolarization    204     sec_dp->SetPolarization(photonPolarization);
205     sec_dp->SetKineticEnergy(sampledEnergy);      205     sec_dp->SetKineticEnergy(sampledEnergy);
206                                                   206 
207     G4double secTime = pPostStepPoint->GetGlob    207     G4double secTime = pPostStepPoint->GetGlobalTime() +
208                        WLSTimeGeneratorProfile    208                        WLSTimeGeneratorProfile->GenerateTime(WLSTime);
209     G4ThreeVector secPos = pPostStepPoint->Get    209     G4ThreeVector secPos = pPostStepPoint->GetPosition();
210     G4Track* secTrack    = new G4Track(sec_dp,    210     G4Track* secTrack    = new G4Track(sec_dp, secTime, secPos);
211                                                   211 
212     secTrack->SetTouchableHandle(aTrack.GetTou    212     secTrack->SetTouchableHandle(aTrack.GetTouchableHandle());
213     secTrack->SetParentID(aTrack.GetTrackID())    213     secTrack->SetParentID(aTrack.GetTrackID());
214                                                   214 
215     proposedSecondaries.push_back(secTrack);      215     proposedSecondaries.push_back(secTrack);
216   }                                               216   }
217                                                   217 
218   aParticleChange.SetNumberOfSecondaries((G4in    218   aParticleChange.SetNumberOfSecondaries((G4int)proposedSecondaries.size());
219   for(auto sec : proposedSecondaries)             219   for(auto sec : proposedSecondaries)
220   {                                               220   {
221     aParticleChange.AddSecondary(sec);            221     aParticleChange.AddSecondary(sec);
222   }                                               222   }
223   if(verboseLevel > 1)                            223   if(verboseLevel > 1)
224   {                                               224   {
225     G4cout << "\n Exiting from G4OpWLS2::DoIt     225     G4cout << "\n Exiting from G4OpWLS2::DoIt -- NumberOfSecondaries = "
226            << aParticleChange.GetNumberOfSecon    226            << aParticleChange.GetNumberOfSecondaries() << G4endl;
227   }                                               227   }
228                                                   228 
229   return G4VDiscreteProcess::PostStepDoIt(aTra    229   return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
230 }                                                 230 }
231                                                   231 
232 //....oooOO0OOooo........oooOO0OOooo........oo    232 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
233 void G4OpWLS2::BuildPhysicsTable(const G4Parti    233 void G4OpWLS2::BuildPhysicsTable(const G4ParticleDefinition&)
234 {                                                 234 {
235   if(theIntegralTable)                            235   if(theIntegralTable)
236   {                                               236   {
237     theIntegralTable->clearAndDestroy();          237     theIntegralTable->clearAndDestroy();
238     delete theIntegralTable;                      238     delete theIntegralTable;
239     theIntegralTable = nullptr;                   239     theIntegralTable = nullptr;
240   }                                               240   }
241                                                   241 
242   const G4MaterialTable* materialTable = G4Mat    242   const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
243   std::size_t numOfMaterials           = G4Mat    243   std::size_t numOfMaterials           = G4Material::GetNumberOfMaterials();
244   theIntegralTable                     = new G    244   theIntegralTable                     = new G4PhysicsTable(numOfMaterials);
245                                                   245 
246   // loop for materials                           246   // loop for materials
247   for(std::size_t i = 0; i < numOfMaterials; +    247   for(std::size_t i = 0; i < numOfMaterials; ++i)
248   {                                               248   {
249     auto physVector = new G4PhysicsFreeVector(    249     auto physVector = new G4PhysicsFreeVector();
250                                                   250 
251     // Retrieve vector of WLS2 wavelength inte    251     // Retrieve vector of WLS2 wavelength intensity for
252     // the material from the material's optica    252     // the material from the material's optical properties table.
253     G4MaterialPropertiesTable* MPT =              253     G4MaterialPropertiesTable* MPT =
254       (*materialTable)[i]->GetMaterialProperti    254       (*materialTable)[i]->GetMaterialPropertiesTable();
255     if(MPT)                                       255     if(MPT)
256     {                                             256     {
257       G4MaterialPropertyVector* wlsVector = MP    257       G4MaterialPropertyVector* wlsVector = MPT->GetProperty(kWLSCOMPONENT2);
258       if(wlsVector)                               258       if(wlsVector)
259       {                                           259       {
260         // Retrieve the first intensity point     260         // Retrieve the first intensity point in vector
261         // of (photon energy, intensity) pairs    261         // of (photon energy, intensity) pairs
262         G4double currentIN = (*wlsVector)[0];     262         G4double currentIN = (*wlsVector)[0];
263         if(currentIN >= 0.0)                      263         if(currentIN >= 0.0)
264         {                                         264         {
265           // Create first (photon energy)         265           // Create first (photon energy)
266           G4double currentPM  = wlsVector->Ene    266           G4double currentPM  = wlsVector->Energy(0);
267           G4double currentCII = 0.0;              267           G4double currentCII = 0.0;
268           physVector->InsertValues(currentPM,     268           physVector->InsertValues(currentPM, currentCII);
269                                                   269 
270           // Set previous values to current on    270           // Set previous values to current ones prior to loop
271           G4double prevPM  = currentPM;           271           G4double prevPM  = currentPM;
272           G4double prevCII = currentCII;          272           G4double prevCII = currentCII;
273           G4double prevIN  = currentIN;           273           G4double prevIN  = currentIN;
274                                                   274 
275           // loop over all (photon energy, int    275           // loop over all (photon energy, intensity)
276           // pairs stored for this material       276           // pairs stored for this material
277           for(std::size_t j = 1; j < wlsVector    277           for(std::size_t j = 1; j < wlsVector->GetVectorLength(); ++j)
278           {                                       278           {
279             currentPM = wlsVector->Energy(j);     279             currentPM = wlsVector->Energy(j);
280             currentIN = (*wlsVector)[j];          280             currentIN = (*wlsVector)[j];
281             currentCII =                          281             currentCII =
282               prevCII + 0.5 * (currentPM - pre    282               prevCII + 0.5 * (currentPM - prevPM) * (prevIN + currentIN);
283                                                   283 
284             physVector->InsertValues(currentPM    284             physVector->InsertValues(currentPM, currentCII);
285                                                   285 
286             prevPM  = currentPM;                  286             prevPM  = currentPM;
287             prevCII = currentCII;                 287             prevCII = currentCII;
288             prevIN  = currentIN;                  288             prevIN  = currentIN;
289           }                                       289           }
290         }                                         290         }
291       }                                           291       }
292     }                                             292     }
293     theIntegralTable->insertAt(i, physVector);    293     theIntegralTable->insertAt(i, physVector);
294   }                                               294   }
295 }                                                 295 }
296                                                   296 
297 //....oooOO0OOooo........oooOO0OOooo........oo    297 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
298 G4double G4OpWLS2::GetMeanFreePath(const G4Tra    298 G4double G4OpWLS2::GetMeanFreePath(const G4Track& aTrack, G4double,
299                                    G4ForceCond    299                                    G4ForceCondition*)
300 {                                                 300 {
301   G4double thePhotonEnergy = aTrack.GetDynamic    301   G4double thePhotonEnergy = aTrack.GetDynamicParticle()->GetTotalEnergy();
302   G4double attLength       = DBL_MAX;             302   G4double attLength       = DBL_MAX;
303   G4MaterialPropertiesTable* MPT =                303   G4MaterialPropertiesTable* MPT =
304     aTrack.GetMaterial()->GetMaterialPropertie    304     aTrack.GetMaterial()->GetMaterialPropertiesTable();
305                                                   305 
306   if(MPT)                                         306   if(MPT)
307   {                                               307   {
308     G4MaterialPropertyVector* attVector = MPT-    308     G4MaterialPropertyVector* attVector = MPT->GetProperty(kWLSABSLENGTH2);
309     if(attVector)                                 309     if(attVector)
310     {                                             310     {
311       attLength = attVector->Value(thePhotonEn    311       attLength = attVector->Value(thePhotonEnergy, idx_wls2);
312     }                                             312     }
313   }                                               313   }
314   return attLength;                               314   return attLength;
315 }                                                 315 }
316                                                   316 
317 //....oooOO0OOooo........oooOO0OOooo........oo    317 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
318 void G4OpWLS2::UseTimeProfile(const G4String n    318 void G4OpWLS2::UseTimeProfile(const G4String name)
319 {                                                 319 {
320   if(WLSTimeGeneratorProfile)                     320   if(WLSTimeGeneratorProfile)
321   {                                               321   {
322     delete WLSTimeGeneratorProfile;               322     delete WLSTimeGeneratorProfile;
323     WLSTimeGeneratorProfile = nullptr;            323     WLSTimeGeneratorProfile = nullptr;
324   }                                               324   }
325   if(name == "delta")                             325   if(name == "delta")
326   {                                               326   {
327     WLSTimeGeneratorProfile = new G4WLSTimeGen    327     WLSTimeGeneratorProfile = new G4WLSTimeGeneratorProfileDelta("delta");
328   }                                               328   }
329   else if(name == "exponential")                  329   else if(name == "exponential")
330   {                                               330   {
331     WLSTimeGeneratorProfile =                     331     WLSTimeGeneratorProfile =
332       new G4WLSTimeGeneratorProfileExponential    332       new G4WLSTimeGeneratorProfileExponential("exponential");
333   }                                               333   }
334   else                                            334   else
335   {                                               335   {
336     G4Exception("G4OpWLS::UseTimeProfile", "em    336     G4Exception("G4OpWLS::UseTimeProfile", "em0202", FatalException,
337                 "generator does not exist");      337                 "generator does not exist");
338   }                                               338   }
339   G4OpticalParameters::Instance()->SetWLS2Time    339   G4OpticalParameters::Instance()->SetWLS2TimeProfile(name);
340 }                                                 340 }
341                                                   341 
342 //....oooOO0OOooo........oooOO0OOooo........oo    342 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
343 void G4OpWLS2::SetVerboseLevel(G4int verbose)     343 void G4OpWLS2::SetVerboseLevel(G4int verbose)
344 {                                                 344 {
345   verboseLevel = verbose;                         345   verboseLevel = verbose;
346   G4OpticalParameters::Instance()->SetWLS2Verb    346   G4OpticalParameters::Instance()->SetWLS2VerboseLevel(verboseLevel);
347 }                                                 347 }
348                                                   348