#include #include #include #include #include #include #include #include namespace RAT { DefaultFitter::DefaultFitter() : Processor("defaultfitter") { } void DefaultFitter::SetS(const std::string& param, const std::string& value) { if (param == "name") { fName = value; } else { throw Processor::ParamUnknown(param); } } Processor::Result DefaultFitter::DSEvent(DS::Run&, DS::Entry& ds) { for( size_t iEV = 0; iEV < ds.GetEVCount(); iEV++ ) Event( ds, ds.GetEV( iEV ) ); return OK; } Processor::Result DefaultFitter::Event(DS::Entry&, DS::EV& ev) { try { DS::FitResult result = ev.GetFitResult(fName); if( !result.GetValid() ) { // ev.SetDefaultFitVertex( fName, NULL );// ev.fit is NULL and TTree::Draw skips it return Processor::OK; } try { DS::FitVertex& resultVertex = result.GetVertex(0); // Fill any missing data with the missing data flag (defined in the db) if(!resultVertex.ContainsPosition()) { resultVertex.SetPosition(TVector3(DS::INVALID, DS::INVALID, DS::INVALID), false); resultVertex.SetPositionErrors(ROOT::Math::XYZVectorF(DS::INVALID, DS::INVALID, DS::INVALID),false); } if(!resultVertex.ContainsDirection()) { resultVertex.SetDirection(TVector3(DS::INVALID, DS::INVALID, DS::INVALID),false); resultVertex.SetDirectionErrors(TVector3(DS::INVALID, DS::INVALID, DS::INVALID),false); } if(!resultVertex.ContainsEnergy()) { resultVertex.SetEnergy(DS::INVALID,false); resultVertex.SetEnergyErrors(DS::INVALID,false); } if(!resultVertex.ContainsTime()) { resultVertex.SetTime(DS::INVALID,false); resultVertex.SetTimeErrors(DS::INVALID,false); } ev.SetDefaultFitVertex(fName, resultVertex); } catch (DS::FitResult::NoVertexError& e) { /* Not a problem */ } } catch (DS::DataNotFound& e) { /* Not a problem */ } return Processor::OK; } } // namespace RAT