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/G4PSSphereSurfaceFlux.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4PSSphereSurfaceFlux.cc,v 1.3 2009/11/14 00:01:13 asaim Exp $
    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: $
    2929//
    3030// G4PSSphereSurfaceFlux
     
    5050// Created: 2005-11-14  Tsukasa ASO, Akinori Kimura.
    5151// 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
    5254//
    5355///////////////////////////////////////////////////////////////////////////////
     
    5557G4PSSphereSurfaceFlux::G4PSSphereSurfaceFlux(G4String name,
    5658                                         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
     66G4PSSphereSurfaceFlux::G4PSSphereSurfaceFlux(G4String name,
     67                                             G4int direction,
     68                                             const G4String& unit,
     69                                             G4int depth)
    5770  :G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction)
    58 {;}
     71{
     72    DefineUnitAndCategory();
     73    SetUnit(unit);
     74}
    5975
    6076G4PSSphereSurfaceFlux::~G4PSSphereSurfaceFlux()
     
    7995  }
    8096
    81 //  if( solid->GetEntityType() != "G4Sphere" ){
    82 //    G4Exception("G4PSSphereSurfaceFluxScorer. - Solid type is not supported.");
    83 //    return FALSE;
    84 //  }
    8597  G4Sphere* sphereSolid = (G4Sphere*)(solid);
    8698
     
    122134      G4double square = radi*radi*dph*( -std::cos(enth) + std::cos(stth) );
    123135
    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.
    126139
    127140      current /= anglefactor;
     
    205218  for(; itr != EvtMap->GetMap()->end(); itr++) {
    206219    G4cout << "  copy no.: " << itr->first
    207            << "  current  : " << *(itr->second)
     220           << "  current  : " << *(itr->second)/GetUnitValue()
     221           << " ["<<GetUnit()<<"]"
    208222           << G4endl;
    209223  }
    210224}
    211225
     226void 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
     241void 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.