AdcDetectorPlotter.h
Go to the documentation of this file.
1 // AdcDetectorPlotter.h
2 
3 // David Adams
4 // March 2018
5 //
6 // Tool to make detector-wide event displays of data from an ADC channel data maps.
7 //
8 // Configuration:
9 // LogLevel - 0=silent, 1=init, 2=each event, >2=more
10 // WireAngle - Include wires with this angle (for protoDUNE, 0, +/-0.623)
11 // DataType - Which data to plot: 0=prepared, 1=raw-pedestal
12 // Tick0 - Tick used as t = 0 for drift calculations.
13 // DriftSpeed - Drift speed in cm/tick.
14 // XMin, XMax - Plot limits for the drift coordinate
15 // ZMin, ZMax - Plot limits for the wire coordinate
16 // SignalThreshold - Signals in a channel-tick bin above this value are plotted
17 // SkipBadChannels - If true, skip channels flagged as bad.
18 // ShowAllTicks - If true, ticks outside the nominal drift volume are displayed.
19 // FirstTick - First tick number to display
20 // LastTick - Last+1 tick number to display
21 // ShowWires - Also show anode wires on the plot.
22 // ShowCathode - Also show cathode planes (one point for each wire) on the plot.
23 // ShowTpcSets - If not empty, only show wires and cathodes for these TPC sets.
24 // ShowGrid - Also show (Root default) grid.
25 // Title - Title at top of plot (part of graph)
26 // PlotTitle - Plot title (appears in lower left corner)
27 // FileName - Name for output plot file.
28 // If blank, no file is written.
29 // Existing file with the same name is replaced.
30 // For the title and file names, the following sustitutions are made:
31 // %RUN% --> run number
32 // %SUBRUN% --> subrun number
33 // %EVENT% --> event number
34 // %PAT% --> pattern passed in call to view
35 //
36 // This is an example of a stateful tool, i.e. one that carries state beyond
37 // its configuration and configuration-derived data. This state is all held
38 // in the subclass State which is mutable so the view method can remain const.
39 // In a multithreaded environment, we will need to guard against access
40 // from multiple threads, e.g. may want a separate data thread.
41 //
42 // The tool creates a 2D plot of wire vs. drift coordinate and adds a point for
43 // each selected wire and its reflection on the cathode. It also adds points for
44 // each ADC wire-tick point with signal above threshold. The ADC data from the
45 // preceding calls are retained if the event (run, subrun and event number) are
46 // unchanged.
47 
48 #ifndef AdcDetectorPlotter_H
49 #define AdcDetectorPlotter_H
50 
52 #include "fhiclcpp/ParameterSet.h"
56 #include <memory>
57 #include "TLatex.h"
58 
59 namespace geo {
60  class GeometryCore;
61 }
62 namespace lariov {
63  class ChannelStatusProvider;
64 }
65 
67 
69 
70 public:
71 
72  using Index = unsigned int;
73  using IndexVector = std::vector<Index>;
74  using TPadManipulatorPtr = std::unique_ptr<TPadManipulator>;
75  using TLatexPtr = std::unique_ptr<TLatex>;
76 
77  class State {
78  public:
79  geo::GeometryCore* pgeo =nullptr; // Geometry
80  Index jobCount =0; // # calls for the job
81  Index reportCount =0; // # calls for the current report
82  Index channelCount =0; // # channels in the current report
83  Index run =0;
84  Index subrun =0;
85  Index event =0;
89  TLatexPtr pttl = nullptr;
90  };
91 
92  using StatePtr = std::shared_ptr<State>;
93 
95 
96  ~AdcDetectorPlotter() override =default;
97 
98  // AdcChannelTool interface.
99  DataMap viewMap(const AdcChannelDataMap& acds) const override;
100  bool updateWithView() const override { return true; }
101  DataMap endEvent(const DuneEventInfo&) const override;
102 
103  int addChannel(const AdcChannelData& acd, double xfac) const;
104 
105  // Return the state.
106  // Shared pointer so we can make sure only one reference is out at a time.
107  StatePtr getState() const { return m_state; }
108  //StatePtr getState() const { return const_cast<StatePtr&>(m_state); }
109 
110  // Initialize the tool.
111  void initialize();
112 
113 private:
114 
115  // Configuration data.
117  float m_WireAngle;
119  float m_Tick0;
121  float m_XMin;
122  float m_XMax;
123  float m_ZMin;
124  float m_ZMax;
137 
138  // Derived configuration.
140 
142 
143  // ADC string tool.
145 
146 };
147 
148 
149 #endif
unsigned int Index
const lariov::ChannelStatusProvider * m_pChannelStatusProvider
std::string string
Definition: nybbler.cc:12
std::shared_ptr< State > StatePtr
std::unique_ptr< TPadManipulator > TPadManipulatorPtr
StatePtr getState() const
const AdcChannelStringTool * m_adcStringBuilder
Class providing information about the quality of channels.
static constexpr double ps
Definition: Units.h:99
Description of geometry of one entire detector.
bool updateWithView() const override
std::unique_ptr< TLatex > TLatexPtr
Filters for channels, events, etc.
std::vector< Index > IndexVector
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
LArSoft geometry interface.
Definition: ChannelGeo.h:16