Commit a0ac4951 authored by Chad Lantz's avatar Chad Lantz
Browse files

Added absorption

parent ec52a20a
...@@ -160,30 +160,44 @@ G4bool FiberSD::ProcessHits(G4Step* aStep,G4TouchableHistory*){ ...@@ -160,30 +160,44 @@ G4bool FiberSD::ProcessHits(G4Step* aStep,G4TouchableHistory*){
//instead of reflected back downward //instead of reflected back downward
// if( 3.1415/2.0 - atan( momentum.y() / ( 1-momentum.y() ) ) >= asin(1.0/Rindex) ){ // if( 3.1415/2.0 - atan( momentum.y() / ( 1-momentum.y() ) ) >= asin(1.0/Rindex) ){
if( momentum.y() > 0.0 ){ if( momentum.y() > 0.0 ){
//Now check for total internal reflection //Now check for total internal reflection
//There are potentially multiple processes for our post step point, so we get the vector
//and step through it looking for TIR
G4ProcessVector* postStepDoItVector = opticalphoton->GetProcessManager()->GetPostStepProcessVector(typeDoIt); G4ProcessVector* postStepDoItVector = opticalphoton->GetProcessManager()->GetPostStepProcessVector(typeDoIt);
G4int n_proc = postStepDoItVector->entries(); G4int n_proc = postStepDoItVector->entries();
for(G4int i = 0; i < n_proc; ++i){ for(G4int i = 0; i < n_proc; ++i){
G4OpBoundaryProcess* opProc = dynamic_cast<G4OpBoundaryProcess*>((*postStepDoItVector)[i]); G4OpBoundaryProcess* opProc = dynamic_cast<G4OpBoundaryProcess*>((*postStepDoItVector)[i]);
if(opProc && opProc->GetStatus() == TotalInternalReflection){ if(opProc && opProc->GetStatus() == TotalInternalReflection){
if(REDUCED_TREE){ //Here we're simulating absorption. We determine the full path length of the photon within the fiber
m_cherenkovVec->at(rodNum)++; //and roll a random number against it's chance of absorption. If it's not absorbed record it
FillTimeVector( rodNum, aStep->GetTrack()->GetGlobalTime() ); G4MaterialPropertyVector* AbsMPV = MPT->GetProperty(kABSLENGTH);
G4double Absorption = AbsMPV->Value(aStep->GetTrack()->GetDynamicParticle()->GetTotalMomentum(), index);
m_nHits++; G4ThreeVector momDir = aStep->GetPreStepPoint()->GetMomentumDirection();
return true; //pathLength = (distance to top of fiber)/sin(polarAngle); polarAngle = atan(y/sqrt(x^2 + z^2));
}//end if REDUCED_TREE G4double pathLength = (m_topOfVolume - pos.y())/sin( atan(momDir.y()/sqrt( pow(momDir.x(),2.0) + pow(momDir.z(),2.0) ) ) );
FiberHit* newHit = new FiberHit(); G4double absChance = exp(-pathLength/Absorption);
newHit->setPos ( pos ); if(CLHEP::RandFlat::shoot(0.0,1.0) < absChance){//This check amounts to if(!absorbed)
newHit->setOrigin ( aStep->GetTrack()->GetVertexPosition() ); //Finally, record the ouput
newHit->setMomentum ( momentum ); if(REDUCED_TREE){
newHit->setEnergy ( aStep->GetPreStepPoint()->GetTotalEnergy() ); m_cherenkovVec->at(rodNum)++;
newHit->setTime ( aStep->GetTrack()->GetGlobalTime() ); FillTimeVector( rodNum, aStep->GetTrack()->GetGlobalTime() );
newHit->setRodNb ( rodNum );
m_nHits++;
fiberCollection->insert ( newHit ); return true;
m_nHits++; }else{
FiberHit* newHit = new FiberHit();
newHit->setPos ( pos );
newHit->setOrigin ( aStep->GetTrack()->GetVertexPosition() );
newHit->setMomentum ( momentum );
newHit->setEnergy ( aStep->GetPreStepPoint()->GetTotalEnergy() );
newHit->setTime ( aStep->GetTrack()->GetGlobalTime() );
newHit->setRodNb ( rodNum );
fiberCollection->insert ( newHit );
m_nHits++;
}//end if REDUCED_TREE
}//end if !absorbed
}//end if opProc && TotalInternalReflection }//end if opProc && TotalInternalReflection
}//end for n_proc }//end for n_proc
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment