Skip to content
Closed
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 @@ -63,7 +63,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 && d != DetID::FT3) {
if (d != DetID::IT3 && d != DetID::TRK && d != DetID::FT3 && d != DetID::PSR) {
active.emplace_back(DetID::getName(d));
}
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
}
printf("joint mask: 0x%lx\n",mskTot.to_ulong());
*/

//
//
#ifndef O2_BASE_DETID_
#define O2_BASE_DETID_

Expand Down Expand Up @@ -81,7 +82,8 @@ class DetID
static constexpr ID IT3 = 17;
static constexpr ID TRK = 18;
static constexpr ID FT3 = 19;
static constexpr ID Last = FT3;
static constexpr ID PSR = 20;
static constexpr ID Last = PSR;
#else
static constexpr ID Last = CTP; ///< if extra detectors added, update this !!!
#endif
Expand Down Expand Up @@ -167,10 +169,21 @@ class DetID
// detector names, will be defined in DataSources
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", "CTP", "IT3", "TRK", "FT3", nullptr};
{"ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD", "ACO", "CTP", "IT3", "TRK", "FT3", "PSR", nullptr};
#else
{"ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD", "ACO", "CTP", nullptr};
#endif
// detector names, will be defined in DataSources
static constexpr std::array<mask_t, nDetectors> sMasks = ///< detectot masks
{math_utils::bit2Mask(ITS), math_utils::bit2Mask(TPC), math_utils::bit2Mask(TRD), math_utils::bit2Mask(TOF), math_utils::bit2Mask(PHS),
math_utils::bit2Mask(CPV), math_utils::bit2Mask(EMC), math_utils::bit2Mask(HMP), math_utils::bit2Mask(MFT), math_utils::bit2Mask(MCH),
math_utils::bit2Mask(MID), math_utils::bit2Mask(ZDC), math_utils::bit2Mask(FT0), math_utils::bit2Mask(FV0), math_utils::bit2Mask(FDD),
math_utils::bit2Mask(ACO)
#ifdef ENABLE_UPGRADES
,
math_utils::bit2Mask(IT3), math_utils::bit2Mask(TRK), math_utils::bit2Mask(FT3), math_utils::bit2Mask(PSR)
#endif
};

