20 #include "canvas/Persistency/Common/FindOneP.h" 91 std::vector<Point> trackBox;
93 std::string readrun,readevent,readtpc,readplane,readwire,readtick,readnumpoly;
94 unsigned int run,
event,tpc,plane,numpoly;
99 if (handscanfile.is_open())
101 while (std::getline(handscanfile,line))
104 std::stringstream ss(line);
105 ss >>
std::ws >> readrun >> readevent >> readtpc >> readplane >> readwire >> readtick >> readnumpoly;
108 run = stoul(readrun);
109 event = stoul(readevent);
110 tick = stod(readtick);
111 tpc = stoul(readtpc);
112 plane = stoul(readplane);
113 wire = stod(readwire);
114 numpoly = stoul(readnumpoly);
124 trackBox.push_back(p);
128 std::cout <<
"Line # " << linenumber <<
" is invalid, skipping..." <<
std::endl;
131 handscanfile.close();
135 std::cout <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" 136 <<
"NO FILE FOUND WITH HAND SCANNED HIT DATA\n" 137 <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" <<
std::endl;
141 for (
size_t i_hit = 0; i_hit < prevHitHandle->size(); i_hit++)
150 ptest.event = e.
event();
156 std::map< unsigned int, std::vector<Point> > polygons;
157 for (
auto const &poly : trackBox)
159 if (poly.run == ptest.run
160 && poly.event == ptest.event
161 && poly.tpc == ptest.tpc
162 && poly.plane == ptest.plane)
164 polygons[poly.numpoly].push_back(poly);
167 bool acceptPoint =
false;
168 for (
auto const &
p : polygons)
177 hcol.emplace_back(*phit,wire,rawdigit);
193 size_t n = polygon.size();
196 for (i = 0, j = n - 1; i <
n; j = i++)
198 if ( ((polygon[i].
tick > ptest.
tick) != (polygon[j].tick > ptest.
tick)) &&
199 (ptest.
wire < (polygon[j].wire - polygon[i].wire) *
200 (ptest.
tick - polygon[i].tick) / (polygon[j].tick - polygon[i].tick) + polygon[i].wire) )
EventNumber_t event() const
Handle< PROD > getHandle(SelectorBase const &) const
geo::WireID WireID() const
EDProducer(fhicl::ParameterSet const &pset)
WireID_t Wire
Index of the wire within its plane.
std::string fPreviousHitModuleLabel
HitHandScan & operator=(HitHandScan const &)=delete
static void declare_products(art::ProducesCollector &collector, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
Helper functions to create a hit.
A class handling a collection of hits and its associations.
#define DEFINE_ART_MODULE(klass)
std::string fHandScanFileName
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
T get(std::string const &key) const
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
void reconfigure(fhicl::ParameterSet const &p)
PlaneID_t Plane
Index of the plane within its TPC.
Definition of data types for geometry description.
ProducesCollector & producesCollector() noexcept
float PeakTime() const
Time of the signal peak, in tick units.
Declaration of signal hit object.
bool insidePolygon(std::vector< Point > polygon, Point ptest)
void produce(art::Event &e) override
void line(double t, double *p, double &x, double &y, double &z)
Declaration of basic channel signal object.
HitHandScan(fhicl::ParameterSet const &p)
TPCID_t TPC
Index of the TPC within its cryostat.
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)