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5 ] [ 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/divisions/src/G4ParameterisationTubs.cc (Version 11.3.0) and /geometry/divisions/src/G4ParameterisationTubs.cc (Version 2.0)


  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 // G4ParameterisationTubs[Rho/Phi/Z] implement    
 27 //                                                
 28 // 26.05.03 - P.Arce, Initial version             
 29 // 08.04.04 - I.Hrivnacova, Implemented reflec    
 30 // 21.04.10 - M.Asai, Added gaps                  
 31 // -------------------------------------------    
 32                                                   
 33 #include "G4ParameterisationTubs.hh"              
 34                                                   
 35 #include <iomanip>                                
 36 #include "G4ThreeVector.hh"                       
 37 #include "G4RotationMatrix.hh"                    
 38 #include "G4VPhysicalVolume.hh"                   
 39 #include "G4LogicalVolume.hh"                     
 40 #include "G4ReflectedSolid.hh"                    
 41 #include "G4Tubs.hh"                              
 42                                                   
 43 //--------------------------------------------    
 44 G4VParameterisationTubs::                         
 45 G4VParameterisationTubs( EAxis axis, G4int nDi    
 46                          G4double offset, G4VS    
 47                          DivisionType divType     
 48   : G4VDivisionParameterisation( axis, nDiv, w    
 49 {                                                 
 50   auto msol = (G4Tubs*)(msolid);                  
 51   if (msolid->GetEntityType() == "G4ReflectedS    
 52   {                                               
 53     //----- get constituent solid                 
 54     G4VSolid* mConstituentSolid                   
 55        = ((G4ReflectedSolid*)msolid)->GetConst    
 56     msol = (G4Tubs*)(mConstituentSolid);          
 57     fmotherSolid = msol;                          
 58     fReflectedSolid = true;                       
 59   }                                               
 60 }                                                 
 61                                                   
 62 //--------------------------------------------    
 63 G4VParameterisationTubs::~G4VParameterisationT    
 64                                                   
 65 //--------------------------------------------    
 66 G4ParameterisationTubsRho::                       
 67 G4ParameterisationTubsRho( EAxis axis, G4int n    
 68                            G4double width, G4d    
 69                            G4VSolid* msolid, D    
 70   : G4VParameterisationTubs( axis, nDiv, width    
 71 {                                                 
 72   CheckParametersValidity();                      
 73   SetType( "DivisionTubsRho" );                   
 74                                                   
 75   auto msol = (G4Tubs*)(fmotherSolid);            
 76   if( divType == DivWIDTH )                       
 77   {                                               
 78     fnDiv = CalculateNDiv( msol->GetOuterRadiu    
 79                            width, offset );       
 80   }                                               
 81   else if( divType == DivNDIV )                   
 82   {                                               
 83     fwidth = CalculateWidth( msol->GetOuterRad    
 84                              nDiv, offset );      
 85   }                                               
 86                                                   
 87 #ifdef G4DIVDEBUG                                 
 88   if( verbose >= 1 )                              
 89   {                                               
 90     G4cout << " G4ParameterisationTubsRho - no    
 91            << nDiv << G4endl                      
 92            << " Offset " << foffset << " = " <    
 93            << " Width " << fwidth << " = " <<     
 94            << " DivType " << divType << G4endl    
 95   }                                               
 96 #endif                                            
 97 }                                                 
 98                                                   
 99 //--------------------------------------------    
100 G4ParameterisationTubsRho::~G4Parameterisation    
101                                                   
102 //--------------------------------------------    
103 G4double G4ParameterisationTubsRho::GetMaxPara    
104 {                                                 
105   auto msol = (G4Tubs*)(fmotherSolid);            
106   return msol->GetOuterRadius() - msol->GetInn    
107 }                                                 
108                                                   
109                                                   
110 //--------------------------------------------    
111 void                                              
112 G4ParameterisationTubsRho::                       
113 ComputeTransformation(const G4int, G4VPhysical    
114 {                                                 
115   //----- translation                             
116   G4ThreeVector origin(0.,0.,0.);                 
117   //----- set translation                         
118   physVol->SetTranslation( origin );              
119                                                   
120   //----- calculate rotation matrix: unit         
121                                                   
122 #ifdef G4DIVDEBUG                                 
123   if( verbose >= 2 )                              
124   {                                               
125     G4cout << " G4ParameterisationTubsRho " <<    
126            << " Offset: " << foffset/CLHEP::de    
127            << " - Width: " << fwidth/CLHEP::de    
128   }                                               
129 #endif                                            
130                                                   
131   ChangeRotMatrix( physVol );                     
132                                                   
133 #ifdef G4DIVDEBUG                                 
134   if( verbose >= 2 )                              
135   {                                               
136     G4cout << std::setprecision(8) << " G4Para    
137            << " Position: " << origin << " - W    
138            << " - Axis " << faxis  << G4endl;     
139   }                                               
140 #endif                                            
141 }                                                 
142                                                   
143 //--------------------------------------------    
144 void                                              
145 G4ParameterisationTubsRho::                       
146 ComputeDimensions( G4Tubs& tubs, const G4int c    
147                    const G4VPhysicalVolume* )     
148 {                                                 
149   auto msol = (G4Tubs*)(fmotherSolid);            
150                                                   
151   G4double pRMin = msol->GetInnerRadius() + fo    
152   G4double pRMax = msol->GetInnerRadius() + fo    
153   G4double pDz = msol->GetZHalfLength();          
154   //- already rotated  G4double pSR = foffset     
155   G4double pSPhi = msol->GetStartPhiAngle();      
156   G4double pDPhi = msol->GetDeltaPhiAngle();;     
157                                                   
158   tubs.SetInnerRadius( pRMin );                   
159   tubs.SetOuterRadius( pRMax );                   
160   tubs.SetZHalfLength( pDz );                     
161   tubs.SetStartPhiAngle( pSPhi, false );          
162   tubs.SetDeltaPhiAngle( pDPhi );                 
163                                                   
164 #ifdef G4DIVDEBUG                                 
165   if( verbose >= 2 )                              
166   {                                               
167     G4cout << " G4ParameterisationTubsRho::Com    
168            << " pRMin: " << pRMin << " - pRMax    
169     tubs.DumpInfo();                              
170   }                                               
171 #endif                                            
172 }                                                 
173                                                   
174 //--------------------------------------------    
175 G4ParameterisationTubsPhi::                       
176 G4ParameterisationTubsPhi( EAxis axis, G4int n    
177                            G4double width, G4d    
178                            G4VSolid* msolid, D    
179   : G4VParameterisationTubs( axis, nDiv, width    
180 {                                                 
181   CheckParametersValidity();                      
182   SetType( "DivisionTubsPhi" );                   
183                                                   
184   auto msol = (G4Tubs*)(fmotherSolid);            
185   if( divType == DivWIDTH )                       
186   {                                               
187     fnDiv = CalculateNDiv( msol->GetDeltaPhiAn    
188   }                                               
189   else if( divType == DivNDIV )                   
190   {                                               
191     fwidth = CalculateWidth( msol->GetDeltaPhi    
192   }                                               
193                                                   
194 #ifdef G4DIVDEBUG                                 
195   if( verbose >= 1 )                              
196   {                                               
197     G4cout << " G4ParameterisationTubsPhi no d    
198            << nDiv << G4endl                      
199            << " Offset " << foffset << " = " <    
200            << " Width " << fwidth << " = " <<     
201   }                                               
202 #endif                                            
203 }                                                 
204                                                   
205 //--------------------------------------------    
206 G4ParameterisationTubsPhi::~G4Parameterisation    
207                                                   
208 //--------------------------------------------    
209 G4double G4ParameterisationTubsPhi::GetMaxPara    
210 {                                                 
211   auto msol = (G4Tubs*)(fmotherSolid);            
212   return msol->GetDeltaPhiAngle();                
213 }                                                 
214                                                   
215 //--------------------------------------------    
216 void                                              
217 G4ParameterisationTubsPhi::                       
218 ComputeTransformation(const G4int copyNo, G4VP    
219 {                                                 
220   //----- translation                             
221   G4ThreeVector origin(0.,0.,0.);                 
222   //----- set translation                         
223   physVol->SetTranslation( origin );              
224                                                   
225   //----- calculate rotation matrix (so that a    
226   G4double posi = foffset  + copyNo*fwidth;       
227                                                   
228 #ifdef G4DIVDEBUG                                 
229   if( verbose >= 2 )                              
230   {                                               
231     G4cout << " G4ParameterisationTubsPhi - po    
232            << " copyNo: " << copyNo << " - fof    
233            << " - fwidth: " << fwidth/CLHEP::d    
234   }                                               
235 #endif                                            
236                                                   
237   ChangeRotMatrix( physVol, -posi );              
238                                                   
239 #ifdef G4DIVDEBUG                                 
240   if( verbose >= 2 )                              
241   {                                               
242     G4cout << std::setprecision(8) << " G4Para    
243            << G4endl                              
244            << " Position: " << origin << " - W    
245            << " - Axis: " << faxis  << G4endl;    
246   }                                               
247 #endif                                            
248 }                                                 
249                                                   
250 //--------------------------------------------    
251 void                                              
252 G4ParameterisationTubsPhi::                       
253 ComputeDimensions( G4Tubs& tubs, const G4int,     
254                    const G4VPhysicalVolume* )     
255 {                                                 
256   auto msol = (G4Tubs*)(fmotherSolid);            
257                                                   
258   G4double pRMin = msol->GetInnerRadius();        
259   G4double pRMax = msol->GetOuterRadius();        
260   G4double pDz = msol->GetZHalfLength();          
261   //----- already rotated in 'ComputeTransform    
262   G4double pSPhi = msol->GetStartPhiAngle() +     
263   G4double pDPhi = fwidth - 2.*fhgap;             
264                                                   
265   tubs.SetInnerRadius( pRMin );                   
266   tubs.SetOuterRadius( pRMax );                   
267   tubs.SetZHalfLength( pDz );                     
268   tubs.SetStartPhiAngle( pSPhi, false );          
269   tubs.SetDeltaPhiAngle( pDPhi );                 
270                                                   
271 #ifdef G4DIVDEBUG                                 
272   if( verbose >= 2 )                              
273   {                                               
274     G4cout << " G4ParameterisationTubsPhi::Com    
275            << " pSPhi: " << pSPhi << " - pDPhi    
276     tubs.DumpInfo();                              
277   }                                               
278 #endif                                            
279 }                                                 
280                                                   
281 //--------------------------------------------    
282 G4ParameterisationTubsZ::                         
283 G4ParameterisationTubsZ( EAxis axis, G4int nDi    
284                          G4double width, G4dou    
285                          G4VSolid* msolid, Div    
286   : G4VParameterisationTubs( axis, nDiv, width    
287 {                                                 
288   CheckParametersValidity();                      
289   SetType( "DivisionTubsZ" );                     
290                                                   
291   auto msol = (G4Tubs*)(fmotherSolid);            
292   if( divType == DivWIDTH )                       
293   {                                               
294     fnDiv = CalculateNDiv( 2*msol->GetZHalfLen    
295   }                                               
296   else if( divType == DivNDIV )                   
297   {                                               
298     fwidth = CalculateWidth( 2*msol->GetZHalfL    
299   }                                               
300                                                   
301 #ifdef G4DIVDEBUG                                 
302   if( verbose >= 1 )                              
303   {                                               
304     G4cout << " G4ParameterisationTubsZ: # div    
305            << nDiv << G4endl                      
306            << " Offset " << foffset << " = " <    
307            << " Width " << fwidth << " = " <<     
308   }                                               
309 #endif                                            
310 }                                                 
311                                                   
312 //--------------------------------------------    
313 G4ParameterisationTubsZ::~G4ParameterisationTu    
314                                                   
315 //--------------------------------------------    
316 G4double G4ParameterisationTubsZ::GetMaxParame    
317 {                                                 
318   auto msol = (G4Tubs*)(fmotherSolid);            
319   return 2*msol->GetZHalfLength();                
320 }                                                 
321                                                   
322 //--------------------------------------------    
323 void                                              
324 G4ParameterisationTubsZ::                         
325 ComputeTransformation(const G4int copyNo, G4VP    
326 {                                                 
327   //----- set translation: along Z axis           
328   auto motherTubs = (G4Tubs*)(fmotherSolid);      
329   G4double posi = - motherTubs->GetZHalfLength    
330                   + fwidth/2 + copyNo*fwidth;     
331   G4ThreeVector origin(0.,0.,posi);               
332   physVol->SetTranslation( origin );              
333                                                   
334   //----- calculate rotation matrix: unit         
335                                                   
336 #ifdef G4DIVDEBUG                                 
337   if( verbose >= 2 )                              
338   {                                               
339     G4cout << " G4ParameterisationTubsZ::Compu    
340            << " Position: " << posi << " - cop    
341            << " foffset " << foffset/CLHEP::de    
342            << G4endl;                             
343   }                                               
344 #endif                                            
345                                                   
346   ChangeRotMatrix( physVol );                     
347                                                   
348 #ifdef G4DIVDEBUG                                 
349   if( verbose >= 2 )                              
350   {                                               
351     G4cout << std::setprecision(8) << " G4Para    
352            << G4endl                              
353            << " Position: " << origin << " - W    
354            << " - Axis: " << faxis  << G4endl;    
355   }                                               
356 #endif                                            
357 }                                                 
358                                                   
359 //--------------------------------------------    
360 void                                              
361 G4ParameterisationTubsZ::                         
362 ComputeDimensions( G4Tubs& tubs, const G4int,     
363                    const G4VPhysicalVolume* )     
364 {                                                 
365   auto msol = (G4Tubs*)(fmotherSolid);            
366                                                   
367   G4double pRMin = msol->GetInnerRadius();        
368   G4double pRMax = msol->GetOuterRadius();        
369   //  G4double pDz = msol->GetZHalfLength() /     
370   G4double pDz = fwidth/2. - fhgap;               
371   G4double pSPhi = msol->GetStartPhiAngle();      
372   G4double pDPhi = msol->GetDeltaPhiAngle();      
373                                                   
374   tubs.SetInnerRadius( pRMin );                   
375   tubs.SetOuterRadius( pRMax );                   
376   tubs.SetZHalfLength( pDz );                     
377   tubs.SetStartPhiAngle( pSPhi, false );          
378   tubs.SetDeltaPhiAngle( pDPhi );                 
379                                                   
380 #ifdef G4DIVDEBUG                                 
381   if( verbose >= 2 )                              
382   {                                               
383     G4cout << " G4ParameterisationTubsZ::Compu    
384            << " pDz: " << pDz << G4endl;          
385     tubs.DumpInfo();                              
386   }                                               
387 #endif                                            
388 }                                                 
389