BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
BesGeoTrack Class Reference

#include <BesGeoTrack.h>

+ Inheritance diagram for BesGeoTrack:

Public Member Functions

 BesGeoTrack ()
 
 BesGeoTrack (Int_t id, Int_t pdgcode, TVirtualGeoTrack *parent=0, TObject *particle=0)
 
virtual ~BesGeoTrack ()
 
virtual void Init ()
 
virtual void AddHit (TObject *obj)
 
virtual void AddInfo (TString info)
 
virtual void CloseInfo ()
 
virtual void SetCharge (Int_t charge)
 
virtual void SetTrackType (Int_t type)
 
virtual void AddPoint (Double_t x, Double_t y, Double_t z, Double_t t)
 
virtual void SetMarker (Double_t x, Double_t y, Double_t z)
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 
virtual void Draw (Option_t *option="")
 
virtual void Paint (Option_t *option="")
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 
 BesGeoTrack ()
 
 BesGeoTrack (Int_t id, Int_t pdgcode, TVirtualGeoTrack *parent=0, TObject *particle=0)
 
virtual ~BesGeoTrack ()
 
virtual void Init ()
 
virtual void AddHit (TObject *obj)
 
virtual void AddInfo (TString info)
 
virtual void CloseInfo ()
 
virtual void SetCharge (Int_t charge)
 
virtual void SetTrackType (Int_t type)
 
virtual void AddPoint (Double_t x, Double_t y, Double_t z, Double_t t)
 
virtual void SetMarker (Double_t x, Double_t y, Double_t z)
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 
virtual void Draw (Option_t *option="")
 
virtual void Paint (Option_t *option="")
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 

Detailed Description

Constructor & Destructor Documentation

◆ BesGeoTrack() [1/4]

BesGeoTrack::BesGeoTrack ( )

◆ BesGeoTrack() [2/4]

BesGeoTrack::BesGeoTrack ( Int_t  id,
Int_t  pdgcode,
TVirtualGeoTrack *  parent = 0,
TObject *  particle = 0 
)

Definition at line 29 of file BesGeoTrack.cxx.

30 : TGeoTrack(id, pdgcode, parent, particle)
31{
32// std::cout << "co BesGeoTrack: " << ++count << std::endl;
33 Init();
34}
virtual void Init()
Definition: BesGeoTrack.cxx:44

◆ ~BesGeoTrack() [1/2]

BesGeoTrack::~BesGeoTrack ( )
virtual

Definition at line 36 of file BesGeoTrack.cxx.

37{
38// std::cout << "de BesGeoTrack: " << --count << std::endl;
39 if (fTip) delete fTip;
40 if (fPolyLine3D) delete fPolyLine3D;
41 if (fMarker) delete fMarker;
42}

◆ BesGeoTrack() [3/4]

BesGeoTrack::BesGeoTrack ( )

◆ BesGeoTrack() [4/4]

BesGeoTrack::BesGeoTrack ( Int_t  id,
Int_t  pdgcode,
TVirtualGeoTrack *  parent = 0,
TObject *  particle = 0 
)

◆ ~BesGeoTrack() [2/2]

virtual BesGeoTrack::~BesGeoTrack ( )
virtual

Member Function Documentation

◆ AddHit() [1/2]

virtual void BesGeoTrack::AddHit ( TObject *  obj)
inlinevirtual

◆ AddHit() [2/2]

virtual void BesGeoTrack::AddHit ( TObject *  obj)
inlinevirtual

Definition at line 21 of file InstallArea/include/BesVisLib/BesVisLib/BesGeoTrack.h.

21{ fHits.Add(obj); }

◆ AddInfo() [1/2]

virtual void BesGeoTrack::AddInfo ( TString  info)
inlinevirtual

◆ AddInfo() [2/2]

virtual void BesGeoTrack::AddInfo ( TString  info)
inlinevirtual

Definition at line 22 of file InstallArea/include/BesVisLib/BesVisLib/BesGeoTrack.h.

22{ fInfoCon.push_back(info); }

◆ AddPoint() [1/2]

void BesGeoTrack::AddPoint ( Double_t  x,
Double_t  y,
Double_t  z,
Double_t  t 
)
virtual

Definition at line 62 of file BesGeoTrack.cxx.

