Skip to content

Commit 940e2e2

Browse files
authored
Add empty skeleton for the TRK digitization (#13959)
1 parent 8c1e88b commit 940e2e2

File tree

16 files changed

+1439
-4
lines changed

16 files changed

+1439
-4
lines changed

Detectors/Upgrades/ALICE3/TRK/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
# or submit itself to any jurisdiction.
1111

1212
add_subdirectory(base)
13-
add_subdirectory(simulation)
13+
add_subdirectory(simulation)
14+
add_subdirectory(workflow)

Detectors/Upgrades/ALICE3/TRK/simulation/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,20 @@
1212
o2_add_library(TRKSimulation
1313
SOURCES src/TRKLayer.cxx
1414
src/Detector.cxx
15+
src/Digitizer.cxx
1516
src/TRKServices.cxx
17+
src/DPLDigitizerParam.cxx
1618
src/TRKPetalCase.cxx
1719
src/TRKPetalLayer.cxx
1820
src/TRKPetalDisk.cxx
1921
PUBLIC_LINK_LIBRARIES O2::TRKBase
2022
O2::FT3Simulation
21-
O2::ITSMFTSimulation)
23+
O2::ITSMFTSimulation
24+
O2::SimulationDataFormat)
2225

2326
o2_target_root_dictionary(TRKSimulation
24-
HEADERS include/TRKSimulation/Detector.h
27+
HEADERS include/TRKSimulation/Digitizer.h
28+
include/TRKSimulation/Detector.h
2529
include/TRKSimulation/TRKLayer.h
2630
include/TRKSimulation/TRKServices.h
2731
include/TRKSimulation/TRKPetalCase.h
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifndef ALICEO2_TRKDPLDIGITIZERPARAM_H_
13+
#define ALICEO2_TRKDPLDIGITIZERPARAM_H_
14+
15+
#include "DetectorsCommonDataFormats/DetID.h"
16+
#include "CommonUtils/ConfigurableParam.h"
17+
#include "CommonUtils/ConfigurableParamHelper.h"
18+
#include <string_view>
19+
20+
namespace o2
21+
{
22+
namespace trk
23+
{
24+
template <int N>
25+
struct DPLDigitizerParam : public o2::conf::ConfigurableParamHelper<DPLDigitizerParam<N>> {
26+
static_assert(N == o2::detectors::DetID::TRK || N == o2::detectors::DetID::FT3, "only DetID::TRK or DetID::FT3 are allowed");
27+
28+
static constexpr std::string_view getParamName()
29+
{
30+
return N == o2::detectors::DetID::TRK ? ParamName[0] : ParamName[1];
31+
}
32+
33+
bool continuous = true; ///< flag for continuous simulation
34+
float noisePerPixel = DEFNoisePerPixel(); ///< ALPIDE Noise per channel
35+
float strobeFlatTop = 7500.; ///< strobe shape flat top
36+
float strobeMaxRiseTime = 1100.; ///< strobe max rise time
37+
float strobeQRiseTime0 = 450.; ///< q @ which strobe rise time is 0
38+
39+
double timeOffset = 0.; ///< time offset (in seconds!) to calculate ROFrame from hit time
40+
int chargeThreshold = 150; ///< charge threshold in Nelectrons
41+
int minChargeToAccount = 15; ///< minimum charge contribution to account
42+
int nSimSteps = 7; ///< number of steps in response simulation
43+
float energyToNElectrons = 1. / 3.6e-9; // conversion of eloss to Nelectrons
44+
45+
float Vbb = 0.0; ///< back bias absolute value for MFT (in Volt)
46+
float IBVbb = 0.0; ///< back bias absolute value for ITS Inner Barrel (in Volt)
47+
float OBVbb = 0.0; ///< back bias absolute value for ITS Outter Barrel (in Volt)
48+
49+
std::string noiseFilePath{}; ///< optional noise masks file path. FIXME to be removed once switch to CCDBFetcher
50+
51+
// boilerplate stuff + make principal key
52+
O2ParamDef(DPLDigitizerParam, getParamName().data());
53+
54+
private:
55+
static constexpr float DEFNoisePerPixel()
56+
{
57+
return N == o2::detectors::DetID::TRK ? 1e-8 : 1e-8; // ITS/MFT values here!!
58+
}
59+
60+
static constexpr std::string_view ParamName[2] = {"TRKDigitizerParam", "FT3DigitizerParam"};
61+
};
62+
63+
template <int N>
64+
DPLDigitizerParam<N> DPLDigitizerParam<N>::sInstance;
65+
66+
} // namespace trk
67+
} // namespace o2
68+
69+
#endif
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file Digitizer.h
13+
/// \brief Definition of the TRK digitizer
14+
#ifndef ALICEO2_TRK_DIGITIZER_H
15+
#define ALICEO2_TRK_DIGITIZER_H
16+
17+
#include <vector>
18+
#include <deque>
19+
#include <memory>
20+
21+
#include "Rtypes.h" // for Digitizer::Class
22+
#include "TObject.h" // for TObject
23+
24+
#include "ITSMFTSimulation/ChipDigitsContainer.h"
25+
// #include "ITSMFTSimulation/AlpideSimResponse.h"
26+
#include "ITSMFTSimulation/DigiParams.h"
27+
#include "ITSMFTSimulation/Hit.h"
28+
#include "TRKBase/GeometryTGeo.h"
29+
// #include "ITS3Base/SegmentationSuperAlpide.h"
30+
#include "DataFormatsITSMFT/Digit.h"
31+
#include "DataFormatsITSMFT/ROFRecord.h"
32+
#include "CommonDataFormat/InteractionRecord.h"
33+
#include "SimulationDataFormat/MCCompLabel.h"
34+
#include "SimulationDataFormat/MCTruthContainer.h"
35+
#endif
36+
37+
namespace o2::trk
38+
{
39+
40+
class Digitizer : public TObject
41+
{
42+
using ExtraDig = std::vector<itsmft::PreDigitLabelRef>; ///< container for extra contributions to PreDigits
43+
44+
public:
45+
void setDigits(std::vector<o2::itsmft::Digit>* dig) { mDigits = dig; }
46+
void setMCLabels(o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mclb) { mMCLabels = mclb; }
47+
void setROFRecords(std::vector<o2::itsmft::ROFRecord>* rec) { mROFRecords = rec; }
48+
49+
o2::itsmft::DigiParams& getParams() { return (o2::itsmft::DigiParams&)mParams; }
50+
const o2::itsmft::DigiParams& getParams() const { return mParams; }
51+
52+
void init();
53+
54+
/// Steer conversion of hits to digits
55+
void process(const std::vector<itsmft::Hit>* hits, int evID, int srcID);
56+
void setEventTime(const o2::InteractionTimeRecord& irt);
57+
double getEndTimeOfROFMax() const
58+
{
59+
///< return the time corresponding to end of the last reserved ROFrame : mROFrameMax
60+
return mParams.getROFrameLength() * (mROFrameMax + 1) + mParams.getTimeOffset();
61+
}
62+
63+
void setContinuous(bool v) { mParams.setContinuous(v); }
64+
bool isContinuous() const { return mParams.isContinuous(); }
65+
void fillOutputContainer(uint32_t maxFrame = 0xffffffff);
66+
67+
void setDigiParams(const o2::itsmft::DigiParams& par) { mParams = par; }
68+
const o2::itsmft::DigiParams& getDigitParams() const { return mParams; }
69+
70+
// provide the common itsmft::GeometryTGeo to access matrices and segmentation
71+
void setGeometry(const o2::trk::GeometryTGeo* gm) { mGeometry = gm; }
72+
73+
uint32_t getEventROFrameMin() const { return mEventROFrameMin; }
74+
uint32_t getEventROFrameMax() const { return mEventROFrameMax; }
75+
void resetEventROFrames()
76+
{
77+
mEventROFrameMin = 0xffffffff;
78+
mEventROFrameMax = 0;
79+
}
80+
81+
void setDeadChannelsMap(const o2::itsmft::NoiseMap* mp) { mDeadChanMap = mp; }
82+
83+
private:
84+
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID);
85+
void registerDigits(o2::itsmft::ChipDigitsContainer& chip, uint32_t roFrame, float tInROF, int nROF,
86+
uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl);
87+
88+
ExtraDig* getExtraDigBuffer(uint32_t roFrame)
89+
{
90+
if (mROFrameMin > roFrame) {
91+
return nullptr; // nothing to do
92+
}
93+
int ind = roFrame - mROFrameMin;
94+
while (ind >= int(mExtraBuff.size())) {
95+
mExtraBuff.emplace_back(std::make_unique<ExtraDig>());
96+
}
97+
return mExtraBuff[ind].get();
98+
}
99+
100+
static constexpr float sec2ns = 1e9;
101+
102+
o2::itsmft::DigiParams mParams; ///< digitization parameters
103+
o2::InteractionTimeRecord mEventTime; ///< global event time and interaction record
104+
o2::InteractionRecord mIRFirstSampledTF; ///< IR of the 1st sampled IR, noise-only ROFs will be inserted till this IR only
105+
double mCollisionTimeWrtROF{};
106+
uint32_t mROFrameMin = 0; ///< lowest RO frame of current digits
107+
uint32_t mROFrameMax = 0; ///< highest RO frame of current digits
108+
uint32_t mNewROFrame = 0; ///< ROFrame corresponding to provided time
109+
110+
uint32_t mEventROFrameMin = 0xffffffff; ///< lowest RO frame for processed events (w/o automatic noise ROFs)
111+
uint32_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs)
112+
113+
o2::itsmft::AlpideSimResponse* mAlpSimResp = nullptr; // simulated response
114+
115+
const o2::trk::GeometryTGeo* mGeometry = nullptr; ///< TRK geometry
116+
117+
std::vector<o2::itsmft::ChipDigitsContainer> mChips; ///< Array of chips digits containers
118+
std::deque<std::unique_ptr<ExtraDig>> mExtraBuff; ///< burrer (per roFrame) for extra digits
119+
120+
std::vector<o2::itsmft::Digit>* mDigits = nullptr; //! output digits
121+
std::vector<o2::itsmft::ROFRecord>* mROFRecords = nullptr; //! output ROF records
122+
o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mMCLabels = nullptr; //! output labels
123+
124+
const o2::itsmft::NoiseMap* mDeadChanMap = nullptr;
125+
126+
ClassDef(Digitizer, 1);
127+
};
128+
} // namespace o2::trk
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#include "TRKSimulation/DPLDigitizerParam.h"
13+
14+
namespace o2
15+
{
16+
namespace trk
17+
{
18+
// this makes sure that the constructor of the parameters is statically called
19+
// so that these params are part of the parameter database
20+
static auto& sDigitizerParamITS = o2::trk::DPLDigitizerParam<o2::detectors::DetID::TRK>::Instance();
21+
static auto& sDigitizerParamMFT = o2::trk::DPLDigitizerParam<o2::detectors::DetID::FT3>::Instance();
22+
} // namespace trk
23+
} // namespace o2

0 commit comments

Comments
 (0)