Logo ROOT   6.21/01
Reference Guide
TGeoTrack.cxx
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 // Author: Andrei Gheata 2003/04/10
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TBrowser.h"
13 #include "TPolyLine3D.h"
14 #include "TPoint.h"
15 #include "TVirtualPad.h"
16 #include "TView.h"
17 
18 #include "TGeoManager.h"
19 #include "TVirtualGeoPainter.h"
20 #include "TGeoTrack.h"
21 
22 /** \class TGeoTrack
23 \ingroup Geometry_classes
24 
25 Class for user-defined tracks attached to a geometry.
26 Tracks are 3D objects made of points and they store a
27 pointer to a TParticle. The geometry manager holds a list
28 of all tracks that will be deleted on destruction of
29 gGeoManager.
30 */
31 
33 
34 ////////////////////////////////////////////////////////////////////////////////
35 /// Default constructor.
36 
38 {
39  fPointsSize = 0;
40  fNpoints = 0;
41  fPoints = 0;
42 }
43 
44 ////////////////////////////////////////////////////////////////////////////////
45 /// Constructor.
46 
47 TGeoTrack::TGeoTrack(Int_t id, Int_t pdgcode, TVirtualGeoTrack *parent, TObject *particle)
48  :TVirtualGeoTrack(id,pdgcode,parent,particle)
49 {
50  fPointsSize = 0;
51  fNpoints = 0;
52  fPoints = 0;
53  if (fParent==0) {
54  SetMarkerColor(2);
55  SetMarkerStyle(8);
56  SetMarkerSize(0.6);
57  SetLineColor(2);
58  SetLineWidth(2);
59  } else {
60  SetMarkerColor(4);
61  SetMarkerStyle(8);
62  SetMarkerSize(0.6);
63  SetLineColor(4);
64  SetLineWidth(2);
65  }
66 }
67 
68 ////////////////////////////////////////////////////////////////////////////////
69 /// Destructor.
70 
72 {
73  if (fPoints) delete [] fPoints;
74 // if (gPad) gPad->GetListOfPrimitives()->Remove(this);
75 }
76 
77 ////////////////////////////////////////////////////////////////////////////////
78 /// Add a daughter track to this.
79 
81 {
82  if (!fTracks) fTracks = new TObjArray(1);
83  Int_t index = fTracks->GetEntriesFast();
84  TGeoTrack *daughter = new TGeoTrack(id,pdgcode,this,particle);
85  fTracks->AddAtAndExpand(daughter,index);
86  return daughter;
87 }
88 
89 ////////////////////////////////////////////////////////////////////////////////
90 /// Add a daughter and return its index.
91 
93 {
94  if (!fTracks) fTracks = new TObjArray(1);
95  Int_t index = fTracks->GetEntriesFast();
96  fTracks->AddAtAndExpand(other,index);
97  other->SetParent(this);
98  return index;
99 }
100 
101 ////////////////////////////////////////////////////////////////////////////////
102 /// Draw animation of this track
103 
104 void TGeoTrack::AnimateTrack(Double_t tmin, Double_t tmax, Double_t nframes, Option_t *option)
105 {
106  if (tmin<0 || tmin>=tmax || nframes<1) return;
109  if (!gPad) {
111  }
112  TList *list = gPad->GetListOfPrimitives();
113  TIter next(list);
114  TObject *obj;
115  while ((obj = next())) {
116  if (!strcmp(obj->ClassName(), "TGeoTrack")) list->Remove(obj);
117  }
118  Double_t dt = (tmax-tmin)/Double_t(nframes);
119  Double_t delt = 2E-9;
120  Double_t t = tmin;
121  Bool_t geomanim = kFALSE;
122  Bool_t issave = kFALSE;
123  TString fname;
124 
125  TString opt(option);
126  if (opt.Contains("/G")) geomanim = kTRUE;
127  if (opt.Contains("/S")) issave = kTRUE;
128 
130  Double_t *box = p->GetViewBox();
131  box[0] = box[1] = box[2] = 0;
132  box[3] = box[4] = box[5] = 100;
133  gGeoManager->SetTminTmax(0,0);
134  Draw(opt.Data());
135  Double_t start[6], end[6];
136  Int_t i, j;
137  Double_t dlat=0, dlong=0, dpsi=0;
138  Double_t dd[6] = {0,0,0,0,0,0};
139  if (geomanim) {
140  p->EstimateCameraMove(tmin+5*dt, tmin+15*dt, start, end);
141  for (i=0; i<3; i++) {
142  start[i+3] = 20 + 1.3*start[i+3];
143  end[i+3] = 20 + 0.9*end[i+3];
144  }
145  for (i=0; i<6; i++) {
146  dd[i] = (end[i]-start[i])/10.;
147  }
148  memcpy(box, start, 6*sizeof(Double_t));
149  p->GetViewAngles(dlong,dlat,dpsi);
150  dlong = (-206-dlong)/Double_t(nframes);
151  dlat = (126-dlat)/Double_t(nframes);
152  dpsi = (75-dpsi)/Double_t(nframes);
153  p->GrabFocus();
154  }
155 
156  for (i=0; i<nframes; i++) {
157  if (t-delt<0) gGeoManager->SetTminTmax(0,t);
158  else gGeoManager->SetTminTmax(t-delt,t);
159  if (geomanim) {
160  for (j=0; j<6; j++) box[j]+=dd[j];
161  p->GrabFocus(1,dlong,dlat,dpsi);
162  } else {
163  gPad->Modified();
164  gPad->Update();
165  }
166  if (issave) {
167  fname = TString::Format("anim%04d.gif", i);
168  gPad->Print(fname);
169  }
170  t += dt;
171  }
173 }
174 
175 ////////////////////////////////////////////////////////////////////////////////
176 /// Add a point on the track.
177 
179 {
180  if (!fPoints) {
181  fPointsSize = 16;
183  } else {
184  if (fNpoints>=fPointsSize) {
185  Double_t *temp = new Double_t[2*fPointsSize];
186  memcpy(temp, fPoints, fNpoints*sizeof(Double_t));
187  fPointsSize *= 2;
188  delete [] fPoints;
189  fPoints = temp;
190  }
191  }
192  fPoints[fNpoints++] = x;
193  fPoints[fNpoints++] = y;
194  fPoints[fNpoints++] = z;
195  fPoints[fNpoints++] = t;
196 }
197 
198 ////////////////////////////////////////////////////////////////////////////////
199 /// How-to-browse for a track.
200 
202 {
203  if (!b) return;
204  Int_t nd = GetNdaughters();
205  if (!nd) {
206  b->Add(this);
207  return;
208  }
209  for (Int_t i=0; i<nd; i++)
210  b->Add(GetDaughter(i));
211 
212 }
213 
214 ////////////////////////////////////////////////////////////////////////////////
215 /// Returns distance to track primitive for picking.
216 
218 {
219  const Int_t inaxis = 7;
220  const Int_t maxdist = 5;
221  Int_t dist = 9999;
222 
223 
224  Int_t puxmin = gPad->XtoAbsPixel(gPad->GetUxmin());
225  Int_t puymin = gPad->YtoAbsPixel(gPad->GetUymin());
226  Int_t puxmax = gPad->XtoAbsPixel(gPad->GetUxmax());
227  Int_t puymax = gPad->YtoAbsPixel(gPad->GetUymax());
228 
229  // return if point is not in the user area
230  if (px < puxmin - inaxis) return dist;
231  if (py > puymin + inaxis) return dist;
232  if (px > puxmax + inaxis) return dist;
233  if (py < puymax - inaxis) return dist;
234 
235  TView *view = gPad->GetView();
236  if (!view) return dist;
237  Int_t imin, imax;
238  if (TObject::TestBit(kGeoPDrawn) && Size(imin,imax)>=2) {
239  Int_t i, dsegment;
240  Double_t x1,y1,x2,y2;
241  Double_t xndc[3];
242  Int_t np = fNpoints>>2;
243  if (imin<0) imin=0;
244  if (imax>np-1) imax=np-1;
245  for (i=imin;i<imax;i++) {
246  view->WCtoNDC(&fPoints[i<<2], xndc);
247  x1 = xndc[0];
248  y1 = xndc[1];
249  view->WCtoNDC(&fPoints[(i+1)<<2], xndc);
250  x2 = xndc[0];
251  y2 = xndc[1];
252  dsegment = DistancetoLine(px,py,x1,y1,x2,y2);
253 // printf("%i: dseg=%i\n", i, dsegment);
254  if (dsegment < dist) {
255  dist = dsegment;
256  if (dist<maxdist) {
257  gPad->SetSelected(this);
258  return 0;
259  }
260  }
261  }
262  }
263  // check now daughters
264  Int_t nd = GetNdaughters();
265  if (!nd) return dist;
266  TGeoTrack *track;
267  for (Int_t id=0; id<nd; id++) {
268  track = (TGeoTrack*)GetDaughter(id);
269  dist = track->DistancetoPrimitive(px,py);
270  if (dist<maxdist) return 0;
271  }
272  return dist;
273 }
274 
275 ////////////////////////////////////////////////////////////////////////////////
276 /// Draw this track over-imposed on a geometry, according to option.
277 /// Options (case sensitive):
278 /// - default : track without daughters
279 /// - /D : track and first level descendents only
280 /// - /* : track and all descendents
281 /// - /Ntype : descendents of this track with particle name matching input type.
282 ///
283 /// Options can appear only once but can be combined : e.g. Draw("/D /Npion-")
284 ///
285 /// Time range for visible track segments can be set via TGeoManager::SetTminTmax()
286 
288 {
289  if (!gPad) gGeoManager->GetMasterVolume()->Draw();
290  char *opt1 = Compress(option); // we will have to delete this ?
291  TString opt(opt1);
292  Bool_t is_default = kTRUE;
293  Bool_t is_onelevel = kFALSE;
294  Bool_t is_all = kFALSE;
295  Bool_t is_type = kFALSE;
296  if (opt.Contains("/D")) {
297  is_onelevel = kTRUE;
298  is_default = kFALSE;
299  }
300  if (opt.Contains("/*")) {
301  is_all = kTRUE;
302  is_default = kFALSE;
303  }
304  if (opt.Contains("/N")) {
305  is_type = kTRUE;
306  Int_t ist = opt.Index("/N")+2;
307  Int_t ilast = opt.Index("/",ist);
308  if (ilast<0) ilast=opt.Length();
309  TString type = opt(ist, ilast-ist);
311  }
312  SetBits(is_default, is_onelevel, is_all, is_type);
313  AppendPad("SAME");
314  if (!gGeoManager->IsAnimatingTracks()) {
315  gPad->Modified();
316  gPad->Update();
317  }
318  delete [] opt1;
319  return;
320 }
321 
322  ///////////////////////////////////////////////////////////////////////////////
323  /// Event treatment.
324 
325 void TGeoTrack::ExecuteEvent(Int_t /*event*/, Int_t /*px*/, Int_t /*py*/)
326 {
327  if (!gPad) return;
328  gPad->SetCursor(kHand);
329 }
330 
331 ////////////////////////////////////////////////////////////////////////////////
332 /// Get some info about the track.
333 
334 char *TGeoTrack::GetObjectInfo(Int_t /*px*/, Int_t /*py*/) const
335 {
336  static TString info;
337  Double_t x=0,y=0,z=0,t=0;
338  GetPoint(0,x,y,z,t);
339  info = TString::Format("%s (%g, %g, %g) tof=%g", GetName(),x,y,z,t);
340  return (char*)info.Data();
341 }
342 
343 ////////////////////////////////////////////////////////////////////////////////
344 /// Get coordinates for point I on the track.
345 
347 {
348  Int_t np = fNpoints>>2;
349  if (i<0 || i>=np) {
350  Error("GetPoint", "no point %i, indmax=%d", i, np-1);
351  return -1;
352  }
353  Int_t icrt = 4*i;
354  x = fPoints[icrt];
355  y = fPoints[icrt+1];
356  z = fPoints[icrt+2];
357  t = fPoints[icrt+3];
358  return i;
359 }
360 
361 ////////////////////////////////////////////////////////////////////////////////
362 /// Return the pointer to the array of points starting with index I.
363 
365 {
366  if (!fNpoints) return 0;
367  return (&fPoints[i<<2]);
368 }
369 
370 ////////////////////////////////////////////////////////////////////////////////
371 /// Return the index of point on track having closest TOF smaller than
372 /// the input value. Output POINT is filled with the interpolated value.
373 
374 Int_t TGeoTrack::GetPoint(Double_t tof, Double_t *point, Int_t istart) const
375 {
376  Int_t np = fNpoints>>2;
377  if (istart>(np-2)) return (np-1);
378  Int_t ip = SearchPoint(tof, istart);
379  if (ip<0 || ip>(np-2)) return ip;
380  // point in segment (ip, ip+1) where 0<=ip<fNpoints-1
381  Int_t i;
382  Int_t j = ip<<2;
383  Int_t k = (ip+1)<<2;
384  Double_t dt = tof-fPoints[j+3];
385  Double_t ddt = fPoints[k+3]-fPoints[j+3];
386  for (i=0; i<3; i++) point[i] = fPoints[j+i] +(fPoints[k+i]-fPoints[j+i])*dt/ddt;
387  return ip;
388 }
389 
390 ////////////////////////////////////////////////////////////////////////////////
391 /// Paint this track (and descendents) with current attributes.
392 
394 {
395  Bool_t is_default = TObject::TestBit(kGeoPDefault);
396  Bool_t is_onelevel = TObject::TestBit(kGeoPOnelevel);
398  Bool_t is_type = TObject::TestBit(kGeoPType);
399  Bool_t match_type = kTRUE;
401  if (is_type) {
402  const char *type = gGeoManager->GetParticleName();
403  if (strlen(type) && strcmp(type, GetName())) match_type=kFALSE;
404  }
405  if (match_type) {
406  if (is_default || is_onelevel || is_all) PaintTrack(option);
407  }
408  // paint now daughters
409  Int_t nd = GetNdaughters();
410  if (!nd || is_default) return;
411  TGeoTrack *track;
412  for (Int_t i=0; i<nd; i++) {
413  track = (TGeoTrack*)GetDaughter(i);
414  if (track->IsInTimeRange()) {
415  track->SetBits(is_default,kFALSE,is_all,is_type);
416  track->Paint(option);
417  }
418  }
419 }
420 
421 ////////////////////////////////////////////////////////////////////////////////
422 /// Paint track and daughters.
423 
425 {
426  Bool_t is_default = TObject::TestBit(kGeoPDefault);
427  Bool_t is_onelevel = TObject::TestBit(kGeoPOnelevel);
429  Bool_t is_type = TObject::TestBit(kGeoPType);
430  Bool_t match_type = kTRUE;
431  if (is_type) {
432  const char *type = gGeoManager->GetParticleName();
433  if (strlen(type) && strcmp(type, GetName())) match_type=kFALSE;
434  }
435  if (match_type) {
436  if (is_default || is_onelevel || is_all) PaintCollectTrack(time, box);
437  }
438  // loop now daughters
439  Int_t nd = GetNdaughters();
440  if (!nd || is_default) return;
441  TGeoTrack *track;
442  for (Int_t i=0; i<nd; i++) {
443  track = (TGeoTrack*)GetDaughter(i);
444  if (track) track->PaintCollect(time, box);
445  }
446 }
447 
448 ////////////////////////////////////////////////////////////////////////////////
449 /// Paint just this track.
450 
452 {
454  if (!painter) return;
455  Int_t np = fNpoints>>2;
456  Double_t point[3], local[3];
458  Int_t ip = GetPoint(time, point);
459  if (ip>=0 && ip<np-1) {
460  if (convert) gGeoManager->MasterToTop(point, local);
461  else memcpy(local, point, 3*sizeof(Double_t));
462  painter->AddTrackPoint(local, box);
463  }
464 }
465 
466 ////////////////////////////////////////////////////////////////////////////////
467 /// Paint current point of the track as marker.
468 
470 {
471  TPoint p;
472  Double_t xndc[3];
473  TView *view = gPad->GetView();
474  if (!view) return;
475  view->WCtoNDC(point, xndc);
476  if (xndc[0] < gPad->GetX1() || xndc[0] > gPad->GetX2()) return;
477  if (xndc[1] < gPad->GetY1() || xndc[1] > gPad->GetY2()) return;
478  p.fX = gPad->XtoPixel(xndc[0]);
479  p.fY = gPad->YtoPixel(xndc[1]);
481  gVirtualX->DrawPolyMarker(1, &p);
482 }
483 
484 ////////////////////////////////////////////////////////////////////////////////
485 /// Paint this track with its current attributes.
486 
488 {
489  // Check whether there is some 3D view class for this TPad
490 // TPadView3D *view3D = (TPadView3D*)gPad->GetView3D();
491 // if (view3D) view3D->PaintGeoTrack(this,option); // to be implemented
492 
493  // Check if option is 'x3d'. NOTE: This is a simple checking
494  // but since there is no other
495  // options yet, this works fine.
496  TString opt(option);
497  opt.ToLower();
499  if (opt.Contains("x")) return;
500  Int_t np = fNpoints>>2;
501  Int_t imin=0;
502  Int_t imax=np-1;
503  Int_t ip;
504  Double_t start[3] = {0.,0.,0.};
505  Double_t end[3] = {0.,0.,0.};
506  Double_t seg[6] = {0.,0.,0.,0.,0.,0.};
508  Double_t tmin=0.,tmax=0.;
509  Bool_t is_time = gGeoManager->GetTminTmax(tmin,tmax);
510  if (is_time) {
511  imin = GetPoint(tmin, start);
512  if (imin>=0 && imin<np-1) {
513  // we have a starting point -> find ending point
514  imax = GetPoint(tmax, end, imin);
515  if (imax<np-1) {
516  // we also have an ending point -> check if on the same segment with imin
517  if (imax==imin) {
518  // paint the virtual segment between the 2 points
520  if (convert) {
521  gGeoManager->MasterToTop(start, &seg[0]);
522  gGeoManager->MasterToTop(end, &seg[3]);
523  gPad->PaintLine3D(&seg[0], &seg[3]);
524  } else {
525  gPad->PaintLine3D(start, end);
526  }
527  } else {
528  // paint the starting, ending and connecting segments
530  if (convert) {
531  gGeoManager->MasterToTop(start, &seg[0]);
532  gGeoManager->MasterToTop(&fPoints[(imin+1)<<2], &seg[3]);
533  gPad->PaintLine3D(&seg[0], &seg[3]);
534  gGeoManager->MasterToTop(&fPoints[imax<<2], &seg[0]);
535  gGeoManager->MasterToTop(end, &seg[3]);
536  gPad->PaintLine3D(&seg[0], &seg[3]);
537  for (ip=imin+1; ip<imax; ip++) {
538  gGeoManager->MasterToTop(&fPoints[ip<<2], &seg[0]);
539  gGeoManager->MasterToTop(&fPoints[(ip+1)<<2], &seg[3]);
540  gPad->PaintLine3D(&seg[0], &seg[3]);
541  }
542  } else {
543  gPad->PaintLine3D(start, &fPoints[(imin+1)<<2]);
544  gPad->PaintLine3D(&fPoints[imax<<2], end);
545  for (ip=imin+1; ip<imax; ip++) {
546  gPad->PaintLine3D(&fPoints[ip<<2], &fPoints[(ip+1)<<2]);
547  }
548  }
549  }
550  if (convert) {
551  gGeoManager->MasterToTop(end, &seg[0]);
552  PaintMarker(&seg[0]);
553  } else {
554  PaintMarker(end);
555  }
556  } else {
558  if (convert) {
559  gGeoManager->MasterToTop(start, &seg[0]);
560  gGeoManager->MasterToTop(&fPoints[(imin+1)<<2], &seg[3]);
561  gPad->PaintLine3D(&seg[0], &seg[3]);
562  for (ip=imin+1; ip<np-2; ip++) {
563  gGeoManager->MasterToTop(&fPoints[ip<<2], &seg[0]);
564  gGeoManager->MasterToTop(&fPoints[(ip+1)<<2], &seg[3]);
565  gPad->PaintLine3D(&seg[0], &seg[3]);
566  }
567  } else {
568  gPad->PaintLine3D(start, &fPoints[(imin+1)<<2]);
569  for (ip=imin+1; ip<np-2; ip++) {
570  gPad->PaintLine3D(&fPoints[ip<<2], &fPoints[(ip+1)<<2]);
571  }
572  }
573  }
574  } else {
575  imax = GetPoint(tmax, end);
576  if (imax<0 || imax>=(np-1)) return;
577  // we have to draw just the end of the track
579  if (convert) {
580  for (ip=0; ip<imax-1; ip++) {
581  gGeoManager->MasterToTop(&fPoints[ip<<2], &seg[0]);
582  gGeoManager->MasterToTop(&fPoints[(ip+1)<<2], &seg[3]);
583  gPad->PaintLine3D(&seg[0], &seg[3]);
584  }
585  } else {
586  for (ip=0; ip<imax-1; ip++) {
587  gPad->PaintLine3D(&fPoints[ip<<2], &fPoints[(ip+1)<<2]);
588  }
589  }
590  if (convert) {
591  gGeoManager->MasterToTop(&fPoints[imax<<2], &seg[0]);
592  gGeoManager->MasterToTop(end, &seg[3]);
593  gPad->PaintLine3D(&seg[0], &seg[3]);
594  PaintMarker(&seg[3]);
595  } else {
596  gPad->PaintLine3D(&fPoints[imax<<2], end);
597  PaintMarker(end);
598  }
599  }
601  return;
602  }
603 
604  // paint all segments from track
606  TAttLine::Modify(); // change attributes if necessary
607  for (ip=imin; ip<imax; ip++) {
608  gPad->PaintLine3D(&fPoints[ip<<2], &fPoints[(ip+1)<<2]);
609  }
610 }
611 
612 ////////////////////////////////////////////////////////////////////////////////
613 /// Print some info about the track.
614 
615 void TGeoTrack::Print(Option_t * /*option*/) const
616 {
617  Int_t np = fNpoints>>2;
618  printf(" TGeoTrack%6i : %s ===============================\n", fId,GetName());
619  printf(" parent =%6i nd =%3i\n", (fParent)?fParent->GetId():-1, GetNdaughters());
620  Double_t x=0,y=0,z=0,t=0;
621  GetPoint(0,x,y,z,t);
622  printf(" production vertex : (%g, %g, %g) at tof=%g\n", x,y,z,t);
623  GetPoint(np-1,x,y,z,t);
624  printf(" Npoints =%6i, last : (%g, %g, %g) at tof=%g\n\n", np,x,y,z,t);
625 }
626 
627 ////////////////////////////////////////////////////////////////////////////////
628 /// Return the number of points within the time interval specified by
629 /// TGeoManager class and the corresponding indices.
630 
632 {
633  Double_t tmin, tmax;
634  Int_t np = fNpoints>>2;
635  imin = 0;
636  imax = np-1;
637  Int_t size = np;
638  if (!gGeoManager->GetTminTmax(tmin, tmax)) return size;
639  imin = SearchPoint(tmin);
640  imax = SearchPoint(tmax, imin);
641  return (imax-imin+1);
642 }
643 
644 ////////////////////////////////////////////////////////////////////////////////
645 /// Search index of track point having the closest time tag smaller than
646 /// TIME. Optional start index can be provided.
647 
649 {
650  Int_t nabove, nbelow, middle, midloc;
651  Int_t np = fNpoints>>2;
652  nabove = np+1;
653  nbelow = istart;
654  while (nabove-nbelow > 1) {
655  middle = (nabove+nbelow)/2;
656  midloc = ((middle-1)<<2)+3;
657  if (time == fPoints[midloc]) return middle-1;
658  if (time < fPoints[midloc]) nabove = middle;
659  else nbelow = middle;
660  }
661  return (nbelow-1);
662 }
663 
664 ////////////////////////////////////////////////////////////////////////////////
665 /// Set drawing bits for this track
666 
667 void TGeoTrack::SetBits(Bool_t is_default, Bool_t is_onelevel,
668  Bool_t is_all, Bool_t is_type)
669 {
670  TObject::SetBit(kGeoPDefault, is_default);
671  TObject::SetBit(kGeoPOnelevel, is_onelevel);
673  TObject::SetBit(kGeoPType, is_type);
674 }
675 
676 ////////////////////////////////////////////////////////////////////////////////
677 /// Returns 3D size for the track.
678 
680 {
681 }
682 
683 ////////////////////////////////////////////////////////////////////////////////
684 /// Reset data for this track.
685 
687 {
688  fNpoints = 0;
689  fPointsSize = 0;
690  if (fTracks) {fTracks->Delete(); delete fTracks;}
691  fTracks = 0;
692  if (fPoints) delete [] fPoints;
693  fPoints = 0;
694 }
695 
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:43
Int_t SearchPoint(Double_t time, Int_t istart=0) const
Search index of track point having the closest time tag smaller than TIME.
Definition: TGeoTrack.cxx:648
TGeoTrack()
Default constructor.
Definition: TGeoTrack.cxx:37
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48
An array of TObjects.
Definition: TObjArray.h:37
virtual void GetViewAngles(Double_t &, Double_t &, Double_t &)
Bool_t GetTminTmax(Double_t &tmin, Double_t &tmax) const
Get time cut for drawing tracks.
virtual const char * GetName() const
Get the PDG name.
Bool_t IsInTimeRange() const
True if track TOF range overlaps with time interval of TGeoManager.
char * Compress(const char *str)
Remove all blanks from the string str.
Definition: TString.cxx:2504
virtual Double_t * GetViewBox()=0
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)=0
virtual void PaintCollectTrack(Double_t time, Double_t *box)
Paint just this track.
Definition: TGeoTrack.cxx:451
const char Option_t
Definition: RtypesCore.h:62
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
Definition: TObjArray.cxx:355
void SetParticleName(const char *pname)
Definition: TGeoManager.h:260
virtual void Draw(Option_t *option="")
draw top volume according to option
See TView3D.
Definition: TView.h:25
SCoord_t fX
Definition: TPoint.h:35
virtual void PaintCollect(Double_t time, Double_t *box)
Paint track and daughters.
Definition: TGeoTrack.cxx:424
Int_t fPointsSize
Definition: TGeoTrack.h:43
virtual void Draw(Option_t *option="")
Draw this track over-imposed on a geometry, according to option.
Definition: TGeoTrack.cxx:287
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:634
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
SCoord_t fY
Definition: TPoint.h:36
Basic string class.
Definition: TString.h:131
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1125
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TGeoVolume * GetMasterVolume() const
Definition: TGeoManager.h:529
virtual void Modify()
Change current line attributes if necessary.
Definition: TAttLine.cxx:242
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
virtual void Paint(Option_t *option="")
Paint this track (and descendents) with current attributes.
Definition: TGeoTrack.cxx:393
Int_t GetId() const
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition: TObject.cxx:105
virtual void ResetTrack()
Reset data for this track.
Definition: TGeoTrack.cxx:686
virtual TVirtualGeoTrack * AddDaughter(Int_t id, Int_t pdgcode, TObject *particle=0)
Add a daughter track to this.
Definition: TGeoTrack.cxx:80
static const double x2[5]
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:128
Double_t x[n]
Definition: legend1.C:17
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Definition: TString.cxx:2311
virtual void GrabFocus(Int_t nfr=0, Double_t dlong=0, Double_t dlat=0, Double_t dpsi=0)=0
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition: TAttMarker.h:38
Base class for user-defined tracks attached to a geometry.
XFontStruct * id
Definition: TGX11.cxx:108
Bool_t IsAnimatingTracks() const
Definition: TGeoManager.h:408
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Event treatment.
Definition: TGeoTrack.cxx:325
Definition: TPoint.h:31
A doubly linked list.
Definition: TList.h:44
virtual void PaintTrack(Option_t *option="")
Paint this track with its current attributes.
Definition: TGeoTrack.cxx:487
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
virtual void Print(Option_t *option="") const
Print some info about the track.
Definition: TGeoTrack.cxx:615
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
virtual void Modify()
Change current marker attributes if necessary.
Definition: TAttMarker.cxx:314
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y, Double_t &z, Double_t &t) const
Get coordinates for point I on the track.
Definition: TGeoTrack.cxx:346
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Returns distance to track primitive for picking.
Definition: TGeoTrack.cxx:217
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
Definition: TObjArray.cxx:234
virtual void AddPoint(Double_t x, Double_t y, Double_t z, Double_t t)
Add a point on the track.
Definition: TGeoTrack.cxx:178
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:819
Int_t Size(Int_t &imin, Int_t &imax)
Return the number of points within the time interval specified by TGeoManager class and the correspon...
Definition: TGeoTrack.cxx:631
virtual void AnimateTrack(Double_t tmin=0, Double_t tmax=5E-8, Double_t nframes=200, Option_t *option="/*")
Draw animation of this track.
Definition: TGeoTrack.cxx:104
Int_t GetEntriesFast() const
Definition: TObjArray.h:64
virtual void EstimateCameraMove(Double_t, Double_t, Double_t *, Double_t *)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
Ssiz_t Length() const
Definition: TString.h:405
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition: TAttMarker.h:40
TVirtualGeoTrack * GetDaughter(Int_t index) const
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Definition: TAttMarker.h:41
#define gVirtualX
Definition: TVirtualX.h:345
constexpr Double_t E()
Base of natural log: .
Definition: TMath.h:97
Int_t fNpoints
Definition: TGeoTrack.h:44
const Bool_t kFALSE
Definition: RtypesCore.h:88
void convert(R1 const &, R2 const)
Definition: 3DConversions.h:41
Double_t * fPoints
Definition: TGeoTrack.h:45
static const double x1[5]
#define ClassImp(name)
Definition: Rtypes.h:365
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:600
double Double_t
Definition: RtypesCore.h:55
int type
Definition: TGX11.cxx:120
void Browse(TBrowser *b)
How-to-browse for a track.
Definition: TGeoTrack.cxx:201
Double_t y[n]
Definition: legend1.C:17
Int_t DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
Compute distance from point px,py to a line.
Definition: TAttLine.cxx:206
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
void SetTminTmax(Double_t tmin=0, Double_t tmax=999)
Set time cut interval for drawing tracks.
Mother of all ROOT objects.
Definition: TObject.h:37
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
void MasterToTop(const Double_t *master, Double_t *top) const
Convert coordinates from master volume frame to top.
Abstract class for geometry painters.
Class for user-defined tracks attached to a geometry.
Definition: TGeoTrack.h:30
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Get some info about the track.
Definition: TGeoTrack.cxx:334
void SetVisLevel(Int_t level=3)
set default level down to which visualization is performed
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
void SetAnimateTracks(Bool_t flag=kTRUE)
Definition: TGeoManager.h:578
TObjArray * fTracks
#define gPad
Definition: TVirtualPad.h:286
virtual void AddTrackPoint(Double_t *point, Double_t *box, Bool_t reset=kFALSE)=0
virtual ~TGeoTrack()
Destructor.
Definition: TGeoTrack.cxx:71
TGeoVolume * GetTopVolume() const
Definition: TGeoManager.h:530
Int_t GetNdaughters() const
const Bool_t kTRUE
Definition: RtypesCore.h:87
TVirtualGeoPainter * GetGeomPainter()
Make a default painter if none present. Returns pointer to it.
virtual void Sizeof3D() const
Returns 3D size for the track.
Definition: TGeoTrack.cxx:679
TVirtualGeoTrack * fParent
void PaintMarker(Double_t *point, Option_t *option="")
Paint current point of the track as marker.
Definition: TGeoTrack.cxx:469
void SetParent(TVirtualGeoTrack *parent)
void SetBits(Bool_t is_default=kTRUE, Bool_t is_onelevel=kFALSE, Bool_t is_all=kFALSE, Bool_t is_type=kFALSE)
Set drawing bits for this track.
Definition: TGeoTrack.cxx:667
const char * GetParticleName() const
Definition: TGeoManager.h:261
const char * Data() const
Definition: TString.h:364