Skip to content

Commit a95660c

Browse files
committed
WIP: digitizer seems working
1 parent 8ef0690 commit a95660c

9 files changed

Lines changed: 60 additions & 43 deletions

File tree

Detectors/Upgrades/IT3/base/include/ITS3Base/SegmentationSuperAlpide.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class SegmentationSuperAlpide
3737
LOGP(info, "rows: {} cols: {} npixels: {}", NRows, NCols, NPixels);
3838
LOGP(info, "SegmentationSuperAlpide: layer {} ActiveMatrixSizeRows: {} ActiveMatrixSizeCols: {}", layer, ActiveMatrixSizeCols, ActiveMatrixSizeRows);
3939
}
40-
static constexpr std::array<float, 10> Radii = {1.8f, 1.8f, 2.4f, 2.4f, 3.0f, 3.0f, 7.0f, 7.0f, 10.f, 10.f};
40+
static constexpr std::array<float, 10> Radii = {1.8f, 2.4f, 3.0f, 7.0f, 10.f};
4141
static constexpr float Length = 27.15f;
4242
static constexpr float PitchCol = 20.e-4;
4343
static constexpr float PitchRow = 20.e-4;

Detectors/Upgrades/IT3/simulation/include/ITS3Simulation/Digitizer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class Digitizer : public TObject
107107
}
108108

109109
std::vector<SegmentationSuperAlpide> mSuperSegmentations;
110+
std::vector<int> mLayerID;
110111
static constexpr float sec2ns = 1e9;
111112

112113
o2::itsmft::DigiParams mParams; ///< digitization parameters

Detectors/Upgrades/IT3/simulation/src/Digitizer.cxx

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "MathUtils/Cartesian.h"
1919
#include "SimulationDataFormat/MCTruthContainer.h"
2020
#include "DetectorsRaw/HBFUtils.h"
21+
#include "CommonConstants/MathConstants.h"
2122

2223
#include <TRandom.h>
2324
#include <climits>
@@ -37,10 +38,13 @@ using namespace o2::its3;
3738

