26 #include "Utilities/AssociationUtil.h" 28 #include "Utilities/func/MathUtil.h" 54 void AddHists(std::vector<TH2F>* th2col,
const Match& bestMatch,
57 bool headFlipEven,
bool headFlipOdd)
const;
60 int vtxPlane,
int vtxCell,
int vtxCellOther)
const;
74 produces<std::vector<lem::MatchList> >();
76 produces<art::Assns<lem::MatchList, rb::Cluster> >();
78 produces<std::vector<lem::MatchIndices> >();
80 produces<art::Assns<lem::MatchIndices, rb::Cluster> >();
83 produces<std::vector<rb::Vertex> >();
84 produces<art::Assns<rb::Vertex, rb::Cluster> >();
88 produces<lem::LibrarySummary, art::InRun>();
91 produces<std::vector<geo::OfflineChan> >();
95 produces<std::vector<TH2F> >();
108 pset.
get<
bool>(
"PreloadLib"),
109 pset.
get<
bool>(
"UseHeads"));
132 run.
put(std::move(ls));
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>);
145 std::unique_ptr<std::vector<rb::Vertex> > vtxcol(
new std::vector<rb::Vertex>);
148 std::unique_ptr<std::vector<geo::OfflineChan> > chancol(
new std::vector<geo::OfflineChan>);
150 std::unique_ptr<std::vector<TH2F>> th2col(
new std::vector<TH2F>);
157 const int inputMax = inputs->size();
158 for(
int inputIdx = 0; inputIdx < inputMax; ++inputIdx){
159 const LEMInput& input = (*inputs)[inputIdx];
211 for(
unsigned int i = 0;
i < matches.size(); ++
i){
216 for(
unsigned int i = 0;
i < matchesEnrich.size(); ++
i){
229 std::vector<art::Ptr<rb::Cluster>> slices = fmt.at(inputIdx);
230 if(slices.size() == 1){
240 evt.
put(std::move(matchcol));
241 evt.
put(std::move(assns));
243 evt.
put(std::move(vtxcol));
244 evt.
put(std::move(vtxassns));
246 evt.
put(std::move(chancol));
252 const Match& bestMatch,
255 bool headFlipEven,
bool headFlipOdd)
const 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);
268 th2col->push_back(evenBest);
269 th2col->push_back(oddBest);
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)};
283 th2col->push_back(hVsBest[0]);
284 th2col->push_back(hVsBest[1]);
290 const char* headTitle = (head->
Description()+
";Plane;Cell").c_str();
293 TH2F evenHead(
"headEven", headTitle, 64, 0, 128, 128, 64, 192);
294 TH2F oddHead (
"headOdd", headTitle, 64, 0, 128, 128, 64, 192);
296 head->
FillHists(&evenHead, &oddHead, headFlipEven, headFlipOdd);
298 th2col->push_back(evenHead);
299 th2col->push_back(oddHead);
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)};
313 th2col->push_back(hVsHead[0]);
314 th2col->push_back(hVsHead[1]);
320 const char* trialTitle =
"Trial event;Plane;Cell";
323 TH2F evenTrial(
"trialEven", trialTitle, 64, 0, 128, 128, 64, 192);
324 TH2F oddTrial (
"trialOdd", trialTitle, 64, 0, 128, 128, 64, 192);
328 th2col->push_back(evenTrial);
329 th2col->push_back(oddTrial);
333 TH2F hVsTrial[2] = {TH2F(
"trialVEven", trialTitle, 64, 0, 128, 128, 64, 192),
334 TH2F(
"trialVOdd", trialTitle, 64, 0, 128, 128, 64, 192)};
343 th2col->push_back(hVsTrial[0]);
344 th2col->push_back(hVsTrial[1]);
350 int vtxPlane,
int vtxCell,
351 int vtxCellOther)
const 357 if(plane < 0) plane = 0;
371 if(geom->
Plane(plane)){
376 if(cell < 0) cell = 0;
377 if(cellOther < 0) cellOther = 0;
390 (v ==
geo::kY) ? xyz[1] : xyz2[1],
virtual void reconfigure(const fhicl::ParameterSet &pset)
std::string Description() const
A 3D position and time representing an interaction vertex.
SubRunNumber_t subRun() const
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
virtual void beginRun(art::Run &run)
Simple representation of event for LEM use.
static double fgChargePower
std::vector< int > matches
void GetCenter(double *xyz, double localz=0.0) const
Attach some information used in matching to an EventSummary.
const unsigned int kMaxNumMatches
Map of electrostatic potential at each cell.
Collection of events for matching.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
rb::Vertex MatchToVertex(const Match &match, int vtxPlane, int vtxCell, int vtxCellOther) const
const MatchableEvent * evt
const CellGeo * Cell(int icell) const
std::string EnvExpansion(const std::string &inString)
Function to expand environment variables.
Vertical planes which measure X.
unsigned int Ncells() const
Number of cells in this plane.
const LibrarySummary & Summary() const
std::vector< int > matchesEnrich
void AddHists(std::vector< TH2F > *th2col, const Match &bestMatch, const EventSummary &trial, const EventSummary *head, bool headFlipEven, bool headFlipOdd) const
std::vector< Match > FindMatches(const MatchableEvent &trial, unsigned int numMatches, int enrich) const
const PlaneGeo * Plane(unsigned int i) const
art::ProductID put(std::unique_ptr< PROD > &&)
DEFINE_ART_MODULE(TestTMapFile)
Horizontal planes which measure Y.
Eigen::Matrix< T, Eigen::Dynamic, 1 > head(const Eigen::Matrix< T, Eigen::Dynamic, 1 > &v, size_t n)
Collection of MatchSummary objects.
ProductID put(std::unique_ptr< PROD > &&product)
Simplified Match information, suitable for serialization.
View_t View() const
Which coordinate does this plane measure.
static void SetPlaneScale(double ps)
Must call before first call to Instance()
Collection of MatchSummary objects.
bool fSaveEventPotentials
const Library * GetLibrary() const
T get(std::string const &key) const
static void SetDecayPower(double dp)
Information about a LEM match.
EventNumber_t event() const
Details of the library LEM matches were made against.
virtual void produce(art::Event &evt)
Vertex location in position and time.
void FillPotential(const EventSummary &trial, Potential &V, bool flipEven, bool flipOdd)
Module to find best LEM matches.
FindLEMMatches(const fhicl::ParameterSet &pset)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
static void SetExpMode(bool em=true)
const MatchableEvent & Event(int i) const
static double fgDecayRate
static void SetCellScale(double cs)
unsigned int NPlanes() const
Calculate and cache electrostatic potential between cells.
List of indices of matched events.
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)
List of indices of matched events.
const unsigned int NextPlaneOtherView(unsigned int p, int d=+1) const