#include "TGeoManager.h"
#include "TVirtualGeoTrack.h"
ClassImp(TVirtualGeoTrack)
TVirtualGeoTrack::TVirtualGeoTrack()
{
fPDG = 0;
fId = -1;
fParent = 0;
fParticle = 0;
fTracks = 0;
}
TVirtualGeoTrack::TVirtualGeoTrack(Int_t id, Int_t pdgcode, TVirtualGeoTrack *parent, TObject *particle)
{
fPDG = pdgcode;
fId = id;
fParent = parent;
fParticle = particle;
fTracks = 0;
}
TVirtualGeoTrack::TVirtualGeoTrack(const TVirtualGeoTrack& other)
:TObject(other), TGeoAtt(other), TAttLine(other), TAttMarker(other),
fPDG(other.fPDG),
fId(other.fId),
fParent(other.fParent),
fParticle(other.fParticle),
fTracks(other.fTracks)
{
}
TVirtualGeoTrack& TVirtualGeoTrack::operator=(const TVirtualGeoTrack& gv)
{
if(this!=&gv) {
TObject::operator=(gv);
TGeoAtt::operator=(gv);
TAttLine::operator=(gv);
TAttMarker::operator=(gv);
fPDG=gv.fPDG;
fId=gv.fId;
fParent=gv.fParent;
fParticle=gv.fParticle;
fTracks=gv.fTracks;
}
return *this;
}
TVirtualGeoTrack::~TVirtualGeoTrack()
{
if (fTracks) {
fTracks->Delete();
delete fTracks;
}
}
const char *TVirtualGeoTrack::GetName() const
{
return gGeoManager->GetPdgName(fPDG);
}
Bool_t TVirtualGeoTrack::IsInTimeRange() const
{
Double_t tmin, tmax;
Bool_t timecut = gGeoManager->GetTminTmax(tmin,tmax);
if (!timecut) return kTRUE;
const Double_t *point = GetFirstPoint();
if (!point) return kFALSE;
if (point[3]>tmax) return kFALSE;
point = GetLastPoint();
if (point[3]<tmin) return kFALSE;
return kTRUE;
}
void TVirtualGeoTrack::SetName(const char *name)
{
gGeoManager->SetPdgName(fPDG, name);
if (!strcmp(name, "gamma")) {
SetLineColor(kGreen);
SetMarkerColor(kGreen);
SetLineWidth(1);
SetLineStyle(kDotted);
return;
}
if (!strcmp(name, "pi+") || !strcmp(name, "proton") || !strcmp(name, "K+")) {
SetLineColor(kRed);
SetMarkerColor(kRed);
SetLineWidth(2);
return;
}
if (!strcmp(name, "pi-") || !strcmp(name, "K-")) {
SetLineColor(30);
SetMarkerColor(30);
SetLineWidth(2);
return;
}
if (!strcmp(name, "pi0") || !strcmp(name, "K0")) {
SetLineColor(kCyan);
SetMarkerColor(kCyan);
SetLineWidth(2);
return;
}
if (!strcmp(name, "neutron")) {
SetLineColor(16);
SetMarkerColor(16);
SetLineWidth(1);
SetLineStyle(kDotted);
return;
}
if (!strcmp(name, "Alpha") || !strcmp(name, "Deuteron") || !strcmp(name, "Triton")) {
SetLineColor(kMagenta);
SetMarkerColor(kMagenta);
SetLineWidth(3);
return;
}
if (!strcmp(name, "e-") || !strcmp(name, "mu-")) {
SetLineColor(kBlue);
SetMarkerColor(kBlue);
SetLineWidth(1);
SetLineStyle(kDotted);
return;
}
if (!strcmp(name, "e+") || !strcmp(name, "mu+")) {
SetLineColor(kMagenta);
SetMarkerColor(kMagenta);
SetLineWidth(1);
SetLineStyle(kDotted);
return;
}
}
Last change: Wed Jun 25 08:54:48 2008
Last generated: 2008-06-25 08:54
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.