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");
87 std::cout <<
"Layer MLOT: " <<
i << std::endl;
92 int numberOfChipsTotal = 0;
155 }
else if (subDetID == 1) {
172 }
else if (subDetID == 1) {
190 }
else if (subDetID == 1) {
223 }
else if (subDetID == 1) {
239 }
else if (subDetID == 1) {
266 int subDetID, petalcase, disk, lay, stave, halfstave;
267 getChipID(
index, subDetID, petalcase, disk, lay, stave, halfstave);
269 int indexRetrieved =
getChipIndex(subDetID, petalcase, disk, lay, stave, halfstave);
271 PrintChipID(
index, subDetID, petalcase, disk, lay, stave, halfstave, indexRetrieved);
274 TString
path =
"/cave_1/barrel_1/TRKV_2/TRKLayer0_1/TRKStave0_1/TRKChip0_1/TRKSensor0_1/";
332 static TGeoHMatrix matTmp;
341 matTmp = *gGeoManager->GetCurrentMatrix();
347 gGeoManager->PopPath();
349 static int chipInGlo{0};
370 LOG(warning) <<
"The method Build was not called yet";
378 LOGP(info,
"Loading {} L2G matrices from TGeo; there are {} matrices",
getName(),
mSize);
380 cacheL2G.setSize(
mSize);
384 cacheL2G.setMatrix(
Mat3D(*hm),
i);
415 if (!nms.BeginsWith(prefix)) {
418 nms.Remove(0, strlen(prefix));
419 if (!isdigit(nms.Data()[0])) {
428 int numberOfLayers = 0;
430 if (trkV ==
nullptr) {
436 TObjArray*
nodes = trkV->GetNodes();
438 int nNodes =
nodes->GetEntriesFast();
439 for (
int j = 0;
j < nNodes;
j++) {
441 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
442 const char*
name = nd->GetName();
446 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
452 LOG(fatal) <<
"Failed to extract wrapper ID from the " <<
name;
454 TObjArray* nodesW = nd->GetNodes();
455 int nNodesW = nodesW->GetEntriesFast();
457 for (
int jw = 0; jw < nNodesW; jw++) {
458 auto ndW =
dynamic_cast<TGeoNode*
>(nodesW->At(jw))->GetName();
461 LOGP(fatal,
"Failed to extract layer ID from wrapper volume '{}' from one of its nodes '{}'",
name, ndW);
469 return numberOfLayers;
476 int numberOfParts = 0;
479 if (vdV ==
nullptr) {
484 TObjArray*
nodes = vdV->GetNodes();
485 int nNodes =
nodes->GetEntriesFast();
486 for (
int j = 0;
j < nNodes;
j++) {
488 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
489 const char*
name = nd->GetName();
494 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
498 return numberOfParts;
505 int numberOfDisks = 0;
508 if (vdV ==
nullptr) {
513 TObjArray*
nodes = vdV->GetNodes();
514 int nNodes =
nodes->GetEntriesFast();
515 for (
int j = 0;
j < nNodes;
j++) {
517 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
518 const char*
name = nd->GetName();
523 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
527 return numberOfDisks;
534 int numberOfChips = 0;
537 if (vdV ==
nullptr) {
542 TObjArray*
nodes = vdV->GetNodes();
543 int nNodes =
nodes->GetEntriesFast();
544 for (
int j = 0;
j < nNodes;
j++) {
546 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
547 const char*
name = nd->GetName();
552 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
556 return numberOfChips;
563 int numberOfLayers = 0;
566 if (vdV ==
nullptr) {
571 TObjArray*
nodes = vdV->GetNodes();
572 int nNodes =
nodes->GetEntriesFast();
573 for (
int j = 0;
j < nNodes;
j++) {
575 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
576 const char*
name = nd->GetName();
581 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
585 return numberOfLayers;
592 int numberOfChips = 0;
595 if (vdV ==
nullptr) {
600 TObjArray*
nodes = vdV->GetNodes();
601 int nNodes =
nodes->GetEntriesFast();
602 for (
int j = 0;
j < nNodes;
j++) {
604 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
605 const char*
name = nd->GetName();
610 LOG(fatal) <<
"Failed to extract layer ID from the " <<
name;
614 return numberOfChips;
620 int numberOfStaves = 0;
623 TGeoVolume* layV = gGeoManager->GetVolume(layName.c_str());
625 if (layV ==
nullptr) {
630 TObjArray*
nodes = layV->GetNodes();
633 int nNodes =
nodes->GetEntriesFast();
635 for (
int j = 0;
j < nNodes;
j++) {
637 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
638 const char*
name = nd->GetName();
643 return numberOfStaves;
649 int numberOfHalfStaves = 0;
652 TGeoVolume* staveV = gGeoManager->GetVolume(staveName.c_str());
654 if (staveV ==
nullptr) {
659 TObjArray*
nodes = staveV->GetNodes();
662 int nNodes =
nodes->GetEntriesFast();
664 for (
int j = 0;
j < nNodes;
j++) {
665 auto nd =
dynamic_cast<TGeoNode*
>(
nodes->At(
j));
666 const char*
name = nd->GetName();
668 numberOfHalfStaves++;
671 return numberOfHalfStaves;
677 std::cout <<
"\nindex = " <<
index << std::endl;
678 std::cout <<
"subDetID = " << subDetID << std::endl;
679 std::cout <<
"petalcase = " << petalcase << std::endl;
680 std::cout <<
"layer = " << lay << std::endl;
681 std::cout <<
"disk = " << disk << std::endl;
682 std::cout <<
"first chip index = " <<
getFirstChipIndex(lay, petalcase, subDetID) << std::endl;
683 std::cout <<
"stave = " << stave << std::endl;
684 std::cout <<
"halfstave = " << halfstave << std::endl;
685 std::cout <<
"check index Retrieved = " << indexRetrieved << std::endl;
692 LOGF(info,
"Geometry not built yet!");
695 std::cout <<
"Detector ID: " << sInstance.get()->getDetID() << std::endl;
697 LOGF(info,
"Summary of GeometryTGeo: %s",
getName());
703 LOGF(info,
"Number of chips per petal VD: ");
707 LOGF(info,
"Number of staves and half staves per layer MLOT: ");
709 std::string mlot =
"";
710 mlot = (
i < 4) ?
"ML" :
"OT";
715 std::cout <<
"mLastChipIndex = [";
722 std::cout <<
"]" << std::endl;
723 std::cout <<
"mLastChipIndexVD = [";
730 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()
void PrintChipID(int index, int subDetID, int petalcase, int disk, int lay, int stave, int halfstave, int indexRetrieved) const
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
static const char * getTRKSensorPattern()
static std::string sStaveName
std::vector< int > mNumberOfHalfStaves
Number Of Staves in each stave of the layer in ML/OT.
int extractNumberOfChipsPerPetalVD() const
int extractNumberOfHalfStavesMLOT(int lay) const
static const char * getTRKPetalLayerPattern()
int getChipIndex(int subDetID, int petalcase, int disk, int lay, int stave, int halfstave) const
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
bool getChipID(int index, int &subDetID, int &petalcase, int &disk, int &lay, int &stave, int &halfstave) const
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 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
int getHalfStave(int index) const
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"