00001 #include "FWCore/Services/interface/UpdaterService.h" 00002 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00003 #include "DataFormats/Provenance/interface/EventID.h" 00004 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" 00005 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" 00006 00007 #include <iostream> 00008 00009 UpdaterService::UpdaterService(const edm::ParameterSet & cfg, edm::ActivityRegistry & r ) : 00010 theEventId(0) { 00011 r.watchPreProcessEvent( this, & UpdaterService::init ); 00012 theInit(); 00013 } 00014 00015 UpdaterService::~UpdaterService(){ 00016 } 00017 00018 void UpdaterService::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { 00019 edm::ParameterSetDescription desc; 00020 descriptions.add("UpdaterService", desc); 00021 } 00022 00023 void UpdaterService::init(const edm::EventID& eId, const edm::Timestamp&){ 00024 theInit(); 00025 theEventId = &eId; 00026 } 00027 00028 void UpdaterService::theInit(){ 00029 theCounts.clear(); 00030 } 00031 00032 bool UpdaterService::checkOnce(std::string tag){ 00033 bool answer=true; 00034 00035 std::map<std::string, unsigned int>::iterator i=theCounts.find(tag); 00036 if (i!=theCounts.end()){ 00037 i->second++; 00038 answer=false; 00039 } 00040 else{ 00041 theCounts[tag]=1; 00042 answer=true; 00043 } 00044 00045 if (theEventId){ LogDebug("UpdaterService")<<"checking ONCE on tag: "<<tag 00046 <<"on run: "<<theEventId->run()<<" event: "<<theEventId->event() 00047 <<((answer)?" -> true":" -> false"); 00048 } 00049 return answer; 00050 } 00051 00052 bool UpdaterService::check(std::string tag, std::string label){ 00053 return true; 00054 }