20 #include <sys/types.h> 85 #endif // SHOWERFINDER_H 95 produces< std::vector<recob::Shower> >();
96 produces< art::Assns<recob::Shower, recob::Cluster> >();
97 produces< art::Assns<recob::Shower, recob::Hit> >();
126 std::unique_ptr<std::vector<recob::Shower> > showercol(
new std::vector<recob::Shower>);
148 std::vector<size_t> protoShowers;
150 std::vector< art::Ptr<recob::Hit> > clusterhits;
159 mf::LogInfo(
"ShowerFinder") <<
"Vertex STRENGTH list size = " << vertexStrengthListHandle->size()
160 <<
" AND vertices:" << vertexListHandle->size()
161 <<
"\nCLUSTER list size = " << clusterListHandle->size()
162 <<
" AND Hough: :" << houghListHandle->size();
164 for(
size_t iv = 0; iv < vertexListHandle->size(); ++iv){
168 if(vertex->
ID() == 1 || vertex->
Strength() == 3){
175 double scan_angle = 0;
187 double cone_angle = (TMath::ATan(fRcone / fLcone)) / 2.0;
188 mf::LogInfo(
"ShowerFinder") <<
"Cone Opening Angle: " << (180.0*cone_angle)/TMath::Pi();
189 double compl_angle = 0;
191 unsigned int n_scan =1 + (int)(TMath::Pi() / (2.0*cone_angle));
192 mf::LogInfo(
"ShowerFinder") <<
"N scan: " << n_scan;
197 int hits_cluster_counter = 0;
203 for(
size_t ivert = 0; ivert < vertSel.
size(); ++ivert){
205 mf::LogInfo(
"ShowerFinder") <<
"Number of STRONG vertices = " << vertSel.
size();
208 xa_cone = vertSel[ivert]->WireID().Wire;
209 ya_cone = vertSel[ivert]->DriftTime();
211 mf::LogInfo(
"ShowerFinder") <<
"Vertex at: (" << xa_cone <<
", " << ya_cone <<
")";
214 for(
unsigned int iscan = 0; iscan < n_scan; ++iscan){
216 mf::LogInfo(
"ShowerFinder") <<
">>>> Start SCAN: " << iscan;
219 scan_angle = (TMath::Pi()/2.0) - (iscan*(2.0*cone_angle));
221 mf::LogInfo(
"ShowerFinder") <<
"Scan Angle: " << (180.*scan_angle)/TMath::Pi();
224 compl_angle = scan_angle - cone_angle;
227 x1_cone = xa_cone + fScone*(std::cos(compl_angle));
228 y1_cone = ya_cone + fScone*(std::sin(compl_angle));
231 x2_cone = xa_cone + fScone*(std::cos(scan_angle + cone_angle));
232 y2_cone = ya_cone + fScone*(std::sin(scan_angle + cone_angle));
235 protoShowers.clear();
236 for(
size_t iclust = 0; iclust < clusterListHandle->size(); ++iclust){
242 clusterhits = fmh.at(iclust);
243 if(clusterhits.size() == 0)
continue;
247 for(
size_t ihits = 0; ihits < clusterhits.size(); ++ihits){
250 x_hit = clusterhits[ihits]->WireID().Wire;
251 y_hit = clusterhits[ihits]->PeakTime();
256 if(y_hit <= ((y2_cone - ya_cone)/(x2_cone - xa_cone))*x_hit + ya_cone &&
257 y_hit >= ((y1_cone - ya_cone)/(x1_cone - xa_cone))*x_hit + ya_cone){
258 hits_cluster_counter++;
264 if(clusterhits.size() == 0)
continue;
265 if(((
double)hits_cluster_counter / (
double)clusterhits.size()) >= 0.5){
266 mf::LogInfo(
"ShowerFinder") <<
"GOT A SHOWER!!! in scan " << iscan
267 <<
" cluster: " << iclust <<
" : " << clust.
ID();
273 protoShowers.push_back(iclust);
276 hits_cluster_counter = 0;
280 if(protoShowers.empty())
continue;
283 double totalCharge = 0.;
285 for(
size_t p = 0; p < protoShowers.size(); ++p){
286 const size_t psIndex = protoShowers[p];
303 showercol->size() - 1, protoShowers.begin(), protoShowers.end());
306 for(
size_t p = 0; p < protoShowers.size(); ++p){
307 const size_t psIndex = protoShowers[p];
308 std::vector< art::Ptr<recob::Hit> >
hits = fmh.at(psIndex);
320 mf::LogInfo(
"ShowerFinder") <<
"---> Recorded shower = "<< showercol->size();
328 evt.
put(std::move(showercol));
329 evt.
put(std::move(cassn));
330 evt.
put(std::move(hassn));
std::string fHoughLineModuleLabel
label of module finding hough line
Encapsulate the construction of a single cyostat.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Declaration of signal hit object.
std::string fVertexModuleLabel
label of module finding 2D endpoint
Set of hits with a 2D structure.
std::string fClusterModuleLabel
label of module finding clusters
void reconfigure(fhicl::ParameterSet const &p)
ProductID put(std::unique_ptr< PROD > &&product)
#define DEFINE_ART_MODULE(klass)
void push_back(Ptr< U > const &p)
T get(std::string const &key) const
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
void produce(art::Event &evt)
Declaration of cluster object.
Detector simulation of raw signals on wires.
std::string fVertexStrengthModuleLabel
label of module finding 2D endpoint
Utility object to perform functions of association.
double fRcone
radious of cone for method
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
ID_t ID() const
Identifier of this cluster.
double fLcone
length of the cone
ShowerFinder(fhicl::ParameterSet const &)
art framework interface to geometry description
Encapsulate the construction of a single detector plane.
Signal from collection planes.