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" 244 m_pRecoTracks = tfs->make<TTree>(
"pandoraTracks",
"LAr Reco Tracks");
252 m_pReco3D = tfs->make<TTree>(
"pandora3D",
"LAr Reco 3D");
267 m_pReco2D = tfs->make<TTree>(
"pandora2D",
"LAr Reco 2D");
280 m_pRecoComparison = tfs->make<TTree>(
"pandora2Dcomparison",
"LAr Reco 2D (comparison)");
291 m_pRecoWire = tfs->make<TTree>(
"rawdata",
"LAr Reco Wires");
376 LArPandoraHelper::DaughterMode::kUseDaughters,
393 this->
FillReco3D(particleVector, particlesToSpacePoints, spacePointsToHits);
398 this->
FillReco2D(evt, hitVector, hitsToParticles);
403 std::cout <<
" PFParticleHitDumper::FillAssociated2DHits(...) " <<
std::endl;
407 particlesToHitsClusters,
435 iterEnd = particlesToTracks.end();
443 if (!trackVector.empty()) {
445 std::cout <<
" Warning: Found particle with more than one associated track " <<
std::endl;
486 if (particleVector.empty()) {
m_pReco3D->Fill(); }
491 for (
unsigned int i = 0; i < particleVector.size(); ++i) {
493 theParticleMap[particle->
Self()] = particle;
498 iterEnd1 = particlesToSpacePoints.end();
510 const size_t parentID(particle->
Parent());
512 if (theParticleMap.end() == pIter)
514 <<
" PFParticleHitDumper::analyze --- Found particle with ID code";
522 << spacepoints.size() <<
" Space Points)" <<
std::endl;
524 for (
unsigned int j = 0; j < spacepoints.size(); ++j) {
527 m_x = spacepoint->
XYZ()[0];
528 m_y = spacepoint->
XYZ()[1];
529 m_z = spacepoint->
XYZ()[2];
532 if (spacePointsToHits.end() == iter2)
534 <<
" PFParticleHitDumper::analyze --- Found space point without associated hit";
566 for (
unsigned int i = 0; i < particleVector.size(); ++i) {
581 if (particlesToHitsClusters.end() != pIter2)
m_hitsFromClusters = pIter2->second.size();
588 if (tracksToHits.end() != iter2) {
589 const HitVector& hitVector = iter2->second;
598 if (showersToHits.end() != iter2) {
599 const HitVector& hitVector = iter2->second;
607 <<
" hits from clusters, and its recob::Track/Shower has " 633 if (hitVector.empty()) {
m_pReco2D->Fill(); }
639 for (
unsigned int i = 0; i < hitVector.size(); ++i) {
646 if (hitsToParticles.end() != pIter) {
659 m_x = detProp.ConvertTicksToX(hit->
PeakTime(), wireID.Plane, wireID.TPC, wireID.Cryostat);
682 int signalCounter(0);
684 for (
unsigned int i = 0; i < wireVector.size(); ++i) {
687 const std::vector<float>& signals(wire->
Signal());
691 std::cout <<
" numWires=" << wireVector.size() <<
" numSignals=" << signals.size()
708 wIterEnd = wireIds.end();
740 const double ay(xyzStart[1]);
741 const double az(xyzStart[2]);
749 const double by(xyzEnd[1]);
750 const double bz(xyzEnd[2]);
752 const double ny(by - ay);
753 const double nz(bz - az);
754 const double N2(ny * ny + nz * nz);
756 const double ry(ay - (ay * ny + az * nz) * ny / N2);
757 const double rz(az - (ay * ny + az * nz) * nz / N2);
758 const double sign((rz > 0.0) ? +1.0 : -1.0);
760 return sign * std::sqrt(ry * ry + rz * rz);
767 const unsigned int tpc,
769 const double z)
const 774 return z * std::sin(m_theta) - y * std::cos(m_theta);
781 const unsigned int tpc,
783 const double z)
const 788 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.
void GetStart(double *xyz) const
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)
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
geo::WireID WireID() const
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
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.
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.
std::vector< art::Ptr< recob::Shower > > ShowerVector
WireID_t Wire
Index of the wire within its plane.
TTree * m_pRecoComparison
void FillRecoWires(const art::Event &event, const WireVector &wireVector)
Store raw data.
std::string m_calwireLabel
EDAnalyzer(fhicl::ParameterSet const &pset)
std::map< art::Ptr< recob::PFParticle >, TrackVector > PFParticlesToTracks
double GetUVW(const geo::WireID &wireID) const
Conversion from wire ID to U/V/W coordinate.
art framework interface to geometry description
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.
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
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.
std::vector< art::Ptr< recob::Track > > TrackVector
std::string m_spacepointLabel
PlaneID_t Plane
Index of the plane within its TPC.
std::map< art::Ptr< recob::PFParticle >, SpacePointVector > PFParticlesToSpacePoints
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
Declaration of signal hit object.
Encapsulate the construction of a single detector plane.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
std::vector< art::Ptr< recob::Wire > > WireVector
void GetEnd(double *xyz) const
std::map< art::Ptr< recob::Hit >, art::Ptr< recob::PFParticle > > HitsToPFParticles
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
Provides recob::Track data product.
const Double32_t * XYZ() const
EventNumber_t event() const
Declaration of basic channel signal object.
int m_hitsFromSpacePoints
std::string m_particleLabel
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
std::map< art::Ptr< recob::SpacePoint >, art::Ptr< recob::Hit > > SpacePointsToHits
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
Event finding and building.
Encapsulate the construction of a single detector plane.