All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TWQProjectionView.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 ///
3 /// \file TWQProjectionView.h
4 /// \brief A view showing the time vs wire, charge and charge vs time information for an event
5 /// \author brebel@fnal.gov
6 // clustering code written by ellen.klein@yale.edu
7 ////////////////////////////////////////////////////////////////////////
8 
9 #ifndef EVD_TWQPROJECTION_H
10 #define EVD_TWQPROJECTION_H
11 
12 #include "RQ_OBJECT.h"
14 #include "nuevdb/EventDisplayBase/Canvas.h"
15 namespace detinfo {
16  class DetectorClocksData;
17  class DetectorPropertiesData;
18 }
19 
20 #include <deque>
21 #include <map>
22 #include <vector>
23 
24 // Forward declarations
25 class TGCheckButton;
26 class TGCompositeFrame;
27 class TGLabel;
28 class TGMainFrame;
29 class TGNumberEntry;
30 class TGRadioButton;
31 class TGTextButton;
32 class TGTextView;
33 
34 namespace util {
35  class DataProductChangeTracker_t;
36 }
37 
38 namespace evd {
39 
40  class HeaderPad;
41  class MCBriefPad;
42  class TQPad;
43  class TWireProjPad;
44 
45  // Helper class, to store zoom settings in each view
46 
47  struct ZoomOptions {
48  std::map<int, double> wmin;
49  std::map<int, double> wmax;
50  std::map<int, double> tmin;
51  std::map<int, double> tmax;
53  };
54 
55  class TWQProjectionView : public evdb::Canvas {
56  public:
57  RQ_OBJECT("evd::TWQProjectionView")
58 
59  public:
60  TWQProjectionView(TGMainFrame* mf);
62 
63  const char*
64  Description() const
65  {
66  return "Time/Wire/Charge Projections";
67  }
68  const char*
69  PrintTag() const
70  {
71  return "twq-proj";
72  }
73 
74  void Draw(const char* opt = "");
75 
76  // void RangeChanged();
77  static void MouseDispatch(int plane, void* wqpv);
78 
79  void ChangeWire(int plane);
80  void SelectTPC(); ///< select TPC from GUI
81 
82  void SetMouseZoomRegion(int plane);
83 
84  void SelectPoint(int plane);
85  void SelectHit(int plane);
86  void SetPlaneWire();
87  void SetPlane();
88  void SetWire();
89  void SetDistance();
90  void SetThreshold();
91  void SetGreyscale();
92  void SetMCInfo();
93  void SetRawCalib();
94  void SetUpSideBar();
95  void ForceRedraw(); ///< Forces a redraw of the window
96  void SetUpZoomButtons();
97  void SetUpClusterButtons();
98  void SetUpDrawingButtons();
99  void SetUpTPCselection();
100  void SetUpPositionFind();
101  void SetZoom(int plane, int wirelow, int wirehi, int timelo, int timehi, bool StoreZoom = true);
102  void ZoomInterest(bool flag = true);
103  /// Clear all the regions of interest
104  void ResetRegionsOfInterest();
105 
106  void ZoomBack(); // Revert to the previous zoom setting
107  void SetClusterInterest();
108 
109  void SetClusters(int plane);
110 
111  void SetZoomInterest();
112  void SetZoomFromView();
113  void PrintCharge();
114  void DrawPads(const char* opt = "");
115 
116  void FindEndPoint();
117  double FindLineLength(detinfo::DetectorClocksData const& clockData,
119  void ClearEndPoints();
120  void ToggleEndPointMarkers();
121 
122  void RadioButtonsDispatch(int parameter);
123  void SaveSelection();
124  void ClearSelection();
125 
126  /// Returns if a new event is detected; if so, it also resets accordingly
127  bool OnNewEvent();
128 
129  void SetTestFlag(int number = 1);
130 
131  protected:
132  TGCompositeFrame* fVFrame; ///< needed for the side frame
133 
134  private:
135  HeaderPad* fHeaderPad; ///< Show header information
136  TQPad* fWireQ; ///< Histogram of charge vs time on selected wire
137  MCBriefPad* fMC; ///< Short summary of MC event
138  std::vector<TQPad*> fPlaneQ; ///< charge on each plane
139  std::vector<TWireProjPad*> fPlanes; ///< time vs wire projection for each plane
140 
141  double fLastThreshold; ///< Kludge to prevent double drawing when changing threshold
142 
143  TGCompositeFrame* fMetaFrame; ///< needed for the side frame
144 
145  TGLabel* fWireLabel;
146  TGLabel* fDistanceLabel;
147  TGLabel* fPlaneLabel;
148  TGLabel* fThresLabel;
149 
150  TGNumberEntry* fWireEntry; ///< Wire number displayed.
151  TGNumberEntry* fPlaneEntry; ///< Plane number displayed.
152  TGNumberEntry* fThresEntry; ///< ADC threshold to display.
153  TGNumberEntry* fDistance; ///<Distance from line to find hits in cluster
154  TGCheckButton* fGreyScale; ///< Display gray or color scale
155  TGCheckButton* fMCOn; ///< Display MC truth information
156  TGRadioButton* fRawDraw; ///< Draw Raw information only
157  TGRadioButton* fCalibDraw; ///< Draw calibrated information only
158  TGRadioButton* fRawCalibDraw; ///< Draw raw and calibrated information
159 
160  TGTextButton* fZoomInterest; ///< Zoom on iteresting region
161  TGTextButton* fUnZoomInterest; ///< Unzoom on iteresting region
162  TGTextButton* fZoomBack; ///< Unzoom on iteresting region
163  TGCheckButton* fToggleAutoZoom; ///< Toggle the autozoom setting
164  TGRadioButton* fToggleZoom; ///< Use zoom setting
165  TGRadioButton* fToggleClusters; ///< Use make cluster setting
166  TGTextView* fAngleInfo;
167 
168  TGTextButton* fFindEndpoint; ///< Calculate XYZ position of two points in wire planes
169  TGTextButton* fClearPPoints; ///< Clear current list of End Points
170  TGCheckButton* fToggleShowMarkers; ///< Toggle the ShowEndPointMarkersSetting
171  TGTextView* fXYZPosition; ///< Display the xyz position
172 
173  TGTextButton* fCalcAngle; ///<Calculate the 2D & 3D angles between lines
174  TGTextButton* fClear; ///<Clears the selected points in an event
175 
176  TGTextButton* fRedraw; ///< Button to force redraw
177 
178  TGNumberEntry* fCryoInput; ///< current cryostat
179  TGNumberEntry* fTPCInput; ///< current TPC
180  TGLabel* fTotalTPCLabel; ///< total TPCs in the current cryostat
181 
182  int DrawLine(int plane, util::PxLine& pline);
183 
184  std::deque<util::PxPoint>
185  ppoints; ///< list of points in each WireProjPad used for x,y,z finding
186  std::deque<util::PxLine>
187  pline; ///< list of lines in each WireProjPad used for calculating 2d and 3d angles, also making seeds (eventually)
188 
189  std::vector<util::PxLine>
190  seedlines; ///< list of lines in each WireProjPad used for calculating 2d and 3d angles, also making seeds (eventually)
191 
193  std::vector<ZoomOptions> fPrevZoomOpt;
194 
195  bool isZoomAutomatic; ///< true if user did not ask for custom zoom
196 
197  util::DataProductChangeTracker_t* fLastEvent; ///< keeps track of latest event
198 
199  /// Records whether we are automatically zooming to the region of interest
200  void SetAutomaticZoomMode(bool bSet = true);
201 
202  /// Returns a string visualizing the total number of elements
203  static std::string TotalElementsString(unsigned int NElements);
204  };
205 
206 } // namespace
207 
208 #endif //EVD_TWQPROJECTION_H
std::vector< ZoomOptions > fPrevZoomOpt
TGNumberEntry * fCryoInput
current cryostat
TGRadioButton * fToggleClusters
Use make cluster setting.
HeaderPad * fHeaderPad
Show header information.
std::deque< util::PxLine > pline
list of lines in each WireProjPad used for calculating 2d and 3d angles, also making seeds (eventuall...
const char * Description() const
void SetMouseZoomRegion(int plane)
int DrawLine(int plane, util::PxLine &pline)
void SetTestFlag(int number=1)
TGTextButton * fCalcAngle
Calculate the 2D &amp; 3D angles between lines.
then echo unknown compiler flag
TGTextButton * fZoomBack
Unzoom on iteresting region.
double fLastThreshold
Kludge to prevent double drawing when changing threshold.
Detects the presence of a new event or data product.
TGTextButton * fZoomInterest
Zoom on iteresting region.
bool isZoomAutomatic
true if user did not ask for custom zoom
void ForceRedraw()
Forces a redraw of the window.
TGNumberEntry * fTPCInput
current TPC
TGCheckButton * fToggleShowMarkers
Toggle the ShowEndPointMarkersSetting.
TQPad * fWireQ
Histogram of charge vs time on selected wire.
TGTextView * fXYZPosition
Display the xyz position.
const char * PrintTag() const
TGNumberEntry * fDistance
Distance from line to find hits in cluster.
std::deque< util::PxPoint > ppoints
list of points in each WireProjPad used for x,y,z finding
TGTextButton * fFindEndpoint
Calculate XYZ position of two points in wire planes.
TGRadioButton * fRawCalibDraw
Draw raw and calibrated information.
std::vector< TQPad * > fPlaneQ
charge on each plane
void SetAutomaticZoomMode(bool bSet=true)
Records whether we are automatically zooming to the region of interest.
std::map< int, double > wmin
TWQProjectionView(TGMainFrame *mf)
TGCheckButton * fToggleAutoZoom
Toggle the autozoom setting.
TGCompositeFrame * fMetaFrame
needed for the side frame
TGTextButton * fClear
Clears the selected points in an event.
TGTextButton * fClearPPoints
Clear current list of End Points.
TGRadioButton * fToggleZoom
Use zoom setting.
void ResetRegionsOfInterest()
Clear all the regions of interest.
TGLabel * fTotalTPCLabel
total TPCs in the current cryostat
TGTextButton * fRedraw
Button to force redraw.
TGCompositeFrame * fVFrame
needed for the side frame
void Draw(const char *opt="")
TGNumberEntry * fThresEntry
ADC threshold to display.
double FindLineLength(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp)
void SelectTPC()
select TPC from GUI
std::vector< util::PxLine > seedlines
list of lines in each WireProjPad used for calculating 2d and 3d angles, also making seeds (eventuall...
bool OnNewEvent()
Returns if a new event is detected; if so, it also resets accordingly.
void DrawPads(const char *opt="")
TGRadioButton * fCalibDraw
Draw calibrated information only.
std::map< int, double > wmax
void ZoomInterest(bool flag=true)
TGRadioButton * fRawDraw
Draw Raw information only.
TGTextButton * fUnZoomInterest
Unzoom on iteresting region.
void RadioButtonsDispatch(int parameter)
TGNumberEntry * fPlaneEntry
Plane number displayed.
Contains all timing reference information for the detector.
static std::string TotalElementsString(unsigned int NElements)
Returns a string visualizing the total number of elements.
static void MouseDispatch(int plane, void *wqpv)
TGCheckButton * fMCOn
Display MC truth information.
void SetZoom(int plane, int wirelow, int wirehi, int timelo, int timehi, bool StoreZoom=true)
MCBriefPad * fMC
Short summary of MC event.
std::vector< TWireProjPad * > fPlanes
time vs wire projection for each plane
TGCheckButton * fGreyScale
Display gray or color scale.
std::map< int, double > tmin
util::DataProductChangeTracker_t * fLastEvent
keeps track of latest event
TGNumberEntry * fWireEntry
Wire number displayed.
auto const detProp
std::map< int, double > tmax