63{
64 TGeoTrack::AddPoint(x,y,z,t);
65}
int t()
Definition: t.c:1

Referenced by BesEvent::ConstructMdcTrackFromRec(), and BesEvent::ConstructMucTrackFromRec().

◆ AddPoint() [2/2]

virtual void BesGeoTrack::AddPoint ( Double_t  x,
Double_t  y,
Double_t  z,
Double_t  t 
)
virtual

◆ CloseInfo() [1/2]

void BesGeoTrack::CloseInfo ( )
virtual

Definition at line 53 of file BesGeoTrack.cxx.

54{
55 if (fTip) {
56 fTip->SetText(fInfoCon);
57 }
58 else
59 cout << "BesGeoTrack::CloseInfo, not initialized" << endl;
60}
virtual void SetText(std::vector< TString > infoCon)

Referenced by BesEvent::ConstructEmcTrackFromRec(), BesEvent::ConstructMdcTrackFromRec(), BesEvent::ConstructMucTrackFromRec(), and BesEvent::ConstructTofTrackFromRec().

◆ CloseInfo() [2/2]

virtual void BesGeoTrack::CloseInfo ( )
virtual

◆ DistancetoPrimitive() [1/2]

Int_t BesGeoTrack::DistancetoPrimitive ( Int_t  px,
Int_t  py 
)
virtual

Definition at line 83 of file BesGeoTrack.cxx.

84{
85 Int_t dist = 9999;
86 Int_t cx, cy;
87 Double_t edge = 4.0; // edge width of track
88 Double_t markSizeRatio = 4.0; // 4.0 is approximate size.
89
90 if (fType == 1 || fType == 2) { // tof or emc
91 if (!fMarker) return dist;
92 fMarker->GetCenterPixel(cx, cy);
93 if (fType == 1) { // tof
94 Double_t r = sqrt( Double_t((px-cx)*(px-cx) + (py-cy)*(py-cy)) );
95 Double_t markerR = markSizeRatio*fMarker->GetMarkerSize();
96 if (markerR > 50) markerR = 50;
97 // if the size of a marker with type of circle is too large > 50 pixel, it could not be enlarged.
98 if ( fabs(r-markerR) < edge ) dist = 0;
99 }
100 else if (fType == 2) { // emc
101 Double_t dx = abs(px-cx), dy = abs(py-cy);
102 if ( fabs(dx) < edge && fabs(dy) < markSizeRatio*fMarker->GetMarkerSize() ||
103 fabs(dy) < edge && fabs(dx) < markSizeRatio*fMarker->GetMarkerSize() )
104 dist = 0;
105 }
106
107 return dist;
108 }
109 else return TGeoTrack::DistancetoPrimitive(px, py);
110}
virtual void GetCenterPixel(Int_t &px, Int_t &py)
Definition: BesMarker2D.cxx:81

◆ DistancetoPrimitive() [2/2]

virtual Int_t BesGeoTrack::DistancetoPrimitive ( Int_t  px,
Int_t  py 
)
virtual

◆ Draw() [1/2]

void BesGeoTrack::Draw ( Option_t *  option = "")
virtual

Definition at line 279 of file BesGeoTrack.cxx.

280{
281 // Draw Polyline3D for OpenGL and X3d
282 BesView *view = (BesView*)gPad->GetView();
283 if (view && view->GetViewType() & k3DView) {
284 Double_t x,y,z,t;
285 fPolyLine3D = new TPolyLine3D(GetNpoints());
286 for (Int_t i = 0; i < GetNpoints(); i++) {
287 GetPoint(i,x,y,z,t);
288 fPolyLine3D->SetPoint(i,x,y,z);
289 }
290 fPolyLine3D->SetBit(kCanDelete);
291
292 fPolyLine3D->SetLineWidth(5);
293 fPolyLine3D->SetLineColor(kRed);
294 fPolyLine3D->Draw(option);
295 }
296
297 if (!gPad) gGeoManager->GetMasterVolume()->Draw();
298 char *opt1 = Compress(option); // we will have to delete this ?
299 TString opt(opt1);
300 Bool_t is_default = kTRUE;
301 Bool_t is_onelevel = kFALSE;
302 Bool_t is_all = kFALSE;
303 Bool_t is_type = kFALSE;
304 if (opt.Contains("/D")) {
305 is_onelevel = kTRUE;
306 is_default = kFALSE;
307 }
308 if (opt.Contains("/*")) {
309 is_all = kTRUE;
310 is_default = kFALSE;
311 }
312 if (opt.Contains("/N")) {
313 is_type = kTRUE;
314 Int_t ist = opt.Index("/N")+2;
315 Int_t ilast = opt.Index("/",ist);
316 if (ilast<0) ilast=opt.Length();
317 TString type = opt(ist, ilast-ist);
318 gGeoManager->SetParticleName(type.Data());
319 }
320 SetBits(is_default, is_onelevel, is_all, is_type);
321 AppendPad("SAME");
322
323 delete [] opt1;
324 return;
325}
Double_t x[10]

