Ignore:
Timestamp:
Dec 22, 2010, 3:52:27 PM (14 years ago)
Author:
garnier
Message:

geant4 tag 9.4

Location:
trunk/source/persistency/gdml
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/persistency/gdml/GNUmakefile

    r850 r1347  
    1 # $Id: GNUmakefile,v 1.10 2008/07/02 14:15:16 gcosmo Exp $
     1# $Id: GNUmakefile,v 1.12 2010/11/02 10:40:24 gcosmo Exp $
    22# -----------------------------------------------------------------------
    33# GNUmakefile for persistency library.  Gabriele Cosmo, 16/11/96.
     
    1212include $(G4INSTALL)/config/architecture.gmk
    1313
    14 CPPFLAGS += -I$(G4INSTALL)/source/global/management/include \
    15             -I$(G4INSTALL)/source/global/HEPGeometry/include \
    16             -I$(G4INSTALL)/source/global/HEPNumerics/include \
    17             -I$(G4INSTALL)/source/digits_hits/hits/include \
    18             -I$(G4INSTALL)/source/digits_hits/digits/include \
    19             -I$(G4INSTALL)/source/particles/management/include \
    20             -I$(G4INSTALL)/source/run/include \
    21             -I$(G4INSTALL)/source/event/include \
    22             -I$(G4INSTALL)/source/track/include \
    23             -I$(G4INSTALL)/source/tracking/include \
    24             -I$(G4INSTALL)/source/intercoms/include \
    25             -I$(G4INSTALL)/source/geometry/management/include \
    26             -I$(G4INSTALL)/source/geometry/volumes/include \
    27             -I$(G4INSTALL)/source/geometry/navigation/include \
    28             -I$(G4INSTALL)/source/geometry/solids/CSG/include \
    29             -I$(G4INSTALL)/source/geometry/solids/Boolean/include \
    30             -I$(G4INSTALL)/source/geometry/solids/specific/include \
    31             -I$(G4INSTALL)/source/geometry/divisions/include \
    32             -I$(G4INSTALL)/source/materials/include \
    33             -I$(G4INSTALL)/source/graphics_reps/include
     14CPPFLAGS += \
     15            -I$(G4BASE)/global/management/include \
     16            -I$(G4BASE)/global/HEPGeometry/include \
     17            -I$(G4BASE)/global/HEPNumerics/include \
     18            -I$(G4BASE)/global/HEPRandom/include \
     19            -I$(G4BASE)/digits_hits/hits/include \
     20            -I$(G4BASE)/digits_hits/digits/include \
     21            -I$(G4BASE)/particles/management/include \
     22            -I$(G4BASE)/run/include \
     23            -I$(G4BASE)/event/include \
     24            -I$(G4BASE)/track/include \
     25            -I$(G4BASE)/tracking/include \
     26            -I$(G4BASE)/intercoms/include \
     27            -I$(G4BASE)/processes/management/include \
     28            -I$(G4BASE)/geometry/management/include \
     29            -I$(G4BASE)/geometry/volumes/include \
     30            -I$(G4BASE)/geometry/navigation/include \
     31            -I$(G4BASE)/geometry/solids/CSG/include \
     32            -I$(G4BASE)/geometry/solids/Boolean/include \
     33            -I$(G4BASE)/geometry/solids/specific/include \
     34            -I$(G4BASE)/geometry/divisions/include \
     35            -I$(G4BASE)/materials/include \
     36            -I$(G4BASE)/graphics_reps/include
    3437 
    3538ifdef G4LIB_USE_GDML
  • trunk/source/persistency/gdml/History

    r1315 r1347  
    1 $Id: History,v 1.120 2010/06/02 13:55:02 gcosmo Exp $
     1$Id: History,v 1.128 2010/11/30 08:56:16 gcosmo Exp $
    22-------------------------------------------------------------------
    33
     
    1717     * Reverse chronological order (last date on top), please *
    1818     ----------------------------------------------------------
     19
     2030 Nov 2010 Gabriele Cosmo (gdml-V09-03-10)
     21- Fixed ambiguity in signature of Write() method in G4GDMLParser.
     22
     2317 Nov 2010 Gabriele Cosmo (gdml-V09-03-09)
     24- Added possibility to de-activate/activate names stripping when reading files,
     25  by invoking a new method G4GDMLParser::SetStripFlag(bool) before importing
     26  the GDML file. Stripping is activated by default.
     27- Corrected initialization of messenger for all constructors of G4GDMLParser.
     28
     2904 Nov 2010 Gabriele Cosmo (gdml-V09-03-08)
     30- Fixed compilation warning on G4GDMLEvaluator.
     31
     3202 Nov 2010 Gabriele Cosmo (gdml-V09-03-07)
     33- Fixed minor left Coverity reports.
     34- Some code cleanup and updated CMake scripts.
     35
     3625 Oct 2010 Witold Pokorski
     37- New class G4GDMLMessenger instantiated with G4GDMLParser and defining
     38  UI commands for importing and exporting GDML files, through the various
     39  options the parser provides.
     40- Corrected GetWorldVolume() in G4GDMLReadStructure, to make use of structure
     41  stored in memory in case geometry is already imported.
     42
     4314 Oct 2010 Gabriele Cosmo (gdml-V09-03-06)
     44- Fixed dummy initialisation of members in constructors in classes
     45  G4GDMLParameterisation, G4GDMLReadParamvol, G4GDMLReadStructure,
     46  G4GDMLWrite, G4GDMLWriteDefine, G4GDMLWriteMaterials, G4GDMLWriteSolids.
     47- Added exceptions asserting validity of dynamic casted pointers.
     48
     4911 Oct 2010 Witold Pokorski (gdml-V09-03-05)
     50- Added GetAuxMap() method to G4GDMLParser and removed 'const' qualifier to
     51  types in internal map of logical-volumes. Changed value type to 'string' in
     52  G4GDMLAuxPairType to avoid extra type evaluation while parsing.
     53
     5419 Aug 2010 Gabriele Cosmo (gdml-V09-03-04)
     55- Fixed printout of unit in G4GDMLWriteStructure for replicas and divisions,
     56  in the case of angles.
    1957
    205802 Jun 2010 Gabriele Cosmo (gdml-V09-03-03)
  • trunk/source/persistency/gdml/include/G4GDMLEvaluator.hh

    r1337 r1347  
    2525//
    2626//
    27 // $Id: G4GDMLEvaluator.hh,v 1.17 2009/04/24 15:34:20 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4GDMLEvaluator.hh,v 1.18 2010/10/25 10:15:41 witoldp Exp $
     28// GEANT4 tag $Name: gdml-V09-03-09 $
    2929//
    3030//
     
    5454   G4GDMLEvaluator();
    5555
     56   void Clear();
    5657   void DefineConstant(const G4String&, G4double);
    5758   void DefineVariable(const G4String&, G4double);
  • trunk/source/persistency/gdml/include/G4GDMLParameterisation.hh

    r1337 r1347  
    2525//
    2626//
    27 // $Id: G4GDMLParameterisation.hh,v 1.10 2008/07/16 15:46:33 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4GDMLParameterisation.hh,v 1.11 2010/10/14 16:19:40 gcosmo Exp $
     28// GEANT4 tag $Name: gdml-V09-03-09 $
    2929//
    3030//
     
    7373      G4double dimension[16];
    7474
    75       PARAMETER() { memset(dimension,0,sizeof(dimension)); }
     75      PARAMETER() : pRot(0) { memset(dimension,0,sizeof(dimension)); }
    7676   };
    7777
  • trunk/source/persistency/gdml/include/G4GDMLParser.hh

    r1337 r1347  
    2525//
    2626//
    27 // $Id: G4GDMLParser.hh,v 1.59 2010/02/17 18:06:25 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4GDMLParser.hh,v 1.65 2010/11/17 10:47:02 gcosmo Exp $
     28// GEANT4 tag $Name: gdml-V09-03-09 $
    2929//
    3030//
     
    4545#include "G4GDMLWriteStructure.hh"
    4646#include "G4STRead.hh"
     47#include "G4GDMLMessenger.hh"
     48
     49#include "G4TransportationManager.hh"
     50#include "G4Navigator.hh"
     51
    4752
    4853#define G4GDML_DEFAULT_SCHEMALOCATION G4String("http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd")
     
    7075
    7176   inline void Write(const G4String& filename,
    72                      const G4VPhysicalVolume* const pvol = 0,
     77                     const G4VPhysicalVolume* pvol = 0,
    7378                           G4bool storeReferences = true,
    7479                     const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
     
    7984     // Alternative path for the schema location can be specified; by default
    8085     // the URL to the GDML web site is used.
     86
     87   inline void Write(const G4String& filename,
     88                     const G4LogicalVolume* lvol = 0,
     89                           G4bool storeReferences = true,
     90                     const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
     91     //
     92     // Exports on a GDML file, specified by 'filename' a geometry tree
     93     // starting from 'pvol' as top volume. Uniqueness of stored entities
     94     // is guaranteed by storing pointer-references by default.
     95     // Alternative path for the schema location can be specified; by default
     96     // the URL to the GDML web site is used. Same as method above except
     97     // that the logical volume is provided here.
    8198
    8299   inline G4LogicalVolume* ParseST(const G4String& name,
     
    101118   inline G4LogicalVolume* GetVolume(const G4String& name) const;
    102119   inline G4VPhysicalVolume* GetWorldVolume(const G4String& setupName="Default") const;
    103    inline G4GDMLAuxListType GetVolumeAuxiliaryInformation(const G4LogicalVolume* const logvol);
     120   inline G4GDMLAuxListType GetVolumeAuxiliaryInformation(G4LogicalVolume* logvol) const;
     121   inline const G4GDMLAuxMapType* GetAuxMap() const;
    104122   inline void StripNamePointers() const;
     123   inline void SetStripFlag(G4bool);
    105124   inline void SetOverlapCheck(G4bool);
     125   inline void Clear();                  // Clears the evaluator
    106126
    107127   // Methods for Writer
     
    115135   G4GDMLReadStructure* reader;
    116136   G4GDMLWriteStructure* writer;
    117    G4bool urcode, uwcode;
     137   G4GDMLMessenger* messenger;
     138   G4bool urcode, uwcode, strip;
    118139
    119140};
  • trunk/source/persistency/gdml/include/G4GDMLParser.icc

    r1337 r1347  
    2525//
    2626//
    27 // $Id: G4GDMLParser.icc,v 1.9 2010/02/17 18:06:25 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4GDMLParser.icc,v 1.15 2010/11/17 10:47:02 gcosmo Exp $
     28// GEANT4 tag $Name: gdml-V09-03-09 $
    2929//
    3030//
     
    3636void G4GDMLParser::Read(const G4String& filename, G4bool validate)
    3737{   
    38   reader->Read(filename,validate,false);
     38  reader->Read(filename,validate,false,strip);
    3939}
    4040
     
    4747inline
    4848void G4GDMLParser::Write(const G4String& filename,
    49                          const G4VPhysicalVolume* const pvol,
     49                         const G4VPhysicalVolume* pvol,
    5050                               G4bool refs,
    5151                         const G4String& schemaLocation)
     
    5656  if (!pvol)
    5757  {
    58     G4VPhysicalVolume* worldPV = GetWorldVolume();
    59     if (!worldPV)
    60     {
    61       G4Exception("G4DMLParser::Write()", "InvalidSetup", FatalException,
    62                   "Detector-Construction needs to be registered first!");
    63     }
    64     lvol = worldPV->GetLogicalVolume();
     58    lvol = G4TransportationManager::GetTransportationManager()->
     59           GetNavigatorForTracking()->GetWorldVolume()->GetLogicalVolume();
    6560  }
    6661  else
    6762  {
    6863    lvol = pvol->GetLogicalVolume();
     64  }
     65
     66  writer->Write(filename,lvol,schemaLocation,depth,refs);
     67}
     68
     69inline
     70void G4GDMLParser::Write(const G4String& filename,
     71                         const G4LogicalVolume* lvol,
     72                               G4bool refs,
     73                         const G4String& schemaLocation)
     74{
     75  const G4int depth = 0;
     76
     77  if (!lvol)
     78  {
     79    lvol = G4TransportationManager::GetTransportationManager()->
     80           GetNavigatorForTracking()->GetWorldVolume()->GetLogicalVolume();
    6981  }
    7082  writer->Write(filename,lvol,schemaLocation,depth,refs);
     
    145157inline
    146158G4GDMLAuxListType
    147 G4GDMLParser::GetVolumeAuxiliaryInformation(const G4LogicalVolume* const logvol)
     159G4GDMLParser::GetVolumeAuxiliaryInformation(G4LogicalVolume* logvol) const
    148160{
    149161  return reader->GetVolumeAuxiliaryInformation(logvol);
     
    151163
    152164inline
     165const G4GDMLAuxMapType* G4GDMLParser::GetAuxMap() const
     166{
     167  return reader->GetAuxMap();
     168}
     169
     170inline
    153171void G4GDMLParser::StripNamePointers() const
    154172{
     
    156174}
    157175
     176inline void G4GDMLParser::SetStripFlag(G4bool flag)
     177{
     178  strip = flag;
     179}
     180
    158181inline void G4GDMLParser::SetOverlapCheck(G4bool flag)
    159182{
     
    161184}
    162185
     186inline void G4GDMLParser::Clear()
     187{
     188  reader->Clear();
     189}
     190
    163191//
    164192// Methods for Writer
  • trunk/source/persistency/gdml/include/G4GDMLRead.hh

    r1337 r1347  
    2525//
    2626//
    27 // $Id: G4GDMLRead.hh,v 1.31 2009/05/12 15:46:43 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4GDMLRead.hh,v 1.33 2010/11/17 10:47:02 gcosmo Exp $
     28// GEANT4 tag $Name: gdml-V09-03-09 $
    2929//
    3030// class G4GDMLRead
     
    115115     // More pure virtual methods implemented in the reader plugin.
    116116
    117    void Read(const G4String&, G4bool validation, G4bool isModule);
     117   void Read(const G4String&, G4bool validation,
     118             G4bool isModule, G4bool strip=true);
    118119     //
    119120     // Main method for reading GDML files.
  • trunk/source/persistency/gdml/include/G4GDMLReadStructure.hh

    r1337 r1347  
    2525//
    2626//
    27 // $Id: G4GDMLReadStructure.hh,v 1.28 2009/09/24 15:04:34 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4GDMLReadStructure.hh,v 1.32 2010/11/02 10:39:27 gcosmo Exp $
     28// GEANT4 tag $Name: gdml-V09-03-09 $
    2929//
    3030//
     
    5454{
    5555   G4String type;
    56    G4double value;
     56   G4String value;
    5757};
    5858
    5959typedef std::vector<G4GDMLAuxPairType> G4GDMLAuxListType;
    60 typedef std::map<const G4LogicalVolume*,G4GDMLAuxListType> G4GDMLAuxMapType;
     60typedef std::map<G4LogicalVolume*,G4GDMLAuxListType> G4GDMLAuxMapType;
    6161typedef std::map<G4String, G4AssemblyVolume*> G4GDMLAssemblyMapType;
    6262
     
    7272   G4LogicalVolume* GetVolume(const G4String&) const;
    7373   G4AssemblyVolume* GetAssembly(const G4String&) const;
    74    G4GDMLAuxListType GetVolumeAuxiliaryInformation(const G4LogicalVolume* const);
     74   G4GDMLAuxListType GetVolumeAuxiliaryInformation(G4LogicalVolume*) const;
    7575   G4VPhysicalVolume* GetWorldVolume(const G4String&);
    7676   const G4GDMLAuxMapType* GetAuxMap() const;
     77   void Clear();   // Clears internal map and evaluator
    7778
    7879   virtual void VolumeRead(const xercesc::DOMElement* const);
     
    101102   G4GDMLAssemblyMapType assemblyMap;
    102103   G4LogicalVolume *pMotherLogical;
    103 
     104   std::map<std::string, G4VPhysicalVolume*> setuptoPV;
    104105};
    105106
  • trunk/source/persistency/gdml/src/G4GDMLEvaluator.cc

    r1228 r1347  
    2525//
    2626//
    27 // $Id: G4GDMLEvaluator.cc,v 1.23 2009/04/24 15:34:20 gcosmo Exp $
     27// $Id: G4GDMLEvaluator.cc,v 1.26 2010/11/04 11:33:49 gcosmo Exp $
    2828// GEANT4 tag $ Name:$
    2929//
     
    4545   eval.setStdMath();
    4646   eval.setSystemOfUnits(meter,kilogram,second,ampere,kelvin,mole,candela);
     47}
     48
     49void G4GDMLEvaluator::Clear()
     50{
     51  eval.clear();
     52  eval.setStdMath();
     53  eval.setSystemOfUnits(meter,kilogram,second,ampere,kelvin,mole,candela);
     54
     55  variableList.clear();
    4756}
    4857
     
    153162   if (open==close) { return in; }
    154163
    155    if (open>close)
     164   if ((open>close) || (open==std::string::npos) || (close==std::string::npos))
    156165   {
    157166     G4String error_msg = "Bracket mismatch: " + in;
    158167     G4Exception("G4GDMLEvaluator::SolveBrackets()", "InvalidExpression",
    159168                 FatalException, error_msg);
     169     return in;
    160170   }
    161171
  • trunk/source/persistency/gdml/src/G4GDMLParser.cc

    r1337 r1347  
    2525//
    2626//
    27 // $Id: G4GDMLParser.cc,v 1.14 2009/04/15 13:29:30 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4GDMLParser.cc,v 1.18 2010/11/17 11:36:45 gcosmo Exp $
     28// GEANT4 tag $Name: gdml-V09-03-09 $
    2929//
    3030//
     
    3636
    3737G4GDMLParser::G4GDMLParser()
    38   : urcode(false), uwcode(false)
     38  : urcode(false), uwcode(false), strip(true)
    3939{
    4040  reader = new G4GDMLReadStructure;
    4141  writer = new G4GDMLWriteStructure;
     42  messenger = new G4GDMLMessenger(this);
     43
    4244  xercesc::XMLPlatformUtils::Initialize();
    4345}
     
    4850  reader = extr;
    4951  writer = new G4GDMLWriteStructure;
     52  messenger = new G4GDMLMessenger(this);
     53
    5054  xercesc::XMLPlatformUtils::Initialize();
    5155}
     
    5761  reader = extr;
    5862  writer = extw;
     63  messenger = new G4GDMLMessenger(this);
     64
    5965  xercesc::XMLPlatformUtils::Initialize();
    6066}
     
    6571  if (!urcode) { delete reader; }
    6672  if (!uwcode) { delete writer; }
     73  delete messenger;
    6774}
  • trunk/source/persistency/gdml/src/G4GDMLRead.cc

    r1337 r1347  
    2424// ********************************************************************
    2525//
    26 // $Id: G4GDMLRead.cc,v 1.47 2009/05/12 15:46:43 gcosmo Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: G4GDMLRead.cc,v 1.50 2010/11/17 10:47:02 gcosmo Exp $
     27// GEANT4 tag $Name: gdml-V09-03-09 $
    2828//
    2929// class G4GDMLRead Implementation
     
    199199      const xercesc::DOMAttr* const attribute
    200200            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     201      if (!attribute)
     202      {
     203        G4Exception("G4GDMLRead::LoopRead()", "InvalidRead",
     204                    FatalException, "No attribute found!");
     205        return;
     206      }
    201207      const G4String attribute_name = Transcode(attribute->getName());
    202208      const G4String attribute_value = Transcode(attribute->getValue());
     
    266272void G4GDMLRead::Read(const G4String& fileName,
    267273                            G4bool validation,
    268                             G4bool isModule)
     274                            G4bool isModule,
     275                            G4bool strip)
    269276{
    270277   if (isModule)
     
    305312     G4Exception("G4GDMLRead::Read()", "InvalidRead",
    306313                 FatalException, error_msg);
     314     return;
    307315   }
    308316   xercesc::DOMElement* element = doc->getDocumentElement();
     
    312320     G4Exception("G4GDMLRead::Read()", "InvalidRead",
    313321                 FatalException, "Empty document!");
     322     return;
    314323   }
    315324
     
    321330      const xercesc::DOMElement* const child
    322331            = dynamic_cast<xercesc::DOMElement*>(iter);
     332      if (!child)
     333      {
     334        G4Exception("G4GDMLRead::Read()", "InvalidRead",
     335                    FatalException, "No child found!");
     336        return;
     337      }
    323338      const G4String tag = Transcode(child->getTagName());
    324339
     
    337352   }
    338353
    339    if (parser)  { delete parser;  }
    340    if (handler) { delete handler; }
     354   delete parser;
     355   delete handler;
    341356
    342357   if (isModule)
     
    347362   {
    348363      G4cout << "G4GDML: Reading '" << fileName << "' done!" << G4endl;
    349       StripNames();
    350    }
    351 }
     364      if (strip)  { StripNames(); }
     365   }
     366}
  • trunk/source/persistency/gdml/src/G4GDMLReadDefine.cc

    r1337 r1347  
    2424// ********************************************************************
    2525//
    26 // $Id: G4GDMLReadDefine.cc,v 1.25 2010/02/17 18:06:25 gcosmo Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: G4GDMLReadDefine.cc,v 1.26 2010/10/14 16:19:40 gcosmo Exp $
     27// GEANT4 tag $Name: gdml-V09-03-09 $
    2828//
    2929// class G4GDMLReadDefine Implementation
     
    4242G4GDMLMatrix::G4GDMLMatrix(size_t rows0, size_t cols0)
    4343{   
    44    if ((rows<=0) || (cols<=0))
     44   if ((rows0==0) || (cols0==0))
    4545   {
    4646     G4Exception("G4GDMLMatrix::G4GDMLMatrix(r,c)", "InvalidSetup",
     
    161161      const xercesc::DOMAttr* const attribute
    162162            = dynamic_cast<xercesc::DOMAttr*>(node);   
     163      if (!attribute)
     164      {
     165        G4Exception("G4GDMLRead::ConstantRead()", "InvalidRead",
     166                    FatalException, "No attribute found!");
     167        return;
     168      }
    163169      const G4String attName = Transcode(attribute->getName());
    164170      const G4String attValue = Transcode(attribute->getValue());
     
    190196      const xercesc::DOMAttr* const attribute
    191197            = dynamic_cast<xercesc::DOMAttr*>(node);   
     198      if (!attribute)
     199      {
     200        G4Exception("G4GDMLRead::ExpressionRead()", "InvalidRead",
     201                    FatalException, "No attribute found!");
     202        return;
     203      }
    192204      const G4String attName = Transcode(attribute->getName());
    193205      const G4String attValue = Transcode(attribute->getValue());
     
    221233      const xercesc::DOMAttr* const attribute
    222234            = dynamic_cast<xercesc::DOMAttr*>(node);   
     235      if (!attribute)
     236      {
     237        G4Exception("G4GDMLRead::MatrixRead()", "InvalidRead",
     238                    FatalException, "No attribute found!");
     239        return;
     240      }
    223241      const G4String attName = Transcode(attribute->getName());
    224242      const G4String attValue = Transcode(attribute->getValue());
     
    271289      const xercesc::DOMAttr* const attribute
    272290            = dynamic_cast<xercesc::DOMAttr*>(node);   
     291      if (!attribute)
     292      {
     293        G4Exception("G4GDMLRead::PositionRead()", "InvalidRead",
     294                    FatalException, "No attribute found!");
     295        return;
     296      }
    273297      const G4String attName = Transcode(attribute->getName());
    274298      const G4String attValue = Transcode(attribute->getValue());
     
    304328      const xercesc::DOMAttr* const attribute
    305329            = dynamic_cast<xercesc::DOMAttr*>(node);   
     330      if (!attribute)
     331      {
     332        G4Exception("G4GDMLRead::RotationRead()", "InvalidRead",
     333                    FatalException, "No attribute found!");
     334        return;
     335      }
    306336      const G4String attName = Transcode(attribute->getName());
    307337      const G4String attValue = Transcode(attribute->getValue());
     
    335365      const xercesc::DOMAttr* const attribute
    336366            = dynamic_cast<xercesc::DOMAttr*>(node);   
     367      if (!attribute)
     368      {
     369        G4Exception("G4GDMLRead::ScaleRead()", "InvalidRead",
     370                    FatalException, "No attribute found!");
     371        return;
     372      }
    337373      const G4String attName = Transcode(attribute->getName());
    338374      const G4String attValue = Transcode(attribute->getValue());
     
    366402      const xercesc::DOMAttr* const attribute
    367403            = dynamic_cast<xercesc::DOMAttr*>(node);   
     404      if (!attribute)
     405      {
     406        G4Exception("G4GDMLRead::VariableRead()", "InvalidRead",
     407                    FatalException, "No attribute found!");
     408        return;
     409      }
    368410      const G4String attName = Transcode(attribute->getName());
    369411      const G4String attValue = Transcode(attribute->getValue());
     
    395437      const xercesc::DOMAttr* const attribute
    396438            = dynamic_cast<xercesc::DOMAttr*>(node);   
     439      if (!attribute)
     440      {
     441        G4Exception("G4GDMLRead::QuantityRead()", "InvalidRead",
     442                    FatalException, "No attribute found!");
     443        return;
     444      }
    397445      const G4String attName = Transcode(attribute->getName());
    398446      const G4String attValue = Transcode(attribute->getValue());
     
    419467      const xercesc::DOMElement* const child
    420468            = dynamic_cast<xercesc::DOMElement*>(iter);
     469      if (!child)
     470      {
     471        G4Exception("G4GDMLRead::DefineRead()", "InvalidRead",
     472                    FatalException, "No child found!");
     473        return;
     474      }
    421475      const G4String tag = Transcode(child->getTagName());
    422476
     
    458512      const xercesc::DOMAttr* const attribute
    459513            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     514      if (!attribute)
     515      {
     516        G4Exception("G4GDMLRead::VectorRead()", "InvalidRead",
     517                    FatalException, "No attribute found!");
     518        return;
     519      }
    460520      const G4String attName = Transcode(attribute->getName());
    461521      const G4String attValue = Transcode(attribute->getValue());
     
    487547      const xercesc::DOMAttr* const attribute
    488548            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     549      if (!attribute)
     550      {
     551        G4Exception("G4GDMLRead::Read()", "InvalidRead",
     552                    FatalException, "No attribute found!");
     553        return ref;
     554      }
    489555      const G4String attName = Transcode(attribute->getName());
    490556      const G4String attValue = Transcode(attribute->getValue());
  • trunk/source/persistency/gdml/src/G4GDMLReadMaterials.cc

    r1228 r1347  
    2525//
    2626//
    27 // $Id: G4GDMLReadMaterials.cc,v 1.20 2009/04/24 15:34:20 gcosmo Exp $
     27// $Id: G4GDMLReadMaterials.cc,v 1.21 2010/10/14 16:19:40 gcosmo Exp $
    2828// GEANT4 tag $ Name:$
    2929//
     
    6969      const xercesc::DOMAttr* const attribute
    7070            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     71      if (!attribute)
     72      {
     73        G4Exception("G4GDMLReadMaterials::AtomRead()", "InvalidRead",
     74                    FatalException, "No attribute found!");
     75        return value;
     76      }
    7177      const G4String attName = Transcode(attribute->getName());
    7278      const G4String attValue = Transcode(attribute->getValue());
     
    98104      const xercesc::DOMAttr* const attribute
    99105            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     106      if (!attribute)
     107      {
     108        G4Exception("G4GDMLReadMaterials::CompositeRead()", "InvalidRead",
     109                    FatalException, "No attribute found!");
     110        return n;
     111      }
    100112      const G4String attName = Transcode(attribute->getName());
    101113      const G4String attValue = Transcode(attribute->getValue());
     
    127139      const xercesc::DOMAttr* const attribute
    128140            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     141      if (!attribute)
     142      {
     143        G4Exception("G4GDMLReadMaterials::DRead()", "InvalidRead",
     144                    FatalException, "No attribute found!");
     145        return value;
     146      }
    129147      const G4String attName = Transcode(attribute->getName());
    130148      const G4String attValue = Transcode(attribute->getValue());
     
    155173      const xercesc::DOMAttr* const attribute
    156174            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     175      if (!attribute)
     176      {
     177        G4Exception("G4GDMLReadMaterials::PRead()", "InvalidRead",
     178                    FatalException, "No attribute found!");
     179        return value;
     180      }
    157181      const G4String attName = Transcode(attribute->getName());
    158182      const G4String attValue = Transcode(attribute->getValue());
     
    183207      const xercesc::DOMAttr* const attribute
    184208            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     209      if (!attribute)
     210      {
     211        G4Exception("G4GDMLReadMaterials::TRead()", "InvalidRead",
     212                    FatalException, "No attribute found!");
     213        return value;
     214      }
    185215      const G4String attName = Transcode(attribute->getName());
    186216      const G4String attValue = Transcode(attribute->getValue());
     
    215245      const xercesc::DOMAttr* const attribute
    216246            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     247      if (!attribute)
     248      {
     249        G4Exception("G4GDMLReadMaterials::ElementRead()", "InvalidRead",
     250                    FatalException, "No attribute found!");
     251        return;
     252      }
    217253      const G4String attName = Transcode(attribute->getName());
    218254      const G4String attValue = Transcode(attribute->getValue());
     
    232268      const xercesc::DOMElement* const child
    233269            = dynamic_cast<xercesc::DOMElement*>(iter);
     270      if (!child)
     271      {
     272        G4Exception("G4GDMLReadMaterials::ElementRead()", "InvalidRead",
     273                    FatalException, "No child found!");
     274        return;
     275      }
    234276      const G4String tag = Transcode(child->getTagName());
    235277
     
    268310      const xercesc::DOMAttr* const attribute
    269311            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     312      if (!attribute)
     313      {
     314        G4Exception("G4GDMLReadMaterials::FractionRead()", "InvalidRead",
     315                    FatalException, "No attribute found!");
     316        return n;
     317      }
    270318      const G4String attName = Transcode(attribute->getName());
    271319      const G4String attValue = Transcode(attribute->getValue());
     
    300348      const xercesc::DOMAttr* const attribute
    301349            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     350      if (!attribute)
     351      {
     352        G4Exception("G4GDMLReadMaterials::IsotopeRead()", "InvalidRead",
     353                    FatalException, "No attribute found!");
     354        return;
     355      }
    302356      const G4String attName = Transcode(attribute->getName());
    303357      const G4String attValue = Transcode(attribute->getValue());
     
    315369      const xercesc::DOMElement* const child
    316370            = dynamic_cast<xercesc::DOMElement*>(iter);
     371      if (!child)
     372      {
     373        G4Exception("G4GDMLReadMaterials::IsotopeRead()", "InvalidRead",
     374                    FatalException, "No child found!");
     375        return;
     376      }
    317377      const G4String tag = Transcode(child->getTagName());
    318378
     
    348408      const xercesc::DOMAttr* const attribute
    349409            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     410      if (!attribute)
     411      {
     412        G4Exception("G4GDMLReadMaterials::MaterialRead()", "InvalidRead",
     413                    FatalException, "No attribute found!");
     414        return;
     415      }
    350416      const G4String attName = Transcode(attribute->getName());
    351417      const G4String attValue = Transcode(attribute->getValue());
     
    370436      const xercesc::DOMElement* const child
    371437            = dynamic_cast<xercesc::DOMElement*>(iter);
     438      if (!child)
     439      {
     440        G4Exception("G4GDMLReadMaterials::MaterialRead()", "InvalidRead",
     441                    FatalException, "No child found!");
     442        return;
     443      }
    372444      const G4String tag = Transcode(child->getTagName());
    373445
     
    401473      const xercesc::DOMElement* const child
    402474            = dynamic_cast<xercesc::DOMElement*>(iter);
     475      if (!child)
     476      {
     477        G4Exception("G4GDMLReadMaterials::MaterialRead()", "InvalidRead",
     478                    FatalException, "No child found!");
     479        return;
     480      }
    403481      const G4String tag = Transcode(child->getTagName());
    404482
     
    417495      const xercesc::DOMElement* const child
    418496            = dynamic_cast<xercesc::DOMElement*>(iter);
     497      if (!child)
     498      {
     499        G4Exception("G4GDMLReadMaterials::MixtureRead()", "InvalidRead",
     500                    FatalException, "No child found!");
     501        return;
     502      }
    419503      const G4String tag = Transcode(child->getTagName());
    420504
     
    439523      const xercesc::DOMElement* const child
    440524            = dynamic_cast<xercesc::DOMElement*>(iter);
     525      if (!child)
     526      {
     527        G4Exception("G4GDMLReadMaterials::MixtureRead()", "InvalidRead",
     528                    FatalException, "No child found!");
     529        return;
     530      }
    441531      const G4String tag = Transcode(child->getTagName());
    442532
     
    493583      const xercesc::DOMAttr* const attribute
    494584            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     585      if (!attribute)
     586      {
     587        G4Exception("G4GDMLReadMaterials::PropertyRead()", "InvalidRead",
     588                    FatalException, "No attribute found!");
     589        return;
     590      }
    495591      const G4String attName = Transcode(attribute->getName());
    496592      const G4String attValue = Transcode(attribute->getValue());
     
    543639      const xercesc::DOMElement* const child
    544640            = dynamic_cast<xercesc::DOMElement*>(iter);
     641      if (!child)
     642      {
     643        G4Exception("G4GDMLReadMaterials::MaterialsRead()", "InvalidRead",
     644                    FatalException, "No child found!");
     645        return;
     646      }
    545647      const G4String tag = Transcode(child->getTagName());
    546648     
  • trunk/source/persistency/gdml/src/G4GDMLReadParamvol.cc

    r1337 r1347  
    2424// ********************************************************************
    2525//
    26 // $Id: G4GDMLReadParamvol.cc,v 1.13 2009/04/24 15:34:20 gcosmo Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: G4GDMLReadParamvol.cc,v 1.14 2010/10/14 16:19:40 gcosmo Exp $
     27// GEANT4 tag $Name: gdml-V09-03-09 $
    2828//
    2929// class G4GDMLReadParamvol Implementation
     
    4040#include "G4VPhysicalVolume.hh"
    4141
    42 G4GDMLReadParamvol::G4GDMLReadParamvol() : G4GDMLReadSetup()
     42G4GDMLReadParamvol::G4GDMLReadParamvol()
     43  : G4GDMLReadSetup(), parameterisation(0)
    4344{
    4445}
     
    6768      const xercesc::DOMAttr* const attribute
    6869            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     70      if (!attribute)
     71      {
     72        G4Exception("G4GDMLReadParamvol::Box_dimensionsRead()",
     73                    "InvalidRead", FatalException, "No attribute found!");
     74        return;
     75      }
    6976      const G4String attName = Transcode(attribute->getName());
    7077      const G4String attValue = Transcode(attribute->getValue());
     
    100107      const xercesc::DOMAttr* const attribute
    101108            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     109      if (!attribute)
     110      {
     111        G4Exception("G4GDMLReadParamvol::Trd_dimensionsRead()",
     112                    "InvalidRead", FatalException, "No attribute found!");
     113        return;
     114      }
    102115      const G4String attName = Transcode(attribute->getName());
    103116      const G4String attValue = Transcode(attribute->getValue());
     
    138151      const xercesc::DOMAttr* const attribute
    139152            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     153      if (!attribute)
     154      {
     155        G4Exception("G4GDMLReadParamvol::Trap_dimensionsRead()",
     156                    "InvalidRead", FatalException, "No attribute found!");
     157        return;
     158      }
    140159      const G4String attName = Transcode(attribute->getName());
    141160      const G4String attValue = Transcode(attribute->getValue());
     
    202221      const xercesc::DOMAttr* const attribute
    203222            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     223      if (!attribute)
     224      {
     225        G4Exception("G4GDMLReadParamvol::Tube_dimensionsRead()",
     226                    "InvalidRead", FatalException, "No attribute found!");
     227        return;
     228      }
    204229      const G4String attName = Transcode(attribute->getName());
    205230      const G4String attValue = Transcode(attribute->getValue());
     
    248273      const xercesc::DOMAttr* const attribute
    249274            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     275      if (!attribute)
     276      {
     277        G4Exception("G4GDMLReadParamvol::Cone_dimensionsRead()",
     278                    "InvalidRead", FatalException, "No attribute found!");
     279        return;
     280      }
    250281      const G4String attName = Transcode(attribute->getName());
    251282      const G4String attValue = Transcode(attribute->getValue());
     
    300331      const xercesc::DOMAttr* const attribute
    301332            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     333      if (!attribute)
     334      {
     335        G4Exception("G4GDMLReadParamvol::Sphere_dimensionsRead()",
     336                    "InvalidRead", FatalException, "No attribute found!");
     337        return;
     338      }
    302339      const G4String attName = Transcode(attribute->getName());
    303340      const G4String attValue = Transcode(attribute->getValue());
     
    348385      const xercesc::DOMAttr* const attribute
    349386            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     387      if (!attribute)
     388      {
     389        G4Exception("G4GDMLReadParamvol::Orb_dimensionsRead()",
     390                    "InvalidRead", FatalException, "No attribute found!");
     391        return;
     392      }
    350393      const G4String attName = Transcode(attribute->getName());
    351394      const G4String attValue = Transcode(attribute->getValue());
     
    378421      const xercesc::DOMAttr* const attribute
    379422            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     423      if (!attribute)
     424      {
     425        G4Exception("G4GDMLReadParamvol::Torus_dimensionsRead()",
     426                    "InvalidRead", FatalException, "No attribute found!");
     427        return;
     428      }
    380429      const G4String attName = Transcode(attribute->getName());
    381430      const G4String attValue = Transcode(attribute->getValue());
     
    424473      const xercesc::DOMAttr* const attribute
    425474            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     475      if (!attribute)
     476      {
     477        G4Exception("G4GDMLReadParamvol::Para_dimensionsRead()",
     478                    "InvalidRead", FatalException, "No attribute found!");
     479        return;
     480      }
    426481      const G4String attName = Transcode(attribute->getName());
    427482      const G4String attValue = Transcode(attribute->getValue());
     
    473528      const xercesc::DOMAttr* const attribute
    474529            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     530      if (!attribute)
     531      {
     532        G4Exception("G4GDMLReadParamvol::Hype_dimensionsRead()",
     533                    "InvalidRead", FatalException, "No attribute found!");
     534        return;
     535      }
    475536      const G4String attName = Transcode(attribute->getName());
    476537      const G4String attValue = Transcode(attribute->getValue());
     
    514575      const xercesc::DOMElement* const child
    515576            = dynamic_cast<xercesc::DOMElement*>(iter);
     577      if (!child)
     578      {
     579        G4Exception("G4GDMLReadParamvol::ParametersRead()",
     580                    "InvalidRead", FatalException, "No child found!");
     581        return;
     582      }
    516583      const G4String tag = Transcode(child->getTagName());
    517584      if (tag=="rotation") { VectorRead(child,rotation); } else
     
    560627     const xercesc::DOMElement* const child
    561628           = dynamic_cast<xercesc::DOMElement*>(iter);
     629     if (!child)
     630     {
     631       G4Exception("G4GDMLReadParamvol::ParameterisedRead()",
     632                   "InvalidRead", FatalException, "No child found!");
     633       return;
     634     }
    562635     const G4String tag = Transcode(child->getTagName());
    563636 
     
    578651          const xercesc::DOMAttr* const attribute
    579652                = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     653          if (!attribute)
     654          {
     655            G4Exception("G4GDMLReadParamvol::ParameterisedRead()",
     656                        "InvalidRead", FatalException, "No attribute found!");
     657            return;
     658          }
    580659          const G4String attName = Transcode(attribute->getName());
    581660          const G4String attValue = Transcode(attribute->getValue());
     
    602681      const xercesc::DOMElement* const child
    603682            = dynamic_cast<xercesc::DOMElement*>(iter);
     683      if (!child)
     684      {
     685        G4Exception("G4GDMLReadParamvol::Paramvol_contentRead()", "InvalidRead",
     686                    FatalException, "No child found!");
     687        return;
     688      }
    604689      const G4String tag = Transcode(child->getTagName());
    605690      if (tag=="parameterised_position_size") { ParameterisedRead(child); }else
     
    622707      const xercesc::DOMElement* const child
    623708            = dynamic_cast<xercesc::DOMElement*>(iter);
     709      if (!child)
     710      {
     711        G4Exception("G4GDMLReadParamvol::ParamvolRead()", "InvalidRead",
     712                    FatalException, "No child found!");
     713        return;
     714      }
    624715      const G4String tag = Transcode(child->getTagName());
    625716
  • trunk/source/persistency/gdml/src/G4GDMLReadSetup.cc

    r1337 r1347  
    2424// ********************************************************************
    2525//
    26 // $Id: G4GDMLReadSetup.cc,v 1.10 2009/03/24 15:47:33 gcosmo Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: G4GDMLReadSetup.cc,v 1.11 2010/10/14 16:19:40 gcosmo Exp $
     27// GEANT4 tag $Name: gdml-V09-03-09 $
    2828//
    2929// class G4GDMLReadSetup Implementation
     
    7979      const xercesc::DOMAttr* const attribute
    8080            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     81      if (!attribute)
     82      {
     83        G4Exception("G4GDMLReadSetup::SetupRead()",
     84                    "InvalidRead", FatalException, "No attribute found!");
     85        return;
     86      }
    8187      const G4String attName  = Transcode(attribute->getName());
    8288      const G4String attValue = Transcode(attribute->getValue());
     
    9298      const xercesc::DOMElement* const child
    9399            = dynamic_cast<xercesc::DOMElement*>(iter);
     100      if (!child)
     101      {
     102        G4Exception("G4GDMLReadSetup::SetupRead()",
     103                    "InvalidRead", FatalException, "No child found!");
     104        return;
     105      }
    94106      const G4String tag = Transcode(child->getTagName());
    95107
  • trunk/source/persistency/gdml/src/G4GDMLReadSolids.cc

    r1337 r1347  
    2424// ********************************************************************
    2525//
    26 // $Id: G4GDMLReadSolids.cc,v 1.31 2010/06/03 14:19:49 gcosmo Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: G4GDMLReadSolids.cc,v 1.32 2010/10/14 16:19:40 gcosmo Exp $
     27// GEANT4 tag $Name: gdml-V09-03-09 $
    2828//
    2929// class G4GDMLReadSolids Implementation
     
    102102      const xercesc::DOMAttr* const attribute
    103103            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     104      if (!attribute)
     105      {
     106        G4Exception("G4GDMLReadSolids::BooleanRead()",
     107                    "InvalidRead", FatalException, "No attribute found!");
     108        return;
     109      }
    104110      const G4String attName = Transcode(attribute->getName());
    105111      const G4String attValue = Transcode(attribute->getValue());
     
    115121      const xercesc::DOMElement* const child
    116122            = dynamic_cast<xercesc::DOMElement*>(iter);
     123      if (!child)
     124      {
     125        G4Exception("G4GDMLReadSolids::BooleanRead()",
     126                    "InvalidRead", FatalException, "No child found!");
     127        return;
     128      }
    117129      const G4String tag = Transcode(child->getTagName());
    118130
     
    186198      const xercesc::DOMAttr* const attribute
    187199            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     200      if (!attribute)
     201      {
     202        G4Exception("G4GDMLReadSolids::BoxRead()",
     203                    "InvalidRead", FatalException, "No attribute found!");
     204        return;
     205      }
    188206      const G4String attName = Transcode(attribute->getName());
    189207      const G4String attValue = Transcode(attribute->getValue());
     
    231249      const xercesc::DOMAttr* const attribute
    232250            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     251      if (!attribute)
     252      {
     253        G4Exception("G4GDMLReadSolids::ConeRead()",
     254                    "InvalidRead", FatalException, "No attribute found!");
     255        return;
     256      }
    233257      const G4String attName = Transcode(attribute->getName());
    234258      const G4String attValue = Transcode(attribute->getValue());
     
    281305      const xercesc::DOMAttr* const attribute
    282306            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     307      if (!attribute)
     308      {
     309        G4Exception("G4GDMLReadSolids::ElconeRead()",
     310                    "InvalidRead", FatalException, "No attribute found!");
     311        return;
     312      }
    283313      const G4String attName = Transcode(attribute->getName());
    284314      const G4String attValue = Transcode(attribute->getValue());
     
    325355      const xercesc::DOMAttr* const attribute
    326356            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     357      if (!attribute)
     358      {
     359        G4Exception("G4GDMLReadSolids::EllipsoidRead()",
     360                    "InvalidRead", FatalException, "No attribute found!");
     361        return;
     362      }
    327363      const G4String attName = Transcode(attribute->getName());
    328364      const G4String attValue = Transcode(attribute->getValue());
     
    369405      const xercesc::DOMAttr* const attribute
    370406            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     407      if (!attribute)
     408      {
     409        G4Exception("G4GDMLReadSolids::EltubeRead()",
     410                    "InvalidRead", FatalException, "No attribute found!");
     411        return;
     412      }
    371413      const G4String attName = Transcode(attribute->getName());
    372414      const G4String attValue = Transcode(attribute->getValue());
     
    405447      const xercesc::DOMAttr* const attribute
    406448            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     449      if (!attribute)
     450      {
     451        G4Exception("G4GDMLReadSolids::XtruRead()",
     452                    "InvalidRead", FatalException, "No attribute found!");
     453        return;
     454      }
    407455      const G4String attName = Transcode(attribute->getName());
    408456      const G4String attValue = Transcode(attribute->getValue());
     
    422470      const xercesc::DOMElement* const child
    423471            = dynamic_cast<xercesc::DOMElement*>(iter);
     472      if (!child)
     473      {
     474        G4Exception("G4GDMLReadSolids::XtruRead()",
     475                    "InvalidRead", FatalException, "No child found!");
     476        return;
     477      }
    424478      const G4String tag = Transcode(child->getTagName());
    425479
     
    458512      const xercesc::DOMAttr* const attribute
    459513            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     514      if (!attribute)
     515      {
     516        G4Exception("G4GDMLReadSolids::HypeRead()",
     517                    "InvalidRead", FatalException, "No attribute found!");
     518        return;
     519      }
    460520      const G4String attName = Transcode(attribute->getName());
    461521      const G4String attValue = Transcode(attribute->getValue());
     
    500560      const xercesc::DOMAttr* const attribute
    501561            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     562      if (!attribute)
     563      {
     564        G4Exception("G4GDMLReadSolids::OrbRead()",
     565                    "InvalidRead", FatalException, "No attribute found!");
     566        return;
     567      }
    502568      const G4String attName = Transcode(attribute->getName());
    503569      const G4String attValue = Transcode(attribute->getValue());
     
    539605      const xercesc::DOMAttr* const attribute
    540606            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     607      if (!attribute)
     608      {
     609        G4Exception("G4GDMLReadSolids::ParaRead()",
     610                    "InvalidRead", FatalException, "No attribute found!");
     611        return;
     612      }
    541613      const G4String attName = Transcode(attribute->getName());
    542614      const G4String attValue = Transcode(attribute->getValue());
     
    587659      const xercesc::DOMAttr* const attribute
    588660            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     661      if (!attribute)
     662      {
     663        G4Exception("G4GDMLReadSolids::ParaboloidRead()",
     664                    "InvalidRead", FatalException, "No attribute found!");
     665        return;
     666      }
    589667      const G4String attName = Transcode(attribute->getName());
    590668      const G4String attValue = Transcode(attribute->getValue());
     
    628706      const xercesc::DOMAttr* const attribute
    629707            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     708      if (!attribute)
     709      {
     710        G4Exception("G4GDMLReadSolids::PolyconeRead()",
     711                    "InvalidRead", FatalException, "No attribute found!");
     712        return;
     713      }
    630714      const G4String attName = Transcode(attribute->getName());
    631715      const G4String attValue = Transcode(attribute->getValue());
     
    650734      const xercesc::DOMElement* const child
    651735            = dynamic_cast<xercesc::DOMElement*>(iter);
     736      if (!child)
     737      {
     738        G4Exception("G4GDMLReadSolids::PolyconeRead()",
     739                    "InvalidRead", FatalException, "No child found!");
     740        return;
     741      }
    652742      const G4String tag = Transcode(child->getTagName());
    653743
     
    696786      const xercesc::DOMAttr* const attribute
    697787            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     788      if (!attribute)
     789      {
     790        G4Exception("G4GDMLReadSolids::PolyhedraRead()",
     791                    "InvalidRead", FatalException, "No attribute found!");
     792        return;
     793      }
    698794      const G4String attName = Transcode(attribute->getName());
    699795      const G4String attValue = Transcode(attribute->getValue());
     
    719815      const xercesc::DOMElement* const child
    720816            = dynamic_cast<xercesc::DOMElement*>(iter);
     817      if (!child)
     818      {
     819        G4Exception("G4GDMLReadSolids::PolyhedraRead()",
     820                    "InvalidRead", FatalException, "No child found!");
     821        return;
     822      }
    721823      const G4String tag = Transcode(child->getTagName());
    722824
     
    765867      const xercesc::DOMAttr* const attribute
    766868            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     869      if (!attribute)
     870      {
     871        G4Exception("G4GDMLReadSolids::QuadrangularRead()",
     872                    "InvalidRead", FatalException, "No attribute found!");
     873        return 0;
     874      }
    767875      const G4String attName = Transcode(attribute->getName());
    768876      const G4String attValue = Transcode(attribute->getValue());
     
    808916      const xercesc::DOMAttr* const attribute
    809917            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     918      if (!attribute)
     919      {
     920        G4Exception("G4GDMLReadSolids::ReflectedSolidRead()",
     921                    "InvalidRead", FatalException, "No attribute found!");
     922        return;
     923      }
    810924      const G4String attName = Transcode(attribute->getName());
    811925      const G4String attValue = Transcode(attribute->getValue());
     
    856970      const xercesc::DOMAttr* const attribute
    857971            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     972      if (!attribute)
     973      {
     974        G4Exception("G4GDMLReadSolids::SectionRead()",
     975                    "InvalidRead", FatalException, "No attribute found!");
     976        return G4ExtrudedSolid::ZSection(zPosition,Offset,scalingFactor);
     977      }
    858978      const G4String attName = Transcode(attribute->getName());
    859979      const G4String attValue = Transcode(attribute->getValue());
     
    8991019      const xercesc::DOMAttr* const attribute
    9001020            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1021      if (!attribute)
     1022      {
     1023        G4Exception("G4GDMLReadSolids::SphereRead()",
     1024                    "InvalidRead", FatalException, "No attribute found!");
     1025        return;
     1026      }
    9011027      const G4String attName = Transcode(attribute->getName());
    9021028      const G4String attValue = Transcode(attribute->getValue());
     
    9421068      const xercesc::DOMAttr* const attribute
    9431069            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1070      if (!attribute)
     1071      {
     1072        G4Exception("G4GDMLReadSolids::TessellatedRead()",
     1073                    "InvalidRead", FatalException, "No attribute found!");
     1074        return;
     1075      }
    9441076      const G4String attName = Transcode(attribute->getName());
    9451077      const G4String attValue = Transcode(attribute->getValue());
     
    9571089      const xercesc::DOMElement* const child
    9581090            = dynamic_cast<xercesc::DOMElement*>(iter);
     1091      if (!child)
     1092      {
     1093        G4Exception("G4GDMLReadSolids::TessellatedRead()",
     1094                    "InvalidRead", FatalException, "No child found!");
     1095        return;
     1096      }
    9591097      const G4String tag = Transcode(child->getTagName());
    9601098
     
    9901128      const xercesc::DOMAttr* const attribute
    9911129            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1130      if (!attribute)
     1131      {
     1132        G4Exception("G4GDMLReadSolids::TetRead()",
     1133                    "InvalidRead", FatalException, "No attribute found!");
     1134        return;
     1135      }
    9921136      const G4String attName = Transcode(attribute->getName());
    9931137      const G4String attValue = Transcode(attribute->getValue());
     
    10331177      const xercesc::DOMAttr* const attribute
    10341178            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1179      if (!attribute)
     1180      {
     1181        G4Exception("G4GDMLReadSolids::TorusRead()",
     1182                    "InvalidRead", FatalException, "No attribute found!");
     1183        return;
     1184      }
    10351185      const G4String attName = Transcode(attribute->getName());
    10361186      const G4String attValue = Transcode(attribute->getValue());
     
    10791229      const xercesc::DOMAttr* const attribute
    10801230            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1231      if (!attribute)
     1232      {
     1233        G4Exception("G4GDMLReadSolids::GenTrapRead()",
     1234                    "InvalidRead", FatalException, "No attribute found!");
     1235        return;
     1236      }
    10811237      const G4String attName = Transcode(attribute->getName());
    10821238      const G4String attValue = Transcode(attribute->getValue());
     
    11471303      const xercesc::DOMAttr* const attribute
    11481304            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1305      if (!attribute)
     1306      {
     1307        G4Exception("G4GDMLReadSolids::TrapRead()",
     1308                    "InvalidRead", FatalException, "No attribute found!");
     1309        return;
     1310      }
    11491311      const G4String attName = Transcode(attribute->getName());
    11501312      const G4String attValue = Transcode(attribute->getValue());
     
    12051367      const xercesc::DOMAttr* const attribute
    12061368            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1369      if (!attribute)
     1370      {
     1371        G4Exception("G4GDMLReadSolids::TrdRead()",
     1372                    "InvalidRead", FatalException, "No attribute found!");
     1373        return;
     1374      }
    12071375      const G4String attName = Transcode(attribute->getName());
    12081376      const G4String attValue = Transcode(attribute->getValue());
     
    12491417      const xercesc::DOMAttr* const attribute
    12501418            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1419      if (!attribute)
     1420      {
     1421        G4Exception("G4GDMLReadSolids::TriangularRead()",
     1422                    "InvalidRead", FatalException, "No attribute found!");
     1423        return 0;
     1424      }
    12511425      const G4String attName = Transcode(attribute->getName());
    12521426      const G4String attValue = Transcode(attribute->getValue());
     
    12901464      const xercesc::DOMAttr* const attribute
    12911465            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1466      if (!attribute)
     1467      {
     1468        G4Exception("G4GDMLReadSolids::TubeRead()",
     1469                    "InvalidRead", FatalException, "No attribute found!");
     1470        return;
     1471      }
    12921472      const G4String attName = Transcode(attribute->getName());
    12931473      const G4String attValue = Transcode(attribute->getValue());
     
    13371517      const xercesc::DOMAttr* const attribute
    13381518            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1519      if (!attribute)
     1520      {
     1521        G4Exception("G4GDMLReadSolids::TwistedboxRead()",
     1522                    "InvalidRead", FatalException, "No attribute found!");
     1523        return;
     1524      }
    13391525      const G4String attName = Transcode(attribute->getName());
    13401526      const G4String attValue = Transcode(attribute->getValue());
     
    13891575      const xercesc::DOMAttr* const attribute
    13901576            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1577      if (!attribute)
     1578      {
     1579        G4Exception("G4GDMLReadSolids::TwistedtrapRead()",
     1580                    "InvalidRead", FatalException, "No attribute found!");
     1581        return;
     1582      }
    13911583      const G4String attName = Transcode(attribute->getName());
    13921584      const G4String attValue = Transcode(attribute->getValue());
     
    14511643      const xercesc::DOMAttr* const attribute
    14521644            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1645      if (!attribute)
     1646      {
     1647        G4Exception("G4GDMLReadSolids::TwistedtrdRead()",
     1648                    "InvalidRead", FatalException, "No attribute found!");
     1649        return;
     1650      }
    14531651      const G4String attName = Transcode(attribute->getName());
    14541652      const G4String attValue = Transcode(attribute->getValue());
     
    15011699      const xercesc::DOMAttr* const attribute
    15021700            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1701      if (!attribute)
     1702      {
     1703        G4Exception("G4GDMLReadSolids::TwistedtubsRead()",
     1704                    "InvalidRead", FatalException, "No attribute found!");
     1705        return;
     1706      }
    15031707      const G4String attName = Transcode(attribute->getName());
    15041708      const G4String attValue = Transcode(attribute->getValue());
     
    15411745      const xercesc::DOMAttr* const attribute
    15421746            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1747      if (!attribute)
     1748      {
     1749        G4Exception("G4GDMLReadSolids::TwoDimVertexRead()",
     1750                    "InvalidRead", FatalException, "No attribute found!");
     1751        return vec;
     1752      }
    15431753      const G4String attName = Transcode(attribute->getName());
    15441754      const G4String attValue = Transcode(attribute->getValue());
     
    15541764ZplaneRead(const xercesc::DOMElement* const zplaneElement)
    15551765{
    1556    zplaneType zplane;
     1766   zplaneType zplane = {0.,0.,0.};
    15571767
    15581768   const xercesc::DOMNamedNodeMap* const attributes
     
    15691779      const xercesc::DOMAttr* const attribute
    15701780            = dynamic_cast<xercesc::DOMAttr*>(node);   
     1781      if (!attribute)
     1782      {
     1783        G4Exception("G4GDMLReadSolids::ZplaneRead()",
     1784                    "InvalidRead", FatalException, "No attribute found!");
     1785        return zplane;
     1786      }
    15711787      const G4String attName = Transcode(attribute->getName());
    15721788      const G4String attValue = Transcode(attribute->getValue());
     
    16031819      const xercesc::DOMAttr* const attribute
    16041820            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     1821      if (!attribute)
     1822      {
     1823        G4Exception("G4GDMLReadSolids::OpticalSurfaceRead()",
     1824                    "InvalidRead", FatalException, "No attribute found!");
     1825        return;
     1826      }
    16051827      const G4String attName = Transcode(attribute->getName());
    16061828      const G4String attValue = Transcode(attribute->getValue());
     
    17051927      const xercesc::DOMElement* const child
    17061928            = dynamic_cast<xercesc::DOMElement*>(iter);
     1929      if (!child)
     1930      {
     1931        G4Exception("G4GDMLReadSolids::SolidsRead()",
     1932                    "InvalidRead", FatalException, "No child found!");
     1933        return;
     1934      }
    17071935      const G4String tag = Transcode(child->getTagName());
    17081936      if (tag=="define") { DefineRead(child);  }  else
  • trunk/source/persistency/gdml/src/G4GDMLReadStructure.cc

    r1337 r1347  
    2424// ********************************************************************
    2525//
    26 // $Id: G4GDMLReadStructure.cc,v 1.62 2009/09/24 15:04:34 gcosmo Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: G4GDMLReadStructure.cc,v 1.67 2010/11/02 10:39:27 gcosmo Exp $
     27// GEANT4 tag $Name: gdml-V09-03-09 $
    2828//
    2929// class G4GDMLReadStructure Implementation
     
    4747#include "G4VisAttributes.hh"
    4848
    49 G4GDMLReadStructure::G4GDMLReadStructure() : G4GDMLReadParamvol()
     49G4GDMLReadStructure::G4GDMLReadStructure()
     50  : G4GDMLReadParamvol(), pMotherLogical(0)
    5051{
    5152}
     
    5859AuxiliaryRead(const xercesc::DOMElement* const auxiliaryElement)
    5960{
    60    G4GDMLAuxPairType auxpair;
     61   G4GDMLAuxPairType auxpair = {"",""};
    6162
    6263   const xercesc::DOMNamedNodeMap* const attributes
     
    7475      const xercesc::DOMAttr* const attribute
    7576            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     77      if (!attribute)
     78      {
     79        G4Exception("G4GDMLReadStructure::AuxiliaryRead()",
     80                    "InvalidRead", FatalException, "No attribute found!");
     81        return auxpair;
     82      }
    7683      const G4String attName = Transcode(attribute->getName());
    7784      const G4String attValue = Transcode(attribute->getValue());
    7885
    7986      if (attName=="auxtype") { auxpair.type = attValue; } else
    80       if (attName=="auxvalue") { auxpair.value = eval.Evaluate(attValue); }
     87        //      if (attName=="auxvalue") { auxpair.value = eval.Evaluate(attValue); }
     88      if (attName=="auxvalue") { auxpair.value = attValue; }
    8189   }
    8290
     
    107115      const xercesc::DOMAttr* const attribute
    108116            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     117      if (!attribute)
     118      {
     119        G4Exception("G4GDMLReadStructure::BorderSurfaceRead()",
     120                    "InvalidRead", FatalException, "No attribute found!");
     121        return;
     122      }
    109123      const G4String attName = Transcode(attribute->getName());
    110124      const G4String attValue = Transcode(attribute->getValue());
     
    123137      const xercesc::DOMElement* const child
    124138            = dynamic_cast<xercesc::DOMElement*>(iter);
     139      if (!child)
     140      {
     141        G4Exception("G4GDMLReadStructure::BorderSurfaceRead()",
     142                    "InvalidRead", FatalException, "No child found!");
     143        return;
     144      }
    125145      const G4String tag = Transcode(child->getTagName());
    126146
     
    162182      const xercesc::DOMAttr* const attribute
    163183            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     184      if (!attribute)
     185      {
     186        G4Exception("G4GDMLReadStructure::DivisionvolRead()",
     187                    "InvalidRead", FatalException, "No attribute found!");
     188        return;
     189      }
    164190      const G4String attName = Transcode(attribute->getName());
    165191      const G4String attValue = Transcode(attribute->getValue());
     
    190216      const xercesc::DOMElement* const child
    191217            = dynamic_cast<xercesc::DOMElement*>(iter);
     218      if (!child)
     219      {
     220        G4Exception("G4GDMLReadStructure::DivisionvolRead()",
     221                    "InvalidRead", FatalException, "No child found!");
     222        return;
     223      }
    192224      const G4String tag = Transcode(child->getTagName());
    193225
    194226      if (tag=="volumeref") { logvol = GetVolume(GenerateName(RefRead(child))); }
    195227   }
     228
     229   if (!logvol)  { return; }
    196230
    197231   G4PVDivisionFactory::GetInstance();
     
    239273      const xercesc::DOMAttr* const attribute
    240274            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     275      if (!attribute)
     276      {
     277        G4Exception("G4GDMLReadStructure::FileRead()",
     278                    "InvalidRead", FatalException, "No attribute found!");
     279        return 0;
     280      }
    241281      const G4String attName = Transcode(attribute->getName());
    242282      const G4String attValue = Transcode(attribute->getValue());
     
    299339     const xercesc::DOMAttr* const attribute
    300340           = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     341     if (!attribute)
     342     {
     343       G4Exception("G4GDMLReadStructure::PhysvolRead()",
     344                   "InvalidRead", FatalException, "No attribute found!");
     345       return;
     346     }
    301347     const G4String attName = Transcode(attribute->getName());
    302348     const G4String attValue = Transcode(attribute->getValue());
     
    312358     const xercesc::DOMElement* const child
    313359           = dynamic_cast<xercesc::DOMElement*>(iter);
     360     if (!child)
     361     {
     362       G4Exception("G4GDMLReadStructure::PhysvolRead()",
     363                   "InvalidRead", FatalException, "No child found!");
     364       return;
     365     }
    314366     const G4String tag = Transcode(child->getTagName());
    315367
     
    339391          G4Exception("G4GDMLReadStructure::PhysvolRead()", "ReadError",
    340392                      FatalException, error_msg);
     393          return;
    341394        }
    342395   }
     
    347400   if (pAssembly)   // Fill assembly structure
    348401   {
     402     if (!logvol) { return; }
    349403     pAssembly->AddPlacedVolume(logvol, transform);
    350404   }
     
    357411     else
    358412     {
     413       if (!logvol) { return; }
    359414       G4String pv_name = logvol->GetName() + "_PV";
    360415       G4PhysicalVolumesPair pair = G4ReflectionFactory::Instance()
     
    378433    const xercesc::DOMElement* const child
    379434          = dynamic_cast<xercesc::DOMElement*>(iter);
     435    if (!child)
     436    {
     437      G4Exception("G4GDMLReadStructure::ReplicavolRead()",
     438                  "InvalidRead", FatalException, "No child found!");
     439      return;
     440    }
    380441    const G4String tag = Transcode(child->getTagName());
    381442
     
    386447    else if (tag=="replicate_along_axis")
    387448    {
    388       ReplicaRead(child,logvol,number);
     449      if (logvol)  { ReplicaRead(child,logvol,number); }
    389450    }
    390451    else
     
    415476      const xercesc::DOMElement* const child
    416477            = dynamic_cast<xercesc::DOMElement*>(iter);
     478      if (!child)
     479      {
     480        G4Exception("G4GDMLReadStructure::ReplicaRead()",
     481                    "InvalidRead", FatalException, "No child found!");
     482        return;
     483      }
    417484      const G4String tag = Transcode(child->getTagName());
    418485
     
    451518AxisRead(const xercesc::DOMElement* const axisElement)
    452519{
    453    
    454520   EAxis axis = kUndefined;
    455521
     
    468534      const xercesc::DOMAttr* const attribute
    469535            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     536      if (!attribute)
     537      {
     538        G4Exception("G4GDMLReadStructure::AxisRead()",
     539                    "InvalidRead", FatalException, "No attribute found!");
     540        return axis;
     541      }
    470542      const G4String attName = Transcode(attribute->getName());
    471543      const G4String attValue = Transcode(attribute->getValue());
     
    503575      const xercesc::DOMAttr* const attribute
    504576            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     577      if (!attribute)
     578      {
     579        G4Exception("G4GDMLReadStructure::QuantityRead()",
     580                    "InvalidRead", FatalException, "No attribute found!");
     581        return value;
     582      }
    505583      const G4String attName = Transcode(attribute->getName());
    506584      const G4String attValue = Transcode(attribute->getValue());
     
    531609      const xercesc::DOMElement* const child
    532610            = dynamic_cast<xercesc::DOMElement*>(iter);
     611      if (!child)
     612      {
     613        G4Exception("G4GDMLReadStructure::VolumeRead()",
     614                    "InvalidRead", FatalException, "No child found!");
     615        return;
     616      }
    533617      const G4String tag = Transcode(child->getTagName());
    534618
     
    565649      const xercesc::DOMElement* const child
    566650            = dynamic_cast<xercesc::DOMElement*>(iter);
     651      if (!child)
     652      {
     653        G4Exception("G4GDMLReadStructure::AssemblyRead()",
     654                    "InvalidRead", FatalException, "No child found!");
     655        return;
     656      }
    567657      const G4String tag = Transcode(child->getTagName());
    568658
     
    600690      const xercesc::DOMAttr* const attribute
    601691            = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     692      if (!attribute)
     693      {
     694        G4Exception("G4GDMLReadStructure::SkinsurfaceRead()",
     695                    "InvalidRead", FatalException, "No attribute found!");
     696        return;
     697      }
    602698      const G4String attName = Transcode(attribute->getName());
    603699      const G4String attValue = Transcode(attribute->getValue());
     
    616712      const xercesc::DOMElement* const child
    617713            = dynamic_cast<xercesc::DOMElement*>(iter);
     714      if (!child)
     715      {
     716        G4Exception("G4GDMLReadStructure::SkinsurfaceRead()",
     717                    "InvalidRead", FatalException, "No child found!");
     718        return;
     719      }
    618720      const G4String tag = Transcode(child->getTagName());
    619721
     
    643745      const xercesc::DOMElement* const child
    644746            = dynamic_cast<xercesc::DOMElement*>(iter);
     747      if (!child)
     748      {
     749        G4Exception("G4GDMLReadStructure::Volume_contentRead()",
     750                    "InvalidRead", FatalException, "No child found!");
     751        return;
     752      }
    645753      const G4String tag = Transcode(child->getTagName());
    646754
     
    674782          const xercesc::DOMAttr* const attribute
    675783                = dynamic_cast<xercesc::DOMAttr*>(attribute_node);   
     784          if (!attribute)
     785          {
     786            G4Exception("G4GDMLReadStructure::Volume_contentRead()",
     787                        "InvalidRead", FatalException, "No attribute found!");
     788            return;
     789          }
    676790          const G4String attName = Transcode(attribute->getName());
    677791          const G4String attValue = Transcode(attribute->getValue());
     
    711825      const xercesc::DOMElement* const child
    712826            = dynamic_cast<xercesc::DOMElement*>(iter);
     827      if (!child)
     828      {
     829        G4Exception("G4GDMLReadStructure::StructureRead()",
     830                    "InvalidRead", FatalException, "No child found!");
     831        return;
     832      }
    713833      const G4String tag = Transcode(child->getTagName());
    714834
     
    768888
    769889G4GDMLAuxListType G4GDMLReadStructure::
    770 GetVolumeAuxiliaryInformation(const G4LogicalVolume* const logvol)
     890GetVolumeAuxiliaryInformation(G4LogicalVolume* logvol) const
    771891{
    772892   G4GDMLAuxMapType::const_iterator pos = auxMap.find(logvol);
     
    786906   G4LogicalVolume* volume = GetVolume(Strip(GetSetup(setupName)));
    787907   volume->SetVisAttributes(G4VisAttributes::Invisible);
    788    G4VPhysicalVolume* pvWorld =
    789      new G4PVPlacement(0,G4ThreeVector(0,0,0),volume,setupName,0,0,0);
     908
     909   G4VPhysicalVolume* pvWorld = 0;
     910
     911   if(setuptoPV[setupName])
     912   {
     913     pvWorld = setuptoPV[setupName];
     914   }
     915   else
     916   {
     917     pvWorld = new G4PVPlacement(0,G4ThreeVector(0,0,0),volume,
     918                                 volume->GetName()+"_PV",0,0,0);
     919     setuptoPV[setupName] = pvWorld;
     920   }
    790921   return pvWorld;
    791922}
     923
     924void G4GDMLReadStructure::Clear()
     925{
     926  eval.Clear();
     927  setuptoPV.clear();
     928}
  • trunk/source/persistency/gdml/src/G4GDMLWrite.cc

    r1337 r1347  
    2525//
    2626//
    27 // $Id: G4GDMLWrite.cc,v 1.55 2009/04/24 15:34:20 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4GDMLWrite.cc,v 1.58 2010/11/02 10:55:03 gcosmo Exp $
     28// GEANT4 tag $Name: gdml-V09-03-09 $
    2929//
    3030// class G4GDMLWrite Implementation
     
    4545G4bool G4GDMLWrite::addPointerToName = true;
    4646
    47 G4GDMLWrite::G4GDMLWrite() : extElement(0)
     47G4GDMLWrite::G4GDMLWrite() : doc(0), extElement(0)
    4848{
    4949}
     
    155155
    156156   xercesc::XMLString::transcode("LS", tempStr, 99);
     157     xercesc::DOMImplementationRegistry::getDOMImplementation(tempStr);
     158   xercesc::XMLString::transcode("Range", tempStr, 99);
    157159   xercesc::DOMImplementation* impl =
    158160     xercesc::DOMImplementationRegistry::getDOMImplementation(tempStr);
    159    xercesc::XMLString::transcode("Range", tempStr, 99);
    160    impl = xercesc::DOMImplementationRegistry::getDOMImplementation(tempStr);
    161161   xercesc::XMLString::transcode("gdml", tempStr, 99);
    162162   doc = impl->createDocument(0,tempStr,0);
     
    255255     G4Exception("G4GDMLWrite::AddModule()", "InvalidSetup", FatalException,
    256256                 "Invalid NULL pointer is specified for modularization!");
     257     return;
    257258   }
    258259   if (dynamic_cast<const G4PVDivision*>(physvol))
     
    260261     G4Exception("G4GDMLWrite::AddModule()", "InvalidSetup", FatalException,
    261262                 "It is not possible to modularize by divisionvol!");
     263     return;
    262264   }
    263265   if (physvol->IsParameterised())
     
    265267     G4Exception("G4GDMLWrite::AddModule()", "InvalidSetup", FatalException,
    266268                 "It is not possible to modularize by parameterised volume!");
     269     return;
    267270   }
    268271   if (physvol->IsReplicated())
     
    270273     G4Exception("G4GDMLWrite::AddModule()", "InvalidSetup", FatalException,
    271274                 "It is not possible to modularize by replicated volume!");
     275     return;
    272276   }
    273277
  • trunk/source/persistency/gdml/src/G4GDMLWriteDefine.cc

    r1337 r1347  
    2525//
    2626//
    27 // $Id: G4GDMLWriteDefine.cc,v 1.19 2009/03/24 15:47:33 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4GDMLWriteDefine.cc,v 1.20 2010/10/14 16:19:40 gcosmo Exp $
     28// GEANT4 tag $Name: gdml-V09-03-09 $
    2929//
    3030// class G4GDMLWriteDefine Implementation
     
    4040const G4double G4GDMLWriteDefine::kLinearPrecision = DBL_EPSILON;
    4141
    42 G4GDMLWriteDefine::G4GDMLWriteDefine() : G4GDMLWrite()
     42G4GDMLWriteDefine::G4GDMLWriteDefine()
     43  : G4GDMLWrite(), defineElement(0)
    4344{
    4445}
  • trunk/source/persistency/gdml/src/G4GDMLWriteMaterials.cc

    r1337 r1347  
    2525//
    2626//
    27 // $Id: G4GDMLWriteMaterials.cc,v 1.25 2010/02/18 17:38:24 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4GDMLWriteMaterials.cc,v 1.26 2010/10/14 16:19:40 gcosmo Exp $
     28// GEANT4 tag $Name: gdml-V09-03-09 $
    2929//
    3030// class G4GDMLWriteMaterials Implementation
     
    4141#include "G4Material.hh"
    4242
    43 G4GDMLWriteMaterials::
    44 G4GDMLWriteMaterials() : G4GDMLWriteDefine()
    45 {
    46 }
    47 
    48 G4GDMLWriteMaterials::
    49 ~G4GDMLWriteMaterials()
     43G4GDMLWriteMaterials::G4GDMLWriteMaterials()
     44  : G4GDMLWriteDefine(), materialsElement(0)
     45{
     46}
     47
     48G4GDMLWriteMaterials::~G4GDMLWriteMaterials()
    5049{
    5150}
  • trunk/source/persistency/gdml/src/G4GDMLWriteSolids.cc

    r1337 r1347  
    2525//
    2626//
    27 // $Id: G4GDMLWriteSolids.cc,v 1.68 2010/06/03 14:19:49 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4GDMLWriteSolids.cc,v 1.69 2010/10/14 16:19:40 gcosmo Exp $
     28// GEANT4 tag $Name: gdml-V09-03-09 $
    2929//
    3030// class G4GDMLWriteSolids Implementation
     
    6868#include "G4SurfaceProperty.hh"
    6969
    70 G4GDMLWriteSolids::
    71 G4GDMLWriteSolids() : G4GDMLWriteMaterials()
    72 {
    73 }
    74 
    75 G4GDMLWriteSolids::
    76 ~G4GDMLWriteSolids()
     70G4GDMLWriteSolids::G4GDMLWriteSolids()
     71  : G4GDMLWriteMaterials(), solidsElement(0)
     72{
     73}
     74
     75G4GDMLWriteSolids::~G4GDMLWriteSolids()
    7776{
    7877}
  • trunk/source/persistency/gdml/src/G4GDMLWriteStructure.cc

    r1337 r1347  
    2525//
    2626//
    27 // $Id: G4GDMLWriteStructure.cc,v 1.81 2010/05/20 12:56:57 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4GDMLWriteStructure.cc,v 1.83 2010/10/14 16:19:40 gcosmo Exp $
     28// GEANT4 tag $Name: gdml-V09-03-09 $
    2929//
    3030// class G4GDMLWriteStructure Implementation
     
    7575   else if (axis==kZAxis) { axisString = "kZAxis"; }
    7676   else if (axis==kRho)   { axisString = "kRho";     }
    77    else if (axis==kPhi)   { axisString = "kPhi"; unitString = "degree"; }
     77   else if (axis==kPhi)   { axisString = "kPhi"; unitString = "rad"; }
    7878
    7979   const G4String name
     
    188188     { dirElement->setAttributeNode(NewAttribute("rho","1")); }
    189189   else if(axis==kPhi)
    190      { dirElement->setAttributeNode(NewAttribute("phi","1")); }
     190     { dirElement->setAttributeNode(NewAttribute("phi","1"));
     191       unitString="rad"; }
    191192   replicateElement->appendChild(dirElement);
    192193
     
    231232   if (FindOpticalSurface(psurf))
    232233   {
    233      OpticalSurfaceWrite(solidsElement,
    234                          dynamic_cast<const G4OpticalSurface*>(psurf));
     234     const G4OpticalSurface* opsurf =
     235       dynamic_cast<const G4OpticalSurface*>(psurf);
     236     if (!opsurf)
     237     {
     238       G4Exception("G4GDMLWriteStructure::BorderSurfaceCache()",
     239                   "InvalidSetup", FatalException, "No optical surface found!");
     240       return;
     241     }
     242     OpticalSurfaceWrite(solidsElement, opsurf);
    235243   }
    236244
     
    260268   if (FindOpticalSurface(psurf))
    261269   {
    262      OpticalSurfaceWrite(solidsElement,
    263                          dynamic_cast<const G4OpticalSurface*>(psurf));
     270     const G4OpticalSurface* opsurf =
     271       dynamic_cast<const G4OpticalSurface*>(psurf);
     272     if (!opsurf)
     273     {
     274       G4Exception("G4GDMLWriteStructure::SkinSurfaceCache()",
     275                   "InvalidSetup", FatalException, "No optical surface found!");
     276       return;
     277     }
     278     OpticalSurfaceWrite(solidsElement, opsurf);
    264279   }
    265280
  • trunk/source/persistency/gdml/src/G4STRead.cc

    r1337 r1347  
    2424// ********************************************************************
    2525//
    26 // $Id: G4STRead.cc,v 1.4 2009/04/24 15:34:20 gcosmo Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: G4STRead.cc,v 1.6 2010/11/02 10:39:27 gcosmo Exp $
     27// GEANT4 tag $Name: gdml-V09-03-09 $
    2828//
    2929// class G4STRead Implementation
     
    123123   stream >> level >> name >> r1 >> r2 >> r3 >> n1 >> r4 >> r5 >> r6
    124124          >> n2 >> r7 >> r8 >> r9 >> n3 >> pX >> pY >> pZ >> n4 >> n5;
    125 
    126    name.resize(name.rfind("_"));
     125   std::string::size_type idx = name.rfind("_");
     126   if (idx!=std::string::npos)
     127   {
     128     name.resize(idx);
     129   }
     130   else
     131   {
     132     G4Exception("G4STRead::PhysvolRead()", "ReadError",
     133                 FatalException, "Invalid input stream!");
     134     return;
     135   }
    127136
    128137   G4cout << "G4STRead: Placing tessellated solid: " << name << G4endl;
Note: See TracChangeset for help on using the changeset viewer.