All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
apa::APAHitFinder Class Reference
Inheritance diagram for apa::APAHitFinder:

Public Member Functions

 APAHitFinder (fhicl::ParameterSet const &pset)
 

Private Member Functions

void produce (art::Event &evt) override
 

Private Attributes

apa::DisambigAlg fDisambigAlg
 
art::ServiceHandle
< geo::Geometry const > 
fGeom
 
std::string fChanHitLabel
 

Detailed Description

Definition at line 36 of file APAHitFinder_module.cc.

Constructor & Destructor Documentation

apa::APAHitFinder::APAHitFinder ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 53 of file APAHitFinder_module.cc.

54  : EDProducer{pset}, fDisambigAlg(pset.get<fhicl::ParameterSet>("DisambigAlg"))
55  {
56  fChanHitLabel = pset.get<std::string>("ChanHitLabel");
57 
58  // let HitCollectionCreator declare that we are going to produce
59  // hits and associations with wires and raw digits
60  // (with no particular product label)
62  }
apa::DisambigAlg fDisambigAlg
static void declare_products(art::ProducesCollector &collector, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
Definition: HitCreator.cxx:248

Member Function Documentation

void apa::APAHitFinder::produce ( art::Event &  evt)
overrideprivate

Definition at line 66 of file APAHitFinder_module.cc.

67  {
68  // this object contains the hit collection
69  // and its associations to wires and raw digits:
71 
72  art::Handle<std::vector<recob::Hit>> ChannelHits;
73  evt.getByLabel(fChanHitLabel, ChannelHits);
74 
75  // also get the associated wires and raw digits;
76  // we assume they have been created by the same module as the hits
77  art::FindOneP<raw::RawDigit> ChannelHitRawDigits(ChannelHits, evt, fChanHitLabel);
78  art::FindOneP<recob::Wire> ChannelHitWires(ChannelHits, evt, fChanHitLabel);
79 
80  // Make unambiguous collection hits
81  std::vector<art::Ptr<recob::Hit>> ChHits;
82  art::fill_ptr_vector(ChHits, ChannelHits);
83  for (size_t h = 0; h < ChHits.size(); h++) {
84  if (ChHits[h]->View() != geo::kZ) continue;
85 
86  art::Ptr<recob::Wire> wire = ChannelHitWires.at(h);
87  art::Ptr<raw::RawDigit> rawdigits = ChannelHitRawDigits.at(h);
88 
89  // just copy it
90  hcol.emplace_back(*ChHits[h], wire, rawdigits);
91  }
92 
93  // Run alg on all APAs
94  auto const clock_data =
95  art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
96  auto const det_prop =
97  art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt, clock_data);
98  fDisambigAlg.RunDisambig(clock_data, det_prop, ChannelHits);
99 
100  for (size_t t = 0; t < fDisambigAlg.fDisambigHits.size(); t++) {
101  art::Ptr<recob::Hit> hit = fDisambigAlg.fDisambigHits[t].first;
102  geo::WireID wid = fDisambigAlg.fDisambigHits[t].second;
103 
104  // create a new hit copy of the original one, but with new wire ID
105  recob::HitCreator disambiguous_hit(*hit, wid);
106 
107  // get the objects associated with the original hit;
108  // since hit comes from ChannelHits, its key is the index in that collection
109  // and also the index for the query of associated objects
110  art::Ptr<recob::Hit>::key_type hit_index = hit.key();
111  art::Ptr<recob::Wire> wire = ChannelHitWires.at(hit_index);
112  art::Ptr<raw::RawDigit> rawdigits = ChannelHitRawDigits.at(hit_index);
113 
114  hcol.emplace_back(disambiguous_hit.move(), wire, rawdigits);
115  } // for
116 
117  // put the hit collection and associations into the event
118  hcol.put_into(evt);
119  }
apa::DisambigAlg fDisambigAlg
Planes which measure Z direction.
Definition: geo_types.h:132
void RunDisambig(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, art::Handle< std::vector< recob::Hit >> GausHits)
Definition: DisambigAlg.cxx:54
process_name hit
Definition: cheaterreco.fcl:51
while getopts h
Class managing the creation of a new recob::Hit object.
Definition: HitCreator.h:83
A class handling a collection of hits and its associations.
Definition: HitCreator.h:508
std::vector< std::pair< art::Ptr< recob::Hit >, geo::WireID > > fDisambigHits
The final list of hits to pass back to be made.
Definition: DisambigAlg.h:64
TCEvent evt
Definition: DataStructs.cxx:8

Member Data Documentation

std::string apa::APAHitFinder::fChanHitLabel
private

Definition at line 47 of file APAHitFinder_module.cc.

apa::DisambigAlg apa::APAHitFinder::fDisambigAlg
private

Definition at line 44 of file APAHitFinder_module.cc.

art::ServiceHandle<geo::Geometry const> apa::APAHitFinder::fGeom
private

Definition at line 45 of file APAHitFinder_module.cc.


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