From 34d0a95d52ba345e839b1e2e652498501c74b74b Mon Sep 17 00:00:00 2001
From: Dmitrii Neverov <dmitrii.neverov@desy.de>
Date: Tue, 2 Jul 2019 13:26:26 +0900
Subject: [PATCH] this should fix issues with caused by ROOT io

---
 trackReps/include/MplTrackRep.h  |  3 ++-
 trackReps/include/RKTrackRep.h   |  4 ++++
 trackReps/src/MplTrackRep.cc     | 20 ++++++++++++++++++++
 trackReps/src/trackRepsLinkDef.h |  2 +-
 4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/trackReps/include/MplTrackRep.h b/trackReps/include/MplTrackRep.h
index ec29bf0a..9cc4992a 100644
--- a/trackReps/include/MplTrackRep.h
+++ b/trackReps/include/MplTrackRep.h
@@ -48,9 +48,10 @@ namespace genfit {
     const double m_magCharge;
     const double m_mass;
 
+
   public:
 
-    ClassDef(MplTrackRep, 1)
+    ClassDefOverride(MplTrackRep, 1)
 
   };
 } //end genfit namespace
diff --git a/trackReps/include/RKTrackRep.h b/trackReps/include/RKTrackRep.h
index dd6461fc..c88647db 100644
--- a/trackReps/include/RKTrackRep.h
+++ b/trackReps/include/RKTrackRep.h
@@ -284,9 +284,13 @@ class RKTrackRep : public AbsTrackRep {
 
   double momMag(const M1x7& state7) const;
 
+ protected:
 
   mutable StateOnPlane lastStartState_; //! state where the last extrapolation has started
   mutable StateOnPlane lastEndState_; //! state where the last extrapolation has ended
+
+ private:
+
   mutable std::vector<RKStep> RKSteps_; //! RungeKutta steps made in the last extrapolation
   mutable int RKStepsFXStart_; //!
   mutable int RKStepsFXStop_; //!
diff --git a/trackReps/src/MplTrackRep.cc b/trackReps/src/MplTrackRep.cc
index c938b850..49abd72e 100644
--- a/trackReps/src/MplTrackRep.cc
+++ b/trackReps/src/MplTrackRep.cc
@@ -26,6 +26,8 @@
 
 #include <math.h>
 
+#include <TBuffer.h>
+
 using namespace genfit;
 
 MplTrackRep::MplTrackRep(int pdgCode, float magCharge, char propDir) :
@@ -254,3 +256,21 @@ double MplTrackRep::RKPropagate(M1x7& state7,
   // in Numerical Recipes.  FIXME: move to caller.
   return pow(DLT/EST, 1./5.);
 }
+
+void MplTrackRep::Streamer(TBuffer &R__b)
+{
+   // I guess I have to reimplement this since it can not be taken from RKTrackRep?
+   typedef ::genfit::MplTrackRep thisClass;
+   UInt_t R__s, R__c;
+   if (R__b.IsReading()) {
+      ::genfit::AbsTrackRep::Streamer(R__b);
+      Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
+      R__b.CheckByteCount(R__s, R__c, thisClass::IsA());
+      lastStartState_.setRep(this);
+      lastEndState_.setRep(this);
+   } else {
+      ::genfit::AbsTrackRep::Streamer(R__b);
+      R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
+      R__b.SetByteCount(R__c, kTRUE);
+   }
+}
diff --git a/trackReps/src/trackRepsLinkDef.h b/trackReps/src/trackRepsLinkDef.h
index e6ff71a7..efc35440 100644
--- a/trackReps/src/trackRepsLinkDef.h
+++ b/trackReps/src/trackRepsLinkDef.h
@@ -8,4 +8,4 @@
 #pragma link C++ namespace genfit;
 
 #pragma link C++ class genfit::RKTrackRep-;
-#pragma link C++ class genfit::MplTrackRep+;
+#pragma link C++ class genfit::MplTrackRep-;
-- 
GitLab