- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/digits_hits/scorer/src/G4PSSphereSurfaceCurrent.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4PSSphereSurfaceCurrent.cc,v 1. 4 2009/11/14 00:01:13 asaimExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4PSSphereSurfaceCurrent.cc,v 1.6 2010/07/23 04:35:38 taso Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // G4PSSphereSurfaceCurrent … … 49 49 // 50 50 // Created: 2005-11-14 Tsukasa ASO, Akinori Kimura. 51 // 2010-07-22 Introduce Unit specification. 51 52 // 52 53 /////////////////////////////////////////////////////////////////////////////// … … 56 57 :G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction), 57 58 weighted(true),divideByArea(true) 58 {;} 59 { 60 DefineUnitAndCategory(); 61 SetUnit("percm2"); 62 } 63 64 G4PSSphereSurfaceCurrent::G4PSSphereSurfaceCurrent(G4String name, 65 G4int direction, 66 const G4String& unit, 67 G4int depth) 68 :G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction), 69 weighted(true),divideByArea(true) 70 { 71 DefineUnitAndCategory(); 72 SetUnit(unit); 73 } 59 74 60 75 G4PSSphereSurfaceCurrent::~G4PSSphereSurfaceCurrent() … … 79 94 } 80 95 81 // if( solid->GetEntityType() != "G4Sphere" ){82 // G4Exception("G4PSSphereSurfaceCurrentScorer. - Solid type is not supported.");83 // return FALSE;84 // }85 96 G4Sphere* sphereSolid = (G4Sphere*)(solid); 86 97 … … 177 188 for(; itr != EvtMap->GetMap()->end(); itr++) { 178 189 G4cout << " copy no.: " << itr->first << " current : " ; 179 if ( divideByArea ) G4cout << *(itr->second)*cm*cm << " [/cm2]" ; 180 else G4cout << *(itr->second)*cm*cm << " [track]" ; 190 if ( divideByArea ) { 191 G4cout << *(itr->second)/GetUnitValue() 192 << " [" <<GetUnit()<<"]"; 193 }else { 194 G4cout << *(itr->second) << " [tracks]" ; 195 } 181 196 G4cout << G4endl; 182 197 } 183 198 } 184 199 200 201 void G4PSSphereSurfaceCurrent::SetUnit(const G4String& unit) 202 { 203 if ( divideByArea ) { 204 CheckAndSetUnit(unit,"Per Unit Surface"); 205 } else { 206 if (unit == "" ){ 207 unitName = unit; 208 unitValue = 1.0; 209 }else{ 210 G4String msg = "Invalid unit ["+unit+"] (Current unit is [" +GetUnit()+"] )"; 211 G4Exception(GetName(),"DetScorer0000",JustWarning,msg); 212 } 213 } 214 } 215 216 void G4PSSphereSurfaceCurrent::DefineUnitAndCategory(){ 217 // Per Unit Surface 218 new G4UnitDefinition("percentimeter2","percm2","Per Unit Surface",(1./cm2)); 219 new G4UnitDefinition("permillimeter2","permm2","Per Unit Surface",(1./mm2)); 220 new G4UnitDefinition("permeter2","perm2","Per Unit Surface",(1./m2)); 221 }
Note: See TracChangeset
for help on using the changeset viewer.