12 #include "art_root_io/TFileService.h" 13 #include "cetlib/cpu_timer.h" 32 #include "Api/PandoraApi.h" 44 , m_configFile(pset.
get<
std::string>(
"ConfigFile"))
45 , m_shouldRunAllHitsCosmicReco(pset.
get<bool>(
"ShouldRunAllHitsCosmicReco"))
46 , m_shouldRunStitching(pset.
get<bool>(
"ShouldRunStitching"))
47 , m_shouldRunCosmicHitRemoval(pset.
get<bool>(
"ShouldRunCosmicHitRemoval"))
48 , m_shouldRunSlicing(pset.
get<bool>(
"ShouldRunSlicing"))
49 , m_shouldRunNeutrinoRecoOption(pset.
get<bool>(
"ShouldRunNeutrinoRecoOption"))
50 , m_shouldRunCosmicRecoOption(pset.
get<bool>(
"ShouldRunCosmicRecoOption"))
51 , m_shouldPerformSliceId(pset.
get<bool>(
"ShouldPerformSliceId"))
52 , m_shouldProduceAllOutcomes(pset.
get<bool>(
"ProduceAllOutcomes", false))
53 , m_printOverallRecoStatus(pset.
get<bool>(
"PrintOverallRecoStatus", false))
54 , m_generatorModuleLabel(pset.
get<
std::string>(
"GeneratorModuleLabel",
""))
55 , m_geantModuleLabel(pset.
get<
std::string>(
"GeantModuleLabel",
"largeant"))
56 , m_simChannelModuleLabel(pset.
get<
std::string>(
"SimChannelModuleLabel", m_geantModuleLabel))
57 , m_hitfinderModuleLabel(pset.
get<
std::string>(
"HitFinderModuleLabel"))
58 , m_backtrackerModuleLabel(pset.
get<
std::string>(
"BackTrackerModuleLabel",
""))
59 , m_allOutcomesInstanceLabel(pset.
get<
std::string>(
"AllOutcomesInstanceLabel",
"allOutcomes"))
60 , m_enableProduction(pset.
get<bool>(
"EnableProduction", true))
61 , m_enableDetectorGaps(pset.
get<bool>(
"EnableLineGaps", true))
62 , m_enableMCParticles(pset.
get<bool>(
"EnableMCParticles", false))
63 , m_disableRealDataCheck(pset.
get<bool>(
"DisableRealDataCheck", false))
64 , m_lineGapsCreated(false)
83 pset.get<
bool>(
"ShouldProduceTestBeamInteractionVertices",
false);
85 "TestBeamInteractionVerticesInstanceLabel",
"testBeamInteractionVertices");
92 std::vector<std::string> instanceNames({
""});
95 for (
const std::string& instanceName : instanceNames) {
96 produces<std::vector<recob::PFParticle>>(instanceName);
97 produces<std::vector<recob::SpacePoint>>(instanceName);
98 produces<std::vector<recob::Cluster>>(instanceName);
99 produces<std::vector<recob::Vertex>>(instanceName);
100 produces<std::vector<larpandoraobj::PFParticleMetadata>>(instanceName);
102 produces<art::Assns<recob::PFParticle, larpandoraobj::PFParticleMetadata>>(instanceName);
103 produces<art::Assns<recob::PFParticle, recob::SpacePoint>>(instanceName);
104 produces<art::Assns<recob::PFParticle, recob::Cluster>>(instanceName);
105 produces<art::Assns<recob::PFParticle, recob::Vertex>>(instanceName);
106 produces<art::Assns<recob::SpacePoint, recob::Hit>>(instanceName);
107 produces<art::Assns<recob::Cluster, recob::Hit>>(instanceName);
111 produces<std::vector<recob::Vertex>>(
113 produces<art::Assns<recob::PFParticle, recob::Vertex>>(
118 produces<std::vector<anab::T0>>(instanceName);
119 produces<art::Assns<recob::PFParticle, anab::T0>>(instanceName);
123 produces<std::vector<recob::Slice>>(instanceName);
124 produces<art::Assns<recob::Slice, recob::Hit>>(instanceName);
125 produces<art::Assns<recob::PFParticle, recob::Slice>>(instanceName);
143 <<
" LArPandora::beginJob - failed to create primary Pandora instance " << std::endl;
191 bool areSimChannelsValid(
false);
207 if (!artSimChannels.empty()) {
210 else if (!areSimChannelsValid) {
213 <<
"LArPandora::CreatePandoraInput - Can't build MCParticle to Hit map." << std::endl
215 <<
"\", and BackTrackerModuleLabel isn't set in FHiCL." << std::endl;
222 <<
" *** LArPandora::CreatePandoraInput - empty list of sim channels found " << std::endl;
231 artMCTruthToMCParticles,
232 artMCParticlesToMCTruth,
233 generatorArtMCParticleVector);
259 if (pset.
has_key(
"HitCollectionTool")) {
264 psetHitCollection.
put<std::string>(
"tool_type",
"LArPandoraHitCollectionToolDefault");
265 return psetHitCollection;
std::map< int, art::Ptr< recob::Hit > > IdToHitMap
Header file for the pfo helper class.
std::string m_allOutcomesInstanceLabel
The instance label for all outcomes.
void CreatePandoraInput(art::Event &evt, IdToHitMap &idToHitMap)
Create pandora input hits, mc particles etc.
Base producer module for reconstructing recob::PFParticles from recob::Hits.
const pandora::Pandora * m_pPrimaryPandora
static void LoadGeometry(LArDriftVolumeList &outputVolumeList, LArDriftVolumeMap &outputVolumeMap, const bool useActiveBoundingBox)
Load drift volume geometry.
Declaration of signal hit object.
std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth > > MCParticlesToMCTruth
std::string m_testBeamInteractionVerticesInstanceLabel
The label for the test beam interaction vertices.
std::vector< LArDriftVolume > LArDriftVolumeList
std::string m_allOutcomesInstanceLabel
The label for the instance producing all outcomes.
bool m_disableRealDataCheck
Whether to check if the input file contains real data before accessing MC information.
bool m_shouldProduceAllOutcomes
Steering: whether to produce all reconstruction outcomes.
bool m_isNeutrinoRecoOnlyNoSlicing
If we are running the neutrino reconstruction only with no slicing.
std::string m_backtrackerModuleLabel
The back tracker module label.
static void CollectGeneratorMCParticles(const art::Event &evt, const std::string &label, RawMCParticleVector &particleVector)
Collect a vector of MCParticle objects from the generator in the ART event record. ATTN: This function is needed as accessing generator (opposed to Geant4) level MCParticles requires use of MCTruth block.
bool m_lineGapsCreated
Book-keeping: whether line gap creation has been called.
std::string m_hitfinderModuleLabel
The hit finder module label.
std::map< art::Ptr< recob::Hit >, TrackIDEVector > HitsToTrackIDEs
bool m_shouldRunNeutrinoRecoOption
Steering: whether to run neutrino reconstruction for each slice.
fhicl::ParameterSet ConstructHitCollectionToolParameterSet(const fhicl::ParameterSet &pset)
const pandora::Pandora * m_pPrimaryPandora
The address of the primary pandora instance.
std::vector< simb::MCParticle > RawMCParticleVector
LArDriftVolumeMap m_driftVolumeMap
The map from volume id to drift volume.
virtual void CreatePandoraInstances()=0
Create pandora instances.
std::map< art::Ptr< simb::MCTruth >, MCParticleVector > MCTruthToMCParticles
std::string m_generatorModuleLabel
The generator module label.
std::string m_geantModuleLabel
The geant module label.
T get(std::string const &key) const
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
void ProcessPandoraOutput(art::Event &evt, const IdToHitMap &idToHitMap)
Process pandora output particle flow objects.
static void CollectSimChannels(const art::Event &evt, const std::string &label, SimChannelVector &simChannelVector, bool &areSimChannelsValid)
Collect a vector of SimChannel objects from the ART event record.
Provides recob::Track data product.
static void ProduceArtOutput(const Settings &settings, const IdToHitMap &idToHitMap, art::Event &evt)
Convert the Pandora PFOs into ART clusters and write into ART event.
static void LoadDetectorGaps(LArDetectorGapList &listOfGaps, const bool useActiveBoundingBox)
Load the 2D gaps that go with the chosen geometry.
bool m_shouldRunCosmicRecoOption
Steering: whether to run cosmic-ray reconstruction for each slice.
bool has_key(std::string const &key) const
virtual void ResetPandoraInstances()=0
Reset all associated pandora instances.
Declaration of cluster object.
LArPandora(fhicl::ParameterSet const &pset)
Constructor.
bool m_shouldProduceTestBeamInteractionVertices
Whether to write the test beam interaction vertices in a separate collection.
bool m_enableDetectorGaps
Whether to pass detector gap information to Pandora instances.
void produce(art::Event &evt)
bool m_shouldRunStitching
Steering: whether to stitch cosmic-ray muons crossing between volumes.
LArPandoraInput::Settings m_inputSettings
The lar pandora input settings.
std::vector< art::Ptr< recob::Hit > > HitVector
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
LArPandoraOutput::Settings m_outputSettings
The lar pandora output settings.
bool m_shouldRunStitching
std::vector< art::Ptr< sim::SimChannel > > SimChannelVector
bool m_shouldProduceAllOutcomes
If all outcomes should be produced in separate collections (choose false if you only require the cons...
std::unique_ptr< IHitCollectionTool > m_collectHitsTool
art tool used to collect the hits
std::vector< LArDetectorGap > LArDetectorGapList
bool m_shouldProduceSlices
Whether to produce output slices e.g. may not want to do this if only (re)processing single slices...
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
Header file detailing content for use with particle flow reconstruction at liquid argon time projecti...
bool m_shouldRunSlicing
Steering: whether to slice events into separate regions for processing.
virtual void RunPandoraInstances()=0
Run all associated pandora instances.
bool m_enableMCParticles
Whether to pass mc information to Pandora instances to aid development.
bool m_enableProduction
Whether to persist output products.
static void BuildMCParticleHitMaps(const art::Event &evt, const HitVector &hitVector, const SimChannelVector &simChannelVector, HitsToTrackIDEs &hitsToTrackIDEs)
Collect the links from reconstructed hits to their true energy deposits.
static void CollectMCParticles(const art::Event &evt, const std::string &label, MCParticleVector &particleVector)
Collect a vector of MCParticle objects from the ART event record.
std::string m_simChannelModuleLabel
The SimChannel producer module label.
void put(std::string const &key)
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception
std::string m_hitfinderModuleLabel
The hit finder module label.
virtual void ConfigurePandoraInstances()=0
Configure pandora instances.