4 const art::Ptr<recob::Hit>&
hit) {
5 double particleEnergy = 0;
7 art::ServiceHandle<cheat::BackTrackerService> bt;
8 std::vector<sim::TrackIDE> trackIDs = bt->HitToTrackIDEs(clockData, hit);
9 for (
unsigned int idIt = 0; idIt < trackIDs.size(); ++idIt) {
10 if (trackIDs.at(idIt).energy > particleEnergy) {
11 particleEnergy = trackIDs.at(idIt).energy;
12 likelyTrackID = trackIDs.at(idIt).trackID;
21 art::ServiceHandle<cheat::BackTrackerService> bt;
22 std::map<int,double> trackIDToEDepMap;
23 for (
std::vector<art::Ptr<recob::Hit> >::const_iterator hitIt = hits.begin(); hitIt != hits.end(); ++hitIt) {
24 art::Ptr<recob::Hit>
hit = *hitIt;
25 std::vector<sim::TrackIDE> trackIDs = bt->HitToTrackIDEs(clockData, hit);
26 for (
unsigned int idIt = 0; idIt < trackIDs.size(); ++idIt) {
27 trackIDToEDepMap[trackIDs[idIt].trackID] += trackIDs[idIt].energy;
32 double maxenergy = -1;
33 int objectTrack = -99999;
34 for (std::map<int,double>::iterator mapIt = trackIDToEDepMap.begin(); mapIt != trackIDToEDepMap.end(); mapIt++){
35 double energy = mapIt->second;
36 double trackid = mapIt->first;
37 if (energy > maxenergy){
39 objectTrack = trackid;
51 std::map<int,double> trackMap;
52 for (
std::vector<art::Ptr<recob::Hit> >::const_iterator hitIt = hits.begin(); hitIt != hits.end(); ++hitIt) {
53 art::Ptr<recob::Hit>
hit = *hitIt;
55 trackMap[trackID] += hit->Integral();
59 double highestCharge = 0;
60 int objectTrack = -99999;
61 for (std::map<int,double>::iterator trackIt = trackMap.begin(); trackIt != trackMap.end(); ++trackIt) {
62 if (trackIt->second > highestCharge) {
63 highestCharge = trackIt->second;
64 objectTrack = trackIt->first;
75 std::map<int,int> trackMap;
76 for (
std::vector<art::Ptr<recob::Hit> >::const_iterator hitIt = hits.begin(); hitIt != hits.end(); ++hitIt) {
77 art::Ptr<recob::Hit>
hit = *hitIt;
83 int objectTrack = -99999;
84 int highestCount = -1;
85 for (std::map<int,int>::iterator trackIt = trackMap.begin(); trackIt != trackMap.end(); ++trackIt) {
86 if (trackIt->second > highestCount) {
87 highestCount = trackIt->second;
88 objectTrack = trackIt->first;
97 double vtx[3] = {position.X(), position.Y(), position.Z()};
99 art::ServiceHandle<geo::Geometry> geom;
100 geo::TPCID idtpc = geom->FindTPCAtPosition(vtx);
102 if (geom->HasTPC(idtpc))
105 double minx = tpcgeo.
MinX();
double maxx = tpcgeo.
MaxX();
106 double miny = tpcgeo.
MinY();
double maxy = tpcgeo.
MaxY();
107 double minz = tpcgeo.
MinZ();
double maxz = tpcgeo.
MaxZ();
109 for (
size_t c = 0; c < geom->Ncryostats(); c++)
112 for (
size_t t = 0; t < cryostat.
NTPC(); t++)
115 if (tpcg.
MinX() < minx) minx = tpcg.
MinX();
116 if (tpcg.
MaxX() > maxx) maxx = tpcg.
MaxX();
117 if (tpcg.
MinY() < miny) miny = tpcg.
MinY();
118 if (tpcg.
MaxY() > maxy) maxy = tpcg.
MaxY();
119 if (tpcg.
MinZ() < minz) minz = tpcg.
MinZ();
120 if (tpcg.
MaxZ() > maxz) maxz = tpcg.
MaxZ();
125 double dista = fabs(minx - position.X());
126 double distb = fabs(position.X() - maxx);
127 if ((position.X() > minx) && (position.X() < maxx) &&
128 (dista > distance_buffer) && (distb > distance_buffer)) inside =
true;
130 dista = fabs(maxy - position.Y());
131 distb = fabs(position.Y() - miny);
132 if (inside && (position.Y() > miny) && (position.Y() < maxy) &&
133 (dista > distance_buffer) && (distb > distance_buffer)) inside =
true;
136 dista = fabs(maxz - position.Z());
137 distb = fabs(position.Z() - minz);
138 if (inside && (position.Z() > minz) && (position.Z() < maxz) &&
139 (dista > distance_buffer) && (distb > distance_buffer)) inside =
true;
int TrueParticleIDFromTotalTrueEnergy(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit > > &hits, bool rollup_unsaved_ids=1)
double MinX() const
Returns the world x coordinate of the start of the box.
Geometry information for a single TPC.
double MaxX() const
Returns the world x coordinate of the end of the box.
Geometry information for a single cryostat.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
double MinZ() const
Returns the world z coordinate of the start of the box.
unsigned int NTPC() const
Number of TPCs in this cryostat.
int TrueParticleIDFromTotalRecoHits(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit > > &hits, bool rollup_unsaved_ids=1)
const PlaneGeo & GetElement(PlaneID const &planeid) const
The data type to uniquely identify a TPC.
double MaxY() const
Returns the world y coordinate of the end of the box.
Contains all timing reference information for the detector.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
double MaxZ() const
Returns the world z coordinate of the end of the box.
int TrueParticleIDFromTotalRecoCharge(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit > > &hits, bool rollup_unsaved_ids=1)
double MinY() const
Returns the world y coordinate of the start of the box.
int TrueParticleID(detinfo::DetectorClocksData const &clockData, const art::Ptr< recob::Hit > hit, bool rollup_unsaved_ids=1)
bool IsInsideTPC(TVector3 position, double distance_buffer)