Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4OpWLS Class Reference

#include <G4OpWLS.hh>

Inheritance diagram for G4OpWLS:
Collaboration diagram for G4OpWLS:

Public Member Functions

 G4OpWLS (const G4String &processName="OpWLS", G4ProcessType type=fOptical)
 
 ~G4OpWLS ()
 
G4bool IsApplicable (const G4ParticleDefinition &aParticleType)
 
void BuildPhysicsTable (const G4ParticleDefinition &aParticleType)
 
G4double GetMeanFreePath (const G4Track &aTrack, G4double, G4ForceCondition *)
 
G4VParticleChangePostStepDoIt (const G4Track &aTrack, const G4Step &aStep)
 
G4PhysicsTableGetIntegralTable () const
 
void DumpPhysicsTable () const
 
void UseTimeProfile (const G4String name)
 
- Public Member Functions inherited from G4VDiscreteProcess
 G4VDiscreteProcess (const G4String &, G4ProcessType aType=fNotDefined)
 
 G4VDiscreteProcess (G4VDiscreteProcess &)
 
virtual ~G4VDiscreteProcess ()
 
virtual G4double PostStepGetPhysicalInteractionLength (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
 
virtual G4double AlongStepGetPhysicalInteractionLength (const G4Track &, G4double, G4double, G4double &, G4GPILSelection *)
 
virtual G4double AtRestGetPhysicalInteractionLength (const G4Track &, G4ForceCondition *)
 
virtual G4VParticleChangeAtRestDoIt (const G4Track &, const G4Step &)
 
virtual G4VParticleChangeAlongStepDoIt (const G4Track &, const G4Step &)
 
- Public Member Functions inherited from G4VProcess
 G4VProcess (const G4String &aName="NoName", G4ProcessType aType=fNotDefined)
 
 G4VProcess (const G4VProcess &right)
 
virtual ~G4VProcess ()
 
G4int operator== (const G4VProcess &right) const
 
G4int operator!= (const G4VProcess &right) const
 
G4double GetCurrentInteractionLength () const
 
void SetPILfactor (G4double value)
 
G4double GetPILfactor () const
 
G4double AlongStepGPIL (const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
 
G4double AtRestGPIL (const G4Track &track, G4ForceCondition *condition)
 
G4double PostStepGPIL (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
 
virtual void PreparePhysicsTable (const G4ParticleDefinition &)
 
virtual G4bool StorePhysicsTable (const G4ParticleDefinition *, const G4String &, G4bool)
 
virtual G4bool RetrievePhysicsTable (const G4ParticleDefinition *, const G4String &, G4bool)
 
const G4StringGetPhysicsTableFileName (const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
 
const G4StringGetProcessName () const
 
G4ProcessType GetProcessType () const
 
void SetProcessType (G4ProcessType)
 
G4int GetProcessSubType () const
 
void SetProcessSubType (G4int)
 
virtual void StartTracking (G4Track *)
 
virtual void EndTracking ()
 
virtual void SetProcessManager (const G4ProcessManager *)
 
virtual const G4ProcessManagerGetProcessManager ()
 
virtual void ResetNumberOfInteractionLengthLeft ()
 
G4double GetNumberOfInteractionLengthLeft () const
 
G4double GetTotalNumberOfInteractionLengthTraversed () const
 
G4bool isAtRestDoItIsEnabled () const
 
G4bool isAlongStepDoItIsEnabled () const
 
G4bool isPostStepDoItIsEnabled () const
 
virtual void DumpInfo () const
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
virtual void SetMasterProcess (G4VProcess *masterP)
 
const G4VProcessGetMasterProcess () const
 
virtual void BuildWorkerPhysicsTable (const G4ParticleDefinition &part)
 
virtual void PrepareWorkerPhysicsTable (const G4ParticleDefinition &)
 

Protected Attributes

G4VWLSTimeGeneratorProfileWLSTimeGeneratorProfile
 
G4PhysicsTabletheIntegralTable
 
- Protected Attributes inherited from G4VProcess
const G4ProcessManageraProcessManager
 
G4VParticleChangepParticleChange
 
G4ParticleChange aParticleChange
 
G4double theNumberOfInteractionLengthLeft
 
G4double currentInteractionLength
 
G4double theInitialNumberOfInteractionLength
 
G4String theProcessName
 
G4String thePhysicsTableFileName
 
G4ProcessType theProcessType
 
G4int theProcessSubType
 
G4double thePILfactor
 
G4bool enableAtRestDoIt
 
G4bool enableAlongStepDoIt
 
G4bool enablePostStepDoIt
 
G4int verboseLevel
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VProcess
static const G4StringGetProcessTypeName (G4ProcessType)
 
- Protected Member Functions inherited from G4VProcess
void SubtractNumberOfInteractionLengthLeft (G4double previousStepSize)
 
void ClearNumberOfInteractionLengthLeft ()
 

Detailed Description

Definition at line 80 of file G4OpWLS.hh.

Constructor & Destructor Documentation

G4OpWLS::G4OpWLS ( const G4String processName = "OpWLS",
G4ProcessType  type = fOptical 
)

Definition at line 68 of file G4OpWLS.cc.

69  : G4VDiscreteProcess(processName, type)
70 {
72 
73  theIntegralTable = NULL;
74 
76  new G4WLSTimeGeneratorProfileDelta("WLSTimeGeneratorProfileDelta");
77 
78  if (verboseLevel>0) G4cout << GetProcessName() << " is created " << G4endl;
79 }
G4int verboseLevel
Definition: G4VProcess.hh:368
G4GLOB_DLL std::ostream G4cout
G4VWLSTimeGeneratorProfile * WLSTimeGeneratorProfile
Definition: G4OpWLS.hh:137
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:432
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
#define G4endl
Definition: G4ios.hh:61
G4PhysicsTable * theIntegralTable
Definition: G4OpWLS.hh:138

Here is the call graph for this function:

G4OpWLS::~G4OpWLS ( )

Definition at line 85 of file G4OpWLS.cc.

86 {
87  if (theIntegralTable) {
89  delete theIntegralTable;
90  }
92 }
G4VWLSTimeGeneratorProfile * WLSTimeGeneratorProfile
Definition: G4OpWLS.hh:137
G4PhysicsTable * theIntegralTable
Definition: G4OpWLS.hh:138
void clearAndDestroy()

Here is the call graph for this function:

Member Function Documentation

void G4OpWLS::BuildPhysicsTable ( const G4ParticleDefinition aParticleType)
virtual

Reimplemented from G4VProcess.

Definition at line 287 of file G4OpWLS.cc.

288 {
289  if (theIntegralTable) {
291  delete theIntegralTable;
292  theIntegralTable = NULL;
293  }
294 
295  const G4MaterialTable* theMaterialTable =
297  G4int numOfMaterials = G4Material::GetNumberOfMaterials();
298 
299  // create new physics table
300 
301  theIntegralTable = new G4PhysicsTable(numOfMaterials);
302 
303  // loop for materials
304 
305  for (G4int i=0 ; i < numOfMaterials; i++)
306  {
307  G4PhysicsOrderedFreeVector* aPhysicsOrderedFreeVector =
309 
310  // Retrieve vector of WLS wavelength intensity for
311  // the material from the material's optical properties table.
312 
313  G4Material* aMaterial = (*theMaterialTable)[i];
314 
315  G4MaterialPropertiesTable* aMaterialPropertiesTable =
316  aMaterial->GetMaterialPropertiesTable();
317 
318  if (aMaterialPropertiesTable) {
319 
320  G4MaterialPropertyVector* theWLSVector =
321  aMaterialPropertiesTable->GetProperty("WLSCOMPONENT");
322 
323  if (theWLSVector) {
324 
325  // Retrieve the first intensity point in vector
326  // of (photon energy, intensity) pairs
327 
328  G4double currentIN = (*theWLSVector)[0];
329 
330  if (currentIN >= 0.0) {
331 
332  // Create first (photon energy)
333 
334  G4double currentPM = theWLSVector->Energy(0);
335 
336  G4double currentCII = 0.0;
337 
338  aPhysicsOrderedFreeVector->
339  InsertValues(currentPM , currentCII);
340 
341  // Set previous values to current ones prior to loop
342 
343  G4double prevPM = currentPM;
344  G4double prevCII = currentCII;
345  G4double prevIN = currentIN;
346 
347  // loop over all (photon energy, intensity)
348  // pairs stored for this material
349 
350  for (size_t j = 1;
351  j < theWLSVector->GetVectorLength();
352  j++)
353  {
354  currentPM = theWLSVector->Energy(j);
355  currentIN = (*theWLSVector)[j];
356 
357  currentCII = 0.5 * (prevIN + currentIN);
358 
359  currentCII = prevCII +
360  (currentPM - prevPM) * currentCII;
361 
362  aPhysicsOrderedFreeVector->
363  InsertValues(currentPM, currentCII);
364 
365  prevPM = currentPM;
366  prevCII = currentCII;
367  prevIN = currentIN;
368  }
369  }
370  }
371  }
372  // The WLS integral for a given material
373  // will be inserted in the table according to the
374  // position of the material in the material table.
375 
376  theIntegralTable->insertAt(i,aPhysicsOrderedFreeVector);
377  }
378 }
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:587
std::vector< G4Material * > G4MaterialTable
size_t GetVectorLength() const
int G4int
Definition: G4Types.hh:78
G4double Energy(size_t index) const
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:594
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
Definition: G4Material.hh:252
void insertAt(size_t, G4PhysicsVector *)
double G4double
Definition: G4Types.hh:76
G4PhysicsTable * theIntegralTable
Definition: G4OpWLS.hh:138
G4MaterialPropertyVector * GetProperty(const char *key)
void clearAndDestroy()

Here is the call graph for this function:

void G4OpWLS::DumpPhysicsTable ( ) const
inline

Definition at line 159 of file G4OpWLS.hh.

160 {
161  G4int PhysicsTableSize = theIntegralTable->entries();
163 
164  for (G4int i = 0 ; i < PhysicsTableSize ; i++ )
165  {
167  v->DumpValues();
168  }
169 }
void DumpValues(G4double unitE=1.0, G4double unitV=1.0) const
int G4int
Definition: G4Types.hh:78
tuple v
Definition: test.py:18
G4PhysicsTable * theIntegralTable
Definition: G4OpWLS.hh:138
size_t entries() const

Here is the call graph for this function:

G4PhysicsTable * G4OpWLS::GetIntegralTable ( ) const
inline

Definition at line 153 of file G4OpWLS.hh.

154 {
155  return theIntegralTable;
156 }
G4PhysicsTable * theIntegralTable
Definition: G4OpWLS.hh:138
G4double G4OpWLS::GetMeanFreePath ( const G4Track aTrack,
G4double  ,
G4ForceCondition  
)
virtual

Implements G4VDiscreteProcess.

Definition at line 383 of file G4OpWLS.cc.

386 {
387  const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
388  const G4Material* aMaterial = aTrack.GetMaterial();
389 
390  G4double thePhotonEnergy = aParticle->GetTotalEnergy();
391 
392  G4MaterialPropertiesTable* aMaterialPropertyTable;
393  G4MaterialPropertyVector* AttenuationLengthVector;
394 
395  G4double AttenuationLength = DBL_MAX;
396 
397  aMaterialPropertyTable = aMaterial->GetMaterialPropertiesTable();
398 
399  if ( aMaterialPropertyTable ) {
400  AttenuationLengthVector = aMaterialPropertyTable->
401  GetProperty("WLSABSLENGTH");
402  if ( AttenuationLengthVector ){
403  AttenuationLength = AttenuationLengthVector->
404  Value(thePhotonEnergy);
405  }
406  else {
407  // G4cout << "No WLS absorption length specified" << G4endl;
408  }
409  }
410  else {
411  // G4cout << "No WLS absortion length specified" << G4endl;
412  }
413 
414  return AttenuationLength;
415 }
G4double GetTotalEnergy() const
const G4DynamicParticle * GetDynamicParticle() const
G4Material * GetMaterial() const
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
Definition: G4Material.hh:252
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83

Here is the call graph for this function:

G4bool G4OpWLS::IsApplicable ( const G4ParticleDefinition aParticleType)
inlinevirtual

Reimplemented from G4VProcess.

Definition at line 147 of file G4OpWLS.hh.

148 {
149  return ( &aParticleType == G4OpticalPhoton::OpticalPhoton() );
150 }
static G4OpticalPhoton * OpticalPhoton()

Here is the call graph for this function:

G4VParticleChange * G4OpWLS::PostStepDoIt ( const G4Track aTrack,
const G4Step aStep 
)
virtual

Reimplemented from G4VDiscreteProcess.

Definition at line 102 of file G4OpWLS.cc.

103 {
104  aParticleChange.Initialize(aTrack);
105 
107 
108  if (verboseLevel>0) {
109  G4cout << "\n** Photon absorbed! **" << G4endl;
110  }
111 
112  const G4Material* aMaterial = aTrack.GetMaterial();
113 
114  G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
115 
116  G4MaterialPropertiesTable* aMaterialPropertiesTable =
117  aMaterial->GetMaterialPropertiesTable();
118  if (!aMaterialPropertiesTable)
119  return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
120 
121  const G4MaterialPropertyVector* WLS_Intensity =
122  aMaterialPropertiesTable->GetProperty("WLSCOMPONENT");
123 
124  if (!WLS_Intensity)
125  return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
126 
127  G4int NumPhotons = 1;
128 
129  if (aMaterialPropertiesTable->ConstPropertyExists("WLSMEANNUMBERPHOTONS")) {
130 
131  G4double MeanNumberOfPhotons = aMaterialPropertiesTable->
132  GetConstProperty("WLSMEANNUMBERPHOTONS");
133 
134  NumPhotons = G4int(G4Poisson(MeanNumberOfPhotons));
135 
136  if (NumPhotons <= 0) {
137 
138  // return unchanged particle and no secondaries
139 
141 
142  return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
143 
144  }
145 
146  }
147 
149 
150  G4double primaryEnergy = aTrack.GetDynamicParticle()->GetKineticEnergy();
151 
152  G4int materialIndex = aMaterial->GetIndex();
153 
154  // Retrieve the WLS Integral for this material
155  // new G4PhysicsOrderedFreeVector allocated to hold CII's
156 
157  G4double WLSTime = 0.*ns;
158  G4PhysicsOrderedFreeVector* WLSIntegral = 0;
159 
160  WLSTime = aMaterialPropertiesTable->
161  GetConstProperty("WLSTIMECONSTANT");
162  WLSIntegral =
163  (G4PhysicsOrderedFreeVector*)((*theIntegralTable)(materialIndex));
164 
165  // Max WLS Integral
166 
167  G4double CIImax = WLSIntegral->GetMaxValue();
168 
169  G4int NumberOfPhotons = NumPhotons;
170 
171  for (G4int i = 0; i < NumPhotons; i++) {
172 
173  G4double sampledEnergy;
174 
175  // Make sure the energy of the secondary is less than that of the primary
176 
177  for (G4int j = 1; j <= 100; j++) {
178 
179  // Determine photon energy
180 
181  G4double CIIvalue = G4UniformRand()*CIImax;
182  sampledEnergy = WLSIntegral->GetEnergy(CIIvalue);
183 
184  if (verboseLevel>1) {
185  G4cout << "sampledEnergy = " << sampledEnergy << G4endl;
186  G4cout << "CIIvalue = " << CIIvalue << G4endl;
187  }
188 
189  if (sampledEnergy <= primaryEnergy) break;
190  }
191 
192  // If no such energy can be sampled, return one less secondary, or none
193 
194  if (sampledEnergy > primaryEnergy) {
195  if (verboseLevel>1)
196  G4cout << " *** One less WLS photon will be returned ***" << G4endl;
197  NumberOfPhotons--;
198  aParticleChange.SetNumberOfSecondaries(NumberOfPhotons);
199  if (NumberOfPhotons == 0) {
200  if (verboseLevel>1)
201  G4cout << " *** No WLS photon can be sampled for this primary ***"
202  << G4endl;
203  // return unchanged particle and no secondaries
204  return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
205  }
206  continue;
207  }
208 
209  // Generate random photon direction
210 
211  G4double cost = 1. - 2.*G4UniformRand();
212  G4double sint = std::sqrt((1.-cost)*(1.+cost));
213 
214  G4double phi = twopi*G4UniformRand();
215  G4double sinp = std::sin(phi);
216  G4double cosp = std::cos(phi);
217 
218  G4double px = sint*cosp;
219  G4double py = sint*sinp;
220  G4double pz = cost;
221 
222  // Create photon momentum direction vector
223 
224  G4ParticleMomentum photonMomentum(px, py, pz);
225 
226  // Determine polarization of new photon
227 
228  G4double sx = cost*cosp;
229  G4double sy = cost*sinp;
230  G4double sz = -sint;
231 
232  G4ThreeVector photonPolarization(sx, sy, sz);
233 
234  G4ThreeVector perp = photonMomentum.cross(photonPolarization);
235 
236  phi = twopi*G4UniformRand();
237  sinp = std::sin(phi);
238  cosp = std::cos(phi);
239 
240  photonPolarization = cosp * photonPolarization + sinp * perp;
241 
242  photonPolarization = photonPolarization.unit();
243 
244  // Generate a new photon:
245 
246  G4DynamicParticle* aWLSPhoton =
248  photonMomentum);
249  aWLSPhoton->SetPolarization
250  (photonPolarization.x(),
251  photonPolarization.y(),
252  photonPolarization.z());
253 
254  aWLSPhoton->SetKineticEnergy(sampledEnergy);
255 
256  // Generate new G4Track object:
257 
258  // Must give position of WLS optical photon
259 
260  G4double TimeDelay = WLSTimeGeneratorProfile->GenerateTime(WLSTime);
261  G4double aSecondaryTime = (pPostStepPoint->GetGlobalTime()) + TimeDelay;
262 
263  G4ThreeVector aSecondaryPosition = pPostStepPoint->GetPosition();
264 
265  G4Track* aSecondaryTrack =
266  new G4Track(aWLSPhoton,aSecondaryTime,aSecondaryPosition);
267 
268  aSecondaryTrack->SetTouchableHandle(aTrack.GetTouchableHandle());
269  // aSecondaryTrack->SetTouchableHandle((G4VTouchable*)0);
270 
271  aSecondaryTrack->SetParentID(aTrack.GetTrackID());
272 
273  aParticleChange.AddSecondary(aSecondaryTrack);
274  }
275 
276  if (verboseLevel>0) {
277  G4cout << "\n Exiting from G4OpWLS::DoIt -- NumberOfSecondaries = "
279  }
280 
281  return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
282 }
G4long G4Poisson(G4double mean)
Definition: G4Poisson.hh:51
G4int GetNumberOfSecondaries() const
G4int verboseLevel
Definition: G4VProcess.hh:368
G4double GetKineticEnergy() const
const G4DynamicParticle * GetDynamicParticle() const
size_t GetIndex() const
Definition: G4Material.hh:262
void SetTouchableHandle(const G4TouchableHandle &apValue)
int G4int
Definition: G4Types.hh:78
static constexpr double twopi
Definition: G4SIunits.hh:76
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
virtual G4double GenerateTime(const G4double time_constant)=0
const G4ThreeVector & GetPosition() const
G4VWLSTimeGeneratorProfile * WLSTimeGeneratorProfile
Definition: G4OpWLS.hh:137
G4int GetTrackID() const
void SetPolarization(G4double polX, G4double polY, G4double polZ)
void SetKineticEnergy(G4double aEnergy)
const G4TouchableHandle & GetTouchableHandle() const
G4double GetEnergy(G4double aValue)
G4Material * GetMaterial() const
G4bool ConstPropertyExists(const char *key) const
static G4OpticalPhoton * OpticalPhoton()
virtual void Initialize(const G4Track &)
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
Definition: G4Material.hh:252
void SetNumberOfSecondaries(G4int totSecondaries)
Hep3Vector unit() const
void SetParentID(const G4int aValue)
G4StepPoint * GetPostStepPoint() const
G4ParticleChange aParticleChange
Definition: G4VProcess.hh:289
void AddSecondary(G4Track *aSecondary)
#define G4endl
Definition: G4ios.hh:61
G4double GetGlobalTime() const
Hep3Vector cross(const Hep3Vector &) const
double G4double
Definition: G4Types.hh:76
void ProposeTrackStatus(G4TrackStatus status)
G4PhysicsTable * theIntegralTable
Definition: G4OpWLS.hh:138
#define ns
Definition: xmlparse.cc:614
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4MaterialPropertyVector * GetProperty(const char *key)

Here is the call graph for this function:

void G4OpWLS::UseTimeProfile ( const G4String  name)

Definition at line 417 of file G4OpWLS.cc.

418 {
419  if (name == "delta")
420  {
423  new G4WLSTimeGeneratorProfileDelta("delta");
424  }
425  else if (name == "exponential")
426  {
429  new G4WLSTimeGeneratorProfileExponential("exponential");
430  }
431  else
432  {
433  G4Exception("G4OpWLS::UseTimeProfile", "em0202",
435  "generator does not exist");
436  }
437 }
G4VWLSTimeGeneratorProfile * WLSTimeGeneratorProfile
Definition: G4OpWLS.hh:137
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

G4PhysicsTable* G4OpWLS::theIntegralTable
protected

Definition at line 138 of file G4OpWLS.hh.

G4VWLSTimeGeneratorProfile* G4OpWLS::WLSTimeGeneratorProfile
protected

Definition at line 137 of file G4OpWLS.hh.


The documentation for this class was generated from the following files: