From 5234dae224712609865e98936907c85ae03b75d3 Mon Sep 17 00:00:00 2001
From: Eric Torrence <eric.torrence@cern.ch>
Date: Fri, 16 Aug 2019 15:20:40 -0700
Subject: [PATCH] Remove SpacePoint class causing trouble

---
 .../LegacyBase/LegacyBase/FaserSpacePoint.h   |  50 -------
 Legacy/LegacyBase/src/FaserSpacePoint.cxx     | 137 ------------------
 2 files changed, 187 deletions(-)
 delete mode 100644 Legacy/LegacyBase/LegacyBase/FaserSpacePoint.h
 delete mode 100644 Legacy/LegacyBase/src/FaserSpacePoint.cxx

diff --git a/Legacy/LegacyBase/LegacyBase/FaserSpacePoint.h b/Legacy/LegacyBase/LegacyBase/FaserSpacePoint.h
deleted file mode 100644
index 354db49e..00000000
--- a/Legacy/LegacyBase/LegacyBase/FaserSpacePoint.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#pragma once
-
-#include "LegacyBase/FaserCluster.h"
-
-// ROOT include
-#include <TVector3.h>
-
-#include <vector>
-
-
-// SpacePoint class for grouped Faser clusters
-// (Clusters on front/back of a detection plane should be grouped.)
-//
-
-class FaserSpacePoint {
-private:
-  //long fIdentifier;
-  std::vector<FaserCluster*> fClusters;
-  TVector3 fGlobalPosition;
-  void ComputePosition();
-
-public:
-
-  FaserSpacePoint();
-  FaserSpacePoint(std::vector<FaserCluster*> & clusters);
-
-  virtual ~FaserSpacePoint() {
-  }
-
-  void AddCluster(FaserCluster * cluster);
-  std::vector<FaserCluster*> & Clusters() { return fClusters; }
-
-  //long Identifier() { return fIdentifier; }
-
-  int Plane()  const { return fClusters.size()==0 ? -1 : fClusters[0]->Plane(); }
-  int Module() const { return fClusters.size()==0 ? -1 : fClusters[0]->Module(); }
-  int Sensor() const;
-  int Row()    const { return fClusters.size()==0 ? -1 : fClusters[0]->Row(); }
-
-  double Charge() const;
-  TVector3 GlobalPosition() const { return fGlobalPosition; }
-
-  void Print() const;
-  void Debug() const;
-
-  double DistanceTo(const FaserSpacePoint & other) const;
-
-};
-
-
diff --git a/Legacy/LegacyBase/src/FaserSpacePoint.cxx b/Legacy/LegacyBase/src/FaserSpacePoint.cxx
deleted file mode 100644
index bec5513b..00000000
--- a/Legacy/LegacyBase/src/FaserSpacePoint.cxx
+++ /dev/null
@@ -1,137 +0,0 @@
-#include "LegacyBase/FaserSpacePoint.h"
-#include "G4MTRunManager.hh"
-#include "G4RunManager.hh"
-
-#include <iostream>
-#include <string>
-#include <map>
-#include <stdexcept>
-
-using std::cout;
-using std::to_string;
-using std::runtime_error;
-
-//------------------------------------------------------------------------------
-
-FaserSpacePoint::FaserSpacePoint()
-  : fClusters {}
-  , fGlobalPosition {0., 0.,  0.}
-{
-  ;
-}
-
-//------------------------------------------------------------------------------
-
-FaserSpacePoint::FaserSpacePoint(std::vector<FaserCluster*> & clusters)
-  : fClusters {}
-  , fGlobalPosition {0., 0., 0. }
-{
-  for (FaserCluster * clus : clusters) {
-    AddCluster(clus);
-  }
-}
-
-//------------------------------------------------------------------------------
-
-int FaserSpacePoint::Sensor() const
-{
-  if (fClusters.size()==0) return -1;
-  int sensor = fClusters[0]->Sensor();
-
-  // Group top sensors 0/1 -> 0 and bottom 2/3 -> 2.
-  if (sensor==0 || sensor==1) return 0;
-  else if (sensor==2 || sensor==3) return 2;
-
-  return sensor;
-}
-
-//------------------------------------------------------------------------------
-
-double FaserSpacePoint::Charge() const
-{ double charge = 0.;
-  for (const FaserCluster * clus : fClusters) charge += clus->Charge();
-  return charge;
-}
-
-//------------------------------------------------------------------------------
-
-void FaserSpacePoint::ComputePosition()
-{ }
-
-//------------------------------------------------------------------------------
-
-void FaserSpacePoint::AddCluster(FaserCluster * cluster)
-{
-  if (fClusters.size() == 0)
-  {
-    fClusters.push_back(cluster);
-    return;
-  }
-
-  if (cluster->Plane()  != Plane() ) throw runtime_error {"FaserSpacePoint::AddCluster: incompatible planes"};
-  if (cluster->Module() != Module()) throw runtime_error {"FaserSpacePoint::AddCluster: incompatible modules"};
-
-  int sensor = fClusters[0]->Sensor();
-  // Group top sensors 0/1 -> 0 and bottom 2/3 -> 2.
-  if (sensor==1) sensor = 0;
-  else if (sensor==3) sensor = 2;
-  if (sensor!= Sensor()) throw runtime_error {"FaserSpacePoint::AddCluster: incompatible sensors"};
-
-  if (cluster->Row() != Row()) throw runtime_error {"FaserSpacePoint::AddCluster: incompatible rows"};
-
-  fClusters.push_back(cluster);
-  ComputePosition();
-}
-
-//------------------------------------------------------------------------------
-
-void FaserSpacePoint::Print() const
-{
-  cout << "INFO  FaserSpacePoint::Print\n"
-       << "  Clusters (nClusters=" << fClusters.size() << "):\n";
-
-  for (size_t i=0; i<fClusters.size(); ++i)
-  {
-    FaserCluster * c = fClusters[i];
-    cout << "    Cluster " << i << "  plane=" << c->Plane() << ", module=" << c->Module() << ", sensor=" << c->Sensor()
-                           << ", row=" << c->Row() << ", charge=" << c->Charge() << ", weightedStrip=" << c->WeightedStrip()
-                           << ", globalPos=" << c->GlobalPosition() <<"\n";
-  }
-
-  TVector3 pos = GlobalPosition();
-  double x = pos.X();
-  double y = pos.Y();
-  double z = pos.Z();
-  cout << "  Space point obtained:\n"
-       << "    plane=" << Plane() << ", module=" << Module() << ", sensor=" << Sensor() << ", row=" << Row()
-                       << ", charge=" << Charge() << ", globalPos=(" << x << ", " << y << ", " << z << ")\n";
-}
-
-//------------------------------------------------------------------------------
-
-void FaserSpacePoint::Debug() const
-{
-
-  for (size_t i=0; i<fClusters.size(); ++i)
-  {
-    FaserCluster * c = fClusters[i];
-    cout << "DEBUG_CLUSTERS  " << i << ";" << c->Plane() << ";" << c->Module() << ";" << c->Sensor()
-                               << ";" << c->Row() << ";" << c->WeightedStrip() << ";" << c->Charge()
-                               << ";" << c->GlobalPosition() << "\n";
-  }
-
-  //TVector3 pos = GlobalPos();
-  //double x = pos.X();
-  //double y = pos.Y();
-  //double z = pos.Z();
-  //cout << "DEBUG_SPACEPOINT  " << Plane() << "," << Module() << "," << Sensor() << "," << Row()
-  //                     << "," << x << "," << y << "," << z << "\n";
-}
-
-//------------------------------------------------------------------------------
-
-double FaserSpacePoint::DistanceTo(const FaserSpacePoint & other) const {
-    return (GlobalPosition() - other.GlobalPosition()).Mag();
-}
-
-
-- 
GitLab