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

Public Member Functions

 VertexStubTracker (fhicl::ParameterSet const &p)
 
 VertexStubTracker (VertexStubTracker const &)=delete
 
 VertexStubTracker (VertexStubTracker &&)=delete
 
VertexStubTrackeroperator= (VertexStubTracker const &)=delete
 
VertexStubTrackeroperator= (VertexStubTracker &&)=delete
 
void produce (art::Event &e) override
 

Private Attributes

art::InputTag fPFPLabel
 
art::InputTag fTrackLabel
 
art::InputTag fVertexChargeLabel
 
float fdQdxCut
 
float fOneWiredQdxCut
 
bool fCorrectSCE
 
bool fPositionsAreSCECorrected
 
sbn::StubBuilder fStubBuilder
 
std::vector< std::unique_ptr
< sbn::IStubMerge > > 
fStubMergeTools
 

Detailed Description

Definition at line 61 of file VertexStubTracker_module.cc.

Constructor & Destructor Documentation

sbn::VertexStubTracker::VertexStubTracker ( fhicl::ParameterSet const &  p)
explicit

Definition at line 90 of file VertexStubTracker_module.cc.

91  : EDProducer{p},
92  fPFPLabel(p.get<art::InputTag>("PFPLabel", "pandora")),
93  fTrackLabel(p.get<art::InputTag>("TrackLabel", "pandoraTrack")),
94  fVertexChargeLabel(p.get<art::InputTag>("VertexChargeLabel", "vhit")),
95  fdQdxCut(p.get<float>("dQdxCut")),
96  fOneWiredQdxCut(p.get<float>("OneWiredQdxCut")),
97  fCorrectSCE(p.get<bool>("CorrectSCE")),
98  fPositionsAreSCECorrected(p.get<bool>("PositionsAreSCECorrected")),
99  fStubBuilder(p.get<fhicl::ParameterSet >("CaloAlg"), fPositionsAreSCECorrected)
100 {
101  // load the tools
102  std::vector<fhicl::ParameterSet> merge_tool_configs(p.get<std::vector<fhicl::ParameterSet>>("MergeTools"));
103  for (unsigned i = 0; i < merge_tool_configs.size(); i++) {
104  fStubMergeTools.push_back(art::make_tool<IStubMerge>(merge_tool_configs[i]));
105  }
106 
107  produces<std::vector<sbn::Stub>>();
108  produces<art::Assns<sbn::VertexHit, sbn::Stub>>();
109  produces<art::Assns<sbn::Stub, recob::Hit>>();
110  produces<art::Assns<sbn::Stub, recob::Slice>>();
111  produces<art::Assns<sbn::Stub, recob::PFParticle>>();
112 
113 }
pdgs p
Definition: selectors.fcl:22
std::vector< std::unique_ptr< sbn::IStubMerge > > fStubMergeTools
sbn::VertexStubTracker::VertexStubTracker ( VertexStubTracker const &  )
delete
sbn::VertexStubTracker::VertexStubTracker ( VertexStubTracker &&  )
delete

Member Function Documentation

VertexStubTracker& sbn::VertexStubTracker::operator= ( VertexStubTracker const &  )
delete
VertexStubTracker& sbn::VertexStubTracker::operator= ( VertexStubTracker &&  )
delete
void sbn::VertexStubTracker::produce ( art::Event &  e)
override

Definition at line 115 of file VertexStubTracker_module.cc.

