Skip to content
Snippets Groups Projects
Commit bebf75b4 authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau
Browse files

In CbmEvent class, add match presence to ToString + add explicit Clear method

parent 0fc228c4
No related branches found
No related tags found
1 merge request!14Second part of mCBM changes: core/data, fles/mcbm2018, MQ and macro/beamtime/
...@@ -60,7 +60,9 @@ std::string CbmEvent::ToString() const ...@@ -60,7 +60,9 @@ std::string CbmEvent::ToString() const
std::stringstream ss; std::stringstream ss;
ss << "Event " << fNumber << " at t = " << fTimeStart ss << "Event " << fNumber << " at t = " << fTimeStart
<< " ns. Registered data types: " << fIndexMap.size() << " ns. Registered data types: " << fIndexMap.size()
<< ", data objects: " << fNofData << "\n"; << ", data objects: " << fNofData
<< ( nullptr != fMatch ? ", with matches" : ", without matches" )
<< "\n";
for (auto it = fIndexMap.begin(); it != fIndexMap.end(); it++) { for (auto it = fIndexMap.begin(); it != fIndexMap.end(); it++) {
ss << " -- Data type " << it->first ss << " -- Data type " << it->first
<< ", number of data " << it->second.size() << "\n"; << ", number of data " << it->second.size() << "\n";
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "CbmDefs.h" // for ECbmDataType, ECbmModuleId::kStsTrack #include "CbmDefs.h" // for ECbmDataType, ECbmModuleId::kStsTrack
#include "CbmMatch.h" // for CbmMatch #include "CbmMatch.h" // for CbmMatch
#include "CbmVertex.h" // for CbmVertex #include "CbmVertex.h" // for CbmVertex, found in core/data/global
/** @class CbmEvent /** @class CbmEvent
** @brief Class characterising one event by a collection of links (indices) ** @brief Class characterising one event by a collection of links (indices)
...@@ -51,6 +51,9 @@ class CbmEvent: public TObject { ...@@ -51,6 +51,9 @@ class CbmEvent: public TObject {
if ( fMatch ) delete fMatch; if ( fMatch ) delete fMatch;
} }
/** Overload TObject Clear to clear the map! **/
void Clear( Option_t * /*option*/ ) { fIndexMap.clear(); }
/** Add a data object to the index map /** Add a data object to the index map
** @param DataType Type of data (for values see CbmDetectorList.h) ** @param DataType Type of data (for values see CbmDetectorList.h)
......
...@@ -265,7 +265,7 @@ TEST(_GTestCbmEvent, CheckSettersAndGetters) ...@@ -265,7 +265,7 @@ TEST(_GTestCbmEvent, CheckSettersAndGetters)
compareEventMap(test, 9, 3, ECbmDataType::kStsTrack, ststrack); compareEventMap(test, 9, 3, ECbmDataType::kStsTrack, ststrack);
} }
EXPECT_STREQ("Event -111 at t = 1 ns. Registered data types: 6, data objects: 9\n -- Data type 0, number of data 2\n -- Data type 200, number of data 1\n -- Data type 201, number of data 1\n -- Data type 202, number of data 1\n -- Data type 203, number of data 1\n -- Data type 204, number of data 3\n", test.ToString().c_str()); EXPECT_STREQ("Event -111 at t = 1 ns. Registered data types: 6, data objects: 9, without matches\n -- Data type 0, number of data 2\n -- Data type 200, number of data 1\n -- Data type 201, number of data 1\n -- Data type 202, number of data 1\n -- Data type 203, number of data 1\n -- Data type 204, number of data 3\n", test.ToString().c_str());
} }
......
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