#include #include #include #include #include #include #include using namespace RAT; using namespace RAT::Classifiers; using namespace RAT::DS; using namespace std; void SkyShine::BeginOfRun(DS::Run&) { DB* db = DB::Get(); DBLinkPtr dbLink = db->GetLink("CLASSIFIER_SKYSHINE"); fSignalHighZ = dbLink->GetD("signalHighZ"); fSideLowZ = dbLink->GetD("sideLowZ"); fSideHighZ = dbLink->GetD("sideHighZ"); fOWLLowZ = dbLink->GetD("owlLowZ"); } DS::ClassifierResult SkyShine::GetClassification() { fClassifierResult.Reset(); if (fPMTData.empty()) return fClassifierResult; const DU::PMTInfo& info = DU::Utility::Get()->GetPMTInfo(); int nSignal = 0; int nSide = 0; for (vector::const_iterator iPMT = fPMTData.begin(); iPMT != fPMTData.end(); ++iPMT) { const TVector3 pmtPos = info.GetPosition(iPMT->GetID()); double z = pmtPos.Z(); if (z < fSignalHighZ) ++nSignal; else if (z > fSideLowZ && z < fSideHighZ) ++nSide; } // count OWL tubes. // (Note FitterPMT collection only includes inward-looking and HQE tubes) int nOwl = 0; const UncalPMTs& pmts = fEvent->GetUncalPMTs(); for (size_t iowl = 0; iowl < pmts.GetOWLCount(); ++iowl) { const PMTUncal& owl = pmts.GetOWLPMT(iowl); const TVector3 owlPos = info.GetPosition(owl.GetID()); double z = owlPos.Z(); if (z > fOWLLowZ) ++nOwl; } double r = static_cast(nSide) / static_cast(nSignal); fClassifierResult.SetClassification("sideFraction", r); fClassifierResult.SetClassification("neckCount", static_cast(pmts.GetNeckCount())); fClassifierResult.SetClassification("topOWLCount", static_cast(nOwl)); fClassifierResult.SetValid(true); return fClassifierResult; }