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

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4PSCylinderSurfaceCurrent.cc,v 1.3 2009/11/14 00:01:13 asaim Exp $
    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: $
    2929//
    3030// G4PSCylinderSurfaceCurrent
     
    4949//
    5050// Created: 2007-03-21  Tsukasa ASO
     51// 2010-07-22   Introduce Unit specification.
    5152//
    5253///////////////////////////////////////////////////////////////////////////////
     
    5758  :G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),
    5859   weighted(true),divideByArea(true)
    59 {;}
     60{
     61    DefineUnitAndCategory();
     62    SetUnit("percm2");
     63}
     64
     65G4PSCylinderSurfaceCurrent::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}
    6075
    6176G4PSCylinderSurfaceCurrent::~G4PSCylinderSurfaceCurrent()
     
    8095  }
    8196
    82 //  if( solid->GetEntityType() != "G4Tubs" ){
    83 //    G4Exception("G4PSCylinderSurfaceCurrentScorer. - Solid type is not supported.");
    84 //    return FALSE;
    85 //  }
    8697  G4Tubs* tubsSolid = (G4Tubs*)(solid);
    8798
     
    122133      theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos1);
    123134    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 ){
    127135    G4double localR2 = localpos1.x()*localpos1.x()+localpos1.y()*localpos1.y();
    128136    G4double InsideRadius = tubsSolid->GetInnerRadius();
     
    139147      theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos2);
    140148    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 ){
    144149    G4double localR2 = localpos2.x()*localpos2.x()+localpos2.y()*localpos2.y();
    145150    G4double InsideRadius = tubsSolid->GetInnerRadius();
     
    179184    G4cout << "  copy no.: " << itr->first
    180185           << "  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    }
    183192    G4cout << G4endl;
    184193  }
    185194}
    186195
     196void 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
     211void 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.