53 const art::FindManyP<recob::Vertex>& fmv =
58 <<
"Vertex and PF particle association is somehow not valid. Stopping";
61 std::vector<art::Ptr<recob::Vertex>> vtx_cand;
63 vtx_cand = fmv.at(pfparticle.
key());
67 mf::LogError(
"ShowerPFPVertexStartPosition") <<
"PFP-Vertex assan not set, returning";
71 if (vtx_cand.size() != 1) {
74 <<
"Wrong number of vertices: " << vtx_cand.size() <<
", returning";
79 if (vtx_cand.size() == 1) {
81 double xyz[3] = {-999, -999, -999};
82 StartPositionVertex->
XYZ(xyz);
83 TVector3 ShowerStartPosition = {xyz[0], xyz[1], xyz[2]};
84 TVector3 ShowerStartPositionErr = {-999, -999, -999};
93 TVector3 ShowerDirection = {-999, -999, -999};
96 const art::FindManyP<recob::SpacePoint>& fmspp =
100 auto const spHandle = Event.getValidHandle<std::vector<recob::SpacePoint>>(
fPFParticleLabel);
101 const art::FindManyP<recob::Hit>& fmh =
105 std::vector<art::Ptr<recob::SpacePoint>> spacePoints_pfp = fmspp.at(pfparticle.
key());
108 if (spacePoints_pfp.empty()) {
return 0; }
111 auto const clockData =
117 clockData, detProp, spacePoints_pfp, fmh);
121 spacePoints_pfp, ShowerCentre, ShowerDirection);
124 TVector3 ShowerStartPosition =
127 TVector3 ShowerStartPositionErr = {-999, -999, -999};
136 <<
"Start Position has not been set yet. If you are not calculating the start position " 137 "again then maybe you should stop";
void XYZ(double *xyz) const
Legacy method to access vertex position, preserved to avoid breaking code. Please try to use Vertex::...
void OrderShowerSpacePoints(std::vector< art::Ptr< recob::SpacePoint >> &showersps, TVector3 const &vertex, TVector3 const &direction) const
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
const art::FindManyP< T1 > & GetFindManyP(const art::ValidHandle< std::vector< T2 > > &handle, const art::Event &evt, const art::InputTag &moduleTag)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
Definition of vertex object for LArSoft.
key_type key() const noexcept
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
bool CheckElement(const std::string &Name) const
int GetElement(const std::string &Name, T &Element) const
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
TVector3 ShowerCentre(std::vector< art::Ptr< recob::SpacePoint >> const &showersps) const
2D representation of charge deposited in the TDC/wire plane
cet::coded_exception< error, detail::translate > exception
TVector3 SpacePointPosition(art::Ptr< recob::SpacePoint > const &sp) const