77 pset.
get<
std::string>(
"InitialTrackSpacePointsOutputLabel"))
81 <<
"Shower2DLinearRegressionTrackHitFinderEMShower: fNfithits and fToler need to have size " 96 <<
"Start position not set, returning " << std::endl;
102 <<
"Direction not set, returning " << std::endl;
120 std::vector<art::Ptr<recob::Cluster>> clusters = fmc.at(pfparticle.
key());
122 if (clusters.size() < 2) {
125 <<
"Not enough clusters: " << clusters.size() << std::endl;
132 std::map<geo::PlaneID, std::vector<art::Ptr<recob::Hit>>> plane_clusters;
134 for (
auto const&
cluster : clusters) {
137 std::vector<art::Ptr<recob::Hit>>
hits = fmhc.at(
cluster.key());
139 for (
auto hit : hits) {
142 plane_clusters[plane].push_back(
hit);
150 auto const clockData =
155 std::vector<art::Ptr<recob::Hit>> InitialTrackHits;
157 for (
auto const&
cluster : plane_clusters) {
160 std::vector<art::Ptr<recob::Hit>>
hits =
cluster.second;
164 detProp, hits, ShowerStartPosition, ShowerDirection);
169 InitialTrackHits.insert(InitialTrackHits.end(), trackhits.begin(), trackhits.end());
177 auto const hitHandle = Event.getValidHandle<std::vector<recob::Hit>>(
fHitLabel);
184 std::vector<art::Ptr<recob::SpacePoint>> intitaltrack_sp;
185 for (
auto const&
hit : InitialTrackHits) {
186 std::vector<art::Ptr<recob::SpacePoint>> sps = fmsp.at(
hit.key());
187 for (
auto const sp : sps) {
188 intitaltrack_sp.push_back(sp);
201 std::vector<art::Ptr<recob::Hit>> trackHits;
205 std::vector<double> wfit;
206 std::vector<double> tfit;
207 std::vector<double> cfit;
212 unsigned int nhits = 0;
220 (
std::abs((coord.Y() - (parm[0] + coord.X() * parm[1])) *
221 std::cos(std::atan(parm[1]))) <
fToler[i - 1]) ||
225 wfit.push_back(coord.X());
226 tfit.push_back(coord.Y());
232 if (i == fNfitpass - 1) { trackHits.push_back(
hit); }
236 if (i < fNfitpass - 1 && wfit.size()) {
237 fitok =
WeightedFit(wfit.size(), &wfit[0], &tfit[0], &cfit[0], &parm[0]);
267 for (Int_t i = 0; i <
n; i++) {
269 sumx2 += x[i] * x[i] * w[i];
271 sumxy += x[i] * y[i] * w[i];
275 if (sumx2 * sumw - sumx * sumx == 0.)
return 1;
276 if (sumx2 - sumx * sumx / sumw == 0.)
return 1;
278 parm[0] = (sumy * sumx2 - sumx * sumxy) / (sumx2 * sumw - sumx * sumx);
279 parm[1] = (sumxy - sumx * sumy / sumw) / (sumx2 - sumx * sumx / sumw);
281 eparm[0] = sumx2 * (sumx2 * sumw - sumx * sumx);
282 eparm[1] = (sumx2 - sumx * sumx / sumw);
284 if (eparm[0] < 0. || eparm[1] < 0.)
return 1;
286 eparm[0] = sqrt(eparm[0]) / (sumx2 * sumw - sumx * sumx);
287 eparm[1] = sqrt(eparm[1]) / (sumx2 - sumx * sumx / sumw);
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
Declaration of signal hit object.
The data type to uniquely identify a Plane.
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
constexpr auto abs(T v)
Returns the absolute value of the argument.
Set of hits with a 2D structure.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
Cluster finding and building.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
key_type key() const noexcept
bool CheckElement(const std::string &Name) const
constexpr PlaneID const & asPlaneID() const
Conversion to PlaneID (for convenience of notation).
int GetElement(const std::string &Name, T &Element) const
Declaration of cluster object.
void OrderShowerHits(detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit >> &hits, geo::Point_t const &ShowerPosition, geo::Vector_t const &ShowerDirection) const
Detector simulation of raw signals on wires.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
TVector2 HitCoordinates(detinfo::DetectorPropertiesData const &detProp, art::Ptr< recob::Hit > const &hit) const
2D representation of charge deposited in the TDC/wire plane
const art::FindManyP< T1 > & GetFindManyP(const art::ValidHandle< std::vector< T2 >> &handle, const art::Event &evt, const art::InputTag &moduleTag)