![]() |
|
|||
File indexing completed on 2025-08-05 08:18:22
0001 /* Copyright 2011, Technische Universitaet Muenchen, 0002 Author: Karl Bicker 0003 0004 This file is part of GENFIT. 0005 0006 GENFIT is free software: you can redistribute it and/or modify 0007 it under the terms of the GNU Lesser General Public License as published 0008 by the Free Software Foundation, either version 3 of the License, or 0009 (at your option) any later version. 0010 0011 GENFIT is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 GNU Lesser General Public License for more details. 0015 0016 You should have received a copy of the GNU Lesser General Public License 0017 along with GENFIT. If not, see <http://www.gnu.org/licenses/>. 0018 */ 0019 /** @addtogroup EventDisplay 0020 * @{ 0021 */ 0022 0023 #ifndef genfit_EventDisplay_h 0024 #define genfit_EventDisplay_h 0025 0026 #include "Track.h" 0027 #include "AbsKalmanFitter.h" 0028 0029 #include <TEveBox.h> 0030 #include <TVector3.h> 0031 #include <string> 0032 #include <vector> 0033 0034 #include <TGButton.h> 0035 #include <TGNumberEntry.h> 0036 #include <TGButtonGroup.h> 0037 0038 0039 namespace genfit { 0040 0041 enum eFitterType { 0042 SimpleKalman, 0043 RefKalman, 0044 DafSimple, 0045 DafRef 0046 }; 0047 0048 /** @brief Event display designed to run with Genfit. 0049 * 0050 * @author Karl Bicker (Technische Universität München, original author) 0051 * 0052 * The EventDisplay class is a singelton used to visualize the events processed with Genfit. The 0053 * event display uses the EVE event visualization package to visualize Tracks which are bundled 0054 * in a vector and which form one event. The information about the tracks is supplied in Track 0055 * objects. To use the event display, the geometry (TGeoManager)and magnetic field (FieldManager) 0056 * have to be initialized and gApplication and gEve have to exist. 0057 * 0058 */ 0059 class EventDisplay : public TNamed { 0060 private: 0061 EventDisplay(); 0062 0063 public: 0064 ~EventDisplay(); 0065 static EventDisplay* getInstance(); 0066 0067 /** @brief Drop all events.*/ 0068 void reset(); 0069 0070 /** @brief Add new event 0071 * 0072 * Add a new event. An event is a collection of Tracks which are displayed at the 0073 * the same time. 0074 * The tracks are copied. 0075 * 0076 */ 0077 void addEvent(std::vector<genfit::Track*>& tracks); 0078 void addEvent(std::vector<const genfit::Track*>& tracks); 0079 0080 /** @brief Add new event 0081 * 0082 * Add a new event consisting of one track. 0083 * 0084 */ 0085 void addEvent(const Track* tr); 0086 0087 /** @brief Go to the next event or step a certain number of events ahead.*/ 0088 void next(unsigned int stp = 1); 0089 0090 /** @brief Go to the previous event or step a certain number of events back.*/ 0091 void prev(unsigned int stp = 1); 0092 0093 /** @brief Go to event with index id.*/ 0094 void gotoEvent(unsigned int id); 0095 0096 /** @brief Get the total number of events stored.*/ 0097 int getNEvents(); 0098 0099 /** @brief Set the display options. 0100 * 0101 * The option string lets you steer the way the events are displayed. The following 0102 * options are available:\n 0103 * \n 0104 * 'A': Autoscale errors. The representation of hits are scaled with the error found 0105 * their covariance matrix. This can lead to hits not being displayed beause the 0106 * errors are too small. Autoscaling ensures that the errors are scaled up 0107 * sufficiently to ensure all hits are displayed. However, this can lead to unwanted 0108 * results if there are only a few hits with very small errors, as all hits are scaled 0109 * by the same factor to ensure consistency.\n\n 0110 * 'B': Draw Backward Fit (track segments start at updates and end at predictions)\n\n 0111 * 'D': Draw detectors. This causes a simple representation for all detectors to be drawn. For 0112 * planar detectors, this is a plane with the same position and orientation of the real 0113 * detector plane, but with different size. For wires, this is a tube whose diameter 0114 * is equal to the value measured by the wire. Spacepoint hits are not affected by this 0115 * option.\n\n 0116 * 'E': Draw Error cones (position and direction uncertainties) around the track.\n\n 0117 * 'F': Draw Forward Fit (track segments start at updates and end at predictions) 0118 * 'H': Draw hits. This causes the hits to be visualized. Normally, the size of the hit 0119 * representation is connected to the covariance matrix of the hit, scaled by the value 0120 * set in setErrScale which is normally 1. See also option 'A' and 'S'. Normally used in 0121 * connection with 'D'.\n\n 0122 * 'G': Draw geometry. Draw also the geometry in the gGeoManager. This feature is experimental 0123 * and may lead to strang things being drawn.\n\n 0124 * 'M': Draw track markers. Draw the intersection points between the track and the virtual 0125 * (and/or real) detector planes. Can only be used in connection with 'T'.\n\n 0126 * 'P': Draw detector planes. Draws the virtual (and/or real) detector planes.\n\n 0127 * 'S': Scale manually. This leads to the spacepoint hits (and only them up to now!) being drawn 0128 * as spheres with radius 0.5 scaled with the error scale factor. Can be used if the scaling 0129 * with errors leads to problems.\n\n 0130 * 'T': Draw Track. Draw the track as lines between the virtual (and/or real) detector 0131 * planes.\n\n 0132 * 'X': Draw silent. Does not run the TApplication. 0133 * 0134 */ 0135 void setOptions(std::string opts); 0136 0137 /** @brief Set the scaling factor for the visualization of the errors.*/ 0138 void setErrScale(double errScale = 1.); 0139 0140 /** @brief Get the error scaling factor.*/ 0141 double getErrScale(); 0142 0143 /** @brief Open the event display.*/ 0144 void open(); 0145 0146 void guiGoto(); 0147 void guiGoto2(); 0148 void guiSetDrawParams(); 0149 void guiSelectFitterId(int val); 0150 void guiSelectMmHandling(int val); 0151 0152 private: 0153 /** @brief Build the buttons for event navigation.*/ 0154 void makeGui(); 0155 0156 /** @brief Draw an event.*/ 0157 void drawEvent(unsigned int id, bool resetCam = true); 0158 0159 /** @brief Create a box around o, oriented along u and v with widths ud, vd and depth and 0160 * return a pointer to the box object. 0161 */ 0162 TEveBox* boxCreator(TVector3 o, TVector3 u, TVector3 v, float ud, float vd, float depth); 0163 0164 void makeLines(const StateOnPlane* prevState, const StateOnPlane* state, const AbsTrackRep* rep, 0165 const Color_t& color, const Style_t& style, bool drawMarkers, bool drawErrors, double lineWidth = 2, int markerPos = 1); 0166 0167 0168 static EventDisplay* eventDisplay_; //! 0169 unsigned int eventId_; //! 0170 double errorScale_; //! 0171 std::vector< std::vector<genfit::Track*>* > events_; //! 0172 0173 0174 TGNumberEntry* guiEvent; 0175 TGNumberEntry* guiEvent2; 0176 0177 TGCheckButton* guiDrawGeometry_; 0178 bool drawGeometry_; 0179 TGCheckButton* guiDrawDetectors_; 0180 bool drawDetectors_; 0181 TGCheckButton* guiDrawHits_; 0182 bool drawHits_; 0183 TGCheckButton* guiDrawErrors_; 0184 bool drawErrors_; 0185 0186 TGCheckButton* guiDrawPlanes_; 0187 bool drawPlanes_; 0188 TGCheckButton* guiDrawTrackMarkers_; 0189 bool drawTrackMarkers_; 0190 0191 TGCheckButton* guiDrawTrack_; 0192 bool drawTrack_; 0193 TGCheckButton* guiDrawRefTrack_; 0194 bool drawRefTrack_; 0195 TGCheckButton* guiDrawForward_; 0196 bool drawForward_; 0197 TGCheckButton* guiDrawBackward_; 0198 bool drawBackward_; 0199 0200 TGCheckButton* guiDrawAutoScale_; 0201 bool drawAutoScale_; 0202 TGCheckButton* guiDrawScaleMan_; 0203 bool drawScaleMan_; 0204 TGNumberEntry* guiErrorScale_; 0205 0206 bool drawSilent_; 0207 0208 TGCheckButton* guiDrawCardinalRep_; 0209 bool drawCardinalRep_; 0210 TGNumberEntry* guiRepId_; 0211 unsigned int repId_; 0212 0213 TGCheckButton* guiDrawAllTracks_; 0214 bool drawAllTracks_; 0215 TGNumberEntry* guiTrackId_; 0216 unsigned int trackId_; 0217 0218 TGCheckButton* guiRefit_; 0219 bool refit_; 0220 TGNumberEntry* guiDebugLvl_; 0221 unsigned int debugLvl_; 0222 TGButtonGroup* guiFitterId_; 0223 eFitterType fitterId_; 0224 TGButtonGroup* guiMmHandling_; 0225 eMultipleMeasurementHandling mmHandling_; 0226 0227 TGCheckButton* guiSquareRootFormalism_; 0228 bool squareRootFormalism_; 0229 TGNumberEntry* guiDPVal_; 0230 double dPVal_; 0231 TGNumberEntry* guiRelChi2_; 0232 double dRelChi2_; 0233 TGNumberEntry* guiDChi2Ref_; 0234 double dChi2Ref_; 0235 TGNumberEntry* guiNMinIter_; 0236 unsigned int nMinIter_; 0237 TGNumberEntry* guiNMaxIter_; 0238 unsigned int nMaxIter_; 0239 TGNumberEntry* guiNMaxFailed_; 0240 int nMaxFailed_; 0241 TGCheckButton* guiResort_; 0242 bool resort_; 0243 0244 0245 public: 0246 ClassDef(EventDisplay,1) 0247 0248 }; 0249 0250 } /* End of namespace genfit */ 0251 /** @} */ 0252 0253 #endif // genfit_EventDisplay_h 0254
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |