LEMLibrary_service.cc
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////
2 /// \brief Provide access to the LEM library to all modules
3 /// \author Christopher Backhouse - bckhouse@caltech.edu
4 //////////////////////////////////////////////////////////////////////////
5 
7 
8 #include "LEM/func/OnDemand.h"
9 
11 
12 namespace lem
13 {
14  //------------------------------------------------------------
16  art::ActivityRegistry& /*reg*/)
17  : fLib(0), fHeads(0)
18  {
19  reconfigure(pset);
20 
21  if(fMMappedLoading){
22  if(fOnDemand){
25  }
26  else{
29  }
30  }
31  else{
35  fHeads = 0;
36  }
37  }
38 
39  //----------------------------------------------------------
41  {
42  }
43 
44  //-----------------------------------------------------------
46  {
47  std::string libpath = pset.get<std::string>("LibraryPath");
48  fLibPath = util::EnvExpansion(libpath);
49 
50  fDownsampleFactor = pset.get<int>("DownsampleFactor");
51 
52  fSplitLibFactor = pset.get<int>("SplitLibFactor");
53  fSplitLibIndex = pset.get<int>("SplitLibIndex");
54 
55  fMMappedLoading = pset.get<bool>("MMappedLoading");
56  SetOnDemandMemoryLimit(pset.get<int>("LibraryMemoryLimit"));
57  fOnDemand = (pset.get<int>("LibraryMemoryLimit") > 0);
58  fPreloadLib = pset.get<bool>("PreloadLib");
59  fPreloadHeads = pset.get<bool>("PreloadHeads");
60  }
61 
63 }
64 ////////////////////////////////////////////////////////////////////////
Provide access to the LEM library to all modules.
static Heads * FromMMapOnDemand(const std::string &libPath)
Definition: Heads.cxx:49
#define DEFINE_ART_SERVICE(svc)
Definition: ServiceMacros.h:93
std::string EnvExpansion(const std::string &inString)
Function to expand environment variables.
Definition: EnvExpand.cxx:8
PID
Definition: FillPIDs.h:14
T get(std::string const &key) const
Definition: ParameterSet.h:231
const Library * fLib
Utilities for mapping in library files on-demand.
void SetOnDemandMemoryLimit(long limit_mb)
Definition: OnDemand.cxx:117
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
static Library * FromMMapOnDemand(const std::string &libPath)
Definition: Library.cxx:82
static Library * FromTrees(const std::string &libPath, int splitLibFactor, int splitLibIndex, int downsampleFactor)
Definition: Library.cxx:100
const Heads * fHeads
static Heads * FromMMap(const std::string &libPath, bool touchAll)
Definition: Heads.cxx:23
static Library * FromMMap(const std::string &libPath, bool touchAll)
Definition: Library.cxx:62
LEMLibrary(const fhicl::ParameterSet &pset, art::ActivityRegistry &reg)
void reconfigure(const fhicl::ParameterSet &pset)
std::string fLibPath