820 auto recoTracks =
evt.getValidHandle<std::vector<recob::Track>>(
fTrackTag);
821 auto recoShowers =
evt.getValidHandle<std::vector<recob::Shower>>(
fShowerTag);
822 art::FindManyP<recob::Hit> findHitsFromShowers(recoShowers,
evt,
fShowerTag);
823 art::FindManyP<recob::Hit> findHitsFromTracks(recoTracks,
evt,
fTrackTag);
825 std::vector<art::Ptr<recob::Hit>> pfpHits;
826 std::vector<anab::Calorimetry> calovector;
828 if(thisTrack != 0x0) {
829 pfpHits = findHitsFromTracks.at(thisTrack->
ID());
832 }
else if(thisShower != 0x0) {
833 pfpHits = findHitsFromShowers.at(thisShower->
ID());
853 for(
size_t k = 0;
k < calovector.size() &&
k<3;
k++){
854 int plane = calovector[
k].PlaneID().Plane;
855 if(plane !=2 )
continue;
859 for(
size_t l=0;
l<calovector[
k].dEdx().size() &&
l<
NMAXHITS; ++
l){
863 const auto &
pos=(calovector[
k].XYZ())[
l];
875 std::array<float,4> cnn_out = hitResults.getOutput(
hit );
876 const double p_trk_or_sh = cnn_out[ hitResults.getIndex(
"track") ]+ cnn_out[ hitResults.getIndex(
"em") ];
877 const double cnn_score = cnn_out[ hitResults.getIndex(
"em") ]/p_trk_or_sh;
882 std::cout <<
"Pandora track: " << thisTrack <<
", shower: " << thisShower <<
'\n';
889 if(thisTrack != 0x0){
913 else if(thisShower != 0x0){
931 auto recoParticleHandle =
evt.getHandle<std::vector<recob::PFParticle>>(
fPFParticleTag);
932 if( !recoParticleHandle )
return;
938 if(daughter == 0x0)
continue;
946 std::vector<art::Ptr<recob::Hit>> pfpDHits;
947 std::vector<anab::Calorimetry> dcalovector;
948 if(daughterTrack != 0x0) {
949 pfpDHits = findHitsFromTracks.at( daughterTrack->
ID() );
951 }
else if(daughterShower != 0x0) {
952 pfpDHits = findHitsFromShowers.at( daughterShower->
ID() );
955 if(dcalovector.size() != 3 &&
fVerbose > 0) {
956 std::cerr <<
"WARNING::Calorimetry vector size for track is = " << dcalovector.size() <<
std::endl;
960 std::map<int, double> calo_hit_dQdx;
961 std::map<int, double> calo_hit_pitch;
962 for(
size_t k = 0;
k < dcalovector.size() &&
k<3;
k++){
963 int plane = dcalovector[
k].PlaneID().Plane;
964 if(plane !=2 )
continue;
965 for(
size_t l=0;
l<dcalovector[
k].dEdx().size() &&
l<
NMAXHITS; ++
l){
968 calo_hit_dQdx[dcalovector[
k].TpIndices()[
l]] = dcalovector[
k].dQdx()[
l];
969 calo_hit_pitch[dcalovector[
k].TpIndices()[
l]] = dcalovector[
k].TrkPitchVec()[
l];
973 if(daughterShower != 0) {
974 const TVector3 hitvec(pos.X(), pos.Y(), pos.Z());
984 art::FindManyP<recob::SpacePoint> spFromHits(pfpDHits,
evt,
fHitTag);
986 unsigned rec_hiti = 0;
987 for(
unsigned i = 0; i < pfpDHits.size() && rec_hiti <
NMAXHITS; ++i){
988 if(pfpDHits[i]->
WireID().Plane != 2)
continue;
991 TVector3 xyzWire = pwire->
GetCenter<TVector3>();
996 std::vector<art::Ptr<recob::SpacePoint>> sps = spFromHits.at(i);
1004 std::array<float,4> cnn_out = hitResults.getOutput( pfpDHits[i] );
1005 const double p_trk_or_sh = cnn_out[ hitResults.getIndex(
"track") ]+ cnn_out[ hitResults.getIndex(
"em") ];
1006 const double cnn_score = cnn_out[ hitResults.getIndex(
"em") ]/p_trk_or_sh;
1012 TVector3 objdir(0,0,0);
1013 if(daughterTrack != 0x0) {
1017 }
else if(daughterShower != 0x0) {
1020 TVector3 hitdir = objdir.Unit();
1021 if(objdir.Mag2() != 0 && hitpos[1] != -999.0) {
1024 objdir = objdir.Unit();
1025 TVector3 hitend = hitpos + objdir * (wirePitch/objdir.Z());
1031 hitpos += TVector3(poscorr.X(), poscorr.Y(), poscorr.Z());
1032 hitend += TVector3(endcorr.X(), endcorr.Y(), endcorr.Z());
1034 hitdir = (hitend-hitpos).Unit();
1052 if(daughterTrack != 0x0) {
1071 }
else if(daughterShower != 0x0) {
1106 if(parent->
Mother() != 0) {
double E(const int i=0) const
int fprimaryDaughterIstrack[NMAXDAUGHTERS]
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
const TVector3 & ShowerStart() const
const TLorentzVector & Position(const int i=0) const
const std::vector< const recob::Hit * > GetRecoShowerHits(const recob::Shower &shower, art::Event const &evt, const std::string showerModule) const
Get the hits from a given reco shower.
double EndMomentum() const
std::string fShowerCaloTag
std::vector< double > EstimateEnergyFromHitCharge(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const std::vector< const recob::Hit * > &hits, calo::CalorimetryAlg caloAlg)
double fprimaryDaughterStartDirection[NMAXDAUGHTERS][3]
std::vector< anab::T0 > GetPFParticleT0(const recob::PFParticle &particle, art::Event const &evt, std::string particleLabel) const
Get the T0(s) from a given PFParticle.
int NumDaughters() const
Returns the number of daughter particles flowing from this one.
double fprimaryEndDirection[3]
double fprimaryKineticEnergy[3]
double fprimaryDaughterEnergyFromHits[NMAXDAUGHTERS]
geo::GeometryCore const * fGeometryService
const TLorentzVector & EndPosition() const
double fprimaryEndMomentum
const recob::Shower * GetPFParticleShower(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string showerLabel) const
Get the shower associated to this particle. Returns a null pointer if not found.
spacecharge::SpaceChargeService::provider_type const * fSCEService
double fprimaryDaughterCaloHitdQdx[NMAXDAUGHTERS][NMAXHITS]
virtual geo::Vector_t GetCalPosOffsets(geo::Point_t const &point, int const &TPCid) const =0
int fprimaryShowerBestPlane
const simb::MCParticle * TrackIdToParticle_P(int id) const
int fprimaryDaughterNHits[NMAXDAUGHTERS]
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
std::vector< anab::Calorimetry > GetRecoTrackCalorimetry(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string caloModule) const
Get the Calorimetry(s) from a given reco track.
std::vector< anab::Calorimetry > GetRecoShowerCalorimetry(const recob::Shower &shower, art::Event const &evt, const std::string showerModule, const std::string caloModule) const
Get shower calo info.
std::string fCalorimetryTag
std::string fPFParticleTag
double fprimaryEndPosition[3]
double fprimaryDaughterCaloHitPitch[NMAXDAUGHTERS][NMAXHITS]
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
int fprimaryDaughterParentEndProcess[NMAXDAUGHTERS]
double fprimaryDaughterParentEnd[NMAXDAUGHTERS][3]
geo::Length_t WirePitch(geo::PlaneID const &planeid) const
Returns the distance between two consecutive wires.
double fprimaryStartDirection[3]
int fprimaryDaughterGrandparentPdg[NMAXDAUGHTERS]
double fprimaryDaughterHitTime[NMAXDAUGHTERS][NMAXHITS]
double fprimary_cal_pos[NMAXHITS][3]
double fprimaryDaughterParentE[NMAXDAUGHTERS]
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
const simb::MCParticle * GetMCParticleFromReco(detinfo::DetectorClocksData const &clockData, const recob::PFParticle &pfpart, art::Event const &evt, std::string pfparticleModule) const
protoana::ProtoDUNETrackUtils trackUtil
double fprimary_cal_pitch[NMAXHITS]
double dEdx(float dqdx, float Efield)
double Length(size_t p=0) const
Access to various track properties.
double fprimaryOpeningAngle
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::string EndProcess() const
int fprimaryDaughterParentPdg[NMAXDAUGHTERS]
int fprimaryDaughterParentID[NMAXDAUGHTERS]
double fprimaryDaughterEndPosition[NMAXDAUGHTERS][3]
double Theta() const
Access to spherical or geographical angles at vertex or at any point.
int fprimaryDaughterNCollHits[NMAXDAUGHTERS]
const recob::Track * GetPFParticleTrack(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Get the track associated to this particle. Returns a null pointer if not found.
double fprimaryDaughterHitPosition[NMAXDAUGHTERS][NMAXHITS][3]
int fprimaryIsBeamparticle
double fprimaryDaughterEndDirection[NMAXDAUGHTERS][3]
const simb::MCParticle * GetMCParticleFromRecoTrack(detinfo::DetectorClocksData const &clockData, const recob::Track &track, art::Event const &evt, std::string trackModule) const
const TVector3 & Direction() const
int fprimaryDaughterHitWire[NMAXDAUGHTERS][NMAXHITS]
int fprimaryDaughterID[NMAXDAUGHTERS]
double fprimaryDaughterGrandparentE[NMAXDAUGHTERS]
protoana::ProtoDUNETruthUtils truthUtil
double fprimaryDaughterLength[NMAXDAUGHTERS]
double fprimaryDaughterCNNScore[NMAXDAUGHTERS]
double fprimaryDaughterOwnHitPitch[NMAXDAUGHTERS][NMAXHITS]
Detector simulation of raw signals on wires.
double fprimaryDaughterHitCharge[NMAXDAUGHTERS][NMAXHITS]
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Vector_t EndDirection() const
Returns the direction of the trajectory at the last point.
double fprimaryResidualRange[NMAXHITS]
double Vx(const int i=0) const
virtual bool EnableCalSpatialSCE() const =0
double fprimarydQdx[NMAXHITS]
protoana::ProtoDUNEPFParticleUtils pfpUtil
double StartMomentum() const
Hierarchical representation of particle flow.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Point_t const & End() const
Returns the position of the last valid point of the trajectory [cm].
double fprimaryDaughterBDTScore[NMAXDAUGHTERS]
double fprimaryDaughterGrandparentEnd[NMAXDAUGHTERS][3]
int fprimaryDaughterIsshower[NMAXDAUGHTERS]
double fprimaryDaughterStartPosition[NMAXDAUGHTERS][3]
double fprimaryDaughterEndMomentum[NMAXDAUGHTERS]
protoana::ProtoDUNEShowerUtils showerUtil
double fprimaryStartPosition[3]
double fprimaryTruth_vtx[3]
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
const simb::MCParticle * GetMCParticleFromRecoShower(detinfo::DetectorClocksData const &clockData, const recob::Shower &shower, art::Event const &evt, std::string showerModule) const
Vector_t StartDirection() const
Returns the direction of the trajectory at the first point.
recob::tracking::Plane Plane
double fprimaryDaughterMomentum[NMAXDAUGHTERS]
Point_t const & Start() const
Returns the position of the first valid point of the trajectory [cm].
float GetBeamCosmicScore(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Access the BDT output used to decide if a slice is beam-like or cosmic-like.
int fprimaryDaughterGrandparentID[NMAXDAUGHTERS]
def parent(G, child, parent_type)
double Vy(const int i=0) const
calo::CalorimetryAlg fCalorimetryAlg
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
double fprimaryDaughterParentStart[NMAXDAUGHTERS][3]
QTextStream & endl(QTextStream &s)
double fprimarydEdx[NMAXHITS]
double fprimaryDaughterGrandparentStart[NMAXDAUGHTERS][3]
size_t Daughter(size_t idx) const
Returns the ID of the specified daughter.
WireGeo const * WirePtr(geo::WireID const &wireid) const
Returns the specified wire.