Public Member Functions | Private Attributes | List of all members
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 53 of file GFRecoHitFactory.h.

Constructor & Destructor Documentation

genf::GFRecoHitFactory::GFRecoHitFactory ( )

Definition at line 25 of file GFRecoHitFactory.cxx.

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

Definition at line 28 of file GFRecoHitFactory.cxx.

28  {
29  clear();
30 }
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 32 of file GFRecoHitFactory.cxx.

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:48
void genf::GFRecoHitFactory::clear ( )

Clear all hit producers.

Definition at line 46 of file GFRecoHitFactory.cxx.

46  {
48  while(it!=fHitProdMap.end()){
49  delete it->second;
50  ++it;
51  }
52  fHitProdMap.clear();
53 }
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 71 of file GFRecoHitFactory.cxx.

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

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

Member Data Documentation

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

Definition at line 55 of file GFRecoHitFactory.h.


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