Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions Detectors/ITSMFT/common/data/AlpideResponseData/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,8 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.


o2_add_executable(alpide-response-generator
SOURCES AlpideResponse.cxx
PUBLIC_LINK_LIBRARIES O2::ITSMFTSimulation
ROOT::Core
TARGETVARNAME targetName)

set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/data/AlpideResponseData/AlpideResponse.cxx)

if(ITSRESPONSE)
message(STATUS "ITSRESPONSE option provided, setting ITSRESPONSE_DIR from it: " ${ITSRESPONSE})
set(ITSRESPONSE_DIR ${ITSRESPONSE} CACHE PATH "ITSResponse directory")
else()
message(STATUS "ITSRESPONSE option not provided, setting ITSRESPONSE_DIR from environment ITSRESPONSE_ROOT: " $ENV{ITSRESPONSE_ROOT})
set(ITSRESPONSE_DIR $ENV{ITSRESPONSE_ROOT} CACHE PATH "ITSResponse directory")
endif()

add_custom_command(TARGET O2exe-alpide-response-generator POST_BUILD
COMMAND ${CMAKE_BINARY_DIR}/stage/bin/o2-alpide-response-generator -i ${ITSRESPONSE_DIR}/response/AlpideResponseData/ -o ${CMAKE_CURRENT_BINARY_DIR}/
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/AlpideResponseData.root
COMMENT "Generating AlpideResponseData.root"
)

# # Add a target that depends on the custom command output
add_custom_target(
GenerateAlpideResponse ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/AlpideResponseData.root
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AlpideResponseData.root" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/Detectors/ITSMFT/data/AlpideResponseData/")
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class Digitizer : public TObject
void setDeadChannelsMap(const o2::itsmft::NoiseMap* mp) { mDeadChanMap = mp; }

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

auto getChipResponse(int chipID);

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

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

std::vector<o2::itsmft::ChipDigitsContainer> mChips; ///< Array of chips digits containers
Expand Down
30 changes: 6 additions & 24 deletions Detectors/ITSMFT/common/simulation/src/Digitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,54 +48,36 @@ void Digitizer::init()
mChips[i].setDeadChanMap(mDeadChanMap);
}
}
// initializing for both collection tables
/*for (int i = 0; i < 2; i++) {
mAlpSimResp[i].initData(i);
}*/

// importing the charge collection tables
// (initialized while building O2)
auto file = TFile::Open(mResponseFile.data());
if (!file) {
LOG(fatal) << "Cannot open response file " << mResponseFile;
}
/*std::string response = "response";
for (int i=0; i<2; i++) {
response.append(std::to_string(i));
mAlpSimResp[i] = *(o2::itsmft::AlpideSimResponse*)file->Get(response.data());
}*/
mAlpSimResp[0] = *(o2::itsmft::AlpideSimResponse*)file->Get("response0");
mAlpSimResp[1] = *(o2::itsmft::AlpideSimResponse*)file->Get("response1");

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

// initializing response according to detector and back-bias value
if (doptMFT.Vbb == 0.0) { // for MFT
mAlpSimRespMFT = mAlpSimResp;
mAlpSimRespMFT = mAlpSimResp[0];
LOG(info) << "Choosing Vbb=0V for MFT";
} else if (doptMFT.Vbb == 3.0) {
mAlpSimRespMFT = mAlpSimResp + 1;
mAlpSimRespMFT = mAlpSimResp[1];
LOG(info) << "Choosing Vbb=-3V for MFT";
} else {
LOG(fatal) << "Invalid MFT back-bias value";
}

if (doptITS.IBVbb == 0.0) { // for ITS Inner Barrel
mAlpSimRespIB = mAlpSimResp;
mAlpSimRespIB = mAlpSimResp[0];
LOG(info) << "Choosing Vbb=0V for ITS IB";
} else if (doptITS.IBVbb == 3.0) {
mAlpSimRespIB = mAlpSimResp + 1;
mAlpSimRespIB = mAlpSimResp[1];
LOG(info) << "Choosing Vbb=-3V for ITS IB";
} else {
LOG(fatal) << "Invalid ITS Inner Barrel back-bias value";
}
if (doptITS.OBVbb == 0.0) { // for ITS Outter Barrel
mAlpSimRespOB = mAlpSimResp;
mAlpSimRespOB = mAlpSimResp[0];
LOG(info) << "Choosing Vbb=0V for ITS OB";
} else if (doptITS.OBVbb == 3.0) {
mAlpSimRespOB = mAlpSimResp + 1;
mAlpSimRespOB = mAlpSimResp[1];
LOG(info) << "Choosing Vbb=-3V for ITS OB";
} else {
LOG(fatal) << "Invalid ITS Outter Barrel back-bias value";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
#define ALICEO2_TRK_DIGIPARAMS_H

#include <Rtypes.h>
#include <ITSMFTSimulation/AlpideSignalTrapezoid.h>
#include "ITSMFTSimulation/AlpideSignalTrapezoid.h"
#include "ITSMFTSimulation/AlpideSimResponse.h"
#include "TRKBase/TRKBaseParam.h"
#include "TRKBase/GeometryTGeo.h"

Expand Down Expand Up @@ -91,8 +92,8 @@ class DigiParams

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

const o2::trk::ChipSimResponse* getAlpSimResponse() const { return mAlpSimResponse; }
void setAlpSimResponse(const o2::trk::ChipSimResponse* par) { mAlpSimResponse = par; }
const o2::trk::ChipSimResponse* getAlpSimResponse() const { return mAlpSimResponse.get(); }
void setAlpSimResponse(const o2::itsmft::AlpideSimResponse*);

const SignalShape& getSignalShape() const { return mSignalShape; }
SignalShape& getSignalShape() { return (SignalShape&)mSignalShape; }
Expand Down Expand Up @@ -122,7 +123,7 @@ class DigiParams

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

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

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

#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Digitizer

void init();

o2::trk::ChipSimResponse* getChipResponse(int chipID);
const o2::trk::ChipSimResponse* getChipResponse(int chipID);

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

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

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

int mNumberOfChips = 0;

o2::trk::ChipSimResponse* mChipSimResp = nullptr; // simulated response
o2::trk::ChipSimResponse* mChipSimRespVD = nullptr; // simulated response for VD chips
o2::trk::ChipSimResponse* mChipSimRespMLOT = nullptr; // simulated response for ML/OT chips

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

bool mSimRespOrientation{false}; // wether the orientation in the response function is flipped
float mSimRespVDShift{0.f}; // adjusting the Y-shift in the APTS response function to match sensor local coord.
Expand Down
13 changes: 11 additions & 2 deletions Detectors/Upgrades/ALICE3/TRK/simulation/src/DigiParams.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
/// \file DigiParams.cxx
/// \brief Implementation of the TRK digitization steering params. Based on the ITS2 code.

#include <fairlogger/Logger.h> // for LOG
#include "TRKSimulation/DigiParams.h"
#include <cassert>
#include "Framework/Logger.h"
#include "TRKSimulation/DigiParams.h"
#include "TRKSimulation/ChipSimResponse.h"

using namespace o2::trk;

Expand Down Expand Up @@ -70,3 +71,11 @@ void DigiParams::print() const
printf("Charge time-response:\n");
mSignalShape.print();
}

void DigiParams::setAlpSimResponse(const o2::itsmft::AlpideSimResponse* resp)
{
if (!resp) {
LOGP(fatal, "cannot set response function from null");
}
mAlpSimResponse = std::make_unique<o2::trk::ChipSimResponse>(resp);
}
10 changes: 2 additions & 8 deletions Detectors/Upgrades/ALICE3/TRK/simulation/src/Digitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,9 @@ void Digitizer::init()
mChips[i].setDeadChanMap(mDeadChanMap);
}
}
// importing the charge collection tables
// (initialized while building O2)
auto file = TFile::Open(mResponseFile.data());
if (!file) {
LOG(fatal) << "Cannot open response file " << mResponseFile;
}

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

Expand Down Expand Up @@ -92,7 +86,7 @@ void Digitizer::init()
mIRFirstSampledTF = o2::raw::HBFUtils::Instance().getFirstSampledTFIR();
}

o2::trk::ChipSimResponse* Digitizer::getChipResponse(int chipID)
const o2::trk::ChipSimResponse* Digitizer::getChipResponse(int chipID)
{
if (mGeometry->getSubDetID(chipID) == 0) { /// VD
return mChipSimRespVD;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#pragma link C++ class o2::trk::Detector + ;
#pragma link C++ class o2::base::DetImpl < o2::trk::Detector> + ;
#pragma link C++ class o2::trk::Digitizer + ;
#pragma link C++ class o2::trk::ChipSimResponse + ;

#pragma link C++ class o2::trk::DPLDigitizerParam < o2::detectors::DetID::TRK> + ;
#pragma link C++ class o2::trk::DPLDigitizerParam < o2::detectors::DetID::FT3> + ;
Expand Down
1 change: 0 additions & 1 deletion Detectors/Upgrades/ITS3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#add_compile_options(-O0 -g -fPIC -fsanitize=address)
#add_link_options(-fsanitize=address)

add_subdirectory(data)
add_subdirectory(simulation)
add_subdirectory(alignment)
add_subdirectory(base)
Expand Down
34 changes: 0 additions & 34 deletions Detectors/Upgrades/ITS3/data/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,17 @@ class DigiParams final : public o2::itsmft::DigiParams
const o2::itsmft::AlpideSimResponse* getOBSimResponse() const { return mOBSimResponse; }
void setOBSimResponse(const o2::itsmft::AlpideSimResponse* response) { mOBSimResponse = response; }

o2::its3::ChipSimResponse* getIBSimResponse() const { return mIBSimResponse; }
void setIBSimResponse(o2::its3::ChipSimResponse* response);
o2::its3::ChipSimResponse* getIBSimResponse() const { return mIBSimResponse.get(); }
void setIBSimResponse(const o2::itsmft::AlpideSimResponse* resp);

bool hasResponseFunctions() const { return mIBSimResponse != nullptr && mOBSimResponse != nullptr; }

void print() const final;

private:
const o2::itsmft::AlpideSimResponse* mOBSimResponse = nullptr; //!< pointer to external response
o2::its3::ChipSimResponse* mIBSimResponse = nullptr; //!< pointer to external response
const o2::itsmft::AlpideSimResponse* mOBSimResponse = nullptr; //!< pointer to external response
const o2::itsmft::AlpideSimResponse* mIBSimResponseExt = nullptr; //!< pointer to external response
std::unique_ptr<o2::its3::ChipSimResponse> mIBSimResponse = nullptr; //!< pointer to external response

ClassDef(DigiParams, 1);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Digitizer : public TObject
using ExtraDig = std::vector<itsmft::PreDigitLabelRef>; ///< container for extra contributions to PreDigits

public:
~Digitizer();
~Digitizer() = default;

void setDigits(std::vector<o2::itsmft::Digit>* dig) { mDigits = dig; }
void setMCLabels(o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mclb) { mMCLabels = mclb; }
Expand Down Expand Up @@ -111,18 +111,18 @@ class Digitizer : public TObject

static constexpr std::array<o2::its3::SegmentationMosaix, 3> mIBSegmentations{0, 1, 2};

o2::its3::ChipSimResponse* mSimRespIB = nullptr; // simulated response for IB
o2::itsmft::AlpideSimResponse* mSimRespOB = nullptr; // simulated response for OB
bool mSimRespIBOrientation{false}; // wether the orientation in the IB response function is flipped
float mSimRespIBShift{0.f}; // adjusting the Y-shift in the IB response function to match sensor local coord.
float mSimRespIBScaleX{1.f}; // scale x-local coordinate to response function x-coordinate
float mSimRespIBScaleZ{1.f}; // scale z-local coordinate to response function z-coordinate
float mSimRespOBShift{0.f}; // adjusting the Y-shift in the OB response function to match sensor local coord.
const o2::its3::ChipSimResponse* mSimRespIB = nullptr; // simulated response for IB
const o2::itsmft::AlpideSimResponse* mSimRespOB = nullptr; // simulated response for OB
bool mSimRespIBOrientation{false}; // wether the orientation in the IB response function is flipped
float mSimRespIBShift{0.f}; // adjusting the Y-shift in the IB response function to match sensor local coord.
float mSimRespIBScaleX{1.f}; // scale x-local coordinate to response function x-coordinate
float mSimRespIBScaleZ{1.f}; // scale z-local coordinate to response function z-coordinate
float mSimRespOBShift{0.f}; // adjusting the Y-shift in the OB response function to match sensor local coord.

const o2::its::GeometryTGeo* mGeometry = nullptr; ///< ITS3 geometry

std::vector<o2::its3::ChipDigitsContainer> mChips; ///< Array of chips digits containers
std::deque<std::unique_ptr<ExtraDig>> mExtraBuff; ///< burrer (per roFrame) for extra digits
std::vector<o2::its3::ChipDigitsContainer> mChips; ///< Array of chips digits containers
std::deque<std::unique_ptr<ExtraDig>> mExtraBuff; ///< burrer (per roFrame) for extra digits

std::vector<o2::itsmft::Digit>* mDigits = nullptr; //! output digits
std::vector<o2::itsmft::ROFRecord>* mROFRecords = nullptr; //! output ROF records
Expand Down
10 changes: 6 additions & 4 deletions Detectors/Upgrades/ITS3/simulation/src/DigiParams.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ void DigiParams::print() const
getSignalShape().print();
}

void DigiParams::setIBSimResponse(o2::its3::ChipSimResponse* response)
void DigiParams::setIBSimResponse(const o2::itsmft::AlpideSimResponse* resp)
{
mIBSimResponse = response;
if (mIBSimResponse) {
mIBSimResponse->computeCentreFromData();
if (!resp) {
LOGP(fatal, "cannot set response from nullptr");
}
mIBSimResponseExt = resp;
mIBSimResponse = std::make_unique<o2::its3::ChipSimResponse>(mIBSimResponseExt);
mIBSimResponse->computeCentreFromData();
}

} // namespace o2::its3
Loading