#include <G4PSSphereSurfaceFlux.hh>
Inheritance diagram for G4PSSphereSurfaceFlux:
Public Member Functions | |
G4PSSphereSurfaceFlux (G4String name, G4int direction, G4int depth=0) | |
G4PSSphereSurfaceFlux (G4String name, G4int direction, const G4String &unit, G4int depth=0) | |
virtual | ~G4PSSphereSurfaceFlux () |
void | Weighted (G4bool flg=true) |
void | DivideByArea (G4bool flg=true) |
virtual void | Initialize (G4HCofThisEvent *) |
virtual void | EndOfEvent (G4HCofThisEvent *) |
virtual void | clear () |
virtual void | DrawAll () |
virtual void | PrintAll () |
virtual void | SetUnit (const G4String &unit) |
Protected Member Functions | |
virtual G4bool | ProcessHits (G4Step *, G4TouchableHistory *) |
G4int | IsSelectedSurface (G4Step *, G4Sphere *) |
virtual void | DefineUnitAndCategory () |
Definition at line 60 of file G4PSSphereSurfaceFlux.hh.
Definition at line 59 of file G4PSSphereSurfaceFlux.cc.
References DefineUnitAndCategory(), and SetUnit().
00061 : G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction), 00062 weighted(true),divideByArea(true) 00063 { 00064 DefineUnitAndCategory(); 00065 SetUnit("percm2"); 00066 }
G4PSSphereSurfaceFlux::G4PSSphereSurfaceFlux | ( | G4String | name, | |
G4int | direction, | |||
const G4String & | unit, | |||
G4int | depth = 0 | |||
) |
Definition at line 68 of file G4PSSphereSurfaceFlux.cc.
References DefineUnitAndCategory(), and SetUnit().
00072 : G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction), 00073 weighted(true),divideByArea(true) 00074 { 00075 DefineUnitAndCategory(); 00076 SetUnit(unit); 00077 }
G4PSSphereSurfaceFlux::~G4PSSphereSurfaceFlux | ( | ) | [virtual] |
void G4PSSphereSurfaceFlux::clear | ( | ) | [virtual] |
void G4PSSphereSurfaceFlux::DefineUnitAndCategory | ( | ) | [protected, virtual] |
Definition at line 245 of file G4PSSphereSurfaceFlux.cc.
Referenced by G4PSSphereSurfaceFlux().
00245 { 00246 // Per Unit Surface 00247 new G4UnitDefinition("percentimeter2","percm2","Per Unit Surface",(1./cm2)); 00248 new G4UnitDefinition("permillimeter2","permm2","Per Unit Surface",(1./mm2)); 00249 new G4UnitDefinition("permeter2","perm2","Per Unit Surface",(1./m2)); 00250 }
void G4PSSphereSurfaceFlux::DivideByArea | ( | G4bool | flg = true |
) | [inline] |
void G4PSSphereSurfaceFlux::DrawAll | ( | ) | [virtual] |
void G4PSSphereSurfaceFlux::EndOfEvent | ( | G4HCofThisEvent * | ) | [virtual] |
void G4PSSphereSurfaceFlux::Initialize | ( | G4HCofThisEvent * | ) | [virtual] |
Reimplemented from G4VPrimitiveScorer.
Definition at line 199 of file G4PSSphereSurfaceFlux.cc.
References G4HCofThisEvent::AddHitsCollection(), G4VPrimitiveScorer::detector, G4VPrimitiveScorer::GetCollectionID(), G4VPrimitiveScorer::GetName(), and G4VSensitiveDetector::GetName().
00200 { 00201 EvtMap = new G4THitsMap<G4double>(detector->GetName(), GetName()); 00202 if ( HCID < 0 ) HCID = GetCollectionID(0); 00203 HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); 00204 }
Definition at line 154 of file G4PSSphereSurfaceFlux.cc.
References fFlux_In, fFlux_Out, fGeomBoundary, G4Sphere::GetInsideRadius(), G4GeometryTolerance::GetInstance(), G4StepPoint::GetPosition(), G4Step::GetPostStepPoint(), G4Step::GetPreStepPoint(), G4StepPoint::GetStepStatus(), G4GeometryTolerance::GetSurfaceTolerance(), and G4StepPoint::GetTouchableHandle().
Referenced by ProcessHits().
00154 { 00155 00156 G4TouchableHandle theTouchable = 00157 aStep->GetPreStepPoint()->GetTouchableHandle(); 00158 G4double kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance(); 00159 00160 if (aStep->GetPreStepPoint()->GetStepStatus() == fGeomBoundary ){ 00161 // Entering Geometry 00162 G4ThreeVector stppos1= aStep->GetPreStepPoint()->GetPosition(); 00163 G4ThreeVector localpos1 = 00164 theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos1); 00165 G4double localR2 = localpos1.x()*localpos1.x() 00166 +localpos1.y()*localpos1.y() 00167 +localpos1.z()*localpos1.z(); 00168 //G4double InsideRadius2 = 00169 // sphereSolid->GetInsideRadius()*sphereSolid->GetInsideRadius(); 00170 //if(std::fabs( localR2 - InsideRadius2 ) < kCarTolerance ){ 00171 G4double InsideRadius = sphereSolid->GetInsideRadius(); 00172 if ( localR2 > (InsideRadius-kCarTolerance)*(InsideRadius-kCarTolerance) 00173 &&localR2 < (InsideRadius+kCarTolerance)*(InsideRadius+kCarTolerance)){ 00174 return fFlux_In; 00175 } 00176 } 00177 00178 if (aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary ){ 00179 // Exiting Geometry 00180 G4ThreeVector stppos2= aStep->GetPostStepPoint()->GetPosition(); 00181 G4ThreeVector localpos2 = 00182 theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos2); 00183 G4double localR2 = localpos2.x()*localpos2.x() 00184 +localpos2.y()*localpos2.y() 00185 +localpos2.z()*localpos2.z(); 00186 //G4double InsideRadius2 = 00187 // sphereSolid->GetInsideRadius()*sphereSolid->GetInsideRadius(); 00188 //if(std::facb(localR2 - InsideRadius2) ) < kCarTolerance ){ 00189 G4double InsideRadius = sphereSolid->GetInsideRadius(); 00190 if ( localR2 > (InsideRadius-kCarTolerance)*(InsideRadius-kCarTolerance) 00191 &&localR2 < (InsideRadius+kCarTolerance)*(InsideRadius+kCarTolerance)){ 00192 return fFlux_Out; 00193 } 00194 } 00195 00196 return -1; 00197 }
void G4PSSphereSurfaceFlux::PrintAll | ( | ) | [virtual] |
Reimplemented from G4VPrimitiveScorer.
Definition at line 216 of file G4PSSphereSurfaceFlux.cc.
References G4VPrimitiveScorer::detector, G4cout, G4endl, G4VPrimitiveScorer::GetName(), G4VSensitiveDetector::GetName(), G4VPrimitiveScorer::GetUnit(), and G4VPrimitiveScorer::GetUnitValue().
00217 { 00218 G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl; 00219 G4cout << " PrimitiveScorer " << GetName() <<G4endl; 00220 G4cout << " Number of entries " << EvtMap->entries() << G4endl; 00221 std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin(); 00222 for(; itr != EvtMap->GetMap()->end(); itr++) { 00223 G4cout << " copy no.: " << itr->first 00224 << " Flux : " << *(itr->second)/GetUnitValue() 00225 << " ["<<GetUnit()<<"]" 00226 << G4endl; 00227 } 00228 }
G4bool G4PSSphereSurfaceFlux::ProcessHits | ( | G4Step * | , | |
G4TouchableHistory * | ||||
) | [protected, virtual] |
Implements G4VPrimitiveScorer.
Definition at line 82 of file G4PSSphereSurfaceFlux.cc.
References G4VSolid::ComputeDimensions(), G4VPVParameterisation::ComputeSolid(), FALSE, fFlux_In, fFlux_InOut, fFlux_Out, G4Sphere::GetDeltaPhiAngle(), G4Sphere::GetDeltaThetaAngle(), G4VPrimitiveScorer::GetIndex(), G4Sphere::GetInsideRadius(), G4VPhysicalVolume::GetLogicalVolume(), G4StepPoint::GetMomentumDirection(), G4VPhysicalVolume::GetParameterisation(), G4StepPoint::GetPhysicalVolume(), G4StepPoint::GetPosition(), G4Step::GetPostStepPoint(), G4Step::GetPreStepPoint(), G4LogicalVolume::GetSolid(), G4Sphere::GetStartThetaAngle(), G4StepPoint::GetTouchable(), G4StepPoint::GetTouchableHandle(), G4StepPoint::GetWeight(), G4VPrimitiveScorer::indexDepth, IsSelectedSurface(), and TRUE.
00083 { 00084 G4StepPoint* preStep = aStep->GetPreStepPoint(); 00085 00086 G4VPhysicalVolume* physVol = preStep->GetPhysicalVolume(); 00087 G4VPVParameterisation* physParam = physVol->GetParameterisation(); 00088 G4VSolid * solid = 0; 00089 if(physParam) 00090 { // for parameterized volume 00091 G4int idx = ((G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable())) 00092 ->GetReplicaNumber(indexDepth); 00093 solid = physParam->ComputeSolid(idx, physVol); 00094 solid->ComputeDimensions(physParam,idx,physVol); 00095 } 00096 else 00097 { // for ordinary volume 00098 solid = physVol->GetLogicalVolume()->GetSolid(); 00099 } 00100 00101 G4Sphere* sphereSolid = (G4Sphere*)(solid); 00102 00103 G4int dirFlag =IsSelectedSurface(aStep,sphereSolid); 00104 if ( dirFlag > 0 ) { 00105 if ( fDirection == fFlux_InOut || fDirection == dirFlag ){ 00106 00107 G4StepPoint* thisStep=0; 00108 if ( dirFlag == fFlux_In ){ 00109 thisStep = preStep; 00110 }else if ( dirFlag == fFlux_Out ){ 00111 thisStep = aStep->GetPostStepPoint(); 00112 }else{ 00113 return FALSE; 00114 } 00115 00116 G4TouchableHandle theTouchable = thisStep->GetTouchableHandle(); 00117 G4ThreeVector pdirection = thisStep->GetMomentumDirection(); 00118 G4ThreeVector localdir = 00119 theTouchable->GetHistory()->GetTopTransform().TransformAxis(pdirection); 00120 G4double localdirL2 = localdir.x()*localdir.x() 00121 +localdir.y()*localdir.y() 00122 +localdir.z()*localdir.z(); 00123 G4ThreeVector stppos1= aStep->GetPreStepPoint()->GetPosition(); 00124 G4ThreeVector localpos1 = 00125 theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos1); 00126 G4double localR2 = localpos1.x()*localpos1.x() 00127 +localpos1.y()*localpos1.y() 00128 +localpos1.z()*localpos1.z(); 00129 G4double anglefactor = (localdir.x()*localpos1.x() 00130 +localdir.y()*localpos1.y() 00131 +localdir.z()*localpos1.z()) 00132 /std::sqrt(localdirL2)/std::sqrt(localR2); 00133 00134 G4double radi = sphereSolid->GetInsideRadius(); 00135 G4double dph = sphereSolid->GetDeltaPhiAngle()/radian; 00136 G4double stth = sphereSolid->GetStartThetaAngle()/radian; 00137 G4double enth = stth+sphereSolid->GetDeltaThetaAngle()/radian; 00138 G4double square = radi*radi*dph*( -std::cos(enth) + std::cos(stth) ); 00139 00140 G4double current = 1.0; 00141 if ( weighted ) thisStep->GetWeight(); // Flux (Particle Weight) 00142 if ( divideByArea ) current = current/square; // Flux with angle. 00143 00144 current /= anglefactor; 00145 00146 G4int index = GetIndex(aStep); 00147 EvtMap->add(index,current); 00148 } 00149 } 00150 00151 return TRUE; 00152 }
void G4PSSphereSurfaceFlux::SetUnit | ( | const G4String & | unit | ) | [virtual] |
Reimplemented from G4VPrimitiveScorer.
Definition at line 230 of file G4PSSphereSurfaceFlux.cc.
References G4VPrimitiveScorer::CheckAndSetUnit(), G4Exception(), G4VPrimitiveScorer::GetName(), G4VPrimitiveScorer::GetUnit(), JustWarning, G4VPrimitiveScorer::unitName, and G4VPrimitiveScorer::unitValue.
Referenced by G4PSSphereSurfaceFlux(), and G4PSSphereSurfaceFlux3D::G4PSSphereSurfaceFlux3D().
00231 { 00232 if ( divideByArea ) { 00233 CheckAndSetUnit(unit,"Per Unit Surface"); 00234 } else { 00235 if (unit == "" ){ 00236 unitName = unit; 00237 unitValue = 1.0; 00238 }else{ 00239 G4String msg = "Invalid unit ["+unit+"] (Current unit is [" +GetUnit()+"] ) for " + GetName(); 00240 G4Exception("G4PSSphereSurfaceFlux::SetUnit","DetPS0016",JustWarning,msg); 00241 } 00242 } 00243 }
void G4PSSphereSurfaceFlux::Weighted | ( | G4bool | flg = true |
) | [inline] |