Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleHPHash Class Reference

#include <G4ParticleHPHash.hh>

Public Member Functions

 G4ParticleHPHash ()
 
 ~G4ParticleHPHash ()
 
 G4ParticleHPHash (const G4ParticleHPHash &aHash)
 
G4ParticleHPHashoperator= (const G4ParticleHPHash &aHash)
 
void Clear ()
 
G4bool Prepared () const
 
void SetData (G4int index, G4double x, G4double y)
 
G4int GetMinIndex (G4double e) const
 

Detailed Description

Definition at line 37 of file G4ParticleHPHash.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPHash() [1/2]

G4ParticleHPHash::G4ParticleHPHash ( )
inline

Definition at line 40 of file G4ParticleHPHash.hh.

41 {
42 theUpper = nullptr;
43 prepared = false;
44 }

Referenced by G4ParticleHPHash(), operator=(), and SetData().

◆ ~G4ParticleHPHash()

G4ParticleHPHash::~G4ParticleHPHash ( )
inline

Definition at line 46 of file G4ParticleHPHash.hh.

46{ delete theUpper; }

◆ G4ParticleHPHash() [2/2]

G4ParticleHPHash::G4ParticleHPHash ( const G4ParticleHPHash & aHash)
inline

Definition at line 48 of file G4ParticleHPHash.hh.

49 {
50 theIndex = aHash.theIndex;
51 theData = aHash.theData;
52 prepared = aHash.prepared;
53 if (aHash.theUpper != nullptr) {
54 theUpper = new G4ParticleHPHash(*(aHash.theUpper));
55 }
56 else {
57 theUpper = nullptr;
58 }
59 }

Member Function Documentation

◆ Clear()

void G4ParticleHPHash::Clear ( )
inline

Definition at line 76 of file G4ParticleHPHash.hh.

77 {
78 if (theUpper != nullptr) {
79 theUpper->Clear();
80 delete theUpper;
81 theUpper = nullptr;
82 }
83 theIndex.clear();
84 theData.clear();
85 prepared = false;
86 }

Referenced by G4ParticleHPVector::CleanUp(), Clear(), G4ParticleHPVector::ReHash(), and G4ParticleHPVector::~G4ParticleHPVector().

◆ GetMinIndex()

G4int G4ParticleHPHash::GetMinIndex ( G4double e) const
inline

Definition at line 102 of file G4ParticleHPHash.hh.

103 {
104 G4int result = -1;
105 if (theData.empty()) return 0;
106 if (theData[0].GetX() > e) return 0;
107
108 G4int lower = 0;
109 if (theUpper != nullptr) {
110 lower = theUpper->GetMinIndex(e);
111 }
112 unsigned int i;
113 for (i = lower; i < theData.size(); i++) {
114 if (theData[i].GetX() > e) {
115 result = theIndex[i - 1];
116 break;
117 }
118 }
119 if (result == -1) result = theIndex[theIndex.size() - 1];
120 return result;
121 }
int G4int
Definition G4Types.hh:85
G4int GetMinIndex(G4double e) const

Referenced by G4ParticleHPVector::GetMaxY(), GetMinIndex(), and G4ParticleHPVector::GetXsec().

◆ operator=()

G4ParticleHPHash & G4ParticleHPHash::operator= ( const G4ParticleHPHash & aHash)
inline

Definition at line 61 of file G4ParticleHPHash.hh.

62 {
63 if (&aHash != this) {
64 theIndex = aHash.theIndex;
65 theData = aHash.theData;
66 if (aHash.theUpper != nullptr) {
67 theUpper = new G4ParticleHPHash(*(aHash.theUpper));
68 }
69 else {
70 theUpper = nullptr;
71 }
72 }
73 return *this;
74 }

◆ Prepared()

G4bool G4ParticleHPHash::Prepared ( ) const
inline

◆ SetData()

void G4ParticleHPHash::SetData ( G4int index,
G4double x,
G4double y )
inline

Definition at line 89 of file G4ParticleHPHash.hh.

90 {
91 prepared = true;
93 aPoint.SetData(x, y);
94 theData.push_back(aPoint);
95 theIndex.push_back(index);
96 if (0 == theData.size() % 10 && !theData.empty()) {
97 if (nullptr == theUpper) theUpper = new G4ParticleHPHash();
98 theUpper->SetData(static_cast<G4int>(theData.size()) - 1, x, y);
99 }
100 }
void SetData(G4double e, G4double x)
void SetData(G4int index, G4double x, G4double y)

Referenced by G4ParticleHPVector::Hash(), G4ParticleHPVector::Init(), and SetData().


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