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

Constructor & Destructor Documentation

GFRecoHitFactory::GFRecoHitFactory ( )

Definition at line 24 of file GFRecoHitFactory.cxx.

24  {
25 }
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 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().

Referenced by PndRecoDafFit::Init(), PndRecoKalmanFit::Init(), PndHypKalmanTask::Init(), PndHypDKalmanTask::Init(), and PndLmdKalmanTask::Init().

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 }
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:45
std::map< int, GFAbsRecoHitProducer * > fHitProdMap
void GFRecoHitFactory::clear ( void  )

Clear all hit producers.

Definition at line 45 of file GFRecoHitFactory.cxx.

References fHitProdMap.

Referenced by ~GFRecoHitFactory().

45  {
46  std::map<int, GFAbsRecoHitProducer*>::iterator it=fHitProdMap.begin();
47  while(it!=fHitProdMap.end()){
48  delete it->second;
49  ++it;
50  }
51  fHitProdMap.clear();
52 }
std::map< int, GFAbsRecoHitProducer * > fHitProdMap
std::vector< GFAbsRecoHit * > 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(), GFTrackCand::getHit(), GFTrackCand::getNHits(), i, and nHits.

Referenced by PndHypKalmanTask::Exec(), PndHypDKalmanTask::Exec(), PndLmdKalmanTask::Exec(), PndRecoDafFit::Fit(), and PndRecoKalmanFit::Fit().

70  {
71  std::vector<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 }
Int_t i
Definition: run_full.C:25
unsigned int getNHits() const
Definition: GFTrackCand.h:113
int nHits
Definition: RiemannTest.C:16
void getHit(unsigned int i, unsigned int &detId, unsigned int &hitId) const
Get detector ID and cluster index (hitId) for hit number i.
Definition: GFTrackCand.h:84
GFAbsRecoHit * createOne(int detID, int index)
Create a RecoHit.
GFAbsRecoHit * 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 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 }
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:45
std::map< int, GFAbsRecoHitProducer * > fHitProdMap

Member Data Documentation

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

Definition at line 53 of file GFRecoHitFactory.h.

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


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