#include #include #include #include #include #include #include #include #include #include namespace RAT { ULong64_t GetDataCleaningWord( const std::string& bitMask ) { RAT::DBLinkPtr datacleaningDB = RAT::DB::Get()->GetLink( "DATACLEANING", "bitmask" ); std::vector mask = datacleaningDB->GetSArray( bitMask ); RAT::DU::DataCleaningBits dataCleaningBits = RAT::DU::Utility::Get()->GetDataCleaningBits(); // To get the data cleaning bits ULong64_t result = 0; for( unsigned int i = 0; i < mask.size(); i++ ){ result |= ((ULong64_t)0x1 << dataCleaningBits.GetBitIndex( mask.at(i) ) ); } return result; } ///////////////////////////// ///////////////////////////// ULong64_t GetDataCleaningWord( const std::vector& cutnames ) { RAT::DU::DataCleaningBits dataCleaningBits = RAT::DU::Utility::Get()->GetDataCleaningBits(); // To get the data cleaning bits ULong64_t result = 0; for( unsigned int i = 0; i < cutnames.size(); i++ ){ result |= ((ULong64_t)0x1 << dataCleaningBits.GetBitIndex( cutnames.at(i) ) ); } return result; } ///////////////////////////// ///////////////////////////// Bool_t EventIsClean( const RAT::DS::EV& ev, const ULong64_t dataCleaningWord, const Int_t pass ) { Bool_t cleanFlag = false; const RAT::DS::DataQCFlags& dataQCFlags = ev.GetDataCleaningFlags(); Int_t passNumber = -1; if( pass >= 0 ) passNumber = pass; else passNumber = dataQCFlags.GetLatestPass(); if(passNumber<0) { warn<<"The applied flags were not found in any pass, returning notClean "<GetDataCleaningBits(); // To get the data cleaning bits for( std::map::iterator iDCBits = dataCleaningBits.GetInverseMapBegin(); iDCBits != dataCleaningBits.GetInverseMapEnd(); iDCBits++ ) { if( comparison & ((ULong64_t)0x1 << iDCBits->first ) ){ warn << "DataCleaningUtility::MissingBits: Bit for " << iDCBits->second << " is missing." << newline; } } } } // namespace RAT