Static Public Member Functions | List of all members
dune_ana::DUNEAnaEventUtils Class Reference

DUNEAnaEventUtils class. More...

#include <DUNEAnaEventUtils.h>

Inheritance diagram for dune_ana::DUNEAnaEventUtils:
dune_ana::DUNEAnaUtilsBase

Static Public Member Functions

static std::vector< art::Ptr< recob::PFParticle > > GetPFParticles (const art::Event &evt, const std::string &label)
 Get the particles from the event. More...
 
static std::vector< art::Ptr< recob::Track > > GetTracks (const art::Event &evt, const std::string &label)
 Get the tracks from the event. This function shouldn't be used as the basis of an analysis. More...
 
static std::vector< art::Ptr< recob::Shower > > GetShowers (const art::Event &evt, const std::string &label)
 Get the showers from the event. This function shouldn't be used as the basis of an analysis. More...
 
static std::vector< art::Ptr< recob::Vertex > > GetVertices (const art::Event &evt, const std::string &label)
 Get the vertices from the event. More...
 
static std::vector< art::Ptr< recob::Hit > > GetHits (const art::Event &evt, const std::string &label)
 Get the hits from the event. More...
 
static std::vector< art::Ptr< recob::Wire > > GetWires (const art::Event &evt, const std::string &label)
 Get the wires from the event. More...
 
static std::vector< art::Ptr< recob::SpacePoint > > GetSpacePoints (const art::Event &evt, const std::string &label)
 Get the spacepoints from the event. More...
 
static std::vector< art::Ptr< recob::Slice > > GetSlices (const art::Event &evt, const std::string &label)
 Get the slices from the event. More...
 
static std::vector< art::Ptr< simb::MCTruth > > GetMCTruths (const art::Event &evt, const std::string &label)
 Get the MC truths from the event. More...
 
static std::vector< art::Ptr< simb::MCParticle > > GetMCParticles (const art::Event &evt, const std::string &label)
 Get the MC particles from the event. More...
 
static std::vector< art::Ptr< recob::PFParticle > > GetClearCosmics (const art::Event &evt, const std::string &label)
 Get the clear cosmic ray primaries from the event. More...
 
static art::Ptr< recob::PFParticleGetNeutrino (const art::Event &evt, const std::string &label)
 Get the neutrino from the event. More...
 
static bool HasNeutrino (const art::Event &evt, const std::string &label)
 Check to see if the event has a reconstructed neutrino. More...
 
static std::vector< art::Ptr< cvn::Result > > GetCVNResults (const art::Event &evt, const std::string &label)
 Get the CVN result objects from the event. More...
 
static std::vector< art::Ptr< ctp::CTPResult > > GetSquIDResults (const art::Event &evt, const std::string &label)
 Get the SquID track PID result objects from the event. More...
 

Additional Inherited Members

- Static Private Member Functions inherited from dune_ana::DUNEAnaUtilsBase
template<typename T >
static std::vector< art::Ptr< T > > GetProductVector (const art::Event &evt, const std::string &label)
 
template<typename T , typename U >
static std::vector< art::Ptr< T > > GetAssocProductVector (const art::Ptr< U > &part, const art::Event &evt, const std::string &label, const std::string &assocLabel)
 
template<typename T , typename U >
static art::Ptr< T > GetAssocProduct (const art::Ptr< U > &part, const art::Event &evt, const std::string &label, const std::string &assocLabel)
 

Detailed Description

DUNEAnaEventUtils class.

Definition at line 40 of file DUNEAnaEventUtils.h.

Member Function Documentation

std::vector< art::Ptr< recob::PFParticle > > dune_ana::DUNEAnaEventUtils::GetClearCosmics ( const art::Event evt,
const std::string label 
)
static

Get the clear cosmic ray primaries from the event.

Parameters
evtis the underlying art event
labelis the label for the particle producer
Returns
vector of art::Ptrs to cosmic particles

Definition at line 106 of file DUNEAnaEventUtils.cxx.

107 {
108  std::vector<art::Ptr<recob::PFParticle>> theseParticles = DUNEAnaEventUtils::GetProductVector<recob::PFParticle>(evt,label);
109 
110  std::vector<art::Ptr<recob::PFParticle>> theseCosmics;
111 
112  // We only want primary cosmic rays
113  for (art::Ptr<recob::PFParticle> pParticle : theseParticles)
114  {
115  if (!pParticle->IsPrimary())
116  {
117  continue;
118  }
119 
120  if (DUNEAnaPFParticleUtils::IsClearCosmic(pParticle, evt, label))
121  {
122  theseCosmics.push_back(pParticle);
123  }
124  }
125 
126  return theseCosmics;
127 }
static bool IsClearCosmic(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel)
Check if this particle is a clear cosmic ray.
TCEvent evt
Definition: DataStructs.cxx:7
std::vector< art::Ptr< cvn::Result > > dune_ana::DUNEAnaEventUtils::GetCVNResults ( const art::Event evt,
const std::string label 
)
static

Get the CVN result objects from the event.

