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

#include <G4MolecularConfiguration.hh>

Public Member Functions

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

Detailed Description

Definition at line 194 of file G4MolecularConfiguration.hh.

Member Function Documentation

◆ operator()()

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

Definition at line 196 of file G4MolecularConfiguration.hh.

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

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