//modified by Elisabetta Prencipe 19/5/2014 #ifndef PNDSTTRECOHITPRODUCER2_H #define PNDSTTRECOHITPRODUCER2_H #include #include #include #include #include "TClonesArray.h" #include "Exception.h" #include "TrackCandHit.h" #include "MeasurementProducer.h" #include "AbsMeasurement.h" template class PndSttRecoHitProducer2 : public genfit::AbsMeasurementProducer { private: TClonesArray* hitArrayTClones; TClonesArray* tubeArrayTClones; public: PndSttRecoHitProducer2(TClonesArray*, TClonesArray*); virtual ~PndSttRecoHitProducer2(); virtual genfit::AbsMeasurement* produce(int index, const genfit::TrackCandHit* hit); }; template PndSttRecoHitProducer2::PndSttRecoHitProducer2(TClonesArray* theArr, TClonesArray* theTubeArr) { hitArrayTClones = theArr; tubeArrayTClones = theTubeArr; } template PndSttRecoHitProducer2::~PndSttRecoHitProducer2() { delete(tubeArrayTClones); } template genfit::AbsMeasurement* PndSttRecoHitProducer2::produce(int index, const genfit::TrackCandHit* hit) { assert(hitArrayTClones!=NULL); assert(tubeArrayTClones!=NULL); if(hitArrayTClones->At(index) == 0) { genfit::Exception e("In PndSttRecoHitProducer2: index for hit in TClonesArray out of bounds",__LINE__,__FILE__); e.setFatal(); throw e; } return ( new measurement_T( (hit_T*) hitArrayTClones->At(index), hit, tubeArrayTClones ) ); } #endif