LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
RawDataDrawer.h
Go to the documentation of this file.
1 #ifndef EVD_RAWDATADRAWER_H
5 #define EVD_RAWDATADRAWER_H
6 
7 #include "larcoreobj/SimpleTypesAndConstants/geo_types.h" // geo::PlaneID
8 
9 #include <vector>
10 #ifndef __CINT__
11 
12 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h" // lariov::ChannelStatusProvider::Status_t
13 
14 #endif
15 
16 class TH1F;
17 class TVirtualPad;
18 namespace art { class Event; }
19 namespace evdb { class View2D; }
20 namespace evdb { class View3D; }
21 namespace raw { class RawDigit; }
22 namespace lar {
23  namespace util {
24  template <typename T> class MinMaxCollector;
25  }
26 }
27 namespace util {
28  class PlaneDataChangeTracker_t;
29 } // namespace util
30 
31 namespace evd {
32 
33  namespace details {
34  class RawDigitCacheDataClass;
36  typedef ::util::PlaneDataChangeTracker_t CacheID_t;
37  } // namespace details
38 
40  class RawDataDrawer {
41  public:
42 
43  RawDataDrawer();
44  ~RawDataDrawer();
45 
67  void RawDigit2D(
68  art::Event const& evt, evdb::View2D* view, unsigned int plane,
69  bool bZoomToRoI = false
70  );
71 
72 /* void RawDigit3D(const art::Event& evt, */
73 /* evdb::View3D* view); */
74 
75  void FillQHisto(const art::Event& evt,
76  unsigned int plane,
77  TH1F* histo);
78 
79  void FillTQHisto(const art::Event& evt,
80  unsigned int plane,
81  unsigned int wire,
82  TH1F* histo);
83 
84  double StartTick() const { return fStartTick; }
85  double TotalClockTicks() const { return fTicks; }
86 
88  void ExtractRange
89  (TVirtualPad* pPad, std::vector<double> const* zoom = nullptr);
90 
92  void SetDrawingLimits
93  (float low_wire, float high_wire, float low_tdc, float high_tdc);
94 
95  int GetRegionOfInterest(int plane,
96  int& minw,
97  int& maxw,
98  int& mint,
99  int& maxt);
100 
102  void ResetRegionOfInterest();
103 
106  bool hasRegionOfInterest(geo::PlaneID::PlaneID_t plane) const;
107 
108  void GetChargeSum(int plane,
109  double& charge,
110  double& convcharge);
111 
112  private:
113  typedef struct {
114  int adc = 0;
115  bool good = false;
116  } BoxInfo_t;
117 
118  typedef struct {
119  unsigned int width = 0; // width of pad in pixels
120  unsigned int height = 0; // heigt of pad in pixels
121 
123  bool isFilled() const { return (width != 0) && (height != 0); }
124 
126  operator bool() const { return isFilled(); }
127 
128  } PadResolution_t;
129 
131  class OperationBaseClass;
132  class ManyOperations;
133  class BoxDrawer;
135 
136  // Since this is a private facility, we indulge in non-recommended practises
137  // like friendship; these classes have the ability to write their findings
138  // directly into RawDataDrawer; the alternative would be to have an
139  // interface writing that information exposed to the public, that has the
140  // draw back that we completely lose control on who can use it.
141  // Other solutions might be also possible...
142  // but this is already more complicated than needed.
143  friend class BoxDrawer;
144  friend class RoIextractorClass;
145 
147  // Never use raw pointers. Unless you are dealing with CINT, that is.
149 
150 #ifndef __CINT__
151  void Reset(art::Event const& event);
153 
155  void GetRawDigits(art::Event const& evt);
156 
158  bool ProcessChannelWithStatus
159  (lariov::ChannelStatusProvider::Status_t channel_status) const;
160 #endif // __CINT__
161 
162  double fStartTick;
163  double fTicks;
164 
165  std::vector<int> fWireMin;
166  std::vector<int> fWireMax;
167  std::vector<int> fTimeMin;
168  std::vector<int> fTimeMax;
169 
170  std::vector<double> fRawCharge;
171  std::vector<double> fConvertedCharge;
172 
174 
176 
177  // TODO with ROOT 6, turn this into a std::unique_ptr()
179 
181  void DrawRawDigit2D
182  (art::Event const& evt, evdb::View2D* view, unsigned int plane);
183 
197  void GetRawDigits
198  (art::Event const& evt, details::CacheID_t const& new_timestamp);
199 
200  // Helper functions for drawing
201  bool RunOperation(art::Event const& evt, OperationBaseClass* operation);
202  void QueueDrawingBoxes(
203  evdb::View2D* view,
204  geo::PlaneID const& pid,
205  std::vector<BoxInfo_t> const& BoxInfo
206  );
207  void RunDrawOperation
208  (art::Event const& evt, evdb::View2D* view, unsigned int plane);
209  void RunRoIextractor(art::Event const& evt, unsigned int plane);
210  void SetDrawingLimitsFromRoI(geo::PlaneID::PlaneID_t plane);
212  { SetDrawingLimitsFromRoI(pid.Plane); }
213 
215  static std::vector<raw::RawDigit> const EmptyRawDigits;
216 
217  }; // class RawDataDrawer
218 
219 
220 }
221 
222 #endif
223 
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:17
double fStartTick
low tick
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
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
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:251
double fTicks
number of ticks of the clock
LArSoft includes.
PadResolution_t PadResolution
stored pad resolution
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:85
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:258
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:84
LArSoft-specific namespace.
Aid in the rendering of RawData objects.
Definition: RawDataDrawer.h:40
HLT enums.
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:35
Manages a grid-like division of 2D space.
TCEvent evt
Definition: DataStructs.cxx:5
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.