CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
BesMcTrack.cxx
Go to the documentation of this file.
1#include <TPad.h>
2#include <TVector3.h>
3#include <TGeoManager.h>
4#include "math.h"
5#include <TMath.h>
6#include <TStyle.h>
7
8#include <iostream>
9
11#include "BesVisLib/BesView.h"
13#include "BesVisLib/Mdc2DWire.h"
15#include "BesVisLib/BesCursor.h"
16
17using namespace std;
18
19#ifndef __CINT__
21#endif
22//int BesMcTrack::count = 0;
24 : BesGeoTrack()
25{
26}
27
28BesMcTrack::BesMcTrack(Int_t id, Int_t pdgcode, TVirtualGeoTrack *parent, TObject *particle)
29 : BesGeoTrack(id, pdgcode, parent, particle)
30{
31}
32
33void BesMcTrack::ExecuteEvent(Int_t event, Int_t px, Int_t py)
34{
35 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
36
37 if (gBesCursor->GetType() == kBesHand) {
38 if (view) view->ExecuteEvent(event, px, py);
39 }
40 else if (gBesCursor->GetType() == kBesPick){
41
42 if (gPad) gPad->SetCursor(kPointer);
43
44 Int_t width, color;
45 Int_t normalWidth = 2, hlWidth = 3;
46
47 switch (event) {
48 case kMouseEnter:
49 width = this->GetLineWidth();
50 color = this->GetLineColor();
51 this->SetLineWidth(hlWidth);
52 this->SetLineColor(kRed);
53
54 fTip->SetPos(px, py);
55 view->UpdateView(0);
56
57 if (gBesCursor->GetShowInfo()) fTip->Draw("TL,SAME"); // "BR,ARC,SAME"
58 gPad->Modified();
59 gPad->Update();
60 break;
61
62 case kMouseLeave:
63 this->SetLineWidth(normalWidth);
64 this->SetLineColor(kBlue);
65
66 view->UpdateView(0);
67 gPad->Modified();
68 gPad->Update();
69 break;
70 }
71
72 TGeoTrack::ExecuteEvent(event, px, py);
73 }
74}
75
76//_____________________________________________________
77
78void BesMcTrack::SetCharge(Int_t charge)
79{
81 if (charge > 0) this->SetLineColor(kBlue); // +
82 else if (charge < 0) this->SetLineColor(kBlue); // -
83 else this->SetLineColor(kBlue-8); // 0
84}
85
@ kBesHand
Definition: BesCursor.h:15
@ kBesPick
Definition: BesCursor.h:14
R__EXTERN BesCursor * gBesCursor
Definition: BesCursor.h:40
ClassImp(BesMcTrack) BesMcTrack
Definition: BesMcTrack.cxx:20
g1 SetLineColor(2)
gr SetLineWidth(2)
Bool_t GetShowInfo()
Definition: BesCursor.h:35
EBESCursorType GetType()
Definition: BesCursor.h:32
BesPaveText * fTip
Definition: BesGeoTrack.h:57
virtual void SetCharge(Int_t charge)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Definition: BesMcTrack.cxx:33
virtual void SetCharge(Int_t charge)
Definition: BesMcTrack.cxx:78
virtual void SetPos(Int_t px, Int_t py)
Definition: BesPaveText.cxx:86
virtual void UpdateView(Bool_t resetview=kFALSE)
Definition: BesView.cxx:753
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Definition: BesView.cxx:451