308 {
309 G4double cvelScint = c_light / m_refIndexEc;
310
311 G4ThreeVector pos = hit->
GetPos();
314 G4double edep = hit->
GetEdep();
316
318 G4double timeFlight = hit->
GetTime() - m_beamTime;
320 {
323 }
324
326 G4double nx = pDirection.x();
327 G4double ny = pDirection.y();
328 G4double nz = pDirection.z();
329
330
331 G4int NphStep;
332 G4double nMean, nPhoton;
333 nMean = m_phNConstEc *
BirksLaw( hit );
334
335 if ( nMean > 10 )
336 {
337 G4double resolutionScale = 1.;
338 G4double sigma = resolutionScale * sqrt( nMean );
339 nPhoton = G4int( G4RandGauss::shoot( nMean, sigma ) + 0.5 );
340 }
341 else nPhoton = G4int( G4Poisson( nMean ) );
342
343 NphStep = G4int( nPhoton * 0.66 * m_QEEc * m_CEEc );
344
345
346
347 if ( m_G4Svc->TofRootFlag() )
m_NphAllSteps += G4int( nPhoton * 0.66 * m_QEEc * m_CEEc );
348
349 if ( NphStep > 0 )
350 {
351 for ( G4int i = 0; i < NphStep; i++ )
352 {
353
354 G4double ddS, ddT;
355 ddS = stepL * G4UniformRand();
356 ddT = deltaT * G4UniformRand();
357 G4ThreeVector emtPos;
358 emtPos.setX( pos.x() + nx * ddS );
359 emtPos.setY( pos.y() + ny * ddS );
360 emtPos.setZ( pos.z() + nz * ddS );
361
362
363 G4double radius = sqrt( emtPos.x() * emtPos.x() + emtPos.y() * emtPos.y() ) - m_ecR1;
364 const G4double pie = 2. * asin( 1. );
365 G4double phi = 0;
366 if ( emtPos.x() > 0 && emtPos.y() > 0 ) phi = atan( emtPos.y() / emtPos.x() );
367 else if ( emtPos.x() == 0 && emtPos.y() > 0 ) phi = pie / 2.;
368 else if ( emtPos.x() < 0 ) phi = atan( emtPos.y() / emtPos.x() ) + pie;
369 else if ( emtPos.x() == 0 && emtPos.y() < 0 ) phi = 1.5 * pie;
370 else if ( emtPos.x() > 0 && emtPos.y() < 0 )
371 phi = 2. * pie + atan( emtPos.y() / emtPos.x() );
372 phi = phi * 180. / pie;
373 G4double z = fabs( emtPos.z() );
374
375
376 G4int rBin = G4int( radius / 10. );
377 G4double resPhi = phi - ( G4int( phi / 7.5 ) * 7.5 );
378 G4int phiBin = G4int( resPhi / 1.25 );
379 G4int zBin = G4int( ( z - 1332. ) / 8. );
380
381
382
383 G4int forb = 0;
384 G4double transpTime = 0;
385 G4double pathL = 0;
386 G4double efficiency1;
387 G4double efficiency2;
388 efficiency1 = G4RandGauss::shoot( 0, 0.004 );
389 if ( rBin >= 0 && rBin <= nR && phiBin >= 0 && phiBin <= nPhi && zBin >= 0 &&
391 efficiency1 += eff[rBin][phiBin][zBin];
392 else efficiency1 = 0;
393
394 if ( m_attenEc == 0 )
395 {
396 G4cout << " ERROR: Attenuation Length is null!" << G4endl;
397 break;
398 }
399
400 if ( G4UniformRand() <= efficiency1 )
401 {
402 DirectPh( rBin, phiBin, zBin, transpTime );
403
404 }
405
406
407
408
409
410 if ( transpTime > 0 )
411 {
412
413 G4double scinSwim = transpTime;
414
416
417
419
420 G4double endTime = timeFlight + ddT + scinSwim + scinTime + transitTime;
421
422 if ( m_G4Svc->TofRootFlag() )
423 {
424
432 }
433
434
436
437
438 if ( m_t1st[forb] > endTime ) m_t1st[forb] = endTime;
439 if ( m_tLast[forb] < endTime ) m_tLast[forb] = endTime;
440
441
442 }
443 }
444 }
445}
void DirectPh(G4int, G4int, G4int, G4double &)
G4double Scintillation(G4int)
void AccuSignal(G4double, G4int)
G4double BirksLaw(BesTofHit *hit)
static NTuple::Tuple * m_tupleTof3
static NTuple::Item< double > m_ddT
static NTuple::Item< double > m_scinTime
static NTuple::Item< double > m_NphAllSteps
static NTuple::Item< double > m_timeFlight
static NTuple::Item< double > m_scinSwim
static NTuple::Item< double > m_endTime
static NTuple::Item< double > m_transitTime
G4ThreeVector GetPDirection()