#include #include #include #include #include #include #include #include using namespace RAT; using namespace RAT::Classifiers; using namespace RAT::DS; #include using namespace std; void EarlyTime::BeginOfRun( DS::Run& ) { fLightPath = DU::Utility::Get()->GetLightPathCalculator(); } void EarlyTime::DefaultSeed() { fEventPos = TVector3(); fEventTime = 0.0; } void EarlyTime::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 EarlyTime::GetClassification() { fClassifierResult.Reset(); if( fPMTData.empty() ) return fClassifierResult; int numTooEarly = 0; for( vector::const_iterator iPMT = fPMTData.begin(); iPMT != fPMTData.end(); ++iPMT ) { const TVector3 pmtPos = DU::Utility::Get()->GetPMTInfo().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 = iPMT->GetTime() - transitTime - fEventTime; if( corTime < 0.0 ) numTooEarly++; } fClassifierResult.SetClassification( "earlyFraction", static_cast( numTooEarly ) / static_cast( fPMTData.size() ) ); fClassifierResult.SetValid( true ); return fClassifierResult; }