62 TPrimary::TPrimary(Int_t part, Int_t first, Int_t second, Int_t gener,
63 Double_t px, Double_t py, Double_t pz,
64 Double_t etot, Double_t vx, Double_t vy, Double_t vz,
65 Double_t time, Double_t timend,
const char *type)
69 fSecondMother = second;
102 Int_t TPrimary::DistancetoPrimitive(Int_t px, Int_t py)
104 const Int_t big = 9999;
105 Float_t xv[3], xe[3], xndc[3];
106 Float_t rmin[3], rmax[3];
107 TView *view = gPad->GetView();
108 if(!view)
return big;
111 Float_t pmom = TMath::Sqrt(fPx*fPx+fPy*fPy+fPz*fPz);
112 if (pmom == 0)
return big;
113 view->GetRange(rmin,rmax);
114 Float_t rbox = rmax[2];
118 xe[0] = fVx+rbox*fPx/pmom;
119 xe[1] = fVy+rbox*fPy/pmom;
120 xe[2] = fVz+rbox*fPz/pmom;
121 view->WCtoNDC(xv, xndc);
122 Float_t x1 = xndc[0];
123 Float_t y1 = xndc[1];
124 view->WCtoNDC(xe, xndc);
125 Float_t x2 = xndc[0];
126 Float_t y2 = xndc[1];
128 return DistancetoLine(px,py,x1,y1,x2,y2);
136 void TPrimary::ExecuteEvent(Int_t, Int_t, Int_t)
138 gPad->SetCursor(kPointer);
144 const char *TPrimary::GetName()
const
146 static char def[4] =
"XXX";
147 const TAttParticle *ap = GetParticle();
148 if (ap)
return ap->GetName();
157 const TAttParticle *TPrimary::GetParticle()
const
159 if (!TAttParticle::fgList) TAttParticle::DefinePDG();
160 return TAttParticle::GetParticle(fPart);
166 const char *TPrimary::GetTitle()
const
168 static char title[128];
169 Float_t pmom = TMath::Sqrt(fPx*fPx+fPy*fPy+fPz*fPz);
170 snprintf(title,128,
"pmom=%f GeV",pmom);
179 void TPrimary::Paint(Option_t *option)
181 Float_t rmin[3], rmax[3];
182 static TPolyLine3D *pline = 0;
184 pline =
new TPolyLine3D(2);
186 Float_t pmom = TMath::Sqrt(fPx*fPx+fPy*fPy+fPz*fPz);
187 if (pmom == 0)
return;
188 TView *view = gPad->GetView();
190 view->GetRange(rmin,rmax);
191 Float_t rbox = rmax[2];
192 pline->SetPoint(0,fVx, fVy, fVz);
193 Float_t xend = fVx+rbox*fPx/pmom;
194 Float_t yend = fVy+rbox*fPy/pmom;
195 Float_t zend = fVz+rbox*fPz/pmom;
196 pline->SetPoint(1, xend, yend, zend);
197 pline->SetLineColor(GetLineColor());
198 pline->SetLineStyle(GetLineStyle());
199 pline->SetLineWidth(GetLineWidth());
200 pline->Paint(option);
208 void TPrimary::Print(Option_t *)
const
210 char def[8] =
"XXXXXXX";
212 TAttParticle *ap = (TAttParticle*)GetParticle();
213 if (ap) name = ap->GetName();
215 Printf(
"TPrimary: %-13s p: %8f %8f %8f Vertex: %8e %8e %8e %5d %5d %s",
216 name,fPx,fPy,fPz,fVx,fVy,fVz,
217 fFirstMother,fSecondMother,fType.Data());
224 void TPrimary::Sizeof3D()
const
226 Float_t pmom = TMath::Sqrt(fPx*fPx+fPy*fPy+fPz*fPz);
227 if (pmom == 0)
return;
229 gSize3D.numPoints += npoints;
230 gSize3D.numSegs += (npoints-1);
231 gSize3D.numPolys += 0;