diff --git a/DataQuality/dqm_algorithms/src/MUCTPISLAnyHit.cxx b/DataQuality/dqm_algorithms/src/MUCTPISLAnyHit.cxx index 0f727ea34b472217b979246c892e238916b8059f..8c270a10337ba68bd0d19e7e1ee8a64f91201350 100644 --- a/DataQuality/dqm_algorithms/src/MUCTPISLAnyHit.cxx +++ b/DataQuality/dqm_algorithms/src/MUCTPISLAnyHit.cxx @@ -49,11 +49,11 @@ MUCTPISLAnyHit::execute( const std::string& name, const TObject& object, const d { using namespace std; - TH2 * hist; + const TH2 *hist; //ensure that input histo is 2D if( object.IsA()->InheritsFrom( "TH2" ) ) { - hist = (TH2*)&object; + hist = dynamic_cast<const TH2 *>(&object); if (hist->GetDimension() != 2 ){ throw dqm_core::BadConfig( ERS_HERE, name, "dimension != 2 " ); }