#include #include #include #include using namespace RAT; void NHitCutProc::SetI( const std::string& param, const int value ) { if( param == "nhit" ) if( value >= 0 ) fMinNHits = value; else throw ParamInvalid( param, "nhit value must be >= 0" ); else if( param == "clean") { if (value != 0) { fCleanHits = true; } else { fCleanHits = false; } } else throw ParamUnknown( param ); } Processor::Result NHitCutProc::DSEvent( DS::Run& run, DS::Entry& ds ) { if (ds.GetEVCount() == 0) return Processor::OKFALSE; //For MC it doesn't make sense to fail all events in an EV event just because the first one fails the nhit cut. //Change this to only fail the EV event if all events fail nhit cut. For data the behaviour is the same for( size_t iEV = 0; iEV < ds.GetEVCount(); iEV++ ){ if(Event(run, ds.GetEV(iEV)) == Processor::OKTRUE) return Processor::OKTRUE; } return Processor::OKFALSE; } Processor::Result NHitCutProc::Event( DS::Run& , DS::EV& ev ) { UInt_t nhits = 0; if (fCleanHits) { nhits = ev.GetNhitsCleaned(); } else { nhits = ev.GetNhits(); } if( nhits >= fMinNHits ) return Processor::OKTRUE; else return Processor::OKFALSE; }