#include #include #include using namespace RAT; void RadiusCutProc::SetD( const std::string& param, const double value ) { if( param == "radius" ) if( value >= 0.0 ) fRadius = value; else throw ParamInvalid( param, "radius value must be >= 0.0" ); else throw ParamUnknown( param ); } void RadiusCutProc::SetS( const std::string& param, const std::string& value ) { if( param == "fitName" ) fFitName = value; else if( param == "mode" ) fMode = value; else throw ParamUnknown( param ); } Processor::Result RadiusCutProc::DSEvent( DS::Run&, DS::Entry& ds ) { if( ds.GetEVCount() < 1 ) return Processor::OKFALSE; double radius = 0.0; bool valid = true; try { const DS::FitResult& result = ds.GetEV( 0 ).GetFitResult( fFitName ); if( result.GetVertexCount() == 0 ) return Processor::OKFALSE; for( size_t iVertex = 0; iVertex < result.GetVertexCount(); iVertex++ ) { const DS::FitVertex& vertex = result.GetVertex( iVertex ); valid &= vertex.ValidPosition(); radius = vertex.GetPosition().Mag(); } } catch( DS::DataNotFound& ) { return Processor::FAIL; } if( valid && fMode == "greater" && radius <= fRadius ) return Processor::OKTRUE; if( valid && fMode == "less" && radius >= fRadius ) return Processor::OKTRUE; else return Processor::OKFALSE; }