#include #include #include #include using namespace RAT; using namespace RAT::Methods; using namespace RAT::DS; #include using namespace std; void SimpleEnergy::Initialise( const std::string& param ) { fIndex = param; } void SimpleEnergy::BeginOfRun( DS::Run& ) { DB *db = DB::Get(); string index; if( fIndex.empty() == true ) { index = db->GetLink("GEO", "inner_av")->GetS("material"); } else index = fIndex; // Get default parameters (those of labppo_scintillator) DBLinkPtr dbSELink = db->GetLink("FIT_SIMPLE_ENERGY"); DBLinkGroup grp=db->GetLinkGroup("FIT_SIMPLE_ENERGY"); DBLinkGroup::iterator it; // Check for material specific parameters // If not, keep default values for(it=grp.begin(); it != grp.end(); ++it){ if(index == it->first){ dbSELink = db->GetLink("FIT_SIMPLE_ENERGY", index); break; } } fNhitPerMeV = dbSELink->GetD("nhit_per_mev"); } DS::FitResult SimpleEnergy::GetBestFit() { fFitResult.Reset(); if( fPMTData.empty() ) return fFitResult; DS::FitVertex fitVertex; fitVertex.SetEnergy( static_cast( fPMTData.size() ) / fNhitPerMeV ); fitVertex.SetEnergyErrors( 1.0 ); fFitResult.SetVertex( 0, fitVertex ); return fFitResult; }