SpectrumLoader.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 class TFile;
6 
8 
9 namespace ana
10 {
11  class Progress;
12 
13  /// \brief Collaborates with \ref Spectrum and \ref OscillatableSpectrum to
14  /// fill spectra from CAF files.
15  ///
16  /// The outside user should just pass a filename, wildcard, SAM dataset name,
17  /// or query to the constructor. Then construct all the spectra you
18  /// need. They will register with this loader. Finally, calling \ref Go will
19  /// cause all the spectra to be filled at once. After this the loader may not
20  /// be used again.
22  {
23  public:
25  SpectrumLoader(const std::vector<std::string>& fnames,
26  DataSource src = kBeam);
27  /// Named constructor for SAM projects
29  DataSource src = kBeam,
30  int fileLimit = -1);
31 
32  // Move operations
33  SpectrumLoader(SpectrumLoader&&) = default;
35 
36  virtual ~SpectrumLoader();
37 
38  virtual void Go() override;
39 
40  protected:
42 
43  // No copy operations because I don't want to deal with pointers
44  SpectrumLoader(const SpectrumLoader&) = delete;
45  SpectrumLoader& operator=(const SpectrumLoader&) = delete;
46 
47  void AccumulateExposures(const caf::SRSpillProxy* spill) override;
48 
49  virtual void HandleFile(TFile* f, Progress* prog = 0);
50 
51  virtual void HandleRecord(caf::SRProxy* sr);
52 
53  /// Save results of AccumulateExposures into the individual spectra
54  void StoreExposures();
55 
56  /// Prints POT/livetime info for all spectra
57  virtual void ReportExposures();
58 
59  /// All unique cuts contained in fHistDefs
60  std::vector<Cut> fAllCuts;
61  std::vector<double> fLivetimeByCut; ///< Indexing matches fAllCuts
62  std::vector<double> fPOTByCut; ///< Indexing matches fAllCuts
63  };
64 }
void StoreExposures()
Save results of AccumulateExposures into the individual spectra.
std::vector< double > fLivetimeByCut
Indexing matches fAllCuts.
Cuts and Vars for the 2020 FD DiF Study.
Definition: CutFlow_header.h:5
SpectrumLoader(const std::string &wildcard, DataSource src=kBeam)
Proxy for caf::StandardRecord.
Definition: SRProxy.h:1969
void AccumulateExposures(const caf::SRSpillProxy *spill) override
SpectrumLoader & operator=(SpectrumLoader &&)=default
virtual void ReportExposures()
Prints POT/livetime info for all spectra.
std::vector< double > fPOTByCut
Indexing matches fAllCuts.
std::vector< std::string > wildcard(const std::string &wildcardString)
Definition: convert.C:9
DataSource
Is this data-file representing beam spills or cosmic spills?
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.
fileLimit
Definition: ProjMan.py:109
Base class for the various types of spectrum loader.
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
virtual void HandleRecord(caf::SRProxy *sr)
Float_t proj
Definition: plot.C:35
A simple ascii-art progress bar.
Definition: Progress.h:9
virtual void HandleFile(TFile *f, Progress *prog=0)
std::vector< Cut > fAllCuts
All unique cuts contained in fHistDefs.
static constexpr Double_t sr
Definition: Munits.h:164