#include #include #include using namespace RAT; using namespace std; void FitEnergyCutProc::SetS( const string& param, const string& value ) { if( param == "fitName" ) fFitName = value; else throw ParamUnknown( param ); } void FitEnergyCutProc::SetD( const string& param, const double value ) { if( param == "Elow" ) fenergyLowCut = value; else if( param == "Ehigh" ) fenergyHighCut = value; else throw ParamUnknown( param ); } Processor::Result FitEnergyCutProc::DSEvent( DS::Run& , DS::Entry& ds ) { if( ds.GetEVCount() < 1 ) return Processor::OKFALSE; bool valid = true; try { const DS::FitResult& result = ds.GetEV( 0 ).GetFitResult( fFitName ); if( result.GetVertexCount() == 0 ) return Processor::OKFALSE; // only look at first fit vertex const DS::FitVertex& vertex = result.GetVertex(0); // check valid energy if(!vertex.ValidEnergy()){ // no valid energy so does not fall in range valid = false; }else{ // Get the energy and test it against allowed window double energy = vertex.GetEnergy(); if(energy>=fenergyLowCut && energy <=fenergyHighCut){ // using cuts inclusively valid = true; }else{ valid =false; } } } catch( DS::DataNotFound& ) { return Processor::FAIL; } if( valid ) return Processor::OKTRUE; else return Processor::OKFALSE; }