Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
hough::HoughT Class Reference
Inheritance diagram for hough::HoughT:
art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerBase::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 HoughT (fhicl::ParameterSet const &p)
 
virtual ~HoughT ()
 
void beginJob ()
 
virtual void produce (art::Event &e)
 
void reconfigure (const fhicl::ParameterSet &p)
 
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 ()
 

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

void WriteHoughHistos (const Hough2P &h)
 
bool is_good_slice (rb::Cluster const &slice, geo::View_t view) const
 

Private Attributes

int fWriteHoughHistos
 Write the hough maps out? More...
 
int fWeightByQ
 Weight hits by charge? More...
 
double fRhoBinSz
 Size of rho bins (cm) More...
 
double fThetaBinSz
 Angular size of angle bins (degrees) More...
 
int fRhoSmoothWin
 Number of bins to smooth over. More...
 
int fThetaSmoothWin
 Number of bins to smooth over. More...
 
double fRsqr
 Distance cut on hit pairs. More...
 
double fPco
 Number of sigma above average peak height to use as threshold cutoff in Hough space. More...
 
unsigned int fHitMin
 Minimum number of hits required per view. More...
 
std::string fSlicerLabel
 Label for the process that made slices. More...
 

Detailed Description

Run and test Hough transform algorithms

Definition at line 29 of file HoughT_module.cc.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

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

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

hough::HoughT::HoughT ( fhicl::ParameterSet const &  p)
explicit

Definition at line 59 of file HoughT_module.cc.

References reconfigure().

60  {
61  reconfigure(p);
62  produces<std::vector<rb::HoughResult> >();
63  produces<art::Assns<rb::HoughResult, rb::Cluster> >();
64  }
const char * p
Definition: xmltok.h:285
void reconfigure(const fhicl::ParameterSet &p)
hough::HoughT::~HoughT ( )
virtual

Definition at line 90 of file HoughT_module.cc.

90 { }

Member Function Documentation

void hough::HoughT::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 68 of file HoughT_module.cc.

69  {
70  }
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::EDProducer::currentContext ( ) const
protectedinherited
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::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

Referenced by skim::NueSkimmer::CopyMichelSlice(), and skim::NueSkimmer::CopyMichelTrack().

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
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 hough::HoughT::is_good_slice ( rb::Cluster const &  slice,
geo::View_t  view 
) const
private

Definition at line 174 of file HoughT_module.cc.

References DEFINE_ART_MODULE(), fHitMin, rb::Cluster::MaxCell(), rb::Cluster::MaxPlane(), rb::Cluster::MinCell(), rb::Cluster::MinPlane(), and rb::Cluster::NCell().

Referenced by produce().

175  {
176  if (slice.NCell(view) <= fHitMin)
177  return false;
178 
179  // It can happen that a slice contains several hits from one cell,
180  // but occurring at differnt times.
181  if (slice.MinPlane(view) == slice.MaxPlane(view) &&
182  slice.MinCell(view) == slice.MaxCell(view))
183  return false;
184 
185  return true;
186  }
unsigned int fHitMin
Minimum number of hits required per view.
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
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void hough::HoughT::produce ( art::Event e)
virtual

Implements art::EDProducer.

Definition at line 94 of file HoughT_module.cc.

References util::CreateAssn(), hough::Hough2P::fH, fPco, fRhoBinSz, fRhoSmoothWin, fRsqr, fSlicerLabel, fThetaBinSz, fThetaSmoothWin, fWeightByQ, fWriteHoughHistos, geom(), art::DataViewImpl::getByLabel(), make_syst_table_plots::h, MECModelEnuComparisons::i, is_good_slice(), rb::Cluster::IsNoise(), kX, geo::kX, geo::kY, kY, hough::Hough2P::Map(), rb::Cluster::NXCell(), rb::Cluster::NYCell(), art::Event::put(), and WriteHoughHistos().

