8 #include <TGeoManager.h> 11 #include <TEveManager.h> 13 #include <TDatabasePDG.h> 14 #include <TParticlePDG.h> 21 "Geant4 Trajectories");
38 std::cout <<
"Handle the trajectories" <<
std::endl;
46 std::ostringstream
label;
47 label << traj->GetName()
48 <<
" (" << traj->GetInitialMomentum().E() <<
" MeV)";
50 if (traj->GetParentId() < 1) {
51 std::cout <<
"Primary " << traj->GetTrackId()
52 <<
" " << traj->GetName()
53 <<
" " << traj->GetInitialMomentum().P() <<
" MeV/c" 54 <<
" w/ points " << points.size()
60 TParticlePDG* particle
61 = TDatabasePDG::Instance()->GetParticle(traj->GetPDGCode());
63 if (
std::abs(particle->Charge()) > 0.01) charged =
true;
64 particleClass = particle->ParticleClass();
67 TEveLine *track =
new TEveLine();
68 track->SetName(
"trajectory");
69 track->SetTitle(label.str().c_str());
71 if (particleClass ==
"Lepton") track->SetLineColor(kMagenta);
72 else if (particleClass ==
"Baryon") track->SetLineColor(kOrange);
73 else if (particleClass ==
"Meson") track->SetLineColor(kGreen);
74 else if (particleClass ==
"GaugeBoson") track->SetLineColor(kCyan);
75 else track->SetLineColor(kRed);
77 if (charged) track->SetLineStyle(3);
78 else track->SetLineStyle(4);
80 for (std::size_t
p = 0;
p < points.size(); ++
p) {
82 points[
p].GetPosition().
X(),
83 points[
p].GetPosition().
Y(),
84 points[
p].GetPosition().
Z());
std::vector< TG4TrajectoryPoint > TrajectoryPoints
~TTrajectoryChangeHandler()
TG4TrajectoryContainer Trajectories
TTrajectoryChangeHandler()
TEveElementList * fTrajectoryList
The trajectories to draw in the event.
static TEventDisplay & Get(void)
TG4Event * gEDepSimEvent
The event being displayed.
virtual void Apply()
Draw the trajectories into the current scene.
QTextStream & endl(QTextStream &s)