2#include <TGeoManager.h>
9#include "BesVisLib/BesCursor.h"
10#include "BesVisLib/BesGeoTrack.h"
11#include "BesVisLib/BesMarker2D.h"
12#include "BesVisLib/BesView.h"
13#include "BesVisLib/Mdc2DWire.h"
14#include "BesVisLib/Muc2DStrip.h"
30 : TGeoTrack( id, pdgcode, parent, particle ) {
52 if ( fTip ) { fTip->SetText( fInfoCon ); }
53 else cout <<
"BesGeoTrack::CloseInfo, not initialized" << endl;
57 TGeoTrack::AddPoint( x, y, z,
t );
61 fMarker =
new BesMarker2D(
"RecMarker",
"RecMarker", x, y, z );
65 fMarker->SetMarkerSizeMultiple( 15 );
66 fMarker->SetMarkerStyle( 5 );
67 fMarker->SetMarkerColor( kBlack );
69 else if ( fType == 2 )
71 fMarker->SetMarkerSizeMultiple( 15 );
72 fMarker->SetMarkerStyle( 2 );
73 fMarker->SetMarkerColor( kBlack );
75 else if ( fType == 6 )
77 fMarker->SetMarkerSizeMultiple( 1.1 );
78 fMarker->SetMarkerStyle( 4 );
79 fMarker->SetMarkerColor( kBlack );
81 else if ( fType == 7 )
83 fMarker->SetMarkerSizeMultiple( 1.2 );
84 fMarker->SetMarkerStyle( 4 );
85 fMarker->SetMarkerColor( kBlack );
93 Double_t markSizeRatio = 4.0;
95 if ( fType == 1 || fType == 2 || fType == 6 || fType == 7 )
97 if ( !fMarker )
return dist;
98 fMarker->GetCenterPixel( cx, cy );
101 Double_t r = sqrt( Double_t( ( px - cx ) * ( px - cx ) + ( py - cy ) * ( py - cy ) ) );
102 Double_t markerR = markSizeRatio * fMarker->GetMarkerSize();
103 if ( markerR > 50 ) markerR = 50;
106 if ( fabs( r - markerR ) < edge ) dist = 0;
109 else if ( fType == 2 || fType == 6 || fType == 7 )
111 Double_t dx =
abs( px - cx ), dy =
abs( py - cy );
112 if ( fabs( dx ) < edge && fabs( dy ) < markSizeRatio * fMarker->GetMarkerSize() ||
113 fabs( dy ) < edge && fabs( dx ) < markSizeRatio * fMarker->GetMarkerSize() )
119 else return TGeoTrack::DistancetoPrimitive( px, py );
132 if ( gPad ) gPad->SetCursor( kPointer );
135 Int_t normalWidth = 1, hlWidth = 2;
144 for ( Int_t i = 0; i < fHits.GetEntries(); i++ )
154 else if ( fType == 1 )
158 for ( Int_t i = 0; i < fHits.GetEntries(); i++ )
171 else if ( fType == 2 )
175 for ( Int_t i = 0; i < fHits.GetEntries(); i++ )
188 else if ( fType == 3 )
192 for ( Int_t i = 0; i < fHits.GetEntries(); i++ )
205 width = this->GetLineWidth();
206 color = this->GetLineColor();
210 else if ( fType == 1 ) { fMarker->SetMarkerColor( kMagenta ); }
211 else if ( fType == 2 ) { fMarker->SetMarkerColor( kMagenta ); }
212 else if ( fType == 3 )
214 width = this->GetLineWidth();
215 color = this->GetLineColor();
219 else if ( fType == 4 )
224 else if ( fType == 6 || fType == 7 )
226 fMarker->SetMarkerColor( kViolet );
227 fMarker->SetMarkerStyle( 8 );
230 fTip->SetPos( px, py );
235 if (
gBesCursor->GetShowInfo() ) fTip->Draw(
"TL,SAME" );
243 for ( Int_t i = 0; i < (Int_t)fHits.GetEntries(); i++ )
249 else if ( fType == 1 )
251 for ( Int_t i = 0; i < fHits.GetEntries(); i++ )
257 else if ( fType == 2 )
259 for ( Int_t i = 0; i < fHits.GetEntries(); i++ )
265 else if ( fType == 3 )
267 for ( Int_t i = 0; i < (Int_t)fHits.GetEntries(); i++ )
279 else if ( fType == 1 ) { fMarker->SetMarkerColor( kBlack ); }
280 else if ( fType == 2 ) { fMarker->SetMarkerColor( kBlack ); }
281 else if ( fType == 3 )
286 else if ( fType == 4 )
291 else if ( fType == 6 || fType == 7 )
293 fMarker->SetMarkerColor( kBlack );
294 fMarker->SetMarkerStyle( 4 );
303 TGeoTrack::ExecuteEvent( event, px, py );
310 fPolyLine3D =
new TPolyLine3D( GetNpoints() );
311 fPolyLine3D->SetBit( kCanDelete );
312 for ( Int_t i = 0; i < GetNpoints(); i++ )
314 GetPoint( i, x, y, z,
t );
315 fPolyLine3D->SetPoint( i, x, y, z );
317 fPolyLine3D->SetLineWidth( 5 );
318 fPolyLine3D->SetLineColor( 897 );
328 fPolyLine3D->Draw( option );
332 for ( Int_t i = 0; i < f3DHits.GetEntries(); ++i )
334 TGeoPhysicalNode* pHit = (TGeoPhysicalNode*)f3DHits.At( i );
335 if ( pHit ) pHit->SetLineColor( kRed );
338 if ( !gPad ) gGeoManager->GetMasterVolume()->Draw();
339 char* opt1 = Compress( option );
341 Bool_t is_default = kTRUE;
342 Bool_t is_onelevel = kFALSE;
343 Bool_t is_all = kFALSE;
344 Bool_t is_type = kFALSE;
345 if ( opt.Contains(
"/D" ) )
350 if ( opt.Contains(
"/*" ) )
355 if ( opt.Contains(
"/N" ) )
358 Int_t ist = opt.Index(
"/N" ) + 2;
359 Int_t ilast = opt.Index(
"/", ist );
360 if ( ilast < 0 ) ilast = opt.Length();
361 TString
type = opt( ist, ilast - ist );
362 gGeoManager->SetParticleName(
type.Data() );
364 SetBits( is_default, is_onelevel, is_all, is_type );
374 TVector3 viewVec(
cos( viewPhi * TMath::DegToRad() ),
sin( viewPhi * TMath::DegToRad() ),
377 Double_t x1 = 0.0, y1 = 0.0, z1 = 0.0;
378 Double_t dot, dotMin = 1e+20, dotTolerance = 0.01;
379 for ( Int_t i = 1; i < GetNpoints(); i++ )
381 GetPoint( i, x, y, z,
t );
382 TVector3
vec( x, y, 0 );
383 if (
vec.Mag() > 5.0 )
386 dot = fabs(
vec.Dot( viewVec ) );
387 if ( dot < dotTolerance && dot < dotMin )
397 if ( dotMin < 1e+20 )
399 BesMarker2D sectionPhi(
"trackPhi",
"trackPhi", x1, y1, z1 );
400 sectionPhi.SetMarkerStyle( 28 );
401 sectionPhi.SetMarkerColor( 1 );
402 sectionPhi.SetMarkerSize( 2 );
407 if ( fMarker ) fMarker->Paint( option );
408 TGeoTrack::Paint( option );
417 else return TObject::GetObjectInfo( px, py );
ClassImp(BesGeoTrack) BesGeoTrack
R__EXTERN BesCursor * gBesCursor
double sin(const BesAngle a)
double cos(const BesAngle a)
virtual void Draw(Option_t *option="")
virtual void AddPoint(Double_t x, Double_t y, Double_t z, Double_t t)
virtual char * GetObjectInfo(Int_t px, Int_t py) const
virtual void Construct3DLine()
virtual void SetMarker(Double_t x, Double_t y, Double_t z)
virtual void Paint(Option_t *option="")
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
virtual void SetCharge(Int_t charge)
virtual void Paint(Option_t *option="")
Bool_t GetVisMucHitsGlobal()
Bool_t GetVisMdcHitsGlobal()
Bool_t GetVisEmcHitsBarrel()
Bool_t GetVisEmcHitsGlobal()
virtual void UpdateView(Bool_t resetview=kFALSE)
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Bool_t GetVisEmcHitsWest()
EBESViewType GetViewType()
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Bool_t GetVisTofHitsWest()
Bool_t GetVisTofHitsGlobal()
Bool_t GetVisEmcHitsEast()
Bool_t GetVisTofHitsBarrel()
Bool_t GetVisTofHitsEast()
virtual void SetHighlighted(bool status=true)
virtual bool IsHighlighted()
virtual void SetHighlighted(bool status=true)
virtual bool IsHighlighted()
virtual void SetHighlighted(bool status=true)
virtual bool IsHighlighted()
virtual void SetHighlighted(bool status=true)
virtual bool IsHighlighted()