Skip to content

Commit c255db4

Browse files
committed
TOF digitiser
1 parent b1633ff commit c255db4

File tree

9 files changed

+233
-13
lines changed

9 files changed

+233
-13
lines changed

Detectors/Upgrades/ALICE3/IOTOF/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(DataFormatsIOTOF)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
o2_add_library(DataFormatsIOTOF
13+
SOURCES src/Digit.cxx
14+
# SOURCES src/MCLabel.cxx
15+
# SOURCES src/Cluster.cxx
16+
PUBLIC_LINK_LIBRARIES O2::DataFormatsITSMFT)
17+
18+
o2_target_root_dictionary(DataFormatsIOTOF
19+
HEADERS include/DataFormatsIOTOF/Digit.h
20+
# HEADERS include/DataFormatsIOTOF/MCLabel.h
21+
# HEADERS include/DataFormatsIOTOF/Cluster.h
22+
)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
///
13+
/// \file Digit.h
14+
/// \brief Definition of IOTOF digit class
15+
/// \author Nicolò Jacazio, Università del Piemonte Orientale (IT)
16+
/// \since 2026-03-17
17+
///
18+
19+
#ifndef ALICEO2_IOTOF_DIGIT_H
20+
#define ALICEO2_IOTOF_DIGIT_H
21+
22+
#include "DataFormatsITSMFT/Digit.h"
23+
24+
namespace o2::iotof
25+
{
26+
class Digit : public o2::itsmft::Digit
27+
{
28+
public:
29+
Digit() = default;
30+
~Digit() = default;
31+
Digit(UShort_t chipindex = 0, UShort_t row = 0, UShort_t col = 0, Int_t charge = 0, double time = 0.)
32+
: o2::itsmft::Digit(chipindex, row, col, charge), mTime(time) {};
33+
34+
// Setters
35+
void setTime(double time) { mTime = time; }
36+
37+
// Getters
38+
double getTime() const { return mTime; }
39+
40+
private:
41+
double mTime = 0.; ///< Measured time (ns)
42+
ClassDefNV(Digit, 1);
43+
};
44+
45+
} // namespace o2::iotof
46+
#endif // ALICEO2_IOTOF_DIGIT_H
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
#ifdef __CLING__
13+
14+
#pragma link off all globals;
15+
#pragma link off all classes;
16+
#pragma link off all functions;
17+
18+
#pragma link C++ class o2::iotof::Digit + ;
19+
// #pragma link C++ class std::vector < o2::iotof::Digit> + ;
20+
#endif
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
///
13+
/// \file Digit.cxx
14+
/// \brief Implementation of IOTOF digit class
15+
/// \author Nicolò Jacazio, Università del Piemonte Orientale (IT)
16+
/// \since 2026-03-17
17+
///
18+
19+
#include "DataFormatsIOTOF/Digit.h"
20+
21+
using namespace o2::iotof;

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
o2_add_library(IOTOFSimulation
1313
SOURCES src/Layer.cxx
1414
src/Detector.cxx
15+
src/Digitizer.cxx
1516
# src/IOTOFServices.cxx
1617
PUBLIC_LINK_LIBRARIES O2::IOTOFBase
18+
O2::DataFormatsIOTOF
1719
O2::ITSMFTSimulation)
1820

