#include #include using namespace RAT; #include using namespace std; void PMTVariation::BeginOfRun() { DB *db = DB::Get(); DBLinkPtr variationSets = db->GetLink( "PMT_VARIATION_SETTINGS" ); fIndex = variationSets->GetS( "use_settings" ); if( fIndex.empty() == true ){ fPMTVariation = db->GetLink( "PMT_VARIATION" )->GetDArray( "variation" ); } else{ fPMTVariation = db->GetLink( "PMT_VARIATION", fIndex )->GetDArray( "variation" ); } } double PMTVariation::GetVariation( const int lcn ) const { try{ return fPMTVariation.at(lcn); } catch(const std::out_of_range&){ std::ostringstream ss; ss << "PMTVariation::GetVariation requested response for PMT #" << lcn << " but only have variations for " << fPMTVariation.size() << " lcns"; throw std::out_of_range(ss.str()); } }