All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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:

Classes

struct  Config
 

Public Types

using Parameters = art::EDProducer::Table< Config >
 

Public Member Functions

 AssnsChainShowerMaker (Parameters const &config)
 
virtual void produce (art::Event &event) override
 

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::InputTag > particleTags
 List of PFParticle tags. More...
 

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

using lar::test::AssnsChainShowerMaker::Parameters = art::EDProducer::Table<Config>

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  }
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

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()
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: