Skip to content

Commit 0244a98

Browse files
authored
ITSMFT&ITS3&TRK: load response functions from ccdb (#14902)
* ITSMFT&ITS3: load response functions from ccdb Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * TRK: load response function from ccdb Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> --------- Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 7394855 commit 0244a98

File tree

17 files changed

+106
-174
lines changed

17 files changed

+106
-174
lines changed

Detectors/ITSMFT/common/data/AlpideResponseData/CMakeLists.txt

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,8 @@
99
# granted to it by virtue of its status as an Intergovernmental Organization
1010
# or submit itself to any jurisdiction.
1111

12-
1312
o2_add_executable(alpide-response-generator
1413
SOURCES AlpideResponse.cxx
1514
PUBLIC_LINK_LIBRARIES O2::ITSMFTSimulation
1615
ROOT::Core
1716
TARGETVARNAME targetName)
18-
19-
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/data/AlpideResponseData/AlpideResponse.cxx)
20-
21-
if(ITSRESPONSE)
22-
message(STATUS "ITSRESPONSE option provided, setting ITSRESPONSE_DIR from it: " ${ITSRESPONSE})
23-
set(ITSRESPONSE_DIR ${ITSRESPONSE} CACHE PATH "ITSResponse directory")
24-
else()
25-
message(STATUS "ITSRESPONSE option not provided, setting ITSRESPONSE_DIR from environment ITSRESPONSE_ROOT: " $ENV{ITSRESPONSE_ROOT})
26-
set(ITSRESPONSE_DIR $ENV{ITSRESPONSE_ROOT} CACHE PATH "ITSResponse directory")
27-
endif()
28-
29-
add_custom_command(TARGET O2exe-alpide-response-generator POST_BUILD
30-
COMMAND ${CMAKE_BINARY_DIR}/stage/bin/o2-alpide-response-generator -i ${ITSRESPONSE_DIR}/response/AlpideResponseData/ -o ${CMAKE_CURRENT_BINARY_DIR}/
31-
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/AlpideResponseData.root
32-
COMMENT "Generating AlpideResponseData.root"
33-
)
34-
35-
# # Add a target that depends on the custom command output
36-
add_custom_target(
37-
GenerateAlpideResponse ALL
38-
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/AlpideResponseData.root
39-
)
40-
41-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AlpideResponseData.root" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/Detectors/ITSMFT/data/AlpideResponseData/")

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class Digitizer : public TObject
6262
void setDeadChannelsMap(const o2::itsmft::NoiseMap* mp) { mDeadChanMap = mp; }
6363

6464
void init();
65+
void setAlpideResponse(const o2::itsmft::AlpideSimResponse* resp, int i) { mAlpSimResp[i] = resp; }
6566

6667
auto getChipResponse(int chipID);
6768

@@ -124,11 +125,10 @@ class Digitizer : public TObject
124125
uint32_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs)
125126

126127
int mNumberOfChips = 0;
127-
o2::itsmft::AlpideSimResponse* mAlpSimRespMFT = nullptr;
128-
o2::itsmft::AlpideSimResponse* mAlpSimRespIB = nullptr;
129-
o2::itsmft::AlpideSimResponse* mAlpSimRespOB = nullptr;
130-
o2::itsmft::AlpideSimResponse mAlpSimResp[2]; // simulated response
131-
std::string mResponseFile = "$(O2_ROOT)/share/Detectors/ITSMFT/data/AlpideResponseData/AlpideResponseData.root";
128+
const o2::itsmft::AlpideSimResponse* mAlpSimRespMFT = nullptr;
129+
const o2::itsmft::AlpideSimResponse* mAlpSimRespIB = nullptr;
130+
const o2::itsmft::AlpideSimResponse* mAlpSimRespOB = nullptr;
131+
const o2::itsmft::AlpideSimResponse* mAlpSimResp[2]; // simulated response
132132
const o2::itsmft::GeometryTGeo* mGeometry = nullptr; ///< ITS OR MFT upgrade geometry
133133

134134
std::vector<o2::itsmft::ChipDigitsContainer> mChips; ///< Array of chips digits containers

Detectors/ITSMFT/common/simulation/src/Digitizer.cxx

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -48,54 +48,36 @@ void Digitizer::init()
4848
mChips[i].setDeadChanMap(mDeadChanMap);
4949
}
5050
}
51-
// initializing for both collection tables
52-
/*for (int i = 0; i < 2; i++) {
53-
mAlpSimResp[i].initData(i);
54-
}*/
55-
56-
// importing the charge collection tables
57-
// (initialized while building O2)
58-
auto file = TFile::Open(mResponseFile.data());
59-
if (!file) {
60-
LOG(fatal) << "Cannot open response file " << mResponseFile;
61-
}
62-
/*std::string response = "response";
63-
for (int i=0; i<2; i++) {
64-
response.append(std::to_string(i));
65-
mAlpSimResp[i] = *(o2::itsmft::AlpideSimResponse*)file->Get(response.data());
66-
}*/
67-
mAlpSimResp[0] = *(o2::itsmft::AlpideSimResponse*)file->Get("response0");
68-
mAlpSimResp[1] = *(o2::itsmft::AlpideSimResponse*)file->Get("response1");
6951

7052
// importing the parameters from DPLDigitizerParam.h
7153
auto& doptMFT = DPLDigitizerParam<o2::detectors::DetID::MFT>::Instance();
7254
auto& doptITS = DPLDigitizerParam<o2::detectors::DetID::ITS>::Instance();
7355

7456
// initializing response according to detector and back-bias value
7557
if (doptMFT.Vbb == 0.0) { // for MFT
76-
mAlpSimRespMFT = mAlpSimResp;
58+
mAlpSimRespMFT = mAlpSimResp[0];
7759
LOG(info) << "Choosing Vbb=0V for MFT";
7860
} else if (doptMFT.Vbb == 3.0) {
79-
mAlpSimRespMFT = mAlpSimResp + 1;
61+
mAlpSimRespMFT = mAlpSimResp[1];
8062
LOG(info) << "Choosing Vbb=-3V for MFT";
8163
} else {
8264
LOG(fatal) << "Invalid MFT back-bias value";
8365
}
8466

8567
if (doptITS.IBVbb == 0.0) { // for ITS Inner Barrel
86-
mAlpSimRespIB = mAlpSimResp;
68+
mAlpSimRespIB = mAlpSimResp[0];
8769
LOG(info) << "Choosing Vbb=0V for ITS IB";
8870
} else if (doptITS.IBVbb == 3.0) {
89-
mAlpSimRespIB = mAlpSimResp + 1;
71+
mAlpSimRespIB = mAlpSimResp[1];
9072
LOG(info) << "Choosing Vbb=-3V for ITS IB";
9173
} else {
9274
LOG(fatal) << "Invalid ITS Inner Barrel back-bias value";
9375
}
9476
if (doptITS.OBVbb == 0.0) { // for ITS Outter Barrel
95-
mAlpSimRespOB = mAlpSimResp;
77+
mAlpSimRespOB = mAlpSimResp[0];
9678
LOG(info) << "Choosing Vbb=0V for ITS OB";
9779
} else if (doptITS.OBVbb == 3.0) {
98-
mAlpSimRespOB = mAlpSimResp + 1;
80+
mAlpSimRespOB = mAlpSimResp[1];
9981
LOG(info) << "Choosing Vbb=-3V for ITS OB";
10082
} else {
10183
LOG(fatal) << "Invalid ITS Outter Barrel back-bias value";

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> + ;

Detectors/Upgrades/ITS3/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#add_compile_options(-O0 -g -fPIC -fsanitize=address)
1313
#add_link_options(-fsanitize=address)
1414

15-
add_subdirectory(data)
1615
add_subdirectory(simulation)
1716
add_subdirectory(alignment)
1817
add_subdirectory(base)

Detectors/Upgrades/ITS3/data/CMakeLists.txt

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)