CSVMaker.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <fstream>
4 #include <memory>
5 
7 
9 
10 namespace ana
11 {
12 
13 class CSVMaker : public SpectrumLoader
14 {
15 public:
16  typedef std::pair<std::string, Var> NamedVar;
17  typedef std::pair<std::string, MultiVar> NamedMultiVar;
18 
19 protected:
20  std::unique_ptr<Cut> cut;
21  std::ofstream ofile;
22 
23  std::vector<NamedVar> vars;
24  std::vector<NamedMultiVar> multiVars;
25 
26  void printHeader();
27  void printRow(caf::SRProxy* sr);
28 
29  void HandleRecord(caf::SRProxy* sr) override;
30 
31 public:
32  CSVMaker(const std::string &input, const std::string &output);
33 
34  void setPrecision(int precision);
35 
36  void addVar (const std::string &name, const Var &var);
37  void addMultiVar(const std::string &name, const MultiVar &multiVar);
38 
39  void addVars (const std::vector<NamedVar> &vars);
40  void addMultiVars(const std::vector<NamedMultiVar> &multiVars);
41 
42  void setCut(const Cut &cut);
43 
44  void Go() override;
45 };
46 
47 }
const XML_Char * name
Definition: expat.h:151
ofstream output
void setCut(const Cut &cut)
Definition: CSVMaker.cxx:132
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::vector< NamedMultiVar > multiVars
Definition: CSVMaker.h:24
void printHeader()
Definition: CSVMaker.cxx:63
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
void addMultiVars(const std::vector< NamedMultiVar > &multiVars)
Definition: CSVMaker.cxx:125
std::ofstream ofile
Definition: CSVMaker.h:21
void setPrecision(int precision)
Definition: CSVMaker.cxx:58
std::vector< NamedVar > vars
Definition: CSVMaker.h:23
std::pair< std::string, Var > NamedVar
Definition: CSVMaker.h:16
caf::StandardRecord * sr
std::unique_ptr< Cut > cut
Definition: CSVMaker.h:20
void addMultiVar(const std::string &name, const MultiVar &multiVar)
Definition: CSVMaker.cxx:115
void addVar(const std::string &name, const Var &var)
Definition: CSVMaker.cxx:110
std::pair< std::string, MultiVar > NamedMultiVar
Definition: CSVMaker.h:17
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
CSVMaker(const std::string &input, const std::string &output)
Definition: CSVMaker.cxx:48
void printRow(caf::SRProxy *sr)
Definition: CSVMaker.cxx:81
void Go() override
Load all the registered spectra.
Definition: CSVMaker.cxx:150
void addVars(const std::vector< NamedVar > &vars)
Definition: CSVMaker.cxx:120
void HandleRecord(caf::SRProxy *sr) override
Definition: CSVMaker.cxx:137
enum BeamMode string