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 6.2.p2)


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