Referenced by BesEvent::DrawTracks().

◆ Draw() [2/2]

virtual void BesGeoTrack::Draw ( Option_t *  option = "")
virtual

◆ ExecuteEvent() [1/2]

void BesGeoTrack::ExecuteEvent ( Int_t  event,
Int_t  px,
Int_t  py 
)
virtual

Definition at line 112 of file BesGeoTrack.cxx.

113{
114 BesView *view = (BesView*)gPad->GetView();
115
116 if (gBesCursor->GetType() == kBesHand) {
117 if (view) view->ExecuteEvent(event, px, py);
118 }
119 else if (gBesCursor->GetType() == kBesPick){
120
121 if (gPad) gPad->SetCursor(kPointer);
122
123 Int_t width, color;
124 Int_t normalWidth = 1, hlWidth = 2;
125
126 switch (event) {
127 case kMouseEnter:
128 if (fType == 0) {
129 if (view->GetVisMdcHitsGlobal()) {
130 for (Int_t i = 0; i < fHits.GetEntries(); i++) {
131 Mdc2DWire *aHit = (Mdc2DWire*)fHits.At(i);
132 if (aHit != 0) {
133 if (view->GetVisMdcHits()) {
134 aHit->SetHighlighted(true);
135 }
136 }
137 }
138 }
139 }
140 else if (fType == 1) {
141 if (view->GetVisTofHitsGlobal()) {
142 for (Int_t i = 0; i < fHits.GetEntries(); i++) {
143 Tof2DScin *aHit = (Tof2DScin*)fHits.At(i);
144 if (aHit != 0) {
145 if ( aHit->GetPart() == 0 && view->GetVisTofHitsEast() ||
146 aHit->GetPart() == 1 && view->GetVisTofHitsBarrel() ||
147 aHit->GetPart() == 2 && view->GetVisTofHitsWest() ) {
148 aHit->SetHighlighted(true);
149 }
150 }
151 }
152 }
153 }
154 else if (fType == 2) {
155 if (view->GetVisEmcHitsGlobal()) {
156 for (Int_t i = 0; i < fHits.GetEntries(); i++) {
157 Emc2DCrystal *aHit = (Emc2DCrystal*)fHits.At(i);
158 if (aHit != 0) {
159 if ( aHit->GetPart() == 0 && view->GetVisEmcHitsEast() ||
160 aHit->GetPart() == 1 && view->GetVisEmcHitsBarrel() ||
161 aHit->GetPart() == 2 && view->GetVisEmcHitsWest() ) {
162 aHit->SetHighlighted(true);
163 }
164 }
165 }
166 }
167 }
168 else if (fType == 3) {
169 if (view->GetVisMucHitsGlobal()) {
170 for (Int_t i = 0; i < fHits.GetEntries(); i++) {
171 Muc2DStrip *aHit = (Muc2DStrip*)fHits.At(i);
172 if (aHit != 0) {
173 if (view->GetVisMucHitsGlobal()) {
174 aHit->SetHighlighted(true);
175 }
176 }
177 }
178 }
179 }
180
181
182 if (fType == 0) {
183 width = this->GetLineWidth();
184 color = this->GetLineColor();
185 this->SetLineWidth(hlWidth);
186 this->SetLineColor(kRed);
187 }
188 else if (fType == 1) {
189 fMarker->SetMarkerColor(kMagenta);
190 }
191 else if (fType == 2) {
192 fMarker->SetMarkerColor(kMagenta);
193 }
194 else if (fType == 3) {
195 width = this->GetLineWidth();
196 color = this->GetLineColor();
197 this->SetLineWidth(hlWidth);
198 this->SetLineColor(kRed);
199 }
200 else if (fType == 4) {
201 this->SetLineWidth(hlWidth);
202 this->SetLineColor(kBlue);
203 }
204
205 fTip->SetPos(px, py);
206 view->UpdateView(0);
207
208 //yzhang 2011-11-15 TEMP
209 //drawHeader(fTip->GetText);
210 if (gBesCursor->GetShowInfo()) fTip->Draw("TL,SAME"); // "BR,ARC,SAME"
211 gPad->Modified();
212 gPad->Update();
213 break;
214
215 case kMouseLeave:
216 if (fType == 0) {
217 for (Int_t i = 0; i < (Int_t)fHits.GetEntries(); i++) {
218 Mdc2DWire *aHit = (Mdc2DWire*)fHits.At(i);
219 if (aHit != 0 && aHit->IsHighlighted()) {
220 aHit->SetHighlighted(false);
221 }
222 }
223 }
224 else if (fType == 1) {
225 for (Int_t i = 0; i < fHits.GetEntries(); i++) {
226 Tof2DScin *aHit = (Tof2DScin*)fHits.At(i);
227 if (aHit != 0 && aHit->IsHighlighted()) {
228 aHit->SetHighlighted(false);
229 }
230 }
231 }
232 else if (fType == 2) {
233 for (Int_t i = 0; i < fHits.GetEntries(); i++) {
234 Emc2DCrystal *aHit = (Emc2DCrystal*)fHits.At(i);
235 if (aHit != 0 && aHit->IsHighlighted()) {
236 aHit->SetHighlighted(false);
237 }
238 }
239 }
240 else if (fType == 3) {
241 for (Int_t i = 0; i < (Int_t)fHits.GetEntries(); i++) {
242 Muc2DStrip *aHit = (Muc2DStrip*)fHits.At(i);
243 if (aHit != 0 && aHit->IsHighlighted()) {
244 aHit->SetHighlighted(false);
245 }
246 }
247 }
248
249
250 if (fType == 0) {
251 this->SetLineWidth(normalWidth);
252 this->SetLineColor(kBlack);
253 }
254 else if (fType == 1) {
255 fMarker->SetMarkerColor(kBlack);
256 }
257 else if (fType == 2) {
258 fMarker->SetMarkerColor(kBlack);
259 }
260 else if (fType == 3) {
261 this->SetLineWidth(normalWidth);
262 this->SetLineColor(kBlack);
263 }
264 else if (fType == 4) {
265 this->SetLineWidth(normalWidth);
266 this->SetLineColor(kBlack);
267 }
268
269 view->UpdateView(0);
270 gPad->Modified();
271 gPad->Update();
272 break;
273 }
274
275 TGeoTrack::ExecuteEvent(event, px, py);
276 }
277}
g1 SetLineColor(2)
gr SetLineWidth(2)
virtual void SetPos(Int_t px, Int_t py)
Definition: BesPaveText.cxx:76
virtual void UpdateView(Bool_t resetview=kFALSE)
Definition: BesView.cxx:598
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Definition: BesView.cxx:365

