00001 #include "cafe/GoodRuns.hpp" 00002 00003 #include <algorithm> 00004 #include <fstream> 00005 00006 #include "cafe/Event.hpp" 00007 #include "cafe/Config.hpp" 00008 00009 namespace cafe { 00010 00011 GoodRuns::GoodRuns(const char *name) 00012 : Processor(name), 00013 _vars("_runno") 00014 { 00015 Config config(name); 00016 _useRuns = static_cast<bool>(config.get("GoodRuns", 1)); 00017 00018 std::vector<std::string> files = config.getVString("Files", " ,"); 00019 for(std::vector<std::string>::iterator it = files.begin(); 00020 it != files.end(); 00021 ++it) { 00022 out() << "GoodRun[" << name << "]: Adding file: " << *it << std::endl; 00023 std::ifstream f((*it).c_str()); 00024 for(int run; f >> run; ) { 00025 _goodRuns.insert(run); 00026 } 00027 } 00028 } 00029 00030 bool GoodRuns::processEvent(cafe::Event& event) 00031 { 00032 if (_useRuns) 00033 return _goodRuns.find(event.getGlobal(_vars)->runno()) != _goodRuns.end(); 00034 else 00035 return _goodRuns.find(event.getGlobal(_vars)->runno()) == _goodRuns.end(); 00036 } 00037 00038 } 00039 00040 ClassImp(cafe::GoodRuns)
1.3.4