27 #include "art_root_io/TFileService.h" 28 #include "canvas/Persistency/Common/FindManyP.h" 53 #include "range/v3/view.hpp" 108 std::vector<std::vector<double>>
111 std::vector<std::vector<double>>
129 std::vector<std::vector<double>>
167 pset.get<
double>(
"dEdxlength");
169 pset.get<
double>(
"calodEdxlength");
170 fUseArea = pset.get<
bool>(
"UseArea");
172 produces<std::vector<recob::Shower>>();
173 produces<art::Assns<recob::Shower, recob::Cluster>>();
174 produces<art::Assns<recob::Shower, recob::Hit>>();
175 produces<std::vector<anab::Calorimetry>>();
176 produces<art::Assns<recob::Shower, anab::Calorimetry>>();
221 "ChargedistributionADC",
"std::vector<std::vector<double>>", &
fDistribChargeADC);
223 "ChargedistributionMeV",
"std::vector<std::vector<double>>", &
fDistribChargeMeV);
234 auto const* geom = lar::providerFrom<geo::Geometry>();
241 fDriftVelocity = detProp.DriftVelocity(detProp.Efield(), detProp.Temperature());
246 ShowerReco::ShowerReco::ClearandResizeVectors(
unsigned int )
250 for (
unsigned int i = 1; i <=
fNPlanes; ++i)
275 for (
unsigned int ii = 0; ii <
fNAngles; ii++) {
285 for (
unsigned int ii = 0; ii <
fNPlanes; ii++) {
353 auto const* geom = lar::providerFrom<geo::Geometry>();
360 auto Shower3DVector = std::make_unique<std::vector<recob::Shower>>();
361 auto cassn = std::make_unique<art::Assns<recob::Shower, recob::Cluster>>();
362 auto hassn = std::make_unique<art::Assns<recob::Shower, recob::Hit>>();
363 auto calorimetrycol = std::make_unique<std::vector<anab::Calorimetry>>();
364 auto calassn = std::make_unique<art::Assns<anab::Calorimetry, recob::Shower>>();
386 clusterAssociationHandle->begin();
388 for (
size_t iClustSet = 0; iClustSet < clusterAssociationHandle->size(); iClustSet++) {
393 if (clusterListHandle->size() < 2 || CurrentClusters.
size() < 2) {
400 std::vector<std::vector<art::Ptr<recob::Hit>>> hitlist_all;
403 for (
size_t iClust = 0; iClust < CurrentClusters.
size(); iClust++) {
410 std::vector<art::Ptr<recob::Hit>>
const& hitlist = ClusterHits.
at(pclust.
key());
414 if (hitlist.size() == 0)
continue;
416 p = (*hitlist.begin())->
WireID().Plane;
421 double ADCcharge = 0;
424 p =
hit->WireID().Plane;
425 hitlist_all[
p].push_back(
hit);
426 ADCcharge +=
hit->PeakAmplitude();
434 unsigned int bp1 = 0, bp2 = 0;
435 double minerror1 = 99999999, minerror2 = 9999999;
436 for (
unsigned int ii = 0; ii <
fNPlanes; ++ii) {
441 if (minerror1 >= locerror)
443 minerror1 = locerror;
447 for (
unsigned int ij = 0; ij <
fNPlanes; ++ij) {
452 if (minerror2 >= locerror && ij != bp1) {
453 minerror2 = locerror;
461 const double origin[3] = {0.};
462 std::vector<std::vector<double>>
position;
464 double fDriftVelocity = detProp.DriftVelocity(detProp.Efield(), detProp.Temperature());
466 for (
unsigned int xx = 0; xx <
fNPlanes; xx++) {
468 geom->Plane(xx).LocalToWorld(origin, pos1);
469 std::vector<double> pos2;
470 pos2.push_back(pos1[0]);
471 pos2.push_back(pos1[1]);
472 pos2.push_back(pos1[2]);
473 position.push_back(pos2);
479 int chan1 = geom->PlaneWireToChannel(bp1,
fWire_vertex[bp1], 0);
480 int chan2 = geom->PlaneWireToChannel(bp2,
fWire_vertex[bp2], 0);
483 geom->ChannelsIntersect(chan1, chan2, y, z);
499 if (bp1 != fNPlanes - 1 && bp2 != fNPlanes - 1) {
501 unsigned int wirevertex;
503 geom->Plane(fNPlanes - 1).LocalToWorld(origin, pos);
507 wirevertex = geom->NearestWire(pos, fNPlanes - 1);
510 (
xyz_vertex_fit[0] / detProp.DriftVelocity(detProp.Efield(), detProp.Temperature())) *
515 (pos[0] / detProp.DriftVelocity(detProp.Efield(), detProp.Temperature())) *
520 if (fabs(
xphi) < 5.) {
521 xtheta = gser.Get3DSpecialCaseTheta(
526 for (
unsigned int i = 0; i <
fNAngles; ++i) {
544 if (!(fabs(
xphi) > 89 && fabs(
xphi) < 91))
549 hitlist_all[fNPlanes - 1]);
555 for (
unsigned int i = 0; i < clusterListHandle->size(); ++i) {
561 std::vector<recob::SpacePoint> spcpts;
569 TMath::Cos(fPhi * TMath::Pi() / 180) * TMath::Sin(fTheta * TMath::Pi() / 180),
570 TMath::Cos(fTheta * TMath::Pi() / 180),
571 TMath::Sin(fPhi * TMath::Pi() / 180) * TMath::Sin(fTheta * TMath::Pi() / 180));
580 Shower3DVector->push_back(singShower);
585 for (
size_t p = 0;
p < prodvec.
size(); ++
p) {
586 std::vector<art::Ptr<recob::Hit>> hits = fmh.at(
p);
591 calorimetrycol->emplace_back(
628 unsigned int wire = 0, plane =
fNPlanes - 1;
630 double mevav2cm = 0.;
632 double npoints_calo = 0;
637 if (fabs(
xphi) < 90) direction = 1;
640 double ortdist, linedist;
641 double wire_on_line, time_on_line;
645 double newpitch = gser.PitchInView(plane,
xphi,
xtheta);
648 using ranges::views::transform;
650 time =
hit.PeakTime();
651 wire =
hit.WireID().Wire;
652 plane =
hit.WireID().Plane;
660 dEdx_new = calalg.
dEdx_AMP(clockData, detProp,
hit, newpitch);
664 totCnrg_corr += dEdx_new;
676 ortdist = gser.Get2DDistance(wire_on_line, time_on_line, wire, time);
679 double wdist = (((double)wire - (
double)
fWire_vertex[plane]) * newpitch) *
684 vdEdx.push_back(dEdx_new);
686 vdQdx.push_back(
hit.PeakAmplitude() / newpitch);
689 Kin_En += dEdx_new * newpitch;
712 auto const signalType =
725 time =
hit.PeakTime();
726 wire =
hit.WireID().Wire;
727 plane =
hit.WireID().Plane;
734 dEdx = calalg.
dEdx_AMP(clockData, detProp,
hit, newpitch);
746 ortdist = gser.Get2DDistance(wire_on_line, time_on_line, wire, time);
755 fRMS_2cm[
set] += (dEdx - mevav2cm) * (dEdx - mevav2cm);
766 time =
hit.PeakTime();
767 wire =
hit.WireID().Wire;
768 plane =
hit.WireID().Plane;
775 dEdx = calalg.
dEdx_AMP(clockData, detProp,
hit, newpitch);
787 ortdist = gser.Get2DDistance(wire_on_line, time_on_line, wire, time);
796 if (((dEdx > (mevav2cm -
fRMS_2cm[
set])) && (dEdx < (mevav2cm +
fRMS_2cm[
set]))) ||
std::vector< double > fTime_last
fhicl::ParameterSet fCaloPSet
std::vector< double > fWire_vertexError
ShowerReco(fhicl::ParameterSet const &pset)
std::vector< double > fTotChargeADC
std::vector< double > fCorr_Charge_2cm
void set_direction_err(const TVector3 &dir_e)
constexpr to_element_t to_element
ProductID getProductID(std::string const &instance_name="") const
std::vector< int > fNhitsperplane
std::vector< std::vector< double > > fNPitch
EDProducer(fhicl::ParameterSet const &pset)
The data type to uniquely identify a Plane.
std::vector< std::vector< double > > fDistribChargeMeV
float StartWire() const
Returns the wire coordinate of the start of the cluster.
std::vector< int > fNpoints_corr_MeV_2cm
std::vector< std::vector< double > > fSingleEvtAngle
std::vector< double > fTime_vertex
float EndTick() const
Returns the tick coordinate of the end of the cluster.
std::vector< double > fTotADCperplane
std::vector< unsigned int > fWire_last
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
std::vector< std::vector< double > > fDistribHalfChargeMeV
float StartAngle() const
Returns the starting angle of the cluster.
std::vector< double > fChargeMeV_2cm_refined
geo::Length_t WirePitch(geo::PlaneID const &planeid) const
Returns the distance between two consecutive wires.
std::vector< float > vdEdx
void GetVertexAndAnglesFromCluster(art::Ptr< recob::Cluster > clust, unsigned int plane)
art framework interface to geometry description
std::vector< float > vdQdx
std::vector< int > fNpoints_2cm
std::vector< double > fTime_vertexError
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
double dEdx(float dqdx, float Efield)
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
std::vector< std::vector< double > > fSingleEvtAngleVal
void set_direction(const TVector3 &dir)
double dEdx_AMP(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
#define DEFINE_ART_MODULE(klass)
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
void push_back(Ptr< U > const &p)
std::vector< float > vresRange
EDProductGetter const * productGetter(ProductID const pid) const
key_type key() const noexcept
T get(std::string const &key) const
std::vector< double > fRMS_2cm
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
void produce(art::Event &evt)
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.
float SigmaStartWire() const
Returns the uncertainty on wire coordinate of the start of the cluster.
reference at(size_type n)
Description of geometry of one entire detector.
Detector simulation of raw signals on wires.
std::vector< double > fCorr_MeV_2cm
std::string fClusterModuleLabel
Declaration of signal hit object.
std::vector< double > xyz_vertex_fit
void beginRun(art::Run &run)
Encapsulate the construction of a single detector plane.
Contains all timing reference information for the detector.
std::vector< double > fChargeMeV_2cm
std::vector< double > fTotChargeMeV_MIPs
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
float SigmaStartTick() const
Returns the uncertainty on tick coordinate of the start of the cluster.
std::vector< double > fChargeADC_2cm
double dEdx_AREA(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
std::vector< float > deadwire
int trigger_offset(DetectorClocksData const &data)
std::vector< std::vector< double > > fDistribChargeADC
EventNumber_t event() const
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
std::vector< double > fChargeMeV_2cm_axsum
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
LArSoft geometry interface.
std::vector< std::vector< double > > fDistribChargeposition
float StartTick() const
Returns the tick coordinate of the start of the cluster.
std::vector< unsigned int > fWire_vertex
SubRunNumber_t subRun() const
constexpr Point origin()
Returns a origin position with a point of the specified type.
cet::coded_exception< error, detail::translate > exception
std::vector< double > fTotChargeMeV
Signal from collection planes.
float EndWire() const
Returns the wire coordinate of the end of the cluster.