Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
lem::FindLEMMatches Class Reference

Module to find best LEM matches. More...

Inheritance diagram for lem::FindLEMMatches:
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

 FindLEMMatches (const fhicl::ParameterSet &pset)
 
 ~FindLEMMatches ()
 
virtual void reconfigure (const fhicl::ParameterSet &pset)
 
virtual void beginRun (art::Run &run)
 
virtual void produce (art::Event &evt)
 
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

void AddHists (std::vector< TH2F > *th2col, const Match &bestMatch, const EventSummary &trial, const EventSummary *head, bool headFlipEven, bool headFlipOdd) const
 
rb::Vertex MatchToVertex (const Match &match, int vtxPlane, int vtxCell, int vtxCellOther) const
 
CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Protected Attributes

FindMatchesAlgfAlg
 
std::string fInputLabel
 
bool fSaveEventImages
 
bool fSaveEventPotentials
 

Detailed Description

Module to find best LEM matches.

Definition at line 44 of file FindLEMMatches_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

lem::FindLEMMatches::FindLEMMatches ( const fhicl::ParameterSet pset)
explicit

Definition at line 70 of file FindLEMMatches_module.cc.

References fSaveEventImages, fSaveEventPotentials, and reconfigure().

71  {
72  reconfigure(pset);
73 
74  produces<std::vector<lem::MatchList> >();
75  // MatchLists are associated with the slice they are against
76  produces<art::Assns<lem::MatchList, rb::Cluster> >();
77 
78  produces<std::vector<lem::MatchIndices> >();
79  // MatchLists are associated with the slice they are against
80  produces<art::Assns<lem::MatchIndices, rb::Cluster> >();
81 
82  // True vertex of best match. Associate to slice
83  produces<std::vector<rb::Vertex> >();
84  produces<art::Assns<rb::Vertex, rb::Cluster> >();
85 
86  // Really should be file level, not run level, but don't know how to do
87  // that
88  produces<lem::LibrarySummary, art::InRun>();
89 
90  // Just to mark where the vertex is so you can check it's right
91  produces<std::vector<geo::OfflineChan> >();
92 
93  // Images of best match
95  produces<std::vector<TH2F> >();
96  }
virtual void reconfigure(const fhicl::ParameterSet &pset)
lem::FindLEMMatches::~FindLEMMatches ( )

Definition at line 99 of file FindLEMMatches_module.cc.

References fAlg.

100  {
101  delete fAlg;
102  }

Member Function Documentation

void lem::FindLEMMatches::AddHists ( std::vector< TH2F > *  th2col,
const Match bestMatch,
const EventSummary trial,
const EventSummary head,
bool  headFlipEven,
bool  headFlipOdd 
) const
protected

Definition at line 251 of file FindLEMMatches_module.cc.

References getBrightness::cell, lem::EventSummary::Description(), lem::Match::evt, lem::EventSummary::FillHists(), lem::FillPotential(), lem::Match::flipEven, lem::Match::flipOdd, fSaveEventImages, fSaveEventPotentials, NDAPDHVSetting::plane, string, and lem::Potential::V.

