Loaders.h
Go to the documentation of this file.
1 #pragma once
2 
4 
6 
7 #include <map>
8 
9 namespace ana
10 {
11  class SpectrumLoader;
12 
13  /// Is this data-file representing beam spills or cosmic spills?
14  enum DataSource{
17  };
18 
21 
22  /// \brief Collection of SpectrumLoaders for many configurations
23  class Loaders
24  {
25  public:
26  enum DataMC{kData, kMC};
28  enum FluxType{kFHC, kRHC};
29 
30  /// No loaders initialized. Use \ref SetLoaderPath to configure
31  Loaders();
32  virtual ~Loaders();
33 
34  /// Configure loader via wildcard \a path
35  void SetLoaderPath(const std::string& path,
37  DataMC datamc,
38  DataSource src = kBeam,
40 
42  DataMC datamc,
43  DataSource src = kBeam,
44  SwappingConfig swap = kNonSwap) const;
45 
46  std::vector <std::string> GetLoaderFiles(caf::Det_t det,
47  DataMC datamc,
48  DataSource src = kBeam,
49  SwappingConfig swap = kNonSwap) const;
50 
51  /// Configure loader via explicit file list
52  void SetLoaderFiles(const std::vector<std::string>& files,
53  caf::Det_t det,
54  DataMC datamc,
55  DataSource src = kBeam,
57 
58  void DisableLoader(caf::Det_t det,
59  DataMC datamc,
60  DataSource src = kBeam,
62 
63  void SetSpillCut(const SpillCut& cut);
64 
65  void SetND(bool nd) { fND = nd; }
66  bool GetND() { return fND; }
67 
68  /// Retrieve a specific loader
70  DataMC datamc,
71  DataSource src = kBeam,
73 
74  /// Call Go() on all the loaders
75  void Go();
76 
77  protected:
78  typedef std::tuple<caf::Det_t, DataMC, DataSource, SwappingConfig> Key_t;
79 
80  // Hold a list of paths that have been set
81  std::map<Key_t, std::string> fLoaderPaths;
82  std::map<Key_t, std::vector<std::string>> fLoaderFiles;
83  // Only reify them when someone actually calls GetLoader()
84  std::map<Key_t, SpectrumLoader*> fLoaders;
85 
87 
88  /// We give this back when a loader isn't set for some configuration
90 
91  bool fND; ///< Bool to set loader for near detector instead of far detector
92  };
93 } // namespace
Det_t
Which NOvA detector?
Definition: SREnums.h:7
std::map< Key_t, std::string > fLoaderPaths
Definition: Loaders.h:81
const SpillCut * fSpillCut
Definition: Loaders.h:86
std::tuple< caf::Det_t, DataMC, DataSource, SwappingConfig > Key_t
Definition: Loaders.h:78
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
EFlatness
Definition: Loaders.h:20
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
std::vector< std::string > GetLoaderFiles(caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap) const
Definition: Loaders.cxx:105
void DisableLoader(caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Definition: Loaders.cxx:65
virtual ~Loaders()
Definition: Loaders.cxx:18
bool datamc
Definition: fnexvscaf.C:20
void Go()
Call Go() on all the loaders.
Definition: Loaders.cxx:162
std::string GetLoaderPath(caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap) const
Definition: Loaders.cxx:89
void SetSpillCut(const SpillCut &cut)
Definition: Loaders.cxx:121
SpectrumLoaderBase & GetLoader(caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Retrieve a specific loader.
Definition: Loaders.cxx:129
DataSource
Is this data-file representing beam spills or cosmic spills?
Definition: Loaders.h:14
NullLoader fNull
We give this back when a loader isn&#39;t set for some configuration.
Definition: Loaders.h:89
bool GetND()
Definition: Loaders.h:66
Base class for the various types of spectrum loader.
const std::string path
Definition: plot_BEN.C:43
void SetLoaderFiles(const std::vector< std::string > &files, caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via explicit file list.
Definition: Loaders.cxx:45
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
const Cut cut
Definition: exporter_fd.C:30
void SetND(bool nd)
Definition: Loaders.h:65
Dummy loader that doesn&#39;t load any files.
std::map< Key_t, std::vector< std::string > > fLoaderFiles
Definition: Loaders.h:82
Template for Cut and SpillCut.
Definition: Cut.h:15
Loaders()
No loaders initialized. Use SetLoaderPath to configure.
Definition: Loaders.cxx:12
std::map< Key_t, SpectrumLoader * > fLoaders
Definition: Loaders.h:84
void SetLoaderPath(const std::string &path, caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via wildcard path.
Definition: Loaders.cxx:25
bool fND
Bool to set loader for near detector instead of far detector.
Definition: Loaders.h:91
ECAFType
Definition: Loaders.h:19