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 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /geometry/solids/specific/src/G4UParaboloid.cc (Version 11.3.0) and /geometry/solids/specific/src/G4UParaboloid.cc (Version 9.5.p1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 // Implementation for G4UParaboloid wrapper cl    
 27 //                                                
 28 // 19.08.2015 Guilherme Lima, FNAL                
 29 // -------------------------------------------    
 30                                                   
 31 #include "G4Paraboloid.hh"                        
 32 #include "G4UParaboloid.hh"                       
 33                                                   
 34 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G    
 35                                                   
 36 #include "G4AffineTransform.hh"                   
 37 #include "G4VPVParameterisation.hh"               
 38 #include "G4PhysicalConstants.hh"                 
 39 #include "G4BoundingEnvelope.hh"                  
 40 #include "G4Polyhedron.hh"                        
 41                                                   
 42 //////////////////////////////////////////////    
 43 //                                                
 44 // Constructor - check & set half widths          
 45                                                   
 46                                                   
 47 G4UParaboloid::G4UParaboloid(const G4String& p    
 48                                    G4double dz    
 49                                    G4double rl    
 50                                    G4double rh    
 51   : Base_t(pName, rlo, rhi, dz)                   
 52 { }                                               
 53                                                   
 54 //////////////////////////////////////////////    
 55 //                                                
 56 // Fake default constructor - sets only member    
 57 //                            for usage restri    
 58                                                   
 59 G4UParaboloid::G4UParaboloid( __void__& a )       
 60   : Base_t(a)                                     
 61 { }                                               
 62                                                   
 63 //////////////////////////////////////////////    
 64 //                                                
 65 // Destructor                                     
 66                                                   
 67 G4UParaboloid::~G4UParaboloid() = default;        
 68                                                   
 69 //////////////////////////////////////////////    
 70 //                                                
 71 // Copy constructor                               
 72                                                   
 73 G4UParaboloid::G4UParaboloid(const G4UParabolo    
 74   : Base_t(rhs)                                   
 75 { }                                               
 76                                                   
 77 //////////////////////////////////////////////    
 78 //                                                
 79 // Assignment operator                            
 80                                                   
 81 G4UParaboloid& G4UParaboloid::operator = (cons    
 82 {                                                 
 83    // Check assignment to self                    
 84    //                                             
 85    if (this == &rhs)  { return *this; }           
 86                                                   
 87    // Copy base class data                        
 88    //                                             
 89    Base_t::operator=(rhs);                        
 90                                                   
 91    return *this;                                  
 92 }                                                 
 93                                                   
 94 //////////////////////////////////////////////    
 95 //                                                
 96 // Accessors                                      
 97                                                   
 98 G4double G4UParaboloid::GetZHalfLength() const    
 99 {                                                 
100   return GetDz();                                 
101 }                                                 
102                                                   
103 G4double G4UParaboloid::GetRadiusMinusZ() cons    
104 {                                                 
105   return GetRlo();                                
106 }                                                 
107                                                   
108 G4double G4UParaboloid::GetRadiusPlusZ() const    
109 {                                                 
110   return GetRhi();                                
111 }                                                 
112                                                   
113 //////////////////////////////////////////////    
114 //                                                
115 // Modifiers                                      
116                                                   
117 void G4UParaboloid::SetZHalfLength(G4double dz    
118 {                                                 
119   SetDz(dz);                                      
120 }                                                 
121                                                   
122 void G4UParaboloid::SetRadiusMinusZ(G4double r    
123 {                                                 
124   SetRlo(r1);                                     
125 }                                                 
126                                                   
127 void G4UParaboloid::SetRadiusPlusZ(G4double r2    
128 {                                                 
129   SetRhi(r2);                                     
130 }                                                 
131                                                   
132 //////////////////////////////////////////////    
133 //                                                
134 // Make a clone of the object                     
135                                                   
136 G4VSolid* G4UParaboloid::Clone() const            
137 {                                                 
138   return new G4UParaboloid(*this);                
139 }                                                 
140                                                   
141 //////////////////////////////////////////////    
142 //                                                
143 // Get bounding box                               
144                                                   
145 void G4UParaboloid::BoundingLimits(G4ThreeVect    
146                                    G4ThreeVect    
147 {                                                 
148   static G4bool checkBBox = true;                 
149                                                   
150   G4double r2 = GetRadiusPlusZ();                 
151   G4double dz = GetZHalfLength();                 
152   pMin.set(-r2,-r2,-dz);                          
153   pMax.set( r2, r2, dz);                          
154                                                   
155   // Check correctness of the bounding box        
156   //                                              
157   if (pMin.x() >= pMax.x() || pMin.y() >= pMax    
158   {                                               
159     std::ostringstream message;                   
160     message << "Bad bounding box (min >= max)     
161             << GetName() << " !"                  
162             << "\npMin = " << pMin                
163             << "\npMax = " << pMax;               
164     G4Exception("G4UParaboloid::BoundingLimits    
165                 JustWarning, message);            
166     StreamInfo(G4cout);                           
167   }                                               
168                                                   
169   // Check consistency of bounding boxes          
170   //                                              
171   if (checkBBox)                                  
172   {                                               
173     U3Vector vmin, vmax;                          
174     Extent(vmin,vmax);                            
175     if (std::abs(pMin.x()-vmin.x()) > kCarTole    
176         std::abs(pMin.y()-vmin.y()) > kCarTole    
177         std::abs(pMin.z()-vmin.z()) > kCarTole    
178         std::abs(pMax.x()-vmax.x()) > kCarTole    
179         std::abs(pMax.y()-vmax.y()) > kCarTole    
180         std::abs(pMax.z()-vmax.z()) > kCarTole    
181     {                                             
182       std::ostringstream message;                 
183       message << "Inconsistency in bounding bo    
184               << GetName() << " !"                
185               << "\nBBox min: wrapper = " << p    
186               << "\nBBox max: wrapper = " << p    
187       G4Exception("G4UParaboloid::BoundingLimi    
188                   JustWarning, message);          
189       checkBBox = false;                          
190     }                                             
191   }                                               
192 }                                                 
193                                                   
194 //////////////////////////////////////////////    
195 //                                                
196 // Calculate extent under transform and specif    
197                                                   
198 G4bool                                            
199 G4UParaboloid::CalculateExtent(const EAxis pAx    
200                                const G4VoxelLi    
201                                const G4AffineT    
202                                      G4double&    
203 {                                                 
204   G4ThreeVector bmin, bmax;                       
205                                                   
206   // Get bounding box                             
207   BoundingLimits(bmin,bmax);                      
208                                                   
209   // Find extent                                  
210   G4BoundingEnvelope bbox(bmin,bmax);             
211   return bbox.CalculateExtent(pAxis,pVoxelLimi    
212 }                                                 
213                                                   
214 //////////////////////////////////////////////    
215 //                                                
216 // CreatePolyhedron                               
217 //                                                
218 G4Polyhedron* G4UParaboloid::CreatePolyhedron(    
219 {                                                 
220   return new G4PolyhedronParaboloid(GetRadiusM    
221                                     GetRadiusP    
222                                     GetZHalfLe    
223 }                                                 
224                                                   
225 #endif  // G4GEOM_USE_USOLIDS                     
226