◆ ExecuteEvent() [2/2]

virtual void BesGeoTrack::ExecuteEvent ( Int_t  event,
Int_t  px,
Int_t  py 
)
virtual

◆ GetObjectInfo() [1/2]

char * BesGeoTrack::GetObjectInfo ( Int_t  px,
Int_t  py 
) const
virtual

Definition at line 365 of file BesGeoTrack.cxx.

365 {
366
367 BesView *view = (BesView*)gPad->GetView();
368 if (view) return view->GetObjectInfo(px, py);
369 else return TObject::GetObjectInfo(px, py);
370}
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Definition: BesView.cxx:800

◆ GetObjectInfo() [2/2]

virtual char * BesGeoTrack::GetObjectInfo ( Int_t  px,
Int_t  py 
) const
virtual

◆ Init() [1/2]

void BesGeoTrack::Init ( )
virtual

Definition at line 44 of file BesGeoTrack.cxx.

45{
46 fTip = new BesPaveText(0, 0, 0.1, 0.1, "TL");
47
48 fMarker = 0;
49
50 //fHits.Clear("C");
51}

Referenced by BesGeoTrack().

◆ Init() [2/2]

virtual void BesGeoTrack::Init ( )
virtual

◆ Paint() [1/2]

void BesGeoTrack::Paint ( Option_t *  option = "")
virtual

