All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
ana::SBNOsc::PandoraMetadataPrinter Class Reference

Electron neutrino event selection. More...

Inheritance diagram for ana::SBNOsc::PandoraMetadataPrinter:
core::SelectionBase core::ProcessorBase

Public Member Functions

 PandoraMetadataPrinter ()
 
void Initialize (fhicl::ParameterSet *config=NULL)
 
void Finalize ()
 
bool ProcessEvent (const gallery::Event &ev, const std::vector< event::Interaction > &truth, std::vector< event::RecoInteraction > &reco)
 
- Public Member Functions inherited from core::SelectionBase
 SelectionBase ()
 
virtual ~SelectionBase ()
 
- Public Member Functions inherited from core::ProcessorBase
 ProcessorBase ()
 
virtual ~ProcessorBase ()
 
virtual void FillTree ()
 
virtual void FillRecoTree ()
 
virtual void EventCleanup ()
 
template<class T >
TBranch * AddBranch (std::string name, T *obj)
 
template<class T >
TBranch * AddRecoBranch (std::string name, T *obj)
 

Protected Attributes

std::vector< std::string > fPandoraTags
 
unsigned event_ind
 
- Protected Attributes inherited from core::ProcessorBase
unsigned long fEventIndex
 An incrementing index. More...
 
Experiment fExperimentID
 Experiment identifier. More...
 
ProviderManagerfProviderManager
 Interface for provider access. More...
 
std::string fOutputFilename
 The output filename. More...
 
std::string fProviderConfig
 A custom provider config fcl file. More...
 
std::vector< geo::BoxBoundedGeofActiveVolumes
 List of active volumes in configured detector. More...
 
bool fWriteTree
 Enable writing of the main tree. More...
 
TFile * fOutputFile
 The output ROOT file. More...
 
TTree * fTree
 The output ROOT tree. More...
 
event::EventfEvent
 The standard output event data structure. More...
 
bool fWriteRecoTree
 Enable writing of the reco tree. More...
 
TTree * fRecoTree
 The output reco ROOT tree. More...
 
event::RecoEventfRecoEvent
 The standard output reco event data structure. More...
 
TTree * fSubRunTree
 Subrun output tree. More...
 
SubRunfSubRun
 Standard output subrun structure. More...
 
TTree * fFileMetaTree
 File metadata output tree. More...
 
FileMetafFileMeta
 standard output file metadata structure More...
 
TParameter< int > * fExperimentParameter
 Saves value of experiment enum. More...
 
std::set< std::pair< int, int > > fSubRunCache
 Cache stored subruns. More...
 
art::InputTag fTruthTag
 art tag for MCTruth information More...
 
art::InputTag fFluxTag
 art tag for MCFlux information More...
 
std::vector< art::InputTag > fWeightTags
 art tag(s) for MCEventWeight information More...
 
art::InputTag fMCTrackTag
 art tag for MCTrack More...
 
art::InputTag fMCShowerTag
 art tag for MCShower More...
 
art::InputTag fMCParticleTag
 art tag for MCParticle More...
 
std::string fGeneratorProcess
 process_name of process used to run genie. Used to extract subrun/POT information More...
 

Additional Inherited Members

- Public Attributes inherited from core::ProcessorBase
std::vector
< event::RecoInteraction > * 
fReco
 Reco interaction list. More...
 
- Protected Member Functions inherited from core::ProcessorBase
virtual void Initialize (char *config=NULL)
 
virtual void Setup (char *config=NULL)
 
virtual void Setup (fhicl::ParameterSet *config=NULL)
 
virtual void Teardown ()
 
void BuildEventTree (gallery::Event &ev)
 
void SetupServices (gallery::Event &ev)
 
void UpdateSubRuns (gallery::Event &ev)
 
void UpdateFileMeta (gallery::Event &ev)
 

Detailed Description

Electron neutrino event selection.

Definition at line 36 of file PandoraMetadataPrinter.cc.

Constructor & Destructor Documentation

ana::SBNOsc::PandoraMetadataPrinter::PandoraMetadataPrinter ( )
inline

Constructor.

Definition at line 39 of file PandoraMetadataPrinter.cc.

39 {}

Member Function Documentation

void ana::SBNOsc::PandoraMetadataPrinter::Finalize ( )
inlinevirtual

Finalize and write objects to the output file.

Implements core::ProcessorBase.

