Geant4-11
Public Member Functions | Private Member Functions | Private Attributes
GIDI_settings_group Class Reference

#include <GIDI_settings.hh>

Public Member Functions

int getGroupIndexFromEnergy (double energy, bool encloseOutOfRange) const
 
std::string getLabel () const
 
int getNumberOfGroups (void) const
 
 GIDI_settings_group (GIDI_settings_group const &group)
 
 GIDI_settings_group (std::string const &label, int length, double const *values)
 
 GIDI_settings_group (std::string const &label, std::vector< double > const &boundaries)
 
 GIDI_settings_group (std::string const &label="empty", int size=0)
 
bool isLabel (std::string &label) const
 
GIDI_settings_groupoperator= (const GIDI_settings_group &group)
 
double operator[] (int const index) const
 
double const * pointer (void) const
 
void print (bool outline=false, int valuesPerLine=10) const
 
void setFromCDoubleArray (int length, double *values)
 
int size (void) const
 
 ~GIDI_settings_group ()
 

Private Member Functions

void initialize (std::string const &label, int size, int length, double const *values)
 

Private Attributes

std::vector< double > mBoundaries
 
std::string mLabel
 

Detailed Description

Definition at line 35 of file GIDI_settings.hh.

Constructor & Destructor Documentation

◆ GIDI_settings_group() [1/4]

GIDI_settings_group::GIDI_settings_group ( std::string const &  label = "empty",
int  size = 0 
)

Definition at line 14 of file GIDI_settings_group.cc.

14 {
15
16 initialize( label, size1, size1, NULL );
17}
void initialize(std::string const &label, int size, int length, double const *values)

References initialize().

◆ GIDI_settings_group() [2/4]

GIDI_settings_group::GIDI_settings_group ( std::string const &  label,
int  length,
double const *  values 
)

Definition at line 21 of file GIDI_settings_group.cc.

21 {
22
23 initialize( label, length, length, boundaries );
24}

References initialize().

◆ GIDI_settings_group() [3/4]

GIDI_settings_group::GIDI_settings_group ( std::string const &  label,
std::vector< double > const &  boundaries 
)

Definition at line 28 of file GIDI_settings_group.cc.

28 {
29
30 int size1 = (int) boundaries.size( );
31
32 initialize( label, size1, size1, &(boundaries[0]) );
33}

References initialize().

◆ GIDI_settings_group() [4/4]

GIDI_settings_group::GIDI_settings_group ( GIDI_settings_group const &  group)

Definition at line 37 of file GIDI_settings_group.cc.

37 {
38
39 initialize( group.mLabel, group.size( ), group.size( ), &(group.mBoundaries[0]) );
40}

References initialize(), mBoundaries, mLabel, and size().

◆ ~GIDI_settings_group()

GIDI_settings_group::~GIDI_settings_group ( )

Definition at line 66 of file GIDI_settings_group.cc.

66 {
67
68}

Member Function Documentation

◆ getGroupIndexFromEnergy()

int GIDI_settings_group::getGroupIndexFromEnergy ( double  energy,
bool  encloseOutOfRange 
) const

Definition at line 72 of file GIDI_settings_group.cc.

72 {
73
74 int iMin = 0, iMid, iMax = (int) mBoundaries.size( ), iMaxM1 = iMax - 1;
75
76 if( iMax == 0 ) return( -3 );
77 if( energy < mBoundaries[0] ) {
78 if( encloseOutOfRange ) return( 0 );
79 return( -2 );
80 }
81 if( energy > mBoundaries[iMaxM1] ) {
82 if( encloseOutOfRange ) return( iMax - 2 );
83 return( -1 );
84 }
85 while( 1 ) { // Loop checking, 11.06.2015, T. Koi
86 iMid = ( iMin + iMax ) >> 1;
87 if( iMid == iMin ) break;
88 if( energy < mBoundaries[iMid] ) {
89 iMax = iMid; }
90 else {
91 iMin = iMid;
92 }
93 }
94 if( iMin == iMaxM1 ) iMin--;
95 return( iMin );
96}
std::vector< double > mBoundaries
G4double energy(const ThreeVector &p, const G4double m)

