23 initialize( label, length, length, boundaries );
30 int size1 = (
int) boundaries.size( );
32 initialize( label, size1, size1, &(boundaries[0]) );
44 void GIDI_settings_group::initialize( std::string
const &label,
int size1,
int length,
double const *boundaries ) {
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];
65 int iMin = 0, iMid, iMax = (
int) mBoundaries.size( ), iMaxM1 = iMax - 1;
67 if( iMax == 0 )
return( -3 );
68 if( energy < mBoundaries[0] ) {
69 if( encloseOutOfRange )
return( 0 );
72 if( energy > mBoundaries[iMaxM1] ) {
73 if( encloseOutOfRange )
return( iMax - 2 );
77 iMid = ( iMin + iMax ) >> 1;
78 if( iMid == iMin )
break;
79 if( energy < mBoundaries[iMid] ) {
85 if( iMin == iMaxM1 ) iMin--;
96 std::cout <<
"GROUP: label = '" << mLabel <<
"': length = " << nbs << std::endl;
98 for(
int ib = 0; ib < nbs; ib++ ) {
99 sprintf( buffer,
"%16.8e", mBoundaries[ib] );
101 if( ( ( ib + 1 ) % valuesPerLine ) == 0 ) std::cout << std::endl;
103 if( nbs % valuesPerLine ) std::cout << std::endl;
111 GIDI_settings_groups_from_bdfls::GIDI_settings_groups_from_bdfls( std::string
const &fileName ) {
118 GIDI_settings_groups_from_bdfls::GIDI_settings_groups_from_bdfls(
char const *fileName ) {
125 GIDI_settings_groups_from_bdfls::GIDI_settings_groups_from_bdfls( cbdfls_file
const *bdfls ) {
127 initialize2( bdfls );
137 if( ( bdfls = cbdflsOpen( fileName, &Error ) ) == NULL )
throw Error;
138 initialize2( bdfls );
139 cbdflsRelease( bdfls );
144 void GIDI_settings_groups_from_bdfls::initialize2( cbdfls_file
const *bdfls ) {
148 std::string label(
"" );
151 ng = cbdflsGIDs( (cbdfls_file *) bdfls, &gids );
152 for(
int ig = 0; ig < ng; ++ig ) {
153 ngbs = cbdflsGetGroup( (cbdfls_file *) bdfls, gids[ig], &boundaries );
154 sprintf( cLabel,
"LLNL_gid_%.3d", gids[ig] );
162 GIDI_settings_groups_from_bdfls::~GIDI_settings_groups_from_bdfls( ) {
170 std::string label(
"" );
173 sprintf( cLabel,
"LLNL_gid_%.3d", gid );
175 for(
int ig = 0; ig < (
int) mGroups.size( ); ++ig ) {
176 if( mGroups[ig].isLabel( label ) )
return( mGroups[ig] );
183 std::vector<std::string> GIDI_settings_groups_from_bdfls::getLabels(
void )
const {
185 int size = (
int) mGroups.size( );
186 std::vector<std::string> labels( size );
188 for(
int if1 = 0; if1 < size; ++if1 ) labels[if1] = mGroups[if1].getLabel( );
194 std::vector<int> GIDI_settings_groups_from_bdfls::getGIDs(
void )
const {
196 int size = (
int) mGroups.size( );
197 std::vector<int> fids( size );
200 for(
int if1 = 0; if1 < size; ++if1 ) {
201 fids[if1] = (
int) strtol( &(mGroups[if1].getLabel( ).c_str( )[9]), &e, 10 );
210 int ngs = (
int) mGroups.size( );
212 std::cout <<
"BDFLS GROUPs: number of groups = " << ngs << std::endl;
213 for(
int if1 = 0; if1 < ngs ; ++if1 ) mGroups[if1].
print( outline, valuesPerLine );
GIDI_settings_group(std::string const &label="empty", int size=0)
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
void initialize(Config const *const theConfig)
Initialize the clustering model based on the Config object.
void print(G4double elem)
void print(bool outline=false, int valuesPerLine=10) const
int getGroupIndexFromEnergy(double energy, bool encloseOutOfRange) const
G4double energy(const ThreeVector &p, const G4double m)