Skip to content

Commit

Permalink
Deprecate FairGeaneApplication::Instance
Browse files Browse the repository at this point in the history
It's not used in any relevant places.

And if access to it is needed, then a new getter on
FairGeane should be implemented.
  • Loading branch information
ChristianTackeGSI authored and dennisklein committed Nov 11, 2022
1 parent 9b57c47 commit 9c6ac00
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 48 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
* `FairRadGridManager::Instance()` - Consider using the
`GetRadGridMan()` method on `FairMCApplcation`.
* `FairRadMapManager::Instance`, `FairRadLenManager::Instance`
* `FairGeaneApplication::Instance`
* Deprecated some other APIs
* `FairGeoVector::round` was nonfunctional and never did anything.
* `FairTask::*InputPersistance`:
Expand Down
18 changes: 8 additions & 10 deletions base/sim/FairGeaneApplication.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
Expand Down Expand Up @@ -48,9 +48,14 @@ class FairGeaneApplication : public TVirtualMCApplication
/** Define action at each step, dispatch the action to the corresponding detectors */
void GeaneStepping() override; // MC Application
void ConstructGeometry() override;
/** Singelton instance
/**
* Singelton instance
* \deprecated Deprecated in v19, will be removed in v20.
*/
static FairGeaneApplication* Instance();
[[deprecated]] static FairGeaneApplication* Instance()
{
return static_cast<FairGeaneApplication*>(TVirtualMCApplication::Instance());
}

/**pure virtual functions that hasve to be implimented */

Expand Down Expand Up @@ -83,11 +88,4 @@ class FairGeaneApplication : public TVirtualMCApplication
FairGeaneApplication& operator=(const FairGeaneApplication&);
};

// inline functions

inline FairGeaneApplication* FairGeaneApplication::Instance()
{
return static_cast<FairGeaneApplication*>(TVirtualMCApplication::Instance());
}

#endif
19 changes: 8 additions & 11 deletions geane/FairGeanePro.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
Expand All @@ -11,7 +11,6 @@
//
#include "FairGeanePro.h"

#include "FairGeaneApplication.h" // for FairGeaneApplication
#include "FairGeaneUtil.h" // for FairGeaneUtil
#include "FairLogger.h"
#include "FairTrackPar.h" // for FairTrackPar
Expand Down Expand Up @@ -52,10 +51,9 @@ FairGeanePro::FairGeanePro()
, ftrklength(0.)
, ftrktime(0.)
, flag(0)
, fApp(FairGeaneApplication::Instance())
, fPrintErrors(kTRUE)
{
if (gMC3 == NULL) {
if (gMC3 == nullptr) {
LOG(fatal) << "FairGeanePro::TGeant3 has not been initialized! ABORTING!";
throw;
}
Expand All @@ -82,12 +80,11 @@ FairGeanePro::FairGeanePro()
fwire2 = TVector3(0., 0., 0.);
*/

for (int i = 0; i < 5; i++)
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
trpmat[i][j] = 0.;
}

// fApp = FairGeaneApplication::Instance();
}

// fPropOption = "";
for (int i = 0; i < 15; i++) {
Expand Down Expand Up @@ -128,7 +125,7 @@ FairGeanePro::FairGeanePro()
*/
}

FairGeanePro::~FairGeanePro() {}
FairGeanePro::~FairGeanePro() = default;

