LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
genf::GFRecoHitFactory Class Reference

Factory object to create RecoHits from digitized and clustered data. More...

#include "GFRecoHitFactory.h"

Public Member Functions

 GFRecoHitFactory ()
 
virtual ~GFRecoHitFactory ()
 
void addProducer (int detID, GFAbsRecoHitProducer *hitProd)
 Register a producer module to the factory. More...
 
void clear ()
 Clear all hit producers. More...
 
GFAbsRecoHitcreateOne (int detID, int index)
 Create a RecoHit. More...
 
std::vector< GFAbsRecoHit * > createMany (const GFTrackCand &cand)
 Creat a collection of RecoHits. More...
 

Private Attributes

std::map< int, GFAbsRecoHitProducer * > fHitProdMap
 

Detailed Description

Factory object to create RecoHits from digitized and clustered data.

The GFRecoHitFactory is used to automatically fill Track objects with hit data. For each detector type that is used, one GFRecoHitProducer has to be registered in the factory. The factory can the use the index information from a GFTrackCand object to load the indexed hits into the Track.

See also
GFAbsRecoHitProducer
GFTrackCand

Definition at line 52 of file GFRecoHitFactory.h.

Constructor & Destructor Documentation

genf::GFRecoHitFactory::GFRecoHitFactory ( )

Definition at line 24 of file GFRecoHitFactory.cxx.

24 {}
genf::GFRecoHitFactory::~GFRecoHitFactory ( )
virtual

Definition at line 26 of file GFRecoHitFactory.cxx.

References clear().

27 {
28  clear();
29 }
void clear()
Clear all hit producers.

Member Function Documentation

void genf::GFRecoHitFactory::addProducer ( int  detID,
GFAbsRecoHitProducer hitProd 
)

Register a producer module to the factory.

For each type of hit a separate producer is needed. The type of hit is identified by the detector ID (detID). This index corresponds to the detector ID that is stored in the GFTrackCand object

Definition at line 31 of file GFRecoHitFactory.cxx.

References fHitProdMap, GFException::setFatal(), and GFException::setNumbers().

32 {
33  if (fHitProdMap[detID] != NULL) {
34  GFException exc("GFRecoHitFactory: detID already in use", __LINE__, __FILE__);
35  exc.setFatal();
36  std::vector<double> numbers;
37  numbers.push_back(detID);
38  exc.setNumbers("detID", numbers);
39  throw exc;
40  }
41  else {
42  fHitProdMap[detID] = hitProd;
43  }
44 }
std::map< int, GFAbsRecoHitProducer * > fHitProdMap
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
void genf::GFRecoHitFactory::clear ( )

Clear all hit producers.

Definition at line 46 of file GFRecoHitFactory.cxx.

References fHitProdMap.

Referenced by ~GFRecoHitFactory().

47 {
49  while (it != fHitProdMap.end()) {
50  delete it->second;
51  ++it;
52  }
53  fHitProdMap.clear();
54 }
intermediate_table::iterator iterator
std::map< int, GFAbsRecoHitProducer * > fHitProdMap
std::vector< genf::GFAbsRecoHit * > genf::GFRecoHitFactory::createMany ( const GFTrackCand cand)

Creat a collection of RecoHits.

This is the standard way to prepare the hit collection for a Track. The resulting collection can contain hits from several detectors. The order of the hits is the same as in the GFTrackCand. It is assumed that this order is already along the track.

RecoHits have to implement a constructor which takes the cluster object from which the RecoHit is build as the only parameter. See GFAbsRecoHitProducer for details

Definition at line 73 of file GFRecoHitFactory.cxx.

References createOne(), genf::GFTrackCand::getHit(), and genf::GFTrackCand::getNHits().

74 {
75  std::vector<genf::GFAbsRecoHit*> hitVec;
76  unsigned int nHits = cand.getNHits();
77  for (unsigned int i = 0; i < nHits; i++) {
78  unsigned int detID;
79  unsigned int index;
80  cand.getHit(i, detID, index);
81  hitVec.push_back(createOne(detID, index));
82  }
83  return hitVec;
84 }
GFAbsRecoHit * createOne(int detID, int index)
Create a RecoHit.
genf::GFAbsRecoHit * genf::GFRecoHitFactory::createOne ( int  detID,
int  index 
)

Create a RecoHit.

RecoHits have to implement a Constructor which takes the cluster object from which the RecoHit is build as the only parameter. See GFAbsRecoHitProducer for details

Definition at line 56 of file GFRecoHitFactory.cxx.

References fHitProdMap, GFException::setFatal(), and GFException::setNumbers().

Referenced by createMany().

57 {
58  if (fHitProdMap[detID] != NULL) {
59  return (genf::GFAbsRecoHit*)(fHitProdMap[detID]->produce(index));
60  }
61 
62  else {
63  GFException exc(
64  "GFRecoHitFactory: no hitProducer for this detID available", __LINE__, __FILE__);
65  exc.setFatal();
66  std::vector<double> numbers;
67  numbers.push_back(detID);
68  exc.setNumbers("detID", numbers);
69  throw exc;
70  }
71 }
std::map< int, GFAbsRecoHitProducer * > fHitProdMap
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47

Member Data Documentation

std::map<int, GFAbsRecoHitProducer*> genf::GFRecoHitFactory::fHitProdMap
private

Definition at line 54 of file GFRecoHitFactory.h.

Referenced by addProducer(), clear(), and createOne().


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