References G4INCL::KinematicsUtils::energy(), and mBoundaries.

Referenced by GIDI_settings_particle::getGroupIndexFromEnergy(), and MCGIDI_reaction_recast().

◆ getLabel()

std::string GIDI_settings_group::getLabel ( ) const
inline

Definition at line 55 of file GIDI_settings.hh.

55{ return( mLabel ); }

References mLabel.

◆ getNumberOfGroups()

int GIDI_settings_group::getNumberOfGroups ( void  ) const
inline

Definition at line 51 of file GIDI_settings.hh.

51{ return( (int) ( mBoundaries.size( ) - 1 ) ); }

References mBoundaries.

Referenced by GIDI_settings_particle::getNumberOfGroups().

◆ initialize()

void GIDI_settings_group::initialize ( std::string const &  label,
int  size,
int  length,
double const *  values 
)
private

Definition at line 44 of file GIDI_settings_group.cc.

44 {
45
46 int i1;
47
48 mLabel = label;
49 if( size1 < length ) size1 = length;
50 if( size1 < 0 ) size1 = 0;
51 mBoundaries.resize( size1, 0 );
52 for( i1 = 0; i1 < length; ++i1 ) mBoundaries[i1] = boundaries[i1];
53}

References mBoundaries, and mLabel.

Referenced by GIDI_settings_group(), and operator=().

◆ isLabel()

bool GIDI_settings_group::isLabel ( std::string &  label) const
inline

Definition at line 57 of file GIDI_settings.hh.

57{ return( label == mLabel ); }

References mLabel.

◆ operator=()

GIDI_settings_group & GIDI_settings_group::operator= ( const GIDI_settings_group group)

Definition at line 57 of file GIDI_settings_group.cc.

57 {
58 if ( this != &group ) {
59 initialize( group.mLabel, group.size(), group.size(), &(group.mBoundaries[0]) );
60 }
61 return *this;
62}
int size(void) const

References initialize(), mBoundaries, mLabel, and size().

◆ operator[]()

double GIDI_settings_group::operator[] ( int const  index) const
inline

Definition at line 49 of file GIDI_settings.hh.

49{ return( mBoundaries[index] ); }

References mBoundaries.

◆ pointer()

double const * GIDI_settings_group::pointer ( void  ) const
inline

Definition at line 52 of file GIDI_settings.hh.

52{ return( &(mBoundaries[0]) ); }

References mBoundaries.

Referenced by GIDI_settings_particle::setGroup().

◆ print()

void GIDI_settings_group::print ( bool  outline = false,
int  valuesPerLine = 10 
) const

Definition at line 100 of file GIDI_settings_group.cc.

100 {
101
102 int nbs = size( );
103 char buffer[128];
104
105 std::cout << "GROUP: label = '" << mLabel << "': length = " << nbs << std::endl;
106 if( outline ) return;
107 for( int ib = 0; ib < nbs; ib++ ) {
108 sprintf( buffer, "%16.8e", mBoundaries[ib] );
109 std::cout << buffer;
110 if( ( ( ib + 1 ) % valuesPerLine ) == 0 ) std::cout << std::endl;
111 }
112 if( nbs % valuesPerLine ) std::cout << std::endl;
113}
#define buffer
Definition: xmlparse.cc:628

References buffer, mBoundaries, mLabel, and size().

◆ setFromCDoubleArray()

void GIDI_settings_group::setFromCDoubleArray ( int  length,
double *  values 
)

◆ size()

int GIDI_settings_group::size ( void  ) const
inline

Definition at line 50 of file GIDI_settings.hh.

50{ return( (int) mBoundaries.size( ) ); }

References mBoundaries.

Referenced by GIDI_settings_group(), operator=(), print(), and GIDI_settings_particle::setGroup().

Field Documentation

◆ mBoundaries

std::vector<double> GIDI_settings_group::mBoundaries
private

◆ mLabel

std::string GIDI_settings_group::mLabel
private

Definition at line 38 of file GIDI_settings.hh.

Referenced by getLabel(), GIDI_settings_group(), initialize(), isLabel(), operator=(), and print().


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