Definition at line 52 of file PandoraMetadataPrinter.cc.

52  {
53  }
void ana::SBNOsc::PandoraMetadataPrinter::Initialize ( fhicl::ParameterSet *  config = NULL)
inlinevirtual

Initialization.

Parameters
configA configuration, as a FHiCL ParameterSet object

Implements core::ProcessorBase.

Definition at line 46 of file PandoraMetadataPrinter.cc.

46  {
47  fPandoraTags = config ? config->get<std::vector<std::string>>("PandoraTags", {"pandora"}) : std::vector<std::string>(1,"pandora");
48  event_ind = 0;
49  }
bool ana::SBNOsc::PandoraMetadataPrinter::ProcessEvent ( const gallery::Event &  ev,
const std::vector< event::Interaction > &  truth,
std::vector< event::RecoInteraction > &  reco 
)
inlinevirtual

Process one event.

Parameters
evA single event, as a gallery::Event
Reconstructedinteractions
Returns
True to keep event

Implements core::ProcessorBase.

Definition at line 62 of file PandoraMetadataPrinter.cc.

62  {
63  std::cout << "\nNew Event!\n";
64  for (unsigned j = 0; j < fPandoraTags.size(); j++) {
65  auto const &slices_handle = ev.getValidHandle<std::vector<recob::Slice>>(fPandoraTags[j]);
66  auto const &particles_handle = ev.getValidHandle<std::vector<recob::PFParticle>>(fPandoraTags[j]);
67 
68  art::FindManyP<recob::PFParticle, void> slice_to_particle(slices_handle, ev, fPandoraTags[j]);
69  art::FindManyP<larpandoraobj::PFParticleMetadata, void> particles_to_metadata(particles_handle, ev, fPandoraTags[j]);
70 
71  for (unsigned i = 0; i < slices_handle->size(); i++) {
72  std::cout << "New Slice!\n";
73  const recob::Slice &slice = (*slices_handle)[i];
74  const std::vector<art::Ptr<recob::PFParticle>> slice_particles = slice_to_particle.at(i);
75  for (unsigned k = 0; k < slice_particles.size(); k++) {
76  const art::Ptr<recob::PFParticle> pfp_part = slice_particles[k];
77  if (pfp_part->IsPrimary()) {
78  const larpandoraobj::PFParticleMetadata &meta = *particles_to_metadata.at(pfp_part->Self()).at(0);
79  auto const &properties = meta.GetPropertiesMap();
80  if (properties.count("NuScore")) {
81  std::cout << "NuScore: " << properties.at("NuScore") << std::endl;
82  }
83  }
84  }
85  }
86  }
87 
88  // print particle information
89  for (unsigned j = 0; j < fPandoraTags.size(); j++) {
90  auto const &particles_handle = ev.getValidHandle<std::vector<recob::PFParticle>>(fPandoraTags[j]);
91  art::FindManyP<larpandoraobj::PFParticleMetadata, void> particles_to_metadata(particles_handle, ev, fPandoraTags[j]);
92  std::cout << "TAG: " << fPandoraTags[j] << std::endl;
93  for (unsigned i = 0; i < particles_handle->size(); i++) {
94  std::cout << "Particle PDG: " << particles_handle->at(i).PdgCode() << std::endl;
95  std::vector<art::Ptr<larpandoraobj::PFParticleMetadata>> metadatas = particles_to_metadata.at(i);
96  if (metadatas.size() > 0) {
97  assert(metadatas.size() == 1);
98  const larpandoraobj::PFParticleMetadata &metadata = *metadatas[0];
99  std::cout << "New PFParticle!\n";
100  for (auto const &prop_pair: metadata.GetPropertiesMap()) {
101  std::cout << prop_pair.first << " " << prop_pair.second << std::endl;
102  }
103  }
104  }
105  }
106  return false;
107  }
Metadata associated to PFParticles.
const PropertiesMap & GetPropertiesMap() const
pdgs k
Definition: selectors.fcl:22
BEGIN_PROLOG could also be cout

Member Data Documentation

unsigned ana::SBNOsc::PandoraMetadataPrinter::event_ind
protected

Definition at line 111 of file PandoraMetadataPrinter.cc.

std::vector<std::string> ana::SBNOsc::PandoraMetadataPrinter::fPandoraTags
protected

Definition at line 110 of file PandoraMetadataPrinter.cc.


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