Public Types | Public Member Functions | Static 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::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
template<typename UserConfig >
using Table = ProducerBase::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
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Static Public Attributes

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

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

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

using art::EDFilter::ModuleType = EDFilter
inherited

Definition at line 37 of file EDFilter.h.

template<typename UserConfig >
using art::EDFilter::Table = ProducerBase::Table<UserConfig>
inherited

Definition at line 46 of file EDFilter.h.

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

Definition at line 38 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  cosmic_max_dEdx_ (p.get<double> ("cosmic_max_dEdx")),
72  cosmic_min_length_ (p.get<double> ("cosmic_min_length")),
73  hits_adc_cut_ (p.get<unsigned> ("hits_adc_cut")),
74  hits_label_ (p.get<std::string>("hits_label")),
75  isolation_cell_cut_ (p.get<int> ("isolation_cell_cut")),
76  isolation_plane_cut_(p.get<int> ("isolation_plane_cut")),
77  track_label_ (p.get<std::string>("track_label")),
78  use_cosmic_cuts_ (p.get<bool> ("use_cosmic_cuts"))
79 {
80  produces<std::vector<rb::CellHit> >();
81  produces<std::vector<rb::Cluster> >();
82 }
const char * p
Definition: xmltok.h:285
enum BeamMode string
mono::MonopoleCluster::MonopoleCluster ( MonopoleCluster const &  )
delete
mono::MonopoleCluster::MonopoleCluster ( MonopoleCluster &&  )
delete

Member Function Documentation

template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDFilter::currentContext ( ) const
protectedinherited
bool mono::MonopoleCluster::filter ( art::Event e)
overridevirtual

Implements art::EDFilter.

Definition at line 86 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::Event::put(), and track_label_.

87 {
88  std::unique_ptr<std::vector<rb::Cluster> >
89  clusters(new std::vector<rb::Cluster>);
90  std::unique_ptr<std::vector<rb::CellHit> >
91  cellhits(new std::vector<rb::CellHit>);
92 
93  //
94  // Extract Objects from the Event
95  //
97  const bool is_mc = bt->HaveTruthInfo();
98 
99  // Tracks
101  e.getByLabel(track_label_, tracks);
102 
103  // Offline Cell Hits
105  e.getByLabel(hits_label_, hits);
106  std::vector<art::Ptr<rb::CellHit> > hitptrs;
107  for (unsigned i = 0; i < hits->size(); ++i)
108  hitptrs.emplace_back(hits, i);
109 
110  // Remove Low ADC Hits
111  auto hitptrs_new_end = std::remove_if
112  (hitptrs.begin(), hitptrs.end(),
113  [&](art::Ptr<rb::CellHit> hit) { return hit->ADC() < hits_adc_cut_; });
114  hitptrs.erase(hitptrs_new_end, hitptrs.end());
115 
116 
117 
118  //
119  // Create Clusters
120  //
121  rb::Cluster all_hits;
122  for (auto const& hit : hitptrs)
123  all_hits.Add(hit);
124 
125  rb::Cluster track_hits;
126  for (auto const& track : *tracks)
127  if (is_cosmic_track(track))
128  for (auto const& track_hit : track.AllCells())
129  if (track_hit->ADC() > hits_adc_cut_)
130  track_hits.Add(track_hit);
131 
132  auto track_removed_hits = all_hits.Exclude(&track_hits);
133 
134  auto isolated_hits = find_isolated_hits(track_removed_hits);
135  auto mono_hits = track_removed_hits.Exclude(&isolated_hits);
136 
137 
138 
139  //
140  // Add Clusters to the Event
141  //
142  if (mono_hits.NCell() > 0)
143  clusters->push_back(mono_hits);
144 
145  for (auto const& cluster : *clusters)
146  for (auto const& hit : cluster.AllCells())
147  cellhits->push_back(*hit);
148 
149  e.put(std::move(clusters));
150  e.put(std::move(cellhits));
151 
152  if (mono_hits.NCell() > 0)
153  return true;
154 
155  return false;
156 }
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
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void hits()
Definition: readHits.C:15
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
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:133
rb::Cluster mono::MonopoleCluster::find_isolated_hits ( rb::Cluster const &  cluster) const
private

Definition at line 178 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().

179 {
180  rb::Cluster isolated_hits;
181 
182  std::vector<art::PtrVector<rb::CellHit> > views =
183  { cluster.XCells(), cluster.YCells() };
184  for (auto const& view : views)
185  {
186  std::map<int, std::vector<int> > hit_table;
187  for (auto const& hit : view)
188  hit_table[hit->Plane()].push_back(hit->Cell());
189 
190  for (auto const& hit : view)
191  if (hit_is_isolated(hit_table, *hit))
192  isolated_hits.Add(hit);
193  }
194 
195  return isolated_hits;
196 }
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:441
bool hit_is_isolated(std::map< int, std::vector< int > > &hit_table, rb::CellHit const &hit) const
Definition: structs.h:12
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
template<typename PROD , BranchType B>
ProductID art::EDFilter::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 131 of file EDFilter.h.

References art::EDFilter::moduleDescription_.

Referenced by novaddt::HoughTrackMaker::create_associations().

132  {
133  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
134  instanceName);
135  }
ModuleDescription moduleDescription_
Definition: EDFilter.h:124
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
bool mono::MonopoleCluster::hit_is_isolated ( std::map< int, std::vector< int > > &  hit_table,
rb::CellHit const &  hit 
) const
private

Definition at line 201 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().

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

Definition at line 160 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().

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

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID(), and string.

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
MonopoleCluster& mono::MonopoleCluster::operator= ( MonopoleCluster const &  )
delete
MonopoleCluster& mono::MonopoleCluster::operator= ( MonopoleCluster &&  )
delete
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

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::EDFilter::Fail {false}
staticinherited

Definition at line 33 of file EDFilter.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::EDFilter::Pass {true}
staticinherited

Definition at line 32 of file EDFilter.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: