28 ClassImp(TVirtualGeoTrack);
33 TVirtualGeoTrack::TVirtualGeoTrack()
46 TVirtualGeoTrack::TVirtualGeoTrack(Int_t
id, Int_t pdgcode, TVirtualGeoTrack *parent, TObject *particle)
58 TVirtualGeoTrack::TVirtualGeoTrack(
const TVirtualGeoTrack& other)
59 :TObject(other), TGeoAtt(other), TAttLine(other), TAttMarker(other),
62 fParent(other.fParent),
63 fParticle(other.fParticle),
64 fTracks(other.fTracks)
71 TVirtualGeoTrack& TVirtualGeoTrack::operator=(
const TVirtualGeoTrack& gv)
74 TObject::operator=(gv);
75 TGeoAtt::operator=(gv);
76 TAttLine::operator=(gv);
77 TAttMarker::operator=(gv);
81 fParticle=gv.fParticle;
90 TVirtualGeoTrack::~TVirtualGeoTrack()
101 Int_t TVirtualGeoTrack::GetDaughterId(Int_t index)
const
103 TVirtualGeoTrack *daughter = GetDaughter(index);
105 Error(
"GetDaughterId",
"No daughter track with index %d", index);
108 return daughter->GetId();
115 TVirtualGeoTrack *TVirtualGeoTrack::FindTrackWithId(Int_t
id)
const
117 TVirtualGeoTrack* trk=0;
119 trk = (TVirtualGeoTrack*)
this;
122 TVirtualGeoTrack* kid=0;
123 Int_t nd = GetNdaughters();
124 for (Int_t i=0; i<nd; i++)
if (GetDaughterId(i) ==
id)
return GetDaughter(i);
125 for (Int_t i=0; i<nd; i++) {
126 kid = GetDaughter(i);
128 trk = kid->FindTrackWithId(
id);
138 const char *TVirtualGeoTrack::GetName()
const
140 return gGeoManager->GetPdgName(fPDG);
146 Bool_t TVirtualGeoTrack::IsInTimeRange()
const
149 Bool_t timecut = gGeoManager->GetTminTmax(tmin,tmax);
150 if (!timecut)
return kTRUE;
151 const Double_t *point = GetFirstPoint();
152 if (!point)
return kFALSE;
153 if (point[3]>tmax)
return kFALSE;
154 point = GetLastPoint();
155 if (point[3]<tmin)
return kFALSE;
162 void TVirtualGeoTrack::SetName(
const char *name)
164 gGeoManager->SetPdgName(fPDG, name);
165 if (!strcmp(name,
"gamma")) {
166 SetLineColor(kGreen);
167 SetMarkerColor(kGreen);
169 SetLineStyle(kDotted);
172 if (!strcmp(name,
"pi+") || !strcmp(name,
"proton") || !strcmp(name,
"K+")) {
174 SetMarkerColor(kRed);
178 if (!strcmp(name,
"pi-") || !strcmp(name,
"K-")) {
184 if (!strcmp(name,
"pi0") || !strcmp(name,
"K0")) {
186 SetMarkerColor(kCyan);
190 if (!strcmp(name,
"neutron")) {
194 SetLineStyle(kDotted);
197 if (!strcmp(name,
"Alpha") || !strcmp(name,
"Deuteron") || !strcmp(name,
"Triton")) {
198 SetLineColor(kMagenta);
199 SetMarkerColor(kMagenta);
203 if (!strcmp(name,
"e-") || !strcmp(name,
"mu-")) {
205 SetMarkerColor(kBlue);
207 SetLineStyle(kDotted);
210 if (!strcmp(name,
"e+") || !strcmp(name,
"mu+")) {
211 SetLineColor(kMagenta);
212 SetMarkerColor(kMagenta);
214 SetLineStyle(kDotted);