#include #include #include using namespace std; namespace RAT { void RingOfFire::BeginOfRun(DS::Run&) { fLClean = DB::Get()->GetLink("DATACLEANING",fName); fCardLow = fLClean->GetI("card_low"); fCardHigh = fLClean->GetI("card_high"); fChannelLow = fLClean->GetI("channel_low"); fChannelHigh = fLClean->GetI("channel_high"); fCrateFrac = fLClean->GetD("crate_frac"); fRingFrac = fLClean->GetD("ring_frac"); } Processor::Result RingOfFire::DSEvent(DS::Run&, DS::Entry& ds) { bool pass = true; // If any triggered event fails, they all fail for( size_t iEV = 0; iEV < ds.GetEVCount(); iEV++ ) if( Event(ds, ds.GetEV(iEV)) != OKTRUE ) pass = false; return pass ? OKTRUE : OKFALSE; } Processor::Result RingOfFire::Event(DS::Entry&, DS::EV& ev) { vector crate_count(19,0); vector ring_count(19,0); int pmtid,crate,card,channel,count; fPassFlag = true; // should pass orphans and zero hit events if (ev.GetUncalPMTs().GetCount() == 0){ // || ev.IsOrphan() UpdateMask(ev); return fPassFlag ? OKFALSE : OKTRUE; } count = ev.GetUncalPMTs().GetCount(); for (int ipmt=0;ipmt= fCardHigh || channel <= fChannelLow || channel >= fChannelHigh){ ring_count[crate]++; } } // end loop over pmts // check each crate for a ring for (int i=0;i<19;i++){ if ((crate_count[i]/(float)count > fCrateFrac) && ring_count[i]/(float)crate_count[i] > fRingFrac){ fPassFlag = false; } } // now update the mask UpdateMask(ev); return fPassFlag ? OKFALSE : OKTRUE; } } // namespace RAT