Project
Loading...
Searching...
No Matches
GeometryTGeo.cxx
Go to the documentation of this file.
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
13#include <TGeoManager.h>
14
15namespace o2
16{
17namespace rich
18{
19std::unique_ptr<o2::rich::GeometryTGeo> GeometryTGeo::sInstance;
20
21std::string GeometryTGeo::sVolumeName = "RICHV";
22std::string GeometryTGeo::sRingName = "RICHRing";
23std::string GeometryTGeo::sChipName = "RICHChip";
24std::string GeometryTGeo::sSensorName = "RICHSensor";
25std::string GeometryTGeo::sSensorFWDName = "FWDRICHSensor"; // only one big sensor for now
26std::string GeometryTGeo::sSensorBWDName = "BWDRICHSensor"; // only one big sensor for now
27
28GeometryTGeo::GeometryTGeo(bool build, int loadTrans) : DetMatrixCache()
29{
30 if (sInstance) {
31 LOGP(fatal, "Invalid use of public constructor: o2::rich::GeometryTGeo instance exists");
32 }
33 if (build) {
34 Build(loadTrans);
35 }
36}
37
38void GeometryTGeo::Build(int loadTrans)
39{
40 if (isBuilt()) {
41 LOGP(warning, "Already built");
42 return; // already initialized
43 }
44
45 if (!gGeoManager) {
46 LOGP(fatal, "Geometry is not loaded");
47 }
48
49 fillMatrixCache(loadTrans);
50}
51
55
57{
58 if (!sInstance) {
59 sInstance = std::unique_ptr<GeometryTGeo>(new GeometryTGeo(true, 0));
60 }
61 return sInstance.get();
62}
63
64const char* GeometryTGeo::composeSymNameRing(int d, int rg)
65{
66 return Form("%s/%s%d", composeSymNameRICH(d), getRICHRingPattern(), rg);
67}
68
69const char* GeometryTGeo::composeSymNameChip(int d, int rg)
70{
71 return Form("%s/%s%d", composeSymNameRing(d, rg), getRICHChipPattern(), rg);
72}
73
74const char* GeometryTGeo::composeSymNameSensor(int d, int rg)
75{
76 return Form("%s/%s%d", composeSymNameChip(d, rg), getRICHSensorPattern(), rg);
77}
78
80{
81 return Form("%s/%s", composeSymNameRICH(d), getRICHSensorFWDPattern());
82}
83
85{
86 return Form("%s/%s", composeSymNameRICH(d), getRICHSensorBWDPattern());
87}
88
89} // namespace rich
90} // namespace o2
static const char * getRICHSensorBWDPattern()
static const char * composeSymNameSensorFWD(int d)
static const char * getRICHSensorPattern()
static GeometryTGeo * Instance()
static const char * composeSymNameSensor(int d, int ring)
static std::string sRingName
static const char * composeSymNameSensorBWD(int d)
GeometryTGeo(bool build=false, int loadTrans=0)
static std::string sSensorBWDName
static const char * composeSymNameChip(int d, int ring)
static const char * composeSymNameRing(int d, int ring)
static std::string sChipName
void fillMatrixCache(int mask)
static const char * getRICHSensorFWDPattern()
static std::string sSensorName
static const char * getRICHRingPattern()
void Build(int loadTrans)
static const char * getRICHChipPattern()
static std::string sVolumeName
static std::string sSensorFWDName
static const char * composeSymNameRICH(int d)
GLint GLuint mask
Definition glcorearb.h:291
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...