559 std::cout <<
"Making Debug Event Display" <<
std::endl;
565 int subRun =
Event.subRun();
566 int event =
Event.event();
567 int PFPID = pfparticle->
Self();
570 TString canvasName = Form(
"canvas_%i_%i_%i_%i", run, subRun,
event, PFPID);
571 if (evd_disp_name_append.length() > 0) canvasName +=
"_" + evd_disp_name_append;
572 TCanvas* canvas =
tfs->make<TCanvas>(canvasName, canvasName);
590 art::FindManyP<recob::SpacePoint> fmspp(pfpHandle, Event,
fPFParticleLabel);
591 if (!fmspp.isValid()) {
592 throw cet::exception(
"LArPandoraShowerAlg") <<
"Trying to get the spacepoint and failed. Somet\ 593 hing is not configured correctly. Stopping ";
597 std::vector<art::Ptr<recob::SpacePoint>>
const& spacePoints = fmspp.at(pfparticle.
key());
600 if (spacePoints.empty()) {
return; }
603 TVector3 showerStartPosition = {-999, -999, -999};
604 TVector3 showerDirection = {-999, -999, -999};
605 std::vector<art::Ptr<recob::SpacePoint>> trackSpacePoints;
610 double startXYZ[3] = {-999, -999, -999};
618 startXYZ[0] = showerStartPosition.X();
619 startXYZ[1] = showerStartPosition.Y();
620 startXYZ[2] = showerStartPosition.Z();
622 auto startPoly = std::make_unique<TPolyMarker3D>(1, startXYZ);
628 double xDirPoints[2] = {-999, -999};
629 double yDirPoints[2] = {-999, -999};
630 double zDirPoints[2] = {-999, -999};
636 auto allPoly = std::make_unique<TPolyMarker3D>(spacePoints.size());
654 for (
auto spacePoint : spacePoints) {
660 allPoly->SetPoint(point, x, y, z);
672 spacePoint, showerStartPosition, showerDirection);
677 xDirPoints[0] = (showerStartPosition.X() + minProj * showerDirection.X());
678 xDirPoints[1] = (showerStartPosition.X() + maxProj * showerDirection.X());
680 yDirPoints[0] = (showerStartPosition.Y() + minProj * showerDirection.Y());
681 yDirPoints[1] = (showerStartPosition.Y() + maxProj * showerDirection.Y());
683 zDirPoints[0] = (showerStartPosition.Z() + minProj * showerDirection.Z());
684 zDirPoints[1] = (showerStartPosition.Z() + maxProj * showerDirection.Z());
687 auto dirPoly = std::make_unique<TPolyLine3D>(2, xDirPoints, yDirPoints, zDirPoints);
693 auto trackPoly = std::make_unique<TPolyMarker3D>(trackSpacePoints.size());
701 for (
auto spacePoint : trackSpacePoints) {
707 trackPoly->SetPoint(point, x, y, z);
724 std::vector<art::Ptr<recob::PFParticle>> pfps;
729 int pfpTrackCounter = 0;
730 int pfpShowerCounter = 0;
733 for (
auto const& pfp : pfps) {
734 std::vector<art::Ptr<recob::SpacePoint>>
const& sps = fmspp.at(pfp.key());
736 int pdg =
abs(pfp->PdgCode());
737 if (pdg == 11 || pdg == 22) { pfpShowerCounter += sps.size(); }
739 pfpTrackCounter += sps.size();
743 auto pfpPolyTrack = std::make_unique<TPolyMarker3D>(pfpTrackCounter);
744 auto pfpPolyShower = std::make_unique<TPolyMarker3D>(pfpShowerCounter);
748 int showerPoints = 0;
750 for (
auto const& pfp : pfps) {
751 std::vector<art::Ptr<recob::SpacePoint>>
const& sps = fmspp.at(pfp.key());
752 int pdg =
abs(pfp->PdgCode());
753 for (
auto sp : sps) {
768 if (pdg == 11 || pdg == 22) {
769 pfpPolyShower->SetPoint(showerPoints, x, y, z);
773 pfpPolyTrack->SetPoint(trackPoints, x, y, z);
786 auto TrackTrajPoly = std::make_unique<TPolyMarker3D>(TPolyMarker3D(1));
787 auto TrackInitTrajPoly = std::make_unique<TPolyMarker3D>(TPolyMarker3D(1));
806 TVector3 TrajPosition = {
807 TrajPositionPoint.X(), TrajPositionPoint.Y(), TrajPositionPoint.Z()};
809 TVector3 pos = TrajPosition;
814 TrackTrajPoly->SetPoint(point, x, y, z);
819 TVector3 TrajPosition = {
820 TrajInitPositionPoint.X(), TrajInitPositionPoint.Y(), TrajInitPositionPoint.Z()};
821 TVector3 pos = TrajPosition;
825 TrackInitTrajPoly->SetPoint(TrackInitTrajPoly->GetN(),
x,
y,
z);
829 gStyle->SetOptStat(0);
830 TH3F axes(
"axes",
"", 1, x_min, x_max, 1, y_min, y_max, 1, z_min, z_max);
831 axes.SetDirectory(0);
832 axes.GetXaxis()->SetTitle(
"X");
833 axes.GetYaxis()->SetTitle(
"Y");
834 axes.GetZaxis()->SetTitle(
"Z");
838 pfpPolyShower->SetMarkerStyle(20);
839 pfpPolyShower->SetMarkerColor(4);
840 pfpPolyShower->Draw();
841 pfpPolyTrack->SetMarkerStyle(20);
842 pfpPolyTrack->SetMarkerColor(6);
843 pfpPolyTrack->Draw();
844 allPoly->SetMarkerStyle(20);
846 trackPoly->SetMarkerStyle(20);
847 trackPoly->SetMarkerColor(2);
849 startPoly->SetMarkerStyle(21);
850 startPoly->SetMarkerSize(0.5);
851 startPoly->SetMarkerColor(3);
853 dirPoly->SetLineWidth(1);
854 dirPoly->SetLineColor(6);
856 TrackTrajPoly->SetMarkerStyle(22);
857 TrackTrajPoly->SetMarkerColor(7);
858 TrackTrajPoly->Draw();
859 TrackInitTrajPoly->SetMarkerStyle(22);
860 TrackInitTrajPoly->SetMarkerColor(4);
861 TrackInitTrajPoly->Draw();
size_t Self() const
Returns the index of this particle.
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.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
const std::string fInitialTrackSpacePointsInputLabel
key_type key() const noexcept
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
static int max(int a, int b)
int GetElement(const std::string &Name, T &Element) const
const std::string fShowerStartPositionInputLabel
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
art::ServiceHandle< art::TFileService > tfs
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
PointFlags_t const & FlagsAtPoint(size_t i) const
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
Event finding and building.
TVector3 SpacePointPosition(art::Ptr< recob::SpacePoint > const &sp) const