256  {
257  // Best
258  const EventSummary* bestEvt = bestMatch.evt;
259 
260  const std::string bestTitle = bestEvt->Description()+";Plane;Cell";
261 
262  if(fSaveEventImages){
263  TH2F evenBest("bestEven", bestTitle.c_str(), 64, 0, 128, 128, 64, 192);
264  TH2F oddBest ("bestOdd", bestTitle.c_str(), 64, 0, 128, 128, 64, 192);
265 
266  bestEvt->FillHists(&evenBest, &oddBest, bestMatch.flipEven, bestMatch.flipOdd);
267 
268  th2col->push_back(evenBest);
269  th2col->push_back(oddBest);
270  }
271 
273  TH2F hVsBest[2] = {TH2F("bestVEven", bestTitle.c_str(), 64, 0, 128, 128, 64, 192),
274  TH2F("bestVOdd", bestTitle.c_str(), 64, 0, 128, 128, 64, 192)};
275  Potential VBest;
276  FillPotential(*bestEvt, VBest, bestMatch.flipEven, bestMatch.flipOdd);
277  for(int plane = 0; plane < 256; ++plane){
278  for(int cell = 0; cell < 256; ++cell){
279  const double p = VBest.V[256*plane+cell];
280  hVsBest[plane%2].Fill(plane, cell, p);
281  }
282  }
283  th2col->push_back(hVsBest[0]);
284  th2col->push_back(hVsBest[1]);
285  }
286 
287 
288  // Head
289  if(head){
290  const char* headTitle = (head->Description()+";Plane;Cell").c_str();
291 
292  if(fSaveEventImages){
293  TH2F evenHead("headEven", headTitle, 64, 0, 128, 128, 64, 192);
294  TH2F oddHead ("headOdd", headTitle, 64, 0, 128, 128, 64, 192);
295 
296  head->FillHists(&evenHead, &oddHead, headFlipEven, headFlipOdd);
297 
298  th2col->push_back(evenHead);
299  th2col->push_back(oddHead);
300  }
301 
303  TH2F hVsHead[2] = {TH2F("headVEven", bestTitle.c_str(), 64, 0, 128, 128, 64, 192),
304  TH2F("headVOdd", bestTitle.c_str(), 64, 0, 128, 128, 64, 192)};
305  Potential VHead;
306  FillPotential(*head, VHead, headFlipEven, headFlipOdd);
307  for(int plane = 0; plane < 256; ++plane){
308  for(int cell = 0; cell < 256; ++cell){
309  const double p = VHead.V[256*plane+cell];
310  hVsHead[plane%2].Fill(plane, cell, p);
311  }
312  }
313  th2col->push_back(hVsHead[0]);
314  th2col->push_back(hVsHead[1]);
315  }
316  }
317 
318 
319  // Trial
320  const char* trialTitle = "Trial event;Plane;Cell";
321 
322  if(fSaveEventImages){
323  TH2F evenTrial("trialEven", trialTitle, 64, 0, 128, 128, 64, 192);
324  TH2F oddTrial ("trialOdd", trialTitle, 64, 0, 128, 128, 64, 192);
325 
326  trial.FillHists(&evenTrial, &oddTrial);
327 
328  th2col->push_back(evenTrial);
329  th2col->push_back(oddTrial);
330  }
331 
333  TH2F hVsTrial[2] = {TH2F("trialVEven", trialTitle, 64, 0, 128, 128, 64, 192),
334  TH2F("trialVOdd", trialTitle, 64, 0, 128, 128, 64, 192)};
335  Potential VTrial;
336  FillPotential(trial, VTrial, false, false);
337  for(int plane = 0; plane < 256; ++plane){
338  for(int cell = 0; cell < 256; ++cell){
339  const double p = VTrial.V[256*plane+cell];
340  hVsTrial[plane%2].Fill(plane, cell, p);
341  }
342  }
343  th2col->push_back(hVsTrial[0]);
344  th2col->push_back(hVsTrial[1]);
345  }
346  }
const char * p
Definition: xmltok.h:285
Eigen::Matrix< T, Eigen::Dynamic, 1 > head(const Eigen::Matrix< T, Eigen::Dynamic, 1 > &v, size_t n)
Definition: head.hpp:24
void FillPotential(const EventSummary &trial, Potential &V, bool flipEven, bool flipOdd)
Definition: FindMatches.cxx:76
enum BeamMode string
void lem::FindLEMMatches::beginRun ( art::Run run)
virtual

Reimplemented from art::EDProducer.

Definition at line 128 of file FindLEMMatches_module.cc.

References fAlg, lem::FindMatchesAlg::GetLibrary(), g4zmq::ls(), art::Run::put(), and lem::Library::Summary().

129  {
130  std::unique_ptr<lem::LibrarySummary> ls(new lem::LibrarySummary);
131  *ls = fAlg->GetLibrary()->Summary();
132  run.put(std::move(ls));
133  }
const LibrarySummary & Summary() const
Definition: Library.h:30
art::ProductID put(std::unique_ptr< PROD > &&)
Definition: Run.h:149
const Library * GetLibrary() const
Details of the library LEM matches were made against.
def ls(target="")
Definition: g4zmq.py:69
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  }
rb::Vertex lem::FindLEMMatches::MatchToVertex ( const Match match,
int  vtxPlane,
int  vtxCell,
int  vtxCellOther 
) const
protected

Definition at line 349 of file FindLEMMatches_module.cc.

