10 #include "TDatabasePDG.h"
13 #include "TPolyLine.h"
14 #include "TPolyLine3D.h"
15 #include "TPolyMarker.h"
16 #include "TPolyMarker3D.h"
33 #include "nuevdb/EventDisplayBase/View2D.h"
34 #include "nuevdb/EventDisplayBase/View3D.h"
35 #include "nusimdata/SimulationBase/MCParticle.h"
36 #include "nusimdata/SimulationBase/MCTruth.h"
38 #include "art/Framework/Principal/Event.h"
39 #include "art/Framework/Principal/DataViewImpl.h"
40 #include "art/Framework/Principal/View.h"
41 #include "art/Framework/Services/Registry/ServiceHandle.h"
42 #include "messagefacility/MessageLogger/MessageLogger.h"
47 writeErrMsg(
const char* fcn, cet::exception
const&
e)
49 mf::LogWarning(
"SimulationDrawer") <<
"SimulationDrawer::" << fcn <<
" failed with message:\n"
59 art::ServiceHandle<geo::Geometry const> geom;
69 for (
size_t cryoIdx = 0; cryoIdx < geom->Ncryostats(); cryoIdx++) {
72 for (
size_t tpcIdx = 0; tpcIdx < cryoGeo.
NTPC(); tpcIdx++) {
75 mf::LogDebug(
"SimulationDrawer")
76 <<
"Cryo/TPC idx: " << cryoIdx <<
"/" << tpcIdx <<
", TPC center: " << tpc.
GetCenter()[0]
78 mf::LogDebug(
"SimulationDrawer")
97 mf::LogDebug(
"SimulationDrawer")
98 <<
" minx/maxx: " <<
minx <<
"/" <<
maxx <<
", miny/maxy: " <<
miny <<
"/" <<
maxy
99 <<
", minz/miny: " <<
minz <<
"/" <<
maxz << std::endl;
114 if (evt.isRealData())
return;
116 art::ServiceHandle<evd::SimulationDrawingOptions const> drawopt;
118 if (!drawopt->fShowMCTruthText)
return;
120 std::vector<const simb::MCTruth*> mctruth;
123 for (
unsigned int i = 0; i < mctruth.size(); ++i) {
126 bool firstout =
true;
128 std::string incoming;
129 std::string outgoing;
132 int jmax =
TMath::Min(20, mctruth[i]->NParticles());
133 for (
int j = 0; j < jmax; ++j) {
134 const simb::MCParticle&
p = mctruth[i]->GetParticle(j);
138 "#color[%d]{%s #scale[0.75]{[%.1f GeV/c]}}",
149 if (p.StatusCode() == 0) {
150 if (firstin ==
false) incoming +=
" + ";
154 if (p.StatusCode() == 1) {
155 if (firstout ==
false) outgoing +=
" + ";
160 if (origin ==
"" && incoming ==
"") { mctext = outgoing; }
162 mctext = origin + incoming +
" #rightarrow " + outgoing;
164 TLatex& latex = view->AddLatex(0.03, 0.2, mctext.c_str());
165 latex.SetTextSize(0.6);
175 if (evt.isRealData())
return;
177 art::ServiceHandle<evd::SimulationDrawingOptions const> drawopt;
179 if (!drawopt->fShowMCTruthText)
return;
181 std::vector<const simb::MCTruth*> mctruth;
183 std::cout <<
"\nMCTruth Ptcl trackID PDG P T Moth Process\n";
184 for (
unsigned int i = 0; i < mctruth.size(); ++i) {
185 for (
int j = 0; j < mctruth[i]->NParticles(); ++j) {
186 const simb::MCParticle&
p = mctruth[i]->GetParticle(j);
187 if (p.StatusCode() == 0 || p.StatusCode() == 1) {
188 int KE = 1000 * (p.E() - p.Mass());
191 << std::setw(7) << int(1000 * p.P()) << std::setw(7) << KE << std::setw(7)
192 << p.Mother() <<
" " << p.Process() <<
"\n";
202 std::cout <<
"Note: Momentum, P, and kinetic energy, T, in MeV/c\n";
210 if (evt.isRealData())
return;
214 art::ServiceHandle<evd::SimulationDrawingOptions const> drawopt;
216 if (drawopt->fShowMCTruthVectors > 3) {
217 std::cout <<
"Unsupported ShowMCTruthVectors option (> 2)\n";
221 art::ServiceHandle<geo::Geometry const> geo;
222 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
224 double xyz1[3] = {0.};
225 double xyz2[3] = {0.};
230 static bool first =
true;
233 <<
"******** Show MCTruth (Genie) particles when ShowMCTruthVectors = 1 or 3 ******** \n";
235 <<
" and shifted by " << xShift <<
" cm in X\n";
236 std::cout <<
" Neutrons and photons drawn with dotted lines. \n";
237 std::cout <<
" Red = e+/-, nue, nuebar. Blue = mu+/-, numu, numubar. Green = tau+/-, nutau, "
239 std::cout <<
" Yellow = photons. Magenta = pions, protons and nuetrons.\n";
240 std::cout <<
"******** Show MCParticle (Geant) decay photons (e.g. from pizeros) when "
241 "ShowMCTruthVectors = 2 or 3 ******** \n";
242 std::cout <<
" Photons > 50 MeV are drawn as dotted lines corrected for space charge and "
243 "are not shifted.\n";
244 std::cout <<
" Decay photon end points are drawn at 2 interaction lengths (44 cm) from the "
246 std::cout <<
" Color: Green = (50 < E_photon < 100 MeV), Blue = (100 MeV < E_photon < 200 "
247 "MeV), Red = (E_photon > 300 MeV).\n";
250 bool showTruth = (drawopt->fShowMCTruthVectors == 1 || drawopt->fShowMCTruthVectors == 3);
251 bool showPhotons = (drawopt->fShowMCTruthVectors > 1);
254 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt);
258 std::vector<const simb::MCTruth*> mctruth;
261 for (
size_t i = 0; i < mctruth.size(); ++i) {
263 for (
int j = 0; j < mctruth[i]->NParticles(); ++j) {
264 const simb::MCParticle&
p = mctruth[i]->GetParticle(j);
267 if (!(p.StatusCode() == 0 || p.StatusCode() == 1))
continue;
269 double r = p.P() * 10.0;
271 if (p.StatusCode() == 0) r = -r;
276 xyz1[0] = p.Vx() - sceOffset.X();
277 xyz1[1] = p.Vy() + sceOffset.Y();
278 xyz1[2] = p.Vz() + sceOffset.Z();
279 xyz2[0] = xyz1[0] + r * p.Px() / p.P();
280 xyz2[1] = xyz1[1] + r * p.Py() / p.P();
281 xyz2[2] = xyz1[2] + r * p.Pz() / p.P();
284 geo->WireCoordinate(xyz1[1], xyz1[2], (
int)plane, rawopt->fTPC, rawopt->fCryostat);
286 geo->WireCoordinate(xyz2[1], xyz2[2], (
int)plane, rawopt->fTPC, rawopt->fCryostat);
289 detProp.ConvertXToTicks(xyz1[0] + xShift, (
int)plane, rawopt->fTPC, rawopt->fCryostat);
291 detProp.ConvertXToTicks(xyz2[0] + xShift, (
int)plane, rawopt->fTPC, rawopt->fCryostat);
293 if (rawopt->fAxisOrientation < 1) {
294 TLine& l = view->AddLine(w1, time, w2, time2);
298 TLine& l = view->AddLine(time, w1, time2, w2);
309 art::ServiceHandle<cheat::ParticleInventoryService const> pi_serv;
310 sim::ParticleList
const& plist = pi_serv->ParticleList();
311 if (plist.empty())
return;
314 for (sim::ParticleList::const_iterator ipart = plist.begin(); ipart != plist.end(); ++ipart) {
315 simb::MCParticle*
p = (*ipart).second;
316 int trackID = p->TrackId();
317 art::Ptr<simb::MCTruth> theTruth = pi_serv->TrackIdToMCTruth_P(trackID);
319 if (p->PdgCode() != 22)
continue;
320 if (p->Process() !=
"Decay")
continue;
321 int TMeV = 1000 * (p->E() - p->Mass());
322 if (TMeV < 30)
continue;
323 auto gptStart =
geo::Point_t(p->Vx(), p->Vy(), p->Vz());
326 xyz1[0] = p->Vx() - sceOffset.X();
327 xyz1[1] = p->Vy() + sceOffset.Y();
328 xyz1[2] = p->Vz() + sceOffset.Z();
329 xyz2[0] = xyz1[0] + r * p->Px() / p->P();
330 xyz2[1] = xyz1[1] + r * p->Py() / p->P();
331 xyz2[2] = xyz1[2] + r * p->Pz() / p->P();
333 geo->WireCoordinate(xyz1[1], xyz1[2], (
int)plane, rawopt->fTPC, rawopt->fCryostat);
334 double t1 =
detProp.ConvertXToTicks(xyz1[0], (
int)plane, rawopt->fTPC, rawopt->fCryostat);
336 geo->WireCoordinate(xyz2[1], xyz2[2], (
int)plane, rawopt->fTPC, rawopt->fCryostat);
337 double t2 =
detProp.ConvertXToTicks(xyz2[0], (
int)plane, rawopt->fTPC, rawopt->fCryostat);
338 TLine& l = view->AddLine(w1, t1, w2, t2);
340 l.SetLineStyle(kDotted);
341 if (TMeV < 100) { l.SetLineColor(kGreen); }
342 else if (TMeV < 200) {
343 l.SetLineColor(kBlue);
346 l.SetLineColor(kRed);
360 if (evt.isRealData())
return;
362 art::ServiceHandle<evd::SimulationDrawingOptions const> drawopt;
364 if (!drawopt->fShowMCTruthTrajectories)
return;
366 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
368 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt, clockData);
369 art::ServiceHandle<geo::Geometry const> geom;
372 std::vector<const simb::MCParticle*> plist;
376 int neutralColor(12);
378 int neutrinoColor(38);
384 mf::LogDebug(
"SimulationDrawer")
385 <<
"Starting loop over " << plist.size() <<
" McParticles, voxel list size is "
386 << voxels.
size() << std::endl;
398 std::map<int, const simb::MCParticle*> trackToMcParticleMap;
401 double minPartEnergy(0.01);
403 for (
size_t p = 0;
p < plist.size(); ++
p) {
404 trackToMcParticleMap[plist[
p]->TrackId()] = plist[
p];
407 if (drawopt->fShowMCTruthTrajectories) {
409 const simb::MCParticle* mcPart = plist[
p];
410 const simb::MCTrajectory& mcTraj = mcPart->Trajectory();
412 int pdgCode(mcPart->PdgCode());
414 TParticlePDG* partPDG(TDatabasePDG::Instance()->
GetParticle(pdgCode));
415 double partCharge = partPDG ? partPDG->Charge() : 0.;
416 double partEnergy = mcPart->E();
418 if (!drawopt->fShowMCTruthColors) colorIdx = grayedColor;
420 if (!mcTraj.empty() && partEnergy > minPartEnergy && mcPart->TrackId() < 100000000) {
421 double g4Ticks(clockData.TPCG4Time2Tick(mcPart->T()) -
trigger_offset(clockData));
423 double xPosMinTick = 0.;
424 double xPosMaxTick = std::numeric_limits<double>::max();
427 int numTrajPoints = mcTraj.size();
429 std::unique_ptr<double[]> hitPositions(
new double[3 * numTrajPoints]);
432 for (
int hitIdx = 0; hitIdx < numTrajPoints; hitIdx++) {
433 double xPos = mcTraj.X(hitIdx);
434 double yPos = mcTraj.Y(hitIdx);
435 double zPos = mcTraj.Z(hitIdx);
443 geo::TPCID tpcID = geom->PositionToTPCID(hitLocation);
446 xPosMinTick =
detProp.ConvertTicksToX(0, planeID);
447 xPosMaxTick =
detProp.ConvertTicksToX(
detProp.NumberTimeSamples(), planeID);
448 xOffset =
detProp.ConvertTicksToX(g4Ticks, planeID) - xPosMinTick;
450 if (xPosMaxTick < xPosMinTick) std::swap(xPosMinTick, xPosMaxTick);
460 if (xPos > xPosMinTick && xPos < xPosMaxTick) {
470 hitPositions[3 * hitCount] = xPos;
471 hitPositions[3 * hitCount + 1] = yPos;
472 hitPositions[3 * hitCount + 2] = zPos;
477 TPolyLine3D& pl(view->AddPolyLine3D(1, colorIdx, 1, 1));
480 if (partCharge == 0.) {
481 pl.SetLineColor(neutralColor);
485 pl.SetPolyLine(hitCount, hitPositions.get(),
"");
491 std::map<const simb::MCParticle*, std::vector<std::vector<double>>> partToPosMap;
494 for (vxitr = voxels.
begin(); vxitr != voxels.
end(); vxitr++) {
498 if (vxd.
Energy(partIdx) > drawopt->fMinEnergyDeposition) {
499 int trackId = vxd.
TrackID(partIdx);
502 const simb::MCParticle* mcPart = trackToMcParticleMap[trackId];
504 partToPosMap[mcPart].push_back(std::vector<double>(3));
506 partToPosMap[mcPart].back()[0] = vxd.
VoxelID().
X();
507 partToPosMap[mcPart].back()[1] = vxd.
VoxelID().
Y();
508 partToPosMap[mcPart].back()[2] = vxd.
VoxelID().
Z();
515 std::map<const simb::MCParticle*, std::vector<std::vector<double>>>::iterator partToPosMapItr;
517 for (partToPosMapItr = partToPosMap.begin(); partToPosMapItr != partToPosMap.end();
520 const simb::MCParticle* mcPart = partToPosMapItr->first;
523 if (!mcPart || partToPosMapItr->second.empty())
continue;
525 double g4Ticks(clockData.TPCG4Time2Tick(mcPart->T()) -
trigger_offset(clockData));
527 double xPosMinTick = 0.;
528 double xPosMaxTick = std::numeric_limits<double>::max();
531 int markerIdx(kFullDotSmall);
534 if (!drawopt->fShowMCTruthFullSize) {
535 colorIdx = grayedColor;
540 std::unique_ptr<double[]> hitPositions(
new double[3 * partToPosMapItr->second.size()]);
544 for (
size_t posIdx = 0; posIdx < partToPosMapItr->second.size(); posIdx++) {
545 const std::vector<double>& posVec = partToPosMapItr->second[posIdx];
548 geo::Point_t hitLocation(posVec[0], posVec[1], posVec[2]);
551 geo::TPCID tpcID = geom->PositionToTPCID(hitLocation);
554 xPosMinTick =
detProp.ConvertTicksToX(0, planeID);
555 xPosMaxTick =
detProp.ConvertTicksToX(
detProp.NumberTimeSamples(), planeID);
556 xOffset =
detProp.ConvertTicksToX(g4Ticks, planeID) - xPosMinTick;
558 if (xPosMaxTick < xPosMinTick) std::swap(xPosMinTick, xPosMaxTick);
564 double xCoord = posVec[0] + xOffset;
568 if (xCoord > xPosMinTick && xCoord < xPosMaxTick) {
569 hitPositions[3 * hitCount] = xCoord;
570 hitPositions[3 * hitCount + 1] = posVec[1];
571 hitPositions[3 * hitCount + 2] = posVec[2];
576 TPolyMarker3D& pm = view->AddPolyMarker3D(1, colorIdx, markerIdx, markerSize);
577 pm.SetPolyMarker(hitCount, hitPositions.get(), markerIdx);
581 std::vector<const simb::MCTruth*> mctruth;
585 for (
unsigned int idx = 0; idx < mctruth.size(); idx++) {
587 for (
int particleIdx = 0; particleIdx < mctruth[idx]->NParticles(); particleIdx++) {
588 const simb::MCParticle& mcPart = mctruth[idx]->GetParticle(particleIdx);
591 if (mcPart.Mother() == -1 && mcPart.StatusCode() == 0) {
592 mf::LogDebug(
"SimulationDrawer") << mcPart << std::endl;
595 TVector3 particlePosition(mcPart.Vx(), mcPart.Vy(), mcPart.Vz());
598 TVector3 oppPartDir(-mcPart.Px(), -mcPart.Py(), -mcPart.Pz());
600 if (oppPartDir.Mag2() > 0.) oppPartDir.SetMag(1.);
602 double arcLenToDraw = -particlePosition.Z() / oppPartDir.CosTheta();
605 if (arcLenToDraw > 0.) {
607 TPolyLine3D& pl(view->AddPolyLine3D(2, neutrinoColor, 1, 2));
609 pl.SetPoint(0, particlePosition.X(), particlePosition.Y(), particlePosition.Z());
611 particlePosition += std::min(arcLenToDraw + 10., 1000.) * oppPartDir;
613 pl.SetPoint(1, particlePosition.X(), particlePosition.Y(), particlePosition.Z());
633 if (evt.isRealData())
return;
635 art::ServiceHandle<evd::SimulationDrawingOptions const> drawopt;
638 if (!drawopt->fShowMCTruthTrajectories)
return;
641 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
643 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt, clockData);
646 std::vector<const simb::MCParticle*> plist;
651 double xMinimum(-1. * (
maxx -
minx));
652 double xMaximum(2. * (
maxx -
minx));
660 mf::LogDebug(
"SimulationDrawer")
661 <<
"Starting loop over " << plist.size() <<
" McParticles, voxel list size is "
662 << voxels.
size() << std::endl;
674 std::map<int, const simb::MCParticle*> trackToMcParticleMap;
677 bool displayMcTrajectories(
true);
678 double minPartEnergy(0.025);
680 double tpcminx = 1.0;
681 double tpcmaxx = -1.0;
682 double xOffset = 0.0;
683 double g4Ticks = 0.0;
685 double readoutwindowsize = 0.0;
686 double vtx[3] = {0.0, 0.0, 0.0};
687 for (
size_t p = 0;
p < plist.size(); ++
p) {
688 trackToMcParticleMap[plist[
p]->TrackId()] = plist[
p];
691 if (displayMcTrajectories) {
693 const simb::MCParticle* mcPart = plist[
p];
694 const simb::MCTrajectory& mcTraj = mcPart->Trajectory();
696 int pdgCode(mcPart->PdgCode());
697 TParticlePDG* partPDG(TDatabasePDG::Instance()->
GetParticle(pdgCode));
698 double partCharge = partPDG ? partPDG->Charge() : 0.;
699 double partEnergy = mcPart->E();
701 if (!mcTraj.empty() && partEnergy > minPartEnergy && mcPart->TrackId() < 100000000) {
703 int numTrajPoints = mcTraj.size();
705 std::unique_ptr<double[]> hitPosX(
new double[numTrajPoints]);
706 std::unique_ptr<double[]> hitPosY(
new double[numTrajPoints]);
707 std::unique_ptr<double[]> hitPosZ(
new double[numTrajPoints]);
710 double xPos = mcTraj.X(0);
711 double yPos = mcTraj.Y(0);
712 double zPos = mcTraj.Z(0);
722 readoutwindowsize = 0.0;
723 for (
int hitIdx = 0; hitIdx < numTrajPoints; hitIdx++) {
724 xPos = mcTraj.X(hitIdx);
725 yPos = mcTraj.Y(hitIdx);
726 zPos = mcTraj.Z(hitIdx);
729 if (xPos < minx || xPos >
maxx || yPos < miny || yPos >
maxy || zPos <
minz ||
733 if ((xPos < tpcminx) || (xPos > tpcmaxx)) {
741 unsigned int tpc = tpcid.
TPC;
743 tpcminx = tpcgeo.
MinX();
744 tpcmaxx = tpcgeo.
MaxX();
746 coeff =
detProp.GetXTicksCoefficient(tpc, cryo);
748 detProp.ConvertTicksToX(
detProp.ReadOutWindowSize(), 0, tpc, cryo);
753 g4Ticks = clockData.TPCG4Time2Tick(mcPart->T()) +
756 xOffset =
detProp.ConvertTicksToX(g4Ticks, 0, tpc, cryo);
763 readoutwindowsize = 0.0;
770 bool inreadoutwindow =
false;
772 if ((xPos > readoutwindowsize) && (xPos < tpcmaxx)) inreadoutwindow =
true;
774 else if (coeff > 0) {
775 if ((xPos > tpcminx) && (xPos < readoutwindowsize)) inreadoutwindow =
true;
778 if (!inreadoutwindow)
continue;
781 if (xPos > xMinimum && xPos < xMaximum) {
782 hitPosX[hitCount] = xPos;
783 hitPosY[hitCount] = yPos;
784 hitPosZ[hitCount] = zPos;
789 TPolyLine& pl = view->AddPolyLine(
793 if (partCharge == 0.) {
800 pl.SetPolyLine(hitCount, hitPosX.get(), hitPosY.get(),
"");
802 pl.SetPolyLine(hitCount, hitPosZ.get(), hitPosX.get(),
"");
804 pl.SetPolyLine(hitCount, hitPosZ.get(), hitPosY.get(),
"");
810 std::map<const simb::MCParticle*, std::vector<std::vector<double>>> partToPosMap;
813 for (vxitr = voxels.
begin(); vxitr != voxels.
end(); vxitr++) {
817 if (vxd.
Energy(partIdx) > drawopt->fMinEnergyDeposition) {
818 int trackId = vxd.
TrackID(partIdx);
821 const simb::MCParticle* mcPart = trackToMcParticleMap[trackId];
823 partToPosMap[mcPart].push_back(std::vector<double>(3));
825 partToPosMap[mcPart].back()[0] = vxd.
VoxelID().
X();
826 partToPosMap[mcPart].back()[1] = vxd.
VoxelID().
Y();
827 partToPosMap[mcPart].back()[2] = vxd.
VoxelID().
Z();
834 std::map<const simb::MCParticle*, std::vector<std::vector<double>>>::iterator partToPosMapItr;
836 for (partToPosMapItr = partToPosMap.begin(); partToPosMapItr != partToPosMap.end();
839 const simb::MCParticle* mcPart = partToPosMapItr->first;
842 if (!mcPart || partToPosMapItr->second.empty())
continue;
848 std::vector<std::array<double, 3>> posVecCorr;
849 posVecCorr.reserve(partToPosMapItr->second.size());
851 readoutwindowsize = 0.0;
854 for (
size_t posIdx = 0; posIdx < partToPosMapItr->second.size(); posIdx++) {
855 const std::vector<double>& posVec = partToPosMapItr->second[posIdx];
857 if ((posVec[0] < tpcminx) || (posVec[0] > tpcmaxx)) {
865 unsigned int tpc = tpcid.
TPC;
868 tpcminx = tpcgeo.
MinX();
869 tpcmaxx = tpcgeo.
MaxX();
871 coeff =
detProp.GetXTicksCoefficient(tpc, cryo);
872 readoutwindowsize =
detProp.ConvertTicksToX(
detProp.ReadOutWindowSize(), 0, tpc, cryo);
876 g4Ticks = clockData.TPCG4Time2Tick(mcPart->T()) +
879 xOffset =
detProp.ConvertTicksToX(g4Ticks, 0, tpc, cryo);
886 readoutwindowsize = 0.0;
890 double xCoord = posVec[0] + xOffset;
892 bool inreadoutwindow =
false;
894 if ((xCoord > readoutwindowsize) && (xCoord < tpcmaxx)) inreadoutwindow =
true;
896 else if (coeff > 0) {
897 if ((xCoord > tpcminx) && (xCoord < readoutwindowsize)) inreadoutwindow =
true;
900 if (inreadoutwindow && (xCoord > xMinimum && xCoord < xMaximum)) {
901 posVecCorr.push_back({{xCoord, posVec[1], posVec[2]}});
905 TPolyMarker& pm = view->AddPolyMarker(posVecCorr.size(),
910 for (
size_t p = 0;
p < posVecCorr.size(); ++
p) {
912 pm.SetPoint(
p, posVecCorr[
p][0], posVecCorr[p][1]);
914 pm.SetPoint(p, posVecCorr[p][2], posVecCorr[p][0]);
916 pm.SetPoint(p, posVecCorr[p][2], posVecCorr[p][1]);
929 if (evt.isRealData())
return 0;
931 art::ServiceHandle<evd::SimulationDrawingOptions const> drawopt;
933 std::vector<const simb::MCParticle*> temp;
935 art::View<simb::MCParticle> plcol;
938 evt.getView(drawopt->fG4ModuleLabel, plcol);
939 for (
unsigned int i = 0; i < plcol.vals().size(); ++i) {
940 temp.push_back(plcol.vals().at(i));
944 catch (cet::exception&
e) {
945 writeErrMsg(
"GetRawDigits", e);
958 if (evt.isRealData())
return 0;
960 std::vector<const simb::MCTruth*> temp;
962 std::vector<art::Handle<std::vector<simb::MCTruth>>> mctcol;
966 mctcol = evt.getMany<std::vector<simb::MCTruth>>();
967 for (
size_t mctc = 0; mctc < mctcol.size(); ++mctc) {
968 art::Handle<std::vector<simb::MCTruth>> mclistHandle = mctcol[mctc];
970 for (
size_t i = 0; i < mclistHandle->size(); ++i) {
971 temp.push_back(&(mclistHandle->at(i)));
976 catch (cet::exception&
e) {
977 writeErrMsg(
"GetMCTruth", e);
std::map< int, bool > fHighlite
Point GetActiveVolumeCenter() const
Returns the center of the TPC active volume in world coordinates [cm].
Utilities related to art service access.
void MCTruthLongText(const art::Event &evt, evdb::View2D *view)
CryostatGeo const & GetElement(geo::CryostatID const &cryoid) const
void HiLite(int trkId, bool hlt=true)
Container of LAr voxel information.
double ActiveHalfHeight() const
Half height (associated with y coordinate) of active TPC volume [cm].
double MinX() const
Returns the world x coordinate of the start of the box.
The data type to uniquely identify a Plane.
bool isValid
Whether this ID points to a valid element.
Geometry information for a single TPC.
static sim::LArVoxelList GetLArVoxelList(const art::Event &evt, std::string moduleLabel)
int GetMCTruth(const art::Event &evt, std::vector< const simb::MCTruth * > &mctruth)
double MaxX() const
Returns the world x coordinate of the end of the box.
static void FromPDG(TLine &line, int pdgcode)
Geometry information for a single cryostat.
void MCTruth3D(const art::Event &evt, evdb::View3D *view)
double Length() const
Length is associated with z coordinate [cm].
list_type::const_iterator const_iterator
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
Encapsulates the information we want store for a voxel.
virtual bool EnableCorrSCE() const =0
double ActiveHalfWidth() const
Half width (associated with x coordinate) of active TPC volume [cm].
int GetParticle(const art::Event &evt, std::vector< const simb::MCParticle * > &plist)
static int ColorFromPDG(int pdgcode)
unsigned int NTPC() const
Number of TPCs in this cryostat.
size_type NumberParticles() const
The data type to uniquely identify a TPC.
Description of geometry of one entire detector.
double ActiveLength() const
Length (associated with z coordinate) of active TPC volume [cm].
void MCTruthShortText(const art::Event &evt, evdb::View2D *view)
double HalfHeight() const
Height is associated with y coordinate [cm].
virtual geo::Vector_t GetPosOffsets(geo::Point_t const &point) const =0
mapped_type Energy() const
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
static const char * LatexName(int pdgcode)
Convert PDG code to a latex string (root-style)
Render the objects from the Simulation package.
int trigger_offset(DetectorClocksData const &data)
void MCTruthOrtho(const art::Event &evt, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
void MCTruthVectors2D(const art::Event &evt, evdb::View2D *view, unsigned int plane)
sim::LArVoxelID VoxelID() const
TPCID_t TPC
Index of the TPC within its cryostat.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
geo::CryostatID::CryostatID_t FindCryostatAtPosition(geo::Point_t const &worldLoc) const
Returns the index of the cryostat at specified location.
art framework interface to geometry description
BEGIN_PROLOG could also be cout
double HalfWidth() const
Width is associated with x coordinate [cm].
constexpr Point origin()
Returns a origin position with a point of the specified type.
Encapsulate the construction of a single detector plane.
const key_type & TrackID(const size_type) const
Point GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].