AdcDataPlotter.h
Go to the documentation of this file.
1 // AdcDataPlotter.h
2 
3 // David Adams
4 // July 2017
5 //
6 // Tool to make channel vs. tick displays of data from an ADC channel data map.
7 //
8 // Configuration:
9 // LogLevel - 0=silent, 1=init, 2=each event, >2=more
10 // DataType - Which data to plot: 0=prepared, 1=raw-pedestal, 2=signal, 3=not signal
11 // DataView - Which view to use: "" for top, xxx merges everything from xxx
12 // TickRange - Name of the tick range used in the display
13 // The name must be defined in the IndexRangeTool tickRanges
14 // If blank or not defined, the full range is used.
15 // TickRebin - If > 1, histo bins include this # ticks.
16 // ChannelRanges - Names of channel ranges to display.
17 // Ranges are obtained from the tool channelRanges.
18 // Special name "" or "data" plots all channels in data with label "All data".
19 // If the list is empty, data are plotted.
20 // ClockFactor - Clock to tick conversion factor (0.04 for protoDUNE).
21 // ClockOffset - Clock offset between trigger and nominal tick 0.
22 // FembTickOffsets - Tick offset for each FEMB. FEMB = (offline channel)/128
23 // Offset is zero for FEMBs beyond range.
24 // Values should be zero (empty array) for undistorted plots
25 // OnlineChannelMapTool - Name of tool mapping channel # to online channel #.
26 // MinSignal - Formula for min signal. If absent, -(max signal) is used.
27 // MaxSignal - Formula for max signal. Displayed signal range is (min signal, max signal)
28 // SkipBadChannels - If true, skip channels flagged as bad.
29 // SkipChannelStatus - Channel status values to skip (none if empty).
30 // EmptyColor - If >=0, empty bins are drawn in this color (See TAttColor).
31 // Otherwise empty bins are drawn with value zero.
32 // Bins may be empty if a channel is nor processed, if a tick out of range
33 // or a tick is not selected (outside ROI) for DataType 2.
34 // EmptyColor is not used when rebinning.
35 // ChannelLineModulus - Repeat spacing for horizontal lines
36 // ChannelLinePattern - Pattern for horizontal lines
37 // HistName - Histogram name (should be unique within Root file)
38 // HistTitle - Histogram title (appears above histogram)
39 // PlotTitle - Plot title (appears below histogram an only on plots)
40 // PlotSizeX, PlotSizeY: Size in pixels of the plot file.
41 // Root default (700x500?) is used if either is zero.
42 // PlotFileName - Name for output plot file.
43 // If blank, no file is written.
44 // Existing file with the same name is replaced.
45 // RootFileName - Name for the output root file.
46 // If blank, histograms are not written out.
47 // Existing file with the same is updated.
48 // For the title and file names, substitutions are made with adcStringBuilder, e.g.
49 // %RUN% --> run number
50 // %SUBRUN% --> subrun number
51 // %EVENT% --> event number
52 // %CHAN1% --> First channel number
53 // %CHAN2% --> Last channel number
54 // Drawings may include horizontal lines intended to show boundaries of APAs,
55 // FEMBs, wire planes, etc.
56 //
57 // Lines are draw at N*ChannelLineModulus + ChannelLinePattern[i] for any
58 // integer N and any value if i in range of the array which are within
59 // the drawn channel range.
60 // If ChannelLineModulus is zero, then lines are drawn for the channels in
61 // ChannelLinePattern.
62 //
63 // If FirstChannel < LastChannel, then only channels in that range are displayed
64 // and no histogram is produced if the passed data has no channels in the range.
65 //
66 // If ClockFactor > 0, then tick + ClockFactor*(channelClock - triggerClock + ClockOffset)
67 // is used in place of tick.
68 
69 #ifndef AdcDataPlotter_H
70 #define AdcDataPlotter_H
71 
73 #include "fhiclcpp/ParameterSet.h"
77 #include <vector>
78 #include <memory>
79 
81 class IndexMapTool;
82 class IndexRangeTool;
83 namespace lariov {
84  class ChannelStatusProvider;
85 }
86 class RunDataTool;
87 
89 
90 public:
91 
92  using Index = unsigned int;
93  using IndexVector = std::vector<Index>;
94  using IntVector = std::vector<int>;
95  using IndexRangeVector = std::vector<IndexRange>;
96  using Name = std::string;
97  using NameVector = std::vector<Name>;
98 
100 
101  ~AdcDataPlotter() override =default;
102 
103  DataMap viewMap(const AdcChannelDataMap& acds) const override;
104  bool updateWithView() const override { return true; }
105 
106 private:
107 
108  // Configuration data.
133 
134  // Derived configuration data.
137 
138  // Channel ranges.
140 
141  // Client tools and services.
145 
146  // Make replacements in a name.
147  Name nameReplace(Name name, const AdcChannelData& acd, const IndexRange& ran) const;
148 
149 };
150 
151 
152 #endif
static QCString name
Definition: declinfo.cpp:673
IndexVector m_SkipChannelStatus
unsigned int Index
std::string string
Definition: nybbler.cc:12
IndexVector m_ChannelLinePattern
IntVector m_FembTickOffsets
IndexRange m_tickRange
Name m_OnlineChannelMapTool
std::vector< Index > IndexVector
std::string Name
bool updateWithView() const override
const AdcChannelStringTool * m_adcStringBuilder
static constexpr double ps
Definition: Units.h:99
Filters for channels, events, etc.
ParFormula * m_MinSignal
std::vector< IndexRange > IndexRangeVector
std::vector< int > IntVector
NameVector m_ChannelRanges
IndexRangeVector m_crs
ParFormula * m_MaxSignal
const RunDataTool * m_prdtool
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
const IndexMapTool * m_pOnlineChannelMapTool
std::vector< Name > NameVector
Index m_ChannelLineModulus