Definition at line 327 of file BesGeoTrack.cxx.

328{
329 BesView *view = (BesView*)gPad->GetView();
330 Double_t viewPhi = view->GetLongitude();
331 TVector3 viewVec(cos(viewPhi*TMath::DegToRad()), sin(viewPhi*TMath::DegToRad()), 0);
332 Double_t x, y, z, t;
333 Double_t x1=0.0, y1=0.0, z1=0.0;
334 Double_t dot, dotMin = 1e+20, dotTolerance = 0.01;
335 for (Int_t i = 1; i < GetNpoints(); i++) {
336 GetPoint(i, x, y, z, t);
337 TVector3 vec(x,y,0);
338 if (vec.Mag() > 5.0) {
339 vec.SetMag(1.0);
340 dot = fabs(vec.Dot(viewVec));
341 if ( dot < dotTolerance && dot < dotMin ) {
342 x1 = x;
343 y1 = y;
344 z1 = z;
345 dotMin = dot;
346 }
347 }
348 }
349
350 if (dotMin < 1e+20) {
351 BesMarker2D sectionPhi("trackPhi", "trackPhi", x1, y1, z1);
352 sectionPhi.SetMarkerStyle(28);
353 sectionPhi.SetMarkerColor(1);
354 sectionPhi.SetMarkerSize(2);
355 sectionPhi.Paint();
356 //sectionPhi paint the marker in origin point of MdcTrack!!!
357 }
358
359 if (fMarker) fMarker->Paint(option);
360 TGeoTrack::Paint(option);
361}
double sin(const BesAngle a)
double cos(const BesAngle a)
virtual void Paint(Option_t *option="")

◆ Paint() [2/2]

virtual void BesGeoTrack::Paint ( Option_t *  option = "")
virtual

◆ SetCharge() [1/2]

void BesGeoTrack::SetCharge ( Int_t  charge)
virtual

Definition at line 372 of file BesGeoTrack.cxx.

373{
374 fCharge = charge;
375 if (fCharge > 0) this->SetLineColor(kBlack); // +
376 else if (fCharge < 0) this->SetLineColor(kBlack); // -
377 else this->SetLineColor(kGreen); // 0
378}

Referenced by BesEvent::ConstructMdcTrackFromRec(), and BesEvent::ConstructMucTrackFromRec().

◆ SetCharge() [2/2]

virtual void BesGeoTrack::SetCharge ( Int_t  charge)
virtual

◆ SetMarker() [1/2]

void BesGeoTrack::SetMarker ( Double_t  x,
Double_t  y,
Double_t  z 
)
virtual

Definition at line 67 of file BesGeoTrack.cxx.

68{
69 fMarker = new BesMarker2D("RecMarker", "RecMarker", x, y, z);
70
71 if (fType == 1) { // tof
72 fMarker->SetMarkerSizeMultiple(20);
73 fMarker->SetMarkerStyle(5);
74 fMarker->SetMarkerColor(kBlack);
75 }
76 else if (fType == 2) { // emc
77 fMarker->SetMarkerSizeMultiple(20);
78 fMarker->SetMarkerStyle(2);
79 fMarker->SetMarkerColor(kBlack);
80 }
81}

Referenced by BesEvent::ConstructEmcTrackFromRec(), and BesEvent::ConstructTofTrackFromRec().

◆ SetMarker() [2/2]

virtual void BesGeoTrack::SetMarker ( Double_t  x,
Double_t  y,
Double_t  z 
)
virtual

◆ SetTrackType() [1/2]

virtual void BesGeoTrack::SetTrackType ( Int_t  type)
inlinevirtual

◆ SetTrackType() [2/2]

virtual void BesGeoTrack::SetTrackType ( Int_t  type)
inlinevirtual

Definition at line 25 of file InstallArea/include/BesVisLib/BesVisLib/BesGeoTrack.h.

25{ fType = type; }

The documentation for this class was generated from the following files: