LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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 54 of file GFRecoHitFactory.h.

Constructor & Destructor Documentation

genf::GFRecoHitFactory::GFRecoHitFactory ( )

Definition at line 24 of file GFRecoHitFactory.cxx.

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

Definition at line 27 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().

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

Clear all hit producers.

Definition at line 45 of file GFRecoHitFactory.cxx.

References fHitProdMap.

Referenced by ~GFRecoHitFactory().

45  {
47  while(it!=fHitProdMap.end()){
48  delete it->second;
49  ++it;
50  }
51  fHitProdMap.clear();
52 }
std::map< int, GFAbsRecoHitProducer * > fHitProdMap
intermediate_table::iterator iterator
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 70 of file GFRecoHitFactory.cxx.

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

70  {
71  std::vector<genf::GFAbsRecoHit*> hitVec;
72  unsigned int nHits=cand.getNHits();
73  for(unsigned int i=0;i<nHits;i++) {
74  unsigned int detID;
75  unsigned int index;
76  cand.getHit(i,detID,index);
77  hitVec.push_back( createOne(detID,index) );
78  }
79  return hitVec;
80 }
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 54 of file GFRecoHitFactory.cxx.

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

Referenced by createMany().

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

Member Data Documentation

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

Definition at line 56 of file GFRecoHitFactory.h.

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


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