Ignore:
Timestamp:
Dec 22, 2010, 3:52:27 PM (13 years ago)
Author:
garnier
Message:

geant4 tag 9.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/geometry/navigation/src/G4NormalNavigation.cc

    r1337 r1347  
    2525//
    2626//
    27 // $Id: G4NormalNavigation.cc,v 1.9 2007/05/11 13:43:59 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4NormalNavigation.cc,v 1.11 2010/11/04 08:57:56 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-04-ref-00 $
    2929//
    3030//
     
    3838#include "G4AffineTransform.hh"
    3939
    40 #include <iomanip>
    41 
    4240// ********************************************************************
    4341// Constructor
     
    4543//
    4644G4NormalNavigation::G4NormalNavigation()
    47   : fCheck(false), fVerbose(0)
    48 {
     45  : fCheck(false)
     46{
     47  fLogger = new G4NavigationLogger("G4NormalNavigation");
    4948}
    5049
     
    5453//
    5554G4NormalNavigation::~G4NormalNavigation()
    56 {;}
     55{
     56  delete fLogger;
     57}
    5758
    5859// ********************************************************************
     
    9091 
    9192#ifdef G4VERBOSE
    92   static G4int precVerf= 20;  // Precision
    9393  if ( fCheck )
    9494  {
    95     if( fVerbose == 1 )
    96     {
    97       G4cout << "*** G4NormalNavigation::ComputeStep(): ***" << G4endl
    98              << "    Invoked DistanceToOut(p) for mother solid: "
    99              << motherSolid->GetName()
    100              << ". Solid replied: " << motherSafety << G4endl
    101              << "    For local point p: " << localPoint << G4endl
    102              << "    To be considered as 'mother safety'." << G4endl;
    103     }
    104     if ( motherSafety < 0.0 )
    105     {
    106       G4cerr << "ERROR - G4NormalNavigation::ComputeStep()" << G4endl
    107              << "        Current solid " << motherSolid->GetName()
    108              << " gave negative safety: " << motherSafety << G4endl
    109              << "        for the current (local) point " << localPoint
    110              << G4endl;
    111       motherSolid->DumpInfo();
    112       G4Exception("G4NormalNavigation::ComputeStep()",
    113                   "NegativeSafetyMotherVol", FatalException,
    114                   "Negative Safety In Voxel Navigation !" );
    115     }
    116     if( motherSolid->Inside(localPoint)==kOutside )
    117     {
    118       G4cout << "WARNING - G4NormalNavigation::ComputeStep()" << G4endl
    119              << "          Point " << localPoint
    120              << " is outside current volume " << motherPhysical->GetName()
    121              << G4endl;
    122       G4double estDistToSolid= motherSolid->DistanceToIn(localPoint);
    123       G4cout << "          Estimated isotropic distance to solid (distToIn)= "
    124              << estDistToSolid << G4endl;
    125       if( estDistToSolid > 100.0 * motherSolid->GetTolerance() )
    126       {
    127         motherSolid->DumpInfo();
    128         G4Exception("G4NormalNavigation::ComputeStep()",
    129                     "FarOutsideCurrentVolume", FatalException,
    130                     "Point is far outside Current Volume !" );
    131       }
    132       else
    133         G4Exception("G4NormalNavigation::ComputeStep()", "OutsideCurrentVolume",
    134                     JustWarning, "Point is a little outside Current Volume.");
    135     }
    136 
    137     // Verification / verbosity
    138     //
    139     if ( fVerbose > 1 )
    140     {
    141       G4int oldprec = G4cout.precision(precVerf);
    142       G4cout << " G4NormalNavigation::ComputeStep()"
    143              << " - Information on mother / key daughters ..." << G4endl;
    144       G4cout << " Type   " << std::setw(12) << "Solid-Name"   << " "
    145              << std::setw(3*(6+precVerf))   << " local point" << " "
    146              << std::setw(4+precVerf)       << "solid-Safety" << " "
    147              << std::setw(4+precVerf)       << "solid-Step"   << " "
    148              << std::setw(17)               << "distance Method "
    149              << std::setw(3*(6+precVerf))   << " local direction" << " "
    150              << G4endl;
    151       G4cout << " Mother " << std::setw(12) << motherSolid->GetName() << " "
    152              << std::setw(4+precVerf)       << localPoint   << " "
    153              << std::setw(4+precVerf)       << motherSafety << " "
    154              << G4endl;
    155       G4cout.precision(oldprec);
    156     }
    157 
     95    fLogger->PreComputeStepLog(motherPhysical, motherSafety, localPoint);
    15896  }
    15997#endif
     
    193131      const G4double sampleSafety =
    194132              sampleSolid->DistanceToIn(samplePoint);
     133#ifdef G4VERBOSE
     134      if( fCheck )
     135      {
     136        fLogger->PrintDaughterLog(sampleSolid, samplePoint, sampleSafety, 0);
     137      }
     138#endif
    195139      if ( sampleSafety<ourSafety )
    196140      {
     
    202146        const G4double sampleStep =
    203147                sampleSolid->DistanceToIn(samplePoint,sampleDirection);
    204 #ifdef G4VERBOSE
    205         if(( fCheck ) && ( fVerbose == 1 ))
     148
     149#ifdef G4VERBOSE
     150        if( fCheck )
    206151        {
    207           G4cout << "*** G4NormalNavigation::ComputeStep(): ***" << G4endl
    208                  << "    Invoked DistanceToIn(p,v) for daughter solid: "
    209                  << sampleSolid->GetName()
    210                  << ". Solid replied: " << sampleStep << G4endl
    211                  << "    For local point p: " << samplePoint << G4endl
    212                  << "    Direction v: " << sampleDirection
    213                  << ", to be considered as 'daughter step'." << G4endl;
     152          fLogger->PrintDaughterLog(sampleSolid, samplePoint,
     153                                    sampleSafety, sampleStep);
    214154        }
    215155#endif
     
    221161          *pBlockedPhysical = samplePhysical;
    222162          blockedReplicaNo  = -1;
    223 
    224 #ifdef G4VERBOSE
    225           // Check to see that the resulting point is indeed in/on volume.
    226           // This check could eventually be made only for successful candidate.
    227 
    228           if ( ( fCheck ) && ( sampleStep < kInfinity ) )
     163#ifdef G4VERBOSE
     164          if( fCheck )
    229165          {
    230             G4ThreeVector intersectionPoint;
    231             intersectionPoint= samplePoint + sampleStep * sampleDirection;
    232             EInside insideIntPt= sampleSolid->Inside(intersectionPoint);
    233             G4String solidResponse = "-kInside-";
    234             if (insideIntPt == kOutside)
    235               solidResponse = "-kOutside-";
    236             else if (insideIntPt == kSurface)
    237               solidResponse = "-kSurface-";
    238             if( fVerbose == 1 )
    239             {
    240               G4cout << "*** G4NormalNavigation::ComputeStep(): ***" << G4endl
    241                      << "    Invoked Inside() for solid: "
    242                      << sampleSolid->GetName()
    243                      << ". Solid replied: " << solidResponse << G4endl
    244                      << "    For point p: " << intersectionPoint
    245                      << ", considered as 'intersection' point." << G4endl;
    246             }
    247             if ( insideIntPt != kSurface )
    248             {
    249               G4int oldcoutPrec = G4cout.precision(16);
    250               G4cout << "WARNING - G4NormalNavigation::ComputeStep()" << G4endl
    251                      << "          Inaccurate DistanceToIn for solid "
    252                      << sampleSolid->GetName() << G4endl;
    253               G4cout << "          Solid gave DistanceToIn = " << sampleStep
    254                      << " yet returns " << solidResponse
    255                      << " for this point !" << G4endl;
    256               G4cout << "          Point = " << intersectionPoint << G4endl;
    257               if ( insideIntPt != kInside )
    258                 G4cout << "        DistanceToIn(p) = "
    259                        << sampleSolid->DistanceToIn(intersectionPoint)
    260                        << G4endl;
    261               if ( insideIntPt != kOutside )
    262                 G4cout << "        DistanceToOut(p) = "
    263                        << sampleSolid->DistanceToOut(intersectionPoint)
    264                        << G4endl;
    265               G4Exception("G4NormalNavigation::ComputeStep()",
    266                           "InaccurateDistanceToIn", JustWarning,
    267                           "Navigator gets conflicting response from Solid.");
    268               G4cout.precision(oldcoutPrec);
    269             }
    270           }
    271 
    272           // Verification / verbosity
    273           //
    274           if ( fVerbose > 1 )
    275           {
    276             G4int oldprec = G4cout.precision(precVerf);
    277             G4cout << " Daught "
    278                    << std::setw(12)         << sampleSolid->GetName() << " "
    279                    << std::setw(4+precVerf) << samplePoint  << " "
    280                    << std::setw(4+precVerf) << sampleSafety << " "
    281                    << std::setw(4+precVerf) << sampleStep   << " "
    282                    << std::setw(16)         << "distanceToIn" << " "
    283                    << std::setw(4+precVerf) << localDirection << " "
    284                    << G4endl;
    285             G4cout.precision(oldprec);
     166            fLogger->AlongComputeStepLog(sampleSolid, samplePoint,
     167              sampleDirection, localDirection, sampleSafety, sampleStep);
    286168          }
    287169#endif
     
    313195      if ( fCheck )
    314196      {
    315         if( fVerbose == 1 )
    316         {
    317           G4cout << "*** G4NormalNavigation::ComputeStep(): ***" << G4endl
    318                  << "    Invoked DistanceToOut(p,v,...) for mother solid: "
    319                  << motherSolid->GetName()
    320                  << ". Solid replied: " << motherStep << G4endl
    321                  << "    For local point p: " << localPoint << G4endl
    322                  << "    Direction v: " << localDirection
    323                  << ", to be considered as 'mother step'." << G4endl;
    324         }
    325         if( ( motherStep < 0.0 ) || ( motherStep >= kInfinity) )
    326         {
    327           G4cerr << "ERROR - G4NormalNavigation::ComputeStep()" << G4endl
    328                  << "        Problem in Navigation"  << G4endl
    329                  << "        Point (local coordinates): "
    330                  << localPoint << G4endl
    331                  << "        Local Direction: " << localDirection << G4endl
    332                  << "        Solid: " << motherSolid->GetName() << G4endl;
    333           motherSolid->DumpInfo();
    334           G4Exception("G4NormalNavigation::ComputeStep()",
    335                       "PointDistOutInvalid", FatalException,
    336                       "Current point is outside the current solid !");
    337         }
    338       }
    339       if ( fVerbose > 1 )
    340       {
    341         G4int oldprec = G4cout.precision(precVerf);
    342         G4cout << " Mother " << std::setw(12) << motherSolid->GetName() << " "
    343                << std::setw(4+precVerf)       << localPoint   << " "
    344                << std::setw(4+precVerf)       << motherSafety << " "
    345                << std::setw(4+precVerf)       << motherStep   << " "
    346                << std::setw(16)               << "distanceToOut" << " "
    347                << std::setw(4+precVerf)       << localDirection << " "
    348                << G4endl;
    349         G4cout.precision(oldprec);     
     197        fLogger->PostComputeStepLog(motherSolid, localPoint, localDirection,
     198                                    motherStep, motherSafety);
    350199      }
    351200#endif
     
    399248
    400249#ifdef G4VERBOSE
    401   if(( fCheck ) && ( fVerbose == 1 ))
    402   {
    403     G4cout << "*** G4NormalNavigation::ComputeSafety(): ***" << G4endl
    404            << "    Invoked DistanceToOut(p) for mother solid: "
    405            << motherSolid->GetName()
    406            << ". Solid replied: " << motherSafety << G4endl
    407            << "    For local point p: " << localPoint
    408            << ", to be considered as 'mother safety'." << G4endl;
     250  if( fCheck )
     251  {
     252    fLogger->ComputeSafetyLog(motherSolid, localPoint, motherSafety, true);
    409253  }
    410254#endif
     
    430274    }
    431275#ifdef G4VERBOSE
    432     if(( fCheck ) && ( fVerbose == 1 ))
    433     {
    434       G4cout << "*** G4NormalNavigation::ComputeSafety(): ***" << G4endl
    435              << "    Invoked DistanceToIn(p) for daughter solid: "
    436              << sampleSolid->GetName()
    437              << ". Solid replied: " << sampleSafety << G4endl
    438              << "    For local point p: " << samplePoint
    439              << ", to be considered as 'daughter safety'." << G4endl;
     276    if(fCheck)
     277    {
     278      fLogger->ComputeSafetyLog(sampleSolid, samplePoint, sampleSafety, false);
    440279    }
    441280#endif
Note: See TracChangeset for help on using the changeset viewer.