86 std::unique_ptr<std::vector<recob::Shower> > showercol(
new std::vector<recob::Shower>);
87 std::unique_ptr< art::Assns<recob::Shower, recob::Cluster> > cassn(
new art::Assns<recob::Shower, recob::Cluster>);
88 std::unique_ptr< art::Assns<recob::Shower, recob::Hit> > hassn(
new art::Assns<recob::Shower, recob::Hit>);
91 art::Handle< std::vector<recob::EndPoint2D> > vertexListHandle;
95 art::Handle< std::vector<recob::Cluster> > houghListHandle;
99 art::Handle< std::vector<recob::Cluster> > clusterListHandle;
105 art::Handle< std::vector<recob::EndPoint2D> > vertexStrengthListHandle;
108 std::vector<size_t> protoShowers;
110 std::vector< art::Ptr<recob::Hit> > clusterhits;
112 art::ServiceHandle<geo::Geometry const> geom;
115 art::PtrVector<recob::EndPoint2D> vertSel;
119 mf::LogInfo(
"ShowerFinder") <<
"Vertex STRENGTH list size = " << vertexStrengthListHandle->size()
120 <<
" AND vertices:" << vertexListHandle->size()
121 <<
"\nCLUSTER list size = " << clusterListHandle->size()
122 <<
" AND Hough: :" << houghListHandle->size();
124 for(
size_t iv = 0; iv < vertexListHandle->size(); ++iv){
125 art::Ptr<recob::EndPoint2D>
vertex(vertexListHandle, iv);
129 vertSel.push_back(
vertex);
135 double scan_angle = 0;
147 double cone_angle = (TMath::ATan(fRcone /
fLcone)) / 2.0;
148 mf::LogInfo(
"ShowerFinder") <<
"Cone Opening Angle: " << (180.0*cone_angle)/TMath::Pi();
149 double compl_angle = 0;
151 unsigned int n_scan =1 + (int)(TMath::Pi() / (2.0*cone_angle));
152 mf::LogInfo(
"ShowerFinder") <<
"N scan: " << n_scan;
157 int hits_cluster_counter = 0;
163 for(
size_t ivert = 0; ivert < vertSel.size(); ++ivert){
165 mf::LogInfo(
"ShowerFinder") <<
"Number of STRONG vertices = " << vertSel.size();
168 xa_cone = vertSel[ivert]->WireID().Wire;
169 ya_cone = vertSel[ivert]->DriftTime();
171 mf::LogInfo(
"ShowerFinder") <<
"Vertex at: (" << xa_cone <<
", " << ya_cone <<
")";
174 for(
unsigned int iscan = 0; iscan < n_scan; ++iscan){
176 mf::LogInfo(
"ShowerFinder") <<
">>>> Start SCAN: " << iscan;
179 scan_angle = (TMath::Pi()/2.0) - (iscan*(2.0*cone_angle));
181 mf::LogInfo(
"ShowerFinder") <<
"Scan Angle: " << (180.*scan_angle)/TMath::Pi();
184 compl_angle = scan_angle - cone_angle;
187 x1_cone = xa_cone + fScone*(std::cos(compl_angle));
188 y1_cone = ya_cone + fScone*(std::sin(compl_angle));
191 x2_cone = xa_cone + fScone*(std::cos(scan_angle + cone_angle));
192 y2_cone = ya_cone + fScone*(std::sin(scan_angle + cone_angle));
195 protoShowers.clear();
196 for(
size_t iclust = 0; iclust < clusterListHandle->size(); ++iclust){
202 clusterhits = fmh.at(iclust);
203 if(clusterhits.size() == 0)
continue;
207 for(
size_t ihits = 0; ihits < clusterhits.size(); ++ihits){
210 x_hit = clusterhits[ihits]->WireID().Wire;
211 y_hit = clusterhits[ihits]->PeakTime();
216 if(y_hit <= ((y2_cone - ya_cone)/(x2_cone - xa_cone))*x_hit + ya_cone &&
217 y_hit >= ((y1_cone - ya_cone)/(x1_cone - xa_cone))*x_hit + ya_cone){
218 hits_cluster_counter++;
224 if(clusterhits.size() == 0)
continue;
225 if(((
double)hits_cluster_counter / (
double)clusterhits.size()) >= 0.5){
226 mf::LogInfo(
"ShowerFinder") <<
"GOT A SHOWER!!! in scan " << iscan
227 <<
" cluster: " << iclust <<
" : " << clust.
ID();
233 protoShowers.push_back(iclust);
236 hits_cluster_counter = 0;
240 if(protoShowers.empty())
continue;
243 double totalCharge = 0.;
245 for(
size_t p = 0;
p < protoShowers.size(); ++
p){
246 const size_t psIndex = protoShowers[
p];
247 for (art::Ptr<recob::Hit>
const&
hit: fmh.at(psIndex))
263 showercol->size() - 1, protoShowers.begin(), protoShowers.end());
266 for(
size_t p = 0;
p < protoShowers.size(); ++
p){
267 const size_t psIndex = protoShowers[
p];
268 std::vector< art::Ptr<recob::Hit> > hits = fmh.at(psIndex);
280 mf::LogInfo(
"ShowerFinder") <<
"---> Recorded shower = "<< showercol->size();
288 evt.put(std::move(showercol));
289 evt.put(std::move(cassn));
290 evt.put(std::move(hassn));
std::string fHoughLineModuleLabel
label of module finding hough line
std::string fVertexModuleLabel
label of module finding 2D endpoint
Set of hits with a 2D structure.
std::string fClusterModuleLabel
label of module finding clusters
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
double fRcone
radious of cone for method
ID_t ID() const
Identifier of this cluster.
double fLcone
length of the cone
Signal from collection planes.