Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Common/SimConfig/src/SimConfig.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ bool SimConfig::resetFromParsedMap(boost::program_options::variables_map const&
active.clear();
for (int d = DetID::First; d <= DetID::Last; ++d) {
#ifdef ENABLE_UPGRADES
if (d != DetID::IT3 && d != DetID::TRK) {
if (d != DetID::IT3 && d != DetID::TRK && d != DetID::FT3) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at some moment it will make sense to talk about a better isolation of Run3 and upgrade detectors.
Something like predefined list in separate DetIDs ..

active.emplace_back(DetID::getName(d));
}
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ class DetID
#ifdef ENABLE_UPGRADES
static constexpr ID IT3 = 16;
static constexpr ID TRK = 17;
static constexpr ID Last = TRK;
static constexpr ID FT3 = 18;
static constexpr ID Last = FT3;
#else
static constexpr ID Last = ACO; ///< if extra detectors added, update this !!!
#endif
Expand Down Expand Up @@ -133,7 +134,7 @@ class DetID

static constexpr const char* sDetNames[nDetectors + 1] = ///< defined detector names
#ifdef ENABLE_UPGRADES
{"ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD", "ACO", "IT3", "TRK", nullptr};
{"ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD", "ACO", "IT3", "TRK", "FT3", nullptr};
#else
{"ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD", "ACO", nullptr};
#endif
Expand All @@ -145,7 +146,7 @@ class DetID
math_utils::bit2Mask(ACO)
#ifdef ENABLE_UPGRADES
,
math_utils::bit2Mask(IT3), math_utils::bit2Mask(TRK)
math_utils::bit2Mask(IT3), math_utils::bit2Mask(TRK), math_utils::bit2Mask(FT3)
#endif
};

Expand All @@ -156,7 +157,7 @@ class DetID
o2h::gDataOriginMID, o2h::gDataOriginZDC, o2h::gDataOriginFT0, o2h::gDataOriginFV0, o2h::gDataOriginFDD, o2h::gDataOriginACO
#ifdef ENABLE_UPGRADES
,
o2h::gDataOriginIT3, o2h::gDataOriginTRK
o2h::gDataOriginIT3, o2h::gDataOriginTRK, o2h::gDataOriginFT3
#endif
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class SimTraits
// initialization fragile since depends on correct order. Can we do better?

// clang-format off
static inline const std::array<std::vector<std::string>, DetID::nDetectors> DETECTORBRANCHNAMES =
{ /*ITS*/ VS{ "ITSHit" },
static inline const std::array<std::vector<std::string>, DetID::nDetectors> DETECTORBRANCHNAMES =
{ /*ITS*/ VS{ "ITSHit" },
/*TPC*/ VS{ "TPCHitsShiftedSector0",
"TPCHitsShiftedSector1",
"TPCHitsShiftedSector2",
Expand Down Expand Up @@ -90,7 +90,8 @@ class SimTraits
#ifdef ENABLE_UPGRADES
,
/*IT3*/ VS{ "IT3Hit" },
/*TRK*/ VS{ "TRKHit" }
/*TRK*/ VS{ "TRKHit" },
/*FT3*/ VS{ "FT3Hit" }
#endif
};
// clang-format on
Expand Down Expand Up @@ -227,11 +228,14 @@ template <>
struct DetIDToHitTypes<o2::detectors::DetID::IT3> {
using HitType = o2::itsmft::Hit;
};

template <>
struct DetIDToHitTypes<o2::detectors::DetID::TRK> {
using HitType = o2::itsmft::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::FT3> {
using HitType = o2::itsmft::Hit;
};
#endif

} // namespace detectors
Expand Down
1 change: 1 addition & 0 deletions DataFormats/Detectors/Common/src/DetID.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ constexpr DetID::ID DetID::ITS, DetID::TPC, DetID::TRD, DetID::TOF, DetID::PHS,
#ifdef ENABLE_UPGRADES
constexpr DetID::ID DetID::IT3;
constexpr DetID::ID DetID::TRK;
constexpr DetID::ID DetID::FT3;
#endif

constexpr int DetID::nDetectors;
Expand Down
2 changes: 2 additions & 0 deletions DataFormats/Headers/include/Headers/DataHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,8 @@ constexpr o2::header::DataOrigin gDataOriginZDC{"ZDC"};
#ifdef ENABLE_UPGRADES
constexpr o2::header::DataOrigin gDataOriginIT3{"IT3"};
constexpr o2::header::DataOrigin gDataOriginTRK{"TRK"};
constexpr o2::header::DataOrigin gDataOriginFT3{"FT3"};

#endif

//possible data types
Expand Down
3 changes: 2 additions & 1 deletion Detectors/Upgrades/ALICE3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@

add_subdirectory(Passive)
add_subdirectory(TRK)
add_subdirectory(AOD)
add_subdirectory(FT3)
add_subdirectory(AOD)
12 changes: 12 additions & 0 deletions Detectors/Upgrades/ALICE3/FT3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright CERN and copyright holders of ALICE O2. This software is distributed
# under the terms of the GNU General Public License v3 (GPL Version 3), copied
# verbatim in the file "COPYING".
#
# See http://alice-o2.web.cern.ch/license for full licensing information.
#
# 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.

add_subdirectory(simulation)
add_subdirectory(base)
10 changes: 10 additions & 0 deletions Detectors/Upgrades/ALICE3/FT3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- doxy
\page refDetectorsPostLS4 EndCaps
/doxy -->

# PostLS4EndCaps

This is a top page for the PostLS4EndCaps detector documentation.

<!-- doxy
/doxy -->
16 changes: 16 additions & 0 deletions Detectors/Upgrades/ALICE3/FT3/base/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright CERN and copyright holders of ALICE O2. This software is distributed
# under the terms of the GNU General Public License v3 (GPL Version 3), copied
# verbatim in the file "COPYING".
#
# See http://alice-o2.web.cern.ch/license for full licensing information.
#
# 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(FT3Base
SOURCES src/GeometryTGeo.cxx
PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2::ITSMFTBase)

o2_target_root_dictionary(FT3Base
HEADERS include/FT3Base/GeometryTGeo.h)
119 changes: 119 additions & 0 deletions Detectors/Upgrades/ALICE3/FT3/base/include/FT3Base/GeometryTGeo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// 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 GeometryTGeo.h
/// \brief Definition of the GeometryTGeo class
/// \author cvetan.cheshkov@cern.ch - 15/02/2007
/// \author ruben.shahoyan@cern.ch - adapted to ITSupg 18/07/2012
/// \author rafael.pezzi@cern.ch - adapted to PostLS4EndCaps 25/06/2020

#ifndef ALICEO2_FT3_GEOMETRYTGEO_H_
#define ALICEO2_FT3_GEOMETRYTGEO_H_

#include <TGeoMatrix.h> // for TGeoHMatrix
#include <TObject.h> // for TObject
#include <array>
#include <string>
#include <vector>
#include "DetectorsBase/GeometryManager.h"
#include "DetectorsCommonDataFormats/DetID.h"
#include "ITSMFTBase/GeometryTGeo.h"
#include "MathUtils/Utils.h"
#include "Rtypes.h" // for Int_t, Double_t, Bool_t, UInt_t, etc

class TGeoPNEntry;

namespace o2
{
namespace ft3
{
/// GeometryTGeo is a simple interface class to TGeoManager. It is used in the simulation
/// in order to query the TGeo FT3 geometry.
/// RS: In order to preserve the static character of the class but make it dynamically access
/// geometry, we need to check in every method if the structures are initialized. To be converted
/// to singleton at later stage.

class GeometryTGeo : public o2::itsmft::GeometryTGeo
{
public:
typedef o2::math_utils::Transform3D Mat3D;
using DetMatrixCache::getMatrixL2G;
using DetMatrixCache::getMatrixT2GRot;
using DetMatrixCache::getMatrixT2L;
// this method is not advised for ITS: for barrel detectors whose tracking frame is just a rotation
// it is cheaper to use T2GRot
using DetMatrixCache::getMatrixT2G;

static GeometryTGeo* Instance()
{
// get (create if needed) a unique instance of the object
if (!sInstance) {
sInstance = std::unique_ptr<GeometryTGeo>(new GeometryTGeo(true, 0));
}
return sInstance.get();
}

// adopt the unique instance from external raw pointer (to be used only to read saved instance from file)
static void adopt(GeometryTGeo* raw);

// constructor
// ATTENTION: this class is supposed to behave as a singleton, but to make it root-persistent
// we must define public default constructor.
// NEVER use it, it will throw exception if the class instance was already created
// Use GeometryTGeo::Instance() instead
GeometryTGeo(bool build = kFALSE, int loadTrans = 0
/*o2::base::utils::bit2Mask(o2::TransformType::T2L, // default transformations to load
o2::TransformType::T2G,
o2::TransformType::L2G)*/
);

/// Default destructor
~GeometryTGeo() override = default;

GeometryTGeo(const GeometryTGeo& src) = delete;
GeometryTGeo& operator=(const GeometryTGeo& geom) = delete;

// implement filling of the matrix cache
using o2::itsmft::GeometryTGeo::fillMatrixCache;
void fillMatrixCache(int mask) override;

/// Exract FT3 parameters from TGeo
void Build(int loadTrans = 0) override;

void Print(Option_t* opt = "") const;
static const char* getFT3VolPattern() { return sVolumeName.c_str(); }
static const char* getFT3LayerPattern() { return sLayerName.c_str(); }
static const char* getFT3ChipPattern() { return sChipName.c_str(); }
static const char* getFT3SensorPattern() { return sSensorName.c_str(); }

static const char* composeSymNameFT3(Int_t d) { return Form("%s_%d", o2::detectors::DetID(o2::detectors::DetID::FT3).getName(), d); }
static const char* composeSymNameLayer(Int_t d, Int_t lr);
static const char* composeSymNameChip(Int_t d, Int_t lr);
static const char* composeSymNameSensor(Int_t d, Int_t lr);

protected:
static constexpr int MAXLAYERS = 15; ///< max number of active layers

Int_t mNumberOfLayers; ///< number of layers
static std::string sVolumeName; ///< Mother volume name
static std::string sLayerName; ///< Layer name
static std::string sChipName; ///< Chip name

static std::string sSensorName; ///< Sensor name

private:
static std::unique_ptr<o2::ft3::GeometryTGeo> sInstance; ///< singletone instance

ClassDefOverride(GeometryTGeo, 1); // FT3 geometry based on TGeo
};
} // namespace ft3
} // namespace o2

#endif
19 changes: 19 additions & 0 deletions Detectors/Upgrades/ALICE3/FT3/base/src/FT3BaseLinkDef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// 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::ft3::GeometryTGeo;

#endif
110 changes: 110 additions & 0 deletions Detectors/Upgrades/ALICE3/FT3/base/src/GeometryTGeo.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// 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 GeometryTGeo.cxx
/// \brief Implementation of the GeometryTGeo class
/// \author cvetan.cheshkov@cern.ch - 15/02/2007
/// \author ruben.shahoyan@cern.ch - adapted to ITSupg 18/07/2012
/// \author rafael.pezzi@cern.ch - adapted to ALICE 3 EndCaps 14/02/2021

// ATTENTION: In opposite to old AliITSgeomTGeo, all indices start from 0, not from 1!!!

#include "FT3Base/GeometryTGeo.h"
#include "DetectorsBase/GeometryManager.h"
#include "MathUtils/Cartesian.h"

#include "FairLogger.h" // for LOG

#include <TGeoBBox.h> // for TGeoBBox
#include <TGeoManager.h> // for gGeoManager, TGeoManager
#include <TGeoPhysicalNode.h> // for TGeoPNEntry, TGeoPhysicalNode
#include <TGeoShape.h> // for TGeoShape
#include <TMath.h> // for Nint, ATan2, RadToDeg
#include <TString.h> // for TString, Form
#include "TClass.h" // for TClass
#include "TGeoMatrix.h" // for TGeoHMatrix
#include "TGeoNode.h" // for TGeoNode, TGeoNodeMatrix
#include "TGeoVolume.h" // for TGeoVolume
#include "TMathBase.h" // for Max
#include "TObjArray.h" // for TObjArray
#include "TObject.h" // for TObject

#include <cctype> // for isdigit
#include <cstdio> // for snprintf, NULL, printf
#include <cstring> // for strstr, strlen

using namespace TMath;
using namespace o2::ft3;
using namespace o2::detectors;

ClassImp(o2::ft3::GeometryTGeo);

std::unique_ptr<o2::ft3::GeometryTGeo> GeometryTGeo::sInstance;

std::string GeometryTGeo::sVolumeName = "FT3V"; ///< Mother volume name
std::string GeometryTGeo::sLayerName = "FT3Layer"; ///< Layer name
std::string GeometryTGeo::sChipName = "FT3Chip"; ///< Sensor name
std::string GeometryTGeo::sSensorName = "FT3Sensor"; ///< Sensor name

//__________________________________________________________________________
GeometryTGeo::GeometryTGeo(bool build, int loadTrans) : o2::itsmft::GeometryTGeo(DetID::FT3)
{
// default c-tor, if build is true, the structures will be filled and the transform matrices
// will be cached
if (sInstance) {
LOG(FATAL) << "Invalid use of public constructor: o2::ft3::GeometryTGeo instance exists";
// throw std::runtime_error("Invalid use of public constructor: o2::ft3::GeometryTGeo instance exists");
}

if (build) {
Build(loadTrans);
}
}

//__________________________________________________________________________
void GeometryTGeo::Build(int loadTrans)
{
if (isBuilt()) {
LOG(WARNING) << "Already built";
return; // already initialized
}

if (!gGeoManager) {
// RSTODO: in future there will be a method to load matrices from the CDB
LOG(FATAL) << "Geometry is not loaded";
}

fillMatrixCache(loadTrans);
}

//__________________________________________________________________________
const char* GeometryTGeo::composeSymNameLayer(Int_t d, Int_t lr)
{
return Form("%s/%s%d", composeSymNameFT3(d), getFT3LayerPattern(), lr);
}

//__________________________________________________________________________
const char* GeometryTGeo::composeSymNameChip(Int_t d, Int_t lr)
{
return Form("%s/%s%d", composeSymNameLayer(d, lr), getFT3ChipPattern(), lr);
}

//__________________________________________________________________________
const char* GeometryTGeo::composeSymNameSensor(Int_t d, Int_t lr)
{
return Form("%s/%s%d", composeSymNameChip(d, lr), getFT3SensorPattern(), lr);
}

//__________________________________________________________________________
void GeometryTGeo::fillMatrixCache(int mask)
{
// populate matrix cache for requested transformations
//
}
Loading