Public Member Functions | Private Member Functions | Private Attributes | List of all members
tss::TrackShowerHits Class Reference
Inheritance diagram for tss::TrackShowerHits:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 TrackShowerHits (fhicl::ParameterSet const &p)
 
 TrackShowerHits (TrackShowerHits const &)=delete
 
 TrackShowerHits (TrackShowerHits &&)=delete
 
TrackShowerHitsoperator= (TrackShowerHits const &)=delete
 
TrackShowerHitsoperator= (TrackShowerHits &&)=delete
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

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
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 31 of file TrackShowerHits_module.cc.

Constructor & Destructor Documentation

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

Definition at line 57 of file TrackShowerHits_module.cc.

58  : EDProducer{p}, fSegmentation2D(p.get<fhicl::ParameterSet>("Segmentation2DAlg"))
59  {
60  fHitModuleLabel = p.get<std::string>("HitModuleLabel");
61  fHugeShowers = p.get<bool>("FindHugeShowers");
62  fShowersBySeg2D = p.get<bool>("FindMoreShowers");
63 
64  produces<std::vector<recob::Cluster>>();
65  produces<art::Assns<recob::Cluster, recob::Hit>>();
66  }
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
tss::Segmentation2D fSegmentation2D
p
Definition: test.py:223
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)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 97 of file TrackShowerHits_module.cc.

98  {
99  std::unique_ptr<std::vector<recob::Cluster>> clusters(new std::vector<recob::Cluster>);
100  std::unique_ptr<art::Assns<recob::Cluster, recob::Hit>> clu2hit(
102 
103  if (sortHits(evt)) {
104  unsigned int cidx = 0;
105  const unsigned int emTag = 0x10000;
106 
107  for (auto tpc_iter = fGeom->begin_TPC_id(); tpc_iter != fGeom->end_TPC_id(); tpc_iter++) {
108  for (const auto& v : fHitMap[tpc_iter->Cryostat][tpc_iter->TPC]) {
109  auto cls = fSimpleClustering.run(v.second);
110 
111  if (fHugeShowers) {
112  mf::LogVerbatim("TrackShowerHits") << "Find huge EM showers (cores).";
113 
114  int c = 0, clsSize = cls.size();
115  while (c < clsSize) {
116  if (cls[c].hits().size() < 2) {
117  c++;
118  continue;
119  }
120 
121  std::vector<const tss::Hit2D*> trks, ems;
122  fSegmentation2D.splitHitsNaive(cls[c], trks, ems);
123  cls.erase(cls.begin() + c);
124  clsSize--;
125 
126  cls.emplace_back(Cluster2D(trks));
127  cls.emplace_back(Cluster2D(ems));
128  cls.back().tagEM(true);
129  }
130  }
131 
132  if (fShowersBySeg2D) {
133  mf::LogVerbatim("TrackShowerHits") << "Find EM showers by density of vtxs.";
134 
135  int c = 0, clsSize = cls.size();
136  while (c < clsSize) {
137  if (cls[c].isEM() || (cls[c].hits().size() < 2)) {
138  c++;
139  continue;
140  }
141 
142  auto segs = fSegmentation2D.run(cls[c]);
143 
144  for (const auto& s : segs)
145  cls.emplace_back(Cluster2D(s));
146 
147  cls.erase(cls.begin() + c);
148  clsSize--;
149  }
150  }
151 
152  for (auto& c : cls) {
153  if (!c.hits().size()) continue; // skip 0-size clusters
154 
155  if (!c.isEM()) continue; // create clusters only for em parts now
156 
157  clusters->emplace_back(
158  recob::Cluster(0.0F,
159  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  c.hits().size(),
177  0.0F,
178  0.0F,
179  cidx + emTag,
180  (geo::View_t)c.hits().front()->View(),
181  c.hits().front()->Hit2DPtr()->WireID().planeID()));
182 
183  std::vector<art::Ptr<recob::Hit>> hits2d;
184  hits2d.reserve(c.hits().size());
185 
186  for (auto h2d : c.hits())
187  hits2d.push_back(h2d->Hit2DPtr());
188 
189  if (hits2d.size()) util::CreateAssn(*this, evt, *clusters, hits2d, *clu2hit);
190 
191  ++cidx;
192  }
193  }
194  }
195  }
196  else
197  mf::LogWarning("TrackShowerHits") << "Hits not found in the event.";
198 
199  evt.put(std::move(clusters));
200  evt.put(std::move(clu2hit));
201  }
cryo_tpc_view_hitmap fHitMap
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
tss::SimpleClustering fSimpleClustering
TPC_id_iterator begin_TPC_id() const
Returns an iterator pointing to the first TPC ID in the detector.
art::ServiceHandle< geo::Geometry const > fGeom
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
tss::Segmentation2D fSegmentation2D
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
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
def move(depos, offset)
Definition: depos.py:107
std::vector< tss::Cluster2D > run(const std::vector< tss::Hit2D > &inp) 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.
std::vector< tss::Cluster2D > run(tss::Cluster2D &inp) const
TPC_id_iterator end_TPC_id() const
Returns an iterator pointing after the last TPC ID in the detector.
Definition: DirOfGamma.h:20
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
bool sortHits(const art::Event &evt)
TCEvent evt
Definition: DataStructs.cxx:7
static QCString * s
Definition: config.cpp:1042
bool tss::TrackShowerHits::sortHits ( const art::Event evt)
private

Definition at line 70 of file TrackShowerHits_module.cc.

71  {
72  auto const detProp =
74  fHitMap.clear();
75 
77  std::vector<art::Ptr<recob::Hit>> hitlist;
78  if (evt.getByLabel(fHitModuleLabel, hitListHandle)) {
79  art::fill_ptr_vector(hitlist, hitListHandle);
80 
81  unsigned int cryo, tpc, view;
82  for (auto const& h : hitlist) {
83  cryo = h->WireID().Cryostat;
84  tpc = h->WireID().TPC;
85  view = h->WireID().Plane;
86 
87  fHitMap[cryo][tpc][view].emplace_back(detProp, h);
88  }
89  return true;
90  }
91  else
92  return false;
93  }
cryo_tpc_view_hitmap fHitMap
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297

Member Data Documentation

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

Definition at line 46 of file TrackShowerHits_module.cc.

cryo_tpc_view_hitmap tss::TrackShowerHits::fHitMap
private

Definition at line 43 of file TrackShowerHits_module.cc.

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

Definition at line 53 of file TrackShowerHits_module.cc.

bool tss::TrackShowerHits::fHugeShowers
private

Definition at line 48 of file TrackShowerHits_module.cc.

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

Definition at line 51 of file TrackShowerHits_module.cc.

bool tss::TrackShowerHits::fShowersBySeg2D
private

Definition at line 48 of file TrackShowerHits_module.cc.

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

Definition at line 50 of file TrackShowerHits_module.cc.


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