Skip to content

Commit b3c2c2a

Browse files
committed
refactor(base): Enforce new sensitivity model on dependend code
By ,arking old IsSensitive function as final, all deriving classes will generate compilation error.
1 parent c700986 commit b3c2c2a

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

fairroot/base/sim/FairModule.h

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,28 @@ class FairModule : public TNamed
104104
template<class T, class U>
105105
void ConstructASCIIGeometry(TString containerName = "");
106106

107-
/** Check volume sensitivity by probing medium sensitivity flag. */
108-
virtual Bool_t IsSensitive(TGeoVolume* vol) { return (vol->GetMedium()->GetParam(0) == 1.0); }
107+
/**
108+
* Check volume sensitivity by probing medium sensitivity flag.
109+
*
110+
* Function checks the sensitivity property of the medium. This is generic approach and should work for any volume.
111+
* Override this _only_ in case of specific customisation.
112+
*
113+
* See Bool_t IsSensitive(const std::string& name) for deprecation notice.
114+
*/
115+
virtual bool IsSensitive(TGeoVolume* vol) { return (vol->GetMedium()->GetParam(0) == 1.0); }
109116

110-
/**Set the sensitivity flag for volumes, called from ConstructASCIIRootGeometry(), and has to be implimented for
111-
* detectors which use ConstructASCIIRootGeometry() to build the geometry */
112-
virtual Bool_t IsSensitive(const std::string& name) __attribute__((deprecated(
113-
"The method IfSensitive(const std::string& name) is deprecated and may be removed in the future releases.")));
117+
/**
118+
* Set the sensitivity flag for volumes, called from ConstructASCIIRootGeometry(), and has to be implimented for
119+
* detectors which use ConstructASCIIRootGeometry() to build the geometry
120+
*/
121+
[[deprecated("Remove override of this function. Use override of IsSensitive(TGeoVolume* vol) only if customisation "
122+
"required. This function will be removed in the future releases.")]]
123+
virtual Bool_t IsSensitive(const std::string& name) final;
114124

115125
/**The function below is depracated, please change to the new method above */
116-
virtual Bool_t CheckIfSensitive(__attribute__((unused)) std::string name) __attribute__((
117-
deprecated("The method CheckIfSensitive is deprecated. Implement IsSensitive in the detector classes.")))
126+
[[deprecated("The method CheckIfSensitive is deprecated. Implement IsSensitive in the detector "
127+
"classes. To be removed in the future.")]]
128+
virtual Bool_t CheckIfSensitive(__attribute__((unused)) std::string name) final
118129
{
119130
return kFALSE;
120131
}

0 commit comments

Comments
 (0)