From c1b10f166da1a47a4b447be26baa55825986c714 Mon Sep 17 00:00:00 2001
From: Susumu Oda <susumu.oda@cern.ch>
Date: Mon, 13 May 2019 04:22:39 +0000
Subject: [PATCH] Make methods of SiSpacePointsSeedMaker_Trigger const by
 defining EventData to hold event dependent data.

---
 .../SiSpacePointsSeedMaker_Trigger.h          |  250 +--
 .../src/SiSpacePointsSeedMaker_Trigger.cxx    | 1420 +++++++++--------
 2 files changed, 865 insertions(+), 805 deletions(-)

diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Trigger.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Trigger.h
index 142f186b79c..c285ddb82e4 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Trigger.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Trigger.h
@@ -32,6 +32,7 @@
 
 #include <list>
 #include <map>
+#include <mutex>
 #include <vector>
 
 class MsgStream;
@@ -117,19 +118,22 @@ namespace InDet {
       
     ServiceHandle<MagField::IMagFieldSvc> m_fieldServiceHandle{this, "MagFieldSvc", "AtlasFieldSvc"};
 
-    SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
+    ///////////////////////////////////////////////////////////////////
+    // Space points container
+    ///////////////////////////////////////////////////////////////////
+    SG::ReadHandleKey<SpacePointContainer> m_spacepointsSCT{this, "SpacePointsSCTName", "SCT_SpacePoints"};
+    SG::ReadHandleKey<SpacePointContainer> m_spacepointsPixel{this, "SpacePointsPixelName", "PixelSpacePoints"};
+    SG::ReadHandleKey<SpacePointOverlapCollection> m_spacepointsOverlap{this, "SpacePointsOverlapName", "OverlapSpacePoints"};
+
+    SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey{this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"};
+
+    // Properties, which will not be changed after construction
     BooleanProperty m_pixel{this, "usePixel", true};
     BooleanProperty m_sct{this, "useSCT", true};
-    bool                        m_endlist{true};
     BooleanProperty m_useOverlap{this, "useOverlapSpCollection", true};
-    bool                        m_trigger{false};
-    int                         m_outputlevel {};
-    int                         m_nprint   {};
-    int                         m_state{0};
-    int                         m_nspoint{2};
-    int                         m_mode{0};
-    int                         m_nlist{0};
     IntegerProperty m_maxsize{this, "maxSize", 20000};
+    IntegerProperty m_maxsizeSP{this, "maxSizeSP", 1500};
+    IntegerProperty m_maxOneSize{this, "maxSeedsForSpacePoint", 3};
     UnsignedIntegerProperty m_maxNumberVertices{this, "maxNumberVertices", 99};
     FloatProperty m_r1min{this, "minRadius1", 0.};
     FloatProperty m_r1minv{this, "minVRadius1", 0.};
@@ -140,21 +144,10 @@ namespace InDet {
     FloatProperty m_r2max{this, "maxRadius2", 600.};
     FloatProperty m_r2maxv{this, "maxVRadius2", 200.};
     FloatProperty m_r3min{this, "minRadius3", 0.};
-    FloatProperty m_r3max{this, "maxRadius3", 600.};
     FloatProperty m_drmin{this, "mindRadius", 10.};
-    float m_drminv{20.};
     FloatProperty m_drmax{this, "maxdRadius", 270.};
-    FloatProperty m_rapcut{this, "RapidityCut", 2.7};
-    float                       m_dzdrmin {};
-    float                       m_dzdrmax {};
     FloatProperty m_zmin{this, "minZ", -250.};
     FloatProperty m_zmax{this, "maxZ", +250.};
-    float                       m_zminU {};
-    float                       m_zmaxU  {};
-    float                       m_zminB  {};
-    float                       m_zmaxB  {};
-    float                       m_ftrig  {};
-    float                       m_ftrigW {};
     FloatProperty m_r_rmax{this, "radMax", 600.};
     FloatProperty m_r_rstep{this, "radStep", 2.};
     FloatProperty m_dzver{this, "maxdZver", 5.};
@@ -162,77 +155,102 @@ namespace InDet {
     FloatProperty m_diver{this, "maxdImpact", 10.};
     FloatProperty m_diverpps{this, "maxdImpactPPS", 1.7};
     FloatProperty m_diversss{this, "maxdImpactSSS", 1000.};
-    float                       m_dazmax{0.02};
-    FloatProperty m_ptmin{this, "pTmin", 500.};
-    float                       m_ipt      {};
-    float                       m_ipt2     {};
-    float                       m_COF     {};
-    float                       m_K      {};
-    int m_r_size {};
-    int m_rf_size   {};
-    int m_rfz_size  {};
-    std::vector<std::list<InDet::SiSpacePointForSeed*>> m_r_Sorted;
-    std::list<InDet::SiSpacePointForSeed*>  m_rfz_Sorted [SizeRFZ];
-    std::list<InDet::SiSpacePointForSeed*>  m_rfzv_Sorted[SizeRFZV];
-    std::list<InDet::SiSpacePointForSeed> m_l_spforseed;
-    std::list<InDet::SiSpacePointForSeed>::iterator m_i_spforseed;
-    std::list<InDet::SiSpacePointForSeed*>::iterator m_rMin;
-
-    int m_ns{},m_nsaz{},m_nsazv   {};
-    int m_fNmax{},m_fvNmax  {};
-    int m_fNmin{},m_fvNmin{};
-    int m_zMin  {};
-    int  m_nr {};
-    std::vector<int> m_r_index;
-    std::vector<int> m_r_map;
-    int  m_nrfz {}  , m_rfz_index  [SizeRFZ], m_rfz_map  [SizeRFZ];
-    int  m_nrfzv {} , m_rfzv_index [SizeRFZV], m_rfzv_map [SizeRFZV];
-    int m_rfz_b[SizeRFZ],m_rfz_t[SizeRFZ],m_rfz_ib[SizeRFZ][SizeI],m_rfz_it[SizeRFZ][SizeI];
-    int m_rfzv_n[SizeRFZV],m_rfzv_i[SizeRFZV][SizeIV];
-    float m_sF {};
-    float m_sFv  {};
 
-    ///////////////////////////////////////////////////////////////////
-    // Tables for 3 space points seeds search
-    ///////////////////////////////////////////////////////////////////
-     
-    IntegerProperty m_maxsizeSP{this, "maxSizeSP", 1500};
-    std::vector<InDet::SiSpacePointForSeed*> m_SP;
-    std::vector<float> m_R;
-    std::vector<float> m_Tz;
-    std::vector<float> m_Er;
-    std::vector<float> m_U;
-    std::vector<float> m_V;
-    std::vector<float> m_Zo;
-
-    std::list<InDet::SiSpacePointsSeed>           m_l_seeds;
-    std::list<InDet::SiSpacePointsSeed>::iterator m_i_seed;
-    std::list<InDet::SiSpacePointsSeed>::iterator m_i_seede;
-
-    std::multimap<float,InDet::SiSpacePointsSeed*> m_mapOneSeeds;
-    std::multimap<float,InDet::SiSpacePointsSeed*> m_mapSeeds;
-    std::multimap<float,InDet::SiSpacePointsSeed*>::iterator m_seed;
-    std::multimap<float,InDet::SiSpacePointsSeed*>::iterator m_seede;
-
-    std::vector<InDet::SiSpacePointsSeed> m_OneSeeds;
-    IntegerProperty m_maxOneSize{this, "maxSeedsForSpacePoint", 3};
-    int                                            m_nOneSeeds {};
-    std::list<float>                               m_l_vertex;
- 
-    ///////////////////////////////////////////////////////////////////
-    // Beam geometry
-    ///////////////////////////////////////////////////////////////////
-    float m_xbeam[4]{0., 1., 0., 0.}; // x,ax,ay,az - center and x-axis direction
-    float m_ybeam[4]{0., 0., 1., 0.}; // y,ax,ay,az - center and y-axis direction
-    float m_zbeam[4]{0., 0., 0., 1.}; // z,ax,ay,az - center and z-axis direction
+    // Properties, which can be updated in initialize
+    FloatProperty m_r3max{this, "maxRadius3", 600.}; // Always overwriten by m_r_rmax
+    FloatProperty m_rapcut{this, "RapidityCut", 2.7};
+    FloatProperty m_ptmin{this, "pTmin", 500.};
 
-    ///////////////////////////////////////////////////////////////////
-    // Space points container
-    ///////////////////////////////////////////////////////////////////
+    // Not updated at all
+    float m_drminv{20.};
 
-    SG::ReadHandleKey<SpacePointContainer> m_spacepointsSCT{this, "SpacePointsSCTName", "SCT_SpacePoints"};
-    SG::ReadHandleKey<SpacePointContainer> m_spacepointsPixel{this, "SpacePointsPixelName", "PixelSpacePoints"};
-    SG::ReadHandleKey<SpacePointOverlapCollection> m_spacepointsOverlap{this, "SpacePointsOverlapName", "OverlapSpacePoints"};
+    // Updated in only initialize
+    bool m_initialized{false};
+    int m_outputlevel{0};
+    int m_r_size{0};
+    int m_fNmax{0};
+    int m_fvNmax{0};
+    int m_rfz_b[SizeRFZ];
+    int m_rfz_t[SizeRFZ];
+    int m_rfz_ib[SizeRFZ][SizeI];
+    int m_rfz_it[SizeRFZ][SizeI];
+    int m_rfzv_n[SizeRFZV];
+    int m_rfzv_i[SizeRFZV][SizeIV];
+    float m_dzdrmin{0.};
+    float m_dzdrmax{0.};
+    float m_ipt{0.};
+    float m_ipt2{0.};
+    float m_COF{0.};
+    float m_sF{0.};
+    float m_sFv{0.};
+
+    mutable std::mutex m_mutex;
+    mutable std::vector<EventContext::ContextEvt_t> m_cache ATLAS_THREAD_SAFE; // Guarded by m_mutex
+    struct EventData { // To hold event dependent data
+      bool endlist{true};
+      bool trigger{false};
+      int nprint{0};
+      int state{0};
+      int nspoint{2};
+      int mode{0};
+      int nlist{0};
+      int ns{0};
+      int nsaz{0};
+      int nsazv{0};
+      int fNmin{0};
+      int fvNmin{0};
+      int zMin{0};
+      int nr{0};
+      int nrfz{0};
+      int nrfzv{0};
+      int nOneSeeds{0};
+      int rfz_index[SizeRFZ];
+      int rfz_map[SizeRFZ];
+      int rfzv_index[SizeRFZV];
+      int rfzv_map[SizeRFZV];
+      float zminU{0.};
+      float zmaxU{0.};
+      float zminB{0.};
+      float zmaxB{0.};
+      float ftrig{0.};
+      float ftrigW{0.};
+      float K{0.};
+
+      std::vector<int> r_index;
+      std::vector<int> r_map;
+      std::vector<std::list<InDet::SiSpacePointForSeed*>> r_Sorted;
+      std::vector<InDet::SiSpacePointsSeed> OneSeeds;
+      std::multimap<float,InDet::SiSpacePointsSeed*> mapOneSeeds;
+      std::multimap<float,InDet::SiSpacePointsSeed*> mapSeeds;
+      std::multimap<float,InDet::SiSpacePointsSeed*>::iterator seed;
+      std::multimap<float,InDet::SiSpacePointsSeed*>::iterator seede;
+      std::list<InDet::SiSpacePointForSeed*> rfz_Sorted[SizeRFZ];
+      std::list<InDet::SiSpacePointForSeed*> rfzv_Sorted[SizeRFZV];
+      std::list<InDet::SiSpacePointForSeed> l_spforseed;
+      std::list<InDet::SiSpacePointForSeed>::iterator i_spforseed;
+      std::list<InDet::SiSpacePointForSeed*>::iterator rMin;
+      std::list<InDet::SiSpacePointsSeed> l_seeds;
+      std::list<InDet::SiSpacePointsSeed>::iterator i_seed;
+      std::list<InDet::SiSpacePointsSeed>::iterator i_seede;
+      std::list<float> l_vertex;
+      ///////////////////////////////////////////////////////////////////
+      // Tables for 3 space points seeds search
+      ///////////////////////////////////////////////////////////////////
+      std::vector<InDet::SiSpacePointForSeed*> SP;
+      std::vector<float> R;
+      std::vector<float> Tz;
+      std::vector<float> Er;
+      std::vector<float> U;
+      std::vector<float> V;
+      std::vector<float> Zo;
+      ///////////////////////////////////////////////////////////////////
+      // Beam geometry
+      ///////////////////////////////////////////////////////////////////
+      float xbeam[4]{0., 1., 0., 0.}; // x,ax,ay,az - center and x-axis direction
+      float ybeam[4]{0., 0., 1., 0.}; // y,ax,ay,az - center and y-axis direction
+      float zbeam[4]{0., 0., 0., 1.}; // z,ax,ay,az - center and z-axis direction
+    };
+    mutable std::vector<EventData> m_eventData ATLAS_THREAD_SAFE; // Guarded by m_mutex
 
     ///////////////////////////////////////////////////////////////////
     // Private methods
@@ -244,49 +262,55 @@ namespace InDet {
     SiSpacePointsSeedMaker_Trigger &operator=(const SiSpacePointsSeedMaker_Trigger&) = delete;
     //@}
 
-    MsgStream&    dumpConditions(MsgStream   & out) const;
-    MsgStream&    dumpEvent     (MsgStream   & out) const;
+    MsgStream& dumpConditions(EventData& data, MsgStream& out) const;
+    MsgStream& dumpEvent(EventData& data, MsgStream& out) const;
 
     void buildFrameWork();
-    void buildBeamFrameWork();
+    void buildBeamFrameWork(EventData& data) const;
 
     SiSpacePointForSeed* newSpacePoint
-    (const Trk::SpacePoint*const&);
+    (EventData& data, const Trk::SpacePoint*const&) const;
     void newSeed
-    (const Trk::SpacePoint*&,const Trk::SpacePoint*&,
-     const float&);
+    (EventData& data,
+     const Trk::SpacePoint*&,const Trk::SpacePoint*&,
+     const float&) const;
 
     void newOneSeed
-    (const Trk::SpacePoint*&,const Trk::SpacePoint*&,
-     const Trk::SpacePoint*&,const float&,const float&);
-    void fillSeeds();
-
-    void fillLists     ();
-    void erase         ();
-    void production2Sp ();
-    void production3Sp ();
+    (EventData& data,
+     const Trk::SpacePoint*&,const Trk::SpacePoint*&,
+     const Trk::SpacePoint*&,const float&,const float&) const;
+    void fillSeeds(EventData& data) const;
+
+    void fillLists(EventData& data) const;
+    void erase(EventData& data) const;
+    void production2Sp(EventData& data) const;
+    void production3Sp(EventData& data) const;
     void production3Sp
-    (std::list<InDet::SiSpacePointForSeed*>::iterator*,
+    (EventData& data,
+     std::list<InDet::SiSpacePointForSeed*>::iterator*,
      std::list<InDet::SiSpacePointForSeed*>::iterator*,
      std::list<InDet::SiSpacePointForSeed*>::iterator*,
      std::list<InDet::SiSpacePointForSeed*>::iterator*,
-     int,int,int&);
+     int,int,int&) const;
     void production3SpTrigger
-    (std::list<InDet::SiSpacePointForSeed*>::iterator*,
+    (EventData& data,
      std::list<InDet::SiSpacePointForSeed*>::iterator*,
      std::list<InDet::SiSpacePointForSeed*>::iterator*,
      std::list<InDet::SiSpacePointForSeed*>::iterator*,
-     int,int,int&);
+     std::list<InDet::SiSpacePointForSeed*>::iterator*,
+     int,int,int&) const;
  
-    bool newVertices(const std::list<Trk::Vertex>&);
-    void findNext();
-    bool isZCompatible     (float&,float&,float&);
-    void convertToBeamFrameWork(const Trk::SpacePoint*const&,float*);
-    float dZVertexMin(float&);
+    bool newVertices(EventData& data, const std::list<Trk::Vertex>&) const;
+    void findNext(EventData& data) const;
+    bool isZCompatible(EventData& data, float&, float&, float&) const;
+    void convertToBeamFrameWork(EventData& data, const Trk::SpacePoint*const&, float*) const;
+    float dZVertexMin(EventData& data, float&) const;
+
+    EventData& getEventData() const;
   };
 
-  MsgStream&    operator << (MsgStream&   ,const SiSpacePointsSeedMaker_Trigger&);
-  std::ostream& operator << (std::ostream&,const SiSpacePointsSeedMaker_Trigger&);
+  MsgStream& operator << (MsgStream&, const SiSpacePointsSeedMaker_Trigger&);
+  std::ostream& operator << (std::ostream&, const SiSpacePointsSeedMaker_Trigger&);
 
 } // end of name space
 
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
index 49cd204ba25..eac519a8ea0 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
@@ -22,8 +22,8 @@
 ///////////////////////////////////////////////////////////////////
 
 InDet::SiSpacePointsSeedMaker_Trigger::SiSpacePointsSeedMaker_Trigger
-(const std::string& t,const std::string& n,const IInterface* p)
-  : AthAlgTool(t,n,p)
+(const std::string& t, const std::string& n, const IInterface* p)
+  : AthAlgTool(t, n, p)
 {
   declareInterface<ISiSpacePointsSeedMaker>(this);
 }
@@ -60,9 +60,13 @@ StatusCode InDet::SiSpacePointsSeedMaker_Trigger::initialize()
   //
   m_outputlevel = msg().level()-MSG::DEBUG;
   if (m_outputlevel<=0) {
-    m_nprint=0;
+    EventData& data{getEventData()};
+    data.nprint=0;
     ATH_MSG_DEBUG(*this);
   }
+
+  m_initialized = true;
+
   return sc;
 }
 
@@ -79,26 +83,28 @@ StatusCode InDet::SiSpacePointsSeedMaker_Trigger::finalize()
 // Initialize tool for new event 
 ///////////////////////////////////////////////////////////////////
 
-void InDet::SiSpacePointsSeedMaker_Trigger::newEvent (int)
+void InDet::SiSpacePointsSeedMaker_Trigger::newEvent(int)
 {
-  m_trigger = false;
+  EventData& data{getEventData()};
+
+  data.trigger = false;
   if (!m_pixel && !m_sct) return;
-  erase();
-  buildBeamFrameWork();
+  erase(data);
+  buildBeamFrameWork(data);
 
   double f[3], gP[3] ={10.,10.,0.};
 
   if (m_fieldServiceHandle->solenoidOn()) {
     m_fieldServiceHandle->getFieldZR(gP,f);
-    m_K = 2./(300.*f[2]);
+    data.K = 2./(300.*f[2]);
   } else {
-    m_K = 2./(300.* 5. );
+    data.K = 2./(300.* 5.);
   }
 
-  m_i_spforseed = m_l_spforseed.begin();
+  data.i_spforseed = data.l_spforseed.begin();
 
   float irstep = 1./m_r_rstep;
-  int   irmax  = m_r_size-1  ;
+  int   irmax  = m_r_size-1;
 
   // Get pixels space points containers from store gate 
   //
@@ -110,18 +116,18 @@ void InDet::SiSpacePointsSeedMaker_Trigger::newEvent (int)
       for (const SpacePointCollection* spc: *spacepointsPixel) {
         for (const Trk::SpacePoint* sp: *spc) {
 
-	  float r = sp->r();
+          float r = sp->r();
           if (r<0. || r>=m_r_rmax) continue;
 
-	  InDet::SiSpacePointForSeed* sps = newSpacePoint(sp);
+          InDet::SiSpacePointForSeed* sps = newSpacePoint(data, sp);
 
-	  int ir = static_cast<int>(sps->radius()*irstep);
+          int ir = static_cast<int>(sps->radius()*irstep);
           if (ir>irmax) ir = irmax;
-	  m_r_Sorted[ir].push_back(sps);
-          ++m_r_map[ir];
-	  if (m_r_map[ir]==1) m_r_index[m_nr++] = ir;
-	  ++m_ns;
-	}
+          data.r_Sorted[ir].push_back(sps);
+          ++data.r_map[ir];
+          if (data.r_map[ir]==1) data.r_index[data.nr++] = ir;
+          ++data.ns;
+        }
       }
     }
   }
