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 "FullMeasurement.h"
0021 
0022 #include <Exception.h>
0023 #include <RKTrackRep.h>
0024 #include <HMatrixUnit.h>
0025 
0026 #include <cassert>
0027 #include <TBuffer.h>
0028 
0029 namespace genfit {
0030 
0031 FullMeasurement::FullMeasurement(int nDim)
0032   : AbsMeasurement(nDim), plane_()
0033 {
0034   assert(nDim >= 1);
0035 }
0036 
0037 
0038 FullMeasurement::FullMeasurement(const MeasuredStateOnPlane& state, int detId, int hitId, TrackPoint* trackPoint)
0039   : AbsMeasurement(state.getState(), state.getCov(), detId, hitId, trackPoint), plane_(state.getPlane())
0040 {
0041   assert(rawHitCoords_.GetNrows() == (int)state.getRep()->getDim());
0042 }
0043 
0044 
0045 SharedPlanePtr FullMeasurement::constructPlane(const StateOnPlane&) const {
0046   if (!plane_) {
0047     Exception exc("FullMeasurement::constructPlane(): No plane has been set!", __LINE__,__FILE__);
0048     throw exc;
0049   }
0050   return plane_;
0051 }
0052 
0053 
0054 std::vector<MeasurementOnPlane*> FullMeasurement::constructMeasurementsOnPlane(const StateOnPlane& state) const {
0055 
0056   MeasurementOnPlane* mop = new MeasurementOnPlane(rawHitCoords_,
0057        rawHitCov_,
0058        state.getPlane(), state.getRep(), constructHMatrix(state.getRep()));
0059 
0060   std::vector<MeasurementOnPlane*> retVal;
0061   retVal.push_back(mop);
0062   return retVal;
0063 }
0064 
0065 
0066 const AbsHMatrix* FullMeasurement::constructHMatrix(const AbsTrackRep* rep) const {
0067 
0068   if (dynamic_cast<const RKTrackRep*>(rep) == nullptr) {
0069     Exception exc("SpacepointMeasurement default implementation can only handle state vectors of type RKTrackRep!", __LINE__,__FILE__);
0070     throw exc;
0071   }
0072 
0073   return new HMatrixUnit();
0074 }
0075 
0076 
0077 void FullMeasurement::Streamer(TBuffer &R__b)
0078 {
0079    // Stream an object of class genfit::FullMeasurement.
0080 
0081    //This works around a msvc bug and should be harmless on other platforms
0082    typedef ::genfit::FullMeasurement thisClass;
0083    UInt_t R__s, R__c;
0084    if (R__b.IsReading()) {
0085       Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
0086       //This works around a msvc bug and should be harmless on other platforms
0087       typedef genfit::AbsMeasurement baseClass0;
0088       baseClass0::Streamer(R__b);
0089       char flag;
0090       R__b >> flag;
0091       plane_.reset();
0092       if (flag) {
0093         plane_.reset(new DetPlane());
0094         plane_->Streamer(R__b);
0095       }
0096       R__b.CheckByteCount(R__s, R__c, thisClass::IsA());
0097    } else {
0098       R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
0099       //This works around a msvc bug and should be harmless on other platforms
0100       typedef genfit::AbsMeasurement baseClass0;
0101       baseClass0::Streamer(R__b);
0102       if (plane_) {
0103         R__b << (char)1;
0104         plane_->Streamer(R__b);
0105       } else {
0106         R__b << (char)0;
0107       }
0108       R__b.SetByteCount(R__c, kTRUE);
0109    }
0110 }
0111 
0112 } /* End of namespace genfit */