115 double YZtoU(
const unsigned int cstat,
116 const unsigned int tpc,
118 const double z)
const;
128 double YZtoV(
const unsigned int cstat,
129 const unsigned int tpc,
131 const double z)
const;
184 #include "art_root_io/TFileDirectory.h" 185 #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;
368 LArPandoraHelper::DaughterMode::kUseDaughters,
375 if (
m_printDebug) std::cout <<
" PFParticles: " << particleVector.size() << std::endl;
379 if (
m_printDebug) std::cout <<
" PFParticleHitDumper::FillRecoTracks(...) " << std::endl;
384 if (
m_printDebug) std::cout <<
" PFParticleHitDumper::FillReco3D(...) " << std::endl;
385 this->
FillReco3D(particleVector, particlesToSpacePoints, spacePointsToHits);
389 if (
m_printDebug) std::cout <<
" PFParticleHitDumper::FillReco2D(...) " << std::endl;
390 this->
FillReco2D(evt, hitVector, hitsToParticles);
395 std::cout <<
" PFParticleHitDumper::FillAssociated2DHits(...) " << std::endl;
399 particlesToHitsClusters,
407 if (
m_printDebug) std::cout <<
" PFParticleHitDumper::FillRecoWires(...) " << std::endl;
426 iterEnd = particlesToTracks.end();
434 if (!trackVector.empty()) {
436 std::cout <<
" Warning: Found particle with more than one associated track " << std::endl;
442 <<
" Trajectory Points)" << std::endl;
476 if (particleVector.empty()) {
m_pReco3D->Fill(); }
481 for (
unsigned int i = 0; i < particleVector.size(); ++i) {
483 theParticleMap[particle->
Self()] = particle;
488 iterEnd1 = particlesToSpacePoints.end();
500 const size_t parentID(particle->
Parent());
502 if (theParticleMap.end() == pIter)
504 <<
" PFParticleHitDumper::analyze --- Found particle with ID code";
512 << spacepoints.size() <<
" Space Points)" << std::endl;
514 for (
unsigned int j = 0; j < spacepoints.size(); ++j) {
517 m_x = spacepoint->
XYZ()[0];
518 m_y = spacepoint->
XYZ()[1];
519 m_z = spacepoint->
XYZ()[2];
522 if (spacePointsToHits.end() == iter2)
524 <<
" PFParticleHitDumper::analyze --- Found space point without associated hit";
555 for (
unsigned int i = 0; i < particleVector.size(); ++i) {
570 if (particlesToHitsClusters.end() != pIter2)
m_hitsFromClusters = pIter2->second.size();
577 if (tracksToHits.end() != iter2) {
578 const HitVector& hitVector = iter2->second;
587 if (showersToHits.end() != iter2) {
588 const HitVector& hitVector = iter2->second;
596 <<
" hits from clusters, and its recob::Track/Shower has " 621 if (hitVector.empty()) {
m_pReco2D->Fill(); }
627 for (
unsigned int i = 0; i < hitVector.size(); ++i) {
634 if (hitsToParticles.end() != pIter) {
647 m_x = detProp.ConvertTicksToX(hit->
PeakTime(), wireID.Plane, wireID.TPC, wireID.Cryostat);
666 int signalCounter(0);
669 for (
unsigned int i = 0; i < wireVector.size(); ++i) {
672 const std::vector<float>& signals(wire->
Signal());
673 const std::vector<geo::WireID> wireIds = wireReadoutGeom.ChannelToWire(wire->
Channel());
676 std::cout <<
" numWires=" << wireVector.size() <<
" numSignals=" << signals.size()
693 wIterEnd = wireIds.end();
718 auto const xyzStart = wireReadoutGeom.Wire(wireID).GetStart();
719 const double ay(xyzStart.Y());
720 const double az(xyzStart.Z());
722 auto const xyzEnd = wireReadoutGeom.Wire(wireID).GetEnd();
723 const double by(xyzEnd.Y());
724 const double bz(xyzEnd.Z());
726 const double ny(by - ay);
727 const double nz(bz - az);
728 const double N2(ny * ny + nz * nz);
730 const double ry(ay - (ay * ny + az * nz) * ny / N2);
731 const double rz(az - (ay * ny + az * nz) * nz / N2);
732 const double sign((rz > 0.0) ? +1.0 : -1.0);
734 return sign * std::sqrt(ry * ry + rz * rz);
740 const unsigned int tpc,
742 const double z)
const 746 const double m_theta(wireReadoutGeom.WireAngleToVertical(
geo::kU,
geo::TPCID{cstat, tpc}));
747 return z * std::sin(m_theta) - y * std::cos(m_theta);
753 const unsigned int tpc,
755 const double z)
const 759 const double m_theta(wireReadoutGeom.WireAngleToVertical(
geo::kV,
geo::TPCID{cstat, tpc}));
760 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)
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.
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
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
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.
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
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.
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 .
Provides recob::Track data product.
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
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 .