114 double YZtoU(
const unsigned int cstat,
115 const unsigned int tpc,
117 const double z)
const;
127 double YZtoV(
const unsigned int cstat,
128 const unsigned int tpc,
130 const double z)
const;
183 #include "art_root_io/TFileDirectory.h" 184 #include "art_root_io/TFileService.h" 237 mf::LogDebug(
"LArPandora") <<
" *** PFParticleHitDumper::beginJob() *** " << std::endl;
242 m_pRecoTracks = tfs->make<TTree>(
"pandoraTracks",
"LAr Reco Tracks");
250 m_pReco3D = tfs->make<TTree>(
"pandora3D",
"LAr Reco 3D");
265 m_pReco2D = tfs->make<TTree>(
"pandora2D",
"LAr Reco 2D");
278 m_pRecoComparison = tfs->make<TTree>(
"pandora2Dcomparison",
"LAr Reco 2D (comparison)");
289 m_pRecoWire = tfs->make<TTree>(
"rawdata",
"LAr Reco Wires");
309 if (
m_printDebug) std::cout <<
" *** PFParticleHitDumper::analyze(...) *** " << std::endl;
332 std::cout <<
" Run: " <<
m_run << std::endl;
333 std::cout <<
" Event: " <<
m_event << std::endl;
371 LArPandoraHelper::DaughterMode::kUseDaughters,
378 if (
m_printDebug) std::cout <<
" PFParticles: " << particleVector.size() << std::endl;
382 if (
m_printDebug) std::cout <<
" PFParticleHitDumper::FillRecoTracks(...) " << std::endl;
387 if (
m_printDebug) std::cout <<
" PFParticleHitDumper::FillReco3D(...) " << std::endl;
388 this->
FillReco3D(particleVector, particlesToSpacePoints, spacePointsToHits);
392 if (
m_printDebug) std::cout <<
" PFParticleHitDumper::FillReco2D(...) " << std::endl;
393 this->
FillReco2D(evt, hitVector, hitsToParticles);
398 std::cout <<
" PFParticleHitDumper::FillAssociated2DHits(...) " << std::endl;
402 particlesToHitsClusters,
410 if (
m_printDebug) std::cout <<
" PFParticleHitDumper::FillRecoWires(...) " << std::endl;
429 iterEnd = particlesToTracks.end();
437 if (!trackVector.empty()) {
439 std::cout <<
" Warning: Found particle with more than one associated track " << std::endl;
445 <<
" Trajectory Points)" << std::endl;
479 if (particleVector.empty()) {
m_pReco3D->Fill(); }
484 for (
unsigned int i = 0; i < particleVector.size(); ++i) {
486 theParticleMap[particle->
Self()] = particle;
491 iterEnd1 = particlesToSpacePoints.end();
503 const size_t parentID(particle->
Parent());
505 if (theParticleMap.end() == pIter)
507 <<
" PFParticleHitDumper::analyze --- Found particle with ID code";
515 << spacepoints.size() <<
" Space Points)" << std::endl;
517 for (
unsigned int j = 0; j < spacepoints.size(); ++j) {
520 m_x = spacepoint->
XYZ()[0];
521 m_y = spacepoint->
XYZ()[1];
522 m_z = spacepoint->
XYZ()[2];
525 if (spacePointsToHits.end() == iter2)
527 <<
" PFParticleHitDumper::analyze --- Found space point without associated hit";
558 for (
unsigned int i = 0; i < particleVector.size(); ++i) {
573 if (particlesToHitsClusters.end() != pIter2)
m_hitsFromClusters = pIter2->second.size();
580 if (tracksToHits.end() != iter2) {
581 const HitVector& hitVector = iter2->second;
590 if (showersToHits.end() != iter2) {
591 const HitVector& hitVector = iter2->second;
599 <<
" hits from clusters, and its recob::Track/Shower has " 624 if (hitVector.empty()) {
m_pReco2D->Fill(); }
630 for (
unsigned int i = 0; i < hitVector.size(); ++i) {
637 if (hitsToParticles.end() != pIter) {
650 m_x = detProp.ConvertTicksToX(hit->
PeakTime(), wireID.Plane, wireID.TPC, wireID.Cryostat);
672 int signalCounter(0);
674 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()
698 wIterEnd = wireIds.end();
723 auto const xyzStart = theGeometry->
Wire(wireID).
GetStart();
724 const double ay(xyzStart.Y());
725 const double az(xyzStart.Z());
727 auto const xyzEnd = theGeometry->
Wire(wireID).
GetEnd();
728 const double by(xyzEnd.Y());
729 const double bz(xyzEnd.Z());
731 const double ny(by - ay);
732 const double nz(bz - az);
733 const double N2(ny * ny + nz * nz);
735 const double ry(ay - (ay * ny + az * nz) * ny / N2);
736 const double rz(az - (ay * ny + az * nz) * nz / N2);
737 const double sign((rz > 0.0) ? +1.0 : -1.0);
739 return sign * std::sqrt(ry * ry + rz * rz);
745 const unsigned int tpc,
747 const double z)
const 752 return z * std::sin(m_theta) - y * std::cos(m_theta);
758 const unsigned int tpc,
760 const double z)
const 765 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 FillReco2D(const art::Event &event, const HitVector &hitVector, const HitsToPFParticles &hitsToParticles)
Store 2D hits.
double YZtoU(const unsigned int cstat, const unsigned int tpc, const double y, const double z) const
Convert from (Y,Z) to U coordinate.
void analyze(const art::Event &evt)
std::vector< WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
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
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.
Point_t const & LocationAtPoint(size_t i) const
Access to track position at different points.
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.
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.
std::vector< art::Ptr< recob::Shower > > ShowerVector
WireID_t Wire
Index of the wire within its plane.
TTree * m_pRecoComparison
geo::WireID const & WireID() const
Initial tdc tick for hit.
void FillRecoWires(const art::Event &event, const WireVector &wireVector)
Store raw data.
std::string m_calwireLabel
WireGeo const & Wire(WireID const &wireid) const
Returns the specified wire.
EDAnalyzer(fhicl::ParameterSet const &pset)
Point_t GetStart() const
Returns the world coordinate of one end of the wire [cm].
Point_t GetEnd() const
Returns the world coordinate of one end of the wire [cm].
std::map< art::Ptr< recob::PFParticle >, TrackVector > PFParticlesToTracks
double GetUVW(const geo::WireID &wireID) const
Conversion from wire ID to U/V/W coordinate.
std::map< int, art::Ptr< recob::PFParticle > > PFParticleMap
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.
double WireAngleToVertical(View_t view, TPCID const &tpcid) const
Returns the angle of the wires in the specified view from vertical.
bool m_printDebug
switch for print statements (TODO: use message service!)
std::map< art::Ptr< recob::PFParticle >, ShowerVector > PFParticlesToShowers
#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)
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
PFParticleHitDumper(fhicl::ParameterSet const &pset)
Constructor.
std::map< art::Ptr< recob::Shower >, HitVector > ShowersToHits
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.
T get(std::string const &key) const
std::vector< art::Ptr< recob::SpacePoint > > SpacePointVector
std::map< art::Ptr< recob::PFParticle >, HitVector > PFParticlesToHits
void FillReco3D(const PFParticleVector &particleVector, const PFParticlesToSpacePoints &particlesToSpacePoints, const SpacePointsToHits &spacePointsToHits)
Store 3D hits.
Provides recob::Track data product.
bool IsPrimary() const
Returns whether the particle is the root of the flow.
const Double32_t * XYZ() const
std::vector< art::Ptr< recob::Track > > TrackVector
std::string m_spacepointLabel
The data type to uniquely identify a TPC.
PlaneID_t Plane
Index of the plane within its TPC.
std::map< art::Ptr< recob::PFParticle >, SpacePointVector > PFParticlesToSpacePoints
Declaration of cluster object.
std::map< art::Ptr< recob::Track >, HitVector > TracksToHits
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.
Definition of data types for geometry description.
static void CollectPFParticles(const art::Event &evt, const std::string &label, PFParticleVector &particleVector)
Collect the reconstructed PFParticles from the ART event record.
std::string m_clusterLabel
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.
void FillRecoTracks(const PFParticlesToTracks &particlesToTracks)
Store 3D track hits.
float PeakTime() const
Time of the signal peak, in tick units.
std::vector< art::Ptr< recob::Hit > > HitVector
Utility object to perform functions of association.
Encapsulate the construction of a single detector plane.
std::vector< art::Ptr< recob::Wire > > WireVector
std::map< art::Ptr< recob::Hit >, art::Ptr< recob::PFParticle > > HitsToPFParticles
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
EventNumber_t event() const
Declaration of basic channel signal object.
int m_hitsFromSpacePoints
std::string m_particleLabel
TPCID_t TPC
Index of the TPC within its cryostat.
helper function for LArPandoraInterface producer module
std::string m_showerLabel
art framework interface to geometry description
std::map< art::Ptr< recob::SpacePoint >, art::Ptr< recob::Hit > > SpacePointsToHits
cet::coded_exception< error, detail::translate > exception
Event finding and building.
Encapsulate the construction of a single detector plane.