27 #include "Utilities/AssociationUtil.h" 89 produces< std::vector <rb::Shower> >();
90 produces< art::Assns <rb::Shower, rb::Cluster> >();
91 produces< art::Assns <rb::Shower, rb::Prong> >();
148 std::unique_ptr< std::vector< rb::Shower > >
149 reclustCol(
new std::vector< rb::Shower > );
150 std::unique_ptr< art::Assns< rb::Shower, rb::Cluster > >
155 std::unique_ptr< art::Assns< rb::Shower, rb::Prong > >
162 std::vector< rb::Shower > showerVec;
182 if( ((
fProngInput==
true&&fmprong3D.isValid())||(
fProngInput==
false&&fmtrack3D.isValid())) || fmvertex.isValid() ) {
184 int nSli = slices->size();
185 for(
int iSli = 0; iSli < nSli; ++iSli){
199 std::vector<art::Ptr<rb::Track> > tracks3D;
201 if(
fProngInput==
false) tracks3D = fmtrack3D.at(iSli);
204 std::vector<art::Ptr<rb::Prong> > prongs;
207 std::vector<art::Ptr<rb::Prong> > prongs3D = fmprong3D.at(iSli);
208 for (
unsigned int ip=0;
ip<prongs3D.size(); ++
ip){
209 prongs.push_back(prongs3D[
ip]);
213 std::vector<art::Ptr<rb::Prong> > prongs2D = fmprong2D.at(iSli);
214 for (
unsigned int ip=0;
ip<prongs2D.size(); ++
ip){
215 prongs.push_back(prongs2D[
ip]);
221 std::vector<art::Ptr<rb::Track> > tracks3D = fmtrack3D.at(iSli);
222 for (
unsigned int ip=0;
ip<tracks3D.size(); ++
ip){
223 prongs.push_back(tracks3D[
ip]);
225 if(fmtrack2D.isValid()){
226 std::vector<art::Ptr<rb::Track> > tracks2D = fmtrack2D.at(iSli);
227 for (
unsigned int ip=0;
ip<tracks2D.size(); ++
ip){
228 prongs.push_back(tracks2D[
ip]);
233 int nPro = prongs.size();
235 std::vector< rb::Prong > newProngs;
236 std::vector< int > assProng;
238 std::vector<art::Ptr<rb::Vertex> > vertices = fmvertex.at(iSli);
239 if( vertices.empty() )
253 for(
int iPro = 0; iPro < nPro; ++iPro){
258 for(
int ic = 0; ic <
nc; ++ic)
262 for(
int io = 0; io < (
int)orphans.
NCell(); ++io)
270 for(
int iPro = 0; iPro < nPro; ++iPro){
283 int norphans = orphans.
NCell();
284 for(
int io = 0; io < norphans; ++io)
301 TVector3
dir = thisProng.
Dir();
304 int stopPlane, startPlane, vtxPlane;
312 thisProng.
SetDir( -1*dir);
349 if(
abs(vtxPlane - startPlane) >
abs(vtxPlane-stopPlane))
355 for(
auto hit : sliceHits ){
357 int thisPlane =
hit->Plane();
358 int diffFromStart = thisPlane - startPlane;
360 if( startPlane > stopPlane ){
361 diffFromStart = -diffFromStart;
364 if( thisPlane <
std::min(startPlane, stopPlane) ||
365 thisPlane >
std::max(startPlane, stopPlane) )
371 if( distToCore == 9999 )
382 newProngs.push_back( thisProng );
383 assProng.push_back( iPro );
386 std::vector< float > totpe;
387 for(
int iPro = 0; iPro < nPro; ++iPro){
388 totpe.push_back( prongs[iPro]->TotalPE() );
393 int nNewShower = newProngs.size();
395 for(
int i = 0;
i < nNewShower; ++
i){
397 newShower.
SetID(i + (100*iSli) );
399 reclustCol->push_back( newShower );
401 thisSlice ,*sliceAssassin);
403 prongs[ assProng[i] ] ,*prongAssassin);
411 evt.
put( std::move(reclustCol));
412 evt.
put( std::move(sliceAssassin));
413 evt.
put( std::move(prongAssassin));
T max(const caf::Proxy< T > &a, T b)
bool fConsider2D
Should 2-D prongs be considered for reclustering/deconvolution?
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.
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
art::ServiceHandle< geo::Geometry > fGeom
A private handle to geometry service.
bool fRespectFilter
Skip slices that failed filter?
bool fDeconvolve
Should cell-energy deconvolution be performed?
Preforms energy deconvolution for cells that may belong to multple clusters. It does so...
bool fApplyPEThreshold
If this parameter is true, cellhits with PE below fPEThreshold will not be reclustered.
float DistanceToCore(art::Ptr< rb::CellHit > cHit, rb::Prong &prong)
const CellGeo * Cell(int icell) const
std::string fSliceLabel
Label of slicer module.
void beginRun(art::Run &run)
A collection of associated CellHits.
void RemoveHit(const art::Ptr< rb::CellHit > hit)
Remove hit from current cluster.
const PlaneGeo * Plane(unsigned int i) const
rb::Cluster Exclude(const rb::Cluster *excl) const
Create a cluster from this one, but with the hits of excl removed.
DEFINE_ART_MODULE(TestTMapFile)
virtual TVector3 Start() const
void produce(art::Event &evt)
void SetTotalLength(double length)
Set length of a shower.
virtual void SetStart(TVector3 start)
fhicl::ParameterSet fDeconvolveAlgPSet
ParameterSet of DecolvolveAlg.
float fPEThreshold
If a cell PE is less than this value, it will not be added to the shower.
art::PtrVector< rb::CellHit > AllCells() const
Get all cells from both views.
virtual void Add(const art::Ptr< rb::CellHit > &cell, double weight=1)
bool fRecluster
Should shower reclustering be performed?
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
ProductID put(std::unique_ptr< PROD > &&product)
std::string fTrack2DLabel
Label of 2d tracks.
virtual double TotalLength() const
Distance along prong to reach last cell hit.
virtual void SetDir(TVector3 dir)
T get(std::string const &key) const
int getPlaneID(const CellUniqueId &id) const
virtual TVector3 Dir() const
Unit vector describing prong direction.
const CellUniqueId CellId(const double &x, const double &y, const double &z, double dxds=0., double dyds=0., double dzds=1., double step=0.01) const
bool IsFiltered(const art::Event &evt, art::Ptr< T > x, const std::vector< std::string > &labels)
Is this Ptr marked "filtered out"?
Recluster(fhicl::ParameterSet const &pset)
std::string fProngLabel
True = Prong input, False = Track input.
Vertex location in position and time.
float fMaxPlane
The extent of the reclustering cylinder, beyond prong stop point.
void reconfigure(const fhicl::ParameterSet &pset)
void GetWeights(std::vector< rb::Prong > &prong, const std::vector< float > &totpe)
unsigned int MinPlane(geo::View_t view=geo::kXorY) const
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
unsigned long long int CellUniqueId
std::string fTrack3DLabel
Label of 3d tracks.
A Cluster with defined start position and direction.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
std::string fProng2DInstLabel
Label of instance label of 2d prongs.
A rb::Prong with a length.
float fMIPPlane
The extent of the MIP cylinder from the prong start point.
std::string fProng3DInstLabel
Label of instance label of 3d prongs.
float fMaxRadius
The radius of the reclustering cylinder, in cell widths.
unsigned int MaxPlane(geo::View_t view=geo::kXorY) const
Build slid::LID objects to store electron ID, if asked for, otherwise, calculate LID info and make av...
float fMIPRadius
The radius of the MIP cylinder, in cell widths.
std::string fVertexLabel
Lable of vertex producing module.
T min(const caf::Proxy< T > &a, T b)
bool IsNoise() const
Is the noise flag set?
std::vector< std::string > fFilterLabels
Labels of filter lists to obey.
Encapsulate the geometry of one entire detector (near, far, ndos)
DeconvolveAlg * fDeconvolveAlg
An object of DeconvolveAlg.
void SortByPlaneAndCell(std::vector< art::Ptr< rb::CellHit > > &c)
bool fProngInput
Lable of prong producing module.