Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
comparator Struct Reference

#include <G4MolecularConfiguration.hh>

Public Member Functions

bool operator() (const G4ElectronOccupancy &occ1, const G4ElectronOccupancy &occ2) const
 

Detailed Description

Definition at line 202 of file G4MolecularConfiguration.hh.

Member Function Documentation

bool comparator::operator() ( const G4ElectronOccupancy occ1,
const G4ElectronOccupancy occ2 
) const
inline

Definition at line 204 of file G4MolecularConfiguration.hh.

References G4ElectronOccupancy::GetOccupancy(), G4ElectronOccupancy::GetSizeOfOrbit(), and G4ElectronOccupancy::GetTotalOccupancy().

205  {
206  // Since this method is called a lot of time,
207  // we retrieve only once the totOcc
208  G4int totalOcc1 = occ1.GetTotalOccupancy() ;
209  G4int totalOcc2 = occ2.GetTotalOccupancy() ;
210  if ( totalOcc1!= totalOcc2)
211  {
212  return totalOcc1<totalOcc2;
213  }
214  else
215  {
216  G4int occupancy1 = -1 ;
217  G4int occupancy2 = -1 ;
218  const G4int sizeOrbit = occ1.GetSizeOfOrbit() ;
219  for (G4int i=0; i<occ1.GetSizeOfOrbit();)
220  {
221  // Since this method is called a lot of time,
222  // we retrieve only once the Occ
223 
224  occupancy1 = occ1.GetOccupancy(i);
225  occupancy2 = occ2.GetOccupancy(i);
226 
227  if (occupancy1 != occupancy2)
228  {
229  return occupancy1 < occupancy2;
230  }
231  else
232  {
233  i++;
234  if (i >= sizeOrbit) return false;
235  }
236  }
237  }
238  return false;
239  }
G4int GetTotalOccupancy() const
G4int GetSizeOfOrbit() const
int G4int
Definition: G4Types.hh:78
G4int GetOccupancy(G4int orbit) const

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