ra4_draw  4bd0201e3d922d42bd545d4b045ed44db33454a4
event_scan.hpp
Go to the documentation of this file.
1 #ifndef H_EVENT_SCAN
2 #define H_EVENT_SCAN
3 
4 #include <memory>
5 #include <vector>
6 #include <string>
7 #include <fstream>
8 
9 #include "core/figure.hpp"
10 #include "core/process.hpp"
11 
12 class EventScan final : public Figure{
13  public:
14  class SingleScan final : public Figure::FigureComponent{
15  public:
16  SingleScan(const EventScan &event_scan,
17  const std::shared_ptr<Process> &process);
18  ~SingleScan() = default;
19 
20  void RecordEvent(const Baby &baby) final;
21 
22  void Precision(unsigned precision);
23 
24  private:
25  SingleScan() = delete;
26  SingleScan(const SingleScan &) = delete;
27  SingleScan& operator=(const SingleScan &) = delete;
28  SingleScan(SingleScan &&) = delete;
29  SingleScan& operator=(SingleScan &&) = delete;
30 
31  std::ofstream out_;
34  std::vector<NamedFunc::VectorType> val_vectors_;
35  std::size_t row_;
36  };
37 
38  EventScan(const std::string &name,
39  const NamedFunc &cut,
40  const std::vector<NamedFunc> &columns,
41  const std::vector<std::shared_ptr<Process> > &processes,
42  unsigned precision = 10);
43  EventScan(EventScan &&) = default;
44  EventScan& operator=(EventScan &&) = default;
45  ~EventScan() = default;
46 
47  void Print(double luminosity,
48  const std::string &subdir) final;
49 
50  std::set<const Process*> GetProcesses() const final;
51 
52  FigureComponent * GetComponent(const Process *process) final;
53 
54  unsigned Precision() const;
55  EventScan & Precision(unsigned precision);
56 
57  std::string name_;
60 
61  private:
62  std::vector<std::unique_ptr<SingleScan> > scans_;
63  unsigned precision_;
64  unsigned width_;
65 
66  EventScan(const EventScan &) = delete;
67  EventScan& operator=(const EventScan &) = delete;
68  EventScan() = delete;
69 };
70 
71 #endif
~EventScan()=default
unsigned precision_
Decimal places to print.
Definition: event_scan.hpp:63
std::vector< ScalarType > VectorType
Definition: named_func.hpp:16
std::set< const Process * > GetProcesses() const final
Definition: event_scan.cpp:104
Abstract base class for access to ntuple variables.
Definition: baby.hpp:16
STL namespace.
Combines a callable function taking a Baby and returning a scalar or vector with its string represent...
Definition: named_func.hpp:13
EventScan()=delete
void RecordEvent(const Baby &baby) final
Definition: event_scan.cpp:23
FigureComponent * GetComponent(const Process *process) final
Definition: event_scan.cpp:112
void Print(double luminosity, const std::string &subdir) final
Definition: event_scan.cpp:97
std::vector< NamedFunc::VectorType > val_vectors_
Values for each column (to avoid creating new vectors each event)
Definition: event_scan.hpp:34
std::ofstream out_
File to which results are printed.
Definition: event_scan.hpp:31
void Precision(unsigned precision)
Definition: event_scan.cpp:77
NamedFunc cut_
Cut restricting printed events/objects.
Definition: event_scan.hpp:58
SingleScan & operator=(const SingleScan &)=delete
NamedFunc::VectorType cut_vector_
Cut results (to avoid creating new vector each event)
Definition: event_scan.hpp:33
std::vector< std::unique_ptr< SingleScan > > scans_
One scan for each process.
Definition: event_scan.hpp:62
unsigned width_
Width of column in characters. Determined from precision.
Definition: event_scan.hpp:64
std::string name_
Name of scan for saving to file.
Definition: event_scan.hpp:57
std::vector< NamedFunc > columns_
Variables to print.
Definition: event_scan.hpp:59
NamedFunc full_cut_
Cached scan&&process cut.
Definition: event_scan.hpp:32