173 fTCAlg->RunTrajClusterAlg(evt);
175 std::unique_ptr<std::vector<recob::Hit>> newHits = std::make_unique<std::vector<recob::Hit>>(
fTCAlg->YieldHits());
177 std::vector<recob::Cluster> sccol;
178 std::vector<recob::PFParticle> spcol;
180 std::vector<recob::Vertex> sv3col;
181 std::vector<recob::EndPoint2D> sv2col;
182 std::vector<recob::Shower> sscol;
183 std::vector<anab::CosmicTag> ctcol;
185 std::unique_ptr<art::Assns<recob::Cluster, recob::Hit>>
187 std::unique_ptr<art::Assns<recob::Cluster, recob::Vertex, unsigned short>>
189 std::unique_ptr<art::Assns<recob::Shower, recob::Hit>>
192 std::unique_ptr<art::Assns<recob::PFParticle, recob::Cluster>>
194 std::unique_ptr<art::Assns<recob::PFParticle, recob::Shower>>
196 std::unique_ptr<art::Assns<recob::PFParticle, recob::Vertex>>
204 std::unique_ptr<art::Assns<recob::PFParticle, anab::CosmicTag>>
207 std::vector<tca::ClusterStore>
const& Clusters =
fTCAlg->GetClusters();
210 std::vector<tca::VtxStore>
const& EndPts =
fTCAlg->GetEndPoints();
213 if(vtx2.ID == 0)
continue;
214 unsigned int vtxID = vtx2.ID;
215 unsigned int wire = std::nearbyint(vtx2.Pos[0]);
219 sv2col.emplace_back((
double)vtx2.Pos[1],
227 std::unique_ptr<std::vector<recob::EndPoint2D> > v2col(
new std::vector<recob::EndPoint2D>(std::move(sv2col)));
230 std::vector<tca::Vtx3Store>
const& Vertices =
fTCAlg->GetVertices();
231 double xyz[3] = {0, 0, 0};
234 if(vtx3.Wire >= 0)
continue;
235 if(vtx3.ID == 0)
continue;
236 unsigned int vtxID = vtx3.ID;
240 sv3col.emplace_back(xyz, vtxID);
243 std::unique_ptr<std::vector<recob::Vertex> > v3col(
new std::vector<recob::Vertex>(std::move(sv3col)));
246 std::vector<art::Ptr<recob::Hit>> clusterHits;
247 float sumChg, sumADC;
248 std::vector<size_t> dtrIndices;
249 unsigned short clsID = 0;
250 for(
size_t icl = 0; icl < Clusters.size(); ++icl) {
254 unsigned short plane = planeID.
Plane;
255 unsigned short nclhits = clstr.
tclhits.size();
259 for(
unsigned short itt = 0; itt < nclhits; ++itt) {
260 unsigned int iht = clstr.
tclhits[itt];
305 unsigned short vtxIndex = 0;
308 if(vtx3.ID == 0)
continue;
310 if(vtx3.Wire > 0)
continue;
311 if(vtx3.Vx2ID[plane] == 0)
continue;
312 if(vtx3.Vx2ID[plane] == clstr.
BeginVtx) {
325 unsigned short vtxIndex = 0;
328 if(vtx3.ID == 0)
continue;
330 if(vtx3.Wire >= 0)
continue;
331 if(vtx3.Vx2ID[plane] == 0)
continue;
332 if(vtx3.Vx2ID[plane] == clstr.
EndVtx) {
345 std::vector<tca::PFPStruct> pfpList =
fTCAlg->GetPFParticles();
348 std::vector<unsigned int> shwrIndices(pfpList.size(),UINT_MAX);
349 unsigned short nshower =
fTCAlg->GetShowerStructSize();
350 for(
unsigned short ish = 0; ish < nshower; ++ish) {
352 if(ss3.
ID == 0)
continue;
372 sscol.push_back(shower);
373 if(ss3.
PFPIndex < shwrIndices.size()) {
386 for(
size_t ipfp = 0; ipfp < pfpList.size(); ++ipfp) {
387 auto& pfp = pfpList[ipfp];
388 if(pfp.ID == 0)
continue;
390 if(pfp.PDGCode == 22)
continue;
391 size_t parentIndex = pfp.ID - 1;
392 std::vector<size_t> dtrIndices(pfp.DtrIDs.size());
393 for(
unsigned short idtr = 0; idtr < pfp.DtrIDs.size(); ++idtr) dtrIndices[idtr] = pfp.DtrIDs[idtr] - 1;
394 spcol.emplace_back(pfp.PDGCode, ipfp, parentIndex, dtrIndices);
397 std::vector<unsigned int> clsIndices;
398 for(
auto tjid : pfp.TjIDs) {
400 std::cout<<
"TC: Found an invalid tj ID "<<tjid<<
" in P"<<pfp.ID;
403 unsigned int clsIndex =
fTCAlg->GetTjClusterIndex(tjid);
404 if(clsIndex > Clusters.size() - 1) {
405 std::cout<<
"Retrieved an invalid cluster index for PFParticle "<<pfp.ID<<
" TjID "<<tjid<<
". Ignoring it...\n";
409 clsIndices.push_back(clsIndex);
411 if(pfp.Vx3ID[0] > (
int)Vertices.size()) std::cout<<
"TC module: Bad Vtx3DIndex = "<<pfp.Vx3ID[0]<<
" size "<<Vertices.size()<<
"\n";
414 if(!
util::CreateAssn(*
this, evt, *pfp_cls_assn, spcol.size()-1, clsIndices.begin(), clsIndices.end()))
419 std::vector<unsigned int> vtmp(1);
421 unsigned short vtxIndex = 0;
422 for(
unsigned short iv = 0; iv < Vertices.size(); ++iv) {
423 if(Vertices[iv].ID == 0)
continue;
424 if(Vertices[iv].Wire >= 0)
continue;
425 if(pfp.Vx3ID[0] == Vertices[iv].ID) {
427 if(!
util::CreateAssn(*
this, evt, *pfp_vtx_assn, spcol.size()-1, vtmp.begin(), vtmp.end()))
436 if (shwrIndices[ipfp]<UINT_MAX) {
437 if(!
util::CreateAssn(*
this, evt, *pfp_shwr_assn, spcol.size()-1, shwrIndices.begin()+ipfp, shwrIndices.begin()+ipfp+1))
443 if (
fTCAlg->GetTJS().TagCosmics){
444 std::vector<float> tempPt1, tempPt2;
445 tempPt1.push_back(-999);
446 tempPt1.push_back(-999);
447 tempPt1.push_back(-999);
448 tempPt2.push_back(-999);
449 tempPt2.push_back(-999);
450 tempPt2.push_back(-999);
452 if (!
util::CreateAssn(*
this, evt, spcol, ctcol, *pfp_cos_assn, ctcol.size()-1, ctcol.size())){
494 std::unique_ptr<std::vector<recob::Cluster> > ccol(
new std::vector<recob::Cluster>(std::move(sccol)));
495 std::unique_ptr<std::vector<recob::PFParticle> > pcol(
new std::vector<recob::PFParticle>(std::move(spcol)));
497 std::unique_ptr<std::vector<recob::Shower> > scol(
new std::vector<recob::Shower>(std::move(sscol)));
498 std::unique_ptr<std::vector<anab::CosmicTag>> ctgcol(
new std::vector<anab::CosmicTag>(std::move(ctcol)));
506 shcol.use_hits(std::move(newHits));
508 evt.
put(std::move(ccol));
509 evt.
put(std::move(cls_hit_assn));
510 evt.
put(std::move(v2col));
511 evt.
put(std::move(v3col));
512 evt.
put(std::move(scol));
513 evt.
put(std::move(shwr_hit_assn));
514 evt.
put(std::move(cls_vtx_assn));
515 evt.
put(std::move(pcol));
516 evt.
put(std::move(pfp_cls_assn));
517 evt.
put(std::move(pfp_shwr_assn));
518 evt.
put(std::move(pfp_vtx_assn));
522 evt.
put(std::move(ctgcol));
523 evt.
put(std::move(pfp_cos_assn));
void set_start_point_err(const TVector3 &xyz_e)
void set_dedx_err(const std::vector< double > &q)
void set_direction_err(const TVector3 &dir_e)
std::vector< unsigned int > tclhits
struct of temporary 2D vertices (end points)
std::vector< double > dEdxErr
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
The data type to uniquely identify a Plane.
std::vector< double > MIPEnergy
void set_total_energy(const std::vector< double > &q)
CryostatID_t Cryostat
Index of cryostat.
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
void set_total_MIPenergy_err(const std::vector< double > &q)
void set_total_energy_err(const std::vector< double > &q)
static const SentryArgument_t Sentry
An instance of the sentry object.
ProductID put(std::unique_ptr< PROD > &&product)
void set_id(const int id)
struct of temporary 3D vertices
void set_direction(const TVector3 &dir)
bool CreateAssnD(PRODUCER const &prod, art::Event &evt, art::Assns< T, U, D > &assn, size_t first_index, size_t second_index, typename art::Assns< T, U, D >::data_t &&data)
Creates a single one-to-one association with associated data.
void set_length(const double &l)
void set_open_angle(const double &a)
A class handling a collection of hits and its associations.
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
PlaneID_t Plane
Index of the plane within its TPC.
void set_total_best_plane(const int q)
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
std::vector< unsigned int > Hits
std::unique_ptr< tca::TrajClusterAlg > fTCAlg
void set_total_MIPenergy(const std::vector< double > &q)
Detector simulation of raw signals on wires.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::vector< double > EnergyErr
std::vector< double > MIPEnergyErr
std::vector< double > Energy
geo::PlaneID DecodeCTP(CTP_t CTP)
float SummedADC() const
The sum of calibrated ADC counts of the hit (0. by default)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
2D representation of charge deposited in the TDC/wire plane
void set_start_point(const TVector3 &xyz)
TPCID_t TPC
Index of the TPC within its cryostat.
std::vector< double > dEdx
struct of temporary clusters
void set_dedx(const std::vector< double > &q)