234 std::vector<art::Ptr<recob::Hit> > allHits;
235 auto hitHandle =
e.getHandle<std::vector<recob::Hit>>(
fHitLabel);
240 std::map<int,int> trueParticleHits, trueParticleHitsView0, trueParticleHitsView1, trueParticleHitsView2;
241 for (
const auto&
hit: allHits){
244 trueParticleHits[g4ID]++;
245 if(
hit->View()==0)trueParticleHitsView0[g4ID]++;
246 if(
hit->View()==1)trueParticleHitsView1[g4ID]++;
247 if(
hit->View()==2)trueParticleHitsView2[g4ID]++;
257 bool isMCPrimary(
false);
258 for(
unsigned int iMc=0; iMc< mcParticles->size(); iMc++){
269 trueParticle.
Process()==
"primary"? isMCPrimary=
true:isMCPrimary=
false;
301 std::cout <<
"No PFParticles found!" <<
std::endl;
306 std::vector<art::Ptr<recob::Cluster>> clusterVect;
307 auto clusterHandle =
e.getHandle<std::vector<recob::Cluster> >(
fPFParticleLabel);
311 art::FindManyP<recob::Cluster> clusterParticleAssoc(pfparticleVect,
e,
fPFParticleLabel);
313 auto trackHandle =
e.getHandle<std::vector<recob::Track> >(
fTrackLabel);
315 std::cout<<
"Unable to find std::vector<recob::Track> with module label: " <<
fTrackLabel <<
std::endl;
318 std::vector<art::Ptr<recob::Track> > trackList;
331 std::vector<art::Ptr<recob::Cluster>> pfpClusters = clusterParticleAssoc.at(pfp.key());
333 if(!pfpClusters.empty()){
336 fPFPCluPlane[iPfp][iClu]=clu->Plane().asPlaneID().Plane;
346 std::vector<art::Ptr<recob::Hit>> pfpHits;
389 if(!
e.isRealData()) {
469 if(!
e.isRealData()) {
518 if(!
e.isRealData()) {
520 for (
const auto&
hit: pfpHits){
double E(const int i=0) const
bool fPFPIsShower[kNMaxPFParticles]
static art::Ptr< recob::Track > GetTrack(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &trackLabel)
Get the track associated to this particle. Should only be called if IsTrack method succeeds...
int fPFPTrueParticleMatchedIDView[kNMaxPFParticles][kNViews]
unsigned int NumberTrajectoryPoints() const
const TVector3 & ShowerStart() const
const TLorentzVector & Position(const int i=0) const
double fPFPTrackStartX[kNMaxPFParticles]
double fPFPShowerDirectionErrZ[kNMaxPFParticles]
int fPFPParentID[kNMaxPFParticles]
double fPFPTrackLength[kNMaxPFParticles]
float fPFPTrackChi2[kNMaxPFParticles]
const TLorentzVector & EndPosition() const
double fMCParticleEndMomentumX[kNMaxMCParticles]
double fMCParticleEndPositionT[kNMaxMCParticles]
int fPFPNClusters[kNMaxPFParticles]
bool fPFPIsTrack[kNMaxPFParticles]
double fPFPTrackEndX[kNMaxPFParticles]
double fMCParticleEndMomentumY[kNMaxMCParticles]
int fPFPID[kNMaxPFParticles]
double fPFPTrackStartDirectionX[kNMaxPFParticles]
double fPFPTrackAzimuthAngle[kNMaxPFParticles]
double fPFPTrackTheta[kNMaxPFParticles]
double fPFPTrackEndDirectionY[kNMaxPFParticles]
static bool IsShower(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &showerLabel)
Check if this particle has an associated shower.
bool fPFPIsPrimary[kNMaxPFParticles]
G4ID TrueParticleID(detinfo::DetectorClocksData const &clockData, const art::Ptr< recob::Hit > &pHit, const bool rollupUnsavedIDs)
The G4 ID of the true particle which deposits the most energy in the recob::Hit.
double fPFPTrackEndDirectionX[kNMaxPFParticles]
Vector_t VertexDirection() const
double fPFPShowerDirectionErrY[kNMaxPFParticles]
double fPFPTrackEndY[kNMaxPFParticles]
int fPFPTrueParticleMatchedPosition[kNMaxPFParticles]
const TVector3 & ShowerStartErr() const
double ZenithAngle() const
int fPFPNChildren[kNMaxPFParticles]
static std::vector< art::Ptr< recob::Hit > > GetViewHits(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label, const unsigned short &view)
Get the hits associated to this particle in a given view.
double fPFPPurityView[kNMaxMCParticles][kNViews]
double fMCParticleEndPositionY[kNMaxMCParticles]
int fMCParticleNTrajectoryPoint[kNMaxMCParticles]
int fPFPPdgCode[kNMaxPFParticles]
std::string Process() const
double fMCParticleEndTime[kNMaxMCParticles]
void reset(bool deepClean=false)
static std::vector< art::Ptr< recob::Hit > > GetHits(const art::Ptr< recob::Track > &pTrack, const art::Event &evt, const std::string &label)
Get the hits associated with the track.
double fPFPTrackStartDirectionZ[kNMaxPFParticles]
int fPFPTrueParticleMatchedID[kNMaxPFParticles]
double fPFPTrackVertexZ[kNMaxPFParticles]
std::string fMCParticleEndProcess[kNMaxMCParticles]
double fMCParticleStartPositionX[kNMaxMCParticles]
int fPFPTrueParticleMatchedPositionView[kNMaxPFParticles][kNViews]
static art::Ptr< recob::Shower > GetShower(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &showerLabel)
Get the shower associated to this particle. Should only be called if IsShower method succeeds...
double fPFPCluIntegral[kNMaxPFParticles][kNMaxPFPClusters]
int fMCParticleParentTrackID[kNMaxMCParticles]
double fPFPShowerStartZ[kNMaxPFParticles]
double fPFPShowerStartErrZ[kNMaxPFParticles]
double fMCParticleStartMomentumZ[kNMaxMCParticles]
double fPFPShowerStartErrY[kNMaxPFParticles]
double fPFPTrackVertexY[kNMaxPFParticles]
int fMCParticlePdgCode[kNMaxMCParticles]
double fPFPShowerDirectionY[kNMaxPFParticles]
Vector_t StartDirection() const
Access to track direction at different points.
double Length(size_t p=0) const
Access to various track properties.
double fMCParticleStartPositionZ[kNMaxMCParticles]
double fPFPTrackStartZ[kNMaxPFParticles]
std::string EndProcess() const
Point_t const & Start() const
Access to track position at different points.
double fPFPShowerDirectionX[kNMaxPFParticles]
double fMCParticleEndPositionX[kNMaxMCParticles]
double Theta() const
Access to spherical or geographical angles at vertex or at any point.
std::string fMCParticleStartProcess[kNMaxMCParticles]
double fPFPPurity[kNMaxMCParticles]
static const int kNMaxPFPClusters
Point_t const & Vertex() const
int fPFPNSharedTrueParticleHits[kNMaxPFParticles]
int fPFPShowerBestPlane[kNMaxPFParticles]
double fPFPTrackEndZ[kNMaxPFParticles]
double fMCParticleEndMomentumZ[kNMaxMCParticles]
double T(const int i=0) const
int fPFPTrackID[kNMaxPFParticles]
double fPFPShowerDirectionErrX[kNMaxPFParticles]
double fMCParticleStartPositionT[kNMaxMCParticles]
const TVector3 & DirectionErr() const
double fMCParticleStartMomentumE[kNMaxMCParticles]
double fPFPTrackVertexX[kNMaxPFParticles]
const TVector3 & Direction() const
double fPFPTrackZenithAngle[kNMaxPFParticles]
int fMCParticleNHitsView[kNMaxMCParticles][kNViews]
int fPFPTrackNdof[kNMaxPFParticles]
double fPFPTrackEndDirectionZ[kNMaxPFParticles]
int fPFPShowerID[kNMaxPFParticles]
double fPFPTrackVertexDirectionZ[kNMaxPFParticles]
int fMCParticleTrackID[kNMaxMCParticles]
double fPFPTrackStartDirectionY[kNMaxPFParticles]
Detector simulation of raw signals on wires.
bool Valid(const G4ID g4ID) noexcept
Test whether a G4ID returned by the TruthMatchUtils functions is valid.
double fMCParticleEndMomentumE[kNMaxMCParticles]
double fPFPCompleteness[kNMaxMCParticles]
double fPFPShowerOpenAngle[kNMaxPFParticles]
int fPFPNSharedTrueParticleHitsView[kNMaxPFParticles][kNViews]
double fPFPTrackVertexDirectionY[kNMaxPFParticles]
double fPFPShowerStartX[kNMaxPFParticles]
static std::vector< art::Ptr< recob::Hit > > GetHits(const art::Ptr< recob::Shower > &pShower, const art::Event &evt, const std::string &label)
Get the hits associated with the shower.
double fMCParticleTrueEnergy[kNMaxMCParticles]
double AzimuthAngle() const
unsigned int fNMCParticles
Vector_t EndDirection() const
const TLorentzVector & Momentum(const int i=0) const
double fPFPTrackVertexDirectionX[kNMaxPFParticles]
double fMCParticleVertexTime[kNMaxMCParticles]
bool fMCIsPrimary[kNMaxMCParticles]
double fPFPTrackStartY[kNMaxPFParticles]
G4ID TrueParticleIDFromTotalRecoHits(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit >> &pHits, const bool rollupUnsavedIDs)
The G4 ID of the true particle who has been truth-matched to the most hits in a recob::Hit vector...
Point_t const & End() const
static bool IsTrack(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &trackLabel)
Check if this particle has an associated track.
double fPFPShowerStartErrX[kNMaxPFParticles]
double fPFPCompletenessView[kNMaxMCParticles][kNViews]
double fPFPShowerLength[kNMaxPFParticles]
double fMCParticleEndPositionZ[kNMaxMCParticles]
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
double fMCParticleStartMomentumX[kNMaxMCParticles]
int fPFPCluPlane[kNMaxPFParticles][kNMaxPFPClusters]
int fPFPNHitsView[kNMaxPFParticles][kNViews]
int fPFPCluView[kNMaxPFParticles][kNMaxPFPClusters]
std::string fPFParticleLabel
static std::vector< art::Ptr< recob::PFParticle > > GetPFParticles(const art::Event &evt, const std::string &label)
Get the particles from the event.
int fMCParticleNHits[kNMaxMCParticles]
const TLorentzVector & EndMomentum() const
int fPFPCluNHits[kNMaxPFParticles][kNMaxPFPClusters]
double fPFPShowerDirectionZ[kNMaxPFParticles]
QTextStream & endl(QTextStream &s)
unsigned int fNPFParticles
double fPFPShowerStartY[kNMaxPFParticles]
double fMCParticleStartPositionY[kNMaxMCParticles]
double fPFPTrackPhi[kNMaxPFParticles]
double fMCParticleStartMomentumY[kNMaxMCParticles]
int fPFPNHits[kNMaxPFParticles]