All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
core::ProviderManager Class Reference

Interface to LArSoft services. More...

#include <ProviderManager.hh>

Public Member Functions

 ProviderManager (Experiment det, std::string fcl="", bool setup_event_services=true)
 
void SetupServices (gallery::Event &ev)
 
const geo::GeometryCoreGetGeometryProvider () const
 
const geo::AuxDetGeometryCoreGetAuxDetGeometryProvider () const
 
const
detinfo::LArPropertiesStandard
GetLArPropertiesProvider () const
 
const
detinfo::DetectorClocksStandard
GetDetectorClocksProvider () const
 
const
detinfo::DetectorPropertiesStandard
GetDetectorPropertiesProvider () const
 
cheat::BackTrackerGetBackTrackerProvider () const
 
cheat::ParticleInventoryGetParticleInventoryProvider () const
 
cheat::PhotonBackTrackerGetPhotonBackTrackerProvider () const
 

Static Public Member Functions

static std::vector< ExperimentGetValidExperiments ()
 

Private Attributes

fhicl::ParameterSet * config
 
std::unique_ptr
< geo::GeometryCore
fGeometryProvider
 
std::unique_ptr
< geo::AuxDetGeometryCore
fAuxDetGeometryProvider
 
std::unique_ptr
< detinfo::LArPropertiesStandard
fLArPropertiesProvider
 
std::unique_ptr
< detinfo::DetectorClocksStandard
fDetectorClocksProvider
 
std::unique_ptr
< detinfo::DetectorPropertiesStandard
fDetectorPropertiesProvider
 
std::unique_ptr
< cheat::BackTracker
fBackTrackerProvider
 
std::unique_ptr
< cheat::ParticleInventory
fParticleInventoryProvider
 
std::unique_ptr
< cheat::PhotonBackTracker
fPhotonBackTrackerProvider
 

Detailed Description

Interface to LArSoft services.

The ProviderManager handles loading and provides access to LArSoft services:

Parameters
detThe detector ID (as defined in the Detector enum)
fclAn optional FHiCL file for service settings

Definition at line 50 of file ProviderManager.hh.

Constructor & Destructor Documentation

core::ProviderManager::ProviderManager ( Experiment  det,
std::string  fcl = "",
bool  setup_event_services = true 
)

Definition at line 30 of file ProviderManager.cxx.

