All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Loaders.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include <map>
6 
7 namespace ana
8 {
9  class SpectrumLoader;
10 
11  /// \brief Collection of SpectrumLoaders for many configurations
12  class Loaders
13  {
14  public:
15  enum DataMC{kData, kMC};
17 
18  /// No loaders initialized. Use \ref SetLoaderPath to configure
19  Loaders();
20  ~Loaders();
21 
22  /// Configure loader via wildcard \a path
23  void SetLoaderPath(const std::string& path,
24  DataMC datamc,
25  DataSource src = kBeam,
26  SwappingConfig swap = kNonSwap);
27 
28  /// Configure loader via explicit file list
29  void SetLoaderFiles(const std::vector<std::string>& files,
30  DataMC datamc,
31  DataSource src = kBeam,
32  SwappingConfig swap = kNonSwap);
33 
35  DataMC datamc,
36  DataSource src = kBeam,
37  SwappingConfig swap = kNonSwap);
38 
39  void DisableLoader(DataMC datamc,
40  DataSource src = kBeam,
41  SwappingConfig swap = kNonSwap);
42 
43  /// Retrieve a specific loader
45  DataSource src = kBeam,
46  SwappingConfig swap = kNonSwap);
47 
48  /// Call Go() on all the loaders
49  void Go();
50 
51  protected:
52  typedef std::tuple<DataMC, DataSource, SwappingConfig> Key_t;
53 
54  // Hold a list of paths that have been set
55  std::map<Key_t, std::string> fLoaderPaths;
56  std::map<Key_t, std::vector<std::string>> fLoaderFiles;
57  // Only reify them when someone actually calls GetLoader()
58  std::map<Key_t, SpectrumLoaderBase*> fLoaders;
59 
60  /// We give this back when a loader isn't set for some configuration
62  };
63 } // namespace
void AddLoader(SpectrumLoaderBase *, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Definition: Loaders.cxx:57
std::map< Key_t, std::string > fLoaderPaths
Definition: Loaders.h:55
void SetLoaderFiles(const std::vector< std::string > &files, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via explicit file list.
Definition: Loaders.cxx:40
void DisableLoader(DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Definition: Loaders.cxx:74
void SetLoaderPath(const std::string &path, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via wildcard path.
Definition: Loaders.cxx:23
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:12
process_name opflashCryoW ana
void Go()
Call Go() on all the loaders.
Definition: Loaders.cxx:123
BEGIN_PROLOG triggeremu_data_config_icarus settings PMTADCthresholds sequence::icarus_stage0_multiTPC_TPC physics sequence::icarus_stage0_EastHits_TPC physics sequence::icarus_stage0_WestHits_TPC physics producers purityana0 caloskimCalorimetryCryoE physics caloskimCalorimetryCryoW physics path
SpectrumLoaderBase & GetLoader(DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Retrieve a specific loader.
Definition: Loaders.cxx:95
DataSource
Is this data-file representing beam spills or cosmic spills?
NullLoader fNull
We give this back when a loader isn&#39;t set for some configuration.
Definition: Loaders.h:61
Base class for the various types of spectrum loader.
std::map< Key_t, SpectrumLoaderBase * > fLoaders
Definition: Loaders.h:58
std::tuple< DataMC, DataSource, SwappingConfig > Key_t
Definition: Loaders.h:52
Dummy loader that doesn&#39;t load any files.
std::map< Key_t, std::vector< std::string > > fLoaderFiles
Definition: Loaders.h:56
Loaders()
No loaders initialized. Use SetLoaderPath to configure.
Definition: Loaders.cxx:12