@@ -136,18 +142,18 @@ void InDet::SiSpacePointsSeedMaker_Trigger::newEvent (int)
       for (const SpacePointCollection* spc: *spacepointsSCT) {
         for (const Trk::SpacePoint* sp: *spc) {
 
-	  float r = sp->r();
+          float r = sp->r();
           if (r<0. || r>=m_r_rmax) continue;
 
-	  InDet::SiSpacePointForSeed* sps = newSpacePoint(sp);
+          InDet::SiSpacePointForSeed* sps = newSpacePoint(data, sp);
 
-	  int   ir = static_cast<int>(sps->radius()*irstep);
+          int   ir = static_cast<int>(sps->radius()*irstep);
           if (ir>irmax) ir = irmax;
-	  m_r_Sorted[ir].push_back(sps);
-          ++m_r_map[ir];
-	  if (m_r_map[ir]==1) m_r_index[m_nr++] = ir;
-	  ++m_ns;
-	}
+          data.r_Sorted[ir].push_back(sps);
+          ++data.r_map[ir];
+          if (data.r_map[ir]==1) data.r_index[data.nr++] = ir;
+          ++data.ns;
+        }
       }
     }
 
@@ -157,25 +163,25 @@ void InDet::SiSpacePointsSeedMaker_Trigger::newEvent (int)
 
       SG::ReadHandle<SpacePointOverlapCollection> spacepointsOverlap{m_spacepointsOverlap};
       if (spacepointsOverlap.isValid()) {
-	
+ 
         for (const Trk::SpacePoint* sp: *spacepointsOverlap) {
 
-	  float r = sp->r();
-	  if (r<0. || r>=m_r_rmax) continue;
+          float r = sp->r();
+          if (r<0. || r>=m_r_rmax) continue;
 
-	  InDet::SiSpacePointForSeed* sps = newSpacePoint(sp);
+          InDet::SiSpacePointForSeed* sps = newSpacePoint(data, sp);
 
-	  int ir = static_cast<int>(sps->radius()*irstep);
+          int ir = static_cast<int>(sps->radius()*irstep);
           if (ir>irmax) ir = irmax;
-	  m_r_Sorted[ir].push_back(sps);
-          ++m_r_map[ir];
-	  if (m_r_map[ir]==1) m_r_index[m_nr++] = ir;
-	  ++m_ns;
-	}
+          data.r_Sorted[ir].push_back(sps);
+          ++data.r_map[ir];
+          if (data.r_map[ir]==1) data.r_index[data.nr++] = ir;
+          ++data.ns;
+        }
       }
     }
   }
-  fillLists();
+  fillLists(data);
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -185,24 +191,26 @@ void InDet::SiSpacePointsSeedMaker_Trigger::newEvent (int)
 void InDet::SiSpacePointsSeedMaker_Trigger::newRegion
 (const std::vector<IdentifierHash>& vPixel, const std::vector<IdentifierHash>& vSCT)
 {
-  m_trigger = false;
+  EventData& data{getEventData()};
+
+  data.trigger = false;
   if (!m_pixel && !m_sct) return;
-  erase();
+  erase(data);
 
-  buildBeamFrameWork();
+  buildBeamFrameWork(data);
 
   double f[3], gP[3] ={10.,10.,0.};
   if (m_fieldServiceHandle->solenoidOn()) {
-    m_fieldServiceHandle->getFieldZR(gP,f);
-    m_K = 2./(300.*f[2]);
+    m_fieldServiceHandle->getFieldZR(gP, f);
+    data.K = 2./(300.*f[2]);
   } else {
-    m_K = 2./(300.* 5. );
+    data.K = 2./(300.* 5.);
   }
 
-  m_i_spforseed = m_l_spforseed.begin();
+  data.i_spforseed = data.l_spforseed.begin();
 
   float irstep = 1./m_r_rstep;
-  int   irmax  = m_r_size-1  ;
+  int   irmax  = m_r_size-1;
 
   // Get pixels space points containers from store gate 
   //
@@ -216,18 +224,18 @@ void InDet::SiSpacePointsSeedMaker_Trigger::newRegion
       //
       for (const IdentifierHash& l: vPixel) {
         SpacePointContainer::const_iterator  w =  spacepointsPixel->indexFind(l);
-	if (w==spce) continue;
+        if (w==spce) continue;
         for (const Trk::SpacePoint* sp: **w) {
-	  float r = sp->r();
+          float r = sp->r();
           if (r<0. || r>=m_r_rmax) continue;
-	  InDet::SiSpacePointForSeed* sps = newSpacePoint(sp);
-	  int ir = static_cast<int>(sps->radius()*irstep);
+          InDet::SiSpacePointForSeed* sps = newSpacePoint(data, sp);
+          int ir = static_cast<int>(sps->radius()*irstep);
           if (ir>irmax) ir = irmax;
-	  m_r_Sorted[ir].push_back(sps);
-          ++m_r_map[ir];
-	  if (m_r_map[ir]==1) m_r_index[m_nr++] = ir;
-	  ++m_ns;
-	}
+          data.r_Sorted[ir].push_back(sps);
+          ++data.r_map[ir];
+          if (data.r_map[ir]==1) data.r_index[data.nr++] = ir;
+          ++data.ns;
+        }
       }
     }
   }
@@ -243,23 +251,23 @@ void InDet::SiSpacePointsSeedMaker_Trigger::newRegion
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vSCT) {
-	SpacePointContainer::const_iterator w = spacepointsSCT->indexFind(l);
-	if (w==spce) continue;
+        SpacePointContainer::const_iterator w = spacepointsSCT->indexFind(l);
+        if (w==spce) continue;
         for (const Trk::SpacePoint* sp: **w) {
-	  float r = sp->r();
+          float r = sp->r();
           if (r<0. || r>=m_r_rmax) continue;
-	  InDet::SiSpacePointForSeed* sps = newSpacePoint(sp);
-	  int ir = static_cast<int>(sps->radius()*irstep);
+          InDet::SiSpacePointForSeed* sps = newSpacePoint(data, sp);
+          int ir = static_cast<int>(sps->radius()*irstep);
           if (ir>irmax) ir = irmax;
-	  m_r_Sorted[ir].push_back(sps);
-          ++m_r_map[ir];
-	  if (m_r_map[ir]==1) m_r_index[m_nr++] = ir;
-	  ++m_ns;
-	}
+          data.r_Sorted[ir].push_back(sps);
+          ++data.r_map[ir];
+          if (data.r_map[ir]==1) data.r_index[data.nr++] = ir;
+          ++data.ns;
+        }
       }
     }
   }