1921
o2_target_root_dictionary(IOTOFSimulation
2022
HEADERS include/IOTOFSimulation/Detector.h
21-
include/IOTOFSimulation/Layer.h)
23+
include/IOTOFSimulation/Layer.h
24+
include/IOTOFSimulation/Digitizer.h)
2225
# include/IOTOFSimulation/IOTOFServices.h)
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
///
13+
/// \file Digitizer.h
14+
/// \brief Definition of the ALICE3 TOF digitizer
15+
/// \author Nicolò Jacazio, Università del Piemonte Orientale (IT)
16+
/// \since 2026-03-17
17+
///
18+
19+
#ifndef ALICEO2_IOTOF_DIGITIZER_H
20+
#define ALICEO2_IOTOF_DIGITIZER_H
21+
22+
#include "ITSMFTSimulation/Hit.h"
23+
#include "DataFormatsITSMFT/Digit.h"
24+
#include "DataFormatsIOTOF/Digit.h"
25+
#include "DataFormatsITSMFT/ROFRecord.h"
26+
#include "CommonDataFormat/InteractionRecord.h"
27+
#include "SimulationDataFormat/MCCompLabel.h"
28+
#include "SimulationDataFormat/MCTruthContainer.h"
29+
#include "IOTOFBase/GeometryTGeo.h"
30+
31+
namespace o2::iotof
32+
{
33+
34+
class Digitizer
35+
{
36+
public:
37+
void setDigits(std::vector<o2::iotof::Digit>* dig) { mDigits = dig; }
38+
void setMCLabels(o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mclb) { mMCLabels = mclb; }
39+
void setROFRecords(std::vector<o2::itsmft::ROFRecord>* rec) { mROFRecords = rec; }
40+
41+
void init();
42+
43+
/// Steer conversion of hits to digits
44+
void process(const std::vector<o2::itsmft::Hit>* hits, int evID, int srcID);
45+
46+
// provide the common iotof::GeometryTGeo to access matrices and segmentation
47+
void setGeometry(const o2::iotof::GeometryTGeo* gm) { mGeometry = gm; }
48+
49+
private:
50+
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID);
51+
52+
const o2::iotof::GeometryTGeo* mGeometry = nullptr; ///< IOTOF geometry
53+
54+
// std::vector<o2::iotof::ChipDigitsContainer> mChips; ///< Array of chips digits containers
55+
56+
std::vector<o2::iotof::Digit>* mDigits = nullptr; //! output digits
57+
std::vector<o2::itsmft::ROFRecord>* mROFRecords = nullptr; //! output ROF records
58+
o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mMCLabels = nullptr; //! output labels
59+
};
60+
} // namespace o2::iotof
61+
62+
#endif
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
///
13+
/// \file Digitizer.cxx
14+
/// \brief Implementation of the ALICE3 TOF digitizer
15+
/// \author Nicolò Jacazio, Università del Piemonte Orientale (IT)
16+
/// \since 2026-03-17
17+
///
18+
19+
#include "IOTOFSimulation/Digitizer.h"
20+
#include "DetectorsRaw/HBFUtils.h"
21+
22+
#include <TRandom.h>
23+
#include <vector>
24+
#include <iostream>
25+
#include <numeric>
26+
#include <fairlogger/Logger.h>
27+
28+
namespace o2::iotof
29+
{
30+
31+
void Digitizer::init()
32+
{
33+
}
34+
35+
void Digitizer::process(const std::vector<o2::itsmft::Hit>* hits, int evID, int srcID)
36+
{
37+
}
38+
39+
void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID)
40+
{
41+
}
42+
43+
} // namespace o2::iotof

Detectors/Upgrades/ALICE3/TRK/macros/test/CheckClusters.C

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,18 @@ void CheckClusters(const std::string& clusfile = "o2clus_trk.root",
5656
// ── Chip response (for hit-segment propagation to charge-collection plane) ──
5757
// Fetches the same AlpideSimResponse from CCDB as the digitizer (IT3/Calib/APTSResponse)
5858
// and computes Y-intersection planes with the same formulas from Digitizer::init()
59-
auto& ccdbMgr = o2::ccdb::BasicCCDBManager::instance();
60-
ccdbMgr.setURL(ccdbUrl);
61-
if (ccdbTimestamp > 0) {
62-
ccdbMgr.setTimestamp(ccdbTimestamp);
63-
}
64-
auto* alpResp = ccdbMgr.get<o2::itsmft::AlpideSimResponse>("IT3/Calib/APTSResponse");
65-
if (!alpResp) {
66-
LOGP(fatal, "Cannot retrieve AlpideSimResponse from CCDB at {}", ccdbUrl);
67-
return;
68-
}
69-
const float depthMax = alpResp->getDepthMax();
59+
// auto& ccdbMgr = o2::ccdb::BasicCCDBManager::instance();
60+
// ccdbMgr.setURL(ccdbUrl);
61+
// if (ccdbTimestamp > 0) {
62+
// ccdbMgr.setTimestamp(ccdbTimestamp);
63+
// }
64+
// auto* alpResp = ccdbMgr.get<o2::itsmft::AlpideSimResponse>("IT3/Calib/APTSResponse");
65+
// if (!alpResp) {
66+
// LOGP(fatal, "Cannot retrieve AlpideSimResponse from CCDB at {}", ccdbUrl);
67+
// return;
68+
// }
69+
// const float depthMax = alpResp->getDepthMax();
70+
const float depthMax = 500;
7071

7172
// ── Y-plane shifts: why VD and ML/OT need different values ────────────────
7273
//
@@ -154,6 +155,7 @@ void CheckClusters(const std::string& clusfile = "o2clus_trk.root",
154155
o2::dataformats::MCTruthContainer<o2::MCCompLabel>* clusLabArr = nullptr;
155156
std::vector<MC2ROF> mc2rofVec, *mc2rofVecP = &mc2rofVec;
156157
bool hasMC = (clusTree->GetBranch("TRKClusterMCTruth") != nullptr);
158+
// hasMC = false;
157159
if (hasMC) {
158160
clusTree->SetBranchAddress("TRKClusterMCTruth", &clusLabArr);
159161
clusTree->SetBranchAddress("TRKClustersMC2ROF", &mc2rofVecP);

0 commit comments

Comments
 (0)