- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/digits_hits/scorer/src/G4PSCylinderSurfaceCurrent.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4PSCylinderSurfaceCurrent.cc,v 1. 3 2009/11/14 00:01:13 asaimExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4PSCylinderSurfaceCurrent.cc,v 1.5 2010/07/23 04:35:38 taso Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // G4PSCylinderSurfaceCurrent … … 49 49 // 50 50 // Created: 2007-03-21 Tsukasa ASO 51 // 2010-07-22 Introduce Unit specification. 51 52 // 52 53 /////////////////////////////////////////////////////////////////////////////// … … 57 58 :G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction), 58 59 weighted(true),divideByArea(true) 59 {;} 60 { 61 DefineUnitAndCategory(); 62 SetUnit("percm2"); 63 } 64 65 G4PSCylinderSurfaceCurrent::G4PSCylinderSurfaceCurrent(G4String name, 66 G4int direction, 67 const G4String& unit, 68 G4int depth) 69 :G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction), 70 weighted(true),divideByArea(true) 71 { 72 DefineUnitAndCategory(); 73 SetUnit(unit); 74 } 60 75 61 76 G4PSCylinderSurfaceCurrent::~G4PSCylinderSurfaceCurrent() … … 80 95 } 81 96 82 // if( solid->GetEntityType() != "G4Tubs" ){83 // G4Exception("G4PSCylinderSurfaceCurrentScorer. - Solid type is not supported.");84 // return FALSE;85 // }86 97 G4Tubs* tubsSolid = (G4Tubs*)(solid); 87 98 … … 122 133 theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos1); 123 134 if ( std::fabs(localpos1.z()) > tubsSolid->GetZHalfLength() ) return -1; 124 //if(std::fabs( localpos1.x()*localpos1.x()+localpos1.y()*localpos1.y()125 // -(tubsSolid->GetInnerRadius()*tubsSolid->GetInnerRadius()))126 // < kCarTolerance ){127 135 G4double localR2 = localpos1.x()*localpos1.x()+localpos1.y()*localpos1.y(); 128 136 G4double InsideRadius = tubsSolid->GetInnerRadius(); … … 139 147 theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos2); 140 148 if ( std::fabs(localpos2.z()) > tubsSolid->GetZHalfLength() ) return -1; 141 //if(std::fabs( localpos2.x()*localpos2.x()+localpos2.y()*localpos2.y()142 // - (tubsSolid->GetInnerRadius()*tubsSolid->GetInnerRadius()))143 // <kCarTolerance ){144 149 G4double localR2 = localpos2.x()*localpos2.x()+localpos2.y()*localpos2.y(); 145 150 G4double InsideRadius = tubsSolid->GetInnerRadius(); … … 179 184 G4cout << " copy no.: " << itr->first 180 185 << " current : " ; 181 if ( divideByArea ) G4cout << *(itr->second)*cm*cm << " [/cm2]"; 182 else G4cout << *(itr->second) << " [track]"; 186 if ( divideByArea ) { 187 G4cout << *(itr->second)/GetUnitValue() 188 << " ["<<GetUnit()<<"]"; 189 } else { 190 G4cout << *(itr->second) << " [tracks]"; 191 } 183 192 G4cout << G4endl; 184 193 } 185 194 } 186 195 196 void G4PSCylinderSurfaceCurrent::SetUnit(const G4String& unit) 197 { 198 if ( divideByArea ) { 199 CheckAndSetUnit(unit,"Per Unit Surface"); 200 } else { 201 if (unit == "" ){ 202 unitName = unit; 203 unitValue = 1.0; 204 }else{ 205 G4String msg = "Invalid unit ["+unit+"] (Current unit is [" +GetUnit()+"] )"; 206 G4Exception(GetName(),"DetScorer0000",JustWarning,msg); 207 } 208 } 209 } 210 211 void G4PSCylinderSurfaceCurrent::DefineUnitAndCategory(){ 212 // Per Unit Surface 213 new G4UnitDefinition("percentimeter2","percm2","Per Unit Surface",(1./cm2)); 214 new G4UnitDefinition("permillimeter2","permm2","Per Unit Surface",(1./mm2)); 215 new G4UnitDefinition("permeter2","perm2","Per Unit Surface",(1./m2)); 216 } 217
Note: See TracChangeset
for help on using the changeset viewer.