LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
RawDataDrawer.h
Go to the documentation of this file.
1 #ifndef EVD_RAWDATADRAWER_H
5 #define EVD_RAWDATADRAWER_H
6 
7 namespace fhicl {
8  class ParameterSet;
9 }
10 
11 #include "larcoreobj/SimpleTypesAndConstants/geo_types.h" // geo::PlaneID
12 
13 #include <vector>
14 
15 #ifndef __CINT__
16 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h" // lariov::ChannelStatusProvider::Status_t
17 #endif
18 
19 namespace art {
20  class Event;
21 }
22 
23 class TH1F;
24 class TVirtualPad;
25 namespace detinfo {
26  class DetectorPropertiesData;
27 }
28 namespace evdb {
29  class View2D;
30 }
31 namespace raw {
32  class RawDigit;
33 }
34 namespace util {
35  class PlaneDataChangeTracker_t;
36 } // namespace util
37 
38 namespace evd {
39 
40  namespace details {
41  class RawDigitCacheDataClass;
43  typedef ::util::PlaneDataChangeTracker_t CacheID_t;
44  } // namespace details
45 
47  class RawDataDrawer {
48  public:
49  RawDataDrawer();
50  ~RawDataDrawer();
51 
73  void RawDigit2D(art::Event const& evt,
74  detinfo::DetectorPropertiesData const& detProp,
75  evdb::View2D* view,
76  unsigned int plane,
77  bool bZoomToRoI = false);
78 
79  void FillQHisto(const art::Event& evt, unsigned int plane, TH1F* histo);
80 
81  void FillTQHisto(const art::Event& evt, unsigned int plane, unsigned int wire, TH1F* histo);
82 
83  double StartTick() const { return fStartTick; }
84  double TotalClockTicks() const { return fTicks; }
85 
87  void ExtractRange(TVirtualPad* pPad, std::vector<double> const* zoom = nullptr);
88 
90  void SetDrawingLimits(float low_wire, float high_wire, float low_tdc, float high_tdc);
91 
92  int GetRegionOfInterest(int plane, int& minw, int& maxw, int& mint, int& maxt);
93 
95  void ResetRegionOfInterest();
96 
99  bool hasRegionOfInterest(geo::PlaneID::PlaneID_t plane) const;
100 
101  void GetChargeSum(int plane, double& charge, double& convcharge);
102 
103  private:
104  struct BoxInfo_t {
105  int adc = 0;
106  bool good = false;
107  };
108 
110  unsigned int width = 0; // width of pad in pixels
111  unsigned int height = 0; // heigt of pad in pixels
112 
114  bool isFilled() const { return (width != 0) && (height != 0); }
115 
117  operator bool() const { return isFilled(); }
118 
119  };
120 
122  class OperationBaseClass;
123  class ManyOperations;
124  class BoxDrawer;
126 
127  // Since this is a private facility, we indulge in non-recommended practises
128  // like friendship; these classes have the ability to write their findings
129  // directly into RawDataDrawer; the alternative would be to have an
130  // interface writing that information exposed to the public, that has the
131  // draw back that we completely lose control on who can use it.
132  // Other solutions might be also possible...
133  // but this is already more complicated than needed.
134  friend class BoxDrawer;
135  friend class RoIextractorClass;
136 
138  // Never use raw pointers. Unless you are dealing with CINT, that is.
140 
141 #ifndef __CINT__
142  void Reset(art::Event const& event);
144 
146  void GetRawDigits(art::Event const& evt);
147 
149  bool ProcessChannelWithStatus(lariov::ChannelStatusProvider::Status_t channel_status) const;
150 #endif // __CINT__
151 
152  double fStartTick;
153  double fTicks;
154 
155  std::vector<int> fWireMin;
156  std::vector<int> fWireMax;
157  std::vector<int> fTimeMin;
158  std::vector<int> fTimeMax;
159 
160  std::vector<double> fRawCharge;
161  std::vector<double> fConvertedCharge;
162 
164 
166 
167  // TODO with ROOT 6, turn this into a std::unique_ptr()
169 
171  void DrawRawDigit2D(art::Event const& evt, evdb::View2D* view, unsigned int plane);
172 
186  void GetRawDigits(art::Event const& evt, details::CacheID_t const& new_timestamp);
187 
188  // Helper functions for drawing
189  bool RunOperation(art::Event const& evt, OperationBaseClass* operation);
190  void QueueDrawingBoxes(evdb::View2D* view,
191  geo::PlaneID const& pid,
192  std::vector<BoxInfo_t> const& BoxInfo);
193  void RunDrawOperation(art::Event const& evt,
194  detinfo::DetectorPropertiesData const& detProp,
195  evdb::View2D* view,
196  unsigned int plane);
197  void RunRoIextractor(art::Event const& evt, unsigned int plane);
198  void SetDrawingLimitsFromRoI(geo::PlaneID::PlaneID_t plane);
200 
202  static std::vector<raw::RawDigit> const EmptyRawDigits;
203 
204  }; // class RawDataDrawer
205 
206 }
207 
208 #endif
209 
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:26
double fStartTick
low tick
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:464
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
details::CacheID_t * fCacheID
information about the last processed plane
bool isFilled() const
Returns whether the stored value is valid.
Raw data description.
Definition: RawTypes.h:6
Manage all things related to colors for the event display.
std::vector< double > fRawCharge
Sum of Raw Charge.
std::vector< int > fWireMin
lowest wire in interesting region for each plane
std::vector< int > fTimeMax
highest time in interesting region for each plane
double fTicks
number of ticks of the clock
LArSoft includes.
PadResolution_t PadResolution
stored pad resolution
Stores the information about the drawing area.
ntupleExperimental Reset()
parameter set interface
Cached set of RawDigitInfo_t.
std::vector< int > fWireMax
highest wire in interesting region for each plane
void SetDrawingLimitsFromRoI(geo::PlaneID const pid)
double TotalClockTicks() const
Definition: RawDataDrawer.h:84
General LArSoft Utilities.
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:481
Definition of data types for geometry description.
Detects the presence of a new event, data product or wire plane.
double StartTick() const
Definition: RawDataDrawer.h:83
Aid in the rendering of RawData objects.
Definition: RawDataDrawer.h:47
Definition: MVAAlg.h:12
static std::vector< raw::RawDigit > const EmptyRawDigits
Empty collection, used in return value of invalid digits.
details::CellGridClass * fDrawingRange
information about the viewport
std::vector< int > fTimeMin
lowest time in interesting region for each plane
::util::PlaneDataChangeTracker_t CacheID_t
Definition: RawDataDrawer.h:42
Manages a grid-like division of 2D space.
TCEvent evt
Definition: DataStructs.cxx:8
evd::details::RawDigitCacheDataClass * digit_cache
Cache of raw digits.
Event finding and building.
std::vector< double > fConvertedCharge
Sum of Charge Converted using Birks&#39; formula.