11 #include "canvas/Persistency/Common/FindManyP.h" 15 class DetectorClocksData;
16 class DetectorPropertiesData;
30 double m_ang = 15.0/360 * 2*3.1415926;
32 double m_startoffset = 10;
34 std::vector<const recob::Hit*>
m_hits;
41 const TVector3& newStart,
42 const TVector3& newDir,
45 m_clockdata(&clockData),
47 m_start(newStart), m_direction(newDir.Unit()), m_length(newLen)
50 m_start = m_start - m_direction.Unit()*m_startoffset;
51 m_length += m_startoffset;
53 m_width = m_length * tan(m_ang);
57 auto spHandle = m_evt->
getHandle<std::vector<recob::SpacePoint> >(spsLabel);
58 if (!spHandle) {
return; }
60 const art::FindManyP<recob::Hit> sphits(spHandle, *m_evt, spsLabel);
64 const TVector3
pos(sp.XYZ());
66 const double proj = (
pos-m_start).Dot(m_direction);
67 if(proj < 0 || proj > m_length)
continue;
69 const double cradius = (proj/m_length)*m_width/2;
71 const double rej = ((
pos-m_start) - proj*m_direction).Mag();
72 if(rej > cradius)
continue;
76 m_hits.push_back(&*
hit);
78 m_spacepoints.push_back(&sp);
83 TVector3
start()
const {
return m_start; }
84 TVector3
end()
const {
return m_start + m_direction*m_length; }
86 double length()
const {
return m_length; }
87 double width()
const {
return m_width; }
88 std::vector<const recob::Hit*>
hits()
const {
return m_hits; }
89 std::vector<const recob::SpacePoint*>
spacepoints()
const {
return m_spacepoints; }
103 auto hitHandle = m_evt->getHandle<std::vector<recob::Hit> >(hitLabel);
105 std::cout <<
"pizero::Cone::completeness: could not find hits in event.\n";
112 double sharedHits = 0;
122 if(chit->PeakTime() -
hit.PeakTime() < 1
e-5 &&
123 chit->Channel() ==
hit.Channel()) {
134 return MChits==0? 0: sharedHits/MChits;
138 unsigned sharedHits = 0;
149 return (
double)sharedHits / m_hits.size();
detinfo::DetectorPropertiesData const * m_detprop
std::vector< double > EstimateEnergyFromHitCharge(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const std::vector< const recob::Hit * > &hits, calo::CalorimetryAlg caloAlg)
TVector3 direction() const
Handle< PROD > getHandle(SelectorBase const &) const
std::vector< const recob::Hit * > hits() const
std::vector< int > HitToTrackIds(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
General LArSoft Utilities.
Detector simulation of raw signals on wires.
std::vector< const recob::Hit * > m_hits
double energy(calo::CalorimetryAlg caloAlg) const
Contains all timing reference information for the detector.
Cone(const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TVector3 &newStart, const TVector3 &newDir, const double newLen)
2D representation of charge deposited in the TDC/wire plane
std::vector< const recob::SpacePoint * > m_spacepoints
std::vector< const recob::SpacePoint * > spacepoints() const
detinfo::DetectorClocksData const * m_clockdata