Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar::test::AssnsChainShowerMaker Class Reference

Creates some dummy showers and associations to PFParticle objects. More...

Inheritance diagram for lar::test::AssnsChainShowerMaker:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Classes

struct  Config
 

Public Types

using Parameters = art::EDProducer::Table< Config >
 
- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 

Public Member Functions

 AssnsChainShowerMaker (Parameters const &config)
 
virtual void produce (art::Event &event) override
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

std::vector< art::Ptr< recob::PFParticle > > collectPFOs (art::Event const &event) const
 Returns a list of PFParticle objects to be made into showers. More...
 

Private Attributes

std::vector< art::InputTagparticleTags
 List of PFParticle tags. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Creates some dummy showers and associations to PFParticle objects.

Configuration parameters

Definition at line 48 of file AssnsChainShowerMaker_module.cc.

Member Typedef Documentation

Definition at line 63 of file AssnsChainShowerMaker_module.cc.

Constructor & Destructor Documentation

lar::test::AssnsChainShowerMaker::AssnsChainShowerMaker ( Parameters const &  config)
inlineexplicit

Definition at line 65 of file AssnsChainShowerMaker_module.cc.

66  : EDProducer{config}, particleTags(config().particles())
67  {
68  produces<std::vector<recob::Shower>>();
69  produces<art::Assns<recob::PFParticle, recob::Shower>>();
70  }
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
static Config * config
Definition: config.cpp:1054
std::vector< art::InputTag > particleTags
List of PFParticle tags.

Member Function Documentation

std::vector< art::Ptr< recob::PFParticle > > lar::test::AssnsChainShowerMaker::collectPFOs ( art::Event const &  event) const
private

Returns a list of PFParticle objects to be made into showers.

Definition at line 152 of file AssnsChainShowerMaker_module.cc.

152  {
153 
154  std::vector<art::Ptr<recob::PFParticle>> allPFOs;
155 
156  for (auto const& tag: particleTags) {
157  auto PFOs = event.getValidHandle<std::vector<recob::PFParticle>>(tag);
158 
159  std::size_t const nPFOs = PFOs->size();
160  for (std::size_t i = 0; i < nPFOs; ++i)
161  allPFOs.emplace_back(PFOs, i);
162 
163  } // for
164 
165  return allPFOs;
166 } // lar::test::AssnsChainShowerMaker::collectHits()
std::vector< art::InputTag > particleTags
List of PFParticle tags.
void lar::test::AssnsChainShowerMaker::produce ( art::Event event)
overridevirtual

Implements art::EDProducer.

Definition at line 91 of file AssnsChainShowerMaker_module.cc.

91  {
92 
93  //
94  // prepare input: merge all hits in a single collection
95  //
96  std::vector<art::Ptr<recob::PFParticle>> particles = collectPFOs(event);
97 
98  //
99  // prepare output
100  //
101  auto showers = std::make_unique<std::vector<recob::Shower>>();
102  auto PFOshowerAssns
103  = std::make_unique<art::Assns<recob::PFParticle, recob::Shower>>();
104 
105  //
106  // create the showers
107  //
108  unsigned int nShowers = particles.size();
109 
110  art::PtrMaker<recob::Shower> ptrMaker(event);
111 
112  for (unsigned int i = 0; i < nShowers; ++i) {
113 
114  //
115  // generate the shower
116  //
117  showers->push_back(recob::Shower(
118  { 0.0, 0.0, 1.0 }, // dcosVtx
119  { 0.1, 0.1, 0.1 }, // dcosVtxErr
120  { 0.0, 0.0, 0.0 }, // xyz
121  { 1.0, 1.0, 1.0 }, // xyzErr
122  { 1.0, 1.0, 1.0 }, // TotalEnergy
123  { 0.1, 0.1, 0.1 }, // TotalEnergyErr
124  { 2.0, 2.0, 2.0 }, // dEdx
125  { 0.1, 0.1, 0.1 }, // dEdxErr
126  0, // bestplane
127  i, // id
128  1.0, // length
129  1.0 // openAngle
130  ));
131 
132  //
133  // generate associations
134  //
135  PFOshowerAssns->addSingle(particles[i], ptrMaker(i));
136 
137  } // for
138 
139  mf::LogInfo("AssnsChainShowerMaker")
140  << "Created " << showers->size() << " showers from " << particles.size()
141  << " particle flow objects and " << PFOshowerAssns->size()
142  << " associations from " << particleTags.size() << " collections";
143 
144  event.put(std::move(showers));
145  event.put(std::move(PFOshowerAssns));
146 
147 } // lar::test::AssnsChainShowerMaker::produce()
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
def move(depos, offset)
Definition: depos.py:107
std::vector< art::InputTag > particleTags
List of PFParticle tags.
std::vector< art::Ptr< recob::PFParticle > > collectPFOs(art::Event const &event) const
Returns a list of PFParticle objects to be made into showers.

Member Data Documentation

std::vector<art::InputTag> lar::test::AssnsChainShowerMaker::particleTags
private

List of PFParticle tags.

Definition at line 75 of file AssnsChainShowerMaker_module.cc.


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