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