25 #ifndef genfit_MeasurementFactory_h
26 #define genfit_MeasurementFactory_h
28 #include "MeasurementProducer.h"
29 #include "TrackCand.h"
50 template <
class measurement_T>
53 std::map<int, AbsMeasurementProducer<measurement_T>*> hitProdMap_;
96 template <
class measurement_T>
98 typename std::map<int, AbsMeasurementProducer<measurement_T>*>::iterator it = hitProdMap_.find(detID);
99 if(it == hitProdMap_.end()) {
100 hitProdMap_[detID] = hitProd;
102 Exception exc(
"MeasurementFactory: detID already in use",__LINE__,__FILE__);
104 std::vector<double> numbers;
105 numbers.push_back(detID);
111 template <
class measurement_T>
113 typename std::map<int, AbsMeasurementProducer<measurement_T>*>::iterator it=hitProdMap_.begin();
114 while(it!=hitProdMap_.end()){
121 template <
class measurement_T>
123 typename std::map<int, AbsMeasurementProducer<measurement_T>*>::const_iterator it = hitProdMap_.find(detID);
125 if(it != hitProdMap_.end()) {
126 return it->second->produce(index, hit);
128 Exception exc(
"MeasurementFactory: no hitProducer for this detID available",__LINE__,__FILE__);
130 std::vector<double> numbers;
131 numbers.push_back(detID);
137 template <
class measurement_T>
139 typename std::vector<measurement_T*> hitVec;
140 unsigned int nHits=cand.getNHits();
141 for(
unsigned int i=0;i<nHits;i++) {
144 cand.getHit(i, detID, index);
Abstract interface class for MeasurementProducer.
Exception class for error handling in GENFIT (provides storage for diagnostic information)
void setFatal(bool b=true)
Set fatal flag.
void setNumbers(std::string, const std::vector< double > &)
Set list of numbers with description.
Factory object to create AbsMeasurement objects from digitized and clustered data.
std::vector< measurement_T * > createMany(const TrackCand &cand) const
Create a collection of Measurements.
void addProducer(int detID, AbsMeasurementProducer< measurement_T > *hitProd)
Register a producer module to the factory.
measurement_T * createOne(int detID, int index, const TrackCandHit *hit) const
Create a Measurement.
void clear()
Clear all hit producers.
Hit object for use in TrackCand.
Track candidate – seed values and indices.
Defines for I/O streams used for error and debug printing.