Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:21

0001 /* Copyright 2008-2010, Technische Universitaet Muenchen,
0002    Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
0003 
0004    This file is part of GENFIT.
0005 
0006    GENFIT is free software: you can redistribute it and/or modify
0007    it under the terms of the GNU Lesser General Public License as published
0008    by the Free Software Foundation, either version 3 of the License, or
0009    (at your option) any later version.
0010 
0011    GENFIT is distributed in the hope that it will be useful,
0012    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014    GNU Lesser General Public License for more details.
0015 
0016    You should have received a copy of the GNU Lesser General Public License
0017    along with GENFIT.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 /** @addtogroup genfit
0020  * @{
0021  */
0022 
0023 #ifndef genfit_AbsMeasurement_h
0024 #define genfit_AbsMeasurement_h
0025 
0026 #include "MeasurementOnPlane.h"
0027 #include "AbsHMatrix.h"
0028 
0029 #include <TObject.h>
0030 
0031 
0032 namespace genfit {
0033 
0034 class AbsTrackRep;
0035 class TrackPoint;
0036 
0037 /**
0038  *  @brief Contains the measurement and covariance in raw detector coordinates.
0039  *
0040  *  Detector and hit ids can be used to point back to the original detector hits (clusters etc.).
0041  */
0042 class AbsMeasurement : public TObject {
0043 
0044  public:
0045 
0046   AbsMeasurement() : rawHitCoords_(), rawHitCov_(), detId_(-1), hitId_(-1), trackPoint_(nullptr) {;}
0047   AbsMeasurement(int nDims) : rawHitCoords_(nDims), rawHitCov_(nDims), detId_(-1), hitId_(-1), trackPoint_(nullptr) {;}
0048   AbsMeasurement(const TVectorD& rawHitCoords, const TMatrixDSym& rawHitCov, int detId, int hitId, TrackPoint* trackPoint);
0049 
0050   virtual ~AbsMeasurement();
0051 
0052   //! Deep copy ctor for polymorphic class.
0053   virtual AbsMeasurement* clone() const = 0;
0054 
0055   TrackPoint* getTrackPoint() const {return trackPoint_;}
0056   void setTrackPoint(TrackPoint* tp) {trackPoint_ = tp;}
0057 
0058   const TVectorD& getRawHitCoords() const {return rawHitCoords_;}
0059   const TMatrixDSym& getRawHitCov() const {return rawHitCov_;}
0060   TVectorD& getRawHitCoords() {return rawHitCoords_;}
0061   TMatrixDSym& getRawHitCov() {return rawHitCov_;}
0062   int getDetId() const {return detId_;}
0063   int getHitId() const {return hitId_;}
0064 
0065   //! If the AbsMeasurement is a wire hit, the left/right resolution will be used.
0066   virtual bool isLeftRightMeasurement() const {return false;}
0067   virtual int getLeftRightResolution() const {return 0;}
0068 
0069   unsigned int getDim() const {return rawHitCoords_.GetNrows();}
0070 
0071   void setRawHitCoords(const TVectorD& coords) {rawHitCoords_ = coords;}
0072   void setRawHitCov(const TMatrixDSym& cov) {rawHitCov_ = cov;}
0073   void setDetId(int detId) {detId_ = detId;}
0074   void setHitId(int hitId) {hitId_ = hitId;}
0075 
0076 
0077   /**
0078    * Construct (virtual) detector plane (use state's AbsTrackRep).
0079    * It's possible to make corrections to the plane here.
0080    * The state should be defined somewhere near the measurement.
0081    * For virtual planes, the state will be extrapolated to the POCA to point (SpacepointMeasurement)
0082    * or line (WireMeasurement), and from this info the plane will be constructed.
0083    */
0084   virtual SharedPlanePtr constructPlane(const StateOnPlane& state) const = 0;
0085 
0086   /**
0087    * Construct MeasurementOnPlane on plane of the state
0088    * and wrt the states TrackRep.
0089    * The state will usually be the prediction or reference state,
0090    * and has to be defined AT the measurement.
0091    * The AbsMeasurement will be projected onto the plane.
0092    * It's possible to make corrections to the coordinates here (e.g. by using the state coordinates).
0093    * Usually the vector will contain only one element. But in the case of e.g. a WireMeasurement, it will be 2 (left and right).
0094    */
0095   virtual std::vector<genfit::MeasurementOnPlane*> constructMeasurementsOnPlane(const StateOnPlane& state) const = 0;
0096 
0097   /**
0098    * Returns a new AbsHMatrix object. Caller must take ownership.
0099    */
0100   virtual const AbsHMatrix* constructHMatrix(const AbsTrackRep*) const = 0;
0101 
0102   virtual void Print(const Option_t* = "") const;
0103 
0104 
0105  private:
0106   //! protect from calling assignment operator from outside the class. Use #clone() if you want a copy!
0107   AbsMeasurement& operator=(const AbsMeasurement&); // default cannot work because TVector and TMatrix = operators don't do resizing
0108 
0109  protected:
0110   //! protect from calling copy c'tor from outside the class. Use #clone() if you want a copy!
0111   AbsMeasurement(const AbsMeasurement&);
0112 
0113   TVectorD rawHitCoords_;
0114   TMatrixDSym rawHitCov_;
0115   int detId_; // detId id is -1 per default
0116   int hitId_; // hitId id is -1 per default
0117 
0118   //! Pointer to TrackPoint where the measurement belongs to
0119   TrackPoint* trackPoint_; //! No ownership
0120 
0121  public:
0122   ClassDef(AbsMeasurement, 3)
0123 };
0124 
0125 } /* End of namespace genfit */
0126 /** @} */
0127 
0128 #endif // genfit_AbsMeasurement_h