11 #include "art/Utilities/ToolMacros.h"
21 namespace ShowerRecoTools {
51 art::ServiceHandle<geo::Geometry>
fGeom;
57 , fIntercepts(pset.
get<
std::
vector<double>>(
"Intercepts"))
58 , fPFParticleLabel(pset.
get<art::InputTag>(
"PFParticleLabel"))
59 , fVerbose(pset.
get<int>(
"Verbose"))
60 , fShowerEnergyOutputLabel(pset.
get<
std::string>(
"ShowerEnergyOutputLabel"))
61 , fShowerBestPlaneOutputLabel(pset.
get<
std::string>(
"ShowerBestPlaneOutputLabel"))
65 throw cet::exception(
"ShowerLinearEnergy")
66 <<
"The number of planes does not match the size of the fcl parametes passed: Num Planes: "
79 auto const pfpHandle = Event.getValidHandle<std::vector<recob::PFParticle>>(
fPFParticleLabel);
82 auto const clusHandle = Event.getValidHandle<std::vector<recob::Cluster>>(
fPFParticleLabel);
84 const art::FindManyP<recob::Cluster>& fmc =
87 std::vector<art::Ptr<recob::Cluster>> clusters = fmc.at(pfparticle.key());
90 const art::FindManyP<recob::Hit>& fmhc =
94 std::map<geo::PlaneID::PlaneID_t, std::vector<art::Ptr<recob::Hit>>> planeHits;
97 for (
auto const&
cluster : clusters) {
100 std::vector<art::Ptr<recob::Hit>> hits = fmhc.at(
cluster.key());
105 planeHits[plane].insert(planeHits[plane].
end(), hits.begin(), hits.end());
110 unsigned int bestPlaneNumHits = 0;
113 std::vector<double> energyVec(
fNumPlanes, -999.);
114 std::vector<double> energyError(
fNumPlanes, -999.);
116 auto const clockData =
117 art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(Event);
119 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(Event, clockData);
121 for (
auto const& [plane, hits] : planeHits) {
123 unsigned int planeNumHits = hits.size();
128 if (Energy > 0) energyVec.at(plane) =
Energy;
130 if (planeNumHits > bestPlaneNumHits) {
132 bestPlaneNumHits = planeNumHits;
138 if (bestPlane < fGeom->Nplanes()) {
141 int bestPlaneVal(bestPlane);
157 double totalCharge = 0, totalEnergy = 0;
159 for (
auto const&
hit : hits) {
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Declaration of signal hit object.
unsigned int PlaneID_t
Type for the ID number.
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
double ElectronLifetime() const
Set of hits with a 2D structure.
const art::FindManyP< T1 > & GetFindManyP(const art::ValidHandle< std::vector< T2 > > &handle, const art::Event &evt, const art::InputTag &moduleTag)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
auto end(FixedBins< T, C > const &) noexcept
Declaration of cluster object.
Contains all timing reference information for the detector.
2D representation of charge deposited in the TDC/wire plane
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.