Skip to content
Draft
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/IOTOF/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(DataFormatsIOTOF)
22 changes: 22 additions & 0 deletions Detectors/Upgrades/ALICE3/IOTOF/DataFormatsIOTOF/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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.

o2_add_library(DataFormatsIOTOF
SOURCES src/Digit.cxx
# SOURCES src/MCLabel.cxx
# SOURCES src/Cluster.cxx
PUBLIC_LINK_LIBRARIES O2::DataFormatsITSMFT)

o2_target_root_dictionary(DataFormatsIOTOF
HEADERS include/DataFormatsIOTOF/Digit.h
# HEADERS include/DataFormatsIOTOF/MCLabel.h
# HEADERS include/DataFormatsIOTOF/Cluster.h
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// 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 Digit.h
/// \brief Definition of IOTOF digit class
/// \author Nicolò Jacazio, Università del Piemonte Orientale (IT)
/// \since 2026-03-17
///

#ifndef ALICEO2_IOTOF_DIGIT_H
#define ALICEO2_IOTOF_DIGIT_H

#include "DataFormatsITSMFT/Digit.h"

namespace o2::iotof
{
class Digit : public o2::itsmft::Digit
{
public:
Digit() = default;
~Digit() = default;
Digit(UShort_t chipindex = 0, UShort_t row = 0, UShort_t col = 0, Int_t charge = 0, double time = 0.)
: o2::itsmft::Digit(chipindex, row, col, charge), mTime(time) {};

// Setters
void setTime(double time) { mTime = time; }

// Getters
double getTime() const { return mTime; }

private:
double mTime = 0.; ///< Measured time (ns)
ClassDefNV(Digit, 1);
};

} // namespace o2::iotof
#endif // ALICEO2_IOTOF_DIGIT_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 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.

#ifdef __CLING__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class o2::iotof::Digit + ;
// #pragma link C++ class std::vector < o2::iotof::Digit> + ;
#endif
21 changes: 21 additions & 0 deletions Detectors/Upgrades/ALICE3/IOTOF/DataFormatsIOTOF/src/Digit.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 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 Digit.cxx
/// \brief Implementation of IOTOF digit class
/// \author Nicolò Jacazio, Università del Piemonte Orientale (IT)
/// \since 2026-03-17
///

#include "DataFormatsIOTOF/Digit.h"

using namespace o2::iotof;
5 changes: 4 additions & 1 deletion Detectors/Upgrades/ALICE3/IOTOF/simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
o2_add_library(IOTOFSimulation
SOURCES src/Layer.cxx
src/Detector.cxx
src/Digitizer.cxx
# src/IOTOFServices.cxx
PUBLIC_LINK_LIBRARIES O2::IOTOFBase
O2::DataFormatsIOTOF
O2::ITSMFTSimulation)

o2_target_root_dictionary(IOTOFSimulation
HEADERS include/IOTOFSimulation/Detector.h
include/IOTOFSimulation/Layer.h)
include/IOTOFSimulation/Layer.h
include/IOTOFSimulation/Digitizer.h)
# include/IOTOFSimulation/IOTOFServices.h)
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// 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 ALICE3 TOF digitizer
/// \author Nicolò Jacazio, Università del Piemonte Orientale (IT)
/// \since 2026-03-17
///

#ifndef ALICEO2_IOTOF_DIGITIZER_H
#define ALICEO2_IOTOF_DIGITIZER_H

#include "ITSMFTSimulation/Hit.h"
#include "DataFormatsITSMFT/Digit.h"
#include "DataFormatsIOTOF/Digit.h"
#include "DataFormatsITSMFT/ROFRecord.h"
#include "CommonDataFormat/InteractionRecord.h"
#include "SimulationDataFormat/MCCompLabel.h"
#include "SimulationDataFormat/MCTruthContainer.h"
#include "IOTOFBase/GeometryTGeo.h"

namespace o2::iotof
{

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

void init();

/// Steer conversion of hits to digits
void process(const std::vector<o2::itsmft::Hit>* hits, int evID, int srcID);

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

private:
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID);

const o2::iotof::GeometryTGeo* mGeometry = nullptr; ///< IOTOF geometry

// std::vector<o2::iotof::ChipDigitsContainer> mChips; ///< Array of chips digits containers

std::vector<o2::iotof::Digit>* mDigits = nullptr; //! output digits
std::vector<o2::itsmft::ROFRecord>* mROFRecords = nullptr; //! output ROF records
o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mMCLabels = nullptr; //! output labels
};
} // namespace o2::iotof

