EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ProlateSpacepointMeasurement.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ProlateSpacepointMeasurement.cc
1 /* Copyright 2008-2010, Technische Universitaet Muenchen,
2  Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
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 
21 
22 #include <cmath>
23 
24 #include "Exception.h"
25 #include "RKTrackRep.h"
26 
27 
28 namespace genfit {
29 
31  : SpacepointMeasurement(nDim), largestErrorDirection_(0,0,1)
32 {
33  ;
34 }
35 
36 ProlateSpacepointMeasurement::ProlateSpacepointMeasurement(const TVectorD& rawHitCoords, const TMatrixDSym& rawHitCov, int detId, int hitId, TrackPoint* trackPoint)
37  : SpacepointMeasurement(rawHitCoords, rawHitCov, detId, hitId, trackPoint), largestErrorDirection_(0,0,1)
38 {
39  ;
40 }
41 
42 
44 
45  // copy state. Neglect covariance.
46  StateOnPlane st(state);
47 
48 
49  const TVector3 wire1(rawHitCoords_(0), rawHitCoords_(1), rawHitCoords_(2));
50 
51  const AbsTrackRep* rep = state.getRep();
53 
54  TVector3 dirInPoca = rep->getMom(st);
55  dirInPoca.SetMag(1.);
56 
57  // check if direction is parallel to wire
58  if (fabs(largestErrorDirection_.Angle(dirInPoca)) < 0.01){
59  Exception exc("ProlateSpacepointMeasurement::constructPlane(): Cannot construct detector plane, track direction is parallel to largest error direction", __LINE__,__FILE__);
60  throw exc;
61  }
62 
63  // construct orthogonal vector
64  TVector3 U = largestErrorDirection_.Cross(dirInPoca);
65 
66  return SharedPlanePtr(new DetPlane(wire1, U, largestErrorDirection_));
67 }
68 
69 
70 } /* End of namespace genfit */