185 double xcent = geo->TPCXCent();
186 double ycent = geo->TPCYCent();
187 double zcent = geo->TPCZCent();
193 std::vector<const simb::MCParticle*> plist;
201 int neutralColor(12);
203 int neutrinoColor(38);
215 std::map<int, const simb::MCParticle*> trackToMcParticleMap;
218 double minPartEnergy(0.01);
220 std::cout <<
"MC particle listing (limit 20)" <<
std::endl;
221 std::cout <<
" ID PDG Px Py Pz E (GeV) origin (cm) " <<
std::endl;
223 for(
size_t p = 0;
p < plist.size(); ++
p){
225 trackToMcParticleMap[plist[
p]->TrackId()] = plist[
p];
230 int pdgCode(mcPart->
PdgCode());
234 double partEnergy = mcPart->
E();
238 printf(
"%6d %12d %8.3f %8.3f %8.3f %8.3f ",(
int)
p,pdgCode,mcPart->
Px(),mcPart->
Py(),mcPart->
Pz(),partEnergy);
241 double xPos = mcTraj.
X(0) + xcent;
242 double yPos = mcTraj.
Y(0) + ycent;
243 double zPos = mcTraj.
Z(0) + zcent;
244 printf(
"%8.3f %8.3f %8.3f\n",xPos, yPos, zPos);
256 if ( !drawopt->fShowNeutrals && partCharge > -0.1 && partCharge < 0.1)
continue;
259 if (pdgCode == 22 && partEnergy < drawopt->fPhotonEnergyCut)
continue;
262 if (pdgCode == 2112 && partEnergy < drawopt->fNeutronEnergyCut)
continue;
265 if ( partEnergy < drawopt->fOtherNeutralEnergyCut && partCharge > -0.1 && partCharge < 0.1
266 && pdgCode != 22 && pdgCode != 2112)
continue;
270 if (pdgCode >= 1000000000)
continue;
271 if (pdgCode == 111)
continue;
279 if (!mcTraj.
empty() && partEnergy > minPartEnergy && mcPart->
TrackId() < 100000000){
285 int numTrajPoints = mcTraj.
size();
287 std::unique_ptr<double[]> hitPositions(
new double[3*numTrajPoints]);
290 for(
int hitIdx = 0; hitIdx < numTrajPoints; hitIdx++){
291 double xPos = mcTraj.
X(hitIdx) + xcent;
292 double yPos = mcTraj.
Y(hitIdx) + ycent;
293 double zPos = mcTraj.
Z(hitIdx) + zcent;
296 if (xPos < minx || xPos >
maxx || yPos < miny || yPos >
maxy|| zPos < minz || zPos >
maxz)
continue;
300 if (xPos > xMinimum && xPos < xMaximum){
301 hitPositions[3*hitCount ] = zPos;
302 hitPositions[3*hitCount + 1] = xPos;
303 hitPositions[3*hitCount + 2] = yPos;
308 TPolyLine3D& pl(view->AddPolyLine3D(1, colorIdx, 1, 1));
311 if (partCharge == 0.){
312 pl.SetLineColor(neutralColor);
316 pl.SetPolyLine(hitCount, hitPositions.get(),
"");
321 std::map<const simb::MCParticle*, std::vector<std::vector<double> > > partToPosMap;
325 std::map<const simb::MCParticle*, std::vector<std::vector<double> > >
::iterator partToPosMapItr;
327 for(partToPosMapItr = partToPosMap.begin(); partToPosMapItr != partToPosMap.end(); ++partToPosMapItr)
333 if (!mcPart || partToPosMapItr->second.empty())
continue;
339 int markerIdx(kFullDotSmall);
343 colorIdx = grayedColor;
348 TPolyMarker3D&
pm = view->AddPolyMarker3D(partToPosMapItr->second.size(), colorIdx, markerIdx, markerSize);
351 for(
size_t posIdx = 0; posIdx < partToPosMapItr->second.size(); posIdx++){
352 const std::vector<double>& posVec = partToPosMapItr->second[posIdx];
354 double xCoord = posVec[0];
357 if (xCoord > xMinimum && xCoord < xMaximum)
358 pm.SetPoint(posIdx, posVec[2], xCoord, posVec[1]);
363 std::vector<const simb::MCTruth*> mctruth;
367 for (
unsigned int idx = 0; idx < mctruth.size(); idx++){
369 for (
int particleIdx = 0; particleIdx < mctruth[idx]->NParticles(); particleIdx++){
377 TVector3 particlePosition(mcPart.
Vx(),mcPart.
Vy(),mcPart.
Vz());
380 TVector3 oppPartDir(-mcPart.
Px(),-mcPart.
Py(),-mcPart.
Pz());
382 if (oppPartDir.Mag2() > 0.) oppPartDir.SetMag(1.);
385 double arcLenToDraw = 50.0;
388 if (arcLenToDraw > 0.){
390 TPolyLine3D& pl(view->AddPolyLine3D(2, neutrinoColor, 1, 2));
394 pl.SetPoint(0,particlePosition.Z()+zcent,particlePosition.X()+xcent,particlePosition.Y()+ycent);
396 particlePosition +=
std::min(arcLenToDraw + 10.,1000.) * oppPartDir;
398 pl.SetPoint(1,particlePosition.Z()+zcent,particlePosition.X()+xcent,particlePosition.Y()+ycent);
double E(const int i=0) const
double Z(const size_type i) const
double X(const size_type i) const
int GetMCTruth(const art::Event &evt, std::vector< const simb::MCTruth * > &mctruth)
double Py(const int i=0) const
const simb::MCTrajectory & Trajectory() const
double Px(const int i=0) const
double Y(const size_type i) const
static int ColorFromPDG(int pdgcode)
bool fShowMCTruthTrajectories
int GetParticle(const art::Event &evt, std::vector< const simb::MCParticle * > &plist)
double Vx(const int i=0) const
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
double Pz(const int i=0) const
double Vz(const int i=0) const
LArSoft geometry interface.
double Vy(const int i=0) const
QTextStream & endl(QTextStream &s)
bool fShowMCTruthFullSize