Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
mono::MonopoleCluster Class Reference
Inheritance diagram for mono::MonopoleCluster:
art::EDFilter art::detail::Filter art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
template<typename UserConfig >
using Table = Modifier::Table< UserConfig >
 

Public Member Functions

 MonopoleCluster (fhicl::ParameterSet const &p)
 
 MonopoleCluster (MonopoleCluster const &)=delete
 
 MonopoleCluster (MonopoleCluster &&)=delete
 
MonopoleClusteroperator= (MonopoleCluster const &)=delete
 
MonopoleClusteroperator= (MonopoleCluster &&)=delete
 
bool filter (art::Event &e) override
 
std::string workerType () const
 
void doBeginJob ()
 
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 &)
 
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)
 
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< TconsumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< TmayConsumeView (InputTag const &tag)
 

Static Public Attributes

static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (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< TmayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Private Member Functions

rb::Cluster find_isolated_hits (rb::Cluster const &cluster) const
 
bool hit_is_isolated (std::map< int, std::vector< int > > &hit_table, rb::CellHit const &hit) const
 
bool is_cosmic_track (rb::Track const &t) const
 

Private Attributes

double cosmic_max_dEdx_
 
double cosmic_min_length_
 
int hits_adc_cut_
 
std::string hits_label_
 
int isolation_cell_cut_
 
int isolation_plane_cut_
 
std::string track_label_
 
bool use_cosmic_cuts_
 

Detailed Description

Definition at line 40 of file MonopoleCluster_module.cc.

Member Typedef Documentation

Definition at line 19 of file EDFilter.h.

template<typename UserConfig >
using art::detail::Filter::Table = Modifier::Table<UserConfig>
inherited

Definition at line 29 of file Filter.h.

using art::EDFilter::WorkerType = WorkerT<EDFilter>
inherited

Definition at line 20 of file EDFilter.h.

Constructor & Destructor Documentation

mono::MonopoleCluster::MonopoleCluster ( fhicl::ParameterSet const &  p)
explicit

Definition at line 70 of file MonopoleCluster_module.cc.

70  :
71  EDFilter(p),
72  cosmic_max_dEdx_ (p.get<double> ("cosmic_max_dEdx")),
73  cosmic_min_length_ (p.get<double> ("cosmic_min_length")),
74  hits_adc_cut_ (p.get<unsigned> ("hits_adc_cut")),
75  hits_label_ (p.get<std::string>("hits_label")),
76  isolation_cell_cut_ (p.get<int> ("isolation_cell_cut")),
77  isolation_plane_cut_(p.get<int> ("isolation_plane_cut")),
78  track_label_ (p.get<std::string>("track_label")),
79  use_cosmic_cuts_ (p.get<bool> ("use_cosmic_cuts"))
80 {
81  produces<std::vector<rb::CellHit> >();
82  produces<std::vector<rb::Cluster> >();
83 }
const char * p
Definition: xmltok.h:285
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:22
enum BeamMode string
mono::MonopoleCluster::MonopoleCluster ( MonopoleCluster const &  )
delete
mono::MonopoleCluster::MonopoleCluster ( MonopoleCluster &&  )
delete

Member Function Documentation

template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 55 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumes(), T, and getGoodRuns4SAM::tag.

56  {
57  return collector_.consumes<T, BT>(tag);
58  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ProductToken< T > consumes(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ConsumesCollector& art::ModuleBase::consumesCollector ( )
protectedinherited
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 69 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesMany(), and T.

70  {
71  collector_.consumesMany<T, BT>();
72  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 62 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesView(), T, and getGoodRuns4SAM::tag.

63  {
64  return collector_.consumesView<T, BT>(tag);
65  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > consumesView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
void art::detail::Filter::doBeginJob ( )
inherited
bool art::detail::Filter::doBeginRun ( RunPrincipal rp,
ModuleContext const &   
)
inherited
bool art::detail::Filter::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
void art::detail::Filter::doEndJob ( )
inherited
bool art::detail::Filter::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Filter::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Filter::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 
)
inherited
void art::detail::Filter::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited
bool mono::MonopoleCluster::filter ( art::Event e)
overridevirtual

Implements art::EDFilter.

Definition at line 87 of file MonopoleCluster_module.cc.

References rb::Cluster::Add(), rb::Cluster::Exclude(), find_isolated_hits(), art::DataViewImpl::getByLabel(), cheat::BackTracker::HaveTruthInfo(), hits(), hits_adc_cut_, hits_label_, MECModelEnuComparisons::i, is_cosmic_track(), art::DataViewImpl::put(), and track_label_.

88 {
89  std::unique_ptr<std::vector<rb::Cluster> >
90  clusters(new std::vector<rb::Cluster>);
91  std::unique_ptr<std::vector<rb::CellHit> >
92  cellhits(new std::vector<rb::CellHit>);
93 
94  //
95  // Extract Objects from the Event
96  //
98  const bool is_mc = bt->HaveTruthInfo();
99 
100  // Tracks
102  e.getByLabel(track_label_, tracks);
103 
104  // Offline Cell Hits
106  e.getByLabel(hits_label_, hits);
107  std::vector<art::Ptr<rb::CellHit> > hitptrs;
108  for (unsigned i = 0; i < hits->size(); ++i)
109  hitptrs.emplace_back(hits, i);
110 
111  // Remove Low ADC Hits
112  auto hitptrs_new_end = std::remove_if
113  (hitptrs.begin(), hitptrs.end(),
114  [&](art::Ptr<rb::CellHit> hit) { return hit->ADC() < hits_adc_cut_; });
115  hitptrs.erase(hitptrs_new_end, hitptrs.end());
116 
117 
118 
119  //
120  // Create Clusters
121  //
122  rb::Cluster all_hits;
123  for (auto const& hit : hitptrs)
124  all_hits.Add(hit);
125 
126  rb::Cluster track_hits;
127  for (auto const& track : *tracks)
128  if (is_cosmic_track(track))
129  for (auto const& track_hit : track.AllCells())
130  if (track_hit->ADC() > hits_adc_cut_)
131  track_hits.Add(track_hit);
132 
133  auto track_removed_hits = all_hits.Exclude(&track_hits);
134 
135  auto isolated_hits = find_isolated_hits(track_removed_hits);
136  auto mono_hits = track_removed_hits.Exclude(&isolated_hits);
137 
138 
139 
140  //
141  // Add Clusters to the Event
142  //
143  if (mono_hits.NCell() > 0)
144  clusters->push_back(mono_hits);
145 
146  for (auto const& cluster : *clusters)
147  for (auto const& hit : cluster.AllCells())
148  cellhits->push_back(*hit);
149 
150  e.put(std::move(clusters));
151  e.put(std::move(cellhits));
152 
153  if (mono_hits.NCell() > 0)
154  return true;
155 
156  return false;
157 }
bool is_cosmic_track(rb::Track const &t) const
Definition: event.h:19
A collection of associated CellHits.
Definition: Cluster.h:47
rb::Cluster Exclude(const rb::Cluster *excl) const
Create a cluster from this one, but with the hits of excl removed.
Definition: Cluster.cxx:233
rb::Cluster find_isolated_hits(rb::Cluster const &cluster) const
virtual void Add(const art::Ptr< rb::CellHit > &cell, double weight=1)
Definition: Cluster.cxx:84
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
void hits()
Definition: readHits.C:15
Definition: structs.h:12
bool HaveTruthInfo() const
Is this a file with truth info in? (Is BackTracker going to be any use to you?)
Definition: BackTracker.h:137
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
rb::Cluster mono::MonopoleCluster::find_isolated_hits ( rb::Cluster const &  cluster) const
private

Definition at line 179 of file MonopoleCluster_module.cc.

References rb::Cluster::Add(), hit_is_isolated(), art::PtrVector< T >::push_back(), POTSpillRate::view, rb::Cluster::XCells(), and rb::Cluster::YCells().

Referenced by filter(), and is_cosmic_track().

180 {
181  rb::Cluster isolated_hits;
182 
183  std::vector<art::PtrVector<rb::CellHit> > views =
184  { cluster.XCells(), cluster.YCells() };
185  for (auto const& view : views)
186  {
187  std::map<int, std::vector<int> > hit_table;
188  for (auto const& hit : view)
189  hit_table[hit->Plane()].push_back(hit->Cell());
190 
191  for (auto const& hit : view)
192  if (hit_is_isolated(hit_table, *hit))
193  isolated_hits.Add(hit);
194  }
195 
196  return isolated_hits;
197 }
const art::PtrVector< rb::CellHit > & XCells() const
Get all cells from the x-view.
Definition: Cluster.h:124
A collection of associated CellHits.
Definition: Cluster.h:47
virtual void Add(const art::Ptr< rb::CellHit > &cell, double weight=1)
Definition: Cluster.cxx:84
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
bool hit_is_isolated(std::map< int, std::vector< int > > &hit_table, rb::CellHit const &hit) const
Definition: structs.h:12
std::array<std::vector<ProductInfo>, NumBranchTypes> const& art::ModuleBase::getConsumables ( ) const
inherited
bool mono::MonopoleCluster::hit_is_isolated ( std::map< int, std::vector< int > > &  hit_table,
rb::CellHit const &  hit 
) const
private

Definition at line 202 of file MonopoleCluster_module.cc.

References getBrightness::cell, rb::CellHit::Cell(), DEFINE_ART_MODULE(), makeTrainCVSamples::int, isolation_cell_cut_, isolation_plane_cut_, rb::CellHit::Plane(), and NDAPDHVSetting::plane.

Referenced by find_isolated_hits().

203 {
204  int p_start = int(hit.Plane()) - isolation_plane_cut_;
205  int p_end = int(hit.Plane()) + isolation_plane_cut_;
206 
207  int c_start = int(hit.Cell()) - isolation_cell_cut_;
208  int c_end = int(hit.Cell()) + isolation_cell_cut_;
209 
210  for (int plane = p_start; plane <= p_end; ++plane)
211  for (auto const& cell : hit_table[plane])
212  if (cell >= c_start &&
213  cell <= c_end &&
214  !(cell == hit.Cell() && plane == hit.Plane()))
215  return false;
216 
217  return true;
218 }
Definition: structs.h:12
bool mono::MonopoleCluster::is_cosmic_track ( rb::Track const &  t) const
private

Definition at line 161 of file MonopoleCluster_module.cc.

References cosmic_max_dEdx_, cosmic_min_length_, find_isolated_hits(), rb::Cluster::TotalGeV(), rb::Track::TotalLength(), and use_cosmic_cuts_.

Referenced by filter().

162 {
163  if (!use_cosmic_cuts_)
164  return true;
165 
166  if (t.TotalLength() < cosmic_min_length_)
167  return false;
168 
169  double dEdx = t.TotalGeV() / t.TotalLength();
170  if (dEdx > cosmic_max_dEdx_)
171  return false;
172 
173  return true;
174 }
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 76 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsume(), T, and getGoodRuns4SAM::tag.

77  {
78  return collector_.mayConsume<T, BT>(tag);
79  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 90 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeMany(), and T.

91  {
93  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 83 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeView(), T, and getGoodRuns4SAM::tag.

84  {
85  return collector_.mayConsumeView<T, BT>(tag);
86  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > mayConsumeView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ModuleDescription const& art::ModuleBase::moduleDescription ( ) const
inherited
MonopoleCluster& mono::MonopoleCluster::operator= ( MonopoleCluster const &  )
delete
MonopoleCluster& mono::MonopoleCluster::operator= ( MonopoleCluster &&  )
delete
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  )
inherited
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited
std::string art::EDFilter::workerType ( ) const
inherited

Referenced by art::EDFilter::EDFilter().

Member Data Documentation

double mono::MonopoleCluster::cosmic_max_dEdx_
private

Definition at line 58 of file MonopoleCluster_module.cc.

Referenced by is_cosmic_track().

double mono::MonopoleCluster::cosmic_min_length_
private

Definition at line 59 of file MonopoleCluster_module.cc.

Referenced by is_cosmic_track().

constexpr bool art::detail::Filter::Fail {false}
staticinherited

Definition at line 26 of file Filter.h.

Referenced by evgen::GENIEFilter::filter().

int mono::MonopoleCluster::hits_adc_cut_
private

Definition at line 60 of file MonopoleCluster_module.cc.

Referenced by filter().

std::string mono::MonopoleCluster::hits_label_
private

Definition at line 61 of file MonopoleCluster_module.cc.

Referenced by filter().

int mono::MonopoleCluster::isolation_cell_cut_
private

Definition at line 62 of file MonopoleCluster_module.cc.

Referenced by hit_is_isolated().

int mono::MonopoleCluster::isolation_plane_cut_
private

Definition at line 63 of file MonopoleCluster_module.cc.

Referenced by hit_is_isolated().

constexpr bool art::detail::Filter::Pass {true}
staticinherited

Definition at line 25 of file Filter.h.

Referenced by evgen::GENIEFilter::filter().

std::string mono::MonopoleCluster::track_label_
private

Definition at line 64 of file MonopoleCluster_module.cc.

Referenced by filter().

bool mono::MonopoleCluster::use_cosmic_cuts_
private

Definition at line 65 of file MonopoleCluster_module.cc.

Referenced by is_cosmic_track().


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