3839
void Digitizer::init()
3940
{
41+
mLayerID.clear();
42+
mSuperSegmentations.clear();
4043
for (int iLayer{0}; iLayer < mGeometry->getNumberOfLayers() - 4; ++iLayer) {
4144
for (int iChip{0}; iChip < mGeometry->getNumberOfChipsPerLayer(iLayer); ++iChip) {
4245
LOGP(info, "layer: {} chip: {}", iLayer, iChip);
4346
mSuperSegmentations.push_back(SegmentationSuperAlpide(iLayer));
47+
mLayerID.push_back(iLayer);
4448
}
4549
}
4650

@@ -232,17 +236,22 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
232236
float gap = 0.1; // FIXME: get this properly!
233237
auto startPos = hit.GetPosStart();
234238
// LOGP(info, "StartPos: {} {} {}", startPos.X(), startPos.Y(), startPos.Z());
235-
float reShiftedStartY = (startPos.Y() > 0) ? startPos.Y() - gap / 2 : startPos.Y() + gap / 2; // This is due to the gap between the ITS3 emispheres
236-
float startPhi{std::atan2(reShiftedStartY, startPos.X())};
237-
LOGP(info, "X: {}, Y: {}, startPhi: {}", startPos.X(), reShiftedStartY, startPhi);
239+
bool isTop = startPos.Y() > 0;
240+
float reShiftedStartY = isTop ? startPos.Y() - gap / 2 : startPos.Y() + gap / 2; // This is due to the gap between the ITS3 emispheres
241+
float startPhi{std::atan2(-reShiftedStartY, -startPos.X()) + (isTop ? constants::math::PI / 2 : -constants::math::PI / 2)};
242+
if (innerBarrel) {
243+
// LOGP(info, "X: {}, Y: {}, startPhi: {}", startPos.X(), reShiftedStartY, startPhi);
244+
}
238245
auto endPos = hit.GetPos();
239-
float reShiftedEndY = (endPos.Y() > 0) ? endPos.Y() - gap / 2 : endPos.Y() + gap / 2; // This is due to the gap between the ITS3 emispheres
240-
float endPhi{std::atan2(reShiftedEndY, endPos.X())};
241-
LOGP(info, "X: {}, Y: {}, endPhi: {}", endPos.X(), reShiftedEndY, endPhi);
246+
float reShiftedEndY = isTop ? endPos.Y() - gap / 2 : endPos.Y() + gap / 2; // This is due to the gap between the ITS3 emispheres
247+
float endPhi{std::atan2(-reShiftedEndY, -endPos.X()) + (isTop ? constants::math::PI / 2 : -constants::math::PI / 2)};
248+
if (innerBarrel) {
249+
// LOGP(info, "X: {}, Y: {}, endPhi: {}", endPos.X(), reShiftedEndY, endPhi);
250+
}
242251
math_utils::Vector3D<float> xyzLocS, xyzLocE;
243252
if (innerBarrel) {
244-
xyzLocS = {SegmentationSuperAlpide::Radii[detID] * (startPhi), 0.f, startPos.Z()};
245-
xyzLocE = {SegmentationSuperAlpide::Radii[detID] * (endPhi), 0.f, endPos.Z()};
253+
xyzLocS = {SegmentationSuperAlpide::Radii[mLayerID[detID]] * (startPhi), 0.f, startPos.Z()};
254+
xyzLocE = {SegmentationSuperAlpide::Radii[mLayerID[detID]] * (endPhi), 0.f, endPos.Z()};
246255
} else {
247256
xyzLocS = matrix ^ (hit.GetPosStart());
248257
xyzLocE = matrix ^ (hit.GetPos());
@@ -261,18 +270,20 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
261270
// get entrance pixel row and col
262271
while (!mSuperSegmentations[detID].localToDetector(xyzLocS.X(), xyzLocS.Z(), rowS, colS)) { // guard-ring ?
263272
if (++nSkip >= nSteps) {
273+
LOGP(info, "Start: detId {}", detID);
264274
return; // did not enter to sensitive matrix
265275
}
266276
xyzLocS += step;
267277
}
268278
// get exit pixel row and col
269279
while (!mSuperSegmentations[detID].localToDetector(xyzLocE.X(), xyzLocE.Z(), rowE, colE)) { // guard-ring ?
270280
if (++nSkip >= nSteps) {
281+
LOGP(info, "End: detId {}", detID);
271282
return; // did not enter to sensitive matrix
272283
}
273284
xyzLocE -= step;
274285
}
275-
LOGP(info, "x: {}, z: {}, col: {}, row: {}, detID: {}", xyzLocS.X(), xyzLocS.Z(), colS, rowS, detID);
286+
// LOGP(info, "x: {}, z: {}, col: {}, row: {}, detID: {}", xyzLocS.X(), xyzLocS.Z(), colS, rowS, detID);
276287
} else {
277288
// get entrance pixel row and col
278289
while (!Segmentation::localToDetector(xyzLocS.X(), xyzLocS.Z(), rowS, colS)) { // guard-ring ?

Detectors/Upgrades/IT3/workflow/CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
o2_add_library(ITS3Workflow
1313
SOURCES src/DigitReaderSpec.cxx
1414
src/DigitWriterSpec.cxx
15-
# src/RecoWorkflow.cxx
15+
src/RecoWorkflow.cxx
1616
# src/ClusterWriterWorkflow.cxx
17-
# src/ClustererSpec.cxx
17+
src/ClustererSpec.cxx
1818
# src/ClusterWriterSpec.cxx
1919
# src/TrackerSpec.cxx
2020
# src/CookedTrackerSpec.cxx
@@ -23,14 +23,14 @@ o2_add_library(ITS3Workflow
2323
# src/VertexReaderSpec.cxx
2424
PUBLIC_LINK_LIBRARIES O2::Framework
2525
O2::SimConfig
26-
O2::DataFormatsITS
27-
O2::DataFormatsITS3
26+
O2::DataFormatsITSMFT
27+
# O2::DataFormatsITS3
2828
O2::SimulationDataFormat
2929
O2::ITS3Simulation
3030
# O2::ITStracking
31-
# O2::ITSReconstruction
31+
O2::ITSMFTReconstruction
3232
# O2::ITS3Reconstruction
33-
# O2::ITSMFTWorkflow
33+
O2::ITSWorkflow
3434
# O2::GPUTracking
3535
)
3636

@@ -44,10 +44,10 @@ o2_add_library(ITS3Workflow
4444
# COMPONENT_NAME its3
4545
# PUBLIC_LINK_LIBRARIES O2::ITS3Workflow)
4646

47-
# o2_add_executable(reco-workflow
48-
# SOURCES src/its3-reco-workflow.cxx
49-
# COMPONENT_NAME its3
50-
# PUBLIC_LINK_LIBRARIES O2::ITS3Workflow)
47+
o2_add_executable(reco-workflow
48+
SOURCES src/its3-reco-workflow.cxx
49+
COMPONENT_NAME its3
50+
PUBLIC_LINK_LIBRARIES O2::ITS3Workflow)
5151

5252
# o2_add_executable(cluster-writer-workflow
5353
# SOURCES src/its-cluster-writer-workflow.cxx

Detectors/Upgrades/IT3/workflow/include/ITS3Workflow/ClustererSpec.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
/// @file ClustererSpec.h
1313

14-
#ifndef O2_ITS_CLUSTERERDPL
15-
#define O2_ITS_CLUSTERERDPL
14+
#ifndef O2_ITS3_CLUSTERERDPL
15+
#define O2_ITS3_CLUSTERERDPL
1616

1717
#include <fstream>
1818

19-
#include "ITS3Reconstruction/Clusterer.h"
19+
#include "ITSMFTReconstruction/Clusterer.h"
2020
#include "Framework/DataProcessorSpec.h"
2121
#include "Framework/Task.h"
2222

@@ -42,7 +42,7 @@ class ClustererDPL : public Task
4242
bool mPatterns = true;
4343
int mNThreads = 1;
4444
std::unique_ptr<std::ifstream> mFile = nullptr;
45-
std::unique_ptr<o2::its3::Clusterer> mClusterer = nullptr;
45+
std::unique_ptr<o2::itsmft::Clusterer> mClusterer = nullptr;
4646
};
4747

4848
/// create a processor spec

Detectors/Upgrades/IT3/workflow/include/ITS3Workflow/RecoWorkflow.h

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

12-
#ifndef O2_ITS_RECOWORKFLOW_H
13-
#define O2_ITS_RECOWORKFLOW_H
12+
#ifndef O2_ITS3_RECOWORKFLOW_H
13+
#define O2_ITS3_RECOWORKFLOW_H
1414

1515
/// @file RecoWorkflow.h
1616

1717
#include "Framework/WorkflowSpec.h"
1818

19-
#include "GPUO2Interface.h"
20-
#include "GPUReconstruction.h"
21-
#include "GPUChainITS.h"
19+
// #include "GPUO2Interface.h"
20+
// #include "GPUReconstruction.h"
21+
// #include "GPUChainITS.h"
2222

2323
namespace o2
2424
{
@@ -28,8 +28,12 @@ namespace its3
2828
namespace reco_workflow
2929
{
3030

31-
framework::WorkflowSpec getWorkflow(bool useMC, const std::string& trmode, o2::gpu::GPUDataTypes::DeviceType dType = o2::gpu::GPUDataTypes::DeviceType::CPU,
32-
bool upstreamDigits = false, bool upstreamClusters = false, bool disableRootOutput = false, bool eencode = false);
31+
framework::WorkflowSpec getWorkflow(bool useMC,
32+
const std::string& trmode,
33+
bool upstreamDigits = false,
34+
bool upstreamClusters = false,
35+
bool disableRootOutput = false,
36+
bool eencode = false);
3337
}
3438

3539
} // namespace its3

Detectors/Upgrades/IT3/workflow/src/ClustererSpec.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "ITSMFTReconstruction/ChipMappingITS.h"
2121
#include "ITS3Base/SegmentationSuperAlpide.h"
2222
#include "ITSMFTReconstruction/ClustererParam.h"
23-
#include "DataFormatsITS3/CompCluster.h"
23+
#include "DataFormatsITSMFT/CompCluster.h"
2424
#include "SimulationDataFormat/MCCompLabel.h"
2525
#include "SimulationDataFormat/ConstMCTruthContainer.h"
2626
#include "DataFormatsITSMFT/ROFRecord.h"
@@ -39,8 +39,8 @@ namespace its3
3939

4040
void ClustererDPL::init(InitContext& ic)
4141
{
42-
mClusterer = std::make_unique<o2::its3::Clusterer>();
43-
mClusterer->setNChips(o2::itsmft::ChipMappingITS::getNChips(o2::itsmft::ChipMappingITS::MB) + o2::itsmft::ChipMappingITS::getNChips(o2::itsmft::ChipMappingITS::OB) + SegmentationSuperAlpide::NLayers);
42+
mClusterer = std::make_unique<o2::itsmft::Clusterer>();
43+
mClusterer->setNChips(o2::itsmft::ChipMappingITS::getNChips(o2::itsmft::ChipMappingITS::MB) + o2::itsmft::ChipMappingITS::getNChips(o2::itsmft::ChipMappingITS::OB) + 6); /// Fix MEEEE
4444

4545
auto filenameGRP = ic.options().get<std::string>("grp-file");
4646
const auto grp = o2::parameters::GRPObject::loadFrom(filenameGRP.c_str());
@@ -102,7 +102,7 @@ void ClustererDPL::run(ProcessingContext& pc)
102102
}
103103
reader.init();
104104
auto orig = o2::header::gDataOriginIT3;
105-
std::vector<o2::its3::CompClusterExt> clusCompVec;
105+
std::vector<o2::itsmft::CompClusterExt> clusCompVec;
106106
std::vector<o2::itsmft::ROFRecord> clusROFVec;
107107
std::vector<unsigned char> clusPattVec;
108108

Detectors/Upgrades/IT3/workflow/src/RecoWorkflow.cxx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include "ITS3Workflow/RecoWorkflow.h"
1515
#include "ITS3Workflow/ClustererSpec.h"
16-
#include "ITS3Workflow/ClusterWriterSpec.h"
16+
// #include "ITS3Workflow/ClusterWriterSpec.h"
1717
// #include "ITSWorkflow/TrackerSpec.h"
1818
// #include "ITSWorkflow/TrackWriterSpec.h"
1919
// #include "ITSMFTWorkflow/EntropyEncoderSpec.h"
@@ -27,7 +27,7 @@ namespace its3
2727
namespace reco_workflow
2828
{
2929

30-
framework::WorkflowSpec getWorkflow(bool useMC, const std::string& trmode, o2::gpu::GPUDataTypes::DeviceType dtype,
30+
framework::WorkflowSpec getWorkflow(bool useMC, const std::string& trmode,
3131
bool upstreamDigits, bool upstreamClusters, bool disableRootOutput,
3232
bool)
3333
{
@@ -40,9 +40,10 @@ framework::WorkflowSpec getWorkflow(bool useMC, const std::string& trmode, o2::g
4040
if (!upstreamClusters) {
4141
specs.emplace_back(o2::its3::getClustererSpec(useMC));
4242
}
43-
if (!disableRootOutput) {
44-
specs.emplace_back(o2::its3::getClusterWriterSpec(useMC));
45-
}
43+
44+
// if (!disableRootOutput) {
45+
// // specs.emplace_back(o2::its3::getClusterWriterSpec(useMC));
46+
// }
4647
// specs.emplace_back(o2::its::getTrackerSpec(useMC, trmode, dtype));
4748
// if (!disableRootOutput) {
4849
// specs.emplace_back(o2::its::getTrackWriterSpec(useMC));

Detectors/Upgrades/IT3/workflow/src/its3-reco-workflow.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
4747
{"tracking-mode", o2::framework::VariantType::String, "sync", {"sync,async,cosmics"}},
4848
{"entropy-encoding", o2::framework::VariantType::Bool, false, {"produce entropy encoded data"}},
4949
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}},
50-
{"gpuDevice", o2::framework::VariantType::Int, 1, {"use gpu device: CPU=1,CUDA=2,HIP=3 (default: CPU)"}}};
50+
/*{"gpuDevice", o2::framework::VariantType::Int, 1, {"use gpu device: CPU=1,CUDA=2,HIP=3 (default: CPU)"}}*/};
5151
o2::raw::HBFUtilsInitializer::addConfigOption(options);
5252
std::swap(workflowOptions, options);
5353
}
@@ -62,15 +62,15 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
6262
// Update the (declared) parameters if changed from the command line
6363
auto useMC = !configcontext.options().get<bool>("disable-mc");
6464
auto trmode = configcontext.options().get<std::string>("tracking-mode");
65-
auto gpuDevice = static_cast<o2::gpu::GPUDataTypes::DeviceType>(configcontext.options().get<int>("gpuDevice"));
65+
// auto gpuDevice = static_cast<o2::gpu::GPUDataTypes::DeviceType>(configcontext.options().get<int>("gpuDevice"));
6666
auto extDigits = configcontext.options().get<bool>("digits-from-upstream");
6767
auto extClusters = configcontext.options().get<bool>("clusters-from-upstream");
6868
auto disableRootOutput = configcontext.options().get<bool>("disable-root-output");
6969
auto eencode = configcontext.options().get<bool>("entropy-encoding");
7070

7171
o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
7272

73-
auto wf = o2::its3::reco_workflow::getWorkflow(useMC, trmode, gpuDevice, extDigits, extClusters, disableRootOutput, eencode);
73+
auto wf = o2::its3::reco_workflow::getWorkflow(useMC, trmode, extDigits, extClusters, disableRootOutput, eencode);
7474

7575
// configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
7676
o2::raw::HBFUtilsInitializer hbfIni(configcontext, wf);

0 commit comments

Comments
 (0)