SND@LHC Software
Loading...
Searching...
No Matches
MeasurementProducer.h
Go to the documentation of this file.
1/* Copyright 2008-2010, Technische Universitaet Muenchen,
2 Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch & Tobias Schlüter
3
4 This file is part of GENFIT.
5
6 GENFIT is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 GENFIT is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18*/
19
24#ifndef genfit_MeasurementProducer_h
25#define genfit_MeasurementProducer_h
26
27#include "Exception.h"
28#include "TrackCand.h"
29
30#include <assert.h>
31#include <TClonesArray.h>
32
33
34namespace genfit {
35
36class AbsMeasurement;
37
42template <class measurement_T>
44public:
48 virtual measurement_T* produce(int index, const TrackCandHit* hit) = 0;
50};
51
52
75template <class hit_T, class measurement_T>
76class MeasurementProducer : public AbsMeasurementProducer<genfit::AbsMeasurement> {
77 private:
79 TClonesArray* hitArrayTClones_;
80
81 public:
83 MeasurementProducer(TClonesArray*);
84 virtual ~MeasurementProducer();
85
89 virtual AbsMeasurement* produce(int index, const TrackCandHit* hit);
90};
91
92
93template <class hit_T, class measurement_T>
95 hitArrayTClones_ = theArr;
96 //std::cout << "hit array with " << hitArrayTClones_->GetEntries() << " entries." << std::endl;
97}
98
99template <class hit_T, class measurement_T>
101 // we don't assume ownership over the hit arrays
102}
103
104template <class hit_T, class measurement_T>
106 assert(hitArrayTClones_ != NULL);
107 //std::cout << "hit array with " << hitArrayTClones_->GetEntries() << " entries, looking for entry " << index << "." << std::endl;
108 if(hitArrayTClones_->At(index) == 0) {
109 Exception e("In MeasurementProducer: index for hit in TClonesArray out of bounds",__LINE__,__FILE__);
110 e.setFatal();
111 throw e;
112 }
113 return ( new measurement_T( (hit_T*) hitArrayTClones_->At(index), hit ) );
114}
115
116
117} /* End of namespace genfit */
120#endif // genfit_MeasurementProducer_h
Abstract interface class for MeasurementProducer.
virtual measurement_T * produce(int index, const TrackCandHit *hit)=0
Virtual abstract method to produce a Measurement. Implemented in MeasurementProducer.
Contains the measurement and covariance in raw detector coordinates.
Exception class for error handling in GENFIT (provides storage for diagnostic information)
Definition Exception.h:48
void setFatal(bool b=true)
Set fatal flag.
Definition Exception.h:61
Template class for a measurement producer module.
virtual AbsMeasurement * produce(int index, const TrackCandHit *hit)
Create a Measurement from the cluster at position index in TClonesArray.
MeasurementProducer(TClonesArray *)
Constructor takes pointer to the hit array.
TClonesArray * hitArrayTClones_
pointer to array with cluster data
Hit object for use in TrackCand. Provides IDs and sorting parameters.
Matrix inversion tools.
Definition AbsBField.h:29