9 #include "nusimdata/SimulationBase/MCTruth.h"
11 #include "art/Framework/Services/Registry/ServiceHandle.h"
42 auto& startPos = pfp.
TP3Ds[0].Pos;
43 auto& endPos = pfp.
TP3Ds[pfp.
TP3Ds.size() - 1].Pos;
44 slc.
crt.
cr_pfpxmin.push_back(std::min(startPos[0], endPos[0]));
45 slc.
crt.
cr_pfpxmax.push_back(std::max(startPos[0], endPos[0]));
49 float mindis0 = FLT_MAX;
50 float mindis1 = FLT_MAX;
75 art::ServiceHandle<cheat::BackTrackerService const> bt_serv;
76 art::ServiceHandle<cheat::ParticleInventoryService const> pi_serv;
78 std::map<int, float> omap;
80 for (
auto& tjID : pfp.
TjIDs) {
83 for (
auto& tp : tj.
Pts) {
84 for (
unsigned short ii = 0; ii < tp.Hits.size(); ++ii) {
85 if (!tp.UseHit[ii])
continue;
86 unsigned int iht = tp.Hits[ii];
90 (int)
hit.WireID().Wire,
91 (int)
hit.WireID().TPC,
92 (int)
hit.WireID().Cryostat);
93 double startTick =
hit.PeakTime() -
hit.RMS();
94 double endTick =
hit.PeakTime() +
hit.RMS();
96 std::vector<sim::TrackIDE> tides;
97 tides = bt_serv->ChannelToTrackIDEs(clockData, channel, startTick, endTick);
98 for (
auto itide = tides.begin(); itide != tides.end(); ++itide) {
99 omap[pi_serv->TrackIdToMCTruth_P(itide->trackID)->Origin()] += itide->energy;
107 for (
auto& i : omap) {
108 if (i.second > maxe) {
std::vector< Trajectory > tjs
vector of all trajectories in each plane
std::vector< float > cr_pfpyzmindis
std::vector< float > cr_pfpxmax
Geometry information for a single TPC.
int GetOrigin(detinfo::DetectorClocksData const &clockData, TCSlice &slc, PFPStruct &pfp)
Access the description of detector geometry.
std::vector< TrajPoint > Pts
Trajectory points.
double MinZ() const
Returns the world z coordinate of the start of the box.
std::vector< int > cr_origin
const geo::GeometryCore * geom
Definition of data types for geometry description.
double MaxY() const
Returns the world y coordinate of the end of the box.
std::bitset< 16 > modes
number of points to find AveChg
std::vector< TCHit > slHits
raw::ChannelID_t PlaneWireToChannel(WireID const &wireid) const
Returns the ID of the TPC channel connected to the specified wire.
Contains all timing reference information for the detector.
double MaxZ() const
Returns the world z coordinate of the end of the box.
void SaveCRInfo(detinfo::DetectorClocksData const &clockData, TCSlice &slc, PFPStruct &pfp, bool prt, bool fIsRealData)
std::vector< recob::Hit > const * allHits
std::vector< TP3D > TP3Ds
std::vector< float > cr_pfpxmin
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
unsigned int allHitsIndex
double MinY() const
Returns the world y coordinate of the start of the box.
void ClearCRInfo(TCSlice &slc)
constexpr Point origin()
Returns a origin position with a point of the specified type.
Encapsulate the construction of a single detector plane.