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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/G4tgrSolid.cc (Version 11.3.0) and /persistency/ascii/src/G4tgrSolid.cc (Version 9.5.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4tgrSolid implementation                   << 
 27 //                                                 26 //
 28 // Author: P.Arce, CIEMAT (November 2007)      <<  27 // $Id: G4tgrSolid.cc,v 1.7 2010-10-13 07:56:56 gcosmo Exp $
 29 // ------------------------------------------- <<  28 // GEANT4 tag $Name: not supported by cvs2svn $
                                                   >>  29 //
                                                   >>  30 //
                                                   >>  31 // class G4tgrSolid
 30                                                    32 
 31 #include <map>                                 <<  33 // History:
 32 #include <set>                                 <<  34 // - Created.                                 P.Arce, CIEMAT (November 2007)
                                                   >>  35 // -------------------------------------------------------------------------
 33                                                    36 
 34 #include "G4tgrSolid.hh"                           37 #include "G4tgrSolid.hh"
 35                                                << 
 36 #include "G4SystemOfUnits.hh"                  << 
 37 #include "G4tgrUtils.hh"                           38 #include "G4tgrUtils.hh"
 38 #include "G4tgrMessenger.hh"                       39 #include "G4tgrMessenger.hh"
 39 #include "G4tgrVolumeMgr.hh"                       40 #include "G4tgrVolumeMgr.hh"
 40                                                    41 
 41 // ------------------------------------------- <<  42 #include <map>
                                                   >>  43 #include <set>
                                                   >>  44 
                                                   >>  45 // -------------------------------------------------------------------------
 42 G4tgrSolid::G4tgrSolid()                           46 G4tgrSolid::G4tgrSolid()
 43 {                                                  47 {
 44 }                                                  48 }
 45                                                    49 
 46 // ------------------------------------------- <<  50 
                                                   >>  51 // -------------------------------------------------------------------------
 47 G4tgrSolid::~G4tgrSolid()                          52 G4tgrSolid::~G4tgrSolid()
 48 {                                                  53 {
 49 }                                                  54 }
 50                                                    55 
 51 // ------------------------------------------- <<  56 
 52 G4tgrSolid::G4tgrSolid(const std::vector<G4Str <<  57 // -------------------------------------------------------------------------
                                                   >>  58 G4tgrSolid::G4tgrSolid( const std::vector<G4String>& wl) 
 53 {                                                  59 {
 54   //---------- set name                        <<  60   //---------- set name 
 55   theName = G4tgrUtils::GetString(wl[1]);      <<  61   theName = G4tgrUtils::GetString( wl[1] ); 
 56                                                    62 
 57   //---------- set solid type                      63   //---------- set solid type
 58   theType = G4tgrUtils::GetString(wl[2]);      <<  64   theType = G4tgrUtils::GetString( wl[2] ); 
 59                                                    65 
 60   //---------- create only vector<double> of t     66   //---------- create only vector<double> of theSolidParams
 61   FillSolidParams(wl);                         <<  67   FillSolidParams( wl );
                                                   >>  68 
                                                   >>  69   G4tgrVolumeMgr::GetInstance()->RegisterMe( this );
 62                                                    70 
 63   G4tgrVolumeMgr::GetInstance()->RegisterMe(th << 
 64                                                    71 
 65 #ifdef G4VERBOSE                                   72 #ifdef G4VERBOSE
 66   if(G4tgrMessenger::GetVerboseLevel() >= 1)   <<  73   if( G4tgrMessenger::GetVerboseLevel() >= 1 )
 67   {                                                74   {
 68     G4cout << " Created " << *this << G4endl;  <<  75      G4cout << " Created " << *this << G4endl;
 69   }                                                76   }
 70 #endif                                             77 #endif
                                                   >>  78 
 71 }                                                  79 }
 72                                                    80 
 73 // ------------------------------------------- <<  81 
 74 const std::vector<std::vector<G4double>*> G4tg <<  82 // -------------------------------------------------------------------------
                                                   >>  83 const std::vector< std::vector<G4double>* > G4tgrSolid::GetSolidParams() const
 75 {                                                  84 {
 76   return theSolidParams;                           85   return theSolidParams;
 77 }                                                  86 }
 78                                                    87 
 79 // ------------------------------------------- <<  88 
                                                   >>  89 // -------------------------------------------------------------------------
 80 const G4String& G4tgrSolid::GetRelativeRotMatN     90 const G4String& G4tgrSolid::GetRelativeRotMatName() const
 81 {                                                  91 {
 82   return theName;  // Dummy ...                    92   return theName;  // Dummy ...
 83 }                                                  93 }
 84                                                    94 
 85 // ------------------------------------------- <<  95 
                                                   >>  96 // -------------------------------------------------------------------------
 86 G4ThreeVector G4tgrSolid::GetRelativePlace() c     97 G4ThreeVector G4tgrSolid::GetRelativePlace() const
 87 {                                                  98 {
 88   return G4ThreeVector(0, 0, 0);  // Dummy...  <<  99   return G4ThreeVector(0,0,0);  // Dummy...
 89 }                                                 100 }
 90                                                   101 
 91 // ------------------------------------------- << 102 
 92 void G4tgrSolid::FillSolidParams(const std::ve << 103 // -------------------------------------------------------------------------
                                                   >> 104 void G4tgrSolid::FillSolidParams( const std::vector<G4String>& wl )
 93 {                                                 105 {
 94   //---- Setting which are angle parameters (f    106   //---- Setting which are angle parameters (for dimensions...)
 95   std::map<G4String, std::set<G4int>> anglePar << 107   std::map< G4String, std::set<G4int> > angleParams;
 96   std::set<G4int> apar;                           108   std::set<G4int> apar;
 97   apar.clear();                                << 109   apar.clear(); apar.insert(3); apar.insert(4);
 98   apar.insert(3);                              << 
 99   apar.insert(4);                              << 
100   angleParams["TUBS"] = apar;                     110   angleParams["TUBS"] = apar;
101   apar.clear();                                << 111   apar.clear(); apar.insert(5); apar.insert(6);
102   apar.insert(5);                              << 
103   apar.insert(6);                              << 
104   angleParams["CONS"] = apar;                     112   angleParams["CONS"] = apar;
105   apar.clear();                                << 113   apar.clear(); apar.insert(3); apar.insert(4); apar.insert(5);
106   apar.insert(3);                              << 
107   apar.insert(4);                              << 
108   apar.insert(5);                              << 
109   angleParams["PARA"] = apar;                     114   angleParams["PARA"] = apar;
110   apar.clear();                                << 115   apar.clear(); apar.insert(1); apar.insert(2); apar.insert(6); apar.insert(10);
111   apar.insert(1);                              << 
112   apar.insert(2);                              << 
113   apar.insert(6);                              << 
114   apar.insert(10);                             << 
115   angleParams["TRAP"] = apar;                     116   angleParams["TRAP"] = apar;
116   apar.clear();                                << 117   apar.clear(); apar.insert(2); apar.insert(3); apar.insert(4); apar.insert(5);
117   apar.insert(2);                              << 
118   apar.insert(3);                              << 
119   apar.insert(4);                              << 
120   apar.insert(5);                              << 
121   angleParams["SPHERE"] = apar;                   118   angleParams["SPHERE"] = apar;
122   apar.clear();                                << 119   apar.clear(); apar.insert(3); apar.insert(4);
123   apar.insert(3);                              << 
124   apar.insert(4);                              << 
125   angleParams["TORUS"] = apar;                    120   angleParams["TORUS"] = apar;
126   apar.clear();                                << 121   apar.clear(); apar.insert(0); apar.insert(1);
127   apar.insert(0);                              << 
128   apar.insert(1);                              << 
129   angleParams["POLYCONE"] = apar;                 122   angleParams["POLYCONE"] = apar;
130   apar.clear();                                << 123   apar.clear(); apar.insert(0); apar.insert(1);
131   apar.insert(0);                              << 
132   apar.insert(1);                              << 
133   angleParams["POLYHEDRA"] = apar;                124   angleParams["POLYHEDRA"] = apar;
134   apar.clear();                                << 125   apar.clear(); apar.insert(2); apar.insert(3);
135   apar.insert(2);                              << 
136   apar.insert(3);                              << 
137   angleParams["HYPE"] = apar;                     126   angleParams["HYPE"] = apar;
138   apar.clear();                                << 127   apar.clear(); apar.insert(0);
139   apar.insert(0);                              << 
140   angleParams["TWISTED_BOX"] = apar;              128   angleParams["TWISTED_BOX"] = apar;
141   apar.clear();                                << 129   apar.clear(); apar.insert(0); apar.insert(2); apar.insert(3); apar.insert(10);
142   apar.insert(0);                              << 
143   apar.insert(2);                              << 
144   apar.insert(3);                              << 
145   apar.insert(10);                             << 
146   angleParams["TWISTED_TRAP"] = apar;             130   angleParams["TWISTED_TRAP"] = apar;
147   apar.clear();                                << 131   apar.clear(); apar.insert(5);
148   apar.insert(5);                              << 
149   angleParams["TWISTED_TRD"] = apar;              132   angleParams["TWISTED_TRD"] = apar;
150   apar.clear();                                << 133   apar.clear(); apar.insert(0); apar.insert(4);
151   apar.insert(0);                              << 134   angleParams["TWISTED_TUBS"] = apar;
152   apar.insert(4);                              << 
153   angleParams["TWISTED_TUBS"] = std::move(apar << 
154                                                   135 
155   std::vector<G4double>* vd = new std::vector<    136   std::vector<G4double>* vd = new std::vector<G4double>;
156   theSolidParams.push_back(vd);                << 137   theSolidParams.push_back( vd );
157   std::size_t noParRead = wl.size() - 3;       << 138   size_t noParRead = wl.size()-3;
158                                                   139 
159   G4String solidType = wl[2];                     140   G4String solidType = wl[2];
160   //--- Default unit (mm) if length, deg if an    141   //--- Default unit (mm) if length, deg if angle
161   for(G4int ii = 0; ii < (G4int)noParRead; ++i << 142   for(size_t ii = 0; ii < noParRead; ii++)
162   {                                               143   {
163     G4bool isAngle = 0;                           144     G4bool isAngle = 0;
164     std::map<G4String, std::set<G4int>>::const << 145     std::map< G4String, std::set<G4int> >::iterator ite
165       angleParams.find(solidType);             << 146        = angleParams.find(solidType);
166     if(ite != angleParams.cend())              << 147     if( ite != angleParams.end() )
167     {                                             148     {
168       std::set<G4int> apar2 = (*ite).second;   << 149       std::set<G4int> apar = (*ite).second;
169       if(apar2.find(ii) != apar2.cend())       << 150       if( apar.find(ii) != apar.end() )
170       {                                           151       {
171         isAngle = 1;                              152         isAngle = 1;
172         vd->push_back(G4tgrUtils::GetDouble(wl << 153         vd->push_back( G4tgrUtils::GetDouble( wl[3+ii], deg ));
173 #ifdef G4VERBOSE                                  154 #ifdef G4VERBOSE
174         if(G4tgrMessenger::GetVerboseLevel() > << 155         if( G4tgrMessenger::GetVerboseLevel() >= 3 )
175         {                                         156         {
176           G4cout << " G4tgrSolid::FillSolidPar    157           G4cout << " G4tgrSolid::FillSolidParams() - Angle param found "
177                  << solidType << " " << ii <<     158                  << solidType << " " << ii << G4endl;
178         }                                         159         }
179 #endif                                            160 #endif
180       }                                           161       }
181     }                                          << 162     } 
182     if(!isAngle)                                  163     if(!isAngle)
183     {                                             164     {
184       vd->push_back(G4tgrUtils::GetDouble(wl[3 << 165       vd->push_back( G4tgrUtils::GetDouble( wl[3+ii] ) );
185     }                                             166     }
186   }                                               167   }
187 }                                                 168 }
188                                                   169 
189 // ------------------------------------------- << 170 
                                                   >> 171 // -------------------------------------------------------------------------
190 std::ostream& operator<<(std::ostream& os, con    172 std::ostream& operator<<(std::ostream& os, const G4tgrSolid& sol)
191 {                                                 173 {
192   os << "G4tgrSolid= " << sol.theName << " of  << 174   os << "G4tgrSolid= " << sol.theName
193      << " PARAMS: ";                           << 175      << " of type " << sol.theType << " PARAMS: ";
194   if(sol.theSolidParams.size() != 0)           << 176   if( sol.theSolidParams.size() != 0 )
195   {                                               177   {
196     std::vector<G4double> solpar = *(sol.theSo << 178     std::vector<G4double> solpar = *(sol.theSolidParams[0]); 
197     for(std::size_t ii = 0; ii < solpar.size() << 179     for( size_t ii = 0; ii < solpar.size(); ii++)
198     {                                             180     {
199       os << solpar[ii] << " ";                 << 181       os << solpar[ii] << " " ;
200     }                                             182     }
201   }                                               183   }
202   os << G4endl;                                   184   os << G4endl;
203                                                   185 
204   return os;                                      186   return os;
205 }                                                 187 }
206                                                   188