Public Member Functions | Private Member Functions | Private Attributes | List of all members
vertex::AggregateVertex Class Reference
Inheritance diagram for vertex::AggregateVertex:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 AggregateVertex (fhicl::ParameterSet const &pset)
 
- 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 ()
 
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

void produce (art::Event &evt) override
 
std::unique_ptr< std::vector< recob::Vertex > > MatchV2T (art::Event &evt, art::Assns< recob::Vertex, recob::Track > &vtassn, art::Assns< recob::Vertex, recob::Shower > &vsassn, art::Assns< recob::Vertex, recob::Hit > &vhassn)
 

Private Attributes

std::string fDBScanModuleLabel
 
std::string fHoughModuleLabel
 
std::string fTrack3DModuleLabel
 
std::string fEndPointModuleLabel
 
art::PtrVector< recob::EndPoint2Dfeplist
 
art::PtrVector< recob::Trackftracklist
 
art::PtrVector< recob::EndPoint2DfeplistStrong
 

Additional Inherited Members

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

Definition at line 43 of file AggregateVertex_module.cc.

Constructor & Destructor Documentation

vertex::AggregateVertex::AggregateVertex ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 74 of file AggregateVertex_module.cc.

75  : EDProducer{pset}
76  , fDBScanModuleLabel (pset.get< std::string >("DBScanModuleLabel" ))
77  , fHoughModuleLabel (pset.get< std::string >("HoughModuleLabel" ))
78  , fTrack3DModuleLabel (pset.get< std::string >("Track3DModuleLabel" ))
79  , fEndPointModuleLabel(pset.get< std::string >("EndPointModuleLabel"))
80  {
81  produces< std::vector<recob::Vertex> >();
82  produces< art::Assns<recob::Vertex, recob::Hit> >();
83  produces< art::Assns<recob::Vertex, recob::Track> >();
84  produces< art::Assns<recob::Vertex, recob::Shower> >();
85  }
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20

Member Function Documentation

std::unique_ptr< std::vector< recob::Vertex > > vertex::AggregateVertex::MatchV2T ( art::Event evt,
art::Assns< recob::Vertex, recob::Track > &  vtassn,
art::Assns< recob::Vertex, recob::Shower > &  vsassn,
art::Assns< recob::Vertex, recob::Hit > &  vhassn 
)
private
Todo:
Really need to also determine the xyz position of the found vertex
Todo:
Also should determine the ID for this vertex
Todo:
Really need to also determine the xyz position of the found vertex
Todo:
Also should determine the ID for this vertex
Todo:
get a shower module label in line 169 and get a list of showers
Todo:
from the event

Definition at line 132 of file AggregateVertex_module.cc.

136  {
137  mf::LogInfo("AggregateVertex") << "AggregateEvent::MatchV2T(): (strong) vertexlistStrong"
138  << " and tracklist lengths are "
139  << feplistStrong.size() << " and " << ftracklist.size() << ".";
140 
141  art::FindManyP<recob::Hit> fmhst(feplistStrong, evt, fEndPointModuleLabel);
142 
143  // Bail if there are no tracks or vertices.
144  // if (!((int)vertexlistStrong.size()) || !((int)tracklist.size())) return NULL;
145  if (feplistStrong.isNull() || ftracklist.isNull()) {
146  return std::unique_ptr< std::vector<recob::Vertex> > (new std::vector<recob::Vertex>);
147  }
148 
149  // Loop on the vertices, and all the hits in each
150  std::unique_ptr< std::vector<recob::Vertex> > verts(new std::vector<recob::Vertex>);
151 
152  art::FindManyP<recob::Hit> fmht(ftracklist, evt, fTrack3DModuleLabel);
153  art::FindManyP<recob::Hit> fmhs(ftracklist, evt, fTrack3DModuleLabel);
154 
155  for(size_t epctr = 0; epctr < feplistStrong.size(); ++epctr){
156  art::PtrVector<recob::Track> tlistAssoc; // Will fill with matching tracks.
157  art::PtrVector<recob::Shower> slistAssoc; // Will fill with matching showers.
158  std::vector<size_t> trkIdx;
159  std::vector<size_t> shwIdx;
160 
161  std::vector< art::Ptr<recob::Hit> > hitvertexlistStrong = fmhst.at(epctr);
162 
163  // Should be just one hit per vtx, as per Josh, but we loop anyway.
164  art::PtrVector<recob::Hit>::const_iterator hvIter = hitvertexlistStrong.begin();
165  while (hvIter != hitvertexlistStrong.end()) {
166  art::Ptr<recob::Hit> hitv = (*hvIter);
167 
168  // Now loop on the track hits
169  for(size_t t = 0; t < ftracklist.size(); ++t){
170 
171  std::vector< art::Ptr<recob::Hit> > hittlist = fmht.at(t);
172 
173  std::vector< art::Ptr<recob::Hit> >::const_iterator htIter = hittlist.begin();
174  while (htIter != hittlist.end()) {
175 
176  art::Ptr<recob::Hit> hitt = (*htIter);
177 
178  if (hitt==hitv){
179  //std::cout << "AggregateEvent::MatchV2T(): BooYiggity! Vtx/Trk hit match! hitt, hitv= "
180  //<< hitt << " " <<hitv << std::endl;
181  //std::cout << "AggregateEvent::MatchV2T(): vtx, trk " << vtx<< " " <<trk << std::endl;
182  tlistAssoc.push_back(ftracklist[t]);
183  trkIdx.push_back(t);
184  htIter = hittlist.end()-1; // jump to end of track hitlist, since we've satisfied match
185  }
186  htIter++;
187  } // end hits associated to track
188  } // end track loop
189  hvIter++;
190  }
191 
192  // Now if matching tracks were found for this vertex then create the recob::Vertex object.
193  if (tlistAssoc.size() > 0){
194  /// \todo Really need to also determine the xyz position of the found vertex
195  /// \todo Also should determine the ID for this vertex
196  double xyz[3] = {-999., -999., -999.};
197  verts->push_back(recob::Vertex(xyz, verts->size()));
198 
199  // associate the tracks to the vertex
200  util::CreateAssn(*this, evt, *verts, tlistAssoc, vtassn);
201 
202  //associate the track hits to the vertex
203  for(auto const& t : trkIdx){
204  std::vector< art::Ptr<recob::Hit> > hits = fmht.at(t);
205  util::CreateAssn(*this, evt, *verts, hits, vhassn);
206  }
207  }// end if there are tracks to be associated
208 
209  if (slistAssoc.size() > 0){
210  /// \todo Really need to also determine the xyz position of the found vertex
211  /// \todo Also should determine the ID for this vertex
212  double xyz[3] = {-999., -999., -999.};
213  verts->push_back(recob::Vertex(xyz, verts->size()));
214 
215  // associate the showers to the vertex
216  util::CreateAssn(*this, evt, *verts, slistAssoc, vsassn);
217 
218  //associate the shower hits to the vertex
219  ///\todo get a shower module label in line 169 and get a list of showers
220  ///\todo from the event
221  for(auto const& s : shwIdx){
222  std::vector< art::Ptr<recob::Hit> > hits = fmhs.at(s);
223  util::CreateAssn(*this, evt, *verts, hits, vhassn);
224  }
225  }// end if there are showers to be associated
226 
227  //HnhinVtxes->Fill(hitvertexlistStrong.size(),1);
228 
229  } // end loop over end points
230 
231  return verts;
232 
233  } // end AggregateVertex::MatchV2T
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Definition of vertex object for LArSoft.
Definition: Vertex.h:35
bool isNull() const
Definition: PtrVectorBase.h:68
typename data_t::const_iterator const_iterator
Definition: PtrVector.h:55
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
reference at(size_type n)
Definition: PtrVector.h:359
size_type size() const
Definition: PtrVector.h:302
art::PtrVector< recob::EndPoint2D > feplistStrong
static QCString * s
Definition: config.cpp:1042
art::PtrVector< recob::Track > ftracklist
void vertex::AggregateVertex::produce ( art::Event evt)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 88 of file AggregateVertex_module.cc.

89  {
90 
92  evt.getByLabel(fEndPointModuleLabel,epListHandle);
93  for(size_t ii = 0; ii < epListHandle->size(); ++ii){
94  art::Ptr<recob::EndPoint2D> ep(epListHandle, ii);
95  feplist.push_back(ep); // class member
96  }
97 
99  evt.getByLabel(fTrack3DModuleLabel,trackListHandle);
100  for(size_t ii = 0; ii < trackListHandle->size(); ++ii){
101  art::Ptr<recob::Track> track(trackListHandle, ii);
102  ftracklist.push_back(track); // class member
103  }
104 
105 
106  // Only match strong vertices to tracks.
108 
109  while (epIter != feplist.end()){
110  art::Ptr <recob::EndPoint2D> ep = (*epIter);
111  if (ep->ID() < 3) feplistStrong.push_back(ep); // -- cuz there's one less
112  epIter++;
113  }
114 
115  // We will suck up the hits out of each vertex and out of the tracks
116  // and see if there's an overlap of a sufficient (>0) number of hits. If so,
117  // call the track a match to the vtx. Then, .... stick the track pointer(s)
118  // into the AggVertex object. EC, 23-July-2010.
119  std::unique_ptr< art::Assns<recob::Vertex, recob::Track> > vtassn(new art::Assns<recob::Vertex, recob::Track>);
120  std::unique_ptr< art::Assns<recob::Vertex, recob::Shower> > vsassn(new art::Assns<recob::Vertex, recob::Shower>);
121  std::unique_ptr< art::Assns<recob::Vertex, recob::Hit> > vhassn(new art::Assns<recob::Vertex, recob::Hit>);
122 
123  std::unique_ptr< std::vector<recob::Vertex> > vcol (MatchV2T(evt, *vtassn, *vsassn, *vhassn));
124 
125  evt.put(std::move(vcol));
126  evt.put(std::move(vtassn));
127  evt.put(std::move(vsassn));
128  evt.put(std::move(vhassn));
129  }
std::unique_ptr< std::vector< recob::Vertex > > MatchV2T(art::Event &evt, art::Assns< recob::Vertex, recob::Track > &vtassn, art::Assns< recob::Vertex, recob::Shower > &vsassn, art::Assns< recob::Vertex, recob::Hit > &vhassn)
art::PtrVector< recob::EndPoint2D > feplist
int ID() const
Definition: EndPoint2D.h:58
iterator begin()
Definition: PtrVector.h:217
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
typename data_t::const_iterator const_iterator
Definition: PtrVector.h:55
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
iterator end()
Definition: PtrVector.h:231
art::PtrVector< recob::EndPoint2D > feplistStrong
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
Definition: fwd.h:29
art::PtrVector< recob::Track > ftracklist

Member Data Documentation

std::string vertex::AggregateVertex::fDBScanModuleLabel
private

Definition at line 58 of file AggregateVertex_module.cc.

std::string vertex::AggregateVertex::fEndPointModuleLabel
private

Definition at line 61 of file AggregateVertex_module.cc.

art::PtrVector<recob::EndPoint2D> vertex::AggregateVertex::feplist
private

Definition at line 63 of file AggregateVertex_module.cc.

art::PtrVector<recob::EndPoint2D> vertex::AggregateVertex::feplistStrong
private

Definition at line 65 of file AggregateVertex_module.cc.

std::string vertex::AggregateVertex::fHoughModuleLabel
private

Definition at line 59 of file AggregateVertex_module.cc.

std::string vertex::AggregateVertex::fTrack3DModuleLabel
private

Definition at line 60 of file AggregateVertex_module.cc.

art::PtrVector<recob::Track> vertex::AggregateVertex::ftracklist
private

Definition at line 64 of file AggregateVertex_module.cc.


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