// SanityCheckProc.cc // Contact person: Gabriel Orebi Gann // See SanityCheckProc.hh for more details //———————————————————————// #include #include #include #include #include #include #include #include #include #include using namespace std; namespace RAT { SanityCheckProc::SanityCheckProc() : Processor("sanitychecks") { fHitPMTs.resize(0); nPMTs = 0; } SanityCheckProc::~SanityCheckProc() { fHitPMTs.resize(0); } void SanityCheckProc::BeginOfRun(DS::Run& run) { // Cheat: define size of PMT array based on DQCH array DBLinkPtr dqxxBank = DB::Get()->GetLink("PMT_DQXX"); std::vector dqch = dqxxBank->GetIArray("dqch"); Log::Assert(!dqch.empty(), "SanityCheckProc: Unable to determine PMT count from DQCH data"); nPMTs = (int) dqch.size(); dqch.clear(); } Processor::Result SanityCheckProc::DSEvent( DS::Run&, DS::Entry& ds) { fHitPMTs.resize(0); // Loop over events for (size_t iev=0; iev( (1<<24)-1))SanityCheckProc::Die("",3,eventID,(1<<24)-1); // Event IDs that should never occur are those with bits 0-15 all set to 1 // So, increment eventID by 1 and then test for divisibility by 2^16 eventID += 1; int ibtest = (1<<16); if(eventID % ibtest == 0)SanityCheckProc::Die("",4,eventID-1,0); } // The PMT ID should be within the range of nPMTs // And, each PMT should only be hit once within a single detector event void SanityCheckProc::PMTID(int pmtID) { if(pmtID<0 || pmtID>(nPMTs-1))SanityCheckProc::Die("",2,pmtID,nPMTs-1); int nToDate = fHitPMTs.size(); for(int ih = 0; ih