Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
CompareMaterial Struct Reference

#include <G4DNAMolecularMaterial.hh>

Public Member Functions

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

Detailed Description

Definition at line 39 of file G4DNAMolecularMaterial.hh.

Member Function Documentation

◆ operator()()

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

Definition at line 36 of file G4DNAMolecularMaterial.cc.

37{
38 if(mat1==0 && mat2==0) return false; //(mat1 == mat2)
39 if(mat1==0) return true; // mat1 < mat2
40 if(mat2==0) return false; //mat2 < mat1
41
42 const G4Material* baseMat1 = mat1->GetBaseMaterial();
43 const G4Material* baseMat2 = mat2->GetBaseMaterial();
44
45 if((baseMat1 || baseMat2) == 0) // None of the materials derives from a base material
46 {
47 return mat1 < mat2;
48 }
49 else if(baseMat1 && baseMat2) // Both materials derive from a base material
50 {
51 return baseMat1 < baseMat2;
52 }
53
54 else if(baseMat1 && (baseMat2 == 0)) // Only the material 1 derives from a base material
55 {
56 return baseMat1 < mat2;
57 }
58 // only case baseMat1==0 && baseMat2 remains
59 return mat1 < baseMat2;
60}
const G4Material * GetBaseMaterial() const
Definition: G4Material.hh:232

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