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::MonopoleTrack Class Reference
Inheritance diagram for mono::MonopoleTrack:
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

 MonopoleTrack (fhicl::ParameterSet const &p)
 
 MonopoleTrack (MonopoleTrack const &)=delete
 
 MonopoleTrack (MonopoleTrack &&)=delete
 
MonopoleTrackoperator= (MonopoleTrack const &)=delete
 
MonopoleTrackoperator= (MonopoleTrack &&)=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

bool hit_is_on_track (art::Ptr< rb::CellHit > const &hit, geo::View_t view, double const &slope, double const &intercept) const
 

Private Attributes

std::string hough_label_
 
double hough_peak_cut_
 
std::string slice_label_
 
double track_matching_min_score_
 
unsigned track_min_hits_
 
art::ServiceHandle< geo::Geometrygeometry_
 

Detailed Description

Definition at line 54 of file MonopoleTrack_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::MonopoleTrack::MonopoleTrack ( fhicl::ParameterSet const &  p)
explicit

Definition at line 82 of file MonopoleTrack_module.cc.

82  :
83  hough_label_ (p.get<std::string>("hough_label")),
84  hough_peak_cut_ (p.get<double>("hough_peak_cut")),
85  slice_label_ (p.get<std::string>("slice_label")),
86  track_matching_min_score_(p.get<double>("track_matching_min_score")),
87  track_min_hits_ (p.get<unsigned>("track_min_hits"))
88 {
89  produces<std::vector<rb::Cluster> >();
90  produces<std::vector<mono::Track3D> >();
91 }
const char * p
Definition: xmltok.h:285
enum BeamMode string
mono::MonopoleTrack::MonopoleTrack ( MonopoleTrack const &  )
delete
mono::MonopoleTrack::MonopoleTrack ( MonopoleTrack &&  )
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::MonopoleTrack::filter ( art::Event e)
overridevirtual

Implements art::EDFilter.

Definition at line 95 of file MonopoleTrack_module.cc.

References abs(), rb::Cluster::Add(), mono::Track3D::beta(), mono::Track2D::cluster, mono::Track3D::cluster(), art::FindManyP< ProdB, Data >::get(), art::DataViewImpl::getByLabel(), hit_is_on_track(), hough_label_, hough_peak_cut_, geo::kX, geo::kY, cafExposure::match, overlay_prestage_def::matches, rb::Cluster::NCell(), art::Event::put(), mono::Track_Match::score, slice_label_, track_matching_min_score_, track_min_hits_, and POTSpillRate::view.

96 {
97  //
98  // Extract Objects from the Event
99  //
101  e.getByLabel(slice_label_, mono_slices);
102 
104  find_hough_results(mono_slices, e, hough_label_);
105 
106 
107 
108  //
109  // Track the Monopoles
110  //
111  std::map<geo::View_t, std::vector<Track2D> > mono_tracks;
112  for (size_t n_slice = 0; n_slice != mono_slices->size(); ++n_slice)
113  {
114  if (!mono_slices->at(n_slice).IsNoise())
115  {
116  std::vector<art::Ptr<rb::HoughResult> > hough_results;
117  find_hough_results.get(n_slice, hough_results);
118  for (auto const& hough_result : hough_results)
119  {
120  unsigned n_peak = 0;
121  for (auto const& peak : hough_result->fPeak)
122  {
123  if (peak.fH > hough_peak_cut_)
124  {
125  geo::View_t view = hough_result->fView;
126  double slope = -9999;
127  double intercept = -9999;
128  hough_result->SlopeIcept(n_peak++, &slope, &intercept);
129 
130  Track2D mono_track(view, slope, intercept);
131  for (auto const& hit : mono_slices->at(n_slice).AllCells())
132  if (hit_is_on_track(hit, view, slope, intercept))
133  mono_track.cluster.Add(hit);
134  mono_tracks[view].push_back(mono_track);
135  }
136  }
137  }
138  }
139  }
140 
141 
142 
143  //
144  // Merge Tracks
145  //
146  std::vector<Track_Match> matches;
147  for (auto x_track = mono_tracks[geo::kX].begin();
148  x_track != mono_tracks[geo::kX].end(); ++x_track)
149  {
150  for (auto y_track = mono_tracks[geo::kY].begin();
151  y_track != mono_tracks[geo::kY].end(); ++y_track)
152  {
153  // for each x-hit, we need to see whether there is a matching y-hit
154  // let's count one point per match
155  // this can be encapsulated into a nice separate function
156  double score = 0.0;
157  for (auto const& x_hit : x_track->cluster.AllCells())
158  {
159  for (auto const& y_hit : y_track->cluster.AllCells())
160  {
161  if (abs(int(x_hit->Plane()) - int(y_hit->Plane())) <= 1)
162  score += 1;
163  }
164  }
165 
166  if (score >= track_matching_min_score_)
167  matches.emplace_back(x_track, y_track, score);
168  }
169  }
170 
171  std::sort(matches.begin(), matches.end(),
172  [](Track_Match const& lhs, Track_Match const& rhs)
173  { return lhs.score > rhs.score; });
174 
175  std::set<std::vector<Track2D>::const_iterator> already_matched_tracks;
176  std::vector<Track_Match> good_track_matches;
177  for (auto const& match : matches)
178  {
179  if (already_matched_tracks.find(match.x_track) ==
180  already_matched_tracks.end() &&
181  already_matched_tracks.find(match.y_track) ==
182  already_matched_tracks.end())
183  {
184  good_track_matches.push_back(match);
185  already_matched_tracks.insert(match.x_track);
186  already_matched_tracks.insert(match.y_track);
187  }
188  }
189 
190 
191 
192  //
193  // Add Objects to the Event
194  //
195  std::unique_ptr<std::vector<Track3D> >
196  tracks_3D(new std::vector<Track3D>);
197  for (auto const& good_match : good_track_matches)
198  {
199  // perhaps we can pass the iterators through to make things more efficient
200  Track3D track3D(*(good_match.x_track), *(good_match.y_track));
201 
202  if (track3D.cluster().NCell() >= track_min_hits_)
203  tracks_3D->push_back(track3D);
204  }
205 
206  std::sort(tracks_3D->begin(), tracks_3D->end(),
207  [](Track3D const& lhs, Track3D const& rhs)
208  { return lhs.beta() < rhs.beta(); });
209 
210  std::unique_ptr<std::vector<rb::Cluster> >
211  clusters_3D(new std::vector<rb::Cluster>);
212  for (auto const& track : *tracks_3D)
213  clusters_3D->push_back(track.cluster());
214 
215  e.put(std::move(clusters_3D));
216  e.put(std::move(tracks_3D));
217 
218  return true;
219 }
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Vertical planes which measure X.
Definition: PlaneGeo.h:28
Definition: event.h:19
void abs(TH1 *hist)
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Definition: structs.h:12
bool hit_is_on_track(art::Ptr< rb::CellHit > const &hit, geo::View_t view, double const &slope, double const &intercept) const
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::MonopoleTrack::hit_is_on_track ( art::Ptr< rb::CellHit > const &  hit,
geo::View_t  view,
double const &  slope,
double const &  intercept 
) const
private

