//////////////////////////////////////////////////////////////////// /// \file ApplyDataCleaningCuts.cc /// /// \brief Functions to apply data cleaning cuts. /// /// \author J Walker /// \contact Rob Knapik /// REVISION HISTORY:\n /// 2015-05-29 : J Walker - First version.\n /// 2017-04-05 : Rob Knapik /// -Updated the mask to "analysis_maks" /// -changed contact person /// /// \details An example showing how to fileter events that pass or fail /// data the cleaning cuts. /// Note: The data cleaning processor should have been applied to the data. /// //////////////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include /// Check events pass data cleaning cuts /// /// @param[in] fileName of the RAT::DS root file to analyse void ApplyDataCleaningCuts( const std::string& fileName ) { // If this is being done on data that does not require remote database connection // eg.: a simple simulation with default run number (0) // We can disable the remote connections: // // NOTE: Don't do this if you are using real data!!! RAT::DB::Get()->SetAirplaneModeStatus(true); RAT::DU::DSReader dsReader( fileName ); ULong64_t dcAnalysisWord = RAT::GetDataCleaningWord( "analysis_mask" ); // Loop through entries in rootfile for( size_t iEntry = 0; iEntry < dsReader.GetEntryCount(); iEntry++ ){ const RAT::DS::Entry& rDS = dsReader.GetEntry( iEntry ); // Look at each triggered event in the entry for( size_t iEV = 0; iEV < rDS.GetEVCount(); iEV++ ){ const RAT::DS::EV& rEV = rDS.GetEV( iEV ); if( RAT::EventIsClean( rEV, dcAnalysisWord ) ) std::cout << "Event passed all data cleaning cuts" << std::endl; else std::cout << "Event failed at least one data cleaning cut" << std::endl; } // EV } // Entry }