Skip to content

Commit fa29217

Browse files
committed
TRK: load response function from ccdb
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 0d88043 commit fa29217

File tree

6 files changed

+30
-23
lines changed

6 files changed

+30
-23
lines changed

Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/DigiParams.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
#define ALICEO2_TRK_DIGIPARAMS_H
1717

1818
#include <Rtypes.h>
19-
#include <ITSMFTSimulation/AlpideSignalTrapezoid.h>
19+
#include "ITSMFTSimulation/AlpideSignalTrapezoid.h"
20+
#include "ITSMFTSimulation/AlpideSimResponse.h"
2021
#include "TRKBase/TRKBaseParam.h"
2122
#include "TRKBase/GeometryTGeo.h"
2223

@@ -91,8 +92,8 @@ class DigiParams
9192

9293
bool isTimeOffsetSet() const { return mTimeOffset > -infTime; }
9394

94-
const o2::trk::ChipSimResponse* getAlpSimResponse() const { return mAlpSimResponse; }
95-
void setAlpSimResponse(const o2::trk::ChipSimResponse* par) { mAlpSimResponse = par; }
95+
const o2::trk::ChipSimResponse* getAlpSimResponse() const { return mAlpSimResponse.get(); }
96+
void setAlpSimResponse(const o2::itsmft::AlpideSimResponse*);
9697

9798
const SignalShape& getSignalShape() const { return mSignalShape; }
9899
SignalShape& getSignalShape() { return (SignalShape&)mSignalShape; }
@@ -122,7 +123,7 @@ class DigiParams
122123

123124
o2::itsmft::AlpideSignalTrapezoid mSignalShape; ///< signal timeshape parameterization
124125

125-
const o2::trk::ChipSimResponse* mAlpSimResponse = nullptr; //!< pointer on external response
126+
std::unique_ptr<o2::trk::ChipSimResponse> mAlpSimResponse; //!< pointer on external response
126127

127128
// auxiliary precalculated parameters
128129
float mROFrameLengthInv = 0; ///< inverse length of RO frame in ns
@@ -132,4 +133,4 @@ class DigiParams
132133
} // namespace trk
133134
} // namespace o2
134135

135-
#endif
136+
#endif

Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/Digitizer.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Digitizer
5151

5252
void init();
5353

54-
o2::trk::ChipSimResponse* getChipResponse(int chipID);
54+
const o2::trk::ChipSimResponse* getChipResponse(int chipID);
5555

5656
/// Steer conversion of hits to digits
5757
void process(const std::vector<o2::trk::Hit>* hits, int evID, int srcID);
@@ -66,7 +66,6 @@ class Digitizer
6666
bool isContinuous() const { return mParams.isContinuous(); }
6767
void fillOutputContainer(uint32_t maxFrame = 0xffffffff);
6868

69-
void setDigiParams(const o2::trk::DigiParams& par) { mParams = par; }
7069
const o2::trk::DigiParams& getDigitParams() const { return mParams; }
7170

7271
// provide the common trk::GeometryTGeo to access matrices and segmentation
@@ -142,12 +141,9 @@ class Digitizer
142141

143142
int mNumberOfChips = 0;
144143

145-
o2::trk::ChipSimResponse* mChipSimResp = nullptr; // simulated response
146-
o2::trk::ChipSimResponse* mChipSimRespVD = nullptr; // simulated response for VD chips
147-
o2::trk::ChipSimResponse* mChipSimRespMLOT = nullptr; // simulated response for ML/OT chips
148-
149-
// std::string mResponseFile = "$(O2_ROOT)/share/Detectors/ITSMFT/data/AlpideResponseData/AlpideResponseData.root";
150-
std::string mResponseFile = "$(O2_ROOT)/share/Detectors/Upgrades/ITS3/data/ITS3ChipResponseData/APTSResponseData.root"; /// using temporarly the APTS response
144+
const o2::trk::ChipSimResponse* mChipSimResp = nullptr; // simulated response
145+
const o2::trk::ChipSimResponse* mChipSimRespVD = nullptr; // simulated response for VD chips
146+
const o2::trk::ChipSimResponse* mChipSimRespMLOT = nullptr; // simulated response for ML/OT chips
151147

152148
bool mSimRespOrientation{false}; // wether the orientation in the response function is flipped
153149
float mSimRespVDShift{0.f}; // adjusting the Y-shift in the APTS response function to match sensor local coord.

Detectors/Upgrades/ALICE3/TRK/simulation/src/DigiParams.cxx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
/// \file DigiParams.cxx
1313
/// \brief Implementation of the TRK digitization steering params. Based on the ITS2 code.
1414

15-
#include <fairlogger/Logger.h> // for LOG
16-
#include "TRKSimulation/DigiParams.h"
1715
#include <cassert>
16+
#include "Framework/Logger.h"
17+
#include "TRKSimulation/DigiParams.h"
18+
#include "TRKSimulation/ChipSimResponse.h"
1819

1920
using namespace o2::trk;
2021

@@ -70,3 +71,11 @@ void DigiParams::print() const
7071
printf("Charge time-response:\n");
7172
mSignalShape.print();
7273
}
74+
75+
void DigiParams::setAlpSimResponse(const o2::itsmft::AlpideSimResponse* resp)
76+
{
77+
if (!resp) {
78+
LOGP(fatal, "cannot set response function from null");
79+
}
80+
mAlpSimResponse = std::make_unique<o2::trk::ChipSimResponse>(resp);
81+
}

Detectors/Upgrades/ALICE3/TRK/simulation/src/Digitizer.cxx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,9 @@ void Digitizer::init()
4848
mChips[i].setDeadChanMap(mDeadChanMap);
4949
}
5050
}
51-
// importing the charge collection tables
52-
// (initialized while building O2)
53-
auto file = TFile::Open(mResponseFile.data());
54-
if (!file) {
55-
LOG(fatal) << "Cannot open response file " << mResponseFile;
56-
}
5751

5852
// setting the correct response function (for the moment, for both VD and MLOT the APTS response function is udes)
59-
mChipSimResp = (o2::trk::ChipSimResponse*)file->Get("response1");
53+
mChipSimResp = mParams.getAlpSimResponse();
6054
mChipSimRespVD = mChipSimResp; /// for the moment considering the same response
6155
mChipSimRespMLOT = mChipSimResp; /// for the moment considering the same response
6256

@@ -92,7 +86,7 @@ void Digitizer::init()
9286
mIRFirstSampledTF = o2::raw::HBFUtils::Instance().getFirstSampledTFIR();
9387
}
9488

95-
o2::trk::ChipSimResponse* Digitizer::getChipResponse(int chipID)
89+
const o2::trk::ChipSimResponse* Digitizer::getChipResponse(int chipID)
9690
{
9791
if (mGeometry->getSubDetID(chipID) == 0) { /// VD
9892
return mChipSimRespVD;

Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKSimulationLinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#pragma link C++ class o2::trk::Detector + ;
2525
#pragma link C++ class o2::base::DetImpl < o2::trk::Detector> + ;
2626
#pragma link C++ class o2::trk::Digitizer + ;
27+
#pragma link C++ class o2::trk::ChipSimResponse + ;
2728

2829
#pragma link C++ class o2::trk::DPLDigitizerParam < o2::detectors::DetID::TRK> + ;
2930
#pragma link C++ class o2::trk::DPLDigitizerParam < o2::detectors::DetID::FT3> + ;

Steer/DigitizerWorkflow/src/TRKDigitizerSpec.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ class TRKDPLDigitizerTask : BaseDPLDigitizer
244244
// if (oTRKParams::Instance().useDeadChannelMap) {
245245
// pc.inputs().get<o2::itsmft::NoiseMap*>("TRK_dead"); // trigger final ccdb update
246246
// }
247+
pc.inputs().get<o2::itsmft::AlpideSimResponse*>("TRK_aptsresp");
247248

248249
// init digitizer
249250
mDigitizer.init();
@@ -264,6 +265,10 @@ class TRKDPLDigitizerTask : BaseDPLDigitizer
264265
// mDigitizer.setDeadChannelsMap((o2::itsmft::NoiseMap*)obj);
265266
// return;
266267
// }
268+
if (matcher == ConcreteDataMatcher(mOrigin, "APTSRESP", 0)) {
269+
LOG(info) << mID.getName() << " loaded APTSResponseData";
270+
mDigitizer.getParams().setAlpSimResponse((const o2::itsmft::AlpideSimResponse*)obj);
271+
}
267272
}
268273

269274
private:
@@ -297,6 +302,7 @@ DataProcessorSpec getTRKDigitizerSpec(int channel, bool mctruth)
297302
// if (oTRKParams::Instance().useDeadChannelMap) {
298303
// inputs.emplace_back("TRK_dead", "TRK", "DEADMAP", 0, Lifetime::Condition, ccdbParamSpec("TRK/Calib/DeadMap"));
299304
// }
305+
inputs.emplace_back("TRK_aptsresp", "TRK", "APTSRESP", 0, Lifetime::Condition, ccdbParamSpec("IT3/Calib/APTSResponse"));
300306

301307
return DataProcessorSpec{detStr + "Digitizer",
302308
inputs, makeOutChannels(detOrig, mctruth),

0 commit comments

Comments
 (0)