Definition at line 224 of file MonopoleTrack_module.cc.

References rb::CellHit::Cell(), geo::GeometryBase::CellInfo(), DEFINE_ART_MODULE(), stan::math::fabs(), geometry_, kX, kY, rb::CellHit::Plane(), POTSpillRate::view, and rb::CellHit::View().

Referenced by filter().

226 {
227  if (hit->View() != view)
228  return false;
229 
230  double xyz[3];
231  geometry_->CellInfo(hit->Plane(), hit->Cell(), &view, xyz);
232  TVector3 hit_vector(xyz);
233 
234  double hit_position = -9999;
235  if (view == geo::View_t::kX)
236  hit_position = hit_vector.x();
237  else if (view == geo::View_t::kY)
238  hit_position = hit_vector.y();
239 
240  double track_position = slope * hit_vector.z() + intercept;
241  double distance_to_track = std::fabs(track_position - hit_position);
242 
243  if (distance_to_track > 20)
244  return false;
245 
246  return true;
247 }
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
unsigned short Plane() const
Definition: CellHit.h:39
geo::View_t View() const
Definition: CellHit.h:41
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;})
void CellInfo(unsigned int ip, unsigned int ic, View_t *view=0, double *pos=0, double *dpos=0) const
unsigned short Cell() const
Definition: CellHit.h:40
art::ServiceHandle< geo::Geometry > geometry_
Definition: geo.h:1
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
MonopoleTrack& mono::MonopoleTrack::operator= ( MonopoleTrack const &  )
delete
MonopoleTrack& mono::MonopoleTrack::operator= ( MonopoleTrack &&  )
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

constexpr bool art::EDFilter::Fail {false}
staticinherited

Definition at line 33 of file EDFilter.h.

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

art::ServiceHandle<geo::Geometry> mono::MonopoleTrack::geometry_
private

Definition at line 77 of file MonopoleTrack_module.cc.

Referenced by hit_is_on_track().

std::string mono::MonopoleTrack::hough_label_
private

Definition at line 71 of file MonopoleTrack_module.cc.

Referenced by filter().

double mono::MonopoleTrack::hough_peak_cut_
private

Definition at line 72 of file MonopoleTrack_module.cc.

Referenced by filter().

constexpr bool art::EDFilter::Pass {true}
staticinherited

Definition at line 32 of file EDFilter.h.

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

std::string mono::MonopoleTrack::slice_label_
private

Definition at line 73 of file MonopoleTrack_module.cc.

Referenced by filter().

double mono::MonopoleTrack::track_matching_min_score_
private

Definition at line 74 of file MonopoleTrack_module.cc.

Referenced by filter().

unsigned mono::MonopoleTrack::track_min_hits_
private

Definition at line 75 of file MonopoleTrack_module.cc.

Referenced by filter().


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