static constexpr std::array<o2h::DataOrigin, nDetectors>
sOrigins = ///< detector data origins
Expand All @@ -180,7 +193,7 @@ class DetID
o2h::gDataOriginACO, o2h::gDataOriginCTP
#ifdef ENABLE_UPGRADES
,
o2h::gDataOriginIT3, o2h::gDataOriginTRK, o2h::gDataOriginFT3
o2h::gDataOriginIT3, o2h::gDataOriginTRK, o2h::gDataOriginFT3, o2h::gDataOriginPSR
#endif
};
#endif // GPUCA_GPUCODE_DEVICE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ class SimTraits
,
/*IT3*/ VS{ "IT3Hit" },
/*TRK*/ VS{ "TRKHit" },
/*FT3*/ VS{ "FT3Hit" }
/*FT3*/ VS{ "FT3Hit" },
/*PSR*/ VS{ "PSRHit" }
#endif
};
// clang-format on
Expand Down Expand Up @@ -238,6 +239,11 @@ template <>
struct DetIDToHitTypes<o2::detectors::DetID::FT3> {
using HitType = o2::itsmft::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::PSR> {
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 @@ -33,6 +33,7 @@ constexpr DetID::ID DetID::ITS, DetID::TPC, DetID::TRD, DetID::TOF, DetID::PHS,
constexpr DetID::ID DetID::IT3;
constexpr DetID::ID DetID::TRK;
constexpr DetID::ID DetID::FT3;
constexpr DetID::ID DetID::PSR;
#endif

constexpr int DetID::nDetectors;
Expand Down
1 change: 1 addition & 0 deletions DataFormats/Headers/include/Headers/DataHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ constexpr o2::header::DataOrigin gDataOriginZDC{"ZDC"};
constexpr o2::header::DataOrigin gDataOriginIT3{"IT3"};
constexpr o2::header::DataOrigin gDataOriginTRK{"TRK"};
constexpr o2::header::DataOrigin gDataOriginFT3{"FT3"};
constexpr o2::header::DataOrigin gDataOriginPSR{"PSR"};

//possible data types
constexpr o2::header::DataDescription gDataDescriptionAny{"***************"};
Expand Down
2 changes: 2 additions & 0 deletions Detectors/Upgrades/ALICE3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@
add_subdirectory(Passive)
add_subdirectory(TRK)
add_subdirectory(FT3)
add_subdirectory(PSR)
add_subdirectory(AOD)

12 changes: 12 additions & 0 deletions Detectors/Upgrades/ALICE3/PSR/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)
13 changes: 13 additions & 0 deletions Detectors/Upgrades/ALICE3/PSR/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- doxy
\page refDetectorsUpgradesALICE3PSR Preshower
/doxy -->

# PostLS4Preshower

This is a simple 8 layered preshower detector named PSR. This is a cylindrical detector of length 100 cm whose shower layers are made up of Pb (0.5 cm) and the detector layers are made up of Si (45 microns). PSR is based on the ITSMFT classes and the code is structurally similar to that of FT3. Each layer is made of a monolithic silicon disk with a thin sensitive layer for hit generation. Silicon chip thickness is tuned to match the layer x/X0 to allow a minimal evaluation of material budget effects.

One should get a file o2sim_HitsPSR.root by running
$ o2-sim -m PSR -e TGeant3 -g boxgen -n 10

<!-- doxy
/doxy -->
16 changes: 16 additions & 0 deletions Detectors/Upgrades/ALICE3/PSR/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(PSRBase
SOURCES src/GeometryTGeo.cxx
PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2::ITSMFTBase)

o2_target_root_dictionary(PSRBase
HEADERS include/PSRBase/GeometryTGeo.h)
123 changes: 123 additions & 0 deletions Detectors/Upgrades/ALICE3/PSR/base/include/PSRBase/GeometryTGeo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// 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 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
/// \author aabhishek.naath@gmail.com- adapted for Preshower 12/05/2021

#ifndef ALICEO2_PSR_GEOMETRYTGEO_H_
#define ALICEO2_PSR_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 psr
{
/// GeometryTGeo is a simple interface class to TGeoManager. It is used in the simulation
/// in order to query the TGeo Preshower 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 Preshower parameters from TGeo
void Build(int loadTrans = 0) override;

void Print(Option_t* opt = "") const;
static const char* getPSRVolPattern() { return sVolumeName.c_str(); }
static const char* getPSRLayerPattern() { return sLayerName.c_str(); }
static const char* getPSRChipPattern() { return sChipName.c_str(); }
static const char* getPSRSensorPattern() { return sSensorName.c_str(); }
static const char* getPSRShowerlayerPattern() { return sShowerlayerName.c_str(); }

static const char* composeSymNamePSR(Int_t d) { return Form("%s_%d", o2::detectors::DetID(o2::detectors::DetID::PSR).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);
static const char* composeSymNameShowerlayer(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
static std::string sShowerlayerName; ///< Showerlayer name

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

ClassDefOverride(GeometryTGeo, 1); // Preshower geometry based on TGeo
};
} // namespace psr
} // namespace o2

#endif
121 changes: 121 additions & 0 deletions Detectors/Upgrades/ALICE3/PSR/base/src/GeometryTGeo.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// 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 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
/// \author aabhishek.naath@gmail.com - adapted for ALICE3 preshower

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

#include "PSRBase/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::psr;
using namespace o2::detectors;

ClassImp(o2::psr::GeometryTGeo);

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

std::string GeometryTGeo::sVolumeName = "PSRV"; ///< Mother volume name
std::string GeometryTGeo::sLayerName = "PSRLayer"; ///< Layer name
std::string GeometryTGeo::sChipName = "PSRChip"; ///< Chip name
std::string GeometryTGeo::sSensorName = "PSRSensor"; ///< Sensor name
std::string GeometryTGeo::sShowerlayerName = "PSRShowerlayer"; ///< Showerlayer name

//__________________________________________________________________________
GeometryTGeo::GeometryTGeo(bool build, int loadTrans) : o2::itsmft::GeometryTGeo(DetID::PSR)
{
// 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::psr::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", composeSymNamePSR(d), getPSRLayerPattern(), lr);
}

//__________________________________________________________________________
const char* GeometryTGeo::composeSymNameShowerlayer(Int_t d, Int_t lr)
{
LOG(INFO) << "composenamelayer works_0";
return Form("%s/%s%d", composeSymNameShowerlayer(d, lr), getPSRShowerlayerPattern(), lr);
LOG(INFO) << "composenamelayer works_1";
}

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

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

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