27 #include "art_root_io/TFileService.h" 55 #include "range/v3/view.hpp" 113 std::vector<std::vector<double>>
116 std::vector<std::vector<double>>
134 std::vector<std::vector<double>>
172 pset.get<
double>(
"dEdxlength");
174 pset.get<
double>(
"calodEdxlength");
175 fUseArea = pset.get<
bool>(
"UseArea");
177 produces<std::vector<recob::Shower>>();
178 produces<art::Assns<recob::Shower, recob::Cluster>>();
179 produces<art::Assns<recob::Shower, recob::Hit>>();
180 produces<std::vector<anab::Calorimetry>>();
181 produces<art::Assns<recob::Shower, anab::Calorimetry>>();
190 fNPlanes = wireReadoutGeom.Nplanes();
223 "ChargedistributionADC",
"std::vector<std::vector<double>>", &
fDistribChargeADC);
225 "ChargedistributionMeV",
"std::vector<std::vector<double>>", &
fDistribChargeMeV);
244 fDriftVelocity = detProp.DriftVelocity(detProp.Efield(), detProp.Temperature());
248 void ShowerReco::ShowerReco::ClearandResizeVectors(
unsigned int )
252 for (
unsigned int i = 1; i <=
fNPlanes; ++i)
277 for (
unsigned int ii = 0; ii <
fNAngles; ii++) {
287 for (
unsigned int ii = 0; ii <
fNPlanes; ii++) {
354 auto const* geom = lar::providerFrom<geo::Geometry>();
362 fNPlanes = wireReadoutGeom.Nplanes(tpcid);
363 auto Shower3DVector = std::make_unique<std::vector<recob::Shower>>();
364 auto cassn = std::make_unique<art::Assns<recob::Shower, recob::Cluster>>();
365 auto hassn = std::make_unique<art::Assns<recob::Shower, recob::Hit>>();
366 auto calorimetrycol = std::make_unique<std::vector<anab::Calorimetry>>();
367 auto calassn = std::make_unique<art::Assns<anab::Calorimetry, recob::Shower>>();
389 clusterAssociationHandle->begin();
392 for (
size_t iClustSet = 0; iClustSet < clusterAssociationHandle->size(); iClustSet++) {
397 if (clusterListHandle->size() < 2 || CurrentClusters.
size() < 2) {
404 std::vector<std::vector<art::Ptr<recob::Hit>>> hitlist_all;
407 for (
size_t iClust = 0; iClust < CurrentClusters.
size(); iClust++) {
414 std::vector<art::Ptr<recob::Hit>>
const& hitlist = ClusterHits.at(pclust.
key());
418 if (hitlist.size() == 0)
continue;
420 p = (*hitlist.begin())->
WireID().Plane;
425 double ADCcharge = 0;
428 p =
hit->WireID().Plane;
429 hitlist_all[p].push_back(
hit);
430 ADCcharge +=
hit->PeakAmplitude();
438 unsigned int bp1 = 0, bp2 = 0;
439 double minerror1 = 99999999, minerror2 = 9999999;
440 for (
unsigned int ii = 0; ii <
fNPlanes; ++ii) {
445 if (minerror1 >= locerror)
447 minerror1 = locerror;
451 for (
unsigned int ij = 0; ij <
fNPlanes; ++ij) {
456 if (minerror2 >= locerror && ij != bp1) {
457 minerror2 = locerror;
465 std::vector<geo::Point_t> position;
466 position.reserve(fNPlanes);
468 for (
auto const& plane : wireReadoutGeom.Iterate<
geo::PlaneGeo>(tpcid)) {
469 position.push_back(plane.GetBoxCenter());
476 double fDriftVelocity = detProp.DriftVelocity(detProp.Efield(), detProp.Temperature());
478 int chan1 = wireReadoutGeom.PlaneWireToChannel({0, 0, bp1,
fWire_vertex[bp1]});
479 int chan2 = wireReadoutGeom.PlaneWireToChannel({0, 0, bp2,
fWire_vertex[bp2]});
481 auto const intersection = wireReadoutGeom.ChannelsIntersect(chan1, chan2).value();
496 if (bp1 != fNPlanes - 1 && bp2 != fNPlanes - 1) {
498 auto const& plane = wireReadoutGeom.
Plane(lastPlaneID);
499 auto pos = plane.GetBoxCenter();
502 auto const wirevertex = plane.NearestWireID(pos).Wire;
505 (
xyz_vertex_fit[0] / detProp.DriftVelocity(detProp.Efield(), detProp.Temperature())) *
510 (pos.X() / detProp.DriftVelocity(detProp.Efield(), detProp.Temperature())) *
515 if (fabs(
xphi) < 5.) {
516 xtheta = gser.Get3DSpecialCaseTheta(
521 for (
unsigned int i = 0; i <
fNAngles; ++i) {
539 if (!(fabs(
xphi) > 89 && fabs(
xphi) < 91))
545 hitlist_all[fNPlanes - 1]);
551 for (
unsigned int i = 0; i < clusterListHandle->size(); ++i) {
557 std::vector<recob::SpacePoint> spcpts;
564 TVector3 dcosVtx(std::cos(fPhi * TMath::Pi() / 180) * std::sin(fTheta * TMath::Pi() / 180),
565 std::cos(fTheta * TMath::Pi() / 180),
566 std::sin(fPhi * TMath::Pi() / 180) * std::sin(fTheta * TMath::Pi() / 180));
575 Shower3DVector->push_back(singShower);
580 for (
size_t p = 0; p < prodvec.
size(); ++p) {
581 std::vector<art::Ptr<recob::Hit>>
hits = fmh.at(p);
586 calorimetrycol->emplace_back(
599 evt.
put(std::move(Shower3DVector));
600 evt.
put(std::move(cassn));
601 evt.
put(std::move(hassn));
602 evt.
put(std::move(calorimetrycol));
603 evt.
put(std::move(calassn));
623 unsigned int wire = 0, plane =
fNPlanes - 1;
625 double mevav2cm = 0.;
626 double npoints_calo = 0;
631 if (fabs(
xphi) < 90) direction = 1;
634 double ortdist, linedist;
635 double wire_on_line, time_on_line;
639 double newpitch = gser.PitchInView(plane,
xphi,
xtheta);
642 using ranges::views::transform;
644 time =
hit.PeakTime();
645 wire =
hit.WireID().Wire;
646 plane =
hit.WireID().Plane;
654 dEdx_new = calalg.
dEdx_AMP(clockData, detProp,
hit, newpitch);
658 totCnrg_corr += dEdx_new;
670 ortdist = gser.Get2DDistance(wire_on_line, time_on_line, wire, time);
673 double wdist = (((double)wire - (
double)
fWire_vertex[plane]) * newpitch) *
678 vdEdx.push_back(dEdx_new);
680 vdQdx.push_back(
hit.PeakAmplitude() / newpitch);
683 Kin_En += dEdx_new * newpitch;
705 auto const signalType =
718 time =
hit.PeakTime();
719 wire =
hit.WireID().Wire;
720 plane =
hit.WireID().Plane;
727 dEdx = calalg.
dEdx_AMP(clockData, detProp,
hit, newpitch);
739 ortdist = gser.Get2DDistance(wire_on_line, time_on_line, wire, time);
741 double wdist = (((double)wire - (
double)
fWire_vertex[plane]) * newpitch) * direction;
748 fRMS_2cm[
set] += (dEdx - mevav2cm) * (dEdx - mevav2cm);
759 time =
hit.PeakTime();
760 wire =
hit.WireID().Wire;
761 plane =
hit.WireID().Plane;
768 dEdx = calalg.
dEdx_AMP(clockData, detProp,
hit, newpitch);
780 ortdist = gser.Get2DDistance(wire_on_line, time_on_line, wire, time);
782 double wdist = (((double)wire - (
double)
fWire_vertex[plane]) * newpitch) * direction;
789 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
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
float EndTick() const
Returns the tick coordinate of the end of the cluster.
std::vector< double > fTotADCperplane
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
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)
void LongTransEnergy(geo::GeometryCore const *geom, geo::WireReadoutGeom const &wireReadoutGeom, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, unsigned int set, std::vector< art::Ptr< recob::Hit >> hitlist)
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
void push_back(Ptr< U > const &p)
std::vector< float > vresRange
Interface for a class providing readout channel mapping to geometry.
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 the physical 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
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
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
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
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.