// DataCleaningCutProc.cc // Contact Person: P G Jones // See DataCleaningCutProc.hh for more details #include #include #include #include #include #include #include #include using namespace RAT; using namespace std; void DataCleaningCutProc::SetI( const std::string& param, const int value ) { if( param == "pass" ) fPass = value; else if( param == "blindness" ) fBlindness =value; else throw ParamUnknown( param ); } void DataCleaningCutProc::SetS( const std::string& param, const std::string& value ) { if( param == "flag" ) fFlags.push_back( value ); else if( param == "mask" ) fMasks.push_back( value ); else throw ParamUnknown( param ); } void DataCleaningCutProc::BeginOfRun( DS::Run& ) { DBLinkPtr maskDB; if(fBlindness==0) maskDB = DB::Get()->GetLink( "DATACLEANING", "bitmask" ); else maskDB = DB::Get()->GetLink( "BLINDNESS", "bitmask" ); // Loop over the masks and add the flags defined in the DB for that mask to the flag list for( vector::const_iterator iMask = fMasks.begin(); iMask != fMasks.end(); iMask++ ) { vector flags = maskDB->GetSArray( *iMask ); fFlags.insert( fFlags.end(), flags.begin(), flags.end() ); } } Processor::Result DataCleaningCutProc::DSEvent( DS::Run& run, DS::Entry& ds ) { try { const DS::DataQCFlags& dcFlags = ds.GetEV(0).GetDataCleaningFlags(); // If the pass number is not specified in the macro, set it to the latest pass if( fPass < 0 ) { fPass = dcFlags.GetLatestPass(); } // If no flags exist in any pass return OK. See src/dc/DataQCFlags.hh but -1 means no pass had applied bits if(fPass<0){ warn<<"No pass had the applied bits set you are not doing things correctly"<::const_iterator iFlag = fFlags.begin(); iFlag != fFlags.end(); iFlag++ ) { const size_t bit = DU::Utility::Get()->GetDataCleaningBits().GetBitIndex( *iFlag ); if( !applied.Get( bit ) ){ warn<<"The applied bit for "<< *iFlag <<"was not set, you are not doing things correctly"<