All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
tss::TrackShowerHits Class Reference
Inheritance diagram for tss::TrackShowerHits:

Public Member Functions

 TrackShowerHits (fhicl::ParameterSet const &p)
 
 TrackShowerHits (TrackShowerHits const &)=delete
 
 TrackShowerHits (TrackShowerHits &&)=delete
 
TrackShowerHitsoperator= (TrackShowerHits const &)=delete
 
TrackShowerHitsoperator= (TrackShowerHits &&)=delete
 

Private Member Functions

void produce (art::Event &e) override
 
bool sortHits (const art::Event &evt)
 

Private Attributes

cryo_tpc_view_hitmap fHitMap
 
art::ServiceHandle
< geo::Geometry const > 
fGeom
 
bool fHugeShowers
 
bool fShowersBySeg2D
 
tss::SimpleClustering fSimpleClustering
 
tss::Segmentation2D fSegmentation2D
 
std::string fHitModuleLabel
 

Detailed Description

Definition at line 32 of file TrackShowerHits_module.cc.

Constructor & Destructor Documentation

tss::TrackShowerHits::TrackShowerHits ( fhicl::ParameterSet const &  p)
explicit

Definition at line 58 of file TrackShowerHits_module.cc.

59  : EDProducer{p}, fSegmentation2D(p.get<fhicl::ParameterSet>("Segmentation2DAlg"))
60  {
61  fHitModuleLabel = p.get<std::string>("HitModuleLabel");
62  fHugeShowers = p.get<bool>("FindHugeShowers");
63  fShowersBySeg2D = p.get<bool>("FindMoreShowers");
64 
65  produces<std::vector<recob::Cluster>>();
66  produces<art::Assns<recob::Cluster, recob::Hit>>();
67  }
pdgs p
Definition: selectors.fcl:22
tss::Segmentation2D fSegmentation2D
tss::TrackShowerHits::TrackShowerHits ( TrackShowerHits const &  )
delete
tss::TrackShowerHits::TrackShowerHits ( TrackShowerHits &&  )
delete

Member Function Documentation

TrackShowerHits& tss::TrackShowerHits::operator= ( TrackShowerHits const &  )
delete
TrackShowerHits& tss::TrackShowerHits::operator= ( TrackShowerHits &&  )
delete
void tss::TrackShowerHits::produce ( art::Event &  e)
overrideprivate

Definition at line 98 of file TrackShowerHits_module.cc.

