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

update ti head

Location:
trunk/source/geometry/management/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/geometry/management/src/G4ErrorTarget.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ErrorTarget.cc,v 1.1 2007/05/16 12:50:52 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4ErrorTarget.cc,v 1.2 2010/07/05 09:22:58 gcosmo Exp $
     28// GEANT4 tag $Name: geommng-V09-03-05 $
    2929//
    3030//
     
    3535#include "G4ErrorTarget.hh"
    3636
    37 G4ErrorTarget::G4ErrorTarget(){}
    38 G4ErrorTarget::~G4ErrorTarget(){}
     37G4ErrorTarget::G4ErrorTarget()
     38 : theType(G4ErrorTarget_GeomVolume) {}
     39
     40G4ErrorTarget::~G4ErrorTarget() {}
    3941
    4042G4double G4ErrorTarget::GetDistanceFromPoint( const G4ThreeVector&,
  • trunk/source/geometry/management/src/G4GeometryManager.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4GeometryManager.cc,v 1.22 2008/05/16 13:46:48 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4GeometryManager.cc,v 1.24 2010/07/16 15:52:57 gcosmo Exp $
     28// GEANT4 tag $Name: geommng-V09-03-05 $
    2929//
    3030// class G4GeometryManager
     
    261261#ifdef G4GEOMETRY_VOXELDEBUG
    262262     G4cout << "**** G4GeometryManager::BuildOptimisations" << G4endl
    263             << "     Skipping logical volume name = " << volume->GetName()
     263            << "     Skipping logical volume name = " << tVolume->GetName()
    264264            << G4endl;
    265265#endif
     
    359359         << totalMemory/1024 << " kByte" << G4endl;
    360360  G4cout << "    Total CPU time elapsed for geometry optimisation: "
    361          << std::setprecision(2) << totalCpuTime << " seconds" << G4endl;
     361         << std::setprecision(2) << totalCpuTime << " seconds"
     362         << std::setprecision(6) << G4endl;
    362363 
    363364  //
  • trunk/source/geometry/management/src/G4LogicalVolume.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4LogicalVolume.cc,v 1.34 2009/09/24 13:22:57 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4LogicalVolume.cc,v 1.35 2010/07/05 09:22:58 gcosmo Exp $
     28// GEANT4 tag $Name: geommng-V09-03-05 $
    2929//
    3030//
     
    211211    G4Exception("G4LogicalVolume::GetMass()", "InvalidSetup", FatalException,
    212212                "No material associated to the logical volume !");
     213    return 0;
    213214  }
    214215  if (!fSolid)
     
    219220    G4Exception("G4LogicalVolume::GetMass()", "InvalidSetup", FatalException,
    220221                "No solid associated to the logical volume !");
     222    return 0;
    221223  }
    222224  G4double globalDensity = logMaterial->GetDensity();
  • trunk/source/geometry/management/src/G4ReflectedSolid.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ReflectedSolid.cc,v 1.11 2006/11/08 09:56:33 gcosmo Exp $
    28 //
    29 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4ReflectedSolid.cc,v 1.13 2010/10/19 15:20:18 gcosmo Exp $
     28//
     29// GEANT4 tag $Name: geommng-V09-03-05 $
    3030//
    3131// Implementation for G4ReflectedSolid class for boolean
     
    9393}
    9494
     95///////////////////////////////////////////////////////////////////
     96//
     97
     98G4ReflectedSolid::G4ReflectedSolid(const G4ReflectedSolid& rhs)
     99  : G4VSolid(rhs), fPtrSolid(rhs.fPtrSolid), fpPolyhedron(0)
     100{
     101  fPtrTransform      = new G4AffineTransform(*rhs.fPtrTransform);
     102  fDirectTransform   = new G4AffineTransform(*rhs.fDirectTransform);
     103  fPtrTransform3D    = new G4Transform3D(*rhs.fPtrTransform3D);
     104  fDirectTransform3D = new G4Transform3D(*rhs.fDirectTransform3D);
     105}
     106
     107///////////////////////////////////////////////////////////////////
     108//
     109
     110G4ReflectedSolid& G4ReflectedSolid::operator=(const G4ReflectedSolid& rhs)
     111{
     112  // Check assignment to self
     113  //
     114  if (this == &rhs)  { return *this; }
     115
     116  // Copy base class data
     117  //
     118  G4VSolid::operator=(rhs);
     119
     120  // Copy data
     121  //
     122  fPtrSolid= rhs.fPtrSolid; fpPolyhedron= 0;
     123  delete fPtrTransform;
     124  fPtrTransform= new G4AffineTransform(*rhs.fPtrTransform);
     125  delete fDirectTransform;
     126  fDirectTransform= new G4AffineTransform(*rhs.fDirectTransform);
     127  delete fPtrTransform3D;
     128  fPtrTransform3D= new G4Transform3D(*rhs.fPtrTransform3D);
     129  delete fDirectTransform3D;
     130  fDirectTransform3D= new G4Transform3D(*rhs.fDirectTransform3D);
     131
     132  return *this;
     133}
     134
     135///////////////////////////////////////////////////////////////////
     136//
     137
    95138G4GeometryType G4ReflectedSolid::GetEntityType() const
    96139{
     
    257300  G4Point3D tmpPoint;
    258301
    259 // Calculate rotated vertex coordinates
     302  // Calculate rotated vertex coordinates
    260303
    261304  G4ThreeVectorList* vertices = new G4ThreeVectorList();
    262   vertices->reserve(8);
    263305
    264306  if (vertices)
    265307  {
     308    vertices->reserve(8);
     309
    266310    G4ThreeVector vertex0(x1,y1,z1) ;
    267311    tmpPoint    = transform3D*G4Point3D(vertex0);
     
    494538{
    495539  DumpInfo();
    496   G4Exception("G4BooleanSolid::ComputeDimensions()",
     540  G4Exception("G4ReflectedSolid::ComputeDimensions()",
    497541               "NotApplicable", FatalException,
    498542               "Method not applicable in this context!");
     
    511555  return G4ThreeVector(newPoint.x(),newPoint.y(),newPoint.z());
    512556}
     557
     558//////////////////////////////////////////////////////////////////////////
     559//
     560// Make a clone of this object
     561
     562G4VSolid* G4ReflectedSolid::Clone() const
     563{
     564  return new G4ReflectedSolid(*this);
     565}
     566
    513567
    514568//////////////////////////////////////////////////////////////////////////
  • trunk/source/geometry/management/src/G4SmartVoxelHeader.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4SmartVoxelHeader.cc,v 1.35 2010/02/09 16:50:25 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4SmartVoxelHeader.cc,v 1.39 2010/09/06 09:39:21 gcosmo Exp $
     28// GEANT4 tag $Name: geommng-V09-03-05 $
    2929//
    3030//
     
    148148      }
    149149    }
    150       else
     150    else
    151151    {
    152152      dyingNode = fslices[node]->GetNode();
     
    510510          pTestSlices->pop_back();
    511511          for (G4ProxyVector::iterator i=pTestSlices->begin();
    512                                        i!=pTestSlices->end(); i++)
     512                                       i!=pTestSlices->end(); )
    513513          {
    514514            if (*i==tmpProx)
    515515            {
    516               pTestSlices->erase(i); i--;
     516              i = pTestSlices->erase(i);
     517            }
     518            else
     519            {
     520              ++i;
    517521            }
    518522          }
    519523          if ( tmpProx ) { delete tmpProx; }
    520         } 
     524        }
    521525        delete pTestSlices;
    522526      }
     
    534538                "InvalidSetup", FatalException,
    535539                "Cannot select more than 3 axis for optimisation.");
     540    return;
    536541  }
    537542
     
    548553
    549554#ifdef G4GEOMETRY_VOXELDEBUG
    550   G4cout << G4endl << "     Selected axis = " << faxis << G4endl;
     555  G4cout << G4endl << "     Volume = " << pVolume->GetName()
     556         << G4endl << "     Selected axis = " << faxis << G4endl;
    551557  for (size_t islice=0; islice<fslices.size(); islice++)
    552558  {
     
    808814      G4Exception("G4SmartVoxelHeader::BuildNodes()", "InvalidSetup",
    809815                  FatalException, "Missing parameterisation.");
     816      return 0;
    810817    }
    811818
     
    864871    minExtents[nVol] = targetMinExtent;
    865872    maxExtents[nVol] = targetMaxExtent;
     873
     874#ifdef G4GEOMETRY_VOXELDEBUG
     875   G4cout << "---------------------------------------------------" << G4endl
     876          << "     Volume = " << pDaughter->GetName() << G4endl
     877          << " Min Extent = " << targetMinExtent << G4endl
     878          << " Max Extent = " << targetMaxExtent << G4endl
     879          << "---------------------------------------------------" << G4endl;
     880#endif
    866881
    867882    // Check not entirely outside mother when processing toplevel nodes
     
    960975  G4double nodeWidth = (motherMaxExtent-motherMinExtent)/noNodes;
    961976
    962 // Create G4VoxelNodes. Will Add proxies before setting fslices
    963 //
     977  // Create G4VoxelNodes. Will Add proxies before setting fslices
     978  //
    964979  G4NodeVector* nodeList = new G4NodeVector();
    965   nodeList->reserve(noNodes);
    966980  if (!nodeList)
    967981  {
     
    970984    G4Exception("G4SmartVoxelHeader::BuildNodes()", "FatalError",
    971985                FatalException, "NodeList allocation error.");
    972   }
     986    return 0;
     987  }
     988  nodeList->reserve(noNodes);
     989
    973990  for (nNode=0; nNode<noNodes; nNode++)
    974991  {
     
    981998      G4Exception("G4SmartVoxelHeader::BuildNodes()", "FatalError",
    982999                  FatalException, "Node allocation error.");
     1000      return 0;
    9831001    }
    9841002    nodeList->push_back(pNode);
     
    10261044  //
    10271045  G4ProxyVector* proxyList = new G4ProxyVector();
    1028   proxyList->reserve(noNodes);
    10291046  if (!proxyList)
    10301047  {
     
    10331050    G4Exception("G4SmartVoxelHeader::BuildNodes()", "FatalError",
    10341051                FatalException, "Proxy list allocation error.");
    1035   }
     1052    return 0;
     1053  }
     1054  proxyList->reserve(noNodes);
     1055
    10361056  //
    10371057  // Fill proxy List
     
    10491069      G4Exception("G4SmartVoxelHeader::BuildNodes()", "FatalError",
    10501070                  FatalException, "Proxy node allocation failed.");
     1071      return 0;
    10511072    }
    10521073    proxyList->push_back(pProxyNode);
     
    11961217        noContainedDaughters = targetNode->GetNoContained();
    11971218        targetList = new G4VolumeNosVector();
    1198         targetList->reserve(noContainedDaughters);
    11991219        if (!targetList)
    12001220        {
     
    12051225                      "FatalError", FatalException,
    12061226                      "Target volume node list allocation error.");
    1207         }
     1227          return;
     1228        }
     1229        targetList->reserve(noContainedDaughters);
    12081230        for (i=0; i<noContainedDaughters; i++)
    12091231        {
     
    12181240               << " - " << maxNo << " inclusive" << G4endl;
    12191241#endif
     1242        if (minNo > maxNo)    // Delete node and list to be replaced
     1243        {                     // and avoid further action ...
     1244          delete targetNode;
     1245          delete targetList;
     1246          return;
     1247        }
     1248
    12201249        // Delete node proxies at start of collected sets of nodes/headers
    12211250        //
     
    12461275          G4Exception("G4SmartVoxelHeader::RefineNodes()", "FatalError",
    12471276                      FatalException, "Refined VoxelHeader allocation error.");
     1277          return;
    12481278        }
    12491279        replaceHeader->SetMinEquivalentSliceNo(minNo);
    12501280        replaceHeader->SetMaxEquivalentSliceNo(maxNo);
    12511281        replaceHeaderProxy = new G4SmartVoxelProxy(replaceHeader);
    1252         if (!replaceHeader)
     1282        if (!replaceHeaderProxy)
    12531283        {
    12541284          G4cerr << "ERROR - G4SmartVoxelHeader::RefineNodes()" << G4endl
     
    12561286          G4Exception("G4SmartVoxelHeader::RefineNodes()", "FatalError",
    12571287                      FatalException, "Refined VoxelProxy allocation error.");
     1288          return;
    12581289        }
    12591290        for (replaceNo=minNo; replaceNo<=maxNo; replaceNo++)
  • trunk/source/geometry/management/src/G4VSolid.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4VSolid.cc,v 1.39 2008/09/23 13:07:41 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4VSolid.cc,v 1.40 2010/10/19 15:19:37 gcosmo Exp $
     28// GEANT4 tag $Name: geommng-V09-03-05 $
    2929//
    3030// class G4VSolid
     
    158158        JustWarning, "Not implemented for this solid ! Returning origin.");
    159159    return G4ThreeVector(0,0,0);
     160}
     161
     162//////////////////////////////////////////////////////////////////////////
     163//
     164// Dummy implementations ...
     165
     166const G4VSolid* G4VSolid::GetConstituentSolid(G4int) const
     167{ return 0; }
     168
     169G4VSolid* G4VSolid::GetConstituentSolid(G4int)
     170{ return 0; }
     171
     172const G4DisplacedSolid* G4VSolid::GetDisplacedSolidPtr() const
     173{ return 0; }
     174
     175G4DisplacedSolid* G4VSolid::GetDisplacedSolidPtr()
     176{ return 0; }
     177
     178////////////////////////////////////////////////////////////////
     179//
     180// Returns an estimation of the solid volume in internal units.
     181// The number of statistics and error accuracy is fixed.
     182// This method may be overloaded by derived classes to compute the
     183// exact geometrical quantity for solids where this is possible.
     184// or anyway to cache the computed value.
     185// This implementation does NOT cache the computed value.
     186
     187G4double G4VSolid::GetCubicVolume()
     188{
     189  G4int cubVolStatistics = 1000000;
     190  G4double cubVolEpsilon = 0.001;
     191  return EstimateCubicVolume(cubVolStatistics, cubVolEpsilon);
     192}
     193
     194////////////////////////////////////////////////////////////////
     195//
     196// Calculate cubic volume based on Inside() method.
     197// Accuracy is limited by the second argument or the statistics
     198// expressed by the first argument.
     199// Implementation is courtesy of Vasiliki Despoina Mitsou,
     200// University of Athens.
     201
     202G4double G4VSolid::EstimateCubicVolume(G4int nStat, G4double epsilon) const
     203{
     204  G4int iInside=0;
     205  G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,volume;
     206  G4bool yesno;
     207  G4ThreeVector p;
     208  EInside in;
     209
     210  // values needed for CalculateExtent signature
     211
     212  G4VoxelLimits limit;                // Unlimited
     213  G4AffineTransform origin;
     214
     215  // min max extents of pSolid along X,Y,Z
     216
     217  yesno = this->CalculateExtent(kXAxis,limit,origin,minX,maxX);
     218  yesno = this->CalculateExtent(kYAxis,limit,origin,minY,maxY);
     219  yesno = this->CalculateExtent(kZAxis,limit,origin,minZ,maxZ);
     220
     221  // limits
     222
     223  if(nStat < 100)    nStat   = 100;
     224  if(epsilon > 0.01) epsilon = 0.01;
     225
     226  for(G4int i = 0; i < nStat; i++ )
     227  {
     228    px = minX+(maxX-minX)*G4UniformRand();
     229    py = minY+(maxY-minY)*G4UniformRand();
     230    pz = minZ+(maxZ-minZ)*G4UniformRand();
     231    p  = G4ThreeVector(px,py,pz);
     232    in = this->Inside(p);
     233    if(in != kOutside) iInside++;   
     234  }
     235  volume = (maxX-minX)*(maxY-minY)*(maxZ-minZ)*iInside/nStat;
     236  return volume;
     237}
     238
     239////////////////////////////////////////////////////////////////
     240//
     241// Returns an estimation of the solid surface area in internal units.
     242// The number of statistics and error accuracy is fixed.
     243// This method may be overloaded by derived classes to compute the
     244// exact geometrical quantity for solids where this is possible.
     245// or anyway to cache the computed value.
     246// This implementation does NOT cache the computed value.
     247
     248G4double G4VSolid::GetSurfaceArea()
     249{
     250  G4int stat = 1000000;
     251  G4double ell = -1.;
     252  return EstimateSurfaceArea(stat,ell);
     253}
     254
     255////////////////////////////////////////////////////////////////
     256//
     257// Estimate surface area based on Inside(), DistanceToIn(), and
     258// DistanceToOut() methods. Accuracy is limited by the statistics
     259// defined by the first argument. Implemented by Mikhail Kosov.
     260
     261G4double G4VSolid::EstimateSurfaceArea(G4int nStat, G4double ell) const
     262{
     263  G4int inside=0;
     264  G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,surf;
     265  G4bool yesno;
     266  G4ThreeVector p;
     267  EInside in;
     268
     269  // values needed for CalculateExtent signature
     270
     271  G4VoxelLimits limit;                // Unlimited
     272  G4AffineTransform origin;
     273
     274  // min max extents of pSolid along X,Y,Z
     275
     276  yesno = this->CalculateExtent(kXAxis,limit,origin,minX,maxX);
     277  yesno = this->CalculateExtent(kYAxis,limit,origin,minY,maxY);
     278  yesno = this->CalculateExtent(kZAxis,limit,origin,minZ,maxZ);
     279
     280  // limits
     281
     282  if(nStat < 100) { nStat = 100; }
     283
     284  G4double dX=maxX-minX;
     285  G4double dY=maxY-minY;
     286  G4double dZ=maxZ-minZ;
     287  if(ell<=0.)          // Automatic definition of skin thickness
     288  {
     289    G4double minval=dX;
     290    if(dY<dX) { minval=dY; }
     291    if(dZ<minval) { minval=dZ; }
     292    ell=.01*minval;
     293  }
     294
     295  G4double dd=2*ell;
     296  minX-=ell; minY-=ell; minZ-=ell; dX+=dd; dY+=dd; dZ+=dd;
     297
     298  for(G4int i = 0; i < nStat; i++ )
     299  {
     300    px = minX+dX*G4UniformRand();
     301    py = minY+dY*G4UniformRand();
     302    pz = minZ+dZ*G4UniformRand();
     303    p  = G4ThreeVector(px,py,pz);
     304    in = this->Inside(p);
     305    if(in != kOutside)
     306    {
     307      if  (DistanceToOut(p)<ell) { inside++; }
     308    }
     309    else if(DistanceToIn(p)<ell) { inside++; }
     310  }
     311  // @@ The conformal correction can be upgraded
     312  surf = dX*dY*dZ*inside/dd/nStat;
     313  return surf;
     314}
     315
     316///////////////////////////////////////////////////////////////////////////
     317//
     318// Returns a pointer of a dynamically allocated copy of the solid.
     319// Returns NULL pointer with warning in case the concrete solid does not
     320// implement this method. The caller has responsibility for ownership.
     321//
     322
     323G4VSolid* G4VSolid::Clone() const
     324{
     325  G4String ErrMessage = "Clone() method not implemented for type: "
     326                      + GetEntityType() + "! Returning NULL pointer!";
     327  G4Exception("G4VSolid::Clone()", "NotImplemented",
     328              JustWarning, ErrMessage);
     329  return 0;
    160330}
    161331
     
    447617}
    448618
    449 const G4VSolid* G4VSolid::GetConstituentSolid(G4int) const
    450 { return 0; }
    451 
    452 G4VSolid* G4VSolid::GetConstituentSolid(G4int)
    453 { return 0; }
    454 
    455 const G4DisplacedSolid* G4VSolid::GetDisplacedSolidPtr() const
    456 { return 0; }
    457 
    458 G4DisplacedSolid* G4VSolid::GetDisplacedSolidPtr()
    459 { return 0; }
    460 
    461619G4VisExtent G4VSolid::GetExtent () const
    462620{
     
    491649  return 0;
    492650}
    493 
    494 ////////////////////////////////////////////////////////////////
    495 //
    496 // Returns an estimation of the solid volume in internal units.
    497 // The number of statistics and error accuracy is fixed.
    498 // This method may be overloaded by derived classes to compute the
    499 // exact geometrical quantity for solids where this is possible.
    500 // or anyway to cache the computed value.
    501 // This implementation does NOT cache the computed value.
    502 
    503 G4double G4VSolid::GetCubicVolume()
    504 {
    505   G4int cubVolStatistics = 1000000;
    506   G4double cubVolEpsilon = 0.001;
    507   return EstimateCubicVolume(cubVolStatistics, cubVolEpsilon);
    508 }
    509 
    510 ////////////////////////////////////////////////////////////////
    511 //
    512 // Calculate cubic volume based on Inside() method.
    513 // Accuracy is limited by the second argument or the statistics
    514 // expressed by the first argument.
    515 // Implementation is courtesy of Vasiliki Despoina Mitsou,
    516 // University of Athens.
    517 
    518 G4double G4VSolid::EstimateCubicVolume(G4int nStat, G4double epsilon) const
    519 {
    520   G4int iInside=0;
    521   G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,volume;
    522   G4bool yesno;
    523   G4ThreeVector p;
    524   EInside in;
    525 
    526   // values needed for CalculateExtent signature
    527 
    528   G4VoxelLimits limit;                // Unlimited
    529   G4AffineTransform origin;
    530 
    531   // min max extents of pSolid along X,Y,Z
    532 
    533   yesno = this->CalculateExtent(kXAxis,limit,origin,minX,maxX);
    534   yesno = this->CalculateExtent(kYAxis,limit,origin,minY,maxY);
    535   yesno = this->CalculateExtent(kZAxis,limit,origin,minZ,maxZ);
    536 
    537   // limits
    538 
    539   if(nStat < 100)    nStat   = 100;
    540   if(epsilon > 0.01) epsilon = 0.01;
    541 
    542   for(G4int i = 0; i < nStat; i++ )
    543   {
    544     px = minX+(maxX-minX)*G4UniformRand();
    545     py = minY+(maxY-minY)*G4UniformRand();
    546     pz = minZ+(maxZ-minZ)*G4UniformRand();
    547     p  = G4ThreeVector(px,py,pz);
    548     in = this->Inside(p);
    549     if(in != kOutside) iInside++;   
    550   }
    551   volume = (maxX-minX)*(maxY-minY)*(maxZ-minZ)*iInside/nStat;
    552   return volume;
    553 }
    554 
    555 ////////////////////////////////////////////////////////////////
    556 //
    557 // Returns an estimation of the solid surface area in internal units.
    558 // The number of statistics and error accuracy is fixed.
    559 // This method may be overloaded by derived classes to compute the
    560 // exact geometrical quantity for solids where this is possible.
    561 // or anyway to cache the computed value.
    562 // This implementation does NOT cache the computed value.
    563 
    564 G4double G4VSolid::GetSurfaceArea()
    565 {
    566   G4int stat = 1000000;
    567   G4double ell = -1.;
    568   return EstimateSurfaceArea(stat,ell);
    569 }
    570 
    571 ////////////////////////////////////////////////////////////////
    572 //
    573 // Estimate surface area based on Inside(), DistanceToIn(), and
    574 // DistanceToOut() methods. Accuracy is limited by the statistics
    575 // defined by the first argument. Implemented by Mikhail Kosov.
    576 
    577 G4double G4VSolid::EstimateSurfaceArea(G4int nStat, G4double ell) const
    578 {
    579   G4int inside=0;
    580   G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,surf;
    581   G4bool yesno;
    582   G4ThreeVector p;
    583   EInside in;
    584 
    585   // values needed for CalculateExtent signature
    586 
    587   G4VoxelLimits limit;                // Unlimited
    588   G4AffineTransform origin;
    589 
    590   // min max extents of pSolid along X,Y,Z
    591 
    592   yesno = this->CalculateExtent(kXAxis,limit,origin,minX,maxX);
    593   yesno = this->CalculateExtent(kYAxis,limit,origin,minY,maxY);
    594   yesno = this->CalculateExtent(kZAxis,limit,origin,minZ,maxZ);
    595 
    596   // limits
    597 
    598   if(nStat < 100) { nStat = 100; }
    599 
    600   G4double dX=maxX-minX;
    601   G4double dY=maxY-minY;
    602   G4double dZ=maxZ-minZ;
    603   if(ell<=0.)          // Automatic definition of skin thickness
    604   {
    605     G4double minval=dX;
    606     if(dY<dX) { minval=dY; }
    607     if(dZ<minval) { minval=dZ; }
    608     ell=.01*minval;
    609   }
    610 
    611   G4double dd=2*ell;
    612   minX-=ell; minY-=ell; minZ-=ell; dX+=dd; dY+=dd; dZ+=dd;
    613 
    614   for(G4int i = 0; i < nStat; i++ )
    615   {
    616     px = minX+dX*G4UniformRand();
    617     py = minY+dY*G4UniformRand();
    618     pz = minZ+dZ*G4UniformRand();
    619     p  = G4ThreeVector(px,py,pz);
    620     in = this->Inside(p);
    621     if(in != kOutside)
    622     {
    623       if  (DistanceToOut(p)<ell) { inside++; }
    624     }
    625     else if(DistanceToIn(p)<ell) { inside++; }
    626   }
    627   // @@ The conformal correction can be upgraded
    628   surf = dX*dY*dZ*inside/dd/nStat;
    629   return surf;
    630 }
Note: See TracChangeset for help on using the changeset viewer.