Public Member Functions | Protected Member Functions | Private Attributes | List of all members
novaddt::StaticMapService Class Reference

#include "/cvmfs/"

Public Member Functions

 StaticMapService (fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
const novaddt::calib::FDHitMapgetMap () const
void reload ()
void readMapFromFile (const std::string &fname)

Protected Member Functions

void preProcessEvent (const art::Event &event)

Private Attributes

std::string fMapSource
FileWatcher fFileWatcher
calib::FDHitMap fMap

Detailed Description

Definition at line 31 of file StaticMapService.h.

Constructor & Destructor Documentation

novaddt::StaticMapService::StaticMapService ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry reg 

Definition at line 20 of file

References LogInfo, preProcessEvent(), and art::ActivityRegistry::sPreProcessEvent.

20  :
21  fMapSource(p.get<std::string>("source")),
23 {
24  //::mf::SetModuleName("StaticMapService");
25  ::mf::LogInfo("StaticMapService")<<"map source:"<<fMapSource;
27  //set watcher to monitor file changes in the MapFile
29  reload();
30 }
const char * p
Definition: xmltok.h:285
void preProcessEvent(const art::Event &event)
GlobalSignal< detail::SignalResponseType::FIFO, void(Event const &)> sPreProcessEvent
enum BeamMode string

Member Function Documentation

const novaddt::calib::FDHitMap& novaddt::StaticMapService::getMap ( ) const

Definition at line 35 of file StaticMapService.h.

References fMap.

Referenced by MakeHist(), and novaddt::NoiseHitFinder::produce().

35 {return fMap;}
void novaddt::StaticMapService::preProcessEvent ( const art::Event event)

Definition at line 32 of file

References allTimeWatchdog::endl, fFileWatcher, FileWatcher::isModified(), reload(), and FileWatcher::update().

Referenced by reload(), and StaticMapService().

32  {
33  //reload themap from a new file, when the run number was changed
35  {
36  mf::LogInfo("MapRollover")<<" Map file changed. Updating the map..."<<std::endl;
38  reload();
39  }
40 }
bool isModified()
Definition: FileWatcher.h:15
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void update()
Definition: FileWatcher.h:27
void novaddt::StaticMapService::readMapFromFile ( const std::string fname)

Definition at line 43 of file

References confusionMatrixTree::count, DEFINE_ART_SERVICE, allTimeWatchdog::endl, fMap, LogError, LogInfo, and LogWarning.

Referenced by reload().

44 {
45  ::mf::LogInfo("Progress")<<"reading map from file \""<<fname<<"\"";
46  //block until file is created
47  if(!boost::filesystem::exists(fname)){
48  ::mf::LogWarning("Progress")<<"File "<<fname<<"does not exist.\n";
49  return;
50  }
52  std::ifstream s(,std::ifstream::binary);
53  if(!s.good()){
54  ::mf::LogError("Progress")<<" error opening file \""<<fname<<"\"";
55  return;
56  }
57  s>>fMap;
58  ::mf::LogInfo("Progress")<<"Read map successfully:"
59  <<"zero channels:"<< std::count(,,0)
60  <<" of "<< <<std::endl;
61 }
const XML_Char * s
Definition: expat.h:262
void novaddt::StaticMapService::reload ( )

Member Data Documentation

FileWatcher novaddt::StaticMapService::fFileWatcher

Definition at line 43 of file StaticMapService.h.

Referenced by preProcessEvent().

calib::FDHitMap novaddt::StaticMapService::fMap

Definition at line 44 of file StaticMapService.h.

Referenced by getMap(), and readMapFromFile().

std::string novaddt::StaticMapService::fMapSource

Definition at line 42 of file StaticMapService.h.

Referenced by reload().

The documentation for this class was generated from the following files: