11 #include <FairLogger.h>
14 #include <TGeoManager.h>
15 #include <TGeoMatrix.h>
17 #include <TGeoVolume.h>
29 : fPixelPathToAddressMap()
30 , fPixelAddressToDataMap()
52 Double_t pmtHeight = 5.2;
53 Double_t pmtWidth = 5.2;
54 TGeoVolume* pmtVolume = gGeoManager->FindVolumeFast(
"pmt");
55 if (pmtVolume ==
nullptr)
56 pmtVolume = gGeoManager->FindVolumeFast(
58 if (pmtVolume !=
nullptr) {
59 const TGeoBBox*
shape = (
const TGeoBBox*) (pmtVolume->GetShape());
60 if (
shape !=
nullptr) {
61 pmtHeight = 2. *
shape->GetDY();
62 pmtWidth = 2. *
shape->GetDX();
66 TGeoIterator geoIterator(gGeoManager->GetTopNode()->GetVolume());
67 geoIterator.SetTopName(
"/cave_1");
70 TString pixelNameStr(
"pmt_pixel");
72 while ((curNode = geoIterator())) {
73 TString nodeName(curNode->GetName());
75 if (TString(curNode->GetVolume()->GetName()).Contains(pixelNameStr)) {
76 geoIterator.GetPath(nodePath);
77 const TGeoMatrix* curMatrix = geoIterator.GetCurrentMatrix();
78 const Double_t* curNodeTr = curMatrix->GetTranslation();
79 string path = string(nodePath.Data());
81 size_t pmtInd = path.find_last_of(
"/");
82 if (string::npos == pmtInd)
continue;
83 string pmtPath = path.substr(0, pmtInd + 1);
86 std::stoul(path.substr(pmtInd + 11));
87 Int_t posAtPmt = channel / 100;
88 channel = channel % 100;
90 size_t pmtVolInd = path.rfind(
"/", pmtInd - 1);
91 if (string::npos == pmtVolInd)
continue;
92 Int_t pmtPosBP = std::stoul(path.substr(
94 pmtInd - pmtVolInd - 11));
96 size_t bpInd = path.rfind(
"/", pmtVolInd - 1);
97 if (string::npos == bpInd)
continue;
98 Int_t posBP = std::stoul(path.substr(
100 pmtVolInd - bpInd - 14));
102 Int_t
x = (posBP / 10) + ((((pmtPosBP - 1) / 3) + 1) % 2);
103 Int_t
y = (posBP % 10) + (2 - ((pmtPosBP - 1) % 3));
105 Int_t DiRICH_Add = ((7 & 0xF) << 12) + ((
x & 0xF) << 8) + ((
y & 0xF) << 4)
107 Int_t pixelUID = ((DiRICH_Add << 16) | (channel & 0x00FF));
108 Int_t pmtUID = ((
x & 0xF) << 4) + (
y & 0xF);
113 pixelData->
fX = curNodeTr[0];
114 pixelData->
fY = curNodeTr[1];
115 pixelData->
fZ = curNodeTr[2];
118 pair<Int_t, CbmRichPixelData*>(pixelData->
fAddress, pixelData));
126 pmtData->
fId = pmtUID;
129 pmtData->
fWidth = pmtWidth;
131 pair<Int_t, CbmRichPmtData*>(pmtData->
fId, pmtData));
140 if (pmtData ==
nullptr || pmtId != pmtData->
fId) {
141 LOG(error) <<
"(pmtData == nullptr || pmtId != pmtData->fId) ";
147 <<
" pmtData->fId:" << pmtData->
fId
148 <<
" pmtPath:" << pmtPath << endl
164 if (pixelData ==
nullptr)
continue;
165 pmtData->
fX += pixelData->
fX;
166 pmtData->
fY += pixelData->
fY;
167 pmtData->
fZ += pixelData->
fZ;
174 LOG(info) <<
"CbmRichMCbmDigiMapManager is initialized";
175 LOG(info) <<
"fPixelPathToAddressMap.size() = "
177 LOG(info) <<
"fPixelAddressToDataMap.size() = "
190 std::map<string, Int_t>::iterator it;
199 std::map<Int_t, CbmRichPixelData*>::iterator it;
207 Int_t index = gRandom->Integer(nofPixels);
220 std::map<Int_t, CbmRichPmtData*>::iterator it;
228 std::vector<Int_t>
v;
235 std::vector<Int_t>
v;