Parameters
evtis the underlying art event
labelis the label for the cvn evaluator
Returns
vector of art::Ptrs to CVN result objects

Definition at line 174 of file DUNEAnaEventUtils.cxx.

175 {
176  return DUNEAnaEventUtils::GetProductVector<cvn::Result>(evt,label);
177 }
TCEvent evt
Definition: DataStructs.cxx:7
std::vector< art::Ptr< recob::Hit > > dune_ana::DUNEAnaEventUtils::GetHits ( const art::Event evt,
const std::string label 
)
static

Get the hits from the event.

Parameters
evtis the underlying art event
labelis the label for the hit producer
Returns
vector of art::Ptrs to spacepoints

Definition at line 64 of file DUNEAnaEventUtils.cxx.

65 {
66  return DUNEAnaEventUtils::GetProductVector<recob::Hit>(evt,label);
67 }
TCEvent evt
Definition: DataStructs.cxx:7
std::vector< art::Ptr< simb::MCParticle > > dune_ana::DUNEAnaEventUtils::GetMCParticles ( const art::Event evt,
const std::string label 
)
static

Get the MC particles from the event.

Parameters
evtis the underlying art event
labelis the label for the MC particle producer
Returns
vector of art::Ptrs to MC particles

Definition at line 99 of file DUNEAnaEventUtils.cxx.

100 {
101  return DUNEAnaEventUtils::GetProductVector<simb::MCParticle>(evt,label);
102 }
TCEvent evt
Definition: DataStructs.cxx:7
std::vector< art::Ptr< simb::MCTruth > > dune_ana::DUNEAnaEventUtils::GetMCTruths ( const art::Event evt,
const std::string label 
)
static

Get the MC truths from the event.

Parameters
evtis the underlying art event
labelis the label for the MC truth producer
Returns
vector of art::Ptrs to MC truths

Definition at line 92 of file DUNEAnaEventUtils.cxx.

93 {
94  return DUNEAnaEventUtils::GetProductVector<simb::MCTruth>(evt,label);
95 }
TCEvent evt
Definition: DataStructs.cxx:7
art::Ptr< recob::PFParticle > dune_ana::DUNEAnaEventUtils::GetNeutrino ( const art::Event evt,
const std::string label 
)
static

Get the neutrino from the event.

Parameters
evtis the underlying art event
labelis the label for the particle producer
Returns
atr::Ptr to the neutrino

Definition at line 131 of file DUNEAnaEventUtils.cxx.

132 {
133  if (!HasNeutrino(evt,label))
134  {
135  throw cet::exception("DUNEAna") << "DUNEAnaEventUtils::GetNeutrino --- No neutrino found";
136  }
137 
138  art::Ptr<recob::PFParticle> pNeutrino;
139  std::vector<art::Ptr<recob::PFParticle>> particles = DUNEAnaEventUtils::GetPFParticles(evt,label);
140  for (art::Ptr<recob::PFParticle> pParticle : particles)
141  {
142  if (DUNEAnaPFParticleUtils::IsNeutrino(pParticle))
143  {
144  pNeutrino = pParticle;
145  break;
146  }
147  }
148  return pNeutrino;
149 }
static bool HasNeutrino(const art::Event &evt, const std::string &label)
Check to see if the event has a reconstructed neutrino.
static bool IsNeutrino(const art::Ptr< recob::PFParticle > &pParticle)
Check if this particle is a neutrino.
static std::vector< art::Ptr< recob::PFParticle > > GetPFParticles(const art::Event &evt, const std::string &label)
Get the particles from the event.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< art::Ptr< recob::PFParticle > > dune_ana::DUNEAnaEventUtils::GetPFParticles ( const art::Event evt,
const std::string label 
)
static

Get the particles from the event.

Parameters
evtis the underlying art event
labelis the label for the particle producer
Returns
vector of art::Ptrs to particles

Definition at line 28 of file DUNEAnaEventUtils.cxx.

29 {
30  return DUNEAnaEventUtils::GetProductVector<recob::PFParticle>(evt,label);
31 }
TCEvent evt
Definition: DataStructs.cxx:7
std::vector< art::Ptr< recob::Shower > > dune_ana::DUNEAnaEventUtils::GetShowers ( const art::Event evt,
const std::string label 
)
static

Get the showers from the event. This function shouldn't be used as the basis of an analysis.

Parameters
evtis the underlying art event
labelis the label for the shower producer
Returns
vector of art::Ptrs to showers

Definition at line 46 of file DUNEAnaEventUtils.cxx.

47 {
48  mf::LogWarning("DUNEAna") << " Please note: accessing PFParticle showers through this method is not the recommended workflow.\n"
49  << " Please use DUNEAnaEventUtils::GetPFParticles and access the tracks with DUNEAnaPFParticleUtils::GetShower."
50  << std::endl;
51 
52  return DUNEAnaEventUtils::GetProductVector<recob::Shower>(evt,label);
53 }
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
TCEvent evt
Definition: DataStructs.cxx:7
QTextStream & endl(QTextStream &s)
std::vector< art::Ptr< recob::Slice > > dune_ana::DUNEAnaEventUtils::GetSlices ( const art::Event evt,
const std::string label 
)
static

