Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/optical/src/G4OpWLS.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/G4OpWLS.cc (Version 11.3.0) and /processes/optical/src/G4OpWLS.cc (Version 10.7.p2)


  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:        G4OpWLS.cc                         32 // File:        G4OpWLS.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 "G4OpWLS.hh"                              43 #include "G4OpWLS.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 G4OpWLS::G4OpWLS(const G4String& processName,      54 G4OpWLS::G4OpWLS(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(fOpWLS);                       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 G4OpWLS::~G4OpWLS()                                67 G4OpWLS::~G4OpWLS()
 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 G4OpWLS::PreparePhysicsTable(const G4Part     78 void G4OpWLS::PreparePhysicsTable(const G4ParticleDefinition&) { Initialise(); }
 79                                                    79 
 80 //....oooOO0OOooo........oooOO0OOooo........oo     80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 81 void G4OpWLS::Initialise()                         81 void G4OpWLS::Initialise()
 82 {                                                  82 {
 83   G4OpticalParameters* params = G4OpticalParam     83   G4OpticalParameters* params = G4OpticalParameters::Instance();
 84   SetVerboseLevel(params->GetWLSVerboseLevel()     84   SetVerboseLevel(params->GetWLSVerboseLevel());
 85   UseTimeProfile(params->GetWLSTimeProfile());     85   UseTimeProfile(params->GetWLSTimeProfile());
 86 }                                                  86 }
 87                                                    87 
 88 //....oooOO0OOooo........oooOO0OOooo........oo     88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 89 G4VParticleChange* G4OpWLS::PostStepDoIt(const     89 G4VParticleChange* G4OpWLS::PostStepDoIt(const G4Track& aTrack,
 90                                          const     90                                          const G4Step& aStep)
 91 {                                                  91 {
 92   std::vector<G4Track*> proposedSecondaries;       92   std::vector<G4Track*> proposedSecondaries;
 93   aParticleChange.Initialize(aTrack);              93   aParticleChange.Initialize(aTrack);
 94   aParticleChange.ProposeTrackStatus(fStopAndK     94   aParticleChange.ProposeTrackStatus(fStopAndKill);
 95                                                    95 
 96   if(verboseLevel > 1)                             96   if(verboseLevel > 1)
 97   {                                                97   {
 98     G4cout << "\n** G4OpWLS: Photon absorbed!      98     G4cout << "\n** G4OpWLS: Photon absorbed! **" << G4endl;
 99   }                                                99   }
100                                                   100 
101   G4StepPoint* pPostStepPoint = aStep.GetPostS    101   G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
102   G4MaterialPropertiesTable* MPT =                102   G4MaterialPropertiesTable* MPT =
103     aTrack.GetMaterial()->GetMaterialPropertie    103     aTrack.GetMaterial()->GetMaterialPropertiesTable();
104   if(!MPT)                                        104   if(!MPT)
105   {                                               105   {
106     return G4VDiscreteProcess::PostStepDoIt(aT    106     return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
107   }                                               107   }
108   if(!MPT->GetProperty(kWLSCOMPONENT))            108   if(!MPT->GetProperty(kWLSCOMPONENT))
109   {                                               109   {
110     return G4VDiscreteProcess::PostStepDoIt(aT    110     return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
111   }                                               111   }
112                                                   112 
113   G4int NumPhotons = 1;                           113   G4int NumPhotons = 1;
114   if(MPT->ConstPropertyExists(kWLSMEANNUMBERPH    114   if(MPT->ConstPropertyExists(kWLSMEANNUMBERPHOTONS))
115   {                                               115   {
116     G4double MeanNumberOfPhotons = MPT->GetCon    116     G4double MeanNumberOfPhotons = MPT->GetConstProperty(kWLSMEANNUMBERPHOTONS);
117     NumPhotons                   = G4int(G4Poi    117     NumPhotons                   = G4int(G4Poisson(MeanNumberOfPhotons));
118     if(NumPhotons <= 0)                           118     if(NumPhotons <= 0)
119     {                                             119     {
120       // return unchanged particle and no seco    120       // return unchanged particle and no secondaries
121       aParticleChange.SetNumberOfSecondaries(0    121       aParticleChange.SetNumberOfSecondaries(0);
122       return G4VDiscreteProcess::PostStepDoIt(    122       return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
123     }                                             123     }
124   }                                               124   }
125                                                   125 
126   // Retrieve the WLS Integral for this materi    126   // Retrieve the WLS Integral for this material
127   // new G4PhysicsFreeVector allocated to hold << 127   // new G4PhysicsOrderedFreeVector allocated to hold CII's
128   G4double primaryEnergy = aTrack.GetDynamicPa    128   G4double primaryEnergy = aTrack.GetDynamicParticle()->GetKineticEnergy();
129   G4double WLSTime       = 0.;                    129   G4double WLSTime       = 0.;
130   G4PhysicsFreeVector* WLSIntegral = nullptr;  << 130   G4PhysicsOrderedFreeVector* WLSIntegral = nullptr;
131                                                   131 
132   WLSTime     = MPT->GetConstProperty(kWLSTIME    132   WLSTime     = MPT->GetConstProperty(kWLSTIMECONSTANT);
133   WLSIntegral = (G4PhysicsFreeVector*) ((*theI << 133   WLSIntegral = (G4PhysicsOrderedFreeVector*) ((*theIntegralTable)(
134     aTrack.GetMaterial()->GetIndex()));           134     aTrack.GetMaterial()->GetIndex()));
135                                                   135 
136   // Max WLS Integral                             136   // Max WLS Integral
137   G4double CIImax       = WLSIntegral->GetMaxV    137   G4double CIImax       = WLSIntegral->GetMaxValue();
138   G4int NumberOfPhotons = NumPhotons;             138   G4int NumberOfPhotons = NumPhotons;
139                                                   139 
140   for(G4int i = 0; i < NumPhotons; ++i)           140   for(G4int i = 0; i < NumPhotons; ++i)
141   {                                               141   {
142     G4double sampledEnergy;                       142     G4double sampledEnergy;
143     // Make sure the energy of the secondary i    143     // Make sure the energy of the secondary is less than that of the primary
144     for(G4int j = 1; j <= 100; ++j)               144     for(G4int j = 1; j <= 100; ++j)
145     {                                             145     {
146       // Determine photon energy                  146       // Determine photon energy
147       G4double CIIvalue = G4UniformRand() * CI    147       G4double CIIvalue = G4UniformRand() * CIImax;
148       sampledEnergy     = WLSIntegral->GetEner    148       sampledEnergy     = WLSIntegral->GetEnergy(CIIvalue);
149       if(sampledEnergy <= primaryEnergy)          149       if(sampledEnergy <= primaryEnergy)
150         break;                                    150         break;
151     }                                             151     }
152     // If no such energy can be sampled, retur    152     // If no such energy can be sampled, return one less secondary, or none
153     if(sampledEnergy > primaryEnergy)             153     if(sampledEnergy > primaryEnergy)
154     {                                             154     {
155       if(verboseLevel > 1)                        155       if(verboseLevel > 1)
156       {                                           156       {
157         G4cout << " *** G4OpWLS: One less WLS     157         G4cout << " *** G4OpWLS: One less WLS photon will be returned ***"
158                << G4endl;                         158                << G4endl;
159       }                                           159       }
160       NumberOfPhotons--;                          160       NumberOfPhotons--;
161       if(NumberOfPhotons == 0)                    161       if(NumberOfPhotons == 0)
162       {                                           162       {
163         if(verboseLevel > 1)                      163         if(verboseLevel > 1)
164         {                                         164         {
165           G4cout                                  165           G4cout
166             << " *** G4OpWLS: No WLS photon ca    166             << " *** G4OpWLS: No WLS photon can be sampled for this primary ***"
167             << G4endl;                            167             << G4endl;
168         }                                         168         }
169         // return unchanged particle and no se    169         // return unchanged particle and no secondaries
170         aParticleChange.SetNumberOfSecondaries    170         aParticleChange.SetNumberOfSecondaries(0);
171         return G4VDiscreteProcess::PostStepDoI    171         return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
172       }                                           172       }
173       continue;                                   173       continue;
174     }                                             174     }
175     else if(verboseLevel > 1)                     175     else if(verboseLevel > 1)
176     {                                             176     {
177       G4cout << "G4OpWLS: Created photon with     177       G4cout << "G4OpWLS: Created photon with energy: " << sampledEnergy
178              << G4endl;                           178              << G4endl;
179     }                                             179     }
180                                                   180 
181     // Generate random photon direction           181     // Generate random photon direction
182     G4double cost = 1. - 2. * G4UniformRand();    182     G4double cost = 1. - 2. * G4UniformRand();
183     G4double sint = std::sqrt((1. - cost) * (1    183     G4double sint = std::sqrt((1. - cost) * (1. + cost));
184     G4double phi  = twopi * G4UniformRand();      184     G4double phi  = twopi * G4UniformRand();
185     G4double sinp = std::sin(phi);                185     G4double sinp = std::sin(phi);
186     G4double cosp = std::cos(phi);                186     G4double cosp = std::cos(phi);
187     G4ParticleMomentum photonMomentum(sint * c    187     G4ParticleMomentum photonMomentum(sint * cosp, sint * sinp, cost);
188                                                   188 
189     G4ThreeVector photonPolarization(cost * co    189     G4ThreeVector photonPolarization(cost * cosp, cost * sinp, -sint);
190     G4ThreeVector perp = photonMomentum.cross(    190     G4ThreeVector perp = photonMomentum.cross(photonPolarization);
191                                                   191 
192     phi                = twopi * G4UniformRand    192     phi                = twopi * G4UniformRand();
193     sinp               = std::sin(phi);           193     sinp               = std::sin(phi);
194     cosp               = std::cos(phi);           194     cosp               = std::cos(phi);
195     photonPolarization = (cosp * photonPolariz    195     photonPolarization = (cosp * photonPolarization + sinp * perp).unit();
196                                                   196 
197     // Generate a new photon:                     197     // Generate a new photon:
198     auto sec_dp =                              << 198     G4DynamicParticle* sec_dp =
199       new G4DynamicParticle(G4OpticalPhoton::O    199       new G4DynamicParticle(G4OpticalPhoton::OpticalPhoton(), photonMomentum);
200     sec_dp->SetPolarization(photonPolarization    200     sec_dp->SetPolarization(photonPolarization);
201     sec_dp->SetKineticEnergy(sampledEnergy);      201     sec_dp->SetKineticEnergy(sampledEnergy);
202                                                   202 
203     G4double secTime = pPostStepPoint->GetGlob    203     G4double secTime = pPostStepPoint->GetGlobalTime() +
204                        WLSTimeGeneratorProfile    204                        WLSTimeGeneratorProfile->GenerateTime(WLSTime);
205     G4ThreeVector secPos = pPostStepPoint->Get    205     G4ThreeVector secPos = pPostStepPoint->GetPosition();
206     G4Track* secTrack    = new G4Track(sec_dp,    206     G4Track* secTrack    = new G4Track(sec_dp, secTime, secPos);
207                                                   207 
208     secTrack->SetTouchableHandle(aTrack.GetTou    208     secTrack->SetTouchableHandle(aTrack.GetTouchableHandle());
209     secTrack->SetParentID(aTrack.GetTrackID())    209     secTrack->SetParentID(aTrack.GetTrackID());
210                                                   210 
211     proposedSecondaries.push_back(secTrack);      211     proposedSecondaries.push_back(secTrack);
212   }                                               212   }
213                                                   213 
214   aParticleChange.SetNumberOfSecondaries((G4in << 214   aParticleChange.SetNumberOfSecondaries(proposedSecondaries.size());
215   for(auto sec : proposedSecondaries)             215   for(auto sec : proposedSecondaries)
216   {                                               216   {
217     aParticleChange.AddSecondary(sec);            217     aParticleChange.AddSecondary(sec);
218   }                                               218   }
219   if(verboseLevel > 1)                            219   if(verboseLevel > 1)
220   {                                               220   {
221     G4cout << "\n Exiting from G4OpWLS::DoIt -    221     G4cout << "\n Exiting from G4OpWLS::DoIt -- NumberOfSecondaries = "
222            << aParticleChange.GetNumberOfSecon    222            << aParticleChange.GetNumberOfSecondaries() << G4endl;
223   }                                               223   }
224                                                   224 
225   return G4VDiscreteProcess::PostStepDoIt(aTra    225   return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
226 }                                                 226 }
227                                                   227 
228 //....oooOO0OOooo........oooOO0OOooo........oo    228 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
229 void G4OpWLS::BuildPhysicsTable(const G4Partic    229 void G4OpWLS::BuildPhysicsTable(const G4ParticleDefinition&)
230 {                                                 230 {
231   if(theIntegralTable)                            231   if(theIntegralTable)
232   {                                               232   {
233     theIntegralTable->clearAndDestroy();          233     theIntegralTable->clearAndDestroy();
234     delete theIntegralTable;                      234     delete theIntegralTable;
235     theIntegralTable = nullptr;                   235     theIntegralTable = nullptr;
236   }                                               236   }
237                                                   237 
238   const G4MaterialTable* materialTable = G4Mat    238   const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
239   std::size_t numOfMaterials           = G4Mat << 239   G4int numOfMaterials                 = G4Material::GetNumberOfMaterials();
240   theIntegralTable                     = new G    240   theIntegralTable                     = new G4PhysicsTable(numOfMaterials);
241                                                   241 
242   // loop for materials                           242   // loop for materials
243   for(std::size_t i = 0; i < numOfMaterials; + << 243   for(G4int i = 0; i < numOfMaterials; ++i)
244   {                                               244   {
245     auto physVector = new G4PhysicsFreeVector( << 245     G4PhysicsOrderedFreeVector* physVector = new G4PhysicsOrderedFreeVector();
246                                                   246 
247     // Retrieve vector of WLS wavelength inten    247     // Retrieve vector of WLS wavelength intensity for
248     // the material from the material's optica    248     // the material from the material's optical properties table.
249     G4MaterialPropertiesTable* MPT =              249     G4MaterialPropertiesTable* MPT =
250       (*materialTable)[i]->GetMaterialProperti    250       (*materialTable)[i]->GetMaterialPropertiesTable();
251     if(MPT)                                       251     if(MPT)
252     {                                             252     {
253       G4MaterialPropertyVector* wlsVector = MP    253       G4MaterialPropertyVector* wlsVector = MPT->GetProperty(kWLSCOMPONENT);
254       if(wlsVector)                               254       if(wlsVector)
255       {                                           255       {
256         // Retrieve the first intensity point     256         // Retrieve the first intensity point in vector
257         // of (photon energy, intensity) pairs    257         // of (photon energy, intensity) pairs
258         G4double currentIN = (*wlsVector)[0];     258         G4double currentIN = (*wlsVector)[0];
259         if(currentIN >= 0.0)                      259         if(currentIN >= 0.0)
260         {                                         260         {
261           // Create first (photon energy)         261           // Create first (photon energy)
262           G4double currentPM  = wlsVector->Ene    262           G4double currentPM  = wlsVector->Energy(0);
263           G4double currentCII = 0.0;              263           G4double currentCII = 0.0;
264           physVector->InsertValues(currentPM,     264           physVector->InsertValues(currentPM, currentCII);
265                                                   265 
266           // Set previous values to current on    266           // Set previous values to current ones prior to loop
267           G4double prevPM  = currentPM;           267           G4double prevPM  = currentPM;
268           G4double prevCII = currentCII;          268           G4double prevCII = currentCII;
269           G4double prevIN  = currentIN;           269           G4double prevIN  = currentIN;
270                                                   270 
271           // loop over all (photon energy, int    271           // loop over all (photon energy, intensity)
272           // pairs stored for this material       272           // pairs stored for this material
273           for(std::size_t j = 1; j < wlsVector << 273           for(size_t j = 1; j < wlsVector->GetVectorLength(); ++j)
274           {                                       274           {
275             currentPM = wlsVector->Energy(j);     275             currentPM = wlsVector->Energy(j);
276             currentIN = (*wlsVector)[j];          276             currentIN = (*wlsVector)[j];
277             currentCII =                          277             currentCII =
278               prevCII + 0.5 * (currentPM - pre    278               prevCII + 0.5 * (currentPM - prevPM) * (prevIN + currentIN);
279                                                   279 
280             physVector->InsertValues(currentPM    280             physVector->InsertValues(currentPM, currentCII);
281                                                   281 
282             prevPM  = currentPM;                  282             prevPM  = currentPM;
283             prevCII = currentCII;                 283             prevCII = currentCII;
284             prevIN  = currentIN;                  284             prevIN  = currentIN;
285           }                                       285           }
286         }                                         286         }
287       }                                           287       }
288     }                                             288     }
289     theIntegralTable->insertAt(i, physVector);    289     theIntegralTable->insertAt(i, physVector);
290   }                                               290   }
291 }                                                 291 }
292                                                   292 
293 //....oooOO0OOooo........oooOO0OOooo........oo    293 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
294 G4double G4OpWLS::GetMeanFreePath(const G4Trac    294 G4double G4OpWLS::GetMeanFreePath(const G4Track& aTrack, G4double,
295                                   G4ForceCondi    295                                   G4ForceCondition*)
296 {                                                 296 {
297   G4double thePhotonEnergy = aTrack.GetDynamic    297   G4double thePhotonEnergy = aTrack.GetDynamicParticle()->GetTotalEnergy();
298   G4double attLength       = DBL_MAX;             298   G4double attLength       = DBL_MAX;
299   G4MaterialPropertiesTable* MPT =                299   G4MaterialPropertiesTable* MPT =
300     aTrack.GetMaterial()->GetMaterialPropertie    300     aTrack.GetMaterial()->GetMaterialPropertiesTable();
301                                                   301 
302   if(MPT)                                         302   if(MPT)
303   {                                               303   {
304     G4MaterialPropertyVector* attVector = MPT-    304     G4MaterialPropertyVector* attVector = MPT->GetProperty(kWLSABSLENGTH);
305     if(attVector)                                 305     if(attVector)
306     {                                             306     {
307       attLength = attVector->Value(thePhotonEn    307       attLength = attVector->Value(thePhotonEnergy, idx_wls);
308     }                                             308     }
309   }                                               309   }
310   return attLength;                               310   return attLength;
311 }                                                 311 }
312                                                   312 
313 //....oooOO0OOooo........oooOO0OOooo........oo    313 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
314 void G4OpWLS::UseTimeProfile(const G4String na    314 void G4OpWLS::UseTimeProfile(const G4String name)
315 {                                                 315 {
316   if(WLSTimeGeneratorProfile)                     316   if(WLSTimeGeneratorProfile)
317   {                                               317   {
318     delete WLSTimeGeneratorProfile;               318     delete WLSTimeGeneratorProfile;
319     WLSTimeGeneratorProfile = nullptr;            319     WLSTimeGeneratorProfile = nullptr;
320   }                                               320   }
321   if(name == "delta")                          << 321   if(name.compare("delta") == 0)
322   {                                               322   {
323     WLSTimeGeneratorProfile = new G4WLSTimeGen    323     WLSTimeGeneratorProfile = new G4WLSTimeGeneratorProfileDelta("delta");
324   }                                               324   }
325   else if(name == "exponential")               << 325   else if(name.compare("exponential") == 0)
326   {                                               326   {
327     WLSTimeGeneratorProfile =                     327     WLSTimeGeneratorProfile =
328       new G4WLSTimeGeneratorProfileExponential    328       new G4WLSTimeGeneratorProfileExponential("exponential");
329   }                                               329   }
330   else                                            330   else
331   {                                               331   {
332     G4Exception("G4OpWLS::UseTimeProfile", "em    332     G4Exception("G4OpWLS::UseTimeProfile", "em0202", FatalException,
333                 "generator does not exist");      333                 "generator does not exist");
334   }                                               334   }
335   G4OpticalParameters::Instance()->SetWLSTimeP << 
336 }                                              << 
337                                                << 
338 //....oooOO0OOooo........oooOO0OOooo........oo << 
339 void G4OpWLS::SetVerboseLevel(G4int verbose)   << 
340 {                                              << 
341   verboseLevel = verbose;                      << 
342   G4OpticalParameters::Instance()->SetWLSVerbo << 
343 }                                                 335 }
344                                                   336