LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
GFAbsRecoHit.h
Go to the documentation of this file.
1 /* Copyright 2008-2010, Technische Universitaet Muenchen,
2  Authors: Christian Hoeppner & Sebastian Neubert
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 */
20 /* @{ */
21 
22 
23 
24 #ifndef GFABSRECOHIT_H
25 #define GFABSRECOHIT_H
26 
27 #include<stdexcept> // std::logic_error
28 #include<iostream>
29 
30 #include "TMatrixT.h"
31 #include "TObject.h"
32 
33 #include "larreco/Genfit/GFException.h" // PrintROOTobject()
36 #include<cmath>
37 
75 namespace genf {
76 
77 class GFAbsRecoHit : public TObject{
78 protected:
80  TMatrixT<Double_t> fHitCoord;
81 
83  TMatrixT<Double_t> fHitCov;
84 
85  private:
86  int fNparHit;
87 
88 public:
89  virtual ~GFAbsRecoHit();
90 
97  GFAbsRecoHit(int NparHit);
98 
101  GFAbsRecoHit();
102 
128  virtual TMatrixT<Double_t> getHMatrix(const GFAbsTrackRep* stateVector)=0;
129  virtual TMatrixT<Double_t> getHMatrix(const GFAbsTrackRep* stateVector, const Double_t&, const Double_t&)=0;
130 
131 
147  virtual TMatrixT<Double_t> residualVector(const GFAbsTrackRep* stateVector,
148  const TMatrixT<Double_t>& state,
149  const GFDetPlane& d) {
150  std::cout << "GFAbsRecoHit::residualVector(3args) Not correctly Using theta -- multiple scattering -- information !!! Fix this if you really want to use getChi2Hit" << std::endl;
151  TMatrixT<Double_t> H = getHMatrix(stateVector);
152  return ( getHitCoord(d) - (H*state ));
153  }
154 
155  virtual TMatrixT<Double_t> residualVector(const GFAbsTrackRep* stateVector,
156  const TMatrixT<Double_t>& state,
157  const GFDetPlane& d,
158  const GFDetPlane& dPrev,
159  const double &mass
160  )
161  {
162  Double_t dist = (d.getO()-dPrev.getO()).Mag();
163  // Double_t mass = 0.104; // close enough for muons, pions, I think.
164  Double_t mom = fabs(1.0/state[0][0]);
165  Double_t beta = mom/sqrt(mass*mass+mom*mom);
166  if (std::isnan(dist) || dist<0.2) dist=0.2; // don't allow 0s here.
167  if (std::isnan(beta) || beta<0.04) beta=0.04;
168 
169  TMatrixT<Double_t> H = getHMatrix(stateVector,beta,dist);
170  return ( getHitCoord(d,dPrev) - (H*state ));
171  }
172 
173 
177  TMatrixT<Double_t> getRawHitCov() const {return fHitCov;}
178 
182  TMatrixT<Double_t> getRawHitCoord() const {return fHitCoord;}
183 
191  virtual TMatrixT<Double_t> getHitCov(const GFDetPlane&)=0;
192  virtual TMatrixT<Double_t> getHitCov(const GFDetPlane&, const GFDetPlane&, const TMatrixT<Double_t>&, const Double_t&)=0;
193 
201  virtual TMatrixT<Double_t> getHitCoord(const GFDetPlane&,const GFDetPlane&)=0;
202  virtual TMatrixT<Double_t> getHitCoord(const GFDetPlane&)=0;
203 
204 
219  virtual const GFDetPlane& getDetPlane(GFAbsTrackRep*) = 0;
220 
221 
222 
229  virtual GFAbsRecoHit* clone() = 0;
230 
233  virtual void Print(std::ostream& out = std::cout) const
234  { PrintROOTobject(out, fHitCoord); }
235 
236  virtual const std::string& getPolicyName();
237 
238  int getNparHit(){return fNparHit;}
239 
240  // public:
241  //ClassDef(GFAbsRecoHit,3)
242 
243  private:
244  virtual void Print(Option_t*) const
245  { throw std::logic_error(std::string(__func__) + "::Print(Option_t*) not available"); }
246 
247 };
248 } // namespace
249 
250 #endif //FITTER_ABSHIT_H
251 
virtual TMatrixT< Double_t > getHitCoord(const GFDetPlane &, const GFDetPlane &)=0
Get hit coordinates in a specific detector plane.
virtual ~GFAbsRecoHit()
TMatrixT< Double_t > fHitCoord
Vector of raw coordinates of hit.
Definition: GFAbsRecoHit.h:80
virtual const std::string & getPolicyName()
Generic Interface to magnetic fields in GENFIT.
virtual TMatrixT< Double_t > getHMatrix(const GFAbsTrackRep *stateVector)=0
Get transformation matrix. Transformation between hit coordinates and track representation coordinate...
virtual const GFDetPlane & getDetPlane(GFAbsTrackRep *)=0
Get detector plane for a given track representation.
TMatrixT< Double_t > getRawHitCoord() const
Get raw hit coordinates.
Definition: GFAbsRecoHit.h:182
Double_t beta
Base Class for genfit track representations. Defines interface for track parameterizations.
Definition: GFAbsTrackRep.h:85
TVector3 getO() const
Definition: GFDetPlane.h:76
virtual void Print(Option_t *) const
Definition: GFAbsRecoHit.h:244
virtual TMatrixT< Double_t > residualVector(const GFAbsTrackRep *stateVector, const TMatrixT< Double_t > &state, const GFDetPlane &d, const GFDetPlane &dPrev, const double &mass)
Definition: GFAbsRecoHit.h:155
virtual TMatrixT< Double_t > getHitCov(const GFDetPlane &)=0
Get hit covariances in a specific detector plane.
Float_t d
Definition: plot.C:237
virtual void Print(std::ostream &out=std::cout) const
Print raw hit coordinates.
Definition: GFAbsRecoHit.h:233
GFAbsRecoHit()
Default constructor needed for compatibility with ROOT.
void PrintROOTobject(std::ostream &, const ROOTOBJ &)
Small utility functions which print some ROOT objects into an output stream.
Definition: GFException.h:129
TMatrixT< Double_t > getRawHitCov() const
Get raw hit covariances.
Definition: GFAbsRecoHit.h:177
virtual TMatrixT< Double_t > residualVector(const GFAbsTrackRep *stateVector, const TMatrixT< Double_t > &state, const GFDetPlane &d)
Calculate residual with respect to a track representation.
Definition: GFAbsRecoHit.h:147
TMatrixT< Double_t > fHitCov
Covariance of raw hit coordinates.
Definition: GFAbsRecoHit.h:83
virtual GFAbsRecoHit * clone()=0
Get clone of this object.