Get the slices from the event.

Parameters
evtis the underlying art event
labelis the label for the slice producer
Returns
vector of art::Ptrs to slices

Definition at line 85 of file DUNEAnaEventUtils.cxx.

86 {
87  return DUNEAnaEventUtils::GetProductVector<recob::Slice>(evt,label);
88 }
TCEvent evt
Definition: DataStructs.cxx:7
std::vector< art::Ptr< recob::SpacePoint > > dune_ana::DUNEAnaEventUtils::GetSpacePoints ( const art::Event evt,
const std::string label 
)
static

Get the spacepoints from the event.

Parameters
evtis the underlying art event
labelis the label for the spacepoint producer
Returns
vector of art::Ptrs to spacepoints

Definition at line 78 of file DUNEAnaEventUtils.cxx.

79 {
80  return DUNEAnaEventUtils::GetProductVector<recob::SpacePoint>(evt,label);
81 }
TCEvent evt
Definition: DataStructs.cxx:7
std::vector< art::Ptr< ctp::CTPResult > > dune_ana::DUNEAnaEventUtils::GetSquIDResults ( const art::Event evt,
const std::string label 
)
static

Get the SquID track PID result objects from the event.

Parameters
evtis the underlying art event
labelis the label for the SquID evaluator
Returns
vector of art::Ptrs to SquID result objects

Definition at line 181 of file DUNEAnaEventUtils.cxx.

182 {
183  return DUNEAnaEventUtils::GetProductVector<ctp::CTPResult>(evt,label);
184 }
TCEvent evt
Definition: DataStructs.cxx:7
std::vector< art::Ptr< recob::Track > > dune_ana::DUNEAnaEventUtils::GetTracks ( const art::Event evt,
const std::string label 
)
static

Get the tracks from the event. This function shouldn't be used as the basis of an analysis.

Parameters
evtis the underlying art event
labelis the label for the track producer
Returns
vector of art::Ptrs to tracks

Definition at line 35 of file DUNEAnaEventUtils.cxx.

36 {
37  mf::LogWarning("DUNEAna") << " Please note: accessing PFParticle tracks through this method is not the recommended workflow.\n"
38  << " Please use DUNEAnaEventUtils::GetPFParticles and access the tracks with DUNEAnaPFParticleUtils::GetTrack."
39  << std::endl;
40 
41  return DUNEAnaEventUtils::GetProductVector<recob::Track>(evt,label);
42 }
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
TCEvent evt
Definition: DataStructs.cxx:7
QTextStream & endl(QTextStream &s)
std::vector< art::Ptr< recob::Vertex > > dune_ana::DUNEAnaEventUtils::GetVertices ( const art::Event evt,
const std::string label 
)
static

Get the vertices from the event.

Parameters
evtis the underlying art event
labelis the label for the vertex producer
Returns
vector of art::Ptrs to vertices

Definition at line 57 of file DUNEAnaEventUtils.cxx.

58 {
59  return DUNEAnaEventUtils::GetProductVector<recob::Vertex>(evt,label);
60 }
TCEvent evt
Definition: DataStructs.cxx:7
std::vector< art::Ptr< recob::Wire > > dune_ana::DUNEAnaEventUtils::GetWires ( const art::Event evt,
const std::string label 
)
static

Get the wires from the event.

Parameters
evtis the underlying art event
labelis the label for the wire producer
Returns
vector of art::Ptrs to wires

Definition at line 71 of file DUNEAnaEventUtils.cxx.

72 {
73  return DUNEAnaEventUtils::GetProductVector<recob::Wire>(evt,label);
74 }
TCEvent evt
Definition: DataStructs.cxx:7
bool dune_ana::DUNEAnaEventUtils::HasNeutrino ( const art::Event evt,
const std::string label 
)
static

Check to see if the event has a reconstructed neutrino.

Parameters
evtis the underlying art event
labelis the label for the particle producer
Returns
true if the event has a reconstructed neutrino

Definition at line 153 of file DUNEAnaEventUtils.cxx.

154 {
155  bool hasNeutrino = false;
156  std::vector<art::Ptr<recob::PFParticle>> particles = DUNEAnaEventUtils::GetPFParticles(evt,label);
157  for (art::Ptr<recob::PFParticle> pParticle : particles)
158  {
159  if(!pParticle->IsPrimary())
160  {
161  continue;
162  }
163  if (DUNEAnaPFParticleUtils::IsNeutrino(pParticle))
164  {
165  hasNeutrino = true;
166  break;
167  }
168  }
169  return hasNeutrino;
170 }
static bool IsNeutrino(const art::Ptr< recob::PFParticle > &pParticle)
Check if this particle is a neutrino.
static std::vector< art::Ptr< recob::PFParticle > > GetPFParticles(const art::Event &evt, const std::string &label)
Get the particles from the event.

The documentation for this class was generated from the following files: