Skip to content
Snippets Groups Projects
Commit 95c7729b authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'warn.InDetOverlay-20201009' into 'master'

InDetOverlay: Fix warnings in TRTOverlay_test.

See merge request atlas/athena!37133
parents 365a6bd1 568465f2
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ atlas_add_test( SCTOverlay_test
ENVIRONMENT "JOBOPTSEARCHPATH=${_jobOPath}" )
atlas_add_test( TRTOverlay_test
SOURCES src/TRTOverlay.cxx test/TRTOverlay_test.cxx
SOURCES test/TRTOverlay_test.cxx src/TRTOverlay.cxx
INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS}
LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps IDC_OverlayBase GaudiKernel InDetRawData StoreGateLib SGtests GeneratorObjects InDetIdentifier InDetSimData TrkTrack TRT_ConditionsServicesLib TRT_ElectronPidToolsLib IdDictParser ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES}
ENVIRONMENT "JOBOPTSEARCHPATH=${_jobOPath}" )
......
......@@ -9,6 +9,10 @@
#undef NDEBUG
// Otherwise we get warnings about mutable members in gmock.
#include "CxxUtils/checker_macros.h"
ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
// Tested AthAlgorithm
#include "../InDetOverlay/TRTOverlay.h"
......@@ -65,18 +69,18 @@ namespace OverlayTesting {
MOCK_CONST_METHOD1(getDetectorOccupancy, std::map<int, double>(const TRT_RDO_Container*) );
// Dummy methods to confirm status
virtual StatusCode initialize() override final {
virtual StatusCode initialize() final {
ATH_MSG_INFO ("initializing MockTRT_LocalOccupancy: " << name());
return StatusCode::SUCCESS;
};
// dummy methods implementing in pure virtual interface methods (to make class non-abstract)
/** Return the local occupancy for the sectors crossed by a given track */
virtual float LocalOccupancy( const Trk::Track& ) const override { return 1.0; }; // not used - dummy implementation
virtual float LocalOccupancy(const double, const double) const override{ return 1.0; }; // not used - dummy implementation
virtual float LocalOccupancy( const Trk::Track& ) const { return 1.0; }; // not used - dummy implementation
virtual float LocalOccupancy(const double, const double) const { return 1.0; }; // not used - dummy implementation
/** Return the global occupancy of the event*/
virtual std::vector<float> GlobalOccupancy( ) const override { std::vector<float> dummyVect{}; return dummyVect; }; // not used - dummy implementation
virtual std::vector<float> GlobalOccupancy( ) const { std::vector<float> dummyVect{}; return dummyVect; }; // not used - dummy implementation
};
DECLARE_COMPONENT( MockTRT_LocalOccupancy )
......@@ -96,23 +100,23 @@ namespace OverlayTesting {
virtual ~MockTRT_StrawStatusSummaryTool() = default;
// Dummy methods to confirm status
virtual StatusCode initialize() override final {
virtual StatusCode initialize() final {
ATH_MSG_INFO ("initializing MockTRT_StrawStatusSummaryTool: " << name());
return StatusCode::SUCCESS;
};
virtual int getStatus(const Identifier ) const override { return 1; }; // not used - dummy implementation
virtual int getStatusPermanent(const Identifier) const override { return 1; }; // not used - dummy implementation
virtual int getStatus(const Identifier ) const { return 1; }; // not used - dummy implementation
virtual int getStatusPermanent(const Identifier) const { return 1; }; // not used - dummy implementation
MOCK_CONST_METHOD1(getStatusHT, int(const Identifier)); // This is the only method that we actually need! <--------------
virtual bool get_status(const Identifier) const override { return false; }; // not used - dummy implementation
virtual bool get_statusHT(const Identifier) const override { return false; }; // not used - dummy implementation
virtual const StrawStatusContainer* getStrawStatusHTContainer() const override {return nullptr;}; // not used - dummy implementation
virtual bool get_status(const Identifier) const { return false; }; // not used - dummy implementation
virtual bool get_statusHT(const Identifier) const { return false; }; // not used - dummy implementation
virtual const StrawStatusContainer* getStrawStatusHTContainer() const {return nullptr;}; // not used - dummy implementation
virtual int getStatus(const Identifier, const EventContext& ) const override { return 1; }; // not used - dummy implementation
virtual int getStatusPermanent(const Identifier, const EventContext& ) const override { return 1; }; // not used - dummy implementation
virtual int getStatusHT(const Identifier, const EventContext& ) const override { return 1; }; // not used - dummy implementation
virtual bool get_status(const Identifier, const EventContext& ) const override { return false; }; // not used - dummy implementation
virtual bool get_statusHT(const Identifier, const EventContext& ) const override { return false; }; // not used - dummy implementation
virtual int getStatus(const Identifier, const EventContext& ) const { return 1; }; // not used - dummy implementation
virtual int getStatusPermanent(const Identifier, const EventContext& ) const { return 1; }; // not used - dummy implementation
virtual int getStatusHT(const Identifier, const EventContext& ) const { return 1; }; // not used - dummy implementation
virtual bool get_status(const Identifier, const EventContext& ) const { return false; }; // not used - dummy implementation
virtual bool get_statusHT(const Identifier, const EventContext& ) const { return false; }; // not used - dummy implementation
};
......@@ -359,7 +363,7 @@ namespace OverlayTesting {
// check output makes sense
SG::ReadHandle<TRT_RDO_Container> outputDataHandle{"StoreGateSvc+TRT_RDOs"};
ASSERT_TRUE( outputDataHandle.isValid() );
ASSERT_EQ( outputDataHandle->numberOfCollections(), 0 );
ASSERT_EQ( outputDataHandle->numberOfCollections(), 0u );
}
TEST_F(TRTOverlay_test, containers_with_matching_empty_collections) {
......@@ -390,7 +394,7 @@ namespace OverlayTesting {
// check output makes sense
SG::ReadHandle<TRT_RDO_Container> outputDataHandle{"StoreGateSvc+TRT_RDOs"};
ASSERT_TRUE( outputDataHandle.isValid() );
ASSERT_EQ( outputDataHandle->numberOfCollections(),1 );
ASSERT_EQ( outputDataHandle->numberOfCollections(),1u );
const TRT_RDO_Collection *outputCollection = outputDataHandle->indexFindPtr(sigElementHash);
ASSERT_NE( outputCollection, nullptr );
ASSERT_TRUE( outputCollection->empty() );
......@@ -424,7 +428,7 @@ namespace OverlayTesting {
// check output makes sense
SG::ReadHandle<TRT_RDO_Container> outputDataHandle{"StoreGateSvc+TRT_RDOs"};
ASSERT_TRUE( outputDataHandle.isValid() );
ASSERT_EQ( outputDataHandle->numberOfCollections(), 2 );
ASSERT_EQ( outputDataHandle->numberOfCollections(), 2u );
const TRT_RDO_Collection *outputCollection1 = outputDataHandle->indexFindPtr(sigElementHash);
ASSERT_NE( outputCollection1, nullptr );
ASSERT_TRUE( outputCollection1->empty() );
......@@ -482,10 +486,10 @@ namespace OverlayTesting {
// check output makes sense
SG::ReadHandle<TRT_RDO_Container> outputDataHandle{"StoreGateSvc+TRT_RDOs"};
ASSERT_TRUE( outputDataHandle.isValid() );
ASSERT_EQ( outputDataHandle->numberOfCollections(), 1 );
ASSERT_EQ( outputDataHandle->numberOfCollections(), 1u );
const TRT_RDO_Collection *outputCollection1 = outputDataHandle->indexFindPtr(sigElementHash);
ASSERT_NE( outputCollection1, nullptr );
ASSERT_EQ( outputCollection1->size(), 1 );
ASSERT_EQ( outputCollection1->size(), 1u );
const TRT_LoLumRawData* outputDigit1 = dynamic_cast<const TRT_LoLumRawData*>(outputCollection1->at(0));
ASSERT_NE( outputDigit1, nullptr );
ASSERT_EQ( outputDigit1->highLevel(), sigHT );
......@@ -561,7 +565,7 @@ namespace OverlayTesting {
ASSERT_TRUE( outputDataHandle.isValid() );
const TRT_RDO_Collection *outputCollection1 = outputDataHandle->indexFindPtr(sigElementHash);
ASSERT_NE( outputCollection1, nullptr );
ASSERT_EQ( outputCollection1->size(), 1 );
ASSERT_EQ( outputCollection1->size(), 1u );
const TRT_LoLumRawData* outputDigit1 = dynamic_cast<const TRT_LoLumRawData*>(outputCollection1->at(0));
ASSERT_NE( outputDigit1, nullptr );
ASSERT_EQ( outputDigit1->highLevel(), sigHT );
......@@ -569,7 +573,7 @@ namespace OverlayTesting {
ASSERT_EQ( outputDigit1->driftTimeBin(), sigDriftTimeBin );
const TRT_RDO_Collection *outputCollection2 = outputDataHandle->indexFindPtr(bkgElementHash);
ASSERT_NE( outputCollection2, nullptr );
ASSERT_EQ( outputCollection2->size(), 1 );
ASSERT_EQ( outputCollection2->size(), 1u );
const TRT_LoLumRawData* outputDigit2 = dynamic_cast<const TRT_LoLumRawData*>(outputCollection2->at(0));
ASSERT_NE( outputDigit2, nullptr );
ASSERT_EQ( outputDigit2->highLevel(), bkgHT );
......@@ -637,7 +641,7 @@ namespace OverlayTesting {
ASSERT_TRUE( outputDataHandle.isValid() );
const TRT_RDO_Collection *outputCollection1 = outputDataHandle->indexFindPtr(sigElementHash);
ASSERT_NE( outputCollection1, nullptr );
ASSERT_EQ( outputCollection1->size(), 1 );
ASSERT_EQ( outputCollection1->size(), 1u );
const TRT_LoLumRawData* outputDigit1 = dynamic_cast<const TRT_LoLumRawData*>(outputCollection1->at(0));
ASSERT_NE( outputDigit1, nullptr );
ASSERT_EQ( outputDigit1->highLevel(), sigHT );
......@@ -723,12 +727,12 @@ namespace OverlayTesting {
ASSERT_TRUE( outputDataHandle.isValid() );
const TRT_RDO_Collection *outputCollection1 = outputDataHandle->indexFindPtr(sigElementHash);
ASSERT_NE( outputCollection1, nullptr );
ASSERT_EQ( outputCollection1->size(), 1 );
ASSERT_EQ( outputCollection1->size(), 1u );
const TRT_LoLumRawData* outputDigit1 = dynamic_cast<const TRT_LoLumRawData*>(outputCollection1->at(0));
ASSERT_NE( outputDigit1, nullptr );
ASSERT_EQ( outputDigit1->highLevel(), sigHT );
ASSERT_EQ( outputDigit1->timeOverThreshold(), outputTOT );
ASSERT_EQ( outputDigit1->driftTimeBin(), outputDriftTimeBin );
ASSERT_EQ( outputDigit1->driftTimeBin(), static_cast<int>(outputDriftTimeBin) );
}
TEST_F(TRTOverlay_test, containers_with_matching_collections_with_differing_LT_RDOs_same_strawID) {
......@@ -821,12 +825,12 @@ namespace OverlayTesting {
ASSERT_TRUE( outputDataHandle.isValid() );
const TRT_RDO_Collection *outputCollection1 = outputDataHandle->indexFindPtr(sigElementHash);
ASSERT_NE( outputCollection1, nullptr );
ASSERT_EQ( outputCollection1->size(), 1 );
ASSERT_EQ( outputCollection1->size(), 1u );
const TRT_LoLumRawData* outputDigit1 = dynamic_cast<const TRT_LoLumRawData*>(outputCollection1->at(0));
ASSERT_NE( outputDigit1, nullptr );
ASSERT_EQ( outputDigit1->highLevel(), sigHT );
ASSERT_EQ( outputDigit1->timeOverThreshold(), outputTOT );
ASSERT_EQ( outputDigit1->driftTimeBin(), outputDriftTimeBin );
ASSERT_EQ( outputDigit1->driftTimeBin(), static_cast<int>(outputDriftTimeBin) );
}
TEST_F(TRTOverlay_test, containers_with_matching_collections_with_differing_LT_RDOs_same_strawID_ForceHTbit) {
......@@ -918,12 +922,12 @@ namespace OverlayTesting {
ASSERT_TRUE( outputDataHandle.isValid() );
const TRT_RDO_Collection *outputCollection1 = outputDataHandle->indexFindPtr(sigElementHash);
ASSERT_NE( outputCollection1, nullptr );
ASSERT_EQ( outputCollection1->size(), 1 );
ASSERT_EQ( outputCollection1->size(), 1u );
const TRT_LoLumRawData* outputDigit1 = dynamic_cast<const TRT_LoLumRawData*>(outputCollection1->at(0));
ASSERT_NE( outputDigit1, nullptr );
ASSERT_EQ( outputDigit1->highLevel(), true );
ASSERT_EQ( outputDigit1->timeOverThreshold(), outputTOT );
ASSERT_EQ( outputDigit1->driftTimeBin(), outputDriftTimeBin );
ASSERT_EQ( outputDigit1->driftTimeBin(), static_cast<int>(outputDriftTimeBin) );
}
} // <-- namespace OverlayTesting
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment