Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:19

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4GDMLParser inline methods
0027 //
0028 // Author: Zoltan Torzsok, November 2007
0029 // --------------------------------------------------------------------
0030 
0031 inline void G4GDMLParser::Read(const G4String& filename, G4bool validate)
0032 {
0033   if(G4Threading::IsMasterThread())
0034   {
0035     reader->Read(filename, validate, false, strip);
0036     ImportRegions();
0037   }
0038 }
0039 
0040 // --------------------------------------------------------------------
0041 inline void G4GDMLParser::ReadModule(const G4String& filename, G4bool validate)
0042 {
0043   if(G4Threading::IsMasterThread())
0044   {
0045     reader->Read(filename, validate, true);
0046     ImportRegions();
0047   }
0048 }
0049 
0050 // --------------------------------------------------------------------
0051 inline void G4GDMLParser::Write(const G4String& filename,
0052                                 const G4VPhysicalVolume* pvol, G4bool refs,
0053                                 const G4String& schemaLocation)
0054 {
0055   if(G4Threading::IsMasterThread())
0056   {
0057     const G4int depth     = 0;
0058     G4LogicalVolume* lvol = nullptr;
0059 
0060     if(pvol == nullptr)
0061     {
0062       lvol = G4TransportationManager::GetTransportationManager()
0063                ->GetNavigatorForTracking()
0064                ->GetWorldVolume()
0065                ->GetLogicalVolume();
0066     }
0067     else
0068     {
0069       lvol = pvol->GetLogicalVolume();
0070     }
0071 
0072     if(rexp)
0073     {
0074       ExportRegions(refs);
0075     }
0076     writer->Write(filename, lvol, schemaLocation, depth, refs);
0077   }
0078 }
0079 
0080 // --------------------------------------------------------------------
0081 inline void G4GDMLParser::Write(const G4String& filename,
0082                                 const G4LogicalVolume* lvol, G4bool refs,
0083                                 const G4String& schemaLocation)
0084 {
0085   if(G4Threading::IsMasterThread())
0086   {
0087     const G4int depth = 0;
0088 
0089     if(lvol == nullptr)
0090     {
0091       lvol = G4TransportationManager::GetTransportationManager()
0092                ->GetNavigatorForTracking()
0093                ->GetWorldVolume()
0094                ->GetLogicalVolume();
0095     }
0096     if(rexp)
0097     {
0098       ExportRegions(refs);
0099     }
0100     writer->Write(filename, lvol, schemaLocation, depth, refs);
0101   }
0102 }
0103 
0104 // --------------------------------------------------------------------
0105 inline G4LogicalVolume* G4GDMLParser::ParseST(const G4String& filename,
0106                                               G4Material* medium,
0107                                               G4Material* solid)
0108 {
0109   if(G4Threading::IsMasterThread())
0110   {
0111     G4STRead STreader;
0112     return STreader.Read(filename, medium, solid);
0113   }
0114   else
0115   {
0116     return nullptr;
0117   }
0118 }
0119 
0120 // --------------------------------------------------------------------
0121 // Methods for Reader
0122 // --------------------------------------------------------------------
0123 
0124 inline G4bool G4GDMLParser::IsValid(const G4String& name) const
0125 {
0126   return reader->IsValidID(name);
0127 }
0128 
0129 inline G4double G4GDMLParser::GetConstant(const G4String& name) const
0130 {
0131   return reader->GetConstant(name);
0132 }
0133 
0134 inline G4double G4GDMLParser::GetVariable(const G4String& name) const
0135 {
0136   return reader->GetVariable(name);
0137 }
0138 
0139 inline G4double G4GDMLParser::GetQuantity(const G4String& name) const
0140 {
0141   return reader->GetQuantity(name);
0142 }
0143 
0144 inline G4ThreeVector G4GDMLParser::GetPosition(const G4String& name) const
0145 {
0146   return reader->GetPosition(name);
0147 }
0148 
0149 inline G4ThreeVector G4GDMLParser::GetRotation(const G4String& name) const
0150 {
0151   return reader->GetRotation(name);
0152 }
0153 
0154 inline G4ThreeVector G4GDMLParser::GetScale(const G4String& name) const
0155 {
0156   return reader->GetScale(name);
0157 }
0158 
0159 inline G4GDMLMatrix G4GDMLParser::GetMatrix(const G4String& name) const
0160 {
0161   return reader->GetMatrix(name);
0162 }
0163 
0164 inline G4LogicalVolume* G4GDMLParser::GetVolume(const G4String& name) const
0165 {
0166   return reader->GetVolume(name);
0167 }
0168 
0169 inline G4VPhysicalVolume*
0170 G4GDMLParser::GetPhysVolume(const G4String& name) const
0171 {
0172   return reader->GetPhysvol(name);
0173 }
0174 
0175 inline G4VPhysicalVolume*
0176 G4GDMLParser::GetWorldVolume(const G4String& setupName) const
0177 {
0178   return reader->GetWorldVolume(setupName);
0179 }
0180 
0181 inline G4GDMLAuxListType
0182 G4GDMLParser::GetVolumeAuxiliaryInformation(G4LogicalVolume* logvol) const
0183 {
0184   return reader->GetVolumeAuxiliaryInformation(logvol);
0185 }
0186 
0187 inline const G4GDMLAuxMapType* G4GDMLParser::GetAuxMap() const
0188 {
0189   return reader->GetAuxMap();
0190 }
0191 
0192 inline const G4GDMLAuxListType* G4GDMLParser::GetAuxList() const
0193 {
0194   return reader->GetAuxList();
0195 }
0196 
0197 inline void G4GDMLParser::AddAuxiliary(G4GDMLAuxStructType myaux)
0198 {
0199   return writer->AddAuxiliary(myaux);
0200 }
0201 
0202 inline void G4GDMLParser::StripNamePointers() const
0203 {
0204   reader->StripNames();
0205 }
0206 
0207 inline void G4GDMLParser::SetStripFlag(G4bool flag)
0208 {
0209   strip = flag;
0210 }
0211 
0212 inline void G4GDMLParser::SetOverlapCheck(G4bool flag)
0213 {
0214   reader->OverlapCheck(flag);
0215 }
0216 
0217 inline void G4GDMLParser::SetRegionExport(G4bool flag)
0218 {
0219   rexp = flag;
0220 }
0221 
0222 inline void G4GDMLParser::SetEnergyCutsExport(G4bool flag)
0223 {
0224   writer->SetEnergyCutsExport(flag);
0225 }
0226 
0227 inline void G4GDMLParser::SetSDExport(G4bool flag)
0228 {
0229   writer->SetSDExport(flag);
0230 }
0231 
0232 inline void G4GDMLParser::SetReverseSearch(G4bool flag)
0233 {
0234   reader->SetReverseSearch(flag);
0235 }
0236 
0237 inline G4int G4GDMLParser::GetMaxExportLevel() const
0238 {
0239   return writer->GetMaxExportLevel();
0240 }
0241 
0242 inline void G4GDMLParser::SetMaxExportLevel(G4int level)
0243 {
0244   writer->SetMaxExportLevel(level);
0245 }
0246 
0247 inline void G4GDMLParser::Clear()
0248 {
0249   reader->Clear();
0250 }
0251 
0252 inline void G4GDMLParser::SetImportSchema(const G4String& path_and_filename)
0253 {
0254   reader->SetSchemaFile(path_and_filename);
0255 }
0256 
0257 // --------------------------------------------------------------------
0258 // Methods for Writer
0259 // --------------------------------------------------------------------
0260 
0261 inline void G4GDMLParser::AddModule(const G4VPhysicalVolume* const physvol)
0262 {
0263   writer->AddModule(physvol);
0264 }
0265 
0266 inline void G4GDMLParser::AddModule(const G4int depth)
0267 {
0268   writer->AddModule(depth);
0269 }
0270 
0271 inline void G4GDMLParser::SetAddPointerToName(G4bool set)
0272 {
0273   writer->SetAddPointerToName(set);
0274 }
0275 
0276 inline void G4GDMLParser::AddVolumeAuxiliary(G4GDMLAuxStructType myaux,
0277                                              const G4LogicalVolume* const lvol)
0278 {
0279   writer->AddVolumeAuxiliary(myaux, lvol);
0280 }
0281 
0282 inline void G4GDMLParser::SetOutputFileOverwrite(G4bool flag)
0283 {
0284   writer->SetOutputFileOverwrite(flag);
0285 }