27 #include "art_root_io/TFileService.h" 54 #include "range/v3/view.hpp" 111 std::vector<std::vector<double>>
114 std::vector<std::vector<double>>
132 std::vector<std::vector<double>>
170 pset.get<
double>(
"dEdxlength");
172 pset.get<
double>(
"calodEdxlength");
173 fUseArea = pset.get<
bool>(
"UseArea");
175 produces<std::vector<recob::Shower>>();
176 produces<art::Assns<recob::Shower, recob::Cluster>>();
177 produces<art::Assns<recob::Shower, recob::Hit>>();
178 produces<std::vector<anab::Calorimetry>>();
179 produces<art::Assns<recob::Shower, anab::Calorimetry>>();
223 "ChargedistributionADC",
"std::vector<std::vector<double>>", &
fDistribChargeADC);
225 "ChargedistributionMeV",
"std::vector<std::vector<double>>", &
fDistribChargeMeV);
235 auto const* geom = lar::providerFrom<geo::Geometry>();
242 fDriftVelocity = detProp.DriftVelocity(detProp.Efield(), detProp.Temperature());
246 void 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++) {
352 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 std::vector<geo::Point_t> position;
462 position.reserve(fNPlanes);
464 for (
auto const& plane : geom->Iterate<
geo::PlaneGeo>(tpcid)) {
465 position.push_back(plane.GetBoxCenter());
472 double fDriftVelocity = detProp.DriftVelocity(detProp.Efield(), detProp.Temperature());
474 int chan1 = geom->PlaneWireToChannel({0, 0, bp1,
fWire_vertex[bp1]});
475 int chan2 = geom->PlaneWireToChannel({0, 0, bp2,
fWire_vertex[bp2]});
478 geom->ChannelsIntersect(chan1, chan2, y, z);
494 if (bp1 != fNPlanes - 1 && bp2 != fNPlanes - 1) {
496 auto pos = geom->
Plane(lastPlaneID).GetBoxCenter();
499 auto const wirevertex = geom->NearestWireID(pos, lastPlaneID).Wire;
502 (
xyz_vertex_fit[0] / detProp.DriftVelocity(detProp.Efield(), detProp.Temperature())) *
507 (pos.X() / detProp.DriftVelocity(detProp.Efield(), detProp.Temperature())) *
512 if (fabs(
xphi) < 5.) {
513 xtheta = gser.Get3DSpecialCaseTheta(
518 for (
unsigned int i = 0; i <
fNAngles; ++i) {
536 if (!(fabs(
xphi) > 89 && fabs(
xphi) < 91))
541 hitlist_all[fNPlanes - 1]);
547 for (
unsigned int i = 0; i < clusterListHandle->size(); ++i) {
553 std::vector<recob::SpacePoint> spcpts;
560 TVector3 dcosVtx(std::cos(fPhi * TMath::Pi() / 180) * std::sin(fTheta * TMath::Pi() / 180),
561 std::cos(fTheta * TMath::Pi() / 180),
562 std::sin(fPhi * TMath::Pi() / 180) * std::sin(fTheta * TMath::Pi() / 180));
571 Shower3DVector->push_back(singShower);
576 for (
size_t p = 0; p < prodvec.
size(); ++p) {
577 std::vector<art::Ptr<recob::Hit>>
hits = fmh.at(p);
582 calorimetrycol->emplace_back(
595 evt.
put(std::move(Shower3DVector));
596 evt.
put(std::move(cassn));
597 evt.
put(std::move(hassn));
598 evt.
put(std::move(calorimetrycol));
599 evt.
put(std::move(calassn));
618 unsigned int wire = 0, plane =
fNPlanes - 1;
620 double mevav2cm = 0.;
621 double npoints_calo = 0;
626 if (fabs(
xphi) < 90) direction = 1;
629 double ortdist, linedist;
630 double wire_on_line, time_on_line;
634 double newpitch = gser.PitchInView(plane,
xphi,
xtheta);
637 using ranges::views::transform;
639 time =
hit.PeakTime();
640 wire =
hit.WireID().Wire;
641 plane =
hit.WireID().Plane;
649 dEdx_new = calalg.
dEdx_AMP(clockData, detProp,
hit, newpitch);
653 totCnrg_corr += dEdx_new;
665 ortdist = gser.Get2DDistance(wire_on_line, time_on_line, wire, time);
668 double wdist = (((double)wire - (
double)
fWire_vertex[plane]) * newpitch) *
673 vdEdx.push_back(dEdx_new);
675 vdQdx.push_back(
hit.PeakAmplitude() / newpitch);
678 Kin_En += dEdx_new * newpitch;
700 auto const signalType =
713 time =
hit.PeakTime();
714 wire =
hit.WireID().Wire;
715 plane =
hit.WireID().Plane;
722 dEdx = calalg.
dEdx_AMP(clockData, detProp,
hit, newpitch);
734 ortdist = gser.Get2DDistance(wire_on_line, time_on_line, wire, time);
736 double wdist = (((double)wire - (
double)
fWire_vertex[plane]) * newpitch) * direction;
743 fRMS_2cm[
set] += (dEdx - mevav2cm) * (dEdx - mevav2cm);
754 time =
hit.PeakTime();
755 wire =
hit.WireID().Wire;
756 plane =
hit.WireID().Plane;
763 dEdx = calalg.
dEdx_AMP(clockData, detProp,
hit, newpitch);
775 ortdist = gser.Get2DDistance(wire_on_line, time_on_line, wire, time);
777 double wdist = (((double)wire - (
double)
fWire_vertex[plane]) * newpitch) * direction;
784 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)
Utilities related to art service access.
constexpr to_element_t to_element
std::vector< int > fNhitsperplane
ProductID getProductID(std::string const &instance_name="") const
std::vector< std::vector< double > > fNPitch
Declaration of signal hit object.
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
std::vector< std::vector< double > > fDistribHalfChargeMeV
float StartAngle() const
Returns the starting angle of the cluster.
std::vector< double > fChargeMeV_2cm_refined
std::vector< float > vdEdx
void GetVertexAndAnglesFromCluster(art::Ptr< recob::Cluster > clust, unsigned int plane)
std::vector< float > vdQdx
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
std::vector< int > fNpoints_2cm
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
std::vector< double > fTime_vertexError
std::vector< std::vector< double > > fSingleEvtAngleVal
void set_direction(const TVector3 &dir)
EDProductGetter const * productGetter(ProductID const pid) const
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
key_type key() const noexcept
T get(std::string const &key) const
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
std::vector< double > fRMS_2cm
void produce(art::Event &evt)
float SigmaStartWire() const
Returns the uncertainty on wire coordinate of the start of the cluster.
The data type to uniquely identify a TPC.
PlaneID_t Plane
Index of the plane within its TPC.
Description of geometry of one entire detector.
Declaration of cluster object.
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
Detector simulation of raw signals on wires.
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
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
void beginRun(art::Run &run)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Utility object to perform functions of association.
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)
unsigned int Nplanes(TPCID const &tpcid=tpc_zero) const
Returns the total number of planes in the specified TPC.
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
Namespace collecting geometry-related classes utilities.
std::vector< std::vector< double > > fDistribChargeposition
float StartTick() const
Returns the tick coordinate of the start of the cluster.
Length_t WirePitch(PlaneID const &planeid=plane_zero) const
Returns the distance between two consecutive wires.
std::vector< unsigned int > fWire_vertex
SubRunNumber_t subRun() const
art framework interface to geometry description
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.