- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/digits_hits/scorer/src/G4PSFlatSurfaceCurrent.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4PSFlatSurfaceCurrent.cc,v 1. 3 2008/12/29 00:17:14 asaimExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4PSFlatSurfaceCurrent.cc,v 1.5 2010/07/23 04:35:38 taso Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // G4PSFlatSurfaceCurrent … … 51 51 // 17-Nov-2005 T.Aso, Bug fix for area definition. 52 52 // 31-Mar-2007 T.Aso, Add option for normalizing by the area. 53 // 2010-07-22 Introduce Unit specification. 53 54 // 54 55 /////////////////////////////////////////////////////////////////////////////// … … 59 60 :G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction), 60 61 weighted(true),divideByArea(true) 61 {;} 62 { 63 DefineUnitAndCategory(); 64 SetUnit("percm2"); 65 } 66 67 G4PSFlatSurfaceCurrent::G4PSFlatSurfaceCurrent(G4String name, 68 G4int direction, 69 const G4String& unit, 70 G4int depth) 71 :G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction), 72 weighted(true),divideByArea(true) 73 { 74 DefineUnitAndCategory(); 75 SetUnit(unit); 76 } 62 77 63 78 G4PSFlatSurfaceCurrent::~G4PSFlatSurfaceCurrent() … … 82 97 } 83 98 84 // if( solid->GetEntityType() != "G4Box" ){85 // G4Exception("G4PSFlatSurfaceCurrentScorer. - Solid type is not supported.");86 // return FALSE;87 // }88 99 G4Box* boxSolid = (G4Box*)(solid); 89 100 … … 160 171 for(; itr != EvtMap->GetMap()->end(); itr++) { 161 172 G4cout << " copy no.: " << itr->first << " current : " ; 162 if ( divideByArea ) G4cout << *(itr->second)*cm*cm << " [/cm2] "; 163 else G4cout << *(itr->second) << " [track]"; 173 if ( divideByArea ) { 174 G4cout << *(itr->second)/GetUnitValue() 175 << " ["<<GetUnit()<<"]"; 176 }else { 177 G4cout << *(itr->second)/GetUnitValue() << " [tracks]"; 178 } 164 179 G4cout << G4endl; 165 180 } 166 181 } 167 182 183 void G4PSFlatSurfaceCurrent::SetUnit(const G4String& unit) 184 { 185 if ( divideByArea ) { 186 CheckAndSetUnit(unit,"Per Unit Surface"); 187 } else { 188 if (unit == "" ){ 189 unitName = unit; 190 unitValue = 1.0; 191 }else{ 192 G4String msg = "Invalid unit ["+unit+"] (Current unit is [" +GetUnit()+"] )"; 193 G4Exception(GetName(),"DetScorer0000",JustWarning,msg); 194 } 195 } 196 } 197 198 void G4PSFlatSurfaceCurrent::DefineUnitAndCategory(){ 199 // Per Unit Surface 200 new G4UnitDefinition("percentimeter2","percm2","Per Unit Surface",(1./cm2)); 201 new G4UnitDefinition("permillimeter2","permm2","Per Unit Surface",(1./mm2)); 202 new G4UnitDefinition("permeter2","perm2","Per Unit Surface",(1./m2)); 203 } 204
Note: See TracChangeset
for help on using the changeset viewer.