#include #include #include #include #include #include using namespace RAT; using namespace RAT::Methods; #include using namespace ROOT; using namespace std; void SimpleDirection::DefaultSeed() { DS::FitVertex vertex; vertex.SetPosition( TVector3( 0.0, 0.0, 0.0 ), false, true ); fSeedResult.SetVertex( 0, vertex ); } DS::FitResult SimpleDirection::GetBestFit() { fFitResult.Reset(); if( fPMTData.empty() ) return fFitResult; CopySeedToResult(); SelectPMTData( fSeedResult.GetVertex(0) ); DS::FitVertex vertex = fFitResult.GetVertex( 0 ); TVector3 direction( 0.0, 0.0, 0.0 ); TVector3 error( 1.0, 1.0, 1.0 ); const DU::PMTInfo& pmtInfo = DU::Utility::Get()->GetPMTInfo(); for( vector::const_iterator iPMT = fSelectedPMTData.begin(); iPMT != fSelectedPMTData.end(); ++iPMT ) { const double qPMT = iPMT->GetQHS(); direction += qPMT * qPMT * ( pmtInfo.GetPosition( iPMT->GetID() ) - vertex.GetPosition() ); } direction = direction.Unit(); vertex.SetDirection( direction ); vertex.SetDirectionErrors( error ); fFitResult.SetVertex( 0, vertex ); return fFitResult; }