Skip to content
Closed
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
3 changes: 2 additions & 1 deletion Detectors/Upgrades/ALICE3/TRK/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
# or submit itself to any jurisdiction.

add_subdirectory(base)
add_subdirectory(simulation)
add_subdirectory(simulation)
add_subdirectory(workflow)
8 changes: 6 additions & 2 deletions Detectors/Upgrades/ALICE3/TRK/simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@
o2_add_library(TRKSimulation
SOURCES src/TRKLayer.cxx
src/Detector.cxx
src/Digitizer.cxx
src/TRKServices.cxx
src/DPLDigitizerParam.cxx
PUBLIC_LINK_LIBRARIES O2::TRKBase
O2::FT3Simulation
O2::ITSMFTSimulation)
O2::ITSMFTSimulation
O2::SimulationDataFormat)

o2_target_root_dictionary(TRKSimulation
HEADERS include/TRKSimulation/Detector.h
HEADERS include/TRKSimulation/Digitizer.h
include/TRKSimulation/Detector.h
include/TRKSimulation/TRKLayer.h
include/TRKSimulation/TRKServices.h)
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#ifndef ALICEO2_TRKDPLDIGITIZERPARAM_H_
#define ALICEO2_TRKDPLDIGITIZERPARAM_H_

#include "DetectorsCommonDataFormats/DetID.h"
#include "CommonUtils/ConfigurableParam.h"
#include "CommonUtils/ConfigurableParamHelper.h"
#include <string_view>

namespace o2
{
namespace trk
{
template <int N>
struct DPLDigitizerParam : public o2::conf::ConfigurableParamHelper<DPLDigitizerParam<N>> {
static_assert(N == o2::detectors::DetID::TRK || N == o2::detectors::DetID::FT3, "only DetID::TRK or DetID::FT3 are allowed");

static constexpr std::string_view getParamName()
{
return N == o2::detectors::DetID::TRK ? ParamName[0] : ParamName[1];
}

bool continuous = true; ///< flag for continuous simulation
float noisePerPixel = DEFNoisePerPixel(); ///< ALPIDE Noise per channel
float strobeFlatTop = 7500.; ///< strobe shape flat top
float strobeMaxRiseTime = 1100.; ///< strobe max rise time
float strobeQRiseTime0 = 450.; ///< q @ which strobe rise time is 0

double timeOffset = 0.; ///< time offset (in seconds!) to calculate ROFrame from hit time
int chargeThreshold = 150; ///< charge threshold in Nelectrons
int minChargeToAccount = 15; ///< minimum charge contribution to account
int nSimSteps = 7; ///< number of steps in response simulation
float energyToNElectrons = 1. / 3.6e-9; // conversion of eloss to Nelectrons

float Vbb = 0.0; ///< back bias absolute value for MFT (in Volt)
float IBVbb = 0.0; ///< back bias absolute value for ITS Inner Barrel (in Volt)
float OBVbb = 0.0; ///< back bias absolute value for ITS Outter Barrel (in Volt)

std::string noiseFilePath{}; ///< optional noise masks file path. FIXME to be removed once switch to CCDBFetcher

// boilerplate stuff + make principal key
O2ParamDef(DPLDigitizerParam, getParamName().data());

private:
static constexpr float DEFNoisePerPixel()
{
return N == o2::detectors::DetID::TRK ? 1e-8 : 1e-8; // ITS/MFT values here!!
}

static constexpr std::string_view ParamName[2] = {"TRKDigitizerParam", "FT3DigitizerParam"};
};

template <int N>
DPLDigitizerParam<N> DPLDigitizerParam<N>::sInstance;

} // namespace trk
} // namespace o2

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// \file Digitizer.h
/// \brief Definition of the TRK digitizer
#ifndef ALICEO2_TRK_DIGITIZER_H
#define ALICEO2_TRK_DIGITIZER_H

#include <vector>
#include <deque>
#include <memory>

#include "Rtypes.h" // for Digitizer::Class
#include "TObject.h" // for TObject

#include "ITSMFTSimulation/ChipDigitsContainer.h"
// #include "ITSMFTSimulation/AlpideSimResponse.h"
#include "ITSMFTSimulation/DigiParams.h"
#include "ITSMFTSimulation/Hit.h"
#include "TRKBase/GeometryTGeo.h"
// #include "ITS3Base/SegmentationSuperAlpide.h"
#include "DataFormatsITSMFT/Digit.h"
#include "DataFormatsITSMFT/ROFRecord.h"
#include "CommonDataFormat/InteractionRecord.h"
#include "SimulationDataFormat/MCCompLabel.h"
#include "SimulationDataFormat/MCTruthContainer.h"
#endif

