BadLBNs.cpp

Go to the documentation of this file.
00001 
00002 #include "cafe/BadLBNs.hpp"
00003 
00004 #include <algorithm>
00005 #include <fstream>
00006 
00007 #include "cafe/Event.hpp"
00008 #include "cafe/Config.hpp"
00009 
00010 namespace cafe {
00011 
00012     BadLBNs::BadLBNs(const char *name)
00013         : Processor(name),
00014           _MC(false)
00015     {
00016         Config config(name);
00017         std::vector<std::string> files = config.getVString("Files", " ,");
00018         _MC = config.get("MonteCarlo", 0);
00019 
00020         if(_MC) {
00021             _vars.add("_overlaylumblk");
00022         } else {
00023             _vars.add("_lumblk");
00024         }
00025 
00026         for(std::vector<std::string>::iterator it = files.begin();
00027             it != files.end();
00028             ++it) {
00029             out() << "BadLBN[" << name << "]: Adding file: " << *it << std::endl;
00030             std::ifstream f((*it).c_str());
00031             for(int lbn; f >> lbn; ) {
00032                 _badLBNs.insert(lbn);
00033             }
00034         }
00035     }
00036     
00037     bool BadLBNs::processEvent(cafe::Event& event)
00038     {
00039         if(_MC) {
00040             // Monte Carlo
00041             return _badLBNs.find(event.getMCEventInfo(_vars)->overlaylumblk()) == _badLBNs.end();           
00042         } else {
00043             // Data
00044             return _badLBNs.find(event.getGlobal(_vars)->lumblk()) == _badLBNs.end();
00045         }
00046     }
00047 
00048 }
00049 
00050 ClassImp(cafe::BadLBNs)
00051 

Generated on Thu Apr 3 04:14:22 2008 for CAF by doxygen 1.3.4