70 std::cout <<
"Making Debug Event Display" <<
std::endl;
76 int subRun =
Event.subRun();
77 int event =
Event.event();
78 int PFPID = pfparticle->
Self();
81 TString canvasName = Form(
"canvas_%i_%i_%i_%i", run, subRun,
event, PFPID);
82 TCanvas* canvas =
tfs->make<TCanvas>(canvasName, canvasName);
89 std::vector<art::Ptr<recob::SpacePoint>> showerSpacePoints;
90 std::vector<art::Ptr<recob::SpacePoint>> otherSpacePoints;
93 std::vector<art::Ptr<recob::Hit>> hits;
97 const art::FindManyP<recob::SpacePoint> fmsph(hitHandle, Event,
fPFParticleLabel);
98 if (!fmsph.isValid()) {
100 <<
"Spacepoint and hit association not valid. Stopping.";
105 for (
auto hit : hits) {
107 std::vector<art::Ptr<recob::SpacePoint>> sps = fmsph.at(
hit.key());
108 if (sps.size() == 1) {
110 if (trueParticleID == trueParticle->
TrackId()) { showerSpacePoints.push_back(sp); }
112 otherSpacePoints.push_back(sp);
119 <<
"Start position not set, returning " <<
std::endl;
128 <<
"TrackSpacePoints not set, returning " <<
std::endl;
133 TVector3 showerStartPosition = {-999, -999, -999};
134 TVector3 showerDirection = {-999, -999, -999};
135 std::vector<art::Ptr<recob::SpacePoint>> trackSpacePoints;
142 double startXYZ[3] = {0, 0, 0};
143 auto startPoly = std::make_unique<TPolyMarker3D>(1, startXYZ);
158 auto showerPoly = std::make_unique<TPolyMarker3D>(showerSpacePoints.size());
159 for (
auto spacePoint : showerSpacePoints) {
172 showerPoly->SetPoint(point, x, y, z);
184 double xDirPoints[2] = {minProj * showerDirection.X(), maxProj * showerDirection.X()};
185 double yDirPoints[2] = {minProj * showerDirection.Y(), maxProj * showerDirection.Y()};
186 double zDirPoints[2] = {minProj * showerDirection.Z(), maxProj * showerDirection.Z()};
188 auto dirPoly = std::make_unique<TPolyLine3D>(2, xDirPoints, yDirPoints, zDirPoints);
191 auto trackPoly = std::make_unique<TPolyMarker3D>(trackSpacePoints.size());
192 for (
auto spacePoint : trackSpacePoints) {
197 trackPoly->SetPoint(point, x, y, z);
204 auto otherPoly = std::make_unique<TPolyMarker3D>(otherSpacePoints.size());
209 for (
auto const& sp : otherSpacePoints) {
220 otherPoly->SetPoint(point, x, y, z);
224 gStyle->SetOptStat(0);
225 TH3F axes(
"axes",
"", 1, x_min, x_max, 1, y_min, y_max, 1, z_min, z_max);
226 axes.SetDirectory(0);
227 axes.GetXaxis()->SetTitle(
"X");
228 axes.GetYaxis()->SetTitle(
"Y");
229 axes.GetZaxis()->SetTitle(
"Z");
232 otherPoly->SetMarkerStyle(20);
233 otherPoly->SetMarkerColor(4);
237 showerPoly->SetMarkerStyle(20);
239 trackPoly->SetMarkerStyle(20);
240 trackPoly->SetMarkerColor(2);
242 startPoly->SetMarkerStyle(21);
243 startPoly->SetMarkerSize(2);
244 startPoly->SetMarkerColor(3);
246 dirPoly->SetLineWidth(1);
247 dirPoly->SetLineColor(6);
shower::LArPandoraShowerAlg fLArPandoraShowerAlg
size_t Self() const
Returns the index of this particle.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::string fShowerDirectionInputLabel
bool CheckElement(const std::string &Name) const
art::InputTag fHitModuleLabel
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
int TrueParticleID(detinfo::DetectorClocksData const &clockData, const art::Ptr< recob::Hit > &hit) const
std::string fShowerStartPositionInputLabel
Detector simulation of raw signals on wires.
std::string fInitialTrackSpacePointsInputLabel
art::ServiceHandle< art::TFileService > tfs
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
art::InputTag fPFParticleLabel
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
Event finding and building.
TVector3 SpacePointPosition(art::Ptr< recob::SpacePoint > const &sp) const