References abs(), getBrightness::cell, geo::PlaneGeo::Cell(), DEFINE_ART_MODULE(), lem::Match::evt, geom(), geo::CellGeo::GetCenter(), geo::kPLANE_NOT_FOUND, lem::kVertexCell, lem::kVertexPlane, geo::kX, geo::kY, geo::PlaneGeo::Ncells(), geo::GeometryBase::NextPlaneOtherView(), geo::GeometryBase::NPlanes(), geo::GeometryBase::Plane(), NDAPDHVSetting::plane, lem::EventSummary::trueVtxCell, lem::EventSummary::trueVtxCellOther, lem::EventSummary::trueVtxPlane, registry_explorer::v, and geo::PlaneGeo::View().

352  {
354 
355  int plane = vtxPlane+match.evt->trueVtxPlane-kVertexPlane;
356 
357  if(plane < 0) plane = 0;
358  if(plane > int(geom->NPlanes())) plane = geom->NPlanes()-1;
359 
360  int cell, cellOther;
361  if(abs(match.evt->trueVtxPlane-kVertexPlane)%2 == 0){
362  cell = vtxCell+match.evt->trueVtxCell-kVertexCell;
363  cellOther = vtxCellOther+match.evt->trueVtxCellOther-kVertexCell;
364  }
365  else{
366  cell = vtxCellOther+match.evt->trueVtxCell-kVertexCell;
367  cellOther = vtxCell+match.evt->trueVtxCellOther-kVertexCell;
368  }
369 
370  int planeOther = 0;
371  if(geom->Plane(plane)){
372  geom->NextPlaneOtherView(plane, +1);
373  if(planeOther == geo::kPLANE_NOT_FOUND) planeOther = geom->NextPlaneOtherView(plane, -1);
374  }
375 
376  if(cell < 0) cell = 0;
377  if(cellOther < 0) cellOther = 0;
378  if(cell >= int(geom->Plane(plane)->Ncells())) cell = geom->Plane(plane)->Ncells()-1;
379  if(cellOther >= int(geom->Plane(planeOther)->Ncells())) cellOther = geom->Plane(planeOther)->Ncells()-1;
380 
381  double xyz[3];
382  geom->Plane(plane)->Cell(cell)->GetCenter(xyz);
383 
384  double xyz2[3];
385  geom->Plane(planeOther)->Cell(cellOther)->GetCenter(xyz2);
386 
387  const geo::View_t v = geom->Plane(plane)->View();
388 
389  return rb::Vertex((v == geo::kX) ? xyz[0] : xyz2[0],
390  (v == geo::kY) ? xyz[1] : xyz2[1],
391  xyz[2],
392  -1); // Don't bother to fill the time
393  }
A 3D position and time representing an interaction vertex.
Definition: Vertex.h:15
void GetCenter(double *xyz, double localz=0.0) const
Definition: CellGeo.cxx:159
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
Vertical planes which measure X.
Definition: PlaneGeo.h:28
unsigned int Ncells() const
Number of cells in this plane.
Definition: PlaneGeo.h:43
const int kVertexPlane
Definition: EventSummary.h:22
void abs(TH1 *hist)
const PlaneGeo * Plane(unsigned int i) const
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
const int kVertexCell
Definition: EventSummary.h:23
void geom(int which=0)
Definition: geom.C:163
unsigned int NPlanes() const
const unsigned int NextPlaneOtherView(unsigned int p, int d=+1) const
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 lem::FindLEMMatches::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 136 of file FindLEMMatches_module.cc.

References lem::EventSummary::ccnc, util::CreateAssn(), lem::Library::Event(), lem::EventSummary::event, art::Event::event(), fAlg, lem::FindMatchesAlg::FindMatches(), fInputLabel, PandAna.Demos.pi0_spectra::fmt, fSaveEventImages, fSaveEventPotentials, art::DataViewImpl::getByLabel(), lem::FindMatchesAlg::GetLibrary(), lem::LEMInput::hits, MECModelEnuComparisons::i, dumpEventsToText::inputs, lem::kMaxNumMatches, lem::MatchIndices::matches, lem::MatchList::matches, overlay_prestage_def::matches, lem::MatchIndices::matchesEnrich, lem::EventSummary::origPdg, lem::EventSummary::pdg, art::Event::put(), lem::EventSummary::run, art::Event::run(), lem::EventSummary::subrun, art::Event::subRun(), sum, lem::MatchList::trial, lem::EventSummary::trueEVis, and lem::EventSummary::y.