99  {
100  std::unique_ptr<std::vector<recob::Cluster>> clusters(new std::vector<recob::Cluster>);
101  std::unique_ptr<art::Assns<recob::Cluster, recob::Hit>> clu2hit(
102  new art::Assns<recob::Cluster, recob::Hit>);
103 
104  if (sortHits(evt)) {
105  unsigned int cidx = 0;
106  const unsigned int emTag = 0x10000;
107 
108  for (auto tpc_iter = fGeom->begin_TPC_id(); tpc_iter != fGeom->end_TPC_id(); tpc_iter++) {
109  for (const auto& v : fHitMap[tpc_iter->Cryostat][tpc_iter->TPC]) {
110  auto cls = fSimpleClustering.run(v.second);
111 
112  if (fHugeShowers) {
113  mf::LogVerbatim("TrackShowerHits") << "Find huge EM showers (cores).";
114 
115  int c = 0, clsSize = cls.size();
116  while (c < clsSize) {
117  if (cls[c].hits().size() < 2) {
118  c++;
119  continue;
120  }
121 
122  std::vector<const tss::Hit2D*> trks, ems;
123  fSegmentation2D.splitHitsNaive(cls[c], trks, ems);
124  cls.erase(cls.begin() + c);
125  clsSize--;
126 
127  cls.emplace_back(Cluster2D(trks));
128  cls.emplace_back(Cluster2D(ems));
129  cls.back().tagEM(true);
130  }
131  }
132 
133  if (fShowersBySeg2D) {
134  mf::LogVerbatim("TrackShowerHits") << "Find EM showers by density of vtxs.";
135 
136  int c = 0, clsSize = cls.size();
137  while (c < clsSize) {
138  if (cls[c].isEM() || (cls[c].hits().size() < 2)) {
139  c++;
140  continue;
141  }
142 
143  auto segs = fSegmentation2D.run(cls[c]);
144 
145  for (const auto& s : segs)
146  cls.emplace_back(Cluster2D(s));
147 
148  cls.erase(cls.begin() + c);
149  clsSize--;
150  }
151  }
152 
153  for (auto& c : cls) {
154  if (!c.hits().size()) continue; // skip 0-size clusters
155 
156  if (!c.isEM()) continue; // create clusters only for em parts now
157 
158  clusters->emplace_back(
159  recob::Cluster(0.0F,
160  0.0F,
161  0.0F,
162  0.0F,
163  0.0F,
164  0.0F,
165  0.0F,
166  0.0F,
167  0.0F,
168  0.0F,
169  0.0F,
170  0.0F,
171  0.0F,
172  0.0F,
173  0.0F,
174  0.0F,
175  0.0F,
176  0.0F,
177  c.hits().size(),
178  0.0F,
179  0.0F,
180  cidx + emTag,
181  (geo::View_t)c.hits().front()->View(),
182  c.hits().front()->Hit2DPtr()->WireID().planeID()));
183 
184  std::vector<art::Ptr<recob::Hit>> hits2d;
185  hits2d.reserve(c.hits().size());
186 
187  for (auto h2d : c.hits())
188  hits2d.push_back(h2d->Hit2DPtr());
189 
190  if (hits2d.size()) util::CreateAssn(*this, evt, *clusters, hits2d, *clu2hit);
191 
192  ++cidx;
193  }
194  }
195  }
196  }
197  else
198  mf::LogWarning("TrackShowerHits") << "Hits not found in the event.";
199 
200  evt.put(std::move(clusters));
201  evt.put(std::move(clu2hit));
202  }
cryo_tpc_view_hitmap fHitMap
tss::SimpleClustering fSimpleClustering
art::ServiceHandle< geo::Geometry const > fGeom
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
tss::Segmentation2D fSegmentation2D
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
void splitHitsNaive(const tss::Cluster2D &inp, std::vector< const tss::Hit2D * > &trackHits, std::vector< const tss::Hit2D * > &emHits) const
Set of hits with a 2D structure.
Definition: Cluster.h:71
std::vector< tss::Cluster2D > run(const std::vector< tss::Hit2D > &inp) const
std::vector< tss::Cluster2D > run(tss::Cluster2D &inp) const
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.
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
bool sortHits(const art::Event &evt)
TCEvent evt
Definition: DataStructs.cxx:8
bool tss::TrackShowerHits::sortHits ( const art::Event &  evt)
private

Definition at line 71 of file TrackShowerHits_module.cc.

72  {
73  auto const detProp =
74  art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt);
75  fHitMap.clear();
76 
77  art::Handle<std::vector<recob::Hit>> hitListHandle;
78  std::vector<art::Ptr<recob::Hit>> hitlist;
79  if (evt.getByLabel(fHitModuleLabel, hitListHandle)) {
80  art::fill_ptr_vector(hitlist, hitListHandle);
81 
82  unsigned int cryo, tpc, view;
83  for (auto const& h : hitlist) {
84  cryo = h->WireID().Cryostat;
85  tpc = h->WireID().TPC;
86  view = h->WireID().Plane;
87 
88  fHitMap[cryo][tpc][view].emplace_back(detProp, h);
89  }
90  return true;
91  }
92  else
93  return false;
94  }
cryo_tpc_view_hitmap fHitMap
while getopts h
TCEvent evt
Definition: DataStructs.cxx:8
auto const detProp

Member Data Documentation

art::ServiceHandle<geo::Geometry const> tss::TrackShowerHits::fGeom
private

Definition at line 47 of file TrackShowerHits_module.cc.

cryo_tpc_view_hitmap tss::TrackShowerHits::fHitMap
private

Definition at line 44 of file TrackShowerHits_module.cc.

std::string tss::TrackShowerHits::fHitModuleLabel
private

Definition at line 54 of file TrackShowerHits_module.cc.

bool tss::TrackShowerHits::fHugeShowers
private

Definition at line 49 of file TrackShowerHits_module.cc.

tss::Segmentation2D tss::TrackShowerHits::fSegmentation2D
private

Definition at line 52 of file TrackShowerHits_module.cc.

bool tss::TrackShowerHits::fShowersBySeg2D
private

Definition at line 49 of file TrackShowerHits_module.cc.

tss::SimpleClustering tss::TrackShowerHits::fSimpleClustering
private

Definition at line 51 of file TrackShowerHits_module.cc.


The documentation for this class was generated from the following file: