Skip to content

Commit c7074f6

Browse files
committed
ITS3: fix loading APTS repsonse function
1 parent ab8bcd7 commit c7074f6

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

Detectors/ITSMFT/common/simulation/include/ITSMFTSimulation/AlpideSimResponse.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class AlpideSimResponse
114114

115115
public:
116116
AlpideSimResponse() = default;
117-
~AlpideSimResponse() = default;
117+
virtual ~AlpideSimResponse() = default;
118118

119119
void initData(int tableNumber, std::string dataPath, const bool quiet = true);
120120

@@ -145,7 +145,7 @@ class AlpideSimResponse
145145
const std::string& getColRowDataFmt() const { return mColRowDataFmt; }
146146
void print() const;
147147

148-
ClassDefNV(AlpideSimResponse, 2);
148+
ClassDef(AlpideSimResponse, 2);
149149
};
150150

151151
//-----------------------------------------------------

Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ChipSimResponse.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ChipSimResponse : public o2::itsmft::AlpideSimResponse
2424
public:
2525
ChipSimResponse() = default;
2626
ChipSimResponse(const ChipSimResponse& other) = default;
27+
ChipSimResponse(const o2::itsmft::AlpideSimResponse* base) : o2::itsmft::AlpideSimResponse(*base) {}
2728

2829
float getRespCentreDep() const { return mRespCentreDep; }
2930
void computeCentreFromData();

Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/Digitizer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ class Digitizer : public TObject
4242
using ExtraDig = std::vector<itsmft::PreDigitLabelRef>; ///< container for extra contributions to PreDigits
4343

4444
public:
45+
~Digitizer();
46+
4547
void setDigits(std::vector<o2::itsmft::Digit>* dig) { mDigits = dig; }
4648
void setMCLabels(o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mclb) { mMCLabels = mclb; }
4749
void setROFRecords(std::vector<o2::itsmft::ROFRecord>* rec) { mROFRecords = rec; }

Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/// \file Digitizer.cxx
1313
/// \brief Implementation of the ITS3 digitizer
1414

15+
#include "ITS3Simulation/ChipSimResponse.h"
1516
#include "ITSMFTBase/SegmentationAlpide.h"
1617
#include "ITS3Simulation/Digitizer.h"
1718
#include "ITS3Base/ITS3Params.h"
@@ -34,6 +35,11 @@ using o2::itsmft::PreDigit;
3435

3536
using namespace o2::its3;
3637

38+
Digitizer::~Digitizer()
39+
{
40+
delete mSimRespIB;
41+
}
42+
3743
void Digitizer::init()
3844
{
3945
const int numOfChips = mGeometry->getNumberOfChips();
@@ -57,8 +63,14 @@ void Digitizer::init()
5763
if (!fOB || fOB->IsZombie() || !fOB->IsOpen()) {
5864
LOGP(fatal, "Cannot open file {}", fileOB);
5965
}
60-
mParams.setIBSimResponse(mSimRespIB = fIB->Get<o2::its3::ChipSimResponse>(nameIB));
61-
mParams.setOBSimResponse(mSimRespOB = fOB->Get<o2::itsmft::AlpideSimResponse>(nameOB));
66+
if ((mSimRespIB = new o2::its3::ChipSimResponse(fIB->Get<o2::itsmft::AlpideSimResponse>(nameIB))) == nullptr) {
67+
LOGP(fatal, "Cannot create response function for IB");
68+
}
69+
if ((mSimRespOB = fOB->Get<o2::itsmft::AlpideSimResponse>(nameOB)) == nullptr) {
70+
LOGP(fatal, "Cannot create response function for OB");
71+
}
72+
mParams.setIBSimResponse(mSimRespIB);
73+
mParams.setOBSimResponse(mSimRespOB);
6274
fIB->Close();
6375
fOB->Close();
6476
};

0 commit comments

Comments
 (0)