30  {
31  // Configuration look up policy: allow absolute paths, and search in the
32  // $FHICL_FILE_PATH for non-absolute paths.
33  const char* fhicl_file_path = getenv("FHICL_FILE_PATH");
34  assert(fhicl_file_path);
35  cet::filepath_lookup_nonabsolute policy(fhicl_file_path);
36 
37  fhicl::ParameterSet cfg;
38 
39  // Geometry: Load the correct geo::GeometryCore subclass for each detector
40  switch (det) {
41  case kExpSBND: {
42  fcl = (fcl == "" ? "gallery_services_sbnd.fcl" : fcl);
45  lar::standalone::SetupGeometry<geo::ChannelMapSBNDAlg>(
46  cfg.get<fhicl::ParameterSet>("services.Geometry"));
47  }
48  break;
49  case kExpMicroBooNE: {
50  fcl = (fcl == "" ? "gallery_services_uboone.fcl" : fcl);
52  fhicl::ParameterSet pset = \
53  cfg.get<fhicl::ParameterSet>("services.Geometry");
54  // For MicroBooNE, we also need to initialize the channel map with the
55  // optical detector channel mapping
56  std::unique_ptr<geo::ChannelMapAlg> channelMap = \
57  std::make_unique<geo::ChannelMapUBooNEAlg>(
58  cfg.get<fhicl::ParameterSet>("services.ExptGeoHelperInterface"), pset);
60  lar::standalone::SetupGeometryWithChannelMapping(pset, std::move(channelMap));
61  }
62  break;
63  case kExpICARUS: {
64  fcl = (fcl == "" ? "gallery_services_icarus.fcl" : fcl);
67  lar::standalone::SetupGeometry<geo::ChannelMapIcarusAlg>(
68  cfg.get<fhicl::ParameterSet>("services.Geometry"));
69  }
70  break;
71  default:
72  std::cerr << "ProviderManager: Unknown detector ID" << std::endl;
73  assert(false);
74  break;
75  }
76  config = new fhicl::ParameterSet(cfg);
77 
78  // AuxDetGeometry
79  fAuxDetGeometryProvider = std::make_unique<geo::AuxDetGeometryCore>(cfg.get<fhicl::ParameterSet>("services.AuxDetGeometry"));
80 
81  // find the GDML and load it
82  std::string relPath = config->get<std::string>("services.AuxDetGeometry.RelativePath", "" );
83  const std::string GDMLFileName = config->get<std::string>("services.AuxDetGeometry.GDML" );
84 
85  cet::search_path sp("FW_SEARCH_PATH");
86 
87  std::string GDMLFilePathHint = relPath + GDMLFileName;
88  std::string GDMLFilePath;
89  if( !sp.find_file(GDMLFilePathHint, GDMLFilePath) ) {
90  throw cet::exception("StaticLoadGeometry")
91  << "Can't find geometry file '" << GDMLFilePathHint << std::endl;
92  }
93 
94  std::string ROOTFilePathHint = relPath + GDMLFileName;
95  std::string ROOTFilePath;
96  if( !sp.find_file(ROOTFilePathHint, ROOTFilePath) ) {
97  throw cet::exception("StaticLoadGeometry")
98  << "Can't find geometry file '" << ROOTFilePathHint
99  << "' (for geometry)!\n";
100  }
101  fAuxDetGeometryProvider->LoadGeometryFile(GDMLFilePath, ROOTFilePath);
102 
103  // LArProperties
105  testing::setupProvider<detinfo::LArPropertiesStandard>(
106  cfg.get<fhicl::ParameterSet>("services.LArPropertiesService"));
107 
108  // DetectorClocks
110  testing::setupProvider<detinfo::DetectorClocksStandard>(
111  cfg.get<fhicl::ParameterSet>("services.DetectorClocksService"));
112 
113  // DetectorProperties
115  testing::setupProvider<detinfo::DetectorPropertiesStandard>(
116  cfg.get<fhicl::ParameterSet>("services.DetectorPropertiesService"),
118  fGeometryProvider.get(),
119  static_cast<const detinfo::LArProperties*>(fLArPropertiesProvider.get()),
120  static_cast<const detinfo::DetectorClocks*>(fDetectorClocksProvider.get())
121  });
122 
124  fBackTrackerProvider = NULL;
126  if (!setup_event_services) {
127  return;
128  }
129 
130  // ParticleInventory
131  if (cfg.has_key("services.ParticleInventoryService")) {
132  fParticleInventoryProvider = testing::setupProvider<cheat::ParticleInventory>(
133  cfg.get<fhicl::ParameterSet>("services.ParticleInventoryService"));
134  }
135  else {
136  std::cerr << "Warning: Particle inventory service is missing from fhicl config (" << fcl << ")." \
137  << " Setting ParticleInventoryService to NULL" << std::endl;
138  }
139 
140  // BackTracker
141  if (cfg.has_key("services.BackTrackerService")) {
143  testing::setupProvider<cheat::BackTracker>(
144  cfg.get<fhicl::ParameterSet>("services.BackTrackerService"),
147  }
148  else {
149  std::cerr << "Warning: BackTracker service is missing from fhicl config (" << fcl << ")." \
150  << " Setting BackTrackerService to NULL" << std::endl;
151  }
152 
153  // Photon BackTracker
154  if (cfg.has_key("services.PhotonBackTrackerService")) {
156  testing::setupProvider<cheat::PhotonBackTracker>(
157  cfg.get<fhicl::ParameterSet>("services.PhotonBackTrackerService"),
159  }
160  else {
161  std::cerr << "Warning: PhotonBackTracker service is missing from fhicl config (" << fcl <<")." \
162  << " Setting PhotonBackTrackerService to NULL" << std::endl;
163  }
164 
165  std::cout << "ProviderManager: Loaded configuration for: "
166  << fGeometryProvider.get()->DetectorName() << std::endl;
167 }
process_name standard_reco_uboone fcl
std::unique_ptr< cheat::PhotonBackTracker > fPhotonBackTrackerProvider
BEGIN_PROLOG could also be cerr
std::unique_ptr< detinfo::DetectorClocksStandard > fDetectorClocksProvider
fhicl::ParameterSet * config
std::unique_ptr< geo::GeometryCore > fGeometryProvider
std::unique_ptr< cheat::ParticleInventory > fParticleInventoryProvider
std::unique_ptr< geo::AuxDetGeometryCore > fAuxDetGeometryProvider
std::unique_ptr< cheat::BackTracker > fBackTrackerProvider
std::unique_ptr< detinfo::LArPropertiesStandard > fLArPropertiesProvider
std::unique_ptr< geo::GeometryCore > SetupGeometryWithChannelMapping(fhicl::ParameterSet const &pset, std::unique_ptr< geo::ChannelMapAlg > channelMap)
Initializes a LArSoft geometry object.
std::string GDMLFileName
Container for a list of pointers to providers.
Definition: ProviderPack.h:114
fhicl::ParameterSet ParseConfiguration(std::string configPath, cet::filepath_maker &lookupPolicy)
Parses a FHiCL configuration file.
std::unique_ptr< detinfo::DetectorPropertiesStandard > fDetectorPropertiesProvider
BEGIN_PROLOG could also be cout

Member Function Documentation

const geo::AuxDetGeometryCore* core::ProviderManager::GetAuxDetGeometryProvider ( ) const
inline

Definition at line 60 of file ProviderManager.hh.

60  {
61  return fAuxDetGeometryProvider.get();
62  }
std::unique_ptr< geo::AuxDetGeometryCore > fAuxDetGeometryProvider
cheat::BackTracker* core::ProviderManager::GetBackTrackerProvider ( ) const
inline

Definition at line 76 of file ProviderManager.hh.

76  {
77  return fBackTrackerProvider.get();
78  }
std::unique_ptr< cheat::BackTracker > fBackTrackerProvider
const detinfo::DetectorClocksStandard* core::ProviderManager::GetDetectorClocksProvider ( ) const
inline

Definition at line 68 of file ProviderManager.hh.

68  {
69  return fDetectorClocksProvider.get();
70  }
std::unique_ptr< detinfo::DetectorClocksStandard > fDetectorClocksProvider
const detinfo::DetectorPropertiesStandard* core::ProviderManager::GetDetectorPropertiesProvider ( ) const
inline

Definition at line 72 of file ProviderManager.hh.

72  {
73  return fDetectorPropertiesProvider.get();
74  }
std::unique_ptr< detinfo::DetectorPropertiesStandard > fDetectorPropertiesProvider
const geo::GeometryCore* core::ProviderManager::GetGeometryProvider ( ) const
inline

Definition at line 56 of file ProviderManager.hh.

56  {
57  return fGeometryProvider.get();
58  }
std::unique_ptr< geo::GeometryCore > fGeometryProvider
const detinfo::LArPropertiesStandard* core::ProviderManager::GetLArPropertiesProvider ( ) const
inline

Definition at line 64 of file ProviderManager.hh.

64  {
65  return fLArPropertiesProvider.get();
66  }
std::unique_ptr< detinfo::LArPropertiesStandard > fLArPropertiesProvider
cheat::ParticleInventory* core::ProviderManager::GetParticleInventoryProvider ( ) const
inline

Definition at line 80 of file ProviderManager.hh.

80  {
81  return fParticleInventoryProvider.get();
82  }
std::unique_ptr< cheat::ParticleInventory > fParticleInventoryProvider
cheat::PhotonBackTracker* core::ProviderManager::GetPhotonBackTrackerProvider ( ) const
inline

Definition at line 84 of file ProviderManager.hh.

84  {
85  return fPhotonBackTrackerProvider.get();
86  }
std::unique_ptr< cheat::PhotonBackTracker > fPhotonBackTrackerProvider
std::vector< Experiment > core::ProviderManager::GetValidExperiments ( )
static

Definition at line 193 of file ProviderManager.cxx.

193  {
194  static std::vector<Experiment> ex = {
196  };
197  return ex;
198 }
void core::ProviderManager::SetupServices ( gallery::Event &  ev)

Definition at line 169 of file ProviderManager.cxx.

169  {
170  // reset the channels of the back tracker
171  if (GetBackTrackerProvider() != NULL) {
174  }
175 
176  // reset information in particle inventory
177  if (GetParticleInventoryProvider() != NULL) {
182  }
183 
184  // reset information in the photon back tracker
185  if (GetPhotonBackTrackerProvider() != NULL) {
188  // GetPhotonBackTrackerProvider()->PrepOpFlashToOpHits(ev);
189  }
190 }
void PrepParticleList(const Evt &evt) const
A function to load the ParticleList and cache it This function will find the particle list and load i...
void PrepSimChannels(const Evt &evt)
cheat::BackTracker * GetBackTrackerProvider() const
cheat::ParticleInventory * GetParticleInventoryProvider() const
void PrepTrackIdToMCTruthIndex(const Evt &evt) const
A function to prepare and cache a map of TrackIds and MCTruth object indicies from fMCTruthList...
void PrepMCTruthList(const Evt &evt) const
A function to load and cache the MCTruthList of the event.
void PrepOpDetBTRs(Evt const &evt)
cheat::PhotonBackTracker * GetPhotonBackTrackerProvider() const

Member Data Documentation

fhicl::ParameterSet* core::ProviderManager::config
private

Definition at line 91 of file ProviderManager.hh.

std::unique_ptr<geo::AuxDetGeometryCore> core::ProviderManager::fAuxDetGeometryProvider
private

Definition at line 93 of file ProviderManager.hh.

std::unique_ptr<cheat::BackTracker> core::ProviderManager::fBackTrackerProvider
private

Definition at line 97 of file ProviderManager.hh.

std::unique_ptr<detinfo::DetectorClocksStandard> core::ProviderManager::fDetectorClocksProvider
private

Definition at line 95 of file ProviderManager.hh.

std::unique_ptr<detinfo::DetectorPropertiesStandard> core::ProviderManager::fDetectorPropertiesProvider
private

Definition at line 96 of file ProviderManager.hh.

std::unique_ptr<geo::GeometryCore> core::ProviderManager::fGeometryProvider
private

Definition at line 92 of file ProviderManager.hh.

std::unique_ptr<detinfo::LArPropertiesStandard> core::ProviderManager::fLArPropertiesProvider
private

Definition at line 94 of file ProviderManager.hh.

std::unique_ptr<cheat::ParticleInventory> core::ProviderManager::fParticleInventoryProvider
private

Definition at line 98 of file ProviderManager.hh.

std::unique_ptr<cheat::PhotonBackTracker> core::ProviderManager::fPhotonBackTrackerProvider
private

Definition at line 99 of file ProviderManager.hh.


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