All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SpectrumLoader.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 class TFile;
6 
7 namespace ana
8 {
9  class Progress;
10 
11  /// \brief Collaborates with \ref Spectrum and \ref OscillatableSpectrum to
12  /// fill spectra from CAF files.
13  ///
14  /// The outside user should just pass a filename, wildcard, SAM dataset name,
15  /// or query to the constructor. Then construct all the spectra you
16  /// need. They will register with this loader. Finally, calling \ref Go will
17  /// cause all the spectra to be filled at once. After this the loader may not
18  /// be used again.
20  {
21  public:
22  SpectrumLoader(const std::string& wildcard, DataSource src = kBeam, int max = 0);
23  SpectrumLoader(const std::vector<std::string>& fnames,
24  DataSource src = kBeam, int max = 0);
25  /// Named constructor for SAM projects
26  static SpectrumLoader FromSAMProject(const std::string& proj,
27  DataSource src = kBeam,
28  int fileLimit = -1);
29  virtual ~SpectrumLoader();
30 
31  virtual void Go() override;
32 
33  protected:
35 
36  // Move operations
37  SpectrumLoader(SpectrumLoader&&) = default;
39 
40  // No copy operations because I don't want to deal with pointers
41  SpectrumLoader(const SpectrumLoader&) = delete;
42  SpectrumLoader& operator=(const SpectrumLoader&) = delete;
43 
44  virtual void HandleFile(TFile* f, Progress* prog = 0);
45 
46  virtual void HandleRecord(caf::SRSpillProxy* sr);
47 
48  /// Save accumulated exposures into the individual spectra
49  virtual void StoreExposures();
50 
51  /// All unique cuts contained in fHistDefs
52  // std::vector<Cut> fAllCuts;
53  // std::vector<double> fLivetimeByCut; ///< Indexing matches fAllCuts
54  // std::vector<double> fPOTByCut; ///< Indexing matches fAllCuts
56  };
57 }
virtual void StoreExposures()
Save accumulated exposures into the individual spectra.
int max_entries
All unique cuts contained in fHistDefs.
SpectrumLoader(const std::string &wildcard, DataSource src=kBeam, int max=0)
process_name opflashCryoW ana
SpectrumLoader & operator=(SpectrumLoader &&)=default
DataSource
Is this data-file representing beam spills or cosmic spills?
caf::Proxy< caf::StandardRecord > SRSpillProxy
Definition: EpilogFwd.h:3
virtual void HandleRecord(caf::SRSpillProxy *sr)
virtual void Go() override
Load all the registered spectra.
static SpectrumLoader FromSAMProject(const std::string &proj, DataSource src=kBeam, int fileLimit=-1)
Named constructor for SAM projects.
Base class for the various types of spectrum loader.
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
A simple ascii-art progress bar.
Definition: Progress.h:9
virtual void HandleFile(TFile *f, Progress *prog=0)
prog
Definition: just_cmake.sh:3