-  fillLists();
+  fillLists(data);
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -269,21 +277,24 @@ void InDet::SiSpacePointsSeedMaker_Trigger::newRegion
 void InDet::SiSpacePointsSeedMaker_Trigger::newRegion
 (const std::vector<IdentifierHash>& vPixel, const std::vector<IdentifierHash>& vSCT,const IRoiDescriptor& IRD)
 {
-  newRegion(vPixel,vSCT);
-  m_trigger = true;
+  EventData& data{getEventData()};
+
+  newRegion(vPixel, vSCT);
+
+  data.trigger = true;
 
   double dzdrmin = 1./tan(2.*atan(exp(-IRD.etaMinus())));
   double dzdrmax = 1./tan(2.*atan(exp(-IRD.etaPlus ())));
  
-  m_zminB        = IRD.zedMinus()-m_zbeam[0]; // min bottom Z
-  m_zmaxB        = IRD.zedPlus ()-m_zbeam[0]; // max bottom Z
-  m_zminU        = m_zminB+550.*dzdrmin;
-  m_zmaxU        = m_zmaxB+550.*dzdrmax;
+  data.zminB        = IRD.zedMinus()-data.zbeam[0]; // min bottom Z
+  data.zmaxB        = IRD.zedPlus ()-data.zbeam[0]; // max bottom Z
+  data.zminU        = data.zminB+550.*dzdrmin;
+  data.zmaxU        = data.zmaxB+550.*dzdrmax;
   double fmax    = IRD.phiPlus ();
   double fmin    = IRD.phiMinus();
   if (fmin > fmax) fmin-=(2.*M_PI);
-  m_ftrig        = (fmin+fmax)*.5;
-  m_ftrigW       = (fmax-fmin)*.5;
+  data.ftrig        = (fmin+fmax)*.5;
+  data.ftrigW       = (fmax-fmin)*.5;
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -293,28 +304,29 @@ void InDet::SiSpacePointsSeedMaker_Trigger::newRegion
 
 void InDet::SiSpacePointsSeedMaker_Trigger::find2Sp(const std::list<Trk::Vertex>& lv) 
 {
+  EventData& data{getEventData()};
 
-  int mode;
-  lv.begin()!=lv.end() ?  mode = 1 : mode = 0;
-  bool newv = newVertices(lv);
+  int mode = 0;
+  if (lv.begin()!=lv.end()) mode = 1;
+  bool newv = newVertices(data, lv);
   
-  if (newv || !m_state || m_nspoint!=2 || m_mode!=mode || m_nlist) {
-
-    m_i_seede = m_l_seeds.begin();
-    m_state   = 1   ;
-    m_nspoint = 2   ;
-    m_nlist   = 0   ;
-    m_mode    = mode;
-    m_endlist = true;
-    m_fvNmin  = 0   ;
-    m_fNmin   = 0   ;
-    m_zMin    = 0   ;
-    production2Sp ();
+  if (newv || !data.state || data.nspoint!=2 || data.mode!=mode || data.nlist) {
+
+    data.i_seede = data.l_seeds.begin();
+    data.state   = 1;
+    data.nspoint = 2;
+    data.nlist   = 0;
+    data.mode    = mode;
+    data.endlist = true;
+    data.fvNmin  = 0;
+    data.fNmin   = 0;
+    data.zMin    = 0;
+    production2Sp(data);
   }
-  m_i_seed = m_l_seeds.begin();
+  data.i_seed = data.l_seeds.begin();
   
   if (m_outputlevel<=0) {
-    m_nprint=1;
+    data.nprint=1;
     ATH_MSG_DEBUG(*this);
   }
 }
@@ -326,30 +338,31 @@ void InDet::SiSpacePointsSeedMaker_Trigger::find2Sp(const std::list<Trk::Vertex>
 
 void InDet::SiSpacePointsSeedMaker_Trigger::find3Sp(const std::list<Trk::Vertex>& lv) 
 {
-
-  int mode;
-  lv.begin()!=lv.end() ? mode = 3 : mode = 2;
-  bool newv = newVertices(lv);
-
-  if (newv || !m_state || m_nspoint!=3 || m_mode!=mode || m_nlist) {
-
-    m_i_seede = m_l_seeds.begin();
-    m_state   = 1               ;
-    m_nspoint = 3               ;
-    m_nlist   = 0               ;
-    m_mode    = mode            ;
-    m_endlist = true            ;
-    m_fvNmin  = 0               ;
-    m_fNmin   = 0               ;
-    m_zMin    = 0               ;
-    production3Sp();
+  EventData& data{getEventData()};
+
+  int mode = 2;
+  if (lv.begin()!=lv.end()) mode = 3;
+  bool newv = newVertices(data, lv);
+
+  if (newv || !data.state || data.nspoint!=3 || data.mode!=mode || data.nlist) {
+
+    data.i_seede = data.l_seeds.begin();
+    data.state   = 1;
+    data.nspoint = 3;
+    data.nlist   = 0;
+    data.mode    = mode;
+    data.endlist = true;
+    data.fvNmin  = 0;
+    data.fNmin   = 0;
+    data.zMin    = 0;
+    production3Sp(data);
   }
-  m_i_seed = m_l_seeds.begin();
-  m_seed  = m_mapSeeds.begin();
-  m_seede = m_mapSeeds.end  ();
+  data.i_seed = data.l_seeds.begin();
+  data.seed  = data.mapSeeds.begin();
+  data.seede = data.mapSeeds.end  ();
 
   if (m_outputlevel<=0) {
-    m_nprint=1;
+    data.nprint=1;
     ATH_MSG_DEBUG(*this);
   }
 }
@@ -365,32 +378,33 @@ void InDet::SiSpacePointsSeedMaker_Trigger::find3Sp(const std::list<Trk::Vertex>
 // Variable means (2,3,4,....) any number space points
 ///////////////////////////////////////////////////////////////////
 
-void InDet::SiSpacePointsSeedMaker_Trigger::findVSp (const std::list<Trk::Vertex>& lv)
+void InDet::SiSpacePointsSeedMaker_Trigger::findVSp(const std::list<Trk::Vertex>& lv)
 {
+  EventData& data{getEventData()};
 
-  int mode;
-  lv.begin()!=lv.end() ? mode = 6 : mode = 5;
-  bool newv = newVertices(lv);
+  int mode = 5;
+  if (lv.begin()!=lv.end()) mode = 6;
+  bool newv = newVertices(data, lv);
   
-  if (newv || !m_state || m_nspoint!=4 || m_mode!=mode || m_nlist) {
-
-    m_i_seede = m_l_seeds.begin();
-    m_state   = 1               ;
-    m_nspoint = 4               ;
-    m_nlist   = 0               ;
-    m_mode    = mode            ;
-    m_endlist = true            ;
-    m_fvNmin  = 0               ;
-    m_fNmin   = 0               ;
-    m_zMin    = 0               ;
-    production3Sp();
+  if (newv || !data.state || data.nspoint!=4 || data.mode!=mode || data.nlist) {
+
+    data.i_seede = data.l_seeds.begin();
+    data.state   = 1;
+    data.nspoint = 4;
+    data.nlist   = 0;
+    data.mode    = mode;
+    data.endlist = true;
+    data.fvNmin  = 0;
+    data.fNmin   = 0;
+    data.zMin    = 0;
+    production3Sp(data);
   }
-  m_i_seed = m_l_seeds.begin();
-  m_seed  = m_mapSeeds.begin();
-  m_seede = m_mapSeeds.end  ();
+  data.i_seed = data.l_seeds.begin();
+  data.seed  = data.mapSeeds.begin();
+  data.seede = data.mapSeeds.end  ();
 
   if (m_outputlevel<=0) {
-    m_nprint=1;
+    data.nprint=1;
     ATH_MSG_DEBUG(*this);
   }
 }
@@ -399,17 +413,19 @@ void InDet::SiSpacePointsSeedMaker_Trigger::findVSp (const std::list<Trk::Vertex
 // Dumps relevant information into the MsgStream
 ///////////////////////////////////////////////////////////////////
 
-MsgStream& InDet::SiSpacePointsSeedMaker_Trigger::dump( MsgStream& out ) const
+MsgStream& InDet::SiSpacePointsSeedMaker_Trigger::dump(MsgStream& out) const
 {
-  if (m_nprint)  return dumpEvent(out);
-  return dumpConditions(out);
+  EventData& data{getEventData()};
+
+  if (data.nprint) return dumpEvent(data, out);
+  return dumpConditions(data, out);
 }
 
 ///////////////////////////////////////////////////////////////////
 // Dumps conditions information into the MsgStream
 ///////////////////////////////////////////////////////////////////
 
-MsgStream& InDet::SiSpacePointsSeedMaker_Trigger::dumpConditions( MsgStream& out ) const
+MsgStream& InDet::SiSpacePointsSeedMaker_Trigger::dumpConditions(EventData& data, MsgStream& out) const
 {
   int n = 42-m_spacepointsPixel.key().size();
   std::string s2; for (int i=0; i<n; ++i) s2.append(" "); s2.append("|");
@@ -515,28 +531,28 @@ MsgStream& InDet::SiSpacePointsSeedMaker_Trigger::dumpConditions( MsgStream& out
   out<<"|---------------------------------------------------------------------|"
      <<endmsg;
   out<<"| Beam X center           | "
-     <<std::setw(12)<<std::setprecision(5)<<m_xbeam[0]
+     <<std::setw(12)<<std::setprecision(5)<<data.xbeam[0]
      <<"                              |"<<endmsg;
   out<<"| Beam Y center           | "
-     <<std::setw(12)<<std::setprecision(5)<<m_ybeam[0]
+     <<std::setw(12)<<std::setprecision(5)<<data.ybeam[0]
      <<"                              |"<<endmsg;
   out<<"| Beam Z center           | "
-     <<std::setw(12)<<std::setprecision(5)<<m_zbeam[0]
+     <<std::setw(12)<<std::setprecision(5)<<data.zbeam[0]
      <<"                              |"<<endmsg;
   out<<"| Beam X-axis direction   | "
-     <<std::setw(12)<<std::setprecision(5)<<m_xbeam[1]
-     <<std::setw(12)<<std::setprecision(5)<<m_xbeam[2]
-     <<std::setw(12)<<std::setprecision(5)<<m_xbeam[3]
+     <<std::setw(12)<<std::setprecision(5)<<data.xbeam[1]
+     <<std::setw(12)<<std::setprecision(5)<<data.xbeam[2]
+     <<std::setw(12)<<std::setprecision(5)<<data.xbeam[3]
      <<"      |"<<endmsg;
   out<<"| Beam Y-axis direction   | "
-     <<std::setw(12)<<std::setprecision(5)<<m_ybeam[1]
-     <<std::setw(12)<<std::setprecision(5)<<m_ybeam[2]
-     <<std::setw(12)<<std::setprecision(5)<<m_ybeam[3]
+     <<std::setw(12)<<std::setprecision(5)<<data.ybeam[1]
+     <<std::setw(12)<<std::setprecision(5)<<data.ybeam[2]
+     <<std::setw(12)<<std::setprecision(5)<<data.ybeam[3]
      <<"      |"<<endmsg;
   out<<"| Beam Z-axis direction   | "
-     <<std::setw(12)<<std::setprecision(5)<<m_zbeam[1]
-     <<std::setw(12)<<std::setprecision(5)<<m_zbeam[2]
-     <<std::setw(12)<<std::setprecision(5)<<m_zbeam[3]
+     <<std::setw(12)<<std::setprecision(5)<<data.zbeam[1]
+     <<std::setw(12)<<std::setprecision(5)<<data.zbeam[2]
+     <<std::setw(12)<<std::setprecision(5)<<data.zbeam[3]
      <<"      |"<<endmsg;
   out<<"|---------------------------------------------------------------------|"
      <<endmsg;
@@ -547,21 +563,21 @@ MsgStream& InDet::SiSpacePointsSeedMaker_Trigger::dumpConditions( MsgStream& out
 // Dumps event information into the MsgStream
 ///////////////////////////////////////////////////////////////////
 
-MsgStream& InDet::SiSpacePointsSeedMaker_Trigger::dumpEvent( MsgStream& out ) const
+MsgStream& InDet::SiSpacePointsSeedMaker_Trigger::dumpEvent(EventData& data, MsgStream& out) const
 {
   out<<"|---------------------------------------------------------------------|"
      <<endmsg;
-  out<<"| m_ns                    | "
-     <<std::setw(12)<<m_ns
+  out<<"| data.ns                    | "
+     <<std::setw(12)<<data.ns
      <<"                              |"<<endmsg;
-  out<<"| m_nsaz                  | "
-     <<std::setw(12)<<m_nsaz
+  out<<"| data.nsaz                  | "
+     <<std::setw(12)<<data.nsaz
      <<"                              |"<<endmsg;
-  out<<"| m_nsazv                 | "
-     <<std::setw(12)<<m_nsazv
+  out<<"| data.nsazv                 | "
+     <<std::setw(12)<<data.nsazv
      <<"                              |"<<endmsg;
   out<<"| seeds                   | "
-     <<std::setw(12)<<m_l_seeds.size()
+     <<std::setw(12)<<data.l_seeds.size()
      <<"                              |"<<endmsg;
   out<<"|---------------------------------------------------------------------|"
      <<endmsg;
@@ -572,7 +588,7 @@ MsgStream& InDet::SiSpacePointsSeedMaker_Trigger::dumpEvent( MsgStream& out ) co
 // Dumps relevant information into the ostream
 ///////////////////////////////////////////////////////////////////
 
-std::ostream& InDet::SiSpacePointsSeedMaker_Trigger::dump( std::ostream& out ) const
+std::ostream& InDet::SiSpacePointsSeedMaker_Trigger::dump(std::ostream& out) const
 {
   return out;
 }
@@ -601,39 +617,39 @@ std::ostream& InDet::operator <<
 // Find next set space points
 ///////////////////////////////////////////////////////////////////
 
-void InDet::SiSpacePointsSeedMaker_Trigger::findNext () 
+void InDet::SiSpacePointsSeedMaker_Trigger::findNext(EventData& data) const
 {
-  if (m_endlist) return;
+  if (data.endlist) return;
 
-  m_i_seede = m_l_seeds.begin();
+  data.i_seede = data.l_seeds.begin();
 
-  if      (m_mode==0 || m_mode==1) production2Sp ();
-  else if (m_mode==2 || m_mode==3) production3Sp ();
-  else if (m_mode==5 || m_mode==6) production3Sp ();
+  if      (data.mode==0 || data.mode==1) production2Sp(data);
+  else if (data.mode==2 || data.mode==3) production3Sp(data);
+  else if (data.mode==5 || data.mode==6) production3Sp(data);
 
-  m_i_seed = m_l_seeds.begin();
-  m_seed  = m_mapSeeds.begin();
-  m_seede = m_mapSeeds.end  ();
-  ++m_nlist;
+  data.i_seed = data.l_seeds.begin();
+  data.seed  = data.mapSeeds.begin();
+  data.seede = data.mapSeeds.end  ();
+  ++data.nlist;
 }                       
 
 ///////////////////////////////////////////////////////////////////
 // New and old list vertices comparison
 ///////////////////////////////////////////////////////////////////
 
-bool InDet::SiSpacePointsSeedMaker_Trigger::newVertices(const std::list<Trk::Vertex>& lV)
+bool InDet::SiSpacePointsSeedMaker_Trigger::newVertices(EventData& data, const std::list<Trk::Vertex>& lV) const
 {
-  unsigned int s1 = m_l_vertex.size();
+  unsigned int s1 = data.l_vertex.size();
   unsigned int s2 = lV.size();
 
   if (s1==0 && s2==0) return false;
 
   std::list<Trk::Vertex>::const_iterator v;
-  m_l_vertex.erase(m_l_vertex.begin(),m_l_vertex.end());
+  data.l_vertex.erase(data.l_vertex.begin(),data.l_vertex.end());
   
   for (v=lV.begin(); v!=lV.end(); ++v) {
-    m_l_vertex.push_back(static_cast<float>((*v).position().z()));
-    if (m_l_vertex.size() >= m_maxNumberVertices) break;
+    data.l_vertex.push_back(static_cast<float>((*v).position().z()));
+    if (data.l_vertex.size() >= m_maxNumberVertices) break;
   }
   return false;
 }
@@ -644,26 +660,19 @@ bool InDet::SiSpacePointsSeedMaker_Trigger::newVertices(const std::list<Trk::Ver
 
 void InDet::SiSpacePointsSeedMaker_Trigger::buildFrameWork() 
 {
-  m_ptmin     = fabs(m_ptmin)                  ;
+  m_ptmin     = fabs(m_ptmin);
   if (m_ptmin < 100.) m_ptmin = 100.;
-  m_rapcut    = fabs(m_rapcut)                 ;
+  m_rapcut    = fabs(m_rapcut);
   m_dzdrmax   = 1./tan(2.*atan(exp(-m_rapcut)));
-  m_dzdrmin   =-m_dzdrmax                      ;
-  m_r3max     = m_r_rmax                       ;
-  m_COF       =  134*.05*9.                    ;
-  m_ipt       = 1./fabs(.9*m_ptmin)            ;
-  m_ipt2      = m_ipt*m_ipt                    ;
-  m_K         = 0.                             ;
-
-  m_ns = m_nsaz = m_nsazv = m_nr = m_nrfz = m_nrfzv = 0;
+  m_dzdrmin   =-m_dzdrmax;
+  m_r3max     = m_r_rmax;
+  m_COF       =  134*.05*9.;
+  m_ipt       = 1./fabs(.9*m_ptmin);
+  m_ipt2      = m_ipt*m_ipt;
 
   // Build radius sorted containers
   //
   m_r_size = static_cast<int>((m_r_rmax+.1)/m_r_rstep);
-  m_r_Sorted.resize(m_r_size);
-  m_r_index.resize(m_r_size, 0);
-  m_r_map.resize(m_r_size, 0);
-  m_nr = 0;
 
   // Build radius-azimuthal sorted containers
   //
@@ -672,39 +681,24 @@ void InDet::SiSpacePointsSeedMaker_Trigger::buildFrameWork()
   const float sFmax = static_cast<float>(NFmax)/pi2;
   const float sFmin = 100./60.;
 
-  m_sF        = m_ptmin /60. ;
-  if (m_sF    >sFmax ) m_sF    = sFmax  ;
+  m_sF = m_ptmin /60.;
+  if (m_sF > sFmax ) m_sF = sFmax;
   else if (m_sF < sFmin) m_sF = sFmin;
-  m_fNmax     = static_cast<int>(pi2*m_sF);
+  m_fNmax = static_cast<int>(pi2*m_sF);
   if (m_fNmax >=NFmax) m_fNmax = NFmax-1;
 
- 
-  // Build radius-azimuthal-Z sorted containers
-  //
-  m_nrfz  = 0;
-  for (int i=0; i<SizeRFZ; ++i) {
-    m_rfz_index [i]=0;
-    m_rfz_map [i]=0;
-  }
-
   // Build radius-azimuthal-Z sorted containers for Z-vertices
   //
-  const int   NFtmax  = 100               ;
+  const int NFtmax = 100;
   const float sFvmax = static_cast<float>(NFtmax)/pi2;
-  m_sFv       = m_ptmin/120.  ;
-  if (m_sFv   >sFvmax)  m_sFv    = sFvmax;
-  m_fvNmax    = static_cast<int>(pi2*m_sFv);
+  m_sFv = m_ptmin/120.;
+  if (m_sFv>sFvmax) m_sFv = sFvmax;
+  m_fvNmax = static_cast<int>(pi2*m_sFv);
   if (m_fvNmax>=NFtmax) m_fvNmax = NFtmax-1;
-  m_nrfzv = 0;
-  for (int i=0; i<SizeRFZV; ++i) {
-    m_rfzv_index[i]=0;
-    m_rfzv_map[i]=0;
-  }
 
   // Build maps for radius-azimuthal-Z sorted collections 
   //
   for (int f=0; f<=m_fNmax; ++f) {
-
     int fb = f-1;
     if (fb<0) fb=m_fNmax; 
     int ft = f+1;
@@ -713,7 +707,6 @@ void InDet::SiSpacePointsSeedMaker_Trigger::buildFrameWork()
     // For each azimuthal region loop through all Z regions
     //
     for (int z=0; z<SizeZ; ++z) {
- 
       int a        = f *SizeZ+z;
       int b        = fb*SizeZ+z;
       int c        = ft*SizeZ+z;
@@ -723,53 +716,53 @@ void InDet::SiSpacePointsSeedMaker_Trigger::buildFrameWork()
       m_rfz_ib[a][2] = c; m_rfz_it[a][2] = c;
       if (z==5) {
 
-	m_rfz_t [a]    = 9 ;
-	m_rfz_it[a][3] = a+1;
-	m_rfz_it[a][4] = b+1;
-	m_rfz_it[a][5] = c+1;
-	m_rfz_it[a][6] = a-1;
-	m_rfz_it[a][7] = b-1;
-	m_rfz_it[a][8] = c-1;
+        m_rfz_t [a]    = 9;
+        m_rfz_it[a][3] = a+1;
+        m_rfz_it[a][4] = b+1;
+        m_rfz_it[a][5] = c+1;
+        m_rfz_it[a][6] = a-1;
+        m_rfz_it[a][7] = b-1;
+        m_rfz_it[a][8] = c-1;
       } else if (z> 5) {
 
-	m_rfz_b [a]    = 6 ;
-	m_rfz_ib[a][3] = a-1;
-	m_rfz_ib[a][4] = b-1;
-	m_rfz_ib[a][5] = c-1;
+        m_rfz_b [a]    = 6;
+        m_rfz_ib[a][3] = a-1;
+        m_rfz_ib[a][4] = b-1;
+        m_rfz_ib[a][5] = c-1;
 
-	if (z<10) {
+        if (z<10) {
 
-	  m_rfz_t [a]    = 6 ;
-	  m_rfz_it[a][3] = a+1;
-	  m_rfz_it[a][4] = b+1;
-	  m_rfz_it[a][5] = c+1;
-	}
+          m_rfz_t [a]    = 6;
+          m_rfz_it[a][3] = a+1;
+          m_rfz_it[a][4] = b+1;
+          m_rfz_it[a][5] = c+1;
+        }
       } else {
 
-	m_rfz_b [a]    = 6 ;
-	m_rfz_ib[a][3] = a+1;
-	m_rfz_ib[a][4] = b+1;
-	m_rfz_ib[a][5] = c+1;
+        m_rfz_b [a]    = 6;
+        m_rfz_ib[a][3] = a+1;
+        m_rfz_ib[a][4] = b+1;
+        m_rfz_ib[a][5] = c+1;
 
-	if (z>0) {
+        if (z>0) {
 
-	  m_rfz_t [a]    = 6 ;
-	  m_rfz_it[a][3] = a-1;
-	  m_rfz_it[a][4] = b-1;
-	  m_rfz_it[a][5] = c-1;
-	}
+          m_rfz_t [a]    = 6;
+          m_rfz_it[a][3] = a-1;
+          m_rfz_it[a][4] = b-1;
+          m_rfz_it[a][5] = c-1;
+        }
       }
 
       if (z==3) {
-	m_rfz_b[a]      = 9;
-	m_rfz_ib[a][6] = a+2;
-	m_rfz_ib[a][7] = b+2;
-	m_rfz_ib[a][8] = c+2;
+        m_rfz_b[a]      = 9;
+        m_rfz_ib[a][6] = a+2;
+        m_rfz_ib[a][7] = b+2;
+        m_rfz_ib[a][8] = c+2;
       } else if (z==7) {
-	m_rfz_b[a]      = 9;
-	m_rfz_ib[a][6] = a-2;
-	m_rfz_ib[a][7] = b-2;
-	m_rfz_ib[a][8] = c-2;
+        m_rfz_b[a]      = 9;
+        m_rfz_ib[a][6] = a-2;
+        m_rfz_ib[a][7] = b-2;
+        m_rfz_ib[a][8] = c-2;
       }
     }
   }
@@ -795,45 +788,31 @@ void InDet::SiSpacePointsSeedMaker_Trigger::buildFrameWork()
       m_rfzv_i[a][1] = b;
       m_rfzv_i[a][2] = c;
       if (z>1) {
-	m_rfzv_n[a]    = 6;
-	m_rfzv_i[a][3] = a-1;
-	m_rfzv_i[a][4] = b-1;
-	m_rfzv_i[a][5] = c-1;
+        m_rfzv_n[a]    = 6;
+        m_rfzv_i[a][3] = a-1;
+        m_rfzv_i[a][4] = b-1;
+        m_rfzv_i[a][5] = c-1;
       } else if (z<1) {
-	m_rfzv_n[a]    = 6;
-	m_rfzv_i[a][3] = a+1;
-	m_rfzv_i[a][4] = b+1;
-	m_rfzv_i[a][5] = c+1;
+        m_rfzv_n[a]    = 6;
+        m_rfzv_i[a][3] = a+1;
+        m_rfzv_i[a][4] = b+1;
+        m_rfzv_i[a][5] = c+1;
       }
     }
   }
-
-  m_SP.resize(m_maxsizeSP, nullptr);
-  m_R.resize(m_maxsizeSP, 0.);
-  m_Tz.resize(m_maxsizeSP, 0.);
-  m_Er.resize(m_maxsizeSP, 0.);
-  m_U.resize(m_maxsizeSP, 0.);
-  m_V.resize(m_maxsizeSP, 0.);
-  m_Zo.resize(m_maxsizeSP, 0.);
-  m_OneSeeds.resize(m_maxOneSize);
-
-  m_i_seed  = m_l_seeds.begin();
-  m_i_seede = m_l_seeds.end  ();
-  m_seed  = m_mapSeeds.begin();
-  m_seede = m_mapSeeds.end  ();
 }
 
 ///////////////////////////////////////////////////////////////////
 // Initiate beam frame work for seed generator
 ///////////////////////////////////////////////////////////////////
 
-void InDet::SiSpacePointsSeedMaker_Trigger::buildBeamFrameWork() 
+void InDet::SiSpacePointsSeedMaker_Trigger::buildBeamFrameWork(EventData& data) const
 { 
-  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
+  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{m_beamSpotKey};
 
-  const Amg::Vector3D &cb =     beamSpotHandle->beamPos();
-  double     tx = tan(beamSpotHandle->beamTilt(0));
-  double     ty = tan(beamSpotHandle->beamTilt(1));
+  const Amg::Vector3D& cb = beamSpotHandle->beamPos();
+  double tx = tan(beamSpotHandle->beamTilt(0));
+  double ty = tan(beamSpotHandle->beamTilt(1));
 
   double ph   = atan2(ty,tx);
   double th   = acos(1./sqrt(1.+tx*tx+ty*ty));
@@ -842,20 +821,20 @@ void InDet::SiSpacePointsSeedMaker_Trigger::buildBeamFrameWork()
   double sinp = sin(ph);
   double cosp = cos(ph);
   
-  m_xbeam[0] = static_cast<float>(cb.x())                  ;
-  m_xbeam[1] = static_cast<float>(cost*cosp*cosp+sinp*sinp);
-  m_xbeam[2] = static_cast<float>(cost*sinp*cosp-sinp*cosp);
-  m_xbeam[3] =-static_cast<float>(sint*cosp               );
+  data.xbeam[0] =  static_cast<float>(cb.x());
+  data.xbeam[1] =  static_cast<float>(cost*cosp*cosp+sinp*sinp);
+  data.xbeam[2] =  static_cast<float>(cost*sinp*cosp-sinp*cosp);
+  data.xbeam[3] = -static_cast<float>(sint*cosp               );
   
-  m_ybeam[0] = static_cast<float>(cb.y())                  ;
-  m_ybeam[1] = static_cast<float>(cost*cosp*sinp-sinp*cosp);
-  m_ybeam[2] = static_cast<float>(cost*sinp*sinp+cosp*cosp);
-  m_ybeam[3] =-static_cast<float>(sint*sinp               );
+  data.ybeam[0] =  static_cast<float>(cb.y());
+  data.ybeam[1] =  static_cast<float>(cost*cosp*sinp-sinp*cosp);
+  data.ybeam[2] =  static_cast<float>(cost*sinp*sinp+cosp*cosp);
+  data.ybeam[3] = -static_cast<float>(sint*sinp               );
   
-  m_zbeam[0] = static_cast<float>(cb.z())                  ;
-  m_zbeam[1] = static_cast<float>(sint*cosp)               ;
-  m_zbeam[2] = static_cast<float>(sint*sinp)               ;
-  m_zbeam[3] = static_cast<float>(cost)                    ;
+  data.zbeam[0] =  static_cast<float>(cb.z());
+  data.zbeam[1] =  static_cast<float>(sint*cosp);
+  data.zbeam[2] =  static_cast<float>(sint*sinp);
+  data.zbeam[3] =  static_cast<float>(cost);
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -863,35 +842,35 @@ void InDet::SiSpacePointsSeedMaker_Trigger::buildBeamFrameWork()
 ///////////////////////////////////////////////////////////////////
 
 void  InDet::SiSpacePointsSeedMaker_Trigger::convertToBeamFrameWork
-(const Trk::SpacePoint*const& sp,float* r) 
+(EventData& data, const Trk::SpacePoint*const& sp, float* r) const
 { 
-  r[0] = static_cast<float>(sp->globalPosition().x())-m_xbeam[0];
-  r[1] = static_cast<float>(sp->globalPosition().y())-m_ybeam[0];
-  r[2] = static_cast<float>(sp->globalPosition().z())-m_zbeam[0];
+  r[0] = static_cast<float>(sp->globalPosition().x())-data.xbeam[0];
+  r[1] = static_cast<float>(sp->globalPosition().y())-data.ybeam[0];
+  r[2] = static_cast<float>(sp->globalPosition().z())-data.zbeam[0];
 }
    
 ///////////////////////////////////////////////////////////////////
 // Initiate space points seed maker
 ///////////////////////////////////////////////////////////////////
 
-void InDet::SiSpacePointsSeedMaker_Trigger::fillLists() 
+void InDet::SiSpacePointsSeedMaker_Trigger::fillLists(EventData& data) const
 {
   constexpr float pi2 = 2.*M_PI;
   std::list<InDet::SiSpacePointForSeed*>::iterator r;
   
   for (int i=0; i!= m_r_size;  ++i) {
 
-    if (!m_r_map[i]) continue;
-    r = m_r_Sorted[i].begin();
+    if (!data.r_map[i]) continue;
+    r = data.r_Sorted[i].begin();
 
-    while (r!=m_r_Sorted[i].end()) {
+    while (r!=data.r_Sorted[i].end()) {
       
       // Azimuthal angle sort
       //
       float F = (*r)->phi();
       if (F<0.) F+=pi2;
 
-      int   f = static_cast<int>(F*m_sF);
+      int f = static_cast<int>(F*m_sF);
       if (f < 0) f = m_fNmax;
       else if (f > m_fNmax) f = 0;
 
@@ -903,173 +882,174 @@ void InDet::SiSpacePointsSeedMaker_Trigger::fillLists()
       if (Z>0.) {Z < 250.? z=5 : z=6;}
       else      {Z >-250.? z=5 : z=4;}
       int n = f*SizeZ+z;
-      ++m_nsaz;
-      m_rfz_Sorted[n].push_back(*r);
-      if (!m_rfz_map[n]++) m_rfz_index[m_nrfz++] = n;
+      ++data.nsaz;
+      data.rfz_Sorted[n].push_back(*r);
+      if (!data.rfz_map[n]++) data.rfz_index[data.nrfz++] = n;
 
       if ((*r)->spacepoint->clusterList().second == 0 && z>=3 && z<=7) { 
-	z<=4 ? z=0 : z>=6 ? z=2 : z=1;
-	
-	// Azimuthal angle and Z-coordinate sort for fast vertex search
-	//
-	f = static_cast<int>(F*m_sFv);
+        z<=4 ? z=0 : z>=6 ? z=2 : z=1;
+ 
+        // Azimuthal angle and Z-coordinate sort for fast vertex search
+        //
+        f = static_cast<int>(F*m_sFv);
         if (f < 0) f+=m_fvNmax;
-        else if (f> m_fvNmax) f-=m_fvNmax;
+        else if (f > m_fvNmax) f-=m_fvNmax;
 
-	n = f*3+z;
-        ++m_nsazv;
-	m_rfzv_Sorted[n].push_back(*r);
-        if (!m_rfzv_map[n]++) m_rfzv_index[m_nrfzv++] = n;
+        n = f*3+z;
+        ++data.nsazv;
+        data.rfzv_Sorted[n].push_back(*r);
+        if (!data.rfzv_map[n]++) data.rfzv_index[data.nrfzv++] = n;
       }
-      m_r_Sorted[i].erase(r++);
+      data.r_Sorted[i].erase(r++);
     }
-    m_r_map[i] = 0;
+    data.r_map[i] = 0;
   }
-  m_nr    = 0;
-  m_state = 0;
+  data.nr    = 0;
+  data.state = 0;
 }
  
 ///////////////////////////////////////////////////////////////////
 // Erase space point information
 ///////////////////////////////////////////////////////////////////
 
-void InDet::SiSpacePointsSeedMaker_Trigger::erase()
+void InDet::SiSpacePointsSeedMaker_Trigger::erase(EventData& data) const
 {
-  for (int i=0; i!=m_nr;    ++i) {
-    int n = m_r_index[i];
-    m_r_map[n] = 0;
-    m_r_Sorted[n].clear();
+  for (int i=0; i!=data.nr;    ++i) {
+    int n = data.r_index[i];
+    data.r_map[n] = 0;
+    data.r_Sorted[n].clear();
   }
 
-  for (int i=0; i!=m_nrfz;  ++i) {
-    int n = m_rfz_index[i];
-    m_rfz_map[n] = 0;
-    m_rfz_Sorted[n].clear();
+  for (int i=0; i!=data.nrfz;  ++i) {
+    int n = data.rfz_index[i];
+    data.rfz_map[n] = 0;
+    data.rfz_Sorted[n].clear();
   }
 
-  for (int i=0; i!=m_nrfzv; ++i) {
-    int n = m_rfzv_index[i];
-    m_rfzv_map[n] = 0;
-    m_rfzv_Sorted[n].clear();
+  for (int i=0; i!=data.nrfzv; ++i) {
+    int n = data.rfzv_index[i];
+    data.rfzv_map[n] = 0;
+    data.rfzv_Sorted[n].clear();
   }
-  m_state = 0;
-  m_ns    = 0;
-  m_nsaz  = 0;
-  m_nsazv = 0;
-  m_nr    = 0;
-  m_nrfz  = 0;
-  m_nrfzv = 0;
+  data.state = 0;
+  data.ns    = 0;
+  data.nsaz  = 0;
+  data.nsazv = 0;
+  data.nr    = 0;
+  data.nrfz  = 0;
+  data.nrfzv = 0;
 }
 
 ///////////////////////////////////////////////////////////////////
 // 2 space points seeds production
 ///////////////////////////////////////////////////////////////////
 
-void InDet::SiSpacePointsSeedMaker_Trigger::production2Sp()
+void InDet::SiSpacePointsSeedMaker_Trigger::production2Sp(EventData& data) const
 {
-  if (m_nsazv<2) return;
+  if (data.nsazv<2) return;
 
   std::list<InDet::SiSpacePointForSeed*>::iterator r0,r0e,r,re;
   int nseed = 0;
 
   // Loop thorugh all azimuthal regions
   //
-  for (int f=m_fvNmin; f<=m_fvNmax; ++f) {
+  for (int f=data.fvNmin; f<=m_fvNmax; ++f) {
 
     // For each azimuthal region loop through Z regions
     //
-    int z = 0; if (!m_endlist) z = m_zMin;
+    int z = 0;
+    if (!data.endlist) z = data.zMin;
     for (; z!=3; ++z) {
       
       int a  = f*3+z;
-      if (!m_rfzv_map[a]) continue;
-      r0  = m_rfzv_Sorted[a].begin();
-      r0e = m_rfzv_Sorted[a].end  ();
+      if (!data.rfzv_map[a]) continue;
+      r0  = data.rfzv_Sorted[a].begin();
+      r0e = data.rfzv_Sorted[a].end  ();
 
-      if (!m_endlist) {
-        r0 = m_rMin;
-        m_endlist = true;
+      if (!data.endlist) {
+        r0 = data.rMin;
+        data.endlist = true;
       }
 
       // Loop through trigger space points
       //
       for (; r0!=r0e; ++r0) {
 
-	float X  = (*r0)->x();
-	float Y  = (*r0)->y();
-	float R  = (*r0)->radius();
-	if (R<m_r2minv) continue;
+        float X  = (*r0)->x();
+        float Y  = (*r0)->y();
+        float R  = (*r0)->radius();
+        if (R<m_r2minv) continue;
         if (R>m_r2maxv) break;
-	float Z  = (*r0)->z();
-	float ax = X/R;
-	float ay = Y/R;
-
-	// Bottom links production
-	//
-	int NB = m_rfzv_n[a];
-	for (int i=0; i!=NB; ++i) {
-	  
-	  int an = m_rfzv_i[a][i];
-	  if (!m_rfzv_map[an]) continue;
-
-	  r  =  m_rfzv_Sorted[an].begin();
-	  re =  m_rfzv_Sorted[an].end  ();
-	  
-	  for (; r!=re; ++r) {
-	    
-	    float Rb =(*r)->radius();
-	    if (Rb<m_r1minv) continue;
+        float Z  = (*r0)->z();
+        float ax = X/R;
+        float ay = Y/R;
+
+        // Bottom links production
+        //
+        int NB = m_rfzv_n[a];
+        for (int i=0; i!=NB; ++i) {
+   
+          int an = m_rfzv_i[a][i];
+          if (!data.rfzv_map[an]) continue;
+
+          r  =  data.rfzv_Sorted[an].begin();
+          re =  data.rfzv_Sorted[an].end  ();
+   
+          for (; r!=re; ++r) {
+     
+            float Rb =(*r)->radius();
+            if (Rb<m_r1minv) continue;
             if (Rb>m_r1maxv) break;
-	    float dR = R-Rb;
-	    if (dR<m_drminv) break;
+            float dR = R-Rb;
+            if (dR<m_drminv) break;
             if (dR>m_drmax) continue;
-	    float dZ = Z-(*r)->z();
-	    float Tz = dZ/dR;
+            float dZ = Z-(*r)->z();
+            float Tz = dZ/dR;
             if (Tz<m_dzdrmin || Tz>m_dzdrmax) continue;
-	    float Zo = Z-R*Tz;
-
-	    // Comparison with vertices Z coordinates
-	    //
-	    if (!isZCompatible(Zo,Rb,Tz)) continue;
-
-	    // Momentum cut
-	    //
-	    float dx =(*r)->x()-X;
-	    float dy =(*r)->y()-Y;
-	    float x  = dx*ax+dy*ay          ;
-	    float y  =-dx*ay+dy*ax          ;
-	    float xy = x*x+y*y              ; if (xy == 0.) continue;
-	    float r2 = 1./xy                ;
-	    float Ut = x*r2                 ;
-	    float Vt = y*r2                 ;
-	    float UR = Ut*R+1.              ; if (UR == 0.) continue;
-	    float A  = Vt*R/UR              ;
-	    float B  = Vt-A*Ut              ;
-	    if (fabs(B*m_K) > m_ipt*sqrt(1.+A*A)) continue;
+            float Zo = Z-R*Tz;
+
+            // Comparison with vertices Z coordinates
+            //
+            if (!isZCompatible(data, Zo, Rb, Tz)) continue;
+
+            // Momentum cut
+            //
+            float dx =(*r)->x()-X;
+            float dy =(*r)->y()-Y;
+            float x  = dx*ax+dy*ay;
+            float y  =-dx*ay+dy*ax;
+            float xy = x*x+y*y; if (xy == 0.) continue;
+            float r2 = 1./xy;
+            float Ut = x*r2;
+            float Vt = y*r2;
+            float UR = Ut*R+1.; if (UR == 0.) continue;
+            float A  = Vt*R/UR;
+            float B  = Vt-A*Ut;
+            if (fabs(B*data.K) > m_ipt*sqrt(1.+A*A)) continue;
             ++nseed;
-	    newSeed((*r)->spacepoint,(*r0)->spacepoint,Zo);
-	  }
-	}
-	if (nseed < m_maxsize) continue;
-	m_endlist=false;
-        m_rMin = (++r0);
-        m_fvNmin=f;
-        m_zMin=z;
-	return;
+            newSeed(data, (*r)->spacepoint, (*r0)->spacepoint, Zo);
+          }
+        }
+        if (nseed < m_maxsize) continue;
+        data.endlist=false;
+        data.rMin = (++r0);
+        data.fvNmin=f;
+        data.zMin=z;
+        return;
       }
     }
   }
-  m_endlist = true;
+  data.endlist = true;
 }
 
 ///////////////////////////////////////////////////////////////////
 // Production 3 space points seeds 
 ///////////////////////////////////////////////////////////////////
 
-void InDet::SiSpacePointsSeedMaker_Trigger::production3Sp()
+void InDet::SiSpacePointsSeedMaker_Trigger::production3Sp(EventData& data) const
 { 
-  m_mapSeeds.clear();
-  if (m_nsaz<3) return;
+  data.mapSeeds.clear();
+  if (data.nsaz<3) return;
 
   const int   ZI[SizeZ]= {5,6,7,8,9,10,4,3,2,1,0};
   std::list<InDet::SiSpacePointForSeed*>::iterator rt[9],rte[9],rb[9],rbe[9];
@@ -1077,42 +1057,42 @@ void InDet::SiSpacePointsSeedMaker_Trigger::production3Sp()
 
   // Loop thorugh all azimuthal regions
   //
-  for (int f=m_fNmin; f<=m_fNmax; ++f) {
+  for (int f=data.fNmin; f<=m_fNmax; ++f) {
     
     // For each azimuthal region loop through all Z regions
     //
     int z = 0;
-    if (!m_endlist) z = m_zMin;
+    if (!data.endlist) z = data.zMin;
 
     for (; z<SizeZ; ++z) {
 
       int a  = f *SizeZ+ZI[z];
-      if (!m_rfz_map[a]) continue;
+      if (!data.rfz_map[a]) continue;
       int NB = 0, NT = 0;
       for (int i=0; i!=m_rfz_b[a]; ++i) {
-	
-	int an =  m_rfz_ib[a][i];
-	if (!m_rfz_map[an]) continue;
-	rb [NB] = m_rfz_Sorted[an].begin();
-        rbe[NB++] = m_rfz_Sorted[an].end();
+ 
+        int an =  m_rfz_ib[a][i];
+        if (!data.rfz_map[an]) continue;
+        rb [NB] = data.rfz_Sorted[an].begin();
+        rbe[NB++] = data.rfz_Sorted[an].end();
       } 
       for (int i=0; i!=m_rfz_t[a]; ++i) {
-	
-	int an =  m_rfz_it[a][i];
-	if (!m_rfz_map[an]) continue;
-	rt [NT] = m_rfz_Sorted[an].begin();
-        rte[NT++] = m_rfz_Sorted[an].end();
+ 
+        int an =  m_rfz_it[a][i];
+        if (!data.rfz_map[an]) continue;
+        rt [NT] = data.rfz_Sorted[an].begin();
+        rte[NT++] = data.rfz_Sorted[an].end();
       } 
-      if (!m_trigger) production3Sp       (rb,rbe,rt,rte,NB,NT,nseed);
-      else            production3SpTrigger(rb,rbe,rt,rte,NB,NT,nseed);
-      if (!m_endlist) {
-        m_fNmin = f;
-        m_zMin = z;
+      if (!data.trigger) production3Sp       (data, rb, rbe, rt, rte, NB, NT, nseed);
+      else            production3SpTrigger(data, rb, rbe, rt, rte, NB, NT, nseed);
+      if (!data.endlist) {
+        data.fNmin = f;
+        data.zMin = z;
         return;
       } 
     }
   }
-  m_endlist = true;
+  data.endlist = true;
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -1120,25 +1100,26 @@ void InDet::SiSpacePointsSeedMaker_Trigger::production3Sp()
 ///////////////////////////////////////////////////////////////////
 
 void InDet::SiSpacePointsSeedMaker_Trigger::production3Sp
-( std::list<InDet::SiSpacePointForSeed*>::iterator* rb ,
-  std::list<InDet::SiSpacePointForSeed*>::iterator* rbe,
-  std::list<InDet::SiSpacePointForSeed*>::iterator* rt ,
-  std::list<InDet::SiSpacePointForSeed*>::iterator* rte,
-  int NB, int NT, int& nseed) 
+(EventData& data,
+ std::list<InDet::SiSpacePointForSeed*>::iterator* rb ,
+ std::list<InDet::SiSpacePointForSeed*>::iterator* rbe,
+ std::list<InDet::SiSpacePointForSeed*>::iterator* rt ,
+ std::list<InDet::SiSpacePointForSeed*>::iterator* rte,
+ int NB, int NT, int& nseed) const
 {
   std::list<InDet::SiSpacePointForSeed*>::iterator r0=rb[0],r;
-  if (!m_endlist) {
-    r0 = m_rMin;
-    m_endlist = true;
+  if (!data.endlist) {
+    r0 = data.rMin;
+    data.endlist = true;
   }
 
   // Loop through all trigger space points
   //
   for (; r0!=rbe[0]; ++r0) {
 
-    m_nOneSeeds = 0;
-    m_mapOneSeeds.erase(m_mapOneSeeds.begin(), m_mapOneSeeds.end());
-	
+    data.nOneSeeds = 0;
+    data.mapOneSeeds.erase(data.mapOneSeeds.begin(), data.mapOneSeeds.end());
+ 
     float R  = (*r0)->radius();
     if (R<m_r2min) continue;
     if (R>m_r2max) break;
@@ -1148,40 +1129,40 @@ void InDet::SiSpacePointsSeedMaker_Trigger::production3Sp
     bool pix = true;
     if (SP0->clusterList().second) pix = false;
     const Trk::Surface* sur0 = (*r0)->sur();
-    float               X    = (*r0)->x()  ;
-    float               Y    = (*r0)->y()  ;
-    float               Z    = (*r0)->z()  ;
-    int                 Nb   = 0           ;
+    float               X    = (*r0)->x();
+    float               Y    = (*r0)->y();
+    float               Z    = (*r0)->z();
+    int                 Nb   = 0;
 
     // Bottom links production
     //
     for (int i=0; i!=NB; ++i) {
 
       for (r=rb[i]; r!=rbe[i]; ++r) {
-	
-	float Rb =(*r)->radius();
-	if (Rb<m_r1min) {
+ 
+        float Rb =(*r)->radius();
+        if (Rb<m_r1min) {
           rb[i]=r;
           continue;
         }
         if (Rb>m_r1max) break;
 
-	float dR = R-Rb;
-	if (dR<m_drmin) break;
+        float dR = R-Rb;
+        if (dR<m_drmin) break;
 
-	if (dR > m_drmax || (*r)->sur()==sur0) continue;
+        if (dR > m_drmax || (*r)->sur()==sur0) continue;
 
-	if ( !pix && !(*r)->spacepoint->clusterList().second) continue;
-	
-	float Tz = (Z-(*r)->z())/dR;
+        if ( !pix && !(*r)->spacepoint->clusterList().second) continue;
+ 
+        float Tz = (Z-(*r)->z())/dR;
 
-	if (Tz < m_dzdrmin || Tz > m_dzdrmax) continue;
-	
-	// Comparison with vertices Z coordinates
-	//
-	float Zo = Z-R*Tz;
-        if (!isZCompatible(Zo,Rb,Tz)) continue;
-	m_SP[Nb] = (*r);
+        if (Tz < m_dzdrmin || Tz > m_dzdrmax) continue;
+ 
+        // Comparison with vertices Z coordinates
+        //
+        float Zo = Z-R*Tz;
+        if (!isZCompatible(data, Zo, Rb, Tz)) continue;
+        data.SP[Nb] = (*r);
         if (++Nb==m_maxsizeSP) goto breakb;
       }
     }
@@ -1194,26 +1175,26 @@ void InDet::SiSpacePointsSeedMaker_Trigger::production3Sp
     for (int i=0; i!=NT; ++i) {
       
       for (r=rt[i]; r!=rte[i]; ++r) {
-	
-	float Rt =(*r)->radius();
-	float dR = Rt-R;
+ 
+        float Rt =(*r)->radius();
+        float dR = Rt-R;
         if (dR<m_drmin || Rt<m_r3min) {
           rt[i]=r;
           continue;
         }
-	if (Rt>m_r3max || dR>m_drmax) break;
+        if (Rt>m_r3max || dR>m_drmax) break;
 
-	if ( (*r)->sur()==sur0) continue;
+        if ( (*r)->sur()==sur0) continue;
 
-	float Tz = ((*r)->z()-Z)/dR;
+        float Tz = ((*r)->z()-Z)/dR;
 
-	if (Tz < m_dzdrmin || Tz > m_dzdrmax) continue;
+        if (Tz < m_dzdrmin || Tz > m_dzdrmax) continue;
 
-	// Comparison with vertices Z coordinates
-	//
-	float Zo = Z-R*Tz;
-        if (!isZCompatible(Zo,Rt,Tz)) continue;
-  	m_SP[Nt] = (*r);
+        // Comparison with vertices Z coordinates
+        //
+        float Zo = Z-R*Tz;
+        if (!isZCompatible(data, Zo, Rt, Tz)) continue;
+        data.SP[Nt] = (*r);
         if (++Nt==m_maxsizeSP) goto breakt;
       }
     }
@@ -1229,88 +1210,88 @@ void InDet::SiSpacePointsSeedMaker_Trigger::production3Sp
     
     for (int i=0; i!=Nt; ++i) {
 
-      InDet::SiSpacePointForSeed* sp = m_SP[i];
+      InDet::SiSpacePointForSeed* sp = data.SP[i];
 
-      float dx  = sp->x()-X   ;
-      float dy  = sp->y()-Y   ;
-      float dz  = sp->z()-Z   ;
-      float x   = dx*ax+dy*ay ;
-      float y   =-dx*ay+dy*ax ;
+      float dx  = sp->x()-X;
+      float dy  = sp->y()-Y;
+      float dz  = sp->z()-Z;
+      float x   = dx*ax+dy*ay;
+      float y   =-dx*ay+dy*ax;
       float r2  = 1./(x*x+y*y);
-      float dr  = sqrt(r2)    ;
-      float tz  = dz*dr       ;
+      float dr  = sqrt(r2);
+      float tz  = dz*dr;
       if (i < Nb) tz = -tz;
 
-      m_Tz[i]   = tz                                            ;
-      m_Zo[i]   = Z-R*tz                                        ;
-      m_R [i]   = dr                                            ;
-      m_U [i]   = x*r2                                          ;
-      m_V [i]   = y*r2                                          ;
-      m_Er[i]   = (covz0+sp->covz()+tz*tz*(covr0+sp->covr()))*r2;
+      data.Tz[i]   = tz;
+      data.Zo[i]   = Z-R*tz;
+      data.R [i]   = dr;
+      data.U [i]   = x*r2;
+      data.V [i]   = y*r2;
+      data.Er[i]   = (covz0+sp->covz()+tz*tz*(covr0+sp->covr()))*r2;
     }
  
-    float imc   = m_diver   ;
+    float imc   = m_diver;
     float imcs  = m_diverpps;
-    float ipt2  = m_ipt2    ;
-    float K     = m_K       ;
-    float K2    = K*K       ;
-    float COF   = m_COF     ;
-    float ipt2K = ipt2/K2   ;
-    float ipt2C = ipt2*COF  ;
-    float COFK  = COF*K2    ;
-    covr0      *= 2.        ;
-    covz0      *= 2.        ;
+    float ipt2  = m_ipt2;
+    float K     = data.K;
+    float K2    = K*K;
+    float COF   = m_COF;
+    float ipt2K = ipt2/K2;
+    float ipt2C = ipt2*COF;
+    float COFK  = COF*K2;
+    covr0      *= 2.;
+    covz0      *= 2.;
     
     // Three space points comparison
     //
     for (int b=0; b!=Nb; ++b) {
     
-      const Trk::SpacePoint* SPb = m_SP[b]->spacepoint;
+      const Trk::SpacePoint* SPb = data.SP[b]->spacepoint;
  
-      float  Zob  = m_Zo[b]      ;
-      float  Tzb  = m_Tz[b]      ;
-      float  Rb2r = m_R [b]*covr0;
-      float  Rb2z = m_R [b]*covz0;
-      float  Erb  = m_Er[b]      ;
-      float  Vb   = m_V [b]      ;
-      float  Ub   = m_U [b]      ;
-      float  Tzb2 = (1.+Tzb*Tzb) ;
-      float  CSA  = Tzb2*COFK    ;
-      float ICSA  = Tzb2*ipt2C   ;
-      float dZ    = dZVertexMin(Zob);
-      float Iz    = (dZ*dZ)/Tzb2 ;
+      float  Zob  = data.Zo[b];
+      float  Tzb  = data.Tz[b];
+      float  Rb2r = data.R [b]*covr0;
+      float  Rb2z = data.R [b]*covz0;
+      float  Erb  = data.Er[b];
+      float  Vb   = data.V [b];
+      float  Ub   = data.U [b];
+      float  Tzb2 = (1.+Tzb*Tzb);
+      float  CSA  = Tzb2*COFK;
+      float ICSA  = Tzb2*ipt2C;
+      float dZ    = dZVertexMin(data, Zob);
+      float Iz    = (dZ*dZ)/Tzb2;
 
       for (int t=Nb;  t!=Nt; ++t) {
-	
-	float Ts  = .5*(Tzb+m_Tz[t])                          ;
-	float dt  =     Tzb-m_Tz[t]                           ;
-	float dT  = dt*dt-Erb-m_Er[t]-m_R[t]*(Ts*Ts*Rb2r+Rb2z);
-	if ( dT > ICSA) continue;
-	float dU  = m_U[t]-Ub;
+ 
+        float Ts  = .5*(Tzb+data.Tz[t]);
+        float dt  =     Tzb-data.Tz[t];
+        float dT  = dt*dt-Erb-data.Er[t]-data.R[t]*(Ts*Ts*Rb2r+Rb2z);
+        if ( dT > ICSA) continue;
+        float dU  = data.U[t]-Ub;
         if (dU == 0.) continue;
-	float A   = (m_V[t]-Vb)/dU                   ;
-	float S2  = 1.+A*A                           ;
-	float B   = Vb-A*Ub                          ;
-	float B2  = B*B                              ;
-	if (B2  > ipt2K*S2 || dT*S2 > B2*CSA) continue;
-	float Im  = fabs((A-B*R)*R)                  ;
-	
-	if (Im > imc ) continue;
-	
-	if (pix) {
-	  if (m_SP[t]->spacepoint->clusterList().second && Im > imcs) continue;
-	}
-	if (Im > m_diversss) continue;
-	Im = Im*Im+Iz;
-	newOneSeed(SPb,SP0,m_SP[t]->spacepoint,Zob,Im);
+        float A   = (data.V[t]-Vb)/dU;
+        float S2  = 1.+A*A;
+        float B   = Vb-A*Ub;
+        float B2  = B*B;
+        if (B2  > ipt2K*S2 || dT*S2 > B2*CSA) continue;
+        float Im  = fabs((A-B*R)*R);
+ 
+        if (Im > imc ) continue;
+ 
+        if (pix) {
+          if (data.SP[t]->spacepoint->clusterList().second && Im > imcs) continue;
+        }
+        if (Im > m_diversss) continue;
+        Im = Im*Im+Iz;
+        newOneSeed(data, SPb, SP0, data.SP[t]->spacepoint, Zob, Im);
       }
     }
-    nseed += m_mapOneSeeds.size();
-    fillSeeds();
+    nseed += data.mapOneSeeds.size();
+    fillSeeds(data);
     if (nseed>=m_maxsize) {
-      m_endlist=false;
+      data.endlist=false;
       ++r0;
-      m_rMin = r0;
+      data.rMin = r0;
       return;
     }
   }
@@ -1321,27 +1302,28 @@ void InDet::SiSpacePointsSeedMaker_Trigger::production3Sp
 ///////////////////////////////////////////////////////////////////
 
 void InDet::SiSpacePointsSeedMaker_Trigger::production3SpTrigger
-( std::list<InDet::SiSpacePointForSeed*>::iterator* rb ,
-  std::list<InDet::SiSpacePointForSeed*>::iterator* rbe,
-  std::list<InDet::SiSpacePointForSeed*>::iterator* rt ,
-  std::list<InDet::SiSpacePointForSeed*>::iterator* rte,
-  int NB, int NT, int& nseed) 
+(EventData& data, 
+ std::list<InDet::SiSpacePointForSeed*>::iterator* rb ,
+ std::list<InDet::SiSpacePointForSeed*>::iterator* rbe,
+ std::list<InDet::SiSpacePointForSeed*>::iterator* rt ,
+ std::list<InDet::SiSpacePointForSeed*>::iterator* rte,
+ int NB, int NT, int& nseed) const
 {
   constexpr float pi2 = 2.*M_PI;
 
   std::list<InDet::SiSpacePointForSeed*>::iterator r0=rb[0],r;
-  if (!m_endlist) {
-    r0 = m_rMin;
-    m_endlist = true;
+  if (!data.endlist) {
+    r0 = data.rMin;
+    data.endlist = true;
   }
 
   // Loop through all trigger space points
   //
   for (; r0!=rbe[0]; ++r0) {
 
-    m_nOneSeeds = 0;
-    m_mapOneSeeds.erase(m_mapOneSeeds.begin(), m_mapOneSeeds.end());
-	
+    data.nOneSeeds = 0;
+    data.mapOneSeeds.erase(data.mapOneSeeds.begin(), data.mapOneSeeds.end());
+ 
     float R  = (*r0)->radius();
     if (R<m_r2min) continue;
     if (R>m_r2max) break;
@@ -1351,39 +1333,39 @@ void InDet::SiSpacePointsSeedMaker_Trigger::production3SpTrigger
     bool pix = true;
     if (SP0->clusterList().second) pix = false;
     const Trk::Surface* sur0 = (*r0)->sur();
-    float               X    = (*r0)->x()  ;
-    float               Y    = (*r0)->y()  ;
-    float               Z    = (*r0)->z()  ;
-    int                 Nb   = 0           ;
+    float               X    = (*r0)->x();
+    float               Y    = (*r0)->y();
+    float               Z    = (*r0)->z();
+    int                 Nb   = 0;
 
     // Bottom links production
     //
     for (int i=0; i!=NB; ++i) {
 
       for (r=rb[i]; r!=rbe[i]; ++r) {
-	
-	float Rb =(*r)->radius();
-	if (Rb<m_r1min) {
+ 
+        float Rb =(*r)->radius();
+        if (Rb<m_r1min) {
           rb[i]=r;
           continue;
         }
         if (Rb>m_r1max) break;
 
-	float dR = R-Rb;
-	if (dR<m_drmin) break;
-
-	if (dR > m_drmax || (*r)->sur()==sur0) continue;
-
-	if ( !pix && !(*r)->spacepoint->clusterList().second) continue;
-	
-	// Comparison with  bottom and top Z 
-	//
-	float Tz = (Z-(*r)->z())/dR;
-	float Zo = Z-R*Tz          ;
-        if (Zo < m_zminB || Zo > m_zmaxB) continue;
-	float Zu = Z+(550.-R)*Tz   ;
-        if (Zu < m_zminU || Zu > m_zmaxU) continue;
-	m_SP[Nb] = (*r);
+        float dR = R-Rb;
+        if (dR<m_drmin) break;
+
+        if (dR > m_drmax || (*r)->sur()==sur0) continue;
+
+        if ( !pix && !(*r)->spacepoint->clusterList().second) continue;
+ 
+        // Comparison with  bottom and top Z 
+        //
+        float Tz = (Z-(*r)->z())/dR;
+        float Zo = Z-R*Tz;
+        if (Zo < data.zminB || Zo > data.zmaxB) continue;
+        float Zu = Z+(550.-R)*Tz;
+        if (Zu < data.zminU || Zu > data.zmaxU) continue;
+        data.SP[Nb] = (*r);
         if (++Nb==m_maxsizeSP) goto breakb;
       }
     }
@@ -1396,25 +1378,25 @@ void InDet::SiSpacePointsSeedMaker_Trigger::production3SpTrigger
     for (int i=0; i!=NT; ++i) {
       
       for (r=rt[i]; r!=rte[i]; ++r) {
-	
-	float Rt =(*r)->radius();
-	float dR = Rt-R;
+ 
+        float Rt =(*r)->radius();
+        float dR = Rt-R;
         if (dR<m_drmin || Rt<m_r3min) {
           rt[i]=r;
           continue;
         }
-	if (Rt>m_r3max || dR>m_drmax) break;
-
-	if ( (*r)->sur()==sur0) continue;
-
-	// Comparison with  bottom and top Z 
-	//
-	float Tz = ((*r)->z()-Z)/dR;
-	float Zo = Z-R*Tz          ;
-        if (Zo < m_zminB || Zo > m_zmaxB) continue;
-	float Zu = Z+(550.-R)*Tz   ;
-        if (Zu < m_zminU || Zu > m_zmaxU) continue;
-  	m_SP[Nt] = (*r);
+        if (Rt>m_r3max || dR>m_drmax) break;
+
+        if ( (*r)->sur()==sur0) continue;
+
+        // Comparison with  bottom and top Z 
+        //
+        float Tz = ((*r)->z()-Z)/dR;
+        float Zo = Z-R*Tz;
+        if (Zo < data.zminB || Zo > data.zmaxB) continue;
+        float Zu = Z+(550.-R)*Tz;
+        if (Zu < data.zminU || Zu > data.zmaxU) continue;
+        data.SP[Nt] = (*r);
         if (++Nt==m_maxsizeSP) goto breakt;
       }
     }
@@ -1430,96 +1412,96 @@ void InDet::SiSpacePointsSeedMaker_Trigger::production3SpTrigger
     
     for (int i=0; i!=Nt; ++i) {
 
-      InDet::SiSpacePointForSeed* sp = m_SP[i];
+      InDet::SiSpacePointForSeed* sp = data.SP[i];
 
-      float dx  = sp->x()-X   ;
-      float dy  = sp->y()-Y   ;
-      float dz  = sp->z()-Z   ;
-      float x   = dx*ax+dy*ay ;
-      float y   =-dx*ay+dy*ax ;
+      float dx  = sp->x()-X;
+      float dy  = sp->y()-Y;
+      float dz  = sp->z()-Z;
+      float x   = dx*ax+dy*ay;
+      float y   =-dx*ay+dy*ax;
       float r2  = 1./(x*x+y*y);
-      float dr  = sqrt(r2)    ;
-      float tz  = dz*dr       ;
+      float dr  = sqrt(r2);
+      float tz  = dz*dr;
       if (i < Nb) tz = -tz;
 
-      m_Tz[i]   = tz                                            ;
-      m_Zo[i]   = Z-R*tz                                        ;
-      m_R [i]   = dr                                            ;
-      m_U [i]   = x*r2                                          ;
-      m_V [i]   = y*r2                                          ;
-      m_Er[i]   = (covz0+sp->covz()+tz*tz*(covr0+sp->covr()))*r2;
+      data.Tz[i]   = tz;
+      data.Zo[i]   = Z-R*tz;
+      data.R [i]   = dr;
+      data.U [i]   = x*r2;
+      data.V [i]   = y*r2;
+      data.Er[i]   = (covz0+sp->covz()+tz*tz*(covr0+sp->covr()))*r2;
     }
  
-    float imc   = m_diver   ;
+    float imc   = m_diver;
     float imcs  = m_diverpps;
-    float ipt2  = m_ipt2    ;
-    float K     = m_K       ;
-    float K2    = K*K       ;
-    float COF   = m_COF     ;
-    float ipt2K = ipt2/K2   ;
-    float ipt2C = ipt2*COF  ;
-    float COFK  = COF*K2    ;
-    covr0      *= 2.        ;
-    covz0      *= 2.        ;
+    float ipt2  = m_ipt2;
+    float K     = data.K;
+    float K2    = K*K;
+    float COF   = m_COF;
+    float ipt2K = ipt2/K2;
+    float ipt2C = ipt2*COF;
+    float COFK  = COF*K2;
+    covr0      *= 2.;
+    covz0      *= 2.;
    
     // Three space points comparison
     //
     for (int b=0; b!=Nb; ++b) {
 
-      const Trk::SpacePoint* SPb = m_SP[b]->spacepoint;
+      const Trk::SpacePoint* SPb = data.SP[b]->spacepoint;
  
-      float  Zob  = m_Zo[b]      ;
-      float  Tzb  = m_Tz[b]      ;
-      float  Rb2r = m_R [b]*covr0;
-      float  Rb2z = m_R [b]*covz0;
-      float  Erb  = m_Er[b]      ;
-      float  Vb   = m_V [b]      ;
-      float  Ub   = m_U [b]      ;
-      float  Tzb2 = (1.+Tzb*Tzb) ;
-      float  CSA  = Tzb2*COFK    ;
-      float ICSA  = Tzb2*ipt2C   ;
-      float dZ    = dZVertexMin(Zob);
-      float Iz    = (dZ*dZ)/Tzb2 ;
+      float  Zob  = data.Zo[b];
+      float  Tzb  = data.Tz[b];
+      float  Rb2r = data.R [b]*covr0;
+      float  Rb2z = data.R [b]*covz0;
+      float  Erb  = data.Er[b];
+      float  Vb   = data.V [b];
+      float  Ub   = data.U [b];
+      float  Tzb2 = (1.+Tzb*Tzb);
+      float  CSA  = Tzb2*COFK;
+      float ICSA  = Tzb2*ipt2C;
+      float dZ    = dZVertexMin(data, Zob);
+      float Iz    = (dZ*dZ)/Tzb2;
 
       for (int t=Nb;  t!=Nt; ++t) {
-	
-	float Ts  = .5*(Tzb+m_Tz[t])                          ;
-	float dt  =     Tzb-m_Tz[t]                           ;
-	float dT  = dt*dt-Erb-m_Er[t]-m_R[t]*(Ts*Ts*Rb2r+Rb2z);
-	if ( dT > ICSA) continue;
-	float dU  = m_U[t]-Ub;
-        if (dU == 0.) continue ;
-	float A   = (m_V[t]-Vb)/dU                   ;
-	float S2  = 1.+A*A                           ;
-	float B   = Vb-A*Ub                          ;
-	float B2  = B*B                              ;
-	if (B2  > ipt2K*S2 || dT*S2 > B2*CSA) continue;
-	float Im  = fabs((A-B*R)*R)                  ;
-
-	if (Im > imc ) continue;
-	if (pix) {
-	  if (m_SP[t]->spacepoint->clusterList().second && Im > imcs) continue;
-	}
-
-	if (Im > m_diversss) continue;
-
-	// Azimuthal angle test
-	//
-	float y  = 1.;
-	float x  = 2.*B*R-A;
-	float df = fabs(atan2(ay*y-ax*x,ax*y+ay*x)-m_ftrig);
-	if (df > M_PI) df=pi2-df;
-	if (df > m_ftrigW) continue;
-	Im = Im*Im+Iz;
-	newOneSeed(SPb,SP0,m_SP[t]->spacepoint,Zob,Im);
+ 
+        float Ts  = .5*(Tzb+data.Tz[t]);
+        float dt  =     Tzb-data.Tz[t];
+        float dT  = dt*dt-Erb-data.Er[t]-data.R[t]*(Ts*Ts*Rb2r+Rb2z);
+        if ( dT > ICSA) continue;
+        float dU  = data.U[t]-Ub;
+        if (dU == 0.) continue;
+        float A   = (data.V[t]-Vb)/dU;
+        float S2  = 1.+A*A;
+        float B   = Vb-A*Ub;
+        float B2  = B*B;
+        if (B2  > ipt2K*S2 || dT*S2 > B2*CSA) continue;
+        float Im  = fabs((A-B*R)*R);
+
+        if (Im > imc ) continue;
+        if (pix) {
+          if (data.SP[t]->spacepoint->clusterList().second && Im > imcs) continue;
+        }
+
+        if (Im > m_diversss) continue;
+
+        // Azimuthal angle test
+        //
+        float y  = 1.;
+        float x  = 2.*B*R-A;
+        float df = fabs(atan2(ay*y-ax*x,ax*y+ay*x)-data.ftrig);
+        if (df > M_PI) df=pi2-df;
+        if (df > data.ftrigW) continue;
+        Im = Im*Im+Iz;
+        newOneSeed(data, SPb, SP0, data.SP[t]->spacepoint, Zob, Im);
       }
     }
-    nseed += m_mapOneSeeds.size();
-    fillSeeds();
+    nseed += data.mapOneSeeds.size();
+    fillSeeds(data);
     if (nseed>=m_maxsize) {
-      m_endlist=false;
+      data.endlist=false;
       ++r0;
-      m_rMin = r0;
+      data.rMin = r0;
       return;
     }
   }
@@ -1530,21 +1512,22 @@ void InDet::SiSpacePointsSeedMaker_Trigger::production3SpTrigger
 ///////////////////////////////////////////////////////////////////
 
 void InDet::SiSpacePointsSeedMaker_Trigger::newOneSeed
-(const Trk::SpacePoint*& p1,const Trk::SpacePoint*& p2, 
- const Trk::SpacePoint*& p3,const float& z,const float& q) 
+(EventData& data,
+ const Trk::SpacePoint*& p1,const Trk::SpacePoint*& p2, 
+ const Trk::SpacePoint*& p3,const float& z,const float& q) const
 {
-  if (m_nOneSeeds < m_maxOneSize) {
-
-    m_OneSeeds [m_nOneSeeds].erase     (  );
-    m_OneSeeds [m_nOneSeeds].add       (p1);
-    m_OneSeeds [m_nOneSeeds].add       (p2);
-    m_OneSeeds [m_nOneSeeds].add       (p3);
-    m_OneSeeds [m_nOneSeeds].setZVertex(static_cast<double>(z));
-    m_mapOneSeeds.insert(std::make_pair(q, &(m_OneSeeds[m_nOneSeeds])));
-    ++m_nOneSeeds;
+  if (data.nOneSeeds < m_maxOneSize) {
+
+    data.OneSeeds[data.nOneSeeds].erase();
+    data.OneSeeds[data.nOneSeeds].add(p1);
+    data.OneSeeds[data.nOneSeeds].add(p2);
+    data.OneSeeds[data.nOneSeeds].add(p3);
+    data.OneSeeds[data.nOneSeeds].setZVertex(static_cast<double>(z));
+    data.mapOneSeeds.insert(std::make_pair(q, &(data.OneSeeds[data.nOneSeeds])));
+    ++data.nOneSeeds;
   } else {
     std::multimap<float,InDet::SiSpacePointsSeed*>::reverse_iterator 
-      l = m_mapOneSeeds.rbegin();
+      l = data.mapOneSeeds.rbegin();
     if ((*l).first <= q) return;
     
     InDet::SiSpacePointsSeed* s = (*l).second;
@@ -1554,11 +1537,11 @@ void InDet::SiSpacePointsSeedMaker_Trigger::newOneSeed
     s->add       (p3);
     s->setZVertex(static_cast<double>(z));
     std::multimap<float,InDet::SiSpacePointsSeed*>::iterator 
-      i = m_mapOneSeeds.insert(std::make_pair(q,s));
-	
-    for (++i; i!=m_mapOneSeeds.end(); ++i) {
+      i = data.mapOneSeeds.insert(std::make_pair(q,s));
+                       
+    for (++i; i!=data.mapOneSeeds.end(); ++i) {
       if ((*i).second==s) {
-        m_mapOneSeeds.erase(i);
+        data.mapOneSeeds.erase(i);
         return;
       }
     }
@@ -1567,21 +1550,22 @@ void InDet::SiSpacePointsSeedMaker_Trigger::newOneSeed
 
 const InDet::SiSpacePointsSeed* InDet::SiSpacePointsSeedMaker_Trigger::next()
 {
-  if (m_i_seed==m_i_seede) {
-    findNext();
-    if (m_i_seed==m_i_seede) return nullptr;
+  EventData& data{getEventData()};
+  if (data.i_seed==data.i_seede) {
+    findNext(data);
+    if (data.i_seed==data.i_seede) return nullptr;
   }
-  if (m_mode==0 || m_mode==1) return &(*m_i_seed++);
-  ++m_i_seed;
-  return (*m_seed++).second;
+  if (data.mode==0 || data.mode==1) return &(*data.i_seed++);
+  ++data.i_seed;
+  return (*data.seed++).second;
 }
     
 bool InDet::SiSpacePointsSeedMaker_Trigger::isZCompatible  
-(float& Zv,float& R,float& T)
+(EventData& data, float& Zv, float& R, float& T) const
 {
   if (Zv < m_zmin || Zv > m_zmax) return false;
 
-  std::list<float>::iterator v=m_l_vertex.begin(),ve=m_l_vertex.end();
+  std::list<float>::iterator v=data.l_vertex.begin(),ve=data.l_vertex.end();
   if (v==ve) return true;
 
   float dZmin = fabs((*v)-Zv);
@@ -1593,9 +1577,9 @@ bool InDet::SiSpacePointsSeedMaker_Trigger::isZCompatible
   return dZmin < (m_dzver+m_dzdrver*R)*sqrt(1.+T*T);
 }
 
-float InDet::SiSpacePointsSeedMaker_Trigger::dZVertexMin(float& Z)
+float InDet::SiSpacePointsSeedMaker_Trigger::dZVertexMin(EventData& data, float& Z) const
 {
-  std::list<float>::iterator v=m_l_vertex.begin(),ve=m_l_vertex.end();
+  std::list<float>::iterator v=data.l_vertex.begin(),ve=data.l_vertex.end();
   if (v==ve) return 0.;
 
   float dZm = 1.E10;
@@ -1611,20 +1595,20 @@ float InDet::SiSpacePointsSeedMaker_Trigger::dZVertexMin(float& Z)
 ///////////////////////////////////////////////////////////////////
 
 InDet::SiSpacePointForSeed* InDet::SiSpacePointsSeedMaker_Trigger::newSpacePoint
-(const Trk::SpacePoint*const& sp) 
+(EventData& data, const Trk::SpacePoint*const& sp) const
 {
   InDet::SiSpacePointForSeed* sps = nullptr;
 
   float r[3];
-  convertToBeamFrameWork(sp, r);
+  convertToBeamFrameWork(data, sp, r);
 
-  if (m_i_spforseed!=m_l_spforseed.end()) {
-    sps = &(*m_i_spforseed++);
+  if (data.i_spforseed!=data.l_spforseed.end()) {
+    sps = &(*data.i_spforseed++);
     sps->set(sp, r);
   } else {
-    m_l_spforseed.push_back(InDet::SiSpacePointForSeed(sp, r));
-    sps = &(m_l_spforseed.back());
-    m_i_spforseed = m_l_spforseed.end();
+    data.l_spforseed.push_back(InDet::SiSpacePointForSeed(sp, r));
+    sps = &(data.l_spforseed.back());
+    data.i_spforseed = data.l_spforseed.end();
   }
       
   return sps;
@@ -1635,18 +1619,19 @@ InDet::SiSpacePointForSeed* InDet::SiSpacePointsSeedMaker_Trigger::newSpacePoint
 ///////////////////////////////////////////////////////////////////
 
 void InDet::SiSpacePointsSeedMaker_Trigger::newSeed
-(const Trk::SpacePoint*& p1,const Trk::SpacePoint*& p2, 
- const float& z) 
+(EventData& data,
+ const Trk::SpacePoint*& p1,const Trk::SpacePoint*& p2, 
+ const float& z) const
 {
-  if (m_i_seede!=m_l_seeds.end()) {
-    InDet::SiSpacePointsSeed* s = &(*m_i_seede++);
+  if (data.i_seede!=data.l_seeds.end()) {
+    InDet::SiSpacePointsSeed* s = &(*data.i_seede++);
     s->erase     (  );
     s->add       (p1);
     s->add       (p2);
     s->setZVertex(static_cast<double>(z));
   } else {
-    m_l_seeds.push_back(InDet::SiSpacePointsSeed(p1, p2, z));
-    m_i_seede = m_l_seeds.end();
+    data.l_seeds.push_back(InDet::SiSpacePointsSeed(p1, p2, z));
+    data.i_seede = data.l_seeds.end();
   }
 }
 
@@ -1654,11 +1639,11 @@ void InDet::SiSpacePointsSeedMaker_Trigger::newSeed
 // Fill seeds
 ///////////////////////////////////////////////////////////////////
 
-void InDet::SiSpacePointsSeedMaker_Trigger::fillSeeds()
+void InDet::SiSpacePointsSeedMaker_Trigger::fillSeeds(EventData& data) const
 {
   std::multimap<float, InDet::SiSpacePointsSeed*>::iterator 
-    l  = m_mapOneSeeds.begin(),
-    le = m_mapOneSeeds.end  ();
+    l  = data.mapOneSeeds.begin(),
+    le = data.mapOneSeeds.end  ();
 
   for (; l!=le; ++l) {
     float                     q  = (*l).first;
@@ -1668,16 +1653,67 @@ void InDet::SiSpacePointsSeedMaker_Trigger::fillSeeds()
       (*s0->spacePoints().begin())->clusterList().second ? q+=1000. : q+=10000.;
     }
 
-    if (m_i_seede!=m_l_seeds.end()) {
-      InDet::SiSpacePointsSeed* s = &(*m_i_seede++);
+    if (data.i_seede!=data.l_seeds.end()) {
+      InDet::SiSpacePointsSeed* s = &(*data.i_seede++);
       *s = *s0;
-      m_mapSeeds.insert(std::make_pair(q,s));
+      data.mapSeeds.insert(std::make_pair(q,s));
     } else {
-      m_l_seeds.push_back(InDet::SiSpacePointsSeed(*s0));
-      InDet::SiSpacePointsSeed* s = &(m_l_seeds.back());
-      m_i_seede = m_l_seeds.end();
-      m_mapSeeds.insert(std::make_pair(q, s));
+      data.l_seeds.push_back(InDet::SiSpacePointsSeed(*s0));
+      InDet::SiSpacePointsSeed* s = &(data.l_seeds.back());
+      data.i_seede = data.l_seeds.end();
+      data.mapSeeds.insert(std::make_pair(q, s));
     }
   }
 }
-  
+
+InDet::SiSpacePointsSeedMaker_Trigger::EventData&
+InDet::SiSpacePointsSeedMaker_Trigger::getEventData() const {
+  const EventContext& ctx{Gaudi::Hive::currentContext()};
+  EventContext::ContextID_t slot{ctx.slot()};
+  EventContext::ContextEvt_t evt{ctx.evt()};
+  if (not m_initialized) slot = 0;
+  std::lock_guard<std::mutex> lock{m_mutex};
+  if (slot>=m_cache.size()) { // Need to extend vectors
+    static const EventContext::ContextEvt_t invalidValue{EventContext::INVALID_CONTEXT_EVT};
+    m_cache.resize(slot+1, invalidValue); // Store invalid values in order to go to the next IF statement
+    m_eventData.resize(slot+1);
+  }
+  if (m_cache[slot]!=evt) { // New event
+    m_cache[slot] = evt;
+    // Initialization
+    m_eventData[slot] = EventData{}; // This will be improved later.
+
+    // Build radius sorted containers
+    m_eventData[slot].r_Sorted.resize(m_r_size);
+    m_eventData[slot].r_index.resize(m_r_size, 0);
+    m_eventData[slot].r_map.resize(m_r_size, 0);
+
+    // Build radius-azimuthal-Z sorted containers
+    for (int i=0; i<SizeRFZ; ++i) {
+      m_eventData[slot].rfz_index[i] = 0;
+      m_eventData[slot].rfz_map[i] = 0;
+    }
+
+    // Build radius-azimuthal-Z sorted containers for Z-vertices
+    for (int i=0; i<SizeRFZV; ++i) {
+      m_eventData[slot].rfzv_index[i] = 0;
+      m_eventData[slot].rfzv_map[i] = 0;
+    }
+
+    m_eventData[slot].SP.resize(m_maxsizeSP, nullptr);
+    m_eventData[slot].R.resize(m_maxsizeSP, 0.);
+    m_eventData[slot].Tz.resize(m_maxsizeSP, 0.);
+    m_eventData[slot].Er.resize(m_maxsizeSP, 0.);
+    m_eventData[slot].U.resize(m_maxsizeSP, 0.);
+    m_eventData[slot].V.resize(m_maxsizeSP, 0.);
+    m_eventData[slot].Zo.resize(m_maxsizeSP, 0.);
+    m_eventData[slot].OneSeeds.resize(m_maxOneSize);
+
+    m_eventData[slot].i_seed  = m_eventData[slot].l_seeds.begin();
+    m_eventData[slot].i_seede = m_eventData[slot].l_seeds.end  ();
+    m_eventData[slot].seed  = m_eventData[slot].mapSeeds.begin();
+    m_eventData[slot].seede = m_eventData[slot].mapSeeds.end  ();
+  }
+
+  return m_eventData[slot]; 
+}
-- 
GitLab