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

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-01-15/OnlineCalibration/StaticMapService.h"

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 StaticMapService_service.cc.

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;
26 
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
inline

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)
protected

Definition at line 32 of file StaticMapService_service.cc.

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 StaticMapService_service.cc.

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  }
51 
52  std::ifstream s(fname.data(),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(fMap.data.begin(),fMap.data.end(),0)
60  <<" of "<<fMap.data.size() <<std::endl;
61 }
const XML_Char * s
Definition: expat.h:262
void novaddt::StaticMapService::reload ( )
inline

Member Data Documentation

FileWatcher novaddt::StaticMapService::fFileWatcher
private

Definition at line 43 of file StaticMapService.h.

Referenced by preProcessEvent().

calib::FDHitMap novaddt::StaticMapService::fMap
private

Definition at line 44 of file StaticMapService.h.

Referenced by getMap(), and readMapFromFile().

std::string novaddt::StaticMapService::fMapSource
private

Definition at line 42 of file StaticMapService.h.

Referenced by reload().


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