19 #include "TEveCompound.h"
20 #include "TEveTrack.h"
21 #include "TEveTrackPropagator.h"
23 #include "TParticle.h"
24 #include "TDatabasePDG.h"
25 #include "TGeoManager.h"
28 using namespace DD4hep;
31 kRed, kBlue, kYellow, kGreen, kPink, kAzure, kOrange, kTeal, kViolet, kSpring, kMagenta, kCyan
36 : propagator(p), particles(ps), count(0), lineWidth(4)
38 propagator->SetName(
"Track propagator for charged particles");
43 propagator->RefPMAtt().SetMarkerColor(kYellow);
44 propagator->RefPMAtt().SetMarkerStyle(kCircle);
55 Compounds::const_iterator i =
types.find(name);
56 if ( i ==
types.end() ) {
58 TEveCompound* o =
new TEveCompound(name.c_str(),name.c_str());
60 i =
types.insert(make_pair(name,o)).first;
64 o->CSCApplyMainColorToAllChildren();
67 TEveCompound* c = (*i).second;
68 e->SetMainColor(c->GetMainColor());
74 Compounds::const_iterator i =
types.find(name);
75 if ( i ==
types.end() ) {
77 TEveCompound* o =
new TEveCompound(name.c_str(),name.c_str());
79 i =
types.insert(make_pair(name,o)).first;
80 o->SetMainColor(kBlack);
81 o->CSCApplyMainColorToAllChildren();
84 TEveCompound* c = (*i).second;
87 e->SetMainColor(c->GetMainColor());
93 for(Compounds::const_iterator i =
types.begin(); i!=
types.end(); ++i) {
94 (*i).second->CSCApplyMainColorToAllChildren();
95 (*i).second->CloseCompound();
98 particles->SetRnrSelfChildren(kTRUE,kTRUE);
109 TEveVector dir = end-start;
113 TDatabasePDG* db = TDatabasePDG::Instance();
114 TParticlePDG* def = db->GetParticle(p.
pdgID);
115 TParticle part(p.
pdgID,
125 t->AddPathMark(TEvePathMark(TEvePathMark::kLineSegment,start,momentum,dir));
126 t->AddPathMark(TEvePathMark(TEvePathMark::kReference,start,momentum));
127 t->AddPathMark(TEvePathMark(TEvePathMark::kDecay,end,momentum));
129 t->SetTitle(Form(
"MCParticle: Track ID=%d Parent:%d\n"
130 "Type:%s Charge=%.3f Time:%.3f ns\n"
131 "Start(Vx, Vy, Vz, t) = (%.3f, %.3f, %.3f) [cm]\n"
132 "End (Vx, Vy, Vz, t) = (%.3f, %.3f, %.3f) [cm]\n"
134 "(Px, Py, Pz, E) = (%.3f, %.3f, %.3f, %.3f) [GeV]",
136 def ? def->GetName() :
"Unknown",
137 def ? def->Charge() : 0.0, p.
time,
144 int pdg = abs(p.
pdgID);
147 else if ( pdg == 12 || pdg == 14 || pdg == 16 )
149 else if ( pdg == 22 )
151 else if ( pdg == 13 )
153 else if ( pdg == 211 )
155 else if ( pdg == 321 )
157 else if ( pdg == 2112 )
159 else if ( pdg == 2212 )
166 cout <<
"SKIP particle " << p.
id <<
"." << endl;
TEveTrackPropagator * propagator
void addCompoundLight(const std::string &name, TEveLine *e)
Access sub-compound by name.
Data structure to store the MC particle information.
union DD4hep::DisplayConfiguration::Config::Values data
void close()
Close compounds.
virtual void operator()(const DDEveParticle &particle)
Action callback of this functor:
void addCompound(const std::string &name, TEveLine *e)
Access sub-compound by name.