13#include <TGeoManager.h>
22std::unique_ptr<o2::trk::GeometryTGeo> GeometryTGeo::sInstance;
45 LOGP(fatal,
"Invalid use of public constructor: o2::trk::GeometryTGeo instance exists");
62 LOGP(warning,
"Already built");
66 if (gGeoManager ==
nullptr) {
67 LOGP(fatal,
"Geometry is not loaded");
86 std::cout <<
"Layer MLOT: " <<
i << std::endl;
90 int numberOfChipsTotal = 0;
154 }
else if (subDetID == 1) {
171 }
else if (subDetID == 1) {
204 }
else if (subDetID == 1) {
227 int subDetID, petalcase, disk, lay, stave;
230 int indexRetrieved =
getChipIndex(subDetID, petalcase, disk, lay, stave);
235 TString
path =
"/cave_1/barrel_1/TRKV_2/TRKLayer0_1/TRKStave0_1/TRKChip0_1/TRKSensor0_1/";
293 static TGeoHMatrix matTmp;
294 gGeoManager->PushPath();
302 matTmp = *gGeoManager->GetCurrentMatrix();
308 gGeoManager->PopPath();
310 static int chipInGlo{0};
331 LOG(warning) <<
"The method Build was not called yet";
339 LOGP(info,
"Loading {} L2G matrices from TGeo; there are {} matrices",
getName(),
mSize);
341 cacheL2G.setSize(
mSize);
345 cacheL2G.setMatrix(
Mat3D(*hm),
i);
376 if (!nms.BeginsWith(prefix)) {
379 nms.Remove(0, strlen(prefix));
380 if (!isdigit(nms.Data()[0])) {
389 int numberOfLayers = 0;
391 if (trkV ==
nullptr) {
397 TObjArray*
nodes = trkV->GetNodes();
399 int nNodes =
nodes->GetEntriesFast();
400 for (
int j = 0;
j < nNodes;
j++) {
402 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
403 const char*
name = nd->GetName();
407 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
413 LOG(fatal) <<
"Failed to extract wrapper ID from the " <<
name;
415 TObjArray* nodesW = nd->GetNodes();
416 int nNodesW = nodesW->GetEntriesFast();
418 for (
int jw = 0; jw < nNodesW; jw++) {
419 auto ndW =
dynamic_cast<TGeoNode*
>(nodesW->At(jw))->GetName();
422 LOGP(fatal,
"Failed to extract layer ID from wrapper volume '{}' from one of its nodes '{}'",
name, ndW);
430 return numberOfLayers;
437 int numberOfParts = 0;
440 if (vdV ==
nullptr) {
446 TObjArray*
nodes = vdV->GetNodes();
447 int nNodes =
nodes->GetEntriesFast();
448 for (
int j = 0;
j < nNodes;
j++) {
450 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
451 const char*
name = nd->GetName();
456 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
460 return numberOfParts;
467 int numberOfDisks = 0;
470 if (vdV ==
nullptr) {
476 TObjArray*
nodes = vdV->GetNodes();
477 int nNodes =
nodes->GetEntriesFast();
478 for (
int j = 0;
j < nNodes;
j++) {
480 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
481 const char*
name = nd->GetName();
486 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
490 return numberOfDisks;
497 int numberOfChips = 0;
500 if (vdV ==
nullptr) {
506 TObjArray*
nodes = vdV->GetNodes();
507 int nNodes =
nodes->GetEntriesFast();
508 for (
int j = 0;
j < nNodes;
j++) {
510 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
511 const char*
name = nd->GetName();
516 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
520 return numberOfChips;
527 int numberOfLayers = 0;
530 if (vdV ==
nullptr) {
536 TObjArray*
nodes = vdV->GetNodes();
537 int nNodes =
nodes->GetEntriesFast();
538 for (
int j = 0;
j < nNodes;
j++) {
540 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
541 const char*
name = nd->GetName();
546 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
550 return numberOfLayers;
557 int numberOfChips = 0;
560 if (vdV ==
nullptr) {
566 TObjArray*
nodes = vdV->GetNodes();
567 int nNodes =
nodes->GetEntriesFast();
568 for (
int j = 0;
j < nNodes;
j++) {
570 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
571 const char*
name = nd->GetName();
576 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
580 return numberOfChips;
586 int numberOfStaves = 0;
589 TGeoVolume* layV = gGeoManager->GetVolume(layName.c_str());
591 if (layV ==
nullptr) {
596 TObjArray*
nodes = layV->GetNodes();
599 int nNodes =
nodes->GetEntriesFast();
601 for (
int j = 0;
j < nNodes;
j++) {
603 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
604 const char*
name = nd->GetName();
609 return numberOfStaves;
615 std::cout <<
"\nindex = " <<
index << std::endl;
616 std::cout <<
"subDetID = " << subDetID << std::endl;
617 std::cout <<
"petalcase = " << petalcase << std::endl;
618 std::cout <<
"layer = " << lay << std::endl;
619 std::cout <<
"disk = " << disk << std::endl;
620 std::cout <<
"first chip index = " <<
getFirstChipIndex(lay, petalcase, subDetID) << std::endl;
621 std::cout <<
"stave = " << stave << std::endl;
622 std::cout <<
"chck index Retrieved = " << indexRetrieved << std::endl;
629 LOGF(info,
"Geometry not built yet!");
632 std::cout <<
"Detector ID: " << sInstance.get()->getDetID() << std::endl;
634 LOGF(info,
"Summary of GeometryTGeo: %s",
getName());
640 LOGF(info,
"Number of chips per petal VD: ");
644 LOGF(info,
"Number of staves per layer MLOT: ");
646 std::string mlot =
"";
647 mlot = (
i < 5) ?
"ML" :
"OT";
652 std::cout <<
"mLastChipIndex = [";
659 std::cout <<
"]" << std::endl;
660 std::cout <<
"mLastChipIndexVD = [";
667 std::cout <<
"]" << std::endl;
Static class with identifiers, bitmasks and names for ALICE detectors.
const char * getName() const
int mSize
prebooked number of sensors
const MatrixCache< Mat3D > & getCacheL2G() const
static const char * getTRKPetalDiskPattern()
static const char * composeSymNameLayer(int d, int layer)
static const char * getTRKStavePattern()
int getPetalCase(int index) const
static const char * getTRKChipPattern()
std::vector< int > mNumberOfChipsPerLayerVD
number of chips per layer VD ( = number of petals)
static std::string sVolumeName
int getSubDetID(int index) const
std::array< char, MAXLAYERS > mLayerToWrapper
Layer to wrapper correspondence.
static std::string sPetalLayerName
void PrintChipID(int index, int subDetID, int petalcase, int disk, int lay, int stave, int indexRetrieved) const
static const char * getTRKSensorPattern()
static std::string sStaveName
int extractNumberOfChipsPerPetalVD() const
bool getChipID(int index, int &subDetID, int &petalcase, int &disk, int &lay, int &stave) const
static const char * getTRKPetalLayerPattern()
int extractNumberOfLayersMLOT()
Determines the number of active parts in the Geometry.
std::vector< int > mNumbersOfChipPerDiskVD
numbersOfChipPerDiskVD
std::vector< int > mNumberOfStaves
Number Of Staves per layer in ML/OT.
Int_t mNumberOfPetalsVD
number of Petals = chip in each VD layer
std::vector< int > mLastChipIndexVD
max ID of the detctor in the layer for the VD
static std::string sPetalName
int extractNumberOfStavesMLOT(int lay) const
static const char * composeSymNameChip(int d, int lr)
static std::string sPetalDiskName
void Print(Option_t *opt="") const
int getLayer(int index) const
static const char * getTRKWrapVolPattern()
TString getMatrixPath(int index) const
int getNumberOfChips() const
static const char * getTRKLayerPattern()
int getFirstChipIndex(int lay, int petalcase, int subDetID) const
o2::math_utils::Transform3D Mat3D
static std::string sWrapperVolumeName
Wrapper volume name.
int extractNumberOfLayersVD() const
std::vector< int > mNumberOfChipsPerPetalVD
numbersOfChipPerPetalVD
std::vector< int > mLastChipIndex
max ID of the detctor in the petal(VD) or layer(MLOT)
static std::string sChipName
static std::string sSensorName
std::vector< int > mLastChipIndexMLOT
max ID of the detctor in the layer for the MLOT
void fillMatrixCache(int mask)
static std::string sLayerName
int extractNumberOfActivePartsVD() const
static const char * composeSymNameSensor(int d, int layer)
int extractNumberOfDisksVD() const
static const char * getTRKPetalPattern()
Int_t mNumberOfActivePartsVD
number of layers
std::vector< int > mNumberOfChipsPerLayerMLOT
number of chips per layer MLOT ( = 1 for the moment)
Int_t mNumberOfDisksVD
number of Disks = 6
Int_t mNumberOfLayersMLOT
number of layers
int getChipIndex(int subDetID, int petalcase, int disk, int lay, int stave) const
int getStave(int index) const
static const char * getTRKVolPattern()
static const char * composeSymNameStave(int d, int layer)
int getDisk(int index) const
static const char * composeSymNameTRK(int d)
int extractNumberOfPetalsVD() const
int extractVolumeCopy(const char *name, const char *prefix) const
Extract number following the prefix in the name string.
void Build(int loadTrans)
Int_t mNumberOfLayersVD
number of layers
GeometryTGeo(bool build=false, int loadTrans=0)
TGeoHMatrix * extractMatrixSensor(int index) const
GLuint const GLchar * name
GLsizei const GLchar *const * path
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"