Belle II Software  release-08-01-10
EventDisplay.h
1 /* Copyright 2011, Technische Universitaet Muenchen,
2  Author: Karl Bicker
3 
4  This file is part of GENFIT.
5 
6  GENFIT is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  GENFIT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18 */
23 #ifndef genfit_EventDisplay_h
24 #define genfit_EventDisplay_h
25 
26 #include "Track.h"
27 #include "AbsKalmanFitter.h"
28 
29 #include <TEveBox.h>
30 #include <TVector3.h>
31 #include <string>
32 #include <vector>
33 
34 #include <TGButton.h>
35 #include <TGNumberEntry.h>
36 #include <TGButtonGroup.h>
37 
38 
39 namespace genfit {
40 
41 enum eFitterType {
42  SimpleKalman,
43  RefKalman,
44  DafSimple,
45  DafRef
46 };
47 
59 class EventDisplay : public TNamed {
60  private:
61  EventDisplay();
62 
63  public:
64  ~EventDisplay();
65  static EventDisplay* getInstance();
66 
68  void reset();
69 
77  void addEvent(std::vector<genfit::Track*>& tracks);
78  void addEvent(std::vector<const genfit::Track*>& tracks);
79 
85  void addEvent(const Track* tr);
86 
88  void next(unsigned int stp = 1);
89 
91  void prev(unsigned int stp = 1);
92 
94  void gotoEvent(unsigned int id);
95 
97  int getNEvents();
98 
135  void setOptions(std::string opts);
136 
138  void setErrScale(double errScale = 1.);
139 
141  double getErrScale();
142 
144  void open();
145 
146  void guiGoto();
147  void guiGoto2();
148  void guiSetDrawParams();
149  void guiSelectFitterId(int val);
150  void guiSelectMmHandling(int val);
151 
152  private:
154  void makeGui();
155 
157  void drawEvent(unsigned int id, bool resetCam = true);
158 
162  TEveBox* boxCreator(TVector3 o, TVector3 u, TVector3 v, float ud, float vd, float depth);
163 
164  void makeLines(const StateOnPlane* prevState, const StateOnPlane* state, const AbsTrackRep* rep,
165  const Color_t& color, const Style_t& style, bool drawMarkers, bool drawErrors, double lineWidth = 2, int markerPos = 1);
166 
167 
168  static EventDisplay* eventDisplay_;
169  unsigned int eventId_;
170  double errorScale_;
171  std::vector< std::vector<genfit::Track*>* > events_;
172 
173 
174  TGNumberEntry* guiEvent;
175  TGNumberEntry* guiEvent2;
176 
177  TGCheckButton* guiDrawGeometry_;
178  bool drawGeometry_;
179  TGCheckButton* guiDrawDetectors_;
180  bool drawDetectors_;
181  TGCheckButton* guiDrawHits_;
182  bool drawHits_;
183  TGCheckButton* guiDrawErrors_;
184  bool drawErrors_;
185 
186  TGCheckButton* guiDrawPlanes_;
187  bool drawPlanes_;
188  TGCheckButton* guiDrawTrackMarkers_;
189  bool drawTrackMarkers_;
190 
191  TGCheckButton* guiDrawTrack_;
192  bool drawTrack_;
193  TGCheckButton* guiDrawRefTrack_;
194  bool drawRefTrack_;
195  TGCheckButton* guiDrawForward_;
196  bool drawForward_;
197  TGCheckButton* guiDrawBackward_;
198  bool drawBackward_;
199 
200  TGCheckButton* guiDrawAutoScale_;
201  bool drawAutoScale_;
202  TGCheckButton* guiDrawScaleMan_;
203  bool drawScaleMan_;
204  TGNumberEntry* guiErrorScale_;
205 
206  bool drawSilent_;
207 
208  TGCheckButton* guiDrawCardinalRep_;
209  bool drawCardinalRep_;
210  TGNumberEntry* guiRepId_;
211  unsigned int repId_;
212 
213  TGCheckButton* guiDrawAllTracks_;
214  bool drawAllTracks_;
215  TGNumberEntry* guiTrackId_;
216  unsigned int trackId_;
217 
218  TGCheckButton* guiRefit_;
219  bool refit_;
220  TGNumberEntry* guiDebugLvl_;
221  unsigned int debugLvl_;
222  TGButtonGroup* guiFitterId_;
223  eFitterType fitterId_;
224  TGButtonGroup* guiMmHandling_;
225  eMultipleMeasurementHandling mmHandling_;
226 
227  TGCheckButton* guiSquareRootFormalism_;
228  bool squareRootFormalism_;
229  TGNumberEntry* guiDPVal_;
230  double dPVal_;
231  TGNumberEntry* guiRelChi2_;
232  double dRelChi2_;
233  TGNumberEntry* guiDChi2Ref_;
234  double dChi2Ref_;
235  TGNumberEntry* guiNMinIter_;
236  unsigned int nMinIter_;
237  TGNumberEntry* guiNMaxIter_;
238  unsigned int nMaxIter_;
239  TGNumberEntry* guiNMaxFailed_;
240  int nMaxFailed_;
241  TGCheckButton* guiResort_;
242  bool resort_;
243 
244 
245  public:
246  ClassDef(EventDisplay,1)
247 
248 };
249 
250 } /* End of namespace genfit */
253 #endif // genfit_EventDisplay_h
254 
Abstract base class for a track representation.
Definition: AbsTrackRep.h:66
Event display designed to run with Genfit.
Definition: EventDisplay.h:59
void gotoEvent(unsigned int id)
Go to event with index id.
void drawEvent(unsigned int id, bool resetCam=true)
Draw an event.
int getNEvents()
Get the total number of events stored.
void makeGui()
Build the buttons for event navigation.
void setErrScale(double errScale=1.)
Set the scaling factor for the visualization of the errors.
TEveBox * boxCreator(TVector3 o, TVector3 u, TVector3 v, float ud, float vd, float depth)
Create a box around o, oriented along u and v with widths ud, vd and depth and return a pointer to th...
double getErrScale()
Get the error scaling factor.
void setOptions(std::string opts)
Set the display options.
void prev(unsigned int stp=1)
Go to the previous event or step a certain number of events back.
void open()
Open the event display.
void addEvent(std::vector< genfit::Track * > &tracks)
Add new event.
void next(unsigned int stp=1)
Go to the next event or step a certain number of events ahead.
void reset()
Drop all events.
A state with arbitrary dimension defined in a DetPlane.
Definition: StateOnPlane.h:47
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
Definition: Track.h:71
Defines for I/O streams used for error and debug printing.
eMultipleMeasurementHandling