78 <<
"Initial Track Hits not set returning" <<
std::endl;
88 std::vector<art::Ptr<recob::Hit>> trackhits;
91 if (trackhits.empty()) {
97 TVector3 ShowerStartPosition = {-999, -999, -999};
100 TVector3 showerDir = {-999, -999, -999};
106 std::vector<double> dEdxVec;
107 std::vector<std::vector<art::Ptr<recob::Hit>>> trackHits;
109 trackHits.resize(numPlanes);
112 for (
unsigned int hitIt = 0; hitIt < trackhits.size(); ++hitIt) {
118 if (TPC == vtxTPC) { (trackHits.at(hitWire.
Plane)).
push_back(hit); }
121 int bestHitsPlane = 0;
122 int bestPlaneHits = 0;
123 int bestPlane = -999;
124 double minPitch = 999;
126 auto const clockData =
131 for (
unsigned int plane = 0; plane < numPlanes; ++plane) {
132 std::vector<art::Ptr<recob::Hit>> trackPlaneHits = trackHits.at(plane);
134 if (trackPlaneHits.size()) {
142 double wirepitch =
fGeom->
WirePitch(trackPlaneHits.at(0)->WireID().planeID());
144 trackPlaneHits[0]->WireID().planeID()) -
147 std::abs(std::sin(angleToVert) * showerDir.Y() + std::cos(angleToVert) * showerDir.Z());
149 pitch = wirepitch / cosgamma;
153 std::vector<float> vQ;
156 int w0 = trackPlaneHits.at(0)->WireID().Wire;
158 for (
auto const& hit : trackPlaneHits) {
175 if (pitch < minPitch) {
181 double dQdx = TMath::Median(vQ.size(), &vQ[0]) / pitch;
183 clockData, detProp, dQdx, avgT / nhits, trackPlaneHits.at(0)->WireID().Plane);
185 if (isinf(dEdx)) { dEdx = -999; };
187 if (nhits > bestPlaneHits || ((nhits == bestPlaneHits) && (pitch < minPitch))) {
188 bestHitsPlane = plane;
189 bestPlaneHits = nhits;
192 dEdxVec.push_back(dEdx);
196 <<
"pitch is 0. I can't think how it is 0? Stopping so I can tell you" <<
std::endl;
200 dEdxVec.push_back(-999);
202 trackPlaneHits.clear();
206 std::vector<double> dEdxVecErr = {-999, -999, -999};
213 if (bestPlane == -999) {
214 throw cet::exception(
"ShowerUnidirectiondEdx") <<
"No best plane set";
221 std::cout <<
"Best Plane: " << bestPlane <<
std::endl;
222 for (
unsigned int plane = 0; plane < dEdxVec.size(); plane++) {
223 std::cout <<
"Plane: " << plane <<
" with dEdx: " << dEdxVec[plane] <<
std::endl;
PlaneGeo const & Plane(unsigned int const p, unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified wire.
geo::WireID WireID() const
The data type to uniquely identify a Plane.
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
WireID_t Wire
Index of the wire within its plane.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
geo::Length_t WirePitch(geo::PlaneID const &planeid) const
Returns the distance between two consecutive wires.
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
View_t View() const
Which coordinate does this plane measure.
double dEdx(float dqdx, float Efield)
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
fInnerVessel push_back(Point(-578.400000, 0.000000, 0.000000))
bool CheckElement(const std::string &Name) const
The data type to uniquely identify a TPC.
PlaneID_t Plane
Index of the plane within its TPC.
int GetElement(const std::string &Name, T &Element) const
Detector simulation of raw signals on wires.
constexpr TPCID const & asTPCID() const
Conversion to TPCID (for convenience of notation).
float PeakTime() const
Time of the signal peak, in tick units.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
double dEdx_AREA(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
double WireAngleToVertical(geo::View_t view, geo::TPCID const &tpcid) const
Returns the angle of the wires in the specified view from vertical.
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)