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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 /persistency/ascii/src/G4tgrVolume.cc (Version 11.3.0) and /persistency/ascii/src/G4tgrVolume.cc (Version 4.1)


  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 // G4tgrVolume implementation                     
 27 //                                                
 28 // Author: P.Arce, CIEMAT (November 2007)         
 29 // -------------------------------------------    
 30                                                   
 31 #include "G4tgrVolume.hh"                         
 32 #include "G4tgrUtils.hh"                          
 33 #include "G4tgrSolid.hh"                          
 34 #include "G4tgrVolumeMgr.hh"                      
 35 #include "G4tgrPlace.hh"                          
 36 #include "G4tgrPlaceSimple.hh"                    
 37 #include "G4tgrPlaceDivRep.hh"                    
 38 #include "G4tgrPlaceParameterisation.hh"          
 39 #include "G4tgrFileReader.hh"                     
 40 #include "G4tgrMessenger.hh"                      
 41 #include "G4UIcommand.hh"                         
 42                                                   
 43 // -------------------------------------------    
 44 G4tgrVolume::G4tgrVolume()                        
 45 {                                                 
 46 }                                                 
 47                                                   
 48 // -------------------------------------------    
 49 G4tgrVolume::~G4tgrVolume()                       
 50 {                                                 
 51   delete[] theRGBColour;                          
 52 }                                                 
 53                                                   
 54 // -------------------------------------------    
 55 G4tgrVolume::G4tgrVolume(const std::vector<G4S    
 56 {                                                 
 57   theType = "VOLSimple";                          
 58                                                   
 59   //---------- set name                           
 60   theName = G4tgrUtils::GetString(wl[1]);         
 61                                                   
 62   theVisibility = true;                           
 63   theRGBColour  = new G4double[4];                
 64   for(std::size_t ii = 0; ii < 4; ++ii)           
 65   {                                               
 66     theRGBColour[ii] = -1.;                       
 67   }                                               
 68   theCheckOverlaps = false;                       
 69                                                   
 70   if(wl.size() != 4)                              
 71   {                                               
 72     //:VOLU tag to build a volume creating sol    
 73     //---------- set material name                
 74     theMaterialName = G4tgrUtils::GetString(wl    
 75                                                   
 76     //---------- create only vector<double> of    
 77     theSolid = G4tgrVolumeMgr::GetInstance()->    
 78                                                   
 79 #ifdef G4VERBOSE                                  
 80     if(G4tgrMessenger::GetVerboseLevel() >= 1)    
 81     {                                             
 82       G4cout << "Created from new solid: " <<     
 83     }                                             
 84 #endif                                            
 85   }                                               
 86   else                                            
 87   {                                               
 88     //:VOLU tag to build a volume assigning ma    
 89     //---------- set material name                
 90     theMaterialName = G4tgrUtils::GetString(wl    
 91     theSolid        = G4tgrVolumeMgr::GetInsta    
 92                                                   
 93 #ifdef G4VERBOSE                                  
 94     if(G4tgrMessenger::GetVerboseLevel() >= 1)    
 95     {                                             
 96       G4cout << "Created from existing solid:     
 97     }                                             
 98 #endif                                            
 99   }                                               
100 }                                                 
101                                                   
102 // -------------------------------------------    
103 G4tgrVolume::G4tgrVolume(const G4tgrVolume& vo    
104 {                                                 
105   theName          = vol.GetName();               
106   theType          = vol.GetType();               
107   theMaterialName  = vol.GetMaterialName();       
108   theSolid         = vol.GetSolid();              
109   thePlacements    = vol.GetPlacements();         
110   theVisibility    = vol.GetVisibility();         
111   theRGBColour     = vol.GetRGBColour();          
112   theCheckOverlaps = vol.GetCheckOverlaps();      
113 }                                                 
114                                                   
115 // -------------------------------------------    
116 G4tgrVolume* G4tgrVolume::GetVolume(G4int ii)     
117 {                                                 
118   G4String ErrMessage = "Should only be called    
119                         G4UIcommand::ConvertTo    
120   G4Exception("G4tgrVolume::GetVolume()", "Inv    
121               ErrMessage);                        
122   return nullptr;                                 
123 }                                                 
124                                                   
125 // -------------------------------------------    
126 G4tgrPlace* G4tgrVolume::AddPlace(const std::v    
127 {                                                 
128   //---------- Check for exact number of words    
129   G4tgrUtils::CheckWLsize(wl, 8, WLSIZE_EQ, "     
130   //---------- set G4tgrPlace                     
131   G4tgrPlaceSimple* pl = new G4tgrPlaceSimple(    
132   //---------- check that there is no previous    
133   //           the same parent with the same c    
134   for(auto ite = thePlacements.cbegin(); ite !    
135   {                                               
136     if(((*ite)->GetCopyNo() == pl->GetCopyNo()    
137        ((*ite)->GetParentName() == pl->GetPare    
138     {                                             
139       G4String ErrMessage =                       
140         "Repeated placement. Volume " + theNam    
141       G4Exception("G4tgrVolume::AddPlace()", "    
142                   FatalErrorInArgument, ErrMes    
143     }                                             
144   }                                               
145                                                   
146   pl->SetVolume(this);                            
147   thePlacements.push_back(pl);                    
148                                                   
149 #ifdef G4VERBOSE                                  
150   if(G4tgrMessenger::GetVerboseLevel() >= 2)      
151   {                                               
152     G4cout << " G4tgrVolume:  New placement: "    
153            << " added for Volume " << theName     
154            << pl->GetParentName() << " type "     
155   }                                               
156 #endif                                            
157   //---------- register parent - child            
158   G4tgrVolumeMgr::GetInstance()->RegisterParen    
159                                                   
160   return pl;                                      
161 }                                                 
162                                                   
163 // -------------------------------------------    
164 G4tgrPlaceDivRep* G4tgrVolume::AddPlaceReplica    
165 {                                                 
166   //---------- Check for exact number of words    
167   G4tgrUtils::CheckWLsize(wl, 6, WLSIZE_GE, "     
168   G4tgrUtils::CheckWLsize(wl, 7, WLSIZE_LE, "     
169                                                   
170   if((wl.size() == 7) && (G4tgrUtils::GetDoubl    
171      (wl[3] != "PHI"))                            
172   {                                               
173     G4Exception("G4tgrVolume::AddPlaceReplica"    
174                 "Offset set for replica not al    
175                 JustWarning,                      
176                 G4String("Volume " + wl[1] + "    
177   }                                               
178                                                   
179   //---------- set G4tgrPlace                     
180   G4tgrPlaceDivRep* pl = new G4tgrPlaceDivRep(    
181   pl->SetType("PlaceReplica");                    
182   pl->SetVolume(this);                            
183   thePlacements.push_back(pl);                    
184                                                   
185 #ifdef G4VERBOSE                                  
186   if(G4tgrMessenger::GetVerboseLevel() >= 2)      
187   {                                               
188     G4cout << " G4tgrVolume:  New placement re    
189            << " added for Volume " << theName     
190            << pl->GetParentName() << G4endl;      
191   }                                               
192 #endif                                            
193   //---------- register parent - child            
194   G4tgrVolumeMgr::GetInstance()->RegisterParen    
195                                                   
196   return pl;                                      
197 }                                                 
198                                                   
199 // -------------------------------------------    
200 G4tgrPlaceParameterisation*                       
201 G4tgrVolume::AddPlaceParam(const std::vector<G    
202 {                                                 
203   //---------- set G4tgrPlaceParameterisation     
204   G4tgrPlaceParameterisation* pl = new G4tgrPl    
205                                                   
206   pl->SetVolume(this);                            
207   thePlacements.push_back(pl);                    
208                                                   
209 #ifdef G4VERBOSE                                  
210   if(G4tgrMessenger::GetVerboseLevel() >= 2)      
211   {                                               
212     G4cout << " G4tgrVolume:  New placement Pa    
213            << " added for Volume " << theName     
214            << pl->GetParentName() << G4endl;      
215   }                                               
216 #endif                                            
217   //---------- register parent - child            
218   G4tgrVolumeMgr::GetInstance()->RegisterParen    
219                                                   
220   return pl;                                      
221 }                                                 
222                                                   
223 // -------------------------------------------    
224 void G4tgrVolume::AddVisibility(const std::vec    
225 {                                                 
226   //---------- Check for exact number of words    
227   G4tgrUtils::CheckWLsize(wl, 3, WLSIZE_EQ, "     
228                                                   
229   //---------- Set visibility                     
230   theVisibility = G4tgrUtils::GetBool(wl[2]);     
231 }                                                 
232                                                   
233 // -------------------------------------------    
234 void G4tgrVolume::AddRGBColour(const std::vect    
235 {                                                 
236   //---------- Check for exact number of words    
237   G4tgrUtils::CheckWLsize(wl, 5, WLSIZE_GE, "     
238                                                   
239   //---------- Set RGB colour                     
240   theRGBColour[0] = G4tgrUtils::GetDouble(wl[2    
241   theRGBColour[1] = G4tgrUtils::GetDouble(wl[3    
242   theRGBColour[2] = G4tgrUtils::GetDouble(wl[4    
243   ///--------- Set transparency                   
244   if(wl.size() == 6)                              
245   {                                               
246     theRGBColour[3] = G4tgrUtils::GetDouble(wl    
247   }                                               
248 }                                                 
249                                                   
250 // -------------------------------------------    
251 void G4tgrVolume::AddCheckOverlaps(const std::    
252 {                                                 
253   //---------- Check for exact number of words    
254   G4tgrUtils::CheckWLsize(wl, 3, WLSIZE_GE, "     
255                                                   
256   ///--------- Set check overlaps                 
257   theCheckOverlaps = G4tgrUtils::GetBool(wl[2]    
258 }                                                 
259                                                   
260 // -------------------------------------------    
261 std::ostream& operator<<(std::ostream& os, con    
262 {                                                 
263   os << "G4tgrVolume= " << obj.theName << " Ty    
264      << " Material= " << obj.theMaterialName <    
265      << obj.theVisibility << " Colour " << (ob    
266      << (obj.theRGBColour)[1] << " " << (obj.t    
267      << (obj.theRGBColour)[3] << " "              
268      << " CheckOverlaps " << obj.theCheckOverl    
269      << obj.thePlacements.size() << G4endl;       
270                                                   
271   return os;                                      
272 }                                                 
273