20 #include "art_root_io/TFileService.h" 24 #include "canvas/Persistency/Common/FindManyP.h" 46 #include <TLorentzVector.h> 73 void reset(
bool deepClean=
false);
234 std::vector<art::Ptr<recob::Hit> > allHits;
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;
311 art::FindManyP<recob::Cluster> clusterParticleAssoc(pfparticleVect, e,
fPFParticleLabel);
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;
520 for (
const auto&
hit: pfpHits){
553 fTree = tfs->make<TTree>(
"pandoraOutput",
"Pandora Output Tree");
598 fTree->Branch(
"pfpID",&
fPFPID,
"PFPID[nPFParticles]/I");
774 for (
unsigned int iView = 0; iView <
kNViews; iView++)
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]
Utility containing helpful functions for end users to access information about Tracks.
double fPFPTrackEndX[kNMaxPFParticles]
double fMCParticleEndMomentumY[kNMaxMCParticles]
int fPFPID[kNMaxPFParticles]
double fPFPTrackStartDirectionX[kNMaxPFParticles]
Handle< PROD > getHandle(SelectorBase const &) const
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]
EDAnalyzer(fhicl::ParameterSet const &pset)
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]
const geo::Geometry * fGeom
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]
art framework interface to geometry description
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]
#define DEFINE_ART_MODULE(klass)
double fPFPTrackStartZ[kNMaxPFParticles]
std::string EndProcess() const
Utilities for matching a recob::Hit or vector of recob::Hit to the ID of the most significantly contr...
Point_t const & Start() const
Access to track position at different points.
double fPFPShowerDirectionX[kNMaxPFParticles]
Utility containing helpful functions for end users to access information about Showers.
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]
pandoraAnalysis(fhicl::ParameterSet const &p)
double T(const int i=0) const
int fPFPTrackID[kNMaxPFParticles]
double fPFPShowerDirectionErrX[kNMaxPFParticles]
Utility containing helpful functions for end users to access information about PFParticles.
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
double fMCParticleStartPositionT[kNMaxMCParticles]
const TVector3 & DirectionErr() const
double fMCParticleStartMomentumE[kNMaxMCParticles]
double fPFPTrackVertexX[kNMaxPFParticles]
Utility containing helpful functions for end users to access products from events.
const TVector3 & Direction() const
double fPFPTrackZenithAngle[kNMaxPFParticles]
int fMCParticleNHitsView[kNMaxMCParticles][kNViews]
int fPFPTrackNdof[kNMaxPFParticles]
double fPFPTrackEndDirectionZ[kNMaxPFParticles]
The geometry of one entire detector, as served by art.
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]
Declaration of signal hit object.
double fPFPTrackVertexDirectionY[kNMaxPFParticles]
double fPFPShowerStartX[kNMaxPFParticles]
static const int 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]
Provides recob::Track data product.
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...
EventNumber_t event() const
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]
void analyze(art::Event const &e) override
double fPFPShowerLength[kNMaxPFParticles]
double fMCParticleEndPositionZ[kNMaxMCParticles]
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
double fMCParticleStartMomentumX[kNMaxMCParticles]
pandoraAnalysis & operator=(pandoraAnalysis const &)=delete
int fPFPCluPlane[kNMaxPFParticles][kNMaxPFPClusters]
int fPFPNHitsView[kNMaxPFParticles][kNViews]
int fPFPCluView[kNMaxPFParticles][kNMaxPFPClusters]
helper function for LArPandoraInterface producer module
std::string fPFParticleLabel
Utility functions to extract information from recob::Track
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
SubRunNumber_t subRun() const
static const int kNMaxMCParticles
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]