106 double YZtoU(
const unsigned int cstat,
const unsigned int tpc,
const double y,
const double z)
const;
116 double YZtoV(
const unsigned int cstat,
const unsigned int tpc,
const double y,
const double z)
const;
226 mf::LogDebug(
"LArPandora") <<
" *** PFParticleHitDumper::beginJob() *** " << std::endl;
299 std::cout <<
" *** PFParticleHitDumper::analyze(...) *** " << std::endl;
323 std::cout <<
" Run: " <<
m_run << std::endl;
324 std::cout <<
" Event: " <<
m_event << std::endl;
365 std::cout <<
" PFParticles: " << particleVector.size() << std::endl;
370 std::cout <<
" PFParticleHitDumper::FillRecoTracks(...) " << std::endl;
376 std::cout <<
" PFParticleHitDumper::FillReco3D(...) " << std::endl;
377 this->
FillReco3D(particleVector, particlesToSpacePoints, spacePointsToHits);
382 std::cout <<
" PFParticleHitDumper::FillReco2D(...) " << std::endl;
388 std::cout <<
" PFParticleHitDumper::FillAssociated2DHits(...) " << std::endl;
389 this->
FillAssociated2DHits(evt, particleVector, particlesToHits, particlesToHitsClusters, particlesToTracks, tracksToHits, particlesToShowers, showersToHits);
394 std::cout <<
" PFParticleHitDumper::FillRecoWires(...) " << std::endl;
409 if (particlesToTracks.empty())
422 if (!trackVector.empty())
425 std::cout <<
" Warning: Found particle with more than one associated track " << std::endl;
464 if (particleVector.empty())
472 for (
unsigned int i = 0; i < particleVector.size(); ++i )
475 theParticleMap[particle->
Self()] = particle;
480 iter1 != iterEnd1; ++iter1)
495 const size_t parentID(particle->
Parent());
497 if (theParticleMap.end() == pIter)
498 throw cet::exception(
"LArPandora") <<
" PFParticleHitDumper::analyze --- Found particle with ID code";
506 std::cout <<
" PFPARTICLE [" <<
m_particle <<
"] [Primary=" <<
m_primary <<
"] (" << spacepoints.size() <<
" Space Points)" << std::endl;
508 for (
unsigned int j=0; j<spacepoints.size(); ++j)
512 m_x = spacepoint->
XYZ()[0];
513 m_y = spacepoint->
XYZ()[1];
514 m_z = spacepoint->
XYZ()[2];
517 if (spacePointsToHits.end() == iter2)
518 throw cet::exception(
"LArPandora") <<
" PFParticleHitDumper::analyze --- Found space point without associated hit";
541 if (particleVector.empty())
546 for (
unsigned int i = 0; i<particleVector.size(); ++i)
561 if (particlesToHits.end() != pIter)
563 if (particlesToHitsClusters.end() != pIter2)
572 if (tracksToHits.end() != iter2)
574 const HitVector &hitVector = iter2->second;
584 if (showersToHits.end() != iter2)
586 const HitVector &hitVector = iter2->second;
615 if (hitVector.empty())
621 auto const* theDetector = lar::providerFrom<detinfo::DetectorPropertiesService>();
624 for (
unsigned int i = 0; i<hitVector.size(); ++i)
632 if (hitsToParticles.end() != pIter)
646 m_x = theDetector->ConvertTicksToX(hit->
PeakTime(), wireID.Plane, wireID.TPC, wireID.Cryostat);
659 if (wireVector.empty())
668 auto const* theDetector = lar::providerFrom<detinfo::DetectorPropertiesService>();
671 int signalCounter(0);
673 for (
unsigned int i = 0; i<wireVector.size(); ++i)
677 const std::vector<float> &signals(wire->
Signal());
681 std::cout <<
" numWires=" << wireVector.size() <<
" numSignals=" << signals.size() << std::endl;
721 const double ay(xyzStart[1]);
722 const double az(xyzStart[2]);
726 const double by(xyzEnd[1]);
727 const double bz(xyzEnd[2]);
729 const double ny(by - ay);
730 const double nz(bz - az);
731 const double N2(ny * ny + nz * nz);
733 const double ry(ay - (ay * ny + az * nz) * ny / N2);
734 const double rz(az - (ay * ny + az * nz) * nz / N2);
735 const double sign((rz > 0.0) ? +1.0 : -1.0);
737 return sign * std::sqrt(ry * ry + rz * rz);
747 return z * std::sin(m_theta) - y * std::cos(m_theta);
757 return z * std::sin(m_theta) - y * std::cos(m_theta);
static void BuildPFParticleHitMaps(const PFParticleVector &particleVector, const PFParticlesToSpacePoints &particlesToSpacePoints, const SpacePointsToHits &spacePointsToHits, PFParticlesToHits &particlesToHits, HitsToPFParticles &hitsToParticles, const DaughterMode daughterMode=kUseDaughters)
Build mapping between PFParticles and Hits using PFParticle/SpacePoint/Hit maps.
void GetStart(double *xyz) const
TVector3 LocationAtPoint(unsigned int p) const
Covariance matrices are either set or not.
double YZtoU(const unsigned int cstat, const unsigned int tpc, const double y, const double z) const
Convert from (Y,Z) to U coordinate.
std::map< art::Ptr< recob::SpacePoint >, art::Ptr< recob::Hit > > SpacePointsToHits
std::map< art::Ptr< recob::Hit >, art::Ptr< recob::PFParticle > > HitsToPFParticles
void analyze(const art::Event &evt)
Encapsulate the construction of a single cyostat.
size_t Self() const
Returns the index of this particle.
int m_hitsFromTrackOrShower
static bool IsNeutrino(const art::Ptr< recob::PFParticle > particle)
Determine whether a particle has been reconstructed as a neutrino.
std::string m_hitfinderLabel
WireGeo const & Wire(unsigned int iwire) const
std::map< art::Ptr< recob::Shower >, HitVector > ShowersToHits
geo::WireID WireID() const
Initial tdc tick for hit.
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
Declaration of signal hit object.
double YZtoV(const unsigned int cstat, const unsigned int tpc, const double y, const double z) const
Convert from (Y,Z) to V coordinate.
virtual ~PFParticleHitDumper()
Destructor.
static void CollectWires(const art::Event &evt, const std::string &label, WireVector &wireVector)
Collect the reconstructed wires from the ART event record.
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
void FillRecoWires(const WireVector &wireVector)
Store raw data.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
CryostatID_t Cryostat
Index of cryostat.
int PdgCode() const
Return the type of particle as a PDG ID.
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
WireID_t Wire
Index of the wire within its plane.
TTree * m_pRecoComparison
std::string m_calwireLabel
std::map< art::Ptr< recob::Track >, HitVector > TracksToHits
double GetUVW(const geo::WireID &wireID) const
Conversion from wire ID to U/V/W coordinate.
std::vector< art::Ptr< recob::Track > > TrackVector
static void CollectSpacePoints(const art::Event &evt, const std::string &label, SpacePointVector &spacePointVector, SpacePointsToHits &spacePointsToHits)
Collect the reconstructed SpacePoints and associated hits from the ART event record.
void FillAssociated2DHits(const art::Event &evt, const PFParticleVector &particleVector, const PFParticlesToHits &particlesToHits, const PFParticlesToHits &particlesToHitsClusters, const PFParticlesToTracks &particlesToTracks, const TracksToHits &tracksToHits, const PFParticlesToShowers &particlesToShowers, const ShowersToHits &showersToHits)
Store number of 2D hits associated to PFParticle in different ways.
std::map< int, art::Ptr< recob::PFParticle > > PFParticleMap
bool m_printDebug
switch for print statements (TODO: use message service!)
#define DEFINE_ART_MODULE(klass)
PFParticleHitDumper class.
raw::ChannelID_t Channel() const
Returns the ID of the channel (or InvalidChannelID)
void reconfigure(fhicl::ParameterSet const &pset)
PFParticleHitDumper(fhicl::ParameterSet const &pset)
Constructor.
static void CollectShowers(const art::Event &evt, const std::string &label, ShowerVector &showerVector, PFParticlesToShowers &particlesToShowers)
Collect the reconstructed PFParticles and associated Showers from the ART event record.
std::vector< art::Ptr< recob::Wire > > WireVector
T get(std::string const &key) const
void FillReco2D(const HitVector &hitVector, const HitsToPFParticles &hitsToParticles)
Store 2D hits.
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
void FillReco3D(const PFParticleVector &particleVector, const PFParticlesToSpacePoints &particlesToSpacePoints, const SpacePointsToHits &spacePointsToHits)
Store 3D hits.
bool IsPrimary() const
Returns whether the particle is the root of the flow.
EDAnalyzer(Table< Config > const &config)
std::string m_spacepointLabel
PlaneID_t Plane
Index of the plane within its TPC.
Declaration of cluster object.
std::map< art::Ptr< recob::PFParticle >, ShowerVector > PFParticlesToShowers
Provides recob::Track data product.
static void CollectTracks(const art::Event &evt, const std::string &label, TrackVector &trackVector, PFParticlesToTracks &particlesToTracks)
Collect the reconstructed PFParticles and associated Tracks from the ART event record.
static void CollectPFParticles(const art::Event &evt, const std::string &label, PFParticleVector &particleVector)
Collect the reconstructed PFParticles from the ART event record.
std::vector< art::Ptr< recob::Shower > > ShowerVector
std::string m_clusterLabel
std::vector< art::Ptr< recob::SpacePoint > > SpacePointVector
std::vector< art::Ptr< recob::Hit > > HitVector
std::map< art::Ptr< recob::PFParticle >, TrackVector > PFParticlesToTracks
static void CollectHits(const art::Event &evt, const std::string &label, HitVector &hitVector)
Collect the reconstructed Hits from the ART event record.
Detector simulation of raw signals on wires.
std::vector< float > Signal() const
Return a zero-padded full length vector filled with RoI signal.
std::map< art::Ptr< recob::PFParticle >, HitVector > PFParticlesToHits
void FillRecoTracks(const PFParticlesToTracks &particlesToTracks)
Store 3D track hits.
float PeakTime() const
Time of the signal peak, in tick units.
T * make(ARGS...args) const
const double * XYZ() const
Utility object to perform functions of association.
Encapsulate the construction of a single detector plane.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
void GetEnd(double *xyz) const
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
EventNumber_t event() const
Declaration of basic channel signal object.
int m_hitsFromSpacePoints
std::string m_particleLabel
std::map< art::Ptr< recob::PFParticle >, SpacePointVector > PFParticlesToSpacePoints
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
TPCID_t TPC
Index of the TPC within its cryostat.
helper function for LArPandoraInterface producer module
double WireAngleToVertical(geo::View_t view, geo::TPCID const &tpcid) const
Returns the angle of the wires in the specified view from vertical.
std::string m_showerLabel
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception
Encapsulate the construction of a single detector plane.