20 #include <TEveTrack.h>
21 #include <TEveBoxSet.h>
22 #include <TEvePointSet.h>
23 #include <TEveCompound.h>
24 #include <TEveTrackPropagator.h>
26 #include <TParticle.h>
27 #include <TDatabasePDG.h>
28 #include <TGeoManager.h>
32 #ifdef DD4HEP_USE_GEANT4_UNITS
35 #define MEV_TO_GEV 1000.0
39 #define MEV_TO_GEV 1.0
44 kRed, kBlue, kYellow, kGreen, kPink, kAzure, kOrange, kTeal, kViolet, kSpring, kMagenta, kCyan
50 : propagator(p), particles(ps)
52 propagator->SetName(
"Track propagator for charged particles");
57 propagator->RefPMAtt().SetMarkerColor(kYellow);
58 propagator->RefPMAtt().SetMarkerStyle(kCircle);
65 printout(ALWAYS,
"MCParticleCreator",
"+++ Minimal particle energy: %8.3g [GeV]",
threshold);
71 Compounds::const_iterator i =
types.find(name);
72 if ( i ==
types.end() ) {
74 TEveCompound* o =
new TEveCompound(name.c_str(),name.c_str());
76 i =
types.emplace(name,o).first;
77 Color_t col = Colors[icol%(
sizeof(Colors)/
sizeof(Colors[0]))];
78 col += icol/
sizeof(Colors)/
sizeof(Colors[0]);
80 o->CSCApplyMainColorToAllChildren();
83 TEveCompound* c = (*i).second;
84 e->SetMainColor(c->GetMainColor());
90 Compounds::const_iterator i =
types.find(name);
91 if ( i ==
types.end() ) {
92 TEveCompound* o =
new TEveCompound(name.c_str(),name.c_str());
94 i =
types.emplace(name,o).first;
95 o->SetMainColor(kBlack);
96 o->CSCApplyMainColorToAllChildren();
98 TEveCompound* c = (*i).second;
101 e->SetMainColor(c->GetMainColor());
107 for(Compounds::const_iterator i =
types.begin(); i!=
types.end(); ++i) {
108 (*i).second->CSCApplyMainColorToAllChildren();
109 (*i).second->CloseCompound();
112 particles->SetRnrSelfChildren(kTRUE,kTRUE);
123 TEveVector dir = end-start;
127 TDatabasePDG* db = TDatabasePDG::Instance();
128 TParticlePDG* def = db->GetParticle(p.
pdgID);
129 TParticle part(p.
pdgID,
139 t->AddPathMark(TEvePathMark(TEvePathMark::kLineSegment,start,momentum,dir));
140 t->AddPathMark(TEvePathMark(TEvePathMark::kReference,start,momentum));
141 t->AddPathMark(TEvePathMark(TEvePathMark::kDecay,end,momentum));
143 t->SetTitle(Form(
"MCParticle: Track ID=%d Parent:%d\n"
144 "Type:%s Charge=%.3f Time:%.3f ns\n"
145 "Start(Vx, Vy, Vz, t) = (%.3f, %.3f, %.3f) [cm]\n"
146 "End (Vx, Vy, Vz, t) = (%.3f, %.3f, %.3f) [cm]\n"
148 "(Px, Py, Pz, E) = (%.3f, %.3f, %.3f, %.3f) [GeV]",
150 def ? def->GetName() :
"Unknown",
151 def ? def->Charge() : 0.0, p.
time,
158 int pdg = abs(p.
pdgID);
161 else if ( pdg == 12 || pdg == 14 || pdg == 16 )
163 else if ( pdg == 22 )
165 else if ( pdg == 13 )
167 else if ( pdg == 211 )
169 else if ( pdg == 321 )
171 else if ( pdg == 2112 )
173 else if ( pdg == 2212 )
179 printout(ALWAYS,
"MCParticleCreator",
"+++ SKIP particle %4d. Energy: %8.3g [MeV]",p.
id,p.
energy);
185 : pointset(0), deposit(0), count(0)
187 pointset =
new TEvePointSet(collection.c_str(),length);
193 : pointset(0), deposit(0), count(0)
195 pointset =
new TEvePointSet(collection.c_str(),length);