diff --git a/core/base/CMakeLists.txt b/core/base/CMakeLists.txt index b67dbdd8c2e080b7e1f46e8aec1bf4077981f380..225973166c40a00dfdd546caf9abc343e9c332ad 100644 --- a/core/base/CMakeLists.txt +++ b/core/base/CMakeLists.txt @@ -60,6 +60,13 @@ utils/CbmMediaList.cxx utils/CbmFileUtils.cxx ) + +If(${FairRoot_VERSION} VERSION_LESS 18.4.0) + set_source_files_properties(utils/CbmGeometryUtils.cxx + PROPERTIES COMPILE_DEFINITIONS OLD_MODULE_VERSION + ) +EndIf() + Set(LINKDEF CbmBaseLinkDef.h) Set(LIBRARY_NAME CbmBase) Set(DEPENDENCIES diff --git a/core/base/utils/CbmGeometryUtils.cxx b/core/base/utils/CbmGeometryUtils.cxx index 396877171f0f99ae2785764f76eca872ae5a355b..cf094b6162280e2627a08805665296fbac882c1f 100644 --- a/core/base/utils/CbmGeometryUtils.cxx +++ b/core/base/utils/CbmGeometryUtils.cxx @@ -326,7 +326,11 @@ namespace Cbm if (fNode->GetNdaughters() > 0) { Cbm::GeometryUtils::ExpandNodes(v, mod); } Cbm::GeometryUtils::AssignMediumAtImport(v); +#ifdef OLD_MODULE_VERSION if ((mod->InheritsFrom("FairDetector")) && mod->CheckIfSensitive(v->GetName())) { +#else + if ((mod->InheritsFrom("FairDetector")) && mod->IsSensitive(v->GetName())) { +#endif LOG(debug) << "Module " << v->GetName() << " of detector " << mod->GetName() << " is sensitive"; mod->AddSensitiveVolume(v); } diff --git a/mvd/CbmMvd.cxx b/mvd/CbmMvd.cxx index d1411433653f01059ba2c0f83b7e76ebc2e8de34..ced259652a52b564aa27c3526dbe5fb9bc5e83ae 100644 --- a/mvd/CbmMvd.cxx +++ b/mvd/CbmMvd.cxx @@ -266,7 +266,7 @@ CbmMvdPoint* CbmMvd::AddHit(Int_t trackID, Int_t pdg, Int_t sensorNr, TVector3 p } // ---------------------------------------------------------------------------- -Bool_t CbmMvd::CheckIfSensitive(std::string name) +Bool_t CbmMvd::IsSensitive(const std::string& name) { TString tsname = name; if (tsname.Contains("sensorActive") || tsname.Contains("MimosaActive") @@ -282,8 +282,8 @@ Bool_t CbmMvd::CheckIfSensitive(std::string name) } return kFALSE; } -// ---------------------------------------------------------------------------- +Bool_t CbmMvd::CheckIfSensitive(std::string name) { return IsSensitive(name); } // ---------------------------------------------------------------------------- diff --git a/mvd/CbmMvd.h b/mvd/CbmMvd.h index 229e1c5edebdbe38febcda08c7611aa67d3a4c2d..a377ddc9986873d026afee9a6d0e61c0a3a5687e 100644 --- a/mvd/CbmMvd.h +++ b/mvd/CbmMvd.h @@ -125,6 +125,7 @@ public: virtual void ConstructRootGeometry(TGeoMatrix* shift = NULL); + virtual Bool_t IsSensitive(const std::string& name); virtual Bool_t CheckIfSensitive(std::string name); virtual map<Int_t, Int_t> GetMap() { return fStationMap; }; diff --git a/sim/detectors/much/CbmMuch.cxx b/sim/detectors/much/CbmMuch.cxx index 5aa36c382be049032856c4573d94687305a90ebb..73b4c08643e874927f8f288d9628d863fff40eb8 100644 --- a/sim/detectors/much/CbmMuch.cxx +++ b/sim/detectors/much/CbmMuch.cxx @@ -387,7 +387,7 @@ void CbmMuch::ConstructRootGeometry(TGeoMatrix*) // ----- CheckIfSensitive ------------------------------------------------- -Bool_t CbmMuch::CheckIfSensitive(std::string name) +Bool_t CbmMuch::IsSensitive(const std::string& name) { TString tsname = name; @@ -398,3 +398,5 @@ Bool_t CbmMuch::CheckIfSensitive(std::string name) } return kFALSE; } + +Bool_t CbmMuch::CheckIfSensitive(std::string name) { return IsSensitive(name); } diff --git a/sim/detectors/much/CbmMuch.h b/sim/detectors/much/CbmMuch.h index 48c914ac93612ae1430cfb7e531a6c4281e1e660..a69580af625c42e5ffa378c08804a7c9ec7ec1c2 100644 --- a/sim/detectors/much/CbmMuch.h +++ b/sim/detectors/much/CbmMuch.h @@ -112,6 +112,7 @@ public: virtual void ConstructGeometry(); virtual void ConstructRootGeometry(TGeoMatrix* shift = NULL); Bool_t CheckIfSensitive(std::string name); + virtual Bool_t IsSensitive(const std::string& name); private: /** Track information to be stored until the track leaves the diff --git a/sim/detectors/psd/CbmPsdMC.h b/sim/detectors/psd/CbmPsdMC.h index 3b8da1f3c1f3298fcba5c3f8d6f225afbbf3726d..602a809ac8745c74d1b983786ed35e4d326e8e88 100644 --- a/sim/detectors/psd/CbmPsdMC.h +++ b/sim/detectors/psd/CbmPsdMC.h @@ -52,11 +52,20 @@ public: ** The decision is based on the volume name (has to contain "scint"). ** Virtual from FairModule. **/ - virtual Bool_t CheckIfSensitive(std::string name) + virtual Bool_t IsSensitive(const std::string& name) { return (TString(name).Contains("scint", TString::kIgnoreCase) ? kTRUE : kFALSE); } + /** @brief Check whether a volume is sensitive. + ** @param(name) Volume name + ** @value kTRUE if volume is sensitive, else kFALSE + ** + ** The decision is based on the volume name (has to contain "scint"). + ** Virtual from FairModule. + **/ + virtual Bool_t CheckIfSensitive(std::string name) { return IsSensitive(name); } + /** @brief Construct the PSD geometry in the TGeoManager. ** diff --git a/sim/detectors/rich/CbmRich.cxx b/sim/detectors/rich/CbmRich.cxx index 10760f91e5c5f0a45e26dea3307c266b8f37df06..011304952ae9ec194c1a6fa37daf049b6c65771d 100644 --- a/sim/detectors/rich/CbmRich.cxx +++ b/sim/detectors/rich/CbmRich.cxx @@ -88,7 +88,7 @@ CbmRich::~CbmRich() void CbmRich::Initialize() { FairDetector::Initialize(); } -Bool_t CbmRich::CheckIfSensitive(std::string name) +Bool_t CbmRich::IsSensitive(const std::string& name) { //return true; TString volName = name; @@ -98,6 +98,8 @@ Bool_t CbmRich::CheckIfSensitive(std::string name) return kFALSE; } +Bool_t CbmRich::CheckIfSensitive(std::string name) { return IsSensitive(name); } + Bool_t CbmRich::ProcessHits(FairVolume* vol) { diff --git a/sim/detectors/rich/CbmRich.h b/sim/detectors/rich/CbmRich.h index d84ec6e625166163830110c62bdae84e94815d30..a057a519156bb4ef5e746c1229a767df7cc16ed4 100644 --- a/sim/detectors/rich/CbmRich.h +++ b/sim/detectors/rich/CbmRich.h @@ -163,6 +163,7 @@ public: ** @value kTRUE if volume is sensitive, else kFALSE **/ virtual Bool_t CheckIfSensitive(std::string name); + virtual Bool_t IsSensitive(const std::string& name); /* * \brief set fRegisterPhotonsOnSensitivePlane parameter diff --git a/sim/detectors/sts/CbmStsMC.h b/sim/detectors/sts/CbmStsMC.h index f96e3ae0da695fa8113a5df57c0d96b797477f80..1066a7787db95123da1ad9c81adfc601c0a6426b 100644 --- a/sim/detectors/sts/CbmStsMC.h +++ b/sim/detectors/sts/CbmStsMC.h @@ -59,7 +59,8 @@ public: ** The decision is based on the volume name (has to contain "Sensor"). ** Virtual from FairModule. **/ - virtual Bool_t CheckIfSensitive(std::string name) { return (TString(name).Contains("Sensor") ? kTRUE : kFALSE); } + virtual Bool_t IsSensitive(const std::string& name) { return (TString(name).Contains("Sensor") ? kTRUE : kFALSE); } + virtual Bool_t CheckIfSensitive(std::string name) { return IsSensitive(name); } /** @brief Construct the STS geometry in the TGeoManager. diff --git a/sim/detectors/tof/CbmTof.cxx b/sim/detectors/tof/CbmTof.cxx index c9eba6624f3379840a4f9c6871c86246895dc338..77e8381338f6cf57488cb92ef05001ad0f662c32 100644 --- a/sim/detectors/tof/CbmTof.cxx +++ b/sim/detectors/tof/CbmTof.cxx @@ -543,7 +543,7 @@ void CbmTof::CreateInBeamNodes() // ------------------------------------------------------------------------- // ----- Private method CheckIfSensitive ------------------------------- -Bool_t CbmTof::CheckIfSensitive(std::string name) +Bool_t CbmTof::IsSensitive(const std::string& name) { // If the current Cell volume belongs to a counter declared inactive w.r.t. // Monte Carlo point creation, it is not declared sensitive @@ -561,6 +561,9 @@ Bool_t CbmTof::CheckIfSensitive(std::string name) } return kFALSE; } + +Bool_t CbmTof::CheckIfSensitive(std::string name) { return IsSensitive(name); } + // ------------------------------------------------------------------------- diff --git a/sim/detectors/tof/CbmTof.h b/sim/detectors/tof/CbmTof.h index 1b415d1d6da1a5807f66db2d2b3bd850baa821d4..fcce68b61c27dbd3f0da00289c487cb374099913 100644 --- a/sim/detectors/tof/CbmTof.h +++ b/sim/detectors/tof/CbmTof.h @@ -145,6 +145,9 @@ public: **/ void SetCounterInBeam(Int_t iModuleType, Int_t iModuleIndex, Int_t iCounterIndex); + Bool_t CheckIfSensitive(std::string name); + virtual Bool_t IsSensitive(const std::string& name); + private: /** Track information to be stored until the track leaves the active volume. **/ @@ -199,7 +202,6 @@ private: **/ void ResetParameters(); - Bool_t CheckIfSensitive(std::string name); virtual void ConstructRootGeometry(TGeoMatrix* shift = NULL); diff --git a/sim/detectors/trd/CbmTrd.cxx b/sim/detectors/trd/CbmTrd.cxx index a512f5e57b0ad1ea4cc4cb5f783b0226c8e07939..907d2a6101cb5560f6c598a8c87c2901d3f9534a 100644 --- a/sim/detectors/trd/CbmTrd.cxx +++ b/sim/detectors/trd/CbmTrd.cxx @@ -321,7 +321,7 @@ void CbmTrd::ConstructRootGeometry(TGeoMatrix*) } // ----- CheckIfSensitive ------------------------------------------------- -Bool_t CbmTrd::CheckIfSensitive(std::string name) +Bool_t CbmTrd::IsSensitive(const std::string& name) { TString tsname = name; if (tsname.EqualTo("gas")) { @@ -332,4 +332,6 @@ Bool_t CbmTrd::CheckIfSensitive(std::string name) } // ---------------------------------------------------------------------------- +Bool_t CbmTrd::CheckIfSensitive(std::string name) { return IsSensitive(name); } + ClassImp(CbmTrd) diff --git a/sim/detectors/trd/CbmTrd.h b/sim/detectors/trd/CbmTrd.h index a14eca8790234f064b17b458da60949bd26534c1..c33da858ba6c07dafe89ad0040e3902d35ba1252 100644 --- a/sim/detectors/trd/CbmTrd.h +++ b/sim/detectors/trd/CbmTrd.h @@ -99,6 +99,7 @@ public: virtual void ConstructGeometry(); Bool_t CheckIfSensitive(std::string name); + virtual Bool_t IsSensitive(const std::string& name); void UseGlobalPhysicsProcesses(Bool_t use) { fUseGlobalPhysicsProcesses = use; } diff --git a/sim/passive/CbmMagnet.cxx b/sim/passive/CbmMagnet.cxx index 3e13fdc1bea6ca5e7554ae34ff9630bfca99a58c..f4c9de85e5edade6f638b8d868f0bec5c344eb92 100644 --- a/sim/passive/CbmMagnet.cxx +++ b/sim/passive/CbmMagnet.cxx @@ -65,11 +65,13 @@ void CbmMagnet::ConstructGeometry() } } -Bool_t CbmMagnet::CheckIfSensitive(std::string) +Bool_t CbmMagnet::IsSensitive(const std::string&) { // There are no sensitive volumes in the magnet return kFALSE; } +Bool_t CbmMagnet::CheckIfSensitive(std::string name) { return IsSensitive(name); } + ClassImp(CbmMagnet) diff --git a/sim/passive/CbmMagnet.h b/sim/passive/CbmMagnet.h index f6f6288f3d8d518a5435ee8f5eeb4cc6df40a8ef..930cd7c6c5004165e5b2b9a3c804c11a5d6a698a 100644 --- a/sim/passive/CbmMagnet.h +++ b/sim/passive/CbmMagnet.h @@ -18,6 +18,7 @@ public: virtual ~CbmMagnet(); virtual void ConstructGeometry(); + virtual Bool_t IsSensitive(const std::string& name); Bool_t CheckIfSensitive(std::string name); private: