14 #include "TEveBrowser.h"
15 #include "TEveScene.h"
16 #include "TEveTrackPropagator.h"
17 #include "TEveTrans.h"
22 #include "TParticlePDG.h"
27 #include "application/Application.h"
28 #include "application/event/InteractionTree.h"
29 #include "application/gui/MainWindow.h"
32 static const std::string routineName(
"MainWindow::SetMCTruth");
35 COUT(DEBUG) << nPrim <<
" Primary particles " <<
ENDL;
39 TEveTrackList *trackList =
new TEveTrackList(
"Primary Particles");
41 TEveTrackPropagator *trkProp = trackList->GetPropagator();
42 trkProp->SetStepper(TEveTrackPropagator::kRungeKutta);
44 TString primString =
"";
47 for (
int iPrim = 0; iPrim < nPrim; iPrim++) {
52 TParticle *tempPart =
new TParticle();
53 tempPart->SetPdgCode(thisPrim->
PDGCode);
54 tempPart->SetStatusCode(1);
55 tempPart->SetMother(0, 0);
56 COUT(DEBUG) << tempPart->GetMass() <<
" " << tempPart->GetNDaughters() <<
ENDL;
58 TLorentzVector lpos(thisPrim->
pos[0], thisPrim->
pos[1], thisPrim->
pos[2], thisPrim->
time);
60 lmom.SetXYZM(thisPrim->
mom[0], thisPrim->
mom[1], thisPrim->
mom[2], tempPart->GetMass());
62 tempPart->SetProductionVertex(lpos);
63 tempPart->SetMomentum(lmom);
65 primString +=
"Particle: ";
66 primString += tempPart->GetName();
67 primString += Form(
"\nE_{0}: %5.3f GeV", tempPart->Energy() - tempPart->GetMass());
68 primString += Form(
"\ntheta = %5.3f deg - phi = %5.3f deg", 180 * (1 - tempPart->Theta() / TMath::Pi()),
69 180 * tempPart->Phi() / TMath::Pi());
71 TEveTrack *thisTrack =
new TEveTrack(tempPart, thisPrim->
trackID, trkProp);
72 thisTrack->SetLineWidth(2);
73 if (tempPart->GetPDG()->Charge() > 0)
74 thisTrack->SetMainColor(kCyan);
75 else if (tempPart->GetPDG()->Charge() < 0)
76 thisTrack->SetMainColor(kRed);
78 thisTrack->SetMainColor(kYellow);
80 thisTrack->IncDenyDestroy();
81 thisTrack->SetName(Form(
"Prim Track %d", thisPrim->
trackID));
82 thisTrack->SetStdTitle();
84 trackList->AddElement(thisTrack);
87 trackList->MakeTracks();
88 _MCTruthShortInfo->SetText(primString);
92 _MCTruthList->AddElement(trackList);
95 void MainWindow::CrossPTree() {
96 static const std::string routineName(
"MainWindow::CrossPTree");
102 TEveElementList *trackList =
new TEveElementList(
"Particle tracks");
104 TParticle *tempPart =
new TParticle();
107 TEveLine *line =
new TEveLine();
108 if (!element.second->hits.size())
110 tempPart->SetPdgCode((
int)element.second->hits[0]->particlePdg);
111 if (!element.second->hits[0]->eDep)
113 for (
size_t ihit = 0; ihit < element.second->hits.size(); ihit++) {
114 line->SetNextPoint(element.second->hits[ihit]->entrancePoint[0], element.second->hits[ihit]->entrancePoint[1],
115 element.second->hits[ihit]->entrancePoint[2]);
116 line->SetNextPoint(element.second->hits[ihit]->exitPoint[0], element.second->hits[ihit]->exitPoint[1],
117 element.second->hits[ihit]->exitPoint[2]);
119 line->SetName(Form(
"trackID %i", element.first));
120 line->SetTitle(tempPart->GetName());
122 if (tempPart->GetPDG()) {
123 if (tempPart->GetPDG()->Charge() > 0)
124 line->SetMainColor(kCyan);
125 else if (tempPart->GetPDG()->Charge() < 0)
126 line->SetMainColor(kRed);
128 line->SetMainColor(kYellow);
130 line->SetMainColor(kGray);
133 trackList->AddElement(line);
137 trackList->SetRnrState(0);
138 _MCTruthList->AddElement(trackList);
139 _MCPartHitList = trackList;
Float_t mom[3]
Momentum at generation [GeV].
GGSTParticle * GetPrimaryParticle(UInt_t particleNumber)
Returns a primary particle.
#define COUT(level)
Smart log macro. It writes on stdout only if the specified verbosity level is lesser than the maximum...
Int_t PDGCode
PDG code of particle (see http://www3.nd.edu/~avillano/geant4/geant4_pid.html).
Float_t time
Time of generation [ns].
Class for reading output of GGSMCTruthAction.
UInt_t GetNPrimaries()
Returns the number of primaries in current event.
Float_t pos[3]
Point of generation [cm].
Class to store G4 particles.