95  {
96  unsigned int i;
98 
99  // Container for results to be stored in the event
100  std::unique_ptr<std::vector<rb::HoughResult> >
101  htr(new std::vector<rb::HoughResult>);
102  std::unique_ptr<art::Assns<rb::HoughResult, rb::Cluster> >
104 
105  // Pull out the time slices and shuffle them into a useful container
107  evt.getByLabel(fSlicerLabel,slice);
108 
109  for (i=0; i<slice->size(); ++i)
110  {
111  const rb::Cluster& s = (*slice)[i];
112  //
113  // Skip any noise clusters
114  //
115  if (s.IsNoise()) continue;
116 
117  //
118  // Build a stripped down hit list from the cells in the cluster
119  //
121 
122  //
123  // Construct the Hough transforms of the X and Y views
124  //
127  if(is_good_slice(s, geo::View_t::kX)) hx.Map(h);
128  if(is_good_slice(s, geo::View_t::kY)) hy.Map(h);
129 
130  /*
131  std::cout << "*=== Slice " << i << std::endl;
132  std::cout << "Found " << hx.fH.fPeak.size() << " peaks in X" << std::endl;
133  std::cout << "Found " << hy.fH.fPeak.size() << " peaks in Y" << std::endl;
134  */
135 
136  //
137  // Put the results into the event and associate the last htr element
138  // with the slice.
139  //
140  art::Ptr<rb::Cluster> slice_ptr(slice, i);
141  htr->push_back(hx.fH);
142  util::CreateAssn(*this, evt, *htr, slice_ptr, *assns);
143  htr->push_back(hy.fH);
144  util::CreateAssn(*this, evt, *htr, slice_ptr, *assns);
145 
146  //
147  // Optionally write the hough maps to the ROOT histogram file
148  //
149  if (fWriteHoughHistos)
150  {
151  if (s.NXCell() > 0)
152  this->WriteHoughHistos(hx);
153 
154  if (s.NYCell() > 0)
155  this->WriteHoughHistos(hy);
156  }
157  }
158 
159  evt.put(std::move(htr));
160  evt.put(std::move(assns));
161  }
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
int fWeightByQ
Weight hits by charge?
void WriteHoughHistos(const Hough2P &h)
Vertical planes which measure X.
Definition: PlaneGeo.h:28
A collection of associated CellHits.
Definition: Cluster.h:47
int fRhoSmoothWin
Number of bins to smooth over.
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
const Var kY([](const caf::SRProxy *sr){float tmp=0.f;if(sr->mc.nu.empty()) return tmp;tmp=sr->mc.nu[0].y;return tmp;})
const XML_Char * s
Definition: expat.h:262
std::string fSlicerLabel
Label for the process that made slices.
Just the essential information required for track fitting.
Definition: HitList.h:40
int evt
double fRsqr
Distance cut on hit pairs.
bool is_good_slice(rb::Cluster const &slice, geo::View_t view) const
unsigned int NYCell() const
Number of cells in the y-view.
Definition: Cluster.h:108
unsigned int NXCell() const
Number of cells in the x-view.
Definition: Cluster.h:106
void geom(int which=0)
Definition: geom.C:163
Definition: geo.h:1
double fThetaBinSz
Angular size of angle bins (degrees)
int fThetaSmoothWin
Number of bins to smooth over.
double fPco
Number of sigma above average peak height to use as threshold cutoff in Hough space.
bool IsNoise() const
Is the noise flag set?
Definition: Cluster.h:163
int fWriteHoughHistos
Write the hough maps out?
double fRhoBinSz
Size of rho bins (cm)
void hough::HoughT::reconfigure ( const fhicl::ParameterSet p)

Definition at line 74 of file HoughT_module.cc.

References fHitMin, fPco, fRhoBinSz, fRhoSmoothWin, fRsqr, fSlicerLabel, fThetaBinSz, fThetaSmoothWin, fWeightByQ, fWriteHoughHistos, fhicl::ParameterSet::get(), and string.

Referenced by HoughT().

75  {
76  fWriteHoughHistos = p.get<int> ("WriteHoughHistos");
77  fWeightByQ = p.get<int> ("WeightByQ");
78  fRhoBinSz = p.get<double> ("RhoBinSz");
79  fThetaBinSz = p.get<double> ("ThetaBinSz");
80  fRhoSmoothWin = p.get<int> ("RhoSmoothWin");
81  fThetaSmoothWin = p.get<int> ("ThetaSmoothWin");
82  fRsqr = p.get<double> ("Rsqr");
83  fPco = p.get<double> ("PeakCO");
84  fHitMin = p.get<unsigned int> ("HitMin");
85  fSlicerLabel = p.get<std::string> ("SlicerLabel");
86  }
int fWeightByQ
Weight hits by charge?
int fRhoSmoothWin
Number of bins to smooth over.
std::string fSlicerLabel
Label for the process that made slices.
unsigned int fHitMin
Minimum number of hits required per view.
T get(std::string const &key) const
Definition: ParameterSet.h:231
double fRsqr
Distance cut on hit pairs.
double fThetaBinSz
Angular size of angle bins (degrees)
int fThetaSmoothWin
Number of bins to smooth over.
double fPco
Number of sigma above average peak height to use as threshold cutoff in Hough space.
int fWriteHoughHistos
Write the hough maps out?
double fRhoBinSz
Size of rho bins (cm)
enum BeamMode string
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
void hough::HoughT::WriteHoughHistos ( const Hough2P h)
private

Member Data Documentation

unsigned int hough::HoughT::fHitMin
private

Minimum number of hits required per view.

Definition at line 49 of file HoughT_module.cc.

Referenced by is_good_slice(), and reconfigure().

double hough::HoughT::fPco
private

Number of sigma above average peak height to use as threshold cutoff in Hough space.

Definition at line 48 of file HoughT_module.cc.

Referenced by produce(), and reconfigure().

double hough::HoughT::fRhoBinSz
private

Size of rho bins (cm)

Definition at line 43 of file HoughT_module.cc.

Referenced by produce(), and reconfigure().

int hough::HoughT::fRhoSmoothWin
private

Number of bins to smooth over.

Definition at line 45 of file HoughT_module.cc.

Referenced by produce(), and reconfigure().

double hough::HoughT::fRsqr
private

Distance cut on hit pairs.

Definition at line 47 of file HoughT_module.cc.

Referenced by produce(), and reconfigure().

std::string hough::HoughT::fSlicerLabel
private

Label for the process that made slices.

Definition at line 50 of file HoughT_module.cc.

Referenced by produce(), and reconfigure().

double hough::HoughT::fThetaBinSz
private

Angular size of angle bins (degrees)

Definition at line 44 of file HoughT_module.cc.

Referenced by produce(), and reconfigure().

int hough::HoughT::fThetaSmoothWin
private

Number of bins to smooth over.

Definition at line 46 of file HoughT_module.cc.

Referenced by produce(), and reconfigure().

int hough::HoughT::fWeightByQ
private

Weight hits by charge?

Definition at line 42 of file HoughT_module.cc.

Referenced by produce(), and reconfigure().

int hough::HoughT::fWriteHoughHistos
private

Write the hough maps out?

Definition at line 41 of file HoughT_module.cc.

Referenced by produce(), and reconfigure().


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