AdcChannelPlotter.h
Go to the documentation of this file.
1 // AdcChannelPlotter.h
2 
3 // David Adams
4 // August 2017
5 //
6 // Tool to plot data from an ADC channel.
7 //
8 // Either waveforms (signal vs. tick) or distributions (# tick vs signal)
9 // may be produced.
10 //
11 // Configuration:
12 // LogLevel - 0=silent, 1=init, 2=each event, >2=more
13 // HistTypes: Types of histograms to create:
14 // raw = raw data: ADC vs tick
15 // rawdist = raw data dist: # ticks vs ADC
16 // rawdistlog = raw data dist: log(# ticks) vs ADC
17 // prepared = prepared data: signal vs. tick
18 // HistName: Name for the histogram.
19 // HistTitle: Title for the histogram.
20 // RootFileName: If non-blank, histograms are written to this file.
21 // File is opened in UPDATE mode.
22 // PlotFileName: Name of the file to which plots should be saved.
23 // PlotSamMin: Min tick for raw and prepared plots.
24 // PlotSamMax: Max tick for raw and prepared plots.
25 // PlotSigOpt: Option for setting the plotted signal range:
26 // full - Full range determined from all ticks. Expanded to PlotSigMin ticks.
27 // fixed - Fixed range specified (PlotSigMin, PlotSigMax)
28 // pedestal - Fixed range around pedestal (PlotSigMin+ped, PlotSigMax+ped)
29 // PlotSigMin: - Min for signal range. See PlotSigOpt.
30 // PlotSigMax: - Max for signal range. See PlotSigOpt.
31 // PlotDistMin - Min for y-axis in rawdist plots
32 // PlotDistMax - Max for y-axis in rawdist plots
33 // ColorBad - If nonzero, color for channels flagged bad.
34 // ColorNoisy - If nonzero, color for channels flagged noisy.
35 // SkipFlags - Samples with these flags are excluded from dist plots
36 // LabelSize - Size for x and y labels and titles. This is fraction of the pad size.
37 // Default of 0 ==> Root's 0.035 which can be tiny for many vertical suppads.
38 // The following subsitutions are made in the names:
39 // %RUN% - run number
40 // %SUBRUN% - event number
41 // %EVENT% - event number
42 // %CHAN% - channel number
43 // %TYPE% - histogram type (see HistTypes)
44 //
45 // Datamapp returned by call to view includes:
46 // TH1 HHH - The waveform histogram (HHH = HistName in configuration)
47 // float plotSigMin_HHH - min value for the histogram
48 // float plotSigMax_HHH - max value for the histogram
49 
50 #ifndef AdcChannelPlotter_H
51 #define AdcChannelPlotter_H
52 
54 #include "fhiclcpp/ParameterSet.h"
56 #include <string>
57 #include <vector>
58 #include <map>
59 #include <set>
60 
62 namespace lariov {
63  class ChannelStatusProvider;
64 }
65 class TH1;
66 
68 
69 public:
70 
72 
74 
75  DataMap view(const AdcChannelData& acd) const override;
76  DataMap viewMap(const AdcChannelDataMap& acds) const override;
77  bool updateWithView() const override { return true; }
78 
79 private:
80 
81  using Name = std::string;
82  using NameVector = std::vector<Name>;
83  using Index = unsigned int;
84  using IndexVector = std::vector<Index>;
85  using IndexSet = std::set<Index>;
86 
87  // Configuration data.
94  Index m_PlotSamMin; // Tick range to plot.
97  float m_PlotSigMin;
98  float m_PlotSigMax;
103  float m_LabelSize;
105 
106  // ADC string tool.
108 
109  // Channel status provider.
111 
112  // Derived from config.
114 
115  // Make replacements in a name.
116  Name nameReplace(Name name, const AdcChannelData& acd, Name type) const;
117 
118  using HistMap = std::map<Name, TH1*>;
119 
120  class State {
121  public:
123  };
124  mutable State m_state;
125  State& getState() const { return m_state; }
126 
127 };
128 
129 
130 #endif
static QCString name
Definition: declinfo.cpp:673
State & getState() const
const AdcChannelStringTool * m_adcStringBuilder
const lariov::ChannelStatusProvider * m_pChannelStatusProvider
unsigned int Index
std::string string
Definition: nybbler.cc:12
std::vector< Index > IndexVector
std::set< Index > IndexSet
Class providing information about the quality of channels.
static constexpr double ps
Definition: Units.h:99
Filters for channels, events, etc.
std::vector< Name > NameVector
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
std::map< Name, TH1 * > HistMap
bool updateWithView() const override