#include #include #include #include #include #include #include #include using namespace RAT; using namespace RAT::SeedModifiers; void SolarDriveModifier::SetD(const std::string& param, const double value) { if(param == "driveCorrection") fDriveCorrection = value; else throw Processor::ParamUnknown(param); } DS::FitResult SolarDriveModifier::ModifySeed(const DS::EV& ev, const DS::FitResult& seedResult) { DS::FitResult modifiedResult; const DS::UniversalTime& eventTime = ev.GetUniversalTime(); // Get the angle to the Sun at the time of the event // Modify the seed position in the direction of the sun TVector3 sunDirection = SunDirection(eventTime.GetDays(), eventTime.GetSeconds(), eventTime.GetNanoSeconds()); bool positionModified = false; for(size_t iVertex = 0; iVertex < seedResult.GetVertexCount(); iVertex++) { // If we have multiple fit vertexes we should modify them all! DS::FitVertex fitVertex = seedResult.GetVertex(iVertex); if(fitVertex.ContainsPosition()) { // Can only adjust vertices with position information TVector3 position = fitVertex.GetPosition(); position += fDriveCorrection * sunDirection.Unit(); // Retain seeds information on validity and fixed nature of position value fitVertex.SetPosition(position, fitVertex.ValidPosition(), fitVertex.FixedPosition()); positionModified = true; } modifiedResult.SetVertex(iVertex, fitVertex); } if(!positionModified) warn << "SolarDriveModifier: No position fit in seed" << newline; return modifiedResult; }