Ow to replace calls to G4MaterialPropertiesTable::GetPropertiesMap and GetPropertiesCMap in version 11.0

Hi.
I am trying to get some optical physics code (not mine) that worked successfully under geant4 10.2.p02 working under Geant4 11.0.2. I am getting errors related to changes that Geant4 developers made to the G4MaterialPropertiesTable class between version 10.7 and 11.0. Specifically, I get compilation errors for the methods G4MaterialPropertiesTable::GetPropertiesCMap and G4MaterialPropertiesTable::GetPropertiesMap saying that they do not exist.

When I checked the Geant4 source code in version 10.7.3, there are warning messages:

“GetPropertiesMap will be obsolete from the next release Use G4MaterialPropertiesTable::GetPropertyMap() instead”
"GetPropertiesCMap will be obsolete from the next release Use G4MaterialPropertiesTable::GetConstPropertyMap() instead

However, there are no methods named GetPropertyMap() or GetConstPropertyMap() in version 11.0.

Would the developers have any suggestions on what I should do?
Thanks.

You can use the methods below. The values are now stored in vectors, rather than maps, so they can be accessed faster in run-time. You’ll need to get the vectors of material property names and values with two calls.

  const std::vector<G4String>& GetMaterialPropertyNames() const
  {
    return fMatPropNames;
  }
  const std::vector<G4String>& GetMaterialConstPropertyNames() const
  {
    return fMatConstPropNames;
  }
  const std::vector<G4MaterialPropertyVector*>& GetProperties() const
  {
    return fMP;
  }
  const std::vector<std::pair<G4double, G4bool>>& GetConstProperties()
    const
  {
    return fMCP;
  }
  // return references to the vectors of material (constant) properties.

and note that GetConstProperties() returns a vector of pairs:

  std::vector<std::pair<G4double, G4bool>> fMCP;
  // Vector of energy-independent (i.e., "constant") material properties. We
  // need to keep track if a property is defined or not: the bool in the pair
  // is 'true' if the property is defined.
  // Order of entries in MCP defined by enum in G4MaterialPropertiesIndex.

Thank you very much for your help.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.