#include #include #include #include #include #include #include #include using namespace RAT; using namespace RAT::Classifiers; using namespace RAT::DS; #include using namespace std; void MeanTime::BeginOfRun( DS::Run& ) { fLightPath = DU::Utility::Get()->GetLightPathCalculator(); } void MeanTime::DefaultSeed() { fEventPos = TVector3(); fEventTime = 0.0; } void MeanTime::SetSeed( const DS::FitResult& seed ) { FitVertex seedVertex; try { seedVertex = seed.GetVertex(0); } catch( FitResult::NoVertexError& error ) { // Nothing to seed from, strange request return; } try { fEventPos = seedVertex.GetPosition(); } catch( FitVertex::NoValueError& error ) { /* No data to seed from */ } try { fEventTime = seedVertex.GetTime(); } catch( FitVertex::NoValueError& error ) { /* No data to seed from */ } } DS::ClassifierResult MeanTime::GetClassification() { fClassifierResult.Reset(); if( fPMTData.empty() ) return fClassifierResult; double meanTime = 0.0; const DU::PMTInfo& pmtInfo = DU::Utility::Get()->GetPMTInfo(); const size_t numPMTHits = fPMTData.size(); for( vector::const_iterator iPMT = fPMTData.begin(); iPMT != fPMTData.end(); ++iPMT ) { const double unCorTime = iPMT->GetTime(); // Calculate the corrected time const TVector3 pmtPos = pmtInfo.GetPosition( iPMT->GetID() ); fLightPath.CalcByPosition(fEventPos, pmtPos); double distInInnerAV = fLightPath.GetDistInInnerAV(); double distInAV = fLightPath.GetDistInAV(); double distInWater = fLightPath.GetDistInWater(); const double transitTime = DU::Utility::Get()->GetEffectiveVelocity().CalcByDistance( distInInnerAV, distInAV, distInWater ); const double corTime = unCorTime - transitTime - fEventTime; meanTime += corTime; } meanTime /= static_cast( numPMTHits ); fClassifierResult.SetClassification( "meanTime", meanTime ); fClassifierResult.SetValid( true ); return fClassifierResult; }