Ignore:
Timestamp:
Nov 5, 2010, 3:45:55 PM (14 years ago)
Author:
garnier
Message:

update ti head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/digits_hits/scorer/src/G4PSSphereSurfaceCurrent.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4PSSphereSurfaceCurrent.cc,v 1.4 2009/11/14 00:01:13 asaim Exp $
    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: $
    2929//
    3030// G4PSSphereSurfaceCurrent
     
    4949//
    5050// Created: 2005-11-14  Tsukasa ASO, Akinori Kimura.
     51// 2010-07-22   Introduce Unit specification.
    5152//
    5253///////////////////////////////////////////////////////////////////////////////
     
    5657    :G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),
    5758     weighted(true),divideByArea(true)
    58 {;}
     59{
     60    DefineUnitAndCategory();
     61    SetUnit("percm2");
     62}
     63
     64G4PSSphereSurfaceCurrent::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}
    5974
    6075G4PSSphereSurfaceCurrent::~G4PSSphereSurfaceCurrent()
     
    7994  }
    8095
    81 //  if( solid->GetEntityType() != "G4Sphere" ){
    82 //    G4Exception("G4PSSphereSurfaceCurrentScorer. - Solid type is not supported.");
    83 //    return FALSE;
    84 //  }
    8596  G4Sphere* sphereSolid = (G4Sphere*)(solid);
    8697
     
    177188  for(; itr != EvtMap->GetMap()->end(); itr++) {
    178189    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    }
    181196    G4cout  << G4endl;
    182197  }
    183198}
    184199
     200
     201void 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
     216void 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.