137  {
138  std::unique_ptr<std::vector<lem::MatchList> > matchcol(new std::vector<lem::MatchList>);
139  std::unique_ptr<std::vector<lem::MatchIndices>> matchidxs(new std::vector<lem::MatchIndices>);
140 
141  // Associate matches with the slice they came from
142  std::unique_ptr<art::Assns<lem::MatchList, rb::Cluster> > assns(new art::Assns<lem::MatchList, rb::Cluster>);
143  std::unique_ptr<art::Assns<lem::MatchIndices, rb::Cluster> > idxassns(new art::Assns<lem::MatchIndices, rb::Cluster>);
144 
145  std::unique_ptr<std::vector<rb::Vertex> > vtxcol(new std::vector<rb::Vertex>);
146  std::unique_ptr<art::Assns<rb::Vertex, rb::Cluster> > vtxassns(new art::Assns<rb::Vertex, rb::Cluster>);
147 
148  std::unique_ptr<std::vector<geo::OfflineChan> > chancol(new std::vector<geo::OfflineChan>);
149 
150  std::unique_ptr<std::vector<TH2F>> th2col(new std::vector<TH2F>);
151 
152 
154  evt.getByLabel(fInputLabel, inputs);
156 
157  const int inputMax = inputs->size();
158  for(int inputIdx = 0; inputIdx < inputMax; ++inputIdx){
159  const LEMInput& input = (*inputs)[inputIdx];
160 
161  EventSummary sum(input.hits, -1, std::vector<int>());
162 
163  sum.run = evt.run();
164  sum.subrun = evt.subRun();
165  sum.event = evt.event();
166 
167  sum.origPdg = 0;
168 
169  sum.pdg = 0;
170  sum.ccnc = 0;
171  sum.y = 0;
172  sum.trueEVis = 0;
173 
174 
175  // chancol->push_back(geo::OfflineChan(vtxPlane, vtxCell));
176  // Should really be nextPlane, but that's lost inside of Util.cxx. This
177  // is almost always right, and only for display purposes anyway.
178  // chancol->push_back(geo::OfflineChan(vtxPlane+1, vtxCellOther));
179 
180  MatchableEvent trial(sum);
181 
182  const std::vector<Match> matches = fAlg->FindMatches(trial, kMaxNumMatches, false);
183  const std::vector<Match> matchesEnrich = fAlg->FindMatches(trial, kMaxNumMatches, true);
184 
185 /*
186  if(!matches.empty()){
187  vtxcol->push_back(MatchToVertex(matches[0], vtxPlane, vtxCell, vtxCellOther));
188  vtxcol->back().SetT(slice.MinTNS());
189  util::CreateAssn(*this, evt, *vtxcol,
190  art::Ptr<rb::Cluster>(slices, sliceIdx), *vtxassns);
191  }
192 */
193 
194  // TODO TODO TODO
195 /*
196  if(!matches.empty()){
197  AddHists(th2col.get(), matches[0], sum,
198  (bestHead >= 0) ? &fLib->Event(fHeads->HeadIdx(bestHead)) : 0,
199  headFlipEven, headFlipOdd);
200  }
201 */
202 
203  matchcol->push_back(MatchList());
204  MatchList& ml = matchcol->back();
205 
206  matchidxs->push_back(MatchIndices());
207  MatchIndices& mi = matchidxs->back();
208  // TODO TODO TODO
209  // mi.headIdx = (bestHead >= 0) ? fHeads->HeadIdx(bestHead) : -1;
210 
211  for(unsigned int i = 0; i < matches.size(); ++i){
212  ml.matches.push_back(MatchSummary(matches[i]));
213  mi.matches.push_back(matches[i].evt - &fAlg->GetLibrary()->Event(0));
214  } // end for i
215 
216  for(unsigned int i = 0; i < matchesEnrich.size(); ++i){
217  ml.matches.push_back(MatchSummary(matchesEnrich[i]));
218  mi.matchesEnrich.push_back(matchesEnrich[i].evt - &fAlg->GetLibrary()->Event(0));
219  } // end for i
220 
221  ml.trial = MatchSummary(Match(0, &trial, false, false));
222 
223  // TODO TODO TODO
224  // ml.headIdx = (bestHead >= 0) ? fHeads->HeadIdx(bestHead) : -1;
225 
226  // If the original input hits were associated to a cluster, then so
227  // should our matches be.
228  try{
229  std::vector<art::Ptr<rb::Cluster>> slices = fmt.at(inputIdx);
230  if(slices.size() == 1){
231  util::CreateAssn(*this, evt, *matchcol, slices[0], *assns);
232  util::CreateAssn(*this, evt, *matchidxs, slices[0], *idxassns);
233  }
234  }
235  catch(...){
236  // ugh
237  }
238  } // end for sliceIdx
239 
240  evt.put(std::move(matchcol));
241  evt.put(std::move(assns));
242 
243  evt.put(std::move(vtxcol));
244  evt.put(std::move(vtxassns));
245 
246  evt.put(std::move(chancol));
247  if(fSaveEventImages || fSaveEventPotentials) evt.put(std::move(th2col));
248  }
SubRunNumber_t subRun() const
Definition: Event.h:72
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.
const unsigned int kMaxNumMatches
Definition: FindMatches.h:29
std::vector< Match > FindMatches(const MatchableEvent &trial, unsigned int numMatches, int enrich) const
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
const Library * GetLibrary() const
EventNumber_t event() const
Definition: Event.h:67
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
const MatchableEvent & Event(int i) const
Definition: Library.h:32
Double_t sum
Definition: plot.C:31
RunNumber_t run() const
Definition: Event.h:77
void lem::FindLEMMatches::reconfigure ( const fhicl::ParameterSet pset)
virtual

Definition at line 105 of file FindLEMMatches_module.cc.

References util::EnvExpansion(), fAlg, lem::EventSummary::fgChargePower, lem::EventSummary::fgDecayRate, fInputLabel, fSaveEventImages, fSaveEventPotentials, fhicl::ParameterSet::get(), lem::DistanceMap::SetCellScale(), lem::DistanceMap::SetDecayPower(), lem::DistanceMap::SetExpMode(), lem::DistanceMap::SetPlaneScale(), and string.

Referenced by FindLEMMatches().

106  {
107  fAlg = new FindMatchesAlg(util::EnvExpansion(pset.get<std::string>("LibraryPath")),
108  pset.get<bool>("PreloadLib"),
109  pset.get<bool>("UseHeads"));
110 
111  fInputLabel = pset.get<std::string>("InputLabel");
112 
113  // This needs to be before anyone asks the DistanceMap anything, should be
114  // safe enough here.
115  DistanceMap::SetPlaneScale(pset.get<double>("DistPlaneScale"));
116  DistanceMap::SetCellScale(pset.get<double>("DistCellScale"));
117  DistanceMap::SetDecayPower(pset.get<double>("DistDecayPower"));
118  DistanceMap::SetExpMode(pset.get<bool>("DistExpMode"));
119 
120  EventSummary::fgDecayRate = pset.get<double>("HitDecayRate");
121  EventSummary::fgChargePower = pset.get<double>("HitChargePower");
122 
123  fSaveEventImages = pset.get<bool>("SaveEventImages", true);
124  fSaveEventPotentials = pset.get<bool>("SaveEventPotentials", false);
125  }
static double fgChargePower
Definition: EventSummary.h:76
std::string EnvExpansion(const std::string &inString)
Function to expand environment variables.
Definition: EnvExpand.cxx:8
static void SetPlaneScale(double ps)
Must call before first call to Instance()
Definition: DistanceMap.h:32
T get(std::string const &key) const
Definition: ParameterSet.h:231
static void SetDecayPower(double dp)
Definition: DistanceMap.h:34
static void SetExpMode(bool em=true)
Definition: DistanceMap.h:35
static double fgDecayRate
Definition: EventSummary.h:75
static void SetCellScale(double cs)
Definition: DistanceMap.h:33
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

Member Data Documentation

FindMatchesAlg* lem::FindLEMMatches::fAlg
protected

Definition at line 62 of file FindLEMMatches_module.cc.

Referenced by beginRun(), produce(), reconfigure(), and ~FindLEMMatches().

std::string lem::FindLEMMatches::fInputLabel
protected

Definition at line 64 of file FindLEMMatches_module.cc.

Referenced by produce(), and reconfigure().

bool lem::FindLEMMatches::fSaveEventImages
protected

Definition at line 66 of file FindLEMMatches_module.cc.

Referenced by AddHists(), FindLEMMatches(), produce(), and reconfigure().

bool lem::FindLEMMatches::fSaveEventPotentials
protected

Definition at line 66 of file FindLEMMatches_module.cc.

Referenced by AddHists(), FindLEMMatches(), produce(), and reconfigure().


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