116 {
117  // collect services
118  const geo::GeometryCore *geo = lar::providerFrom<geo::Geometry>();
119  auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(e);
120  auto const dprop =
121  art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(e, clock_data);
122  const spacecharge::SpaceCharge *sce = lar::providerFrom<spacecharge::SpaceChargeService>();
123  // If we are not correcting for SCE, then blank out the service
124  if (!fCorrectSCE) sce = nullptr;
125 
126  // output data products
127  std::unique_ptr<std::vector<sbn::Stub>> outStubs(new std::vector<sbn::Stub>);
128  std::unique_ptr<art::Assns<sbn::VertexHit, sbn::Stub>> assn(new art::Assns<sbn::VertexHit, sbn::Stub>);
129  std::unique_ptr<art::Assns<sbn::Stub, recob::Hit>> hitAssn(new art::Assns<sbn::Stub, recob::Hit>);
130  std::unique_ptr<art::Assns<sbn::Stub, recob::Slice>> slcAssn(new art::Assns<sbn::Stub, recob::Slice>);
131  std::unique_ptr<art::Assns<sbn::Stub, recob::PFParticle>> pfpAssn(new art::Assns<sbn::Stub, recob::PFParticle>);
132 
133  art::PtrMaker<sbn::Stub> StubPtrMaker {e};
134 
135  // input data
136  art::Handle<std::vector<recob::Slice>> slice_handle;
137  e.getByLabel(fPFPLabel, slice_handle);
138 
139  std::vector<art::Ptr<recob::Slice>> slices;
140  art::fill_ptr_vector(slices, slice_handle);
141 
142  art::FindManyP<sbn::VertexHit> slcVHits(slices, e, fVertexChargeLabel);
143 
144  // Setup the stub builder
146 
147  for (unsigned i_slc = 0; i_slc < slices.size(); i_slc++) {
148  const std::vector<art::Ptr<sbn::VertexHit>> &vhits = slcVHits.at(i_slc);
149 
150  // look up info per vertex hit
151  art::FindManyP<recob::Vertex> vhitVtxs(vhits, e, fVertexChargeLabel);
152  art::FindManyP<recob::Hit> vhitHits(vhits, e, fVertexChargeLabel);
153 
154  // stuff common to each vertex hit in a slice
155  art::Ptr<recob::Slice> thisSlice = slices[i_slc];
156 
157  std::vector<sbn::StubInfo> stubs;
158  for (unsigned i_vhit = 0; i_vhit < vhits.size(); i_vhit++) {
159  // Collect data on this Vertex-Hit
160  const sbn::VertexHit &thisVHit = *vhits[i_vhit];
161  const recob::Hit &thisVHitHit = *vhitHits.at(i_vhit).at(0);
162 
163  bool passcut = (thisVHit.dqdx >= fdQdxCut) || ((abs(thisVHit.wire.Wire - thisVHit.vtxw) < 1.) && (thisVHit.dqdx >= fOneWiredQdxCut));
164 
165  if (!passcut) continue;
166 
167  sbn::StubInfo sinfo;
168  sinfo.stub = fStubBuilder.FromVertexHit(thisSlice, thisVHit, thisVHitHit, geo, sce, clock_data, dprop, e, sinfo.hits, sinfo.pfp);
169  sinfo.vhit = vhits[i_vhit];
170  sinfo.vhit_hit = vhitHits.at(i_vhit).at(0);
171 
172  stubs.push_back(sinfo);
173 
174  } // end iterate over vertex hits
175 
176  // Run all of the merging tools
177  for (unsigned i_mrg = 0; i_mrg < fStubMergeTools.size(); i_mrg++) {
178  stubs = fStubMergeTools[i_mrg]->Merge(stubs, geo, sce, clock_data, dprop);
179  }
180 
181  // Save!
182  for (unsigned i_stub = 0; i_stub < stubs.size(); i_stub++) {
183  const sbn::StubInfo &sinfo = stubs[i_stub];
184 
185  outStubs->push_back(sinfo.stub);
186  art::Ptr<sbn::Stub> outStub = StubPtrMaker(outStubs->size() - 1);
187  assn->addSingle(sinfo.vhit, outStub);
188  for (unsigned i_hit = 0; i_hit < sinfo.hits.size(); i_hit++) {
189  hitAssn->addSingle(outStub, sinfo.hits[i_hit]);
190  }
191  slcAssn->addSingle(outStub, thisSlice);
192  if (sinfo.pfp) {
193  pfpAssn->addSingle(outStub, sinfo.pfp);
194  }
195  } // end loop over stubs
196 
197  } // end loop over slices
198  // Save into event
199  e.put(std::move(outStubs));
200  e.put(std::move(assn));
201  e.put(std::move(hitAssn));
202  e.put(std::move(slcAssn));
203  e.put(std::move(pfpAssn));
204 }
float dqdx
charge/pitch [#elec/cm]
Definition: VertexHit.h:20
void Setup(const art::Event &e, const art::InputTag &pfplabel, const art::InputTag &trklabel)
geo::WireID wire
Wire that the hit is on.
Definition: VertexHit.h:11
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:580
std::vector< std::unique_ptr< sbn::IStubMerge > > fStubMergeTools
Internal struct: contains information on stub and other associated data products. ...
std::vector< art::Ptr< recob::Hit > > hits
T abs(T value)
art::Ptr< recob::Hit > vhit_hit
Description of geometry of one entire detector.
std::vector< TCSlice > slices
Definition: DataStructs.cxx:13
art::Ptr< sbn::VertexHit > vhit
sbn::Stub FromVertexHit(const art::Ptr< recob::Slice > &slice, const sbn::VertexHit &vhit, const recob::Hit &vhit_hit, const geo::GeometryCore *geo, const spacecharge::SpaceCharge *sce, const detinfo::DetectorClocksData &dclock, const detinfo::DetectorPropertiesData &dprop, const art::Event &e, std::vector< art::Ptr< recob::Hit >> &stub_hits, art::Ptr< recob::PFParticle > &stub_pfp)
do i e
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
float vtxw
Wire of the vertex associated with this hit. Not space charge corrected. [cm].
Definition: VertexHit.h:14
art::Ptr< recob::PFParticle > pfp

Member Data Documentation

bool sbn::VertexStubTracker::fCorrectSCE
private

Definition at line 84 of file VertexStubTracker_module.cc.

float sbn::VertexStubTracker::fdQdxCut
private

Definition at line 82 of file VertexStubTracker_module.cc.

float sbn::VertexStubTracker::fOneWiredQdxCut
private

Definition at line 83 of file VertexStubTracker_module.cc.

art::InputTag sbn::VertexStubTracker::fPFPLabel
private

Definition at line 79 of file VertexStubTracker_module.cc.

bool sbn::VertexStubTracker::fPositionsAreSCECorrected
private

Definition at line 85 of file VertexStubTracker_module.cc.

sbn::StubBuilder sbn::VertexStubTracker::fStubBuilder
private

Definition at line 86 of file VertexStubTracker_module.cc.

std::vector<std::unique_ptr<sbn::IStubMerge> > sbn::VertexStubTracker::fStubMergeTools
private

Definition at line 87 of file VertexStubTracker_module.cc.

art::InputTag sbn::VertexStubTracker::fTrackLabel
private

Definition at line 80 of file VertexStubTracker_module.cc.

art::InputTag sbn::VertexStubTracker::fVertexChargeLabel
private

Definition at line 81 of file VertexStubTracker_module.cc.


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