bool FairGeanePro::Propagate(FairTrackParH* TParam, FairTrackParH* TEnd, int PDG)
{
Expand Down Expand Up @@ -380,7 +377,6 @@ bool FairGeanePro::Propagate(FairTrackParH* /*TStart*/, FairTrackParP* /*TEnd*/,

bool FairGeanePro::Propagate(float* X1, float* P1, float* X2, float* P2, int PDG)
{
// fApp->GeanePreTrack(X1, P1, PDG);
GeantCode = fdbPDG->ConvertPdgToGeant3(PDG);
xlf[0] = 1000;
gMC3->Eufill(1, ein, xlf);
Expand All @@ -400,7 +396,7 @@ bool FairGeanePro::Propagate(int PDG)

GeantCode = fdbPDG->ConvertPdgToGeant3(PDG);
// LOG(info) << " FairGeanePro::Propagate ---------------------------"<< " " << x1[0]<< " "<< x1[1]<< " "<<
// x1[2]; fApp->GeanePreTrack(x1, p1, PDG);
// x1[2];
gMC3->Ertrak(x1, p1, x2, p2, GeantCode, fPropOption.Data());
if (x2[0] < -1.E29) {
return kFALSE;
Expand Down Expand Up @@ -1555,10 +1551,11 @@ void FairGeanePro::Track3ToPoint(TVector3 X1,

void FairGeanePro::GetTransportMatrix(double trm[5][5])
{
for (int i = 0; i < 5; i++)
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
trm[i][j] = trpmat[i][j];
}
}
}

ClassImp(FairGeanePro);
48 changes: 21 additions & 27 deletions geane/FairGeanePro.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
Expand All @@ -12,16 +12,15 @@
#ifndef FAIRGEANEPRO_H
#define FAIRGEANEPRO_H 1

#include "FairLogger.h"
#include "FairPropagator.h" // for TNamed
#include "TGeant3.h" // for Ertrio_t, etc
#include "TString.h" // for TString
#include "TVector3.h" // for TVector3

#include <TGeant3.h> // for Ertrio_t, etc
#include <TString.h>
#include <TVector3.h>

class FairTrackPar;
class FairTrackParP;
class FairTrackParH;
class FairGeaneApplication;
class TDatabasePDG;

class FairGeanePro : public FairPropagator
Expand All @@ -31,42 +30,42 @@ class FairGeanePro : public FairPropagator
FairGeanePro();

/** Destructor **/
~FairGeanePro();
~FairGeanePro() override;

/* Old methods that still should be working */
virtual bool Propagate(FairTrackParH* TStart, FairTrackParH* TEnd, int PDG);
virtual bool Propagate(FairTrackParP* TStart, FairTrackParH* TEnd, int PDG);
virtual bool Propagate(FairTrackParP* TStart, FairTrackParP* TEnd, int PDG);
virtual bool Propagate(FairTrackParH* TStart, FairTrackParP* TEnd, int PDG);
virtual bool Propagate(float* x1, float* p1, float* x2, float* p2, int PDG);
bool Propagate(FairTrackParH* TStart, FairTrackParH* TEnd, int PDG) override;
bool Propagate(FairTrackParP* TStart, FairTrackParH* TEnd, int PDG) override;
bool Propagate(FairTrackParP* TStart, FairTrackParP* TEnd, int PDG) override;
bool Propagate(FairTrackParH* TStart, FairTrackParP* TEnd, int PDG) override;
bool Propagate(float* x1, float* p1, float* x2, float* p2, int PDG) override;

/* Old methods that still should be working */

/**New method to set the plane to propagate particles to
@v0 v1 v2 Plane defining vectors
*/
virtual bool SetDestinationPlane(const TVector3& v0, const TVector3& v1, const TVector3& v2);
bool SetDestinationPlane(const TVector3& v0, const TVector3& v1, const TVector3& v2) override;

/**New method to set the plane to propagate particles from
@v0 v1 Plane defining vectors
*/
virtual bool SetOriginPlane(const TVector3& v0, const TVector3& v1);
bool SetOriginPlane(const TVector3& v0, const TVector3& v1) override;

/**New method to set the volume to propagate particles to
@volName Volume name
@copyNo Copy number
@option Option
*/
virtual bool SetDestinationVolume(std::string volName, int copyNo, int option);
bool SetDestinationVolume(std::string volName, int copyNo, int option) override;

/**New method to set the length to propagate particles to
@length Track length
*/
virtual bool SetDestinationLength(float length);
bool SetDestinationLength(float length) override;

/**New method to set to propagate only parameters
*/
virtual bool SetPropagateOnlyParameters();
bool SetPropagateOnlyParameters() override;

/* ====== Depracated functions ====== */
/** \deprecated Deprecated pre-v19, will be removed in v20. */
Expand All @@ -87,7 +86,7 @@ class FairGeanePro : public FairPropagator
PropagateOnlyParameters();
/* ====== ====== ====== ====== ====== */

void Init(FairTrackPar* TParam);
void Init(FairTrackPar* TParam) override;
bool Propagate(int PDG);

private:
Expand Down Expand Up @@ -196,14 +195,10 @@ class FairGeanePro : public FairPropagator

void setBackProp() { fPropOption = "BPE"; }

virtual bool SetPCAPropagation(int pca, int dir = 1, FairTrackParP* par = nullptr);
bool SetPCAPropagation(int pca, int dir = 1, FairTrackParP* par = nullptr) override;

virtual PCAOutputStruct FindPCA(int PCA,
int PDGCode,
TVector3 Point,
TVector3 Wire1,
TVector3 Wire2,
double MaxDistance);
PCAOutputStruct FindPCA(int PCA, int PDGCode, TVector3 Point, TVector3 Wire1, TVector3 Wire2, double MaxDistance)
override;

// transport matrix
void GetTransportMatrix(double trm[5][5]);
Expand Down Expand Up @@ -245,7 +240,6 @@ class FairGeanePro : public FairPropagator
float ftrklength;
float ftrktime;
int flag;
FairGeaneApplication* fApp;
double trpmat[5][5];

// if kFALSE --> do not print the ABORT messages
Expand All @@ -254,7 +248,7 @@ class FairGeanePro : public FairPropagator
FairGeanePro(const FairGeanePro&);
FairGeanePro& operator=(const FairGeanePro&);

ClassDef(FairGeanePro, 2);
ClassDefOverride(FairGeanePro, 2);
};

#endif

0 comments on commit 9c6ac00

Please sign in to comment.