#endif
50 changes: 27 additions & 23 deletions Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ void Detector::configLayers(bool itof, bool otof, bool ftof, bool btof, std::str
const float x2x0)
{

const float radiusInnerTof = 19.f;
const float radiusOuterTof = 85.f;
const float lengthInnerTof = 124.f;
float lengthOuterTof = 680.f;
const std::pair<float, float> dInnerTof = {21.f, 124.f}; // Radius and length
std::pair<float, float> dOuterTof = {95.f, 680.f}; // Radius and length
std::pair<float, float> radiusRangeDiskTof = {15.f, 100.f};
float zForwardTof = 370.f;
LOG(info) << "Configuring IOTOF layers with '" << pattern << "' pattern";
Expand All @@ -74,49 +72,55 @@ void Detector::configLayers(bool itof, bool otof, bool ftof, bool btof, std::str
ftof = false;
btof = false;
} else if (pattern == "v3b1a") {
lengthOuterTof = 500.f;
dOuterTof.second = 500.f;
zForwardTof = 270.f;
radiusRangeDiskTof = {30.f, 100.f};
} else if (pattern == "v3b1b") {
lengthOuterTof = 500.f;
dOuterTof.second = 500.f;
zForwardTof = 200.f;
radiusRangeDiskTof = {20.f, 68.f};
} else if (pattern == "v3b2a") {
lengthOuterTof = 440.f;
dOuterTof.second = 440.f;
zForwardTof = 270.f;
radiusRangeDiskTof = {30.f, 120.f};
} else if (pattern == "v3b2b") {
lengthOuterTof = 440.f;
dOuterTof.second = 440.f;
zForwardTof = 200.f;
radiusRangeDiskTof = {20.f, 68.f};
} else if (pattern == "v3b3") {
lengthOuterTof = 580.f;
dOuterTof.second = 580.f;
zForwardTof = 200.f;
radiusRangeDiskTof = {20.f, 68.f};
} else {
LOG(fatal) << "IOTOF layer pattern " << pattern << " not recognized, exiting";
}
if (itof) { // iTOF
mITOFLayer = itofSegmented ? ITOFLayer(std::string{GeometryTGeo::getITOFLayerPattern()},
radiusInnerTof, 0.f, lengthInnerTof, 0.f, x2x0, ITOFLayer::kBarrelSegmented,
24, 5.42, 10.0, 10)
: ITOFLayer(std::string{GeometryTGeo::getITOFLayerPattern()},
radiusInnerTof, 0.f, lengthInnerTof, 0.f, x2x0, ITOFLayer::kBarrel);
const std::string name = GeometryTGeo::getITOFLayerPattern();
const int nStaves = itofSegmented ? 24 : 0; // number of staves in segmented case
const double staveWidth = itofSegmented ? 5.42 : 0.0; // cm
const double staveTiltAngle = itofSegmented ? 10.0 : 0.0; // degrees
const int modulesPerStave = itofSegmented ? 10 : 0; // number of modules per stave in segmented case
mITOFLayer = ITOFLayer(name,
dInnerTof.first, 0.f, dInnerTof.second, 0.f, x2x0, ITOFLayer::kBarrelSegmented,
nStaves, staveWidth, staveTiltAngle, modulesPerStave);
}
if (otof) { // oTOF
mOTOFLayer = otofSegmented ? OTOFLayer(std::string{GeometryTGeo::getOTOFLayerPattern()},
radiusOuterTof, 0.f, lengthOuterTof, 0.f, x2x0, OTOFLayer::kBarrelSegmented,
62, 9.74, 5.0, 54)
: OTOFLayer(std::string{GeometryTGeo::getOTOFLayerPattern()},
radiusOuterTof, 0.f, lengthOuterTof, 0.f, x2x0, OTOFLayer::kBarrel);
const std::string name = GeometryTGeo::getOTOFLayerPattern();
const int nStaves = otofSegmented ? 62 : 0; // number of staves in segmented case
const double staveWidth = otofSegmented ? 9.74 : 0.0; // cm
const double staveTiltAngle = otofSegmented ? 5.0 : 0.0; // degrees
const int modulesPerStave = otofSegmented ? 54 : 0; // number of modules per stave in segmented case
mOTOFLayer = OTOFLayer(name,
dOuterTof.first, 0.f, dOuterTof.second, 0.f, x2x0, OTOFLayer::kBarrelSegmented,
nStaves, staveWidth, staveTiltAngle, modulesPerStave);
}
if (ftof) {
mFTOFLayer = FTOFLayer(std::string{GeometryTGeo::getFTOFLayerPattern()},
radiusRangeDiskTof.first, radiusRangeDiskTof.second, 0.f, zForwardTof, x2x0, FTOFLayer::kDisk); // fTOF
const std::string name = GeometryTGeo::getFTOFLayerPattern();
mFTOFLayer = FTOFLayer(name, radiusRangeDiskTof.first, radiusRangeDiskTof.second, 0.f, zForwardTof, x2x0, FTOFLayer::kDisk); // fTOF
}
if (btof) {
mBTOFLayer = BTOFLayer(std::string{GeometryTGeo::getBTOFLayerPattern()},
radiusRangeDiskTof.first, radiusRangeDiskTof.second, 0.f, -zForwardTof, x2x0, BTOFLayer::kDisk); // bTOF
const std::string name = GeometryTGeo::getBTOFLayerPattern();
mBTOFLayer = BTOFLayer(name, radiusRangeDiskTof.first, radiusRangeDiskTof.second, 0.f, -zForwardTof, x2x0, BTOFLayer::kDisk); // bTOF
}
}

Expand Down
43 changes: 43 additions & 0 deletions Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// 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.cxx
/// \brief Implementation of the ALICE3 TOF digitizer
/// \author Nicolò Jacazio, Università del Piemonte Orientale (IT)
/// \since 2026-03-17
///

#include "IOTOFSimulation/Digitizer.h"
#include "DetectorsRaw/HBFUtils.h"

#include <TRandom.h>
#include <vector>
#include <iostream>
#include <numeric>
#include <fairlogger/Logger.h>

namespace o2::iotof
{

void Digitizer::init()
{
}

void Digitizer::process(const std::vector<o2::itsmft::Hit>* hits, int evID, int srcID)
{
}

void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID)
{
}

} // namespace o2::iotof
9 changes: 5 additions & 4 deletions Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Layer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,15 @@ void OTOFLayer::createLayer(TGeoVolume* motherVolume)
case kBarrelSegmented: {
// First we create the volume for the whole layer, which will be used as mother volume for the segments
const double avgRadius = 0.5 * (mInnerRadius + mOuterRadius);
TGeoTube* layer = new TGeoTube(mInnerRadius, mOuterRadius, mZLength / 2);
const double staveSizeX = mStaves.second; // cm
const double staveSizeY = mOuterRadius - mInnerRadius; // cm
const double staveSizeZ = mZLength; // cm
const double deltaForTilt = 0.5 * (std::sin(TMath::DegToRad() * mTiltAngle) * staveSizeX + std::cos(TMath::DegToRad() * mTiltAngle) * staveSizeY); // we increase the size of the layer to account for the tilt of the staves
TGeoTube* layer = new TGeoTube(mInnerRadius - deltaForTilt, mOuterRadius + deltaForTilt, mZLength / 2);
TGeoVolume* layerVol = new TGeoVolume(mLayerName.c_str(), layer, medAir);
setLayerStyle(layerVol);

// Now we create the volume for a single stave
const double staveSizeX = mStaves.second; // cm
const double staveSizeY = mOuterRadius - mInnerRadius; // cm
const double staveSizeZ = mZLength; // cm
TGeoBBox* stave = new TGeoBBox(staveSizeX * 0.5, staveSizeY * 0.5, staveSizeZ * 0.5);
TGeoVolume* staveVol = new TGeoVolume(staveName, stave, medAir);
setStaveStyle(staveVol);
Expand Down
24 changes: 13 additions & 11 deletions Detectors/Upgrades/ALICE3/TRK/macros/test/CheckClusters.C
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,18 @@ void CheckClusters(const std::string& clusfile = "o2clus_trk.root",
// ── Chip response (for hit-segment propagation to charge-collection plane) ──
// Fetches the same AlpideSimResponse from CCDB as the digitizer (IT3/Calib/APTSResponse)
// and computes Y-intersection planes with the same formulas from Digitizer::init()
auto& ccdbMgr = o2::ccdb::BasicCCDBManager::instance();
ccdbMgr.setURL(ccdbUrl);
if (ccdbTimestamp > 0) {
ccdbMgr.setTimestamp(ccdbTimestamp);
}
auto* alpResp = ccdbMgr.get<o2::itsmft::AlpideSimResponse>("IT3/Calib/APTSResponse");
if (!alpResp) {
LOGP(fatal, "Cannot retrieve AlpideSimResponse from CCDB at {}", ccdbUrl);
return;
}
const float depthMax = alpResp->getDepthMax();
// auto& ccdbMgr = o2::ccdb::BasicCCDBManager::instance();
// ccdbMgr.setURL(ccdbUrl);
// if (ccdbTimestamp > 0) {
// ccdbMgr.setTimestamp(ccdbTimestamp);
// }
// auto* alpResp = ccdbMgr.get<o2::itsmft::AlpideSimResponse>("IT3/Calib/APTSResponse");
// if (!alpResp) {
// LOGP(fatal, "Cannot retrieve AlpideSimResponse from CCDB at {}", ccdbUrl);
// return;
// }
// const float depthMax = alpResp->getDepthMax();
const float depthMax = 500;

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