LArSoft  v09_93_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 
8 #include "fhiclcpp/fwd.h"
9 #include "larcoreobj/SimpleTypesAndConstants/geo_types.h" // geo::PlaneID
10 
11 #ifndef __CINT__
12 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h" // lariov::ChannelStatusProvider::Status_t
13 #endif
14 
15 #include <vector>
16 
17 class TH1F;
18 class TVirtualPad;
19 namespace detinfo {
20  class DetectorPropertiesData;
21 }
22 namespace evdb {
23  class View2D;
24 }
25 namespace raw {
26  class RawDigit;
27 }
28 namespace util {
29  class PlaneDataChangeTracker_t;
30 } // namespace util
31 
32 namespace evd {
33 
34  namespace details {
35  class RawDigitCacheDataClass;
37  typedef ::util::PlaneDataChangeTracker_t CacheID_t;
38  } // namespace details
39 
41  class RawDataDrawer {
42  public:
43  RawDataDrawer();
44  ~RawDataDrawer();
45 
67  void RawDigit2D(art::Event const& evt,
68  detinfo::DetectorPropertiesData const& detProp,
69  evdb::View2D* view,
70  unsigned int plane,
71  bool bZoomToRoI = false);
72 
73  void FillQHisto(const art::Event& evt, unsigned int plane, TH1F* histo);
74 
75  void FillTQHisto(const art::Event& evt, unsigned int plane, unsigned int wire, TH1F* histo);
76 
77  double StartTick() const { return fStartTick; }
78  double TotalClockTicks() const { return fTicks; }
79 
81  void ExtractRange(TVirtualPad* pPad, std::vector<double> const* zoom = nullptr);
82 
84  void SetDrawingLimits(float low_wire, float high_wire, float low_tdc, float high_tdc);
85 
86  int GetRegionOfInterest(int plane, int& minw, int& maxw, int& mint, int& maxt);
87 
89  void ResetRegionOfInterest();
90 
93  bool hasRegionOfInterest(geo::PlaneID::PlaneID_t plane) const;
94 
95  void GetChargeSum(int plane, double& charge, double& convcharge);
96 
97  private:
98  struct BoxInfo_t {
99  int adc = 0;
100  bool good = false;
101  };
102 
104  unsigned int width = 0; // width of pad in pixels
105  unsigned int height = 0; // heigt of pad in pixels
106 
108  bool isFilled() const { return (width != 0) && (height != 0); }
109 
111  operator bool() const { return isFilled(); }
112 
113  };
114 
116  class OperationBaseClass;
117  class ManyOperations;
118  class BoxDrawer;
120 
121  // Since this is a private facility, we indulge in non-recommended practises
122  // like friendship; these classes have the ability to write their findings
123  // directly into RawDataDrawer; the alternative would be to have an
124  // interface writing that information exposed to the public, that has the
125  // draw back that we completely lose control on who can use it.
126  // Other solutions might be also possible...
127  // but this is already more complicated than needed.
128  friend class BoxDrawer;
129  friend class RoIextractorClass;
130 
132  // Never use raw pointers. Unless you are dealing with CINT, that is.
134 
135 #ifndef __CINT__
136  void Reset(art::Event const& event);
138 
140  void GetRawDigits(art::Event const& evt);
141 
143  bool ProcessChannelWithStatus(lariov::ChannelStatusProvider::Status_t channel_status) const;
144 #endif // __CINT__
145 
146  double fStartTick;
147  double fTicks;
148 
149  std::vector<int> fWireMin;
150  std::vector<int> fWireMax;
151  std::vector<int> fTimeMin;
152  std::vector<int> fTimeMax;
153 
154  std::vector<double> fRawCharge;
155  std::vector<double> fConvertedCharge;
156 
158 
160 
161  // TODO with ROOT 6, turn this into a std::unique_ptr()
163 
165  void DrawRawDigit2D(art::Event const& evt, evdb::View2D* view, unsigned int plane);
166 
180  void GetRawDigits(art::Event const& evt, details::CacheID_t const& new_timestamp);
181 
182  // Helper functions for drawing
183  bool RunOperation(art::Event const& evt, OperationBaseClass* operation);
184  void QueueDrawingBoxes(evdb::View2D* view,
185  geo::PlaneID const& pid,
186  std::vector<BoxInfo_t> const& BoxInfo);
187  void RunDrawOperation(art::Event const& evt,
188  detinfo::DetectorPropertiesData const& detProp,
189  evdb::View2D* view,
190  unsigned int plane);
191  void RunRoIextractor(art::Event const& evt, unsigned int plane);
192  void SetDrawingLimitsFromRoI(geo::PlaneID::PlaneID_t plane);
194 
196  static std::vector<raw::RawDigit> const EmptyRawDigits;
197 
198  }; // class RawDataDrawer
199 
200 }
201 
202 #endif
203 
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()
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:78
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:77
Aid in the rendering of RawData objects.
Definition: RawDataDrawer.h:41
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:36
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.