95 const art::FindManyP<recob::SpacePoint>& fmspp =
99 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.size() < 3) {
110 << spacePoints_pfp.size() <<
" spacepoints in shower, not calculating direction" 115 auto const clockData =
121 TVector3 ShowerCentre;
126 TVector3 ShowerCentreErr = {-999, -999, -999};
135 <<
"fUseStartPosition is set but ShowerStartPosition is not set. Bailing" <<
std::endl;
139 TVector3 StartPositionVec = {-999, -999, -999};
143 TVector3 GeneralDir = (ShowerCentre - StartPositionVec).Unit();
146 double DotProduct = PCADirection.Dot(GeneralDir);
149 if (DotProduct < 0) {
150 PCADirection[0] = -PCADirection[0];
151 PCADirection[1] = -PCADirection[1];
152 PCADirection[2] = -PCADirection[2];
156 TVector3 PCADirectionErr = {-999, -999, -999};
163 spacePoints_pfp, ShowerCentre, PCADirection,
fNSegments);
167 if (RMSGradient < -std::numeric_limits<double>::epsilon()) {
168 PCADirection[0] = -PCADirection[0];
169 PCADirection[1] = -PCADirection[1];
170 PCADirection[2] = -PCADirection[2];
174 TVector3 PCADirectionErr = {-999, -999, -999};
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)
double RMSShowerGradient(std::vector< art::Ptr< recob::SpacePoint >> &sps, const TVector3 &ShowerCentre, const TVector3 &Direction, const unsigned int nSegments) const
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
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
2D representation of charge deposited in the TDC/wire plane
QTextStream & endl(QTextStream &s)