From fa0c7fa13dc08efdc135a94b0be70f6156973aa0 Mon Sep 17 00:00:00 2001
From: Michael Deveaux <deveaux@physik.uni-frankfurt.de>
Date: Wed, 18 Jan 2023 13:44:55 +0100
Subject: [PATCH] Remove obsolete data transfer classes from CbmMvdDetector

---
 mvd/CbmMvdClusterfinder.cxx |  20 ++--
 mvd/CbmMvdDetector.cxx      | 208 +-----------------------------------
 mvd/CbmMvdDetector.h        |  10 +-
 mvd/CbmMvdDigitizer.cxx     |   2 +-
 mvd/CbmMvdHitfinder.cxx     |   2 +-
 mvd/CbmMvdReadout.cxx       |  12 ++-
 6 files changed, 26 insertions(+), 228 deletions(-)

diff --git a/mvd/CbmMvdClusterfinder.cxx b/mvd/CbmMvdClusterfinder.cxx
index 4e17674ba2..f1391f18b7 100644
--- a/mvd/CbmMvdClusterfinder.cxx
+++ b/mvd/CbmMvdClusterfinder.cxx
@@ -100,20 +100,20 @@ void CbmMvdClusterfinder::Exec(Option_t* /*opt*/)
       digi->SetRefId(i);
 
       fDetector->SendInputToSensorPlugin(digi->GetDetectorId(), nTargetPlugin, static_cast<TObject*>(digi));
-      }
+    }
 
 
 
 
-      //fDetector->SendInputDigis(fDigiMan);
-      if (fVerbose) cout << "Execute ClusterPlugin Nr. " << fClusterPluginNr << endl;
-      fDetector->Exec(fClusterPluginNr);
-      if (fVerbose) cout << "End Chain" << endl;
-      if (fVerbose) cout << "Start writing Cluster" << endl;
-      fCluster->AbsorbObjects(fDetector->GetOutputCluster(), 0, fDetector->GetOutputCluster()->GetEntriesFast() - 1);
-      if (fVerbose) cout << "Total of " << fCluster->GetEntriesFast() << " Cluster in this Event" << endl;
-      if (fVerbose) cout << "//----------------------------------------//" << endl;
-      LOG(info) << "+ " << setw(20) << GetName() << ": Created: " << fCluster->GetEntriesFast() << " cluster in " << fixed
+    //fDetector->SendInputDigis(fDigiMan);
+    if (fVerbose) cout << "Execute ClusterPlugin Nr. " << fClusterPluginNr << endl;
+    fDetector->Exec(fClusterPluginNr);
+    if (fVerbose) cout << "End Chain" << endl;
+    if (fVerbose) cout << "Start writing Cluster" << endl;
+    fCluster->AbsorbObjects(fDetector->GetOutputCluster(), 0, fDetector->GetOutputCluster()->GetEntriesFast() - 1);
+    if (fVerbose) cout << "Total of " << fCluster->GetEntriesFast() << " Cluster in this Event" << endl;
+    if (fVerbose) cout << "//----------------------------------------//" << endl;
+    LOG(info) << "+ " << setw(20) << GetName() << ": Created: " << fCluster->GetEntriesFast() << " cluster in " << fixed
               << setprecision(6) << fTimer.RealTime() << " s";
   }
 
diff --git a/mvd/CbmMvdDetector.cxx b/mvd/CbmMvdDetector.cxx
index 28ea7cd6cc..791660316e 100644
--- a/mvd/CbmMvdDetector.cxx
+++ b/mvd/CbmMvdDetector.cxx
@@ -19,16 +19,6 @@
 #include "tools/CbmMvdGeoHandler.h"
 
 
-// #include "plugins/buffers/CbmMvdSensorBuffer.h"
-// #include "plugins/buffers/CbmMvdSensorFrameBuffer.h"
-// #include "plugins/buffers/CbmMvdSensorTrackingBuffer.h"
-
-//   #include "plugins/tasks/CbmMvdSensorClusterfinderTask.h"  //khun
-//   #include "plugins/tasks/CbmMvdSensorDigiToHitTask.h"
-//   #include "plugins/tasks/CbmMvdSensorDigitizerTBTask.h"
-//   #include "plugins/tasks/CbmMvdSensorDigitizerTask.h"
-//   #include "plugins/tasks/CbmMvdSensorFindHitTask.h"
-//   #include "plugins/tasks/CbmMvdSensorHitfinderTask.h"  //khun
 
 
 
@@ -255,7 +245,7 @@ Int_t CbmMvdDetector::DetectPlugin(Int_t pluginID)
 {
   // Detects the position of a plugin with a given Plugin-ID (set in the plugin implementation constructor) in the plugin-array of the sensors
 
-  Int_t nDigitizerPlugin=-1;
+
 
   if (!fSensorArrayFilled) {cout << "-W - CbmMvdDetector::DetectPlugin: You tried to access sensor plugins while the detector is not initialized yet." << endl;  return -1;}
   CbmMvdSensor* sensor=GetSensor(0);
@@ -338,202 +328,6 @@ void CbmMvdDetector::SendInputToSensorPlugin(Int_t detectorid, Int_t nPlugin, TO
   fSensorMap[detectorid]->SendInputToPlugin(nPlugin,input);
 }
 //-----------------------------------------------------------------------
-//-----------------------------------------------------------------------
-/*
-void CbmMvdDetector::SendInputToSensorPlugin(Int_t nSensor, Int_t nPlugin, TObject* input)
-{
-  CbmMvdSensor* sensor=(CbmMvdSensor*)fSensorArray->At(nSensor);
-  sensor->SendInputToPlugin(nPlugin,input);
-}
-*/
-//-----------------------------------------------------------------------
-
-/*
-void CbmMvdDetector::SendInput(TClonesArray* input)
-{
-
-
-  CbmMvdPoint* point;
-  Int_t nEntries = input->GetEntriesFast();
-  Int_t nSensors = fSensorArray->GetEntriesFast();
-  CbmMvdSensor* sensor;
-  Bool_t send = kFALSE;
-  for (Int_t i = 0; i < nEntries; i++) {
-    point = (CbmMvdPoint*) input->At(i);
-    point->SetPointId(i);
-    for (Int_t k = 0; k < nSensors; k++) {
-      sensor = (CbmMvdSensor*) fSensorArray->At(k);
-
-      if (point->GetDetectorID() == sensor->GetDetectorID()) {
-        sensor->SendInputToPlugin(sensor->GetDigiPlugin(),(TObject*) point);
-        send = true;
-      }
-    }
-    if (!send) LOG(warn) << "Point not send to any sensor: " << point->GetDetectorID();
-  }
-}
-*/
-//-----------------------------------------------------------------------
-
-//-----------------------------------------------------------------------
-void CbmMvdDetector::SendInputNeutral(TClonesArray* input)
-{
-  /**
-   *
-   * Sending event to sensors,
-   * each sensor gets only his own points
-   *
-   *
-   *
-   * **/
-/*
-
-  TObject* point;
-  Int_t nEntries = input->GetEntriesFast();
-  Int_t nSensors = fSensorArray->GetEntriesFast();
-  CbmMvdSensor* sensor;
-  Bool_t send = kFALSE;
-  for (Int_t i = 0; i < nEntries; i++) {
-    point = (CbmMvdPoint*) input->At(i);
-    point->SetPointId(i);
-    for (Int_t k = 0; k < nSensors; k++) {
-      sensor = (CbmMvdSensor*) fSensorArray->At(k);
-
-      if (point->GetDetectorID() == sensor->GetDetectorID()) {
-        sensor->SendInput(point);
-        send = true;
-      }
-    }
-    if (!send) LOG(warn) << "Point not send to any sensor: " << point->GetDetectorID();
-  }
-
-*/
-}
-//-----------------------------------------------------------------------
-
-//-----------------------------------------------------------------------
-void CbmMvdDetector::SendInputDigis(CbmDigiManager* digiMan)
-{
-  /**
-   *
-   * Sending event to sensors,
-   * each sensor gets only his own points
-   *
-   *
-   *
-   * **/
-  assert(digiMan);
-  assert(digiMan->IsPresent(ECbmModuleId::kMvd));
-
-
-  CbmMvdDigi* digi;
-
-  Int_t nSensors = fSensorArray->GetEntriesFast();
-  Int_t nEntries = digiMan->GetNofDigis(ECbmModuleId::kMvd);
-  CbmMvdSensor* sensor;
-  for (Int_t i = 0; i < nEntries; i++) {
-    digi = new CbmMvdDigi(*(digiMan->Get<CbmMvdDigi>(i)));
-    digi->SetRefId(i);
-    for (Int_t k = 0; k < nSensors; k++) {
-      sensor = (CbmMvdSensor*) fSensorArray->At(k);
-
-      if (digi->GetDetectorId() == sensor->GetDetectorID()) { sensor->SendInputDigi(digi); }
-    }
-  }
-}
-//-----------------------------------------------------------------------
-
-
-//-----------------------------------------------------------------------
-void CbmMvdDetector::SendInputDigis(TClonesArray* digis)
-{
-  /**
-   *
-   * Sending event to sensors,
-   * each sensor gets only his own points
-   *
-   *
-   *
-   * **/
-
-
-  CbmMvdDigi* digi;
-
-  Int_t nSensors = fSensorArray->GetEntriesFast();
-  Int_t nEntries = digis->GetEntriesFast();
-  CbmMvdSensor* sensor;
-  for (Int_t i = 0; i < nEntries; i++) {
-    digi = (CbmMvdDigi*) digis->At(i);
-    digi->SetRefId(i);
-    for (Int_t k = 0; k < nSensors; k++) {
-      sensor = (CbmMvdSensor*) fSensorArray->At(k);
-
-      if (digi->GetDetectorId() == sensor->GetDetectorID()) { sensor->SendInputDigi(digi); }
-    }
-  }
-}
-//-----------------------------------------------------------------------
-
-//-----------------------------------------------------------------------
-void CbmMvdDetector::SendInputDigisToHits(TClonesArray* digis)
-{
-  /**
-   *
-   * Sending event to sensors,
-   * each sensor gets only his own points
-   *
-   * Version for DigiToHit
-   *
-   * **/
-
-
-  CbmMvdDigi* digi;
-  Int_t nEntries = digis->GetEntriesFast();
-  Int_t nSensors = fSensorArray->GetEntriesFast();
-  CbmMvdSensor* sensor;
-  for (Int_t i = 0; i < nEntries; i++) {
-    digi = (CbmMvdDigi*) digis->At(i);
-    digi->SetRefId(i);
-    for (Int_t k = 0; k < nSensors; k++) {
-      sensor = (CbmMvdSensor*) fSensorArray->At(k);
-
-      if (digi->GetDetectorId() == sensor->GetDetectorID()) { sensor->SendInputDigiToHit(digi); }
-    }
-  }
-}
-//-----------------------------------------------------------------------
-
-
-//-----------------------------------------------------------------------
-void CbmMvdDetector::SendInputCluster(TClonesArray* clusters)
-{
-
-  /**
-   *
-   * Sending event to sensors,
-   * each sensor gets only his own points
-   *
-   *
-   *
-   * **/
-  CbmMvdCluster* cluster;
-  Int_t nEntries = clusters->GetEntriesFast();
-  Int_t nSensors = fSensorArray->GetEntriesFast();
-  CbmMvdSensor* sensor;
-  for (Int_t i = 0; i < nEntries; i++) {
-    cluster = (CbmMvdCluster*) clusters->At(i);
-    cluster->SetRefId(i);
-    for (Int_t k = 0; k < nSensors; k++) {
-      sensor = (CbmMvdSensor*) fSensorArray->At(k);
-
-      if (cluster->GetSensorNr() == sensor->GetSensorNr()) {
-        LOG(debug2) << "Sending cluster to sensor: " << sensor->GetSensorNr();
-        sensor->SendInputCluster(cluster);
-      }
-    }
-  }
-}
-//-----------------------------------------------------------------------
 
 //-----------------------------------------------------------------------
 void CbmMvdDetector::ExecChain()
diff --git a/mvd/CbmMvdDetector.h b/mvd/CbmMvdDetector.h
index 12d78061fd..f1724da242 100644
--- a/mvd/CbmMvdDetector.h
+++ b/mvd/CbmMvdDetector.h
@@ -57,15 +57,9 @@ public:
   virtual ~CbmMvdDetector();
 
   /** Data interface */
-  //void SendInput(TClonesArray* input);
-  void SendInputNeutral(TClonesArray* input);
-//  void SendInputToSensorPlugin(Int_t nSensor, Int_t nPlugin, TObject* input);
+
   void SendInputToSensorPlugin(Int_t detectorid, Int_t nPlugin, TObject* input);
-  void SendInputDigis(CbmDigiManager* digiMan);
-  void SendInputDigis(TClonesArray* digis);
-  void SendInputDigisToHits(TClonesArray* digis);
-  void SendInputCluster(TClonesArray* cluster);
-  // void SendClonesArray(TClonesArray* addedStructures, Int_t dataLevel=0){;}
+
 
   TClonesArray* GetOuput() { return 0; }
   TClonesArray* GetOutputHits();
diff --git a/mvd/CbmMvdDigitizer.cxx b/mvd/CbmMvdDigitizer.cxx
index bc2c46ffbe..6531812fcc 100644
--- a/mvd/CbmMvdDigitizer.cxx
+++ b/mvd/CbmMvdDigitizer.cxx
@@ -368,7 +368,7 @@ void CbmMvdDigitizer::GetMvdGeometry() {}
 // -------------------------------------------------------------------------
 
 Int_t CbmMvdDigitizer::DetectPlugin(Int_t pluginID)
-{ Int_t nDigitizerPlugin=-1;
+{
 
   CbmMvdDetector* detector= CbmMvdDetector::Instance();
   return detector->DetectPlugin(pluginID);
diff --git a/mvd/CbmMvdHitfinder.cxx b/mvd/CbmMvdHitfinder.cxx
index 00205b6033..4e23ee22a7 100644
--- a/mvd/CbmMvdHitfinder.cxx
+++ b/mvd/CbmMvdHitfinder.cxx
@@ -105,7 +105,7 @@ void CbmMvdHitfinder::Exec(Option_t* /*opt*/)
   fHits->Clear();
   fTimer.Start();
   Int_t nTargetPlugin= fDetector->DetectPlugin(300);
-  Int_t nDigis;
+  Int_t nDigis=0;
   CbmMvdDigi* digi=0;
   CbmMvdCluster* cluster=0;
 
diff --git a/mvd/CbmMvdReadout.cxx b/mvd/CbmMvdReadout.cxx
index a649b303d4..aac79434ea 100644
--- a/mvd/CbmMvdReadout.cxx
+++ b/mvd/CbmMvdReadout.cxx
@@ -57,7 +57,17 @@ void CbmMvdReadout::Exec(Option_t* /*opt*/)
   if (fDigiMan->GetNofDigis(ECbmModuleId::kMvd) > 0) {
     if (fVerbose) cout << "//----------------------------------------//";
     if (fVerbose) cout << endl << "Send Input" << endl;
-    fDetector->SendInputDigis(fDigiMan);
+    Int_t nTargetPlugin=fDetector->DetectPlugin(200);
+    CbmMvdDigi* digi=0;
+
+    Int_t nDigis = fDigiMan->GetNofDigis(ECbmModuleId::kMvd);
+
+    for (Int_t i = 0; i < nDigis; i++) {
+      digi = new CbmMvdDigi(*(fDigiMan->Get<CbmMvdDigi>(i)));
+      digi->SetRefId(i);
+
+      fDetector->SendInputToSensorPlugin(digi->GetDetectorId(), nTargetPlugin, static_cast<TObject*>(digi));
+    }
     if (fVerbose) cout << "Execute ReadoutPlugin Nr. " << fPluginNr << endl;
     fDetector->Exec(fPluginNr);
     if (fVerbose) cout << "End Chain" << endl;
-- 
GitLab