- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/digits_hits/scorer/src/G4PSSphereSurfaceFlux.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4PSSphereSurfaceFlux.cc,v 1. 3 2009/11/14 00:01:13 asaimExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4PSSphereSurfaceFlux.cc,v 1.7 2010/07/23 04:35:38 taso Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // G4PSSphereSurfaceFlux … … 50 50 // Created: 2005-11-14 Tsukasa ASO, Akinori Kimura. 51 51 // 29-Mar-2007 T.Aso, Bug fix for momentum direction at outgoing flux. 52 // 2010-07-22 Introduce Unit specification. 53 // 2010-07-22 Add weighted and divideByAre options 52 54 // 53 55 /////////////////////////////////////////////////////////////////////////////// … … 55 57 G4PSSphereSurfaceFlux::G4PSSphereSurfaceFlux(G4String name, 56 58 G4int direction, G4int depth) 59 :G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction), 60 weighted(true),divideByArea(true) 61 { 62 DefineUnitAndCategory(); 63 SetUnit("percm2"); 64 } 65 66 G4PSSphereSurfaceFlux::G4PSSphereSurfaceFlux(G4String name, 67 G4int direction, 68 const G4String& unit, 69 G4int depth) 57 70 :G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction) 58 {;} 71 { 72 DefineUnitAndCategory(); 73 SetUnit(unit); 74 } 59 75 60 76 G4PSSphereSurfaceFlux::~G4PSSphereSurfaceFlux() … … 79 95 } 80 96 81 // if( solid->GetEntityType() != "G4Sphere" ){82 // G4Exception("G4PSSphereSurfaceFluxScorer. - Solid type is not supported.");83 // return FALSE;84 // }85 97 G4Sphere* sphereSolid = (G4Sphere*)(solid); 86 98 … … 122 134 G4double square = radi*radi*dph*( -std::cos(enth) + std::cos(stth) ); 123 135 124 G4double current = thisStep->GetWeight(); // Flux (Particle Weight) 125 current = current/square; // Flux with angle. 136 G4double current = 1.0; 137 if ( weighted ) thisStep->GetWeight(); // Flux (Particle Weight) 138 if ( divideByArea ) current = current/square; // Flux with angle. 126 139 127 140 current /= anglefactor; … … 205 218 for(; itr != EvtMap->GetMap()->end(); itr++) { 206 219 G4cout << " copy no.: " << itr->first 207 << " current : " << *(itr->second) 220 << " current : " << *(itr->second)/GetUnitValue() 221 << " ["<<GetUnit()<<"]" 208 222 << G4endl; 209 223 } 210 224 } 211 225 226 void G4PSSphereSurfaceFlux::SetUnit(const G4String& unit) 227 { 228 if ( divideByArea ) { 229 CheckAndSetUnit(unit,"Per Unit Surface"); 230 } else { 231 if (unit == "" ){ 232 unitName = unit; 233 unitValue = 1.0; 234 }else{ 235 G4String msg = "Invalid unit ["+unit+"] (Current unit is [" +GetUnit()+"] )"; 236 G4Exception(GetName(),"DetScorer0000",JustWarning,msg); 237 } 238 } 239 } 240 241 void G4PSSphereSurfaceFlux::DefineUnitAndCategory(){ 242 // Per Unit Surface 243 new G4UnitDefinition("percentimeter2","percm2","Per Unit Surface",(1./cm2)); 244 new G4UnitDefinition("permillimeter2","permm2","Per Unit Surface",(1./mm2)); 245 new G4UnitDefinition("permeter2","perm2","Per Unit Surface",(1./m2)); 246 } 247
Note: See TracChangeset
for help on using the changeset viewer.