354 auto const* geom = lar::providerFrom<geo::Geometry>();
355 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(
evt);
357 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(
evt, clockData);
361 auto Shower3DVector = std::make_unique<std::vector<recob::Shower>>();
362 auto cassn = std::make_unique<art::Assns<recob::Shower, recob::Cluster>>();
363 auto hassn = std::make_unique<art::Assns<recob::Shower, recob::Hit>>();
364 auto calorimetrycol = std::make_unique<std::vector<anab::Calorimetry>>();
365 auto calassn = std::make_unique<art::Assns<anab::Calorimetry, recob::Shower>>();
369 art::Handle<std::vector<recob::Cluster>> clusterListHandle;
372 art::Handle<std::vector<art::PtrVector<recob::Cluster>>> clusterAssociationHandle;
386 std::vector<art::PtrVector<recob::Cluster>>::const_iterator clusterSet =
387 clusterAssociationHandle->begin();
389 for (
size_t iClustSet = 0; iClustSet < clusterAssociationHandle->size(); iClustSet++) {
391 const art::PtrVector<recob::Cluster> CurrentClusters = (*(clusterSet++));
394 if (clusterListHandle->size() < 2 || CurrentClusters.size() < 2) {
401 std::vector<std::vector<art::Ptr<recob::Hit>>> hitlist_all;
404 for (
size_t iClust = 0; iClust < CurrentClusters.size(); iClust++) {
405 art::Ptr<recob::Cluster>
const& pclust = CurrentClusters[iClust];
411 std::vector<art::Ptr<recob::Hit>>
const& hitlist = ClusterHits.at(pclust.key());
415 if (hitlist.size() == 0)
continue;
417 p = (*hitlist.begin())->
WireID().Plane;
422 double ADCcharge = 0;
424 for (art::Ptr<recob::Hit>
const&
hit : hitlist) {
425 p =
hit->WireID().Plane;
426 hitlist_all[
p].push_back(
hit);
427 ADCcharge +=
hit->PeakAmplitude();
435 unsigned int bp1 = 0, bp2 = 0;
436 double minerror1 = 99999999, minerror2 = 9999999;
437 for (
unsigned int ii = 0; ii <
fNPlanes; ++ii) {
442 if (minerror1 >= locerror)
444 minerror1 = locerror;
448 for (
unsigned int ij = 0; ij <
fNPlanes; ++ij) {
451 fTime_vertexError[ij] * fTime_vertexError[ij];
453 if (minerror2 >= locerror && ij != bp1) {
454 minerror2 = locerror;
462 const double origin[3] = {0.};
463 std::vector<std::vector<double>> position;
467 for (
unsigned int xx = 0; xx <
fNPlanes; xx++) {
469 geom->Plane(xx).LocalToWorld(origin, pos1);
470 std::vector<double> pos2;
471 pos2.push_back(pos1[0]);
472 pos2.push_back(pos1[1]);
473 pos2.push_back(pos1[2]);
474 position.push_back(pos2);
480 int chan1 = geom->PlaneWireToChannel(bp1,
fWire_vertex[bp1], 0);
481 int chan2 = geom->PlaneWireToChannel(bp2,
fWire_vertex[bp2], 0);
484 geom->ChannelsIntersect(chan1, chan2, y, z);
492 catch (cet::exception
const&
e) {
493 mf::LogWarning(
"ShowerReco") <<
"caught exception \n" <<
e;
500 if (bp1 != fNPlanes - 1 && bp2 != fNPlanes - 1) {
502 unsigned int wirevertex;
504 geom->Plane(fNPlanes - 1).LocalToWorld(origin, pos);
508 wirevertex = geom->NearestWire(pos, fNPlanes - 1);
521 if (fabs(
xphi) < 5.) {
522 xtheta = gser.Get3DSpecialCaseTheta(
527 for (
unsigned int i = 0; i <
fNAngles; ++i) {
545 if (!(fabs(
xphi) > 89 && fabs(
xphi) < 91))
550 hitlist_all[fNPlanes - 1]);
555 art::PtrVector<recob::Cluster> prodvec;
556 for (
unsigned int i = 0; i < clusterListHandle->size(); ++i) {
557 art::Ptr<recob::Cluster> prod(clusterListHandle, i);
558 prodvec.push_back(prod);
562 std::vector<recob::SpacePoint> spcpts;
570 TMath::Cos(fPhi * TMath::Pi() / 180) * TMath::Sin(fTheta * TMath::Pi() / 180),
571 TMath::Cos(fTheta * TMath::Pi() / 180),
572 TMath::Sin(fPhi * TMath::Pi() / 180) * TMath::Sin(fTheta * TMath::Pi() / 180));
581 Shower3DVector->push_back(singShower);
586 for (
size_t p = 0;
p < prodvec.size(); ++
p) {
587 std::vector<art::Ptr<recob::Hit>> hits = fmh.at(
p);
592 calorimetrycol->emplace_back(
595 art::PtrVector<recob::Shower> ssvec;
597 art::ProductID aid =
evt.getProductID<std::vector<recob::Shower>>();
598 art::Ptr<recob::Shower> aptr(aid, 0,
evt.productGetter(aid));
599 ssvec.push_back(aptr);
605 evt.put(std::move(Shower3DVector));
606 evt.put(std::move(cassn));
607 evt.put(std::move(hassn));
608 evt.put(std::move(calorimetrycol));
609 evt.put(std::move(calassn));
process_name opflash particleana ie ie ie z
std::vector< double > fWire_vertexError
std::vector< double > fTotChargeADC
std::vector< double > fCorr_Charge_2cm
void set_direction_err(const TVector3 &dir_e)
std::vector< int > fNhitsperplane
The data type to uniquely identify a Plane.
std::vector< int > fNpoints_corr_MeV_2cm
std::vector< double > fTime_vertex
std::vector< double > fTotADCperplane
std::vector< unsigned int > fWire_last
std::vector< float > vdEdx
void GetVertexAndAnglesFromCluster(art::Ptr< recob::Cluster > clust, unsigned int plane)
std::vector< float > vdQdx
std::vector< int > fNpoints_2cm
std::vector< double > fTime_vertexError
void set_direction(const TVector3 &dir)
process_name opflash particleana ie ie y
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::vector< float > vresRange
std::vector< double > fRMS_2cm
std::vector< double > fCorr_MeV_2cm
std::string fClusterModuleLabel
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
std::vector< double > xyz_vertex_fit
std::vector< double > fChargeMeV_2cm
std::vector< double > fTotChargeMeV_MIPs
std::vector< double > fChargeADC_2cm
std::vector< float > deadwire
int trigger_offset(DetectorClocksData const &data)
void LongTransEnergy(geo::GeometryCore const *geom, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, unsigned int set, std::vector< art::Ptr< recob::Hit >> hitlist)
constexpr double kBogusD
obviously bogus double value
void ClearandResizeVectors(unsigned int nPlanes)
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
std::vector< int > fNpoints_corr_ADC_2cm
std::vector< unsigned int > fWire_vertex
constexpr Point origin()
Returns a origin position with a point of the specified type.
std::vector< double > fTotChargeMeV