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

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4PSFlatSurfaceCurrent.cc,v 1.3 2008/12/29 00:17:14 asaim Exp $
    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: $
    2929//
    3030// G4PSFlatSurfaceCurrent
     
    5151// 17-Nov-2005 T.Aso, Bug fix for area definition.
    5252// 31-Mar-2007 T.Aso, Add option for normalizing by the area.
     53// 2010-07-22   Introduce Unit specification.
    5354//
    5455///////////////////////////////////////////////////////////////////////////////
     
    5960    :G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),
    6061     weighted(true),divideByArea(true)
    61 {;}
     62{
     63    DefineUnitAndCategory();
     64    SetUnit("percm2");
     65}
     66
     67G4PSFlatSurfaceCurrent::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}
    6277
    6378G4PSFlatSurfaceCurrent::~G4PSFlatSurfaceCurrent()
     
    8297  }
    8398
    84 //  if( solid->GetEntityType() != "G4Box" ){
    85 //    G4Exception("G4PSFlatSurfaceCurrentScorer. - Solid type is not supported.");
    86 //    return FALSE;
    87 //  }
    8899  G4Box* boxSolid = (G4Box*)(solid);
    89100
     
    160171  for(; itr != EvtMap->GetMap()->end(); itr++) {
    161172      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      }
    164179      G4cout << G4endl;
    165180  }
    166181}
    167182
     183void 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
     198void 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.