diff --git a/sim/detectors/sts/CbmStsDigitize.cxx b/sim/detectors/sts/CbmStsDigitize.cxx index c9619a01ff233704b21219b78dea2b4e19a12fdf..5571246d0c498eefc40644be0ff7cd9884ffcb2f 100644 --- a/sim/detectors/sts/CbmStsDigitize.cxx +++ b/sim/detectors/sts/CbmStsDigitize.cxx @@ -613,7 +613,6 @@ void CbmStsDigitize::ProcessMCEvent() assert(fPoints); for (Int_t iPoint = 0; iPoint < fPoints->GetEntriesFast(); iPoint++) { const CbmStsPoint* point = (const CbmStsPoint*) fPoints->At(iPoint); - CbmLink* link = new CbmLink(1., iPoint, fCurrentMCEntry, fCurrentInput); // --- Ignore points from secondaries if the respective flag is set if (fParSim->OnlyPrimaries()) { @@ -639,16 +638,16 @@ void CbmStsDigitize::ProcessMCEvent() } // --- Process the StsPoint + CbmLink link(1., iPoint, fCurrentMCEntry, fCurrentInput); ProcessPoint(point, fCurrentEventTime, link); fNofPointsProc++; - delete link; } //# StsPoints } // ------------------------------------------------------------------------- // ----- Process a StsPoint --------------------------------------------- -void CbmStsDigitize::ProcessPoint(const CbmStsPoint* point, Double_t eventTime, CbmLink* link) +void CbmStsDigitize::ProcessPoint(const CbmStsPoint* point, Double_t eventTime, const CbmLink& link) { // --- Get the sensor the point is in diff --git a/sim/detectors/sts/CbmStsDigitize.h b/sim/detectors/sts/CbmStsDigitize.h index 5b71efdbab6a484b741976e0011aa538a74a3595..5679ac6cacc7a2649844ca1f7b27fc6c0f2f93d1 100644 --- a/sim/detectors/sts/CbmStsDigitize.h +++ b/sim/detectors/sts/CbmStsDigitize.h @@ -349,7 +349,7 @@ private: ** @param point Pointer to CbmStsPoint to be processed ** @param link Link to MCPoint **/ - void ProcessPoint(const CbmStsPoint* point, Double_t eventTime = 0., CbmLink* link = NULL); + void ProcessPoint(const CbmStsPoint* point, Double_t eventTime, const CbmLink& link); /** @brief Reset event counters **/ diff --git a/sim/detectors/sts/CbmStsSimSensor.cxx b/sim/detectors/sts/CbmStsSimSensor.cxx index 2f373d9271086a1dcc3a65779410d638222c8b8e..ee4b13f8d98c01c0e81834311d526b95d45c78c0 100644 --- a/sim/detectors/sts/CbmStsSimSensor.cxx +++ b/sim/detectors/sts/CbmStsSimSensor.cxx @@ -58,7 +58,7 @@ Int_t CbmStsSimSensor::GetSensorId() const // ----- Process a CbmStsPoint ------------------------------------------ -Int_t CbmStsSimSensor::ProcessPoint(const CbmStsPoint* point, Double_t eventTime, CbmLink* link) +Int_t CbmStsSimSensor::ProcessPoint(const CbmStsPoint* point, Double_t eventTime, const CbmLink& link) { // --- Physical node diff --git a/sim/detectors/sts/CbmStsSimSensor.h b/sim/detectors/sts/CbmStsSimSensor.h index 78fb3dfdc0cf8a8af5c097aaf1be9521ce96f3fc..f3e1d581bd9f889147e38700cb9a96c22604c3f7 100644 --- a/sim/detectors/sts/CbmStsSimSensor.h +++ b/sim/detectors/sts/CbmStsSimSensor.h @@ -11,6 +11,8 @@ #define CBMSTSSIMSENSOR_H 1 +#include "CbmLink.h" + #include <TObject.h> #include <TString.h> @@ -70,7 +72,7 @@ public: /** @brief Current link object ** @return Current link object (to CbmStsPoint) **/ - CbmLink* GetCurrentLink() const { return fCurrentLink; } + const CbmLink& GetCurrentLink() const { return fCurrentLink; } /** @brief Corresponding element in STS setup @@ -107,7 +109,7 @@ public: ** system. The appropriate analogue response is then calculated ** with the pure virtual method CalculateResponse. **/ - Int_t ProcessPoint(const CbmStsPoint* point, Double_t eventTime = 0., CbmLink* link = NULL); + Int_t ProcessPoint(const CbmStsPoint* point, Double_t eventTime, const CbmLink& link); /** Set the sensor conditions @@ -172,7 +174,7 @@ protected: Double_t fBx = 0.; ///< x component of magnetic field in sensor centre Double_t fBy = 0.; ///< y component of magnetic field in sensor centre Double_t fBz = 0.; ///< z component of magnetic field in sensor centre - CbmLink* fCurrentLink = nullptr; //! Link to currently processed MCPoint + CbmLink fCurrentLink = {}; //! Link to currently processed MCPoint /** Perform response simulation for one MC Point diff --git a/sim/detectors/sts/CbmStsSimSensorDssd.cxx b/sim/detectors/sts/CbmStsSimSensorDssd.cxx index fc109f7f7fac77230db879f4b43ad45516fb78e4..8c7cc0ce461d9c3fb96bd9c3c04313bbfd899ccf 100644 --- a/sim/detectors/sts/CbmStsSimSensorDssd.cxx +++ b/sim/detectors/sts/CbmStsSimSensorDssd.cxx @@ -280,14 +280,9 @@ void CbmStsSimSensorDssd::RegisterCharge(Int_t side, Int_t strip, Double_t charg Int_t channel = GetModuleChannel(strip, side, GetSensorId()); // --- Get the MC link information - Int_t index = -1; - Int_t entry = -1; - Int_t file = -1; - if (GetCurrentLink()) { - index = GetCurrentLink()->GetIndex(); - entry = GetCurrentLink()->GetEntry(); - file = GetCurrentLink()->GetFile(); - } + Int_t index = GetCurrentLink().GetIndex(); + Int_t entry = GetCurrentLink().GetEntry(); + Int_t file = GetCurrentLink().GetFile(); // --- Send signal to module GetModule()->AddSignal(channel, time, charge, index, entry, file);