namespace o2::trk
{

class Digitizer : public TObject
{
using ExtraDig = std::vector<itsmft::PreDigitLabelRef>; ///< container for extra contributions to PreDigits

public:
void setDigits(std::vector<o2::itsmft::Digit>* dig) { mDigits = dig; }
void setMCLabels(o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mclb) { mMCLabels = mclb; }
void setROFRecords(std::vector<o2::itsmft::ROFRecord>* rec) { mROFRecords = rec; }

o2::itsmft::DigiParams& getParams() { return (o2::itsmft::DigiParams&)mParams; }
const o2::itsmft::DigiParams& getParams() const { return mParams; }

void init();

/// Steer conversion of hits to digits
void process(const std::vector<itsmft::Hit>* hits, int evID, int srcID);
void setEventTime(const o2::InteractionTimeRecord& irt);
double getEndTimeOfROFMax() const
{
///< return the time corresponding to end of the last reserved ROFrame : mROFrameMax
return mParams.getROFrameLength() * (mROFrameMax + 1) + mParams.getTimeOffset();
}

void setContinuous(bool v) { mParams.setContinuous(v); }
bool isContinuous() const { return mParams.isContinuous(); }
void fillOutputContainer(uint32_t maxFrame = 0xffffffff);

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

// provide the common itsmft::GeometryTGeo to access matrices and segmentation
void setGeometry(const o2::trk::GeometryTGeo* gm) { mGeometry = gm; }

uint32_t getEventROFrameMin() const { return mEventROFrameMin; }
uint32_t getEventROFrameMax() const { return mEventROFrameMax; }
void resetEventROFrames()
{
mEventROFrameMin = 0xffffffff;
mEventROFrameMax = 0;
}

void setDeadChannelsMap(const o2::itsmft::NoiseMap* mp) { mDeadChanMap = mp; }

private:
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID);
void registerDigits(o2::itsmft::ChipDigitsContainer& chip, uint32_t roFrame, float tInROF, int nROF,
uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl);

ExtraDig* getExtraDigBuffer(uint32_t roFrame)
{
if (mROFrameMin > roFrame) {
return nullptr; // nothing to do
}
int ind = roFrame - mROFrameMin;
while (ind >= int(mExtraBuff.size())) {
mExtraBuff.emplace_back(std::make_unique<ExtraDig>());
}
return mExtraBuff[ind].get();
}

static constexpr float sec2ns = 1e9;

o2::itsmft::DigiParams mParams; ///< digitization parameters
o2::InteractionTimeRecord mEventTime; ///< global event time and interaction record
o2::InteractionRecord mIRFirstSampledTF; ///< IR of the 1st sampled IR, noise-only ROFs will be inserted till this IR only
double mCollisionTimeWrtROF{};
uint32_t mROFrameMin = 0; ///< lowest RO frame of current digits
uint32_t mROFrameMax = 0; ///< highest RO frame of current digits
uint32_t mNewROFrame = 0; ///< ROFrame corresponding to provided time

uint32_t mEventROFrameMin = 0xffffffff; ///< lowest RO frame for processed events (w/o automatic noise ROFs)
uint32_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs)

o2::itsmft::AlpideSimResponse* mAlpSimResp = nullptr; // simulated response

const o2::trk::GeometryTGeo* mGeometry = nullptr; ///< TRK geometry

std::vector<o2::itsmft::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
o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mMCLabels = nullptr; //! output labels

const o2::itsmft::NoiseMap* mDeadChanMap = nullptr;

ClassDef(Digitizer, 1);
};
} // namespace o2::trk
23 changes: 23 additions & 0 deletions Detectors/Upgrades/ALICE3/TRK/simulation/src/DPLDigitizerParam.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include "TRKSimulation/DPLDigitizerParam.h"

namespace o2
{
namespace trk
{
// this makes sure that the constructor of the parameters is statically called
// so that these params are part of the parameter database
static auto& sDigitizerParamITS = o2::trk::DPLDigitizerParam<o2::detectors::DetID::TRK>::Instance();
static auto& sDigitizerParamMFT = o2::trk::DPLDigitizerParam<o2::detectors::DetID::FT3>::Instance();
} // namespace trk
} // namespace o2
Loading