66 fRcone = pset.get<
double>(
"Rcone");
67 fLcone = pset.get<
double>(
"Lcone");
69 produces<std::vector<recob::Shower>>();
70 produces<art::Assns<recob::Shower, recob::Cluster>>();
71 produces<art::Assns<recob::Shower, recob::Hit>>();
81 std::unique_ptr<std::vector<recob::Shower>> showercol(
new std::vector<recob::Shower>);
82 std::unique_ptr<art::Assns<recob::Shower, recob::Cluster>> cassn(
84 std::unique_ptr<art::Assns<recob::Shower, recob::Hit>> hassn(
105 std::vector<size_t> protoShowers;
107 std::vector<art::Ptr<recob::Hit>> clusterhits;
116 mf::LogInfo(
"ShowerFinder") <<
"Vertex STRENGTH list size = " 117 << vertexStrengthListHandle->size()
118 <<
" AND vertices:" << vertexListHandle->size()
119 <<
"\nCLUSTER list size = " << clusterListHandle->size()
120 <<
" AND Hough: :" << houghListHandle->size();
122 for (
size_t iv = 0; iv < vertexListHandle->size(); ++iv) {
126 if (vertex->
ID() == 1 || vertex->
Strength() == 3) {
134 double scan_angle = 0;
146 double cone_angle = (TMath::ATan(fRcone / fLcone)) / 2.0;
147 mf::LogInfo(
"ShowerFinder") <<
"Cone Opening Angle: " << (180.0 * cone_angle) / TMath::Pi();
148 double compl_angle = 0;
150 unsigned int n_scan = 1 + (int)(TMath::Pi() / (2.0 * cone_angle));
151 mf::LogInfo(
"ShowerFinder") <<
"N scan: " << n_scan;
156 int hits_cluster_counter = 0;
162 for (
size_t ivert = 0; ivert < vertSel.
size(); ++ivert) {
164 mf::LogInfo(
"ShowerFinder") <<
"Number of STRONG vertices = " << vertSel.
size();
167 xa_cone = vertSel[ivert]->WireID().Wire;
168 ya_cone = vertSel[ivert]->DriftTime();
170 mf::LogInfo(
"ShowerFinder") <<
"Vertex at: (" << xa_cone <<
", " << ya_cone <<
")";
173 for (
unsigned int iscan = 0; iscan < n_scan; ++iscan) {
175 mf::LogInfo(
"ShowerFinder") <<
">>>> Start SCAN: " << iscan;
178 scan_angle = (TMath::Pi() / 2.0) - (iscan * (2.0 * cone_angle));
180 mf::LogInfo(
"ShowerFinder") <<
"Scan Angle: " << (180. * scan_angle) / TMath::Pi();
183 compl_angle = scan_angle - cone_angle;
186 x1_cone = xa_cone + fScone * (std::cos(compl_angle));
187 y1_cone = ya_cone + fScone * (std::sin(compl_angle));
190 x2_cone = xa_cone + fScone * (std::cos(scan_angle + cone_angle));
191 y2_cone = ya_cone + fScone * (std::sin(scan_angle + cone_angle));
194 protoShowers.clear();
195 for (
size_t iclust = 0; iclust < clusterListHandle->size(); ++iclust) {
201 clusterhits = fmh.at(iclust);
202 if (clusterhits.size() == 0)
continue;
206 for (
size_t ihits = 0; ihits < clusterhits.size(); ++ihits) {
208 x_hit = clusterhits[ihits]->WireID().Wire;
209 y_hit = clusterhits[ihits]->PeakTime();
214 if (y_hit <= ((y2_cone - ya_cone) / (x2_cone - xa_cone)) * x_hit + ya_cone &&
215 y_hit >= ((y1_cone - ya_cone) / (x1_cone - xa_cone)) * x_hit + ya_cone) {
216 hits_cluster_counter++;
222 if (clusterhits.size() == 0)
continue;
223 if (((
double)hits_cluster_counter / (
double)clusterhits.size()) >= 0.5) {
224 mf::LogInfo(
"ShowerFinder") <<
"GOT A SHOWER!!! in scan " << iscan
225 <<
" cluster: " << iclust <<
" : " << clust.
ID();
231 protoShowers.push_back(iclust);
234 hits_cluster_counter = 0;
238 if (protoShowers.empty())
continue;
244 evt, *cassn, showercol->size() - 1, protoShowers.begin(), protoShowers.end());
247 for (
size_t p = 0; p < protoShowers.size(); ++p) {
248 const size_t psIndex = protoShowers[p];
249 std::vector<art::Ptr<recob::Hit>>
hits = fmh.at(psIndex);
260 mf::LogInfo(
"ShowerFinder") <<
"---> Recorded shower = " << showercol->size();
268 evt.
put(std::move(showercol));
269 evt.
put(std::move(cassn));
270 evt.
put(std::move(hassn));
std::string fHoughLineModuleLabel
label of module finding hough line
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
std::string fVertexModuleLabel
label of module finding 2D endpoint
Set of hits with a 2D structure.
std::string fClusterModuleLabel
label of module finding clusters
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
#define DEFINE_ART_MODULE(klass)
void push_back(Ptr< U > const &p)
void produce(art::Event &evt)
Declaration of cluster object.
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
std::string fVertexStrengthModuleLabel
label of module finding 2D endpoint
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Utility object to perform functions of association.
double fRcone
radious of cone for method
ID_t ID() const
Identifier of this cluster.
double fLcone
length of the cone
ShowerFinder(fhicl::ParameterSet const &)
art framework interface to geometry description