Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CompareMaterial Struct Reference

#include <G4DNAMolecularMaterial.hh>

Public Member Functions

bool operator() (const G4Material *mat1, const G4Material *mat2) const
 

Detailed Description

Definition at line 57 of file G4DNAMolecularMaterial.hh.

Member Function Documentation

bool CompareMaterial::operator() ( const G4Material mat1,
const G4Material mat2 
) const

Definition at line 46 of file G4DNAMolecularMaterial.cc.

48 {
49  if (mat1 == 0 && mat2 == 0) return false; //(mat1 == mat2)
50  if (mat1 == 0) return true; // mat1 < mat2
51  if (mat2 == 0) return false; //mat2 < mat1
52 
53  const G4Material* baseMat1 = mat1->GetBaseMaterial();
54  const G4Material* baseMat2 = mat2->GetBaseMaterial();
55 
56  if ((baseMat1 || baseMat2) == 0){
57  // None of the materials derives from a base material
58  return mat1 < mat2;
59  }
60  else if (baseMat1 && baseMat2){
61  // Both materials derive from a base material
62  return baseMat1 < baseMat2;
63  }
64 
65  else if (baseMat1 && (baseMat2 == 0)){
66  // Only the material 1 derives from a base material
67  return baseMat1 < mat2;
68  }
69  // only case baseMat1==0 && baseMat2 remains
70  return mat1 < baseMat2;
71 }
const G4Material * GetBaseMaterial() const
Definition: G4Material.hh:233

Here is the call graph for this function:


The documentation for this struct was generated from the following files: