Back to home page

sPhenix code displayed by LXR

 
 

    


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

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 
0020 #include "ProlateSpacepointMeasurement.h"
0021 
0022 #include <cmath>
0023 
0024 #include "Exception.h"
0025 #include "RKTrackRep.h"
0026 
0027 
0028 namespace genfit {
0029 
0030 ProlateSpacepointMeasurement::ProlateSpacepointMeasurement(int nDim)
0031   : SpacepointMeasurement(nDim), largestErrorDirection_(0,0,1)
0032 {
0033   ;
0034 }
0035 
0036 ProlateSpacepointMeasurement::ProlateSpacepointMeasurement(const TVectorD& rawHitCoords, const TMatrixDSym& rawHitCov, int detId, int hitId, TrackPoint* trackPoint)
0037   : SpacepointMeasurement(rawHitCoords, rawHitCov, detId, hitId, trackPoint), largestErrorDirection_(0,0,1)
0038 {
0039   ;
0040 }
0041 
0042 
0043 SharedPlanePtr ProlateSpacepointMeasurement::constructPlane(const StateOnPlane& state) const {
0044 
0045   // copy state. Neglect covariance.
0046   StateOnPlane st(state);
0047 
0048 
0049   const TVector3 wire1(rawHitCoords_(0), rawHitCoords_(1), rawHitCoords_(2));
0050 
0051   const AbsTrackRep* rep = state.getRep();
0052   rep->extrapolateToLine(st, wire1, largestErrorDirection_);
0053 
0054   TVector3 dirInPoca = rep->getMom(st);
0055   dirInPoca.SetMag(1.);
0056 
0057   // check if direction is parallel to wire
0058   if (fabs(largestErrorDirection_.Angle(dirInPoca)) < 0.01){
0059     Exception exc("ProlateSpacepointMeasurement::constructPlane(): Cannot construct detector plane, track direction is parallel to largest error direction", __LINE__,__FILE__);
0060     throw exc;
0061   }
0062 
0063   // construct orthogonal vector
0064   TVector3 U = largestErrorDirection_.Cross(dirInPoca);
0065 
0066   return SharedPlanePtr(new DetPlane(wire1, U, largestErrorDirection_));
0067 }
0068 
0069 
0070 } /* End of namespace genfit */