#include #include #include using namespace RAT; using namespace RAT::DU; #include using namespace std; ClassImp( RAT::DU::EffectiveVelocity ) void EffectiveVelocity::BeginOfRun() { DB* db = DB::Get(); try { DBLinkPtr effvDB = db->GetLink( "EFFECTIVE_VELOCITY" ); string index; try { index = db->GetLink( "GEO", "inner_av" )->GetS( "material" ); } catch( RAT::DBNotFoundError& e ) { index = db->GetLink( "GEO", "inner_av" )->GetS( "material_top" ); } DBLinkGroup grp = db->GetLinkGroup( "EFFECTIVE_VELOCITY" ); DBLinkGroup::iterator it; // Check for material specific parameters // If not, use default values for( it = grp.begin(); it != grp.end(); ++it ) { if( index == it->first ) { effvDB = db->GetLink( "EFFECTIVE_VELOCITY", index ); break; } } fInnerAVVelocity = effvDB->GetD( "inner_av_velocity" ); fAVVelocity = effvDB->GetD( "av_velocity" ); fWaterVelocity = effvDB->GetD( "water_velocity" ); fOffset = effvDB->GetD( "offset" ); } catch( RAT::DBNotFoundError &e ) { warn << "EffectiveVelocity::BeginOfRun: Cannot load parameters from database, setting values to zero.\n"; fInnerAVVelocity = 0.0; fAVVelocity = 0.0; fWaterVelocity = 0.0; fOffset = 0.0; } }