Project
Loading...
Searching...
No Matches
Geometry.h
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
12#ifndef ALICEO2_PHOS_GEOMETRY_H_
13#define ALICEO2_PHOS_GEOMETRY_H_
14
15#include <string>
16#include <array>
17
18#include <Rtypes.h>
19#include <RStringView.h>
20#include <TGeoMatrix.h>
21#include <TVector3.h>
22#include <TMath.h>
23#include <array>
24
25namespace o2
26{
27namespace phos
28{
30{
31 public:
36 Geometry() = default;
37
42 Geometry(const std::string_view name);
43
47 Geometry(const Geometry& geom);
48
52 ~Geometry() = default;
53
57 Geometry& operator=(const Geometry& rvalue);
58
63 static Geometry* GetInstance() { return sGeom; }
64
70 // \param mcname: Geant3/4, Fluka, needed for settings of transport (check) \param mctitle: Geant4 physics list
71 // (check)
73 static Geometry* GetInstance(const std::string_view name)
74 {
75 if (sGeom) {
76 if (sGeom->GetName() == name) {
77 return sGeom;
78 } else {
79 delete sGeom;
80 }
81 }
82 sGeom = new Geometry(name);
83 return sGeom;
84 }
85
90 // = 1 are neighbour
91 // = 2 are not neighbour but do not continue searching
92 // =-1 are not neighbour, continue searching, but do not look before d2 next time
93 static int areNeighbours(short absId1, short absId2);
94
99 // \param cell: cell in strip number
100 static short relToAbsId(char moduleNumber, int strip, int cell);
101 // Converts the absolute numbering into the following array
102 // relid[0] = PHOS Module number 1:module
103 // relid[1] = Row number inside a PHOS module (Phi coordinate)
104 // relid[2] = Column number inside a PHOS module (Z coordinate)
105 static bool absToRelNumbering(short absId, char* relid);
106 static char absIdToModule(short absId);
107 static void absIdToRelPosInModule(short absId, float& x, float& z);
108 static void relPosToRelId(short module, float x, float z, char* relId);
109 static bool relToAbsNumbering(const char* RelId, short& AbsId);
110
111 // Converters for TRU tiles
112 static bool truAbsToRelNumbering(short truId, short trigType, char* relid);
113 static short truRelToAbsNumbering(const char* relId, short trigType);
114 static short relPosToTruId(char mod, float x, float z, short trigType);
115
116 // local position to absId
117 static void relPosToAbsId(char module, float x, float z, short& absId);
118
119 // convert local position in module to global position in ALICE
120 void local2Global(char module, float x, float z, TVector3& globaPos) const;
121
122 // calculate impact position on PHOS
123 bool impactOnPHOS(const TVector3& vtx, const TVector3& p,
124 short& module, float& z, float& x) const;
125
126 static int getTotalNCells() { return 56 * 64 * 4; } // TODO: evaluate from real geometry
127 static bool isCellExists(short absId)
128 {
129 return absId >= 0 && absId <= getTotalNCells();
130 } // TODO: evaluate from real geometry
131
132 const std::string& GetName() const { return mGeoName; }
133
134 const TGeoHMatrix* getAlignmentMatrix(int mod) const { return &(mPHOS[mod]); }
135
136 private:
137 static constexpr float CELLSTEP = 2.25;
138
139 static Geometry* sGeom; // Pointer to the unique instance of the singleton
140 std::array<TGeoHMatrix, 5> mPHOS; // Rotation/shift matrices
141
142 std::string mGeoName;
143
144 ClassDefNV(Geometry, 1);
145};
146} // namespace phos
147} // namespace o2
148#endif
static Geometry * GetInstance(const std::string_view name)
Definition Geometry.h:73
static short relPosToTruId(char mod, float x, float z, short trigType)
Definition Geometry.cxx:144
const TGeoHMatrix * getAlignmentMatrix(int mod) const
Definition Geometry.h:134
static int getTotalNCells()
Definition Geometry.h:126
static void relPosToAbsId(char module, float x, float z, short &absId)
Definition Geometry.cxx:220
static void relPosToRelId(short module, float x, float z, char *relId)
Definition Geometry.cxx:226
void local2Global(char module, float x, float z, TVector3 &globaPos) const
Definition Geometry.cxx:234
bool impactOnPHOS(const TVector3 &vtx, const TVector3 &p, short &module, float &z, float &x) const
Definition Geometry.cxx:244
const std::string & GetName() const
Definition Geometry.h:132
static char absIdToModule(short absId)
Definition Geometry.cxx:151
static int areNeighbours(short absId1, short absId2)
Definition Geometry.cxx:159
static short truRelToAbsNumbering(const char *relId, short trigType)
Definition Geometry.cxx:118
static void absIdToRelPosInModule(short absId, float &x, float &z)
Definition Geometry.cxx:198
static bool relToAbsNumbering(const char *RelId, short &AbsId)
Definition Geometry.cxx:207
static short relToAbsId(char moduleNumber, int strip, int cell)
Definition Geometry.cxx:49
Geometry(const Geometry &geom)
Geometry & operator=(const Geometry &rvalue)
static bool truAbsToRelNumbering(short truId, short trigType, char *relid)
Definition Geometry.cxx:83
static bool absToRelNumbering(short absId, char *relid)
Definition Geometry.cxx:65
static bool isCellExists(short absId)
Definition Geometry.h:127
static Geometry * GetInstance()
Definition Geometry.h:63
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint const GLchar * name
Definition glcorearb.h:781
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...