Skip to content

Commit 3b21318

Browse files
matthias-kleinersawenzel
authored andcommitted
MCKinematicsReader: adding destructor
1 parent dbbb414 commit 3b21318

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

Steer/include/Steer/MCKinematicsReader.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ class MCKinematicsReader
3535
/// default constructor
3636
MCKinematicsReader() = default;
3737

38+
/// destructor
39+
~MCKinematicsReader();
40+
3841
/// constructor taking a name and mode (either kDigiContext or kMCKine)
3942
/// In case of "context", the name is the filename of the digitization context.
4043
/// In case of MCKine mode, the name is the "prefix" referencing a single simulation production.
@@ -114,8 +117,8 @@ class MCKinematicsReader
114117
std::vector<TChain*> mInputChains;
115118

116119
// a vector of tracks foreach source and each collision
117-
mutable std::vector<std::vector<std::vector<o2::MCTrack>>> mTracks; // the in-memory track container
118-
mutable std::vector<std::vector<o2::dataformats::MCEventHeader>> mHeaders; // the in-memory header container
120+
mutable std::vector<std::vector<std::vector<o2::MCTrack>>> mTracks; // the in-memory track container
121+
mutable std::vector<std::vector<o2::dataformats::MCEventHeader>> mHeaders; // the in-memory header container
119122
mutable std::vector<std::vector<o2::dataformats::MCTruthContainer<o2::TrackReference>>> mIndexedTrackRefs; // the in-memory track ref container
120123

121124
bool mInitialized = false; // whether initialized

Steer/src/MCKinematicsReader.cxx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@
1818

1919
using namespace o2::steer;
2020

21+
MCKinematicsReader::~MCKinematicsReader()
22+
{
23+
for (auto chain : mInputChains) {
24+
delete chain;
25+
}
26+
mInputChains.clear();
27+
28+
if (mDigitizationContext) {
29+
delete mDigitizationContext;
30+
}
31+
}
32+
2133
void MCKinematicsReader::initIndexedTrackRefs(std::vector<o2::TrackReference>& refs, o2::dataformats::MCTruthContainer<o2::TrackReference>& indexedrefs) const
2234
{
2335
// sort trackrefs according to track index then according to track length

0 commit comments

Comments
 (0)