LEM_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \file LEM_module.cc
3 // \brief Module to find best LEM matches
4 // \author Christopher Backhouse - bckhouse@caltech.edu
5 ////////////////////////////////////////////////////////////////////////
6 
7 #include "LEM/func/DistanceMap.h"
8 #include "LEM/func/FindMatches.h"
9 #include "LEM/func/Heads.h"
10 #include "LEM/func/Library.h"
11 #include "LEM/func/MatchIndices.h"
12 #include "LEM/func/MatchList.h"
13 #include "LEM/func/OnDemand.h"
14 
15 #include "LEM/LEMInput.h"
16 #include "LEM/LEMLibraryService.h"
17 #include "LEM/Util.h"
18 
19 // ROOT includes
20 #include "TChain.h"
21 #include "TH2.h"
22 
23 // NOvASoft includes
25 #include "Geometry/Geometry.h"
26 #include "RecoBase/CellHit.h"
27 #include "RecoBase/Cluster.h"
28 #include "RecoBase/FilterList.h"
29 #include "RecoBase/Vertex.h"
30 #include "Utilities/AssociationUtil.h"
32 #include "Utilities/func/MathUtil.h"
33 
34 // Framework includes
42 #include "fhiclcpp/ParameterSet.h"
43 
44 /// \f$ \nu_e \f$ %PID
45 namespace lem
46 {
47  /// Module to find best %LEM matches
48  class LEM: public art::EDProducer
49  {
50  public:
51  explicit LEM(const fhicl::ParameterSet& pset);
52  ~LEM();
53 
54  virtual void reconfigure(const fhicl::ParameterSet& pset);
55  virtual void beginJob();
56  virtual void beginRun(art::Run& run);
57  virtual void produce(art::Event& evt);
58  virtual void endJob();
59  protected:
60  void AddHists(std::vector<TH2F>* th2col, const Match& bestMatch,
61  const EventSummary& trial,
62  const EventSummary* head,
63  bool headFlipEven, bool headFlipOdd) const;
64 
66  int vtxPlane, int vtxCell, int vtxCellOther) const;
67 
70 
72 
73  std::string fLibPath; ///< Directory to find the library files in
74  bool fUseDownsample; ///< Whether to use downsampling optimization
75  int fDownsampleFactor; ///< How many levels to take the downsampling optimization
76 
79 
82 
85 
87  };
88 
89  //......................................................................
92  fMMappedLoading(false), fPreloadLib(false), fPreloadHeads(false),
93  fLib(0), fHeads(0),
95  {
96  reconfigure(pset);
97 
98  produces<std::vector<lem::MatchList> >();
99  // MatchLists are associated with the slice they are against
100  produces<art::Assns<lem::MatchList, rb::Cluster> >();
101 
102  // produces<std::vector<lem::MatchIndices> >();
103  // MatchLists are associated with the slice they are against
104  // produces<art::Assns<lem::MatchIndices, rb::Cluster> >();
105 
106  // True vertex of best match. Associate to slice
107  produces<std::vector<rb::Vertex> >();
108  produces<art::Assns<rb::Vertex, rb::Cluster> >();
109 
110  // Really should be file level, not run level, but don't know how to do
111  // that
112  produces<lem::LibrarySummary, art::InRun>();
113 
114  // Just to mark where the vertex is so you can check it's right
115  produces<std::vector<geo::OfflineChan> >();
116 
117  // Images of best match
119  produces<std::vector<TH2F> >();
120  }
121 
122  //......................................................................
124  {
125  if(!fUseLibraryService){
126  delete fLib;
127  delete fHeads;
128  }
129  }
130 
131  //......................................................................
133  {
134  fUseLibraryService = pset.get<bool>("UseLibraryService", false);
135 
136  std::string libpath = pset.get<std::string>("LibraryPath");
137  fLibPath = util::EnvExpansion(libpath);
138 
139  fUseDownsample = pset.get<bool>("UseDownsample");
140  fDownsampleFactor = pset.get<int>("DownsampleFactor");
141 
142  fInputLabel = pset.get<std::string>("InputLabel");
143  fInputInstance = pset.get<std::string>("InputInstance");
144 
145  // This needs to be before anyone asks the DistanceMap anything, should be
146  // safe enough here.
147  DistanceMap::SetPlaneScale(pset.get<double>("DistPlaneScale"));
148  DistanceMap::SetCellScale(pset.get<double>("DistCellScale"));
149  DistanceMap::SetDecayPower(pset.get<double>("DistDecayPower"));
150  DistanceMap::SetExpMode(pset.get<bool>("DistExpMode"));
151 
152  EventSummary::fgDecayRate = pset.get<double>("HitDecayRate");
153  EventSummary::fgChargePower = pset.get<double>("HitChargePower");
154 
155  fSplitLibFactor = pset.get<int>("SplitLibFactor");
156  fSplitLibIndex = pset.get<int>("SplitLibIndex");
157 
158  fMMappedLoading = pset.get<bool>("MMappedLoading");
159  SetOnDemandMemoryLimit(pset.get<int>("LibraryMemoryLimit"));
160  fOnDemand = (pset.get<int>("LibraryMemoryLimit") > 0);
161  fPreloadLib = pset.get<bool>("PreloadLib");
162  fPreloadHeads = pset.get<bool>("PreloadHeads");
163 
164  fSaveEventImages = pset.get<bool>("SaveEventImages", true);
165  fSaveEventPotentials = pset.get<bool>("SaveEventPotentials", false);
166  }
167 
168  //......................................................................
170  {
171  if(fUseLibraryService) return;
172 
173  if(fMMappedLoading){
174  if(fOnDemand){
177  }
178  else{
181  }
182  }
183  else{
187  fHeads = 0;
188  }
189  }
190 
191  //......................................................................
192  void LEM::endJob()
193  {
194  }
195 
196  //......................................................................
198  {
199  std::unique_ptr<lem::LibrarySummary> ls(new lem::LibrarySummary);
200  if(fUseLibraryService){
202  *ls = libserv->GetLib()->Summary();
203  }
204  else{
205  *ls = fLib->Summary();
206  }
207  run.put(std::move(ls));
208  }
209 
210  //......................................................................
212  {
213  std::unique_ptr<std::vector<lem::MatchList> > matchcol(new std::vector<lem::MatchList>);
214  std::unique_ptr<std::vector<lem::MatchIndices>> matchidxs(new std::vector<lem::MatchIndices>);
215 
216  // Associate matches with the slice they came from
217  std::unique_ptr<art::Assns<lem::MatchList, rb::Cluster> > assns(new art::Assns<lem::MatchList, rb::Cluster>);
218  std::unique_ptr<art::Assns<lem::MatchIndices, rb::Cluster> > idxassns(new art::Assns<lem::MatchIndices, rb::Cluster>);
219 
220  std::unique_ptr<std::vector<rb::Vertex> > vtxcol(new std::vector<rb::Vertex>);
221  std::unique_ptr<art::Assns<rb::Vertex, rb::Cluster> > vtxassns(new art::Assns<rb::Vertex, rb::Cluster>);
222 
223  std::unique_ptr<std::vector<geo::OfflineChan> > chancol(new std::vector<geo::OfflineChan>);
224 
225  std::unique_ptr<std::vector<TH2F>> th2col(new std::vector<TH2F>);
226 
227 
230  if(!fInputInstance.empty() && inputs.failedToGet()){
231  evt.put(std::move(matchcol));
232  evt.put(std::move(assns));
233 
234  evt.put(std::move(vtxcol));
235  evt.put(std::move(vtxassns));
236 
237  evt.put(std::move(chancol));
238  if(fSaveEventImages || fSaveEventPotentials) evt.put(std::move(th2col));
239  return;
240  }
241 
243 
244  const Library* lib = fLib;
245  const Heads* heads = fHeads;
246  if(fUseLibraryService){
248  lib = libserv->GetLib();
249  heads = libserv->GetHeads();
250  }
251 
252  const int inputMax = inputs->size();
253  for(int inputIdx = 0; inputIdx < inputMax; ++inputIdx){
254  const LEMInput& input = (*inputs)[inputIdx];
255 
256  EventSummary sum(input.hits, -1, std::vector<int>());
257 
258  sum.run = evt.run();
259  sum.subrun = evt.subRun();
260  sum.event = evt.event();
261 
262  sum.origPdg = 0;
263 
264  sum.pdg = 0;
265  sum.ccnc = 0;
266  sum.y = 0;
267  sum.trueEVis = 0;
268 
269 
270  // chancol->push_back(geo::OfflineChan(vtxPlane, vtxCell));
271  // Should really be nextPlane, but that's lost inside of Util.cxx. This
272  // is almost always right, and only for display purposes anyway.
273  // chancol->push_back(geo::OfflineChan(vtxPlane+1, vtxCellOther));
274 
275  // PID calculation starts around here
276 
277  MatchableEvent trial(sum);
278 
279  std::vector<art::Handle<std::vector<lem::MatchList>>> prevmatchcol;
280 
281  evt.getManyByType(prevmatchcol);
282 
283  std::multiset<float> already;
284  for(unsigned int i = 0; i < prevmatchcol.size(); ++i){
285  // This isn't the same as sliceIdx, because we could have skipped
286  // slices for failing preselection.
287  const unsigned int colIdx = matchcol->size();
288  assert(colIdx < (*prevmatchcol[i]).size());
289 
290  for(unsigned int j = 0; j < (*prevmatchcol[i])[colIdx].matches.size(); ++j){
291  already.insert((*prevmatchcol[i])[colIdx].matches[j].potential);
292  }
293  }
294 
295 
296  int bestHead = -1;
297  bool headFlipEven = false;
298  bool headFlipOdd = false;
299  if(heads){
300  // TODO: consolidate potential-filling with FindMatches
302  FillPotential(trial, Vs);
303  float bestE = FLT_MAX;
304  const int nHeads = heads->NHeads();
305  for(int iHead = 0; iHead < nHeads; ++iHead){
306  const MatchableEvent& headEvt = lib->Event(heads->HeadIdx(iHead));
307 
308  for(int flipEven = 0; flipEven < 2; ++flipEven){
309  for(int flipOdd = 0; flipOdd < 2; ++flipOdd){
310  const float E = CalcEnergy(Vs.V[flipEven][flipOdd], trial, headEvt);
311  if(E < bestE){
312  bestE = E;
313  bestHead = iHead;
314  headFlipEven = flipEven;
315  headFlipOdd = flipOdd;
316  }
317  }
318  }
319  }
320  assert(bestHead >= 0);
321  // Don't bother to PID slices with extremely poor matching to any
322  // head. Flag it here.
323 
324  if(bestE > 2*trial.selfEnergy) bestHead = -1;
325  }
326 
327  std::vector<Match> matches, matchesEnrich;
328 
329  if(!heads || bestHead >= 0){
330  matches =
331  FindMatches(trial,
332  lib->NEvents(), lib->Events(), lib->DownsampledEvents(),
333  fDownsampleFactor, already, kMaxNumMatches, false,
334  heads, heads ? bestHead : -1, headFlipEven, headFlipOdd,
336 
337  matchesEnrich =
338  FindMatches(trial,
339  lib->NEvents(), lib->Events(), lib->DownsampledEvents(),
340  fDownsampleFactor, already, kMaxNumMatches, true,
341  heads, heads ? bestHead : -1, headFlipEven, headFlipOdd,
343  }
344 
345 /*
346  if(!matches.empty()){
347  vtxcol->push_back(MatchToVertex(matches[0], vtxPlane, vtxCell, vtxCellOther));
348  vtxcol->back().SetT(slice.MinTNS());
349  util::CreateAssn(*this, evt, *vtxcol,
350  art::Ptr<rb::Cluster>(slices, sliceIdx), *vtxassns);
351  }
352 */
353 
354  if(!matches.empty()){
355  AddHists(th2col.get(), matches[0], sum,
356  (bestHead >= 0) ? &lib->Event(heads->HeadIdx(bestHead)) : 0,
357  headFlipEven, headFlipOdd);
358  }
359 
360  matchcol->push_back(MatchList());
361  MatchList& ml = matchcol->back();
362 
363  matchidxs->push_back(MatchIndices());
364  MatchIndices& mi = matchidxs->back();
365  mi.headIdx = (bestHead >= 0) ? heads->HeadIdx(bestHead) : -1;
366 
367  for(unsigned int i = 0; i < matches.size(); ++i){
368  ml.matches.push_back(MatchSummary(matches[i]));
369  mi.matches.push_back(matches[i].evt-&lib->Event(0));
370  } // end for i
371 
372  for(unsigned int i = 0; i < matchesEnrich.size(); ++i){
373  ml.matches.push_back(MatchSummary(matchesEnrich[i]));
374  mi.matchesEnrich.push_back(matchesEnrich[i].evt-&lib->Event(0));
375  } // end for i
376 
377  ml.trial = MatchSummary(Match(0, &trial, false, false));
378 
379  ml.headIdx = (bestHead >= 0) ? heads->HeadIdx(bestHead) : -1;
380 
381  // If the original input hits were associated to a cluster, then so
382  // should our matches be.
383  try{
384  std::vector<art::Ptr<rb::Cluster>> slices = fmt.at(inputIdx);
385  if(slices.size() == 1){
386  util::CreateAssn(*this, evt, *matchcol, slices[0], *assns);
387  // util::CreateAssn(*this, evt, *matchidxs, slices[0], *idxassns);
388  }
389  }
390  catch(...){
391  // ugh
392  }
393  } // end for sliceIdx
394 
395  evt.put(std::move(matchcol));
396  evt.put(std::move(assns));
397 
398  evt.put(std::move(vtxcol));
399  evt.put(std::move(vtxassns));
400 
401  evt.put(std::move(chancol));
402  if(fSaveEventImages || fSaveEventPotentials) evt.put(std::move(th2col));
403  }
404 
405  //......................................................................
406  void LEM::AddHists(std::vector<TH2F>* th2col,
407  const Match& bestMatch,
408  const EventSummary& trial,
409  const EventSummary* head,
410  bool headFlipEven, bool headFlipOdd) const
411  {
412  // Best
413  const EventSummary* bestEvt = bestMatch.evt;
414 
415  const std::string bestTitle = bestEvt->Description()+";Plane;Cell";
416 
417  if(fSaveEventImages){
418  TH2F evenBest("bestEven", bestTitle.c_str(), 64, 0, 128, 128, 64, 192);
419  TH2F oddBest ("bestOdd", bestTitle.c_str(), 64, 0, 128, 128, 64, 192);
420 
421  bestEvt->FillHists(&evenBest, &oddBest, bestMatch.flipEven, bestMatch.flipOdd);
422 
423  th2col->push_back(evenBest);
424  th2col->push_back(oddBest);
425  }
426 
428  TH2F hVsBest[2] = {TH2F("bestVEven", bestTitle.c_str(), 64, 0, 128, 128, 64, 192),
429  TH2F("bestVOdd", bestTitle.c_str(), 64, 0, 128, 128, 64, 192)};
430  Potential VBest;
431  FillPotential(*bestEvt, VBest, bestMatch.flipEven, bestMatch.flipOdd);
432  for(int plane = 0; plane < 256; ++plane){
433  for(int cell = 0; cell < 256; ++cell){
434  const double p = VBest.V[256*plane+cell];
435  hVsBest[plane%2].Fill(plane, cell, p);
436  }
437  }
438  th2col->push_back(hVsBest[0]);
439  th2col->push_back(hVsBest[1]);
440  }
441 
442 
443  // Head
444  if(fHeads && head){
445  const char* headTitle = (head->Description()+";Plane;Cell").c_str();
446 
447  if(fSaveEventImages){
448  TH2F evenHead("headEven", headTitle, 64, 0, 128, 128, 64, 192);
449  TH2F oddHead ("headOdd", headTitle, 64, 0, 128, 128, 64, 192);
450 
451  head->FillHists(&evenHead, &oddHead, headFlipEven, headFlipOdd);
452 
453  th2col->push_back(evenHead);
454  th2col->push_back(oddHead);
455  }
456 
458  TH2F hVsHead[2] = {TH2F("headVEven", bestTitle.c_str(), 64, 0, 128, 128, 64, 192),
459  TH2F("headVOdd", bestTitle.c_str(), 64, 0, 128, 128, 64, 192)};
460  Potential VHead;
461  FillPotential(*head, VHead, headFlipEven, headFlipOdd);
462  for(int plane = 0; plane < 256; ++plane){
463  for(int cell = 0; cell < 256; ++cell){
464  const double p = VHead.V[256*plane+cell];
465  hVsHead[plane%2].Fill(plane, cell, p);
466  }
467  }
468  th2col->push_back(hVsHead[0]);
469  th2col->push_back(hVsHead[1]);
470  }
471  }
472 
473 
474  // Trial
475  const char* trialTitle = "Trial event;Plane;Cell";
476 
477  if(fSaveEventImages){
478  TH2F evenTrial("trialEven", trialTitle, 64, 0, 128, 128, 64, 192);
479  TH2F oddTrial ("trialOdd", trialTitle, 64, 0, 128, 128, 64, 192);
480 
481  trial.FillHists(&evenTrial, &oddTrial);
482 
483  th2col->push_back(evenTrial);
484  th2col->push_back(oddTrial);
485  }
486 
488  TH2F hVsTrial[2] = {TH2F("trialVEven", trialTitle, 64, 0, 128, 128, 64, 192),
489  TH2F("trialVOdd", trialTitle, 64, 0, 128, 128, 64, 192)};
490  Potential VTrial;
491  FillPotential(trial, VTrial, false, false);
492  for(int plane = 0; plane < 256; ++plane){
493  for(int cell = 0; cell < 256; ++cell){
494  const double p = VTrial.V[256*plane+cell];
495  hVsTrial[plane%2].Fill(plane, cell, p);
496  }
497  }
498  th2col->push_back(hVsTrial[0]);
499  th2col->push_back(hVsTrial[1]);
500  }
501  }
502 
503  //......................................................................
505  int vtxPlane, int vtxCell, int vtxCellOther) const
506  {
508 
509  int plane = vtxPlane+match.evt->trueVtxPlane-kVertexPlane;
510 
511  if(plane < 0) plane = 0;
512  if(plane > int(geom->NPlanes())) plane = geom->NPlanes()-1;
513 
514  int cell, cellOther;
515  if(abs(match.evt->trueVtxPlane-kVertexPlane)%2 == 0){
516  cell = vtxCell+match.evt->trueVtxCell-kVertexCell;
517  cellOther = vtxCellOther+match.evt->trueVtxCellOther-kVertexCell;
518  }
519  else{
520  cell = vtxCellOther+match.evt->trueVtxCell-kVertexCell;
521  cellOther = vtxCell+match.evt->trueVtxCellOther-kVertexCell;
522  }
523 
524  int planeOther = 0;
525  if(geom->Plane(plane)){
526  geom->NextPlaneOtherView(plane, +1);
527  if(planeOther == geo::kPLANE_NOT_FOUND) planeOther = geom->NextPlaneOtherView(plane, -1);
528  }
529 
530  if(cell < 0) cell = 0;
531  if(cellOther < 0) cellOther = 0;
532  if(cell >= int(geom->Plane(plane)->Ncells())) cell = geom->Plane(plane)->Ncells()-1;
533  if(cellOther >= int(geom->Plane(planeOther)->Ncells())) cellOther = geom->Plane(planeOther)->Ncells()-1;
534 
535  double xyz[3];
536  geom->Plane(plane)->Cell(cell)->GetCenter(xyz);
537 
538  double xyz2[3];
539  geom->Plane(planeOther)->Cell(cellOther)->GetCenter(xyz2);
540 
541  const geo::View_t v = geom->Plane(plane)->View();
542 
543  return rb::Vertex((v == geo::kX) ? xyz[0] : xyz2[0],
544  (v == geo::kY) ? xyz[1] : xyz2[1],
545  xyz[2],
546  -1); // Don't bother to fill the time
547  }
548 
550 
551 } //namespace lem
552 ////////////////////////////////////////////////////////////////////////
std::string Description() const
bool fPreloadLib
Definition: LEM_module.cc:78
A 3D position and time representing an interaction vertex.
Definition: Vertex.h:15
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.
std::vector< MatchSummary > matches
Definition: MatchList.h:24
bool fUseDownsample
Whether to use downsampling optimization.
Definition: LEM_module.cc:74
Simple representation of event for LEM use.
Definition: EventSummary.h:26
static double fgChargePower
Definition: EventSummary.h:76
float CalcEnergy(const Potential &Va, const MatchableEvent &a, const MatchableEvent &b)
Definition: FindMatches.cxx:21
const MatchableEvent * Events() const
Definition: Library.h:34
std::vector< int > matches
Definition: MatchIndices.h:19
void GetCenter(double *xyz, double localz=0.0) const
Definition: CellGeo.cxx:159
Attach some information used in matching to an EventSummary.
std::string fLibPath
Directory to find the library files in.
Definition: LEM_module.cc:73
const unsigned int kMaxNumMatches
Definition: FindMatches.h:29
static Heads * FromMMapOnDemand(const std::string &libPath)
Definition: Heads.cxx:49
Map of electrostatic potential at each cell.
Definition: Potential.h:13
bool fUseLibraryService
Definition: LEM_module.cc:71
Collection of events for matching.
virtual void produce(art::Event &evt)
Definition: LEM_module.cc:211
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Collection of events for matching.
Definition: Library.h:18
bool fPreloadHeads
Definition: LEM_module.cc:78
const MatchableEvent * evt
Definition: Match.h:26
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
const char * p
Definition: xmltok.h:285
bool flipOdd
Definition: Match.h:27
std::string EnvExpansion(const std::string &inString)
Function to expand environment variables.
Definition: EnvExpand.cxx:8
Vertical planes which measure X.
Definition: PlaneGeo.h:28
unsigned int Ncells() const
Number of cells in this plane.
Definition: PlaneGeo.h:43
const LibrarySummary & Summary() const
Definition: Library.h:30
const int kVertexPlane
Definition: EventSummary.h:22
std::vector< int > matchesEnrich
Definition: MatchIndices.h:20
int fDownsampleFactor
How many levels to take the downsampling optimization.
Definition: LEM_module.cc:75
void abs(TH1 *hist)
virtual void endJob()
Definition: LEM_module.cc:192
const PlaneGeo * Plane(unsigned int i) const
void AddHists(std::vector< TH2F > *th2col, const Match &bestMatch, const EventSummary &trial, const EventSummary *head, bool headFlipEven, bool headFlipOdd) const
Definition: LEM_module.cc:406
art::ProductID put(std::unique_ptr< PROD > &&)
Definition: Run.h:149
DEFINE_ART_MODULE(TestTMapFile)
bool fSaveEventPotentials
Definition: LEM_module.cc:86
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
Mapping from a subset of the library to their best matches.
Eigen::Matrix< T, Eigen::Dynamic, 1 > head(const Eigen::Matrix< T, Eigen::Dynamic, 1 > &v, size_t n)
Definition: head.hpp:24
Definition: Run.h:31
Collection of MatchSummary objects.
bool fOnDemand
Definition: LEM_module.cc:77
const MatchableEvent * DownsampledEvents() const
Definition: Library.h:35
Definition: __init__.py:1
PID
Definition: FillPIDs.h:14
Core of the LEM match-finding algorithm.
Potential V[2][2]
Definition: FindMatches.h:23
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
std::vector< Match > FindMatches(const MatchableEvent &trial, unsigned int libSize, const MatchableEvent *lib, const MatchableEvent *libDownsample, int factor, const std::multiset< float > &alreadyInput, unsigned int numMatches, int enrich, const Heads *heads, int headIdx, bool flipHeadEven, bool flipHeadOdd, bool useDownsample)
int fSplitLibFactor
Definition: LEM_module.cc:83
Simplified Match information, suitable for serialization.
Definition: MatchSummary.h:16
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
static void SetPlaneScale(double ps)
Must call before first call to Instance()
Definition: DistanceMap.h:32
Collection of MatchSummary objects.
Definition: MatchList.h:17
int fSplitLibIndex
Definition: LEM_module.cc:84
Float_t E
Definition: plot.C:20
Module to find best LEM matches.
Definition: LEM_module.cc:48
const int kVertexCell
Definition: EventSummary.h:23
unsigned int NEvents() const
Definition: Library.h:31
T get(std::string const &key) const
Definition: ParameterSet.h:231
bool fSaveEventImages
Definition: LEM_module.cc:86
Mapping from a subset of the library to their best matches.
Definition: Heads.h:16
static void SetDecayPower(double dp)
Definition: DistanceMap.h:34
void getManyByType(std::vector< Handle< PROD >> &results) const
Definition: DataViewImpl.h:446
virtual void beginJob()
Definition: LEM_module.cc:169
virtual void reconfigure(const fhicl::ParameterSet &pset)
Definition: LEM_module.cc:132
const double j
Definition: BetheBloch.cxx:29
LEM(const fhicl::ParameterSet &pset)
Definition: LEM_module.cc:90
Information about a LEM match.
Definition: Match.h:17
EventNumber_t event() const
Definition: Event.h:67
Details of the library LEM matches were made against.
Vertex location in position and time.
Heads * fHeads
Definition: LEM_module.cc:81
int NHeads() const
Definition: Heads.h:26
Definition: run.py:1
Utilities for mapping in library files on-demand.
void FillPotential(const EventSummary &trial, Potential &V, bool flipEven, bool flipOdd)
Definition: FindMatches.cxx:76
void SetOnDemandMemoryLimit(long limit_mb)
Definition: OnDemand.cxx:117
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
const Heads * GetHeads() const
const Library * GetLib() const
std::string fInputInstance
Definition: LEM_module.cc:69
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
static void SetExpMode(bool em=true)
Definition: DistanceMap.h:35
static Library * FromMMapOnDemand(const std::string &libPath)
Definition: Library.cxx:82
std::vector< LiteHit > hits
Definition: LEMInput.h:14
bool fMMappedLoading
Definition: LEM_module.cc:77
static Library * FromTrees(const std::string &libPath, int splitLibFactor, int splitLibIndex, int downsampleFactor)
Definition: Library.cxx:100
virtual void beginRun(art::Run &run)
Definition: LEM_module.cc:197
void geom(int which=0)
Definition: geom.C:163
const MatchableEvent & Event(int i) const
Definition: Library.h:32
static double fgDecayRate
Definition: EventSummary.h:75
static void SetCellScale(double cs)
Definition: DistanceMap.h:33
assert(nhit_max >=nhit_nbins)
Collection of Potential objects with odd and/or even view flipped.
Definition: FindMatches.h:21
def ls(target="")
Definition: g4zmq.py:69
MatchSummary trial
Definition: MatchList.h:25
static Heads * FromMMap(const std::string &libPath, bool touchAll)
Definition: Heads.cxx:23
Library * fLib
Definition: LEM_module.cc:80
static Library * FromMMap(const std::string &libPath, bool touchAll)
Definition: Library.cxx:62
unsigned int NPlanes() const
Double_t sum
Definition: plot.C:31
Calculate and cache electrostatic potential between cells.
RunNumber_t run() const
Definition: Event.h:77
bool flipEven
Definition: Match.h:27
List of indices of matched events.
float V[256 *256]
Definition: Potential.h:18
void FillHists(TH2 *h1, TH2 *h2, bool flipEven=false, bool flipOdd=false, bool idxs=false) const
Encapsulate the geometry of one entire detector (near, far, ndos)
int HeadIdx(int i) const
Definition: Heads.h:27
bool failedToGet() const
Definition: Handle.h:196
List of indices of matched events.
Definition: MatchIndices.h:15
const unsigned int NextPlaneOtherView(unsigned int p, int d=+1) const
rb::Vertex MatchToVertex(const Match &match, int vtxPlane, int vtxCell, int vtxCellOther) const
Definition: LEM_module.cc:504
std::string fInputLabel
Definition: LEM_module.cc:68