Back to home page

sPhenix code displayed by LXR

 
 

    


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

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 
0021 #include "GFRaveTrackParameters.h"
0022 #include "GFRaveConverters.h"
0023 #include "Exception.h"
0024 
0025 #include <iostream>
0026 
0027 
0028 namespace genfit {
0029 
0030 
0031 GFRaveTrackParameters::GFRaveTrackParameters() :
0032   originalTrack_(nullptr),
0033   weight_(0),
0034   state_(6),
0035   cov_(6,6),
0036   hasSmoothedData_(false)
0037 {
0038   ;
0039 }
0040 
0041 
0042 GFRaveTrackParameters::GFRaveTrackParameters(const Track* track, MeasuredStateOnPlane* /*originalState*/, double weight, const TVectorD & state6, const TMatrixDSym & cov6x6, bool isSmoothed) :
0043   originalTrack_(const_cast<Track*>(track)),
0044   weight_(weight),
0045   state_(state6),
0046   cov_(cov6x6),
0047   hasSmoothedData_(isSmoothed)
0048 {
0049   if (state_.GetNrows() != 6) {
0050     Exception exc("GFRaveTrackParameters ==> State is not 6D!",__LINE__,__FILE__);
0051     throw exc;
0052   }
0053   if (cov_.GetNrows()!=6) {
0054     Exception exc("GFRaveTrackParameters ==> Covariance is not 6D!",__LINE__,__FILE__);
0055     throw exc;
0056   }
0057 
0058 }
0059 
0060 
0061 GFRaveTrackParameters::GFRaveTrackParameters(const Track* track, MeasuredStateOnPlane* /*originalState*/, double weight) :
0062   originalTrack_(const_cast<Track*>(track)),
0063   weight_(weight),
0064   state_(1,6),
0065   cov_(6,6),
0066   hasSmoothedData_(false)
0067 {
0068   ;
0069 }
0070 
0071 
0072 TVector3
0073 GFRaveTrackParameters::getPos() const {
0074   return TVector3(state_[0], state_[1], state_[2]);
0075 }
0076 
0077 
0078 TVector3
0079 GFRaveTrackParameters::getMom() const {
0080   return TVector3(state_[3], state_[4], state_[5]);
0081 }
0082 
0083 
0084 double
0085 GFRaveTrackParameters::getCharge() const {
0086   return getTrack()->getFitStatus()->getCharge();
0087 }
0088 
0089 
0090 double
0091 GFRaveTrackParameters::getPdg() const{
0092   if (hasTrack())
0093     return getTrack()->getCardinalRep()->getPDG();
0094   else {
0095     Exception exc("GFRaveTrackParameters::getPdg() ==> no genfit::Track available!",__LINE__,__FILE__);
0096     throw exc;
0097   }
0098 }
0099 
0100 
0101 void
0102 GFRaveTrackParameters::Print(const Option_t*) const {
0103   std::cout << "weight: " << getWeight() << "\n";
0104   if (!hasSmoothedData_) std::cout << "state and cov are NOT smoothed! \n";
0105   std::cout << "state: "; getState().Print();
0106   std::cout << "cov: "; getCov().Print();
0107   if (hasTrack()) {std::cout << "genfit::Track: "; getTrack()->Print();}
0108   else std::cout << "NO genfit::Track pointer \n";
0109 }
0110 
0111 
0112 } /* End of namespace genfit */