581 std::cout <<
"Making Debug Event Display" << std::endl;
586 int run = Event.run();
587 int subRun = Event.subRun();
588 int event = Event.event();
589 int PFPID = pfparticle->Self();
592 TString canvasName = Form(
"canvas_%i_%i_%i_%i", run, subRun, event, PFPID);
593 if (evd_disp_name_append.length() > 0) canvasName +=
"_" + evd_disp_name_append;
594 TCanvas* canvas =
tfs->make<TCanvas>(canvasName, canvasName);
601 double x_min = std::numeric_limits<double>::max(), x_max = -std::numeric_limits<double>::max();
602 double y_min = std::numeric_limits<double>::max(), y_max = -std::numeric_limits<double>::max();
603 double z_min = std::numeric_limits<double>::max(), z_max = -std::numeric_limits<double>::max();
609 auto const pfpHandle = Event.getValidHandle<std::vector<recob::PFParticle>>(
fPFParticleLabel);
612 art::FindManyP<recob::SpacePoint> fmspp(pfpHandle, Event,
fPFParticleLabel);
613 if (!fmspp.isValid()) {
614 throw cet::exception(
"LArPandoraShowerAlg") <<
"Trying to get the spacepoint and failed. Somet\
615 hing is not configured correctly. Stopping ";
619 std::vector<art::Ptr<recob::SpacePoint>>
const& spacePoints = fmspp.at(pfparticle.key());
622 if (spacePoints.empty()) {
return; }
625 TVector3 showerStartPosition = {-999, -999, -999};
626 TVector3 showerDirection = {-999, -999, -999};
627 std::vector<art::Ptr<recob::SpacePoint>> trackSpacePoints;
632 double startXYZ[3] = {-999, -999, -999};
634 mf::LogError(
"LArPandoraShowerAlg") <<
"Start position not set, returning " << std::endl;
640 startXYZ[0] = showerStartPosition.X();
641 startXYZ[1] = showerStartPosition.Y();
642 startXYZ[2] = showerStartPosition.Z();
644 auto startPoly = std::make_unique<TPolyMarker3D>(1, startXYZ);
650 double xDirPoints[2] = {-999, -999};
651 double yDirPoints[2] = {-999, -999};
652 double zDirPoints[2] = {-999, -999};
658 auto allPoly = std::make_unique<TPolyMarker3D>(spacePoints.size());
662 mf::LogError(
"LArPandoraShowerAlg") <<
"Direction not set, returning " << std::endl;
670 double minProj = std::numeric_limits<double>::max();
671 double maxProj = -std::numeric_limits<double>::max();
676 for (
auto spacePoint : spacePoints) {
682 allPoly->SetPoint(point, x, y, z);
685 x_min = std::min(x, x_min);
686 x_max = std::max(x, x_max);
687 y_min = std::min(y, y_min);
688 y_max = std::max(y, y_max);
689 z_min = std::min(z, z_min);
690 z_max = std::max(z, z_max);
694 spacePoint, showerStartPosition, showerDirection);
695 maxProj = std::max(proj, maxProj);
696 minProj = std::min(proj, minProj);
699 xDirPoints[0] = (showerStartPosition.X() + minProj * showerDirection.X());
700 xDirPoints[1] = (showerStartPosition.X() + maxProj * showerDirection.X());
702 yDirPoints[0] = (showerStartPosition.Y() + minProj * showerDirection.Y());
703 yDirPoints[1] = (showerStartPosition.Y() + maxProj * showerDirection.Y());
705 zDirPoints[0] = (showerStartPosition.Z() + minProj * showerDirection.Z());
706 zDirPoints[1] = (showerStartPosition.Z() + maxProj * showerDirection.Z());
709 auto dirPoly = std::make_unique<TPolyLine3D>(2, xDirPoints, yDirPoints, zDirPoints);
715 auto trackPoly = std::make_unique<TPolyMarker3D>(trackSpacePoints.size());
717 mf::LogError(
"LArPandoraShowerAlg") <<
"TrackSpacePoints not set, returning " << std::endl;
723 for (
auto spacePoint : trackSpacePoints) {
729 trackPoly->SetPoint(point, x, y, z);
731 x_min = std::min(x, x_min);
732 x_max = std::max(x, x_max);
733 y_min = std::min(y, y_min);
734 y_max = std::max(y, y_max);
735 z_min = std::min(z, z_min);
736 z_max = std::max(z, z_max);
746 std::vector<art::Ptr<recob::PFParticle>> pfps;
747 art::fill_ptr_vector(pfps, pfpHandle);
751 int pfpTrackCounter = 0;
752 int pfpShowerCounter = 0;
755 for (
auto const& pfp : pfps) {
756 std::vector<art::Ptr<recob::SpacePoint>>
const& sps = fmspp.at(pfp.key());
758 int pdg =
abs(pfp->PdgCode());
759 if (pdg == 11 || pdg == 22) { pfpShowerCounter += sps.size(); }
761 pfpTrackCounter += sps.size();
765 auto pfpPolyTrack = std::make_unique<TPolyMarker3D>(pfpTrackCounter);
766 auto pfpPolyShower = std::make_unique<TPolyMarker3D>(pfpShowerCounter);
770 int showerPoints = 0;
772 for (
auto const& pfp : pfps) {
773 std::vector<art::Ptr<recob::SpacePoint>>
const& sps = fmspp.at(pfp.key());
774 int pdg =
abs(pfp->PdgCode());
775 for (
auto sp : sps) {
782 x_min = std::min(x, x_min);
783 x_max = std::max(x, x_max);
784 y_min = std::min(y, y_min);
785 y_max = std::max(y, y_max);
786 z_min = std::min(z, z_min);
787 z_max = std::max(z, z_max);
790 if (pdg == 11 || pdg == 22) {
791 pfpPolyShower->SetPoint(showerPoints, x, y, z);
795 pfpPolyTrack->SetPoint(trackPoints, x, y, z);
808 auto TrackTrajPoly = std::make_unique<TPolyMarker3D>(TPolyMarker3D(1));
809 auto TrackInitTrajPoly = std::make_unique<TPolyMarker3D>(TPolyMarker3D(1));
828 TVector3 TrajPosition = {
829 TrajPositionPoint.X(), TrajPositionPoint.Y(), TrajPositionPoint.Z()};
831 TVector3 pos = TrajPosition;
836 TrackTrajPoly->SetPoint(point, x, y, z);
841 TVector3 TrajPosition = {
842 TrajInitPositionPoint.X(), TrajInitPositionPoint.Y(), TrajInitPositionPoint.Z()};
843 TVector3 pos = TrajPosition;
847 TrackInitTrajPoly->SetPoint(TrackInitTrajPoly->GetN(),
x,
y,
z);
851 gStyle->SetOptStat(0);
852 TH3F axes(
"axes",
"", 1, x_min, x_max, 1, y_min, y_max, 1, z_min, z_max);
853 axes.SetDirectory(0);
854 axes.GetXaxis()->SetTitle(
"X");
855 axes.GetYaxis()->SetTitle(
"Y");
856 axes.GetZaxis()->SetTitle(
"Z");
860 pfpPolyShower->SetMarkerStyle(20);
861 pfpPolyShower->SetMarkerColor(4);
862 pfpPolyShower->Draw();
863 pfpPolyTrack->SetMarkerStyle(20);
864 pfpPolyTrack->SetMarkerColor(6);
865 pfpPolyTrack->Draw();
866 allPoly->SetMarkerStyle(20);
868 trackPoly->SetMarkerStyle(20);
869 trackPoly->SetMarkerColor(2);
871 startPoly->SetMarkerStyle(21);
872 startPoly->SetMarkerSize(0.5);
873 startPoly->SetMarkerColor(3);
875 dirPoly->SetLineWidth(1);
876 dirPoly->SetLineColor(6);
878 TrackTrajPoly->SetMarkerStyle(22);
879 TrackTrajPoly->SetMarkerColor(7);
880 TrackTrajPoly->Draw();
881 TrackInitTrajPoly->SetMarkerStyle(22);
882 TrackInitTrajPoly->SetMarkerColor(4);
883 TrackInitTrajPoly->Draw();
process_name opflash particleana ie ie ie z
process_name opflash particleana ie x
static constexpr Flag_t NoPoint
The trajectory point is not defined.
art::InputTag fPFParticleLabel
Point_t const & LocationAtPoint(size_t i) const
const std::string fInitialTrackInputLabel
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
process_name opflash particleana ie ie y
const std::string fInitialTrackSpacePointsInputLabel
bool CheckElement(const std::string &Name) const
const std::string fShowerDirectionInputLabel
double SpacePointProjection(art::Ptr< recob::SpacePoint > const &sp, TVector3 const &vertex, TVector3 const &direction) const
int GetElement(const std::string &Name, T &Element) const
const std::string fShowerStartPositionInputLabel
art::ServiceHandle< art::TFileService > tfs
PointFlags_t const & FlagsAtPoint(size_t i) const
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
BEGIN_PROLOG could also be cout
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
TVector3 SpacePointPosition(art::Ptr< recob::SpacePoint > const &sp) const