diff --git a/core/detectors/trd/CbmTrdGeoHandler.cxx b/core/detectors/trd/CbmTrdGeoHandler.cxx index ed59e65ece82512b3d67b76ee7bb46a80047da93..ffd6b0b1119e72684d9bbc704b876e57f71fd7dd 100644 --- a/core/detectors/trd/CbmTrdGeoHandler.cxx +++ b/core/detectors/trd/CbmTrdGeoHandler.cxx @@ -58,14 +58,30 @@ Int_t CbmTrdGeoHandler::GetModuleAddress() // In the simulation we get the correct information only from gMC Int_t copyNr; if (fIsSimulation) { - LOG(debug4) << gMC->CurrentVolPath(); // get the copy number of the mother volume (1 volume up in hierarchy) gMC->CurrentVolOffID(1, copyNr); + // Check if the geometry is legacy version + string s(gMC->CurrentVolPath()); + if (s.find("Volume") < s.size()) { // new geometry format + LOG(debug4) << "New geo " << gMC->CurrentVolPath(); + // get the copy number of the mother volume (2 volume up in hierarchy) + gMC->CurrentVolOffID(2, copyNr); + } + else + LOG(debug4) << "Legacy geo " << gMC->CurrentVolPath(); } else { - LOG(debug4) << gGeoManager->GetPath(); + // Check if the geometry is legacy version + int nodeIdx(1); + string s(gGeoManager->GetPath()); + if (s.find("Volume") < s.size()) { // new geometry format + LOG(debug4) << "New geo " << s; + nodeIdx++; + } + else + LOG(debug4) << "Legacy geo " << s; // We take the mother node (module) of the current node we are in (gas). - TGeoNode* node = gGeoManager->GetMother(); + TGeoNode* node = gGeoManager->GetMother(nodeIdx); // Get the module copy number to get the information about layerId and moduleId. copyNr = node->GetNumber(); } @@ -189,7 +205,7 @@ Int_t CbmTrdGeoHandler::GetModuleCopyNr(const TString& path) void CbmTrdGeoHandler::NavigateTo(const TString& path) { - // LOG(info)<< "path : " << path.Data(); + LOG(debug) << "CbmTrdGeoHandler::NavigateTo(" << path.Data() << ")"; if (fIsSimulation) { LOG(fatal) << "This method is not supported in simulation mode"; } else { gGeoManager->cd(path.Data()); @@ -199,9 +215,18 @@ void CbmTrdGeoHandler::NavigateTo(const TString& path) Double_t local[3] = {0., 0., 0.}; // Local center of volume gGeoManager->LocalToMaster(local, fGlobal); fGlobalMatrix = gGeoManager->GetCurrentMatrix(); - + int nodeIdx(1); + string s(gGeoManager->GetPath()); + if (s.find("Volume") < s.size()) { // new geometry format + LOG(debug) << "CbmTrdGeoHandler::NavigateTo(new geo)"; + nodeIdx++; + } + // We take the mother node (module) of the current node we are in (gas). + TGeoNode* modulenode = gGeoManager->GetMother(nodeIdx); + // We take the mother of the mother node (layer) of the current node we are in (gas). + TGeoNode* layernode = gGeoManager->GetMother(nodeIdx + 1); // get layer // Get module type information which is decoded in copy number. - std::string moduleName = gGeoManager->GetMother()->GetName(); + std::string moduleName = modulenode->GetName(); auto typeposstart = moduleName.find("module") + 6; uint ndigits = 0; auto partoftype = moduleName.at(typeposstart); @@ -210,16 +235,14 @@ void CbmTrdGeoHandler::NavigateTo(const TString& path) ++ndigits; } fModuleType = std::atoi(moduleName.substr(typeposstart, ndigits).data()); // 6th element+ module type - // We take the mother of the mother node (layer) of the current node we are in (gas). - TGeoNode* layernode = gGeoManager->GetMother(2); // get layer + // TODO hybrid semaphore for TRD2D + if (nodeIdx == 2 && fModuleType == 1) fModuleType = 9; Int_t layercopyNr = layernode->GetNumber(); // fIsRotated is the 4th digit from the back fStation = ((layercopyNr / 10000) % 10); // from layer copy number // LOG(info) << "DE fStation: " << fStation << " "; fLayer = ((layercopyNr / 100) % 10); // from layer copy number - // We take the mother node (module) of the current node we are in (gas). - TGeoNode* modulenode = gGeoManager->GetMother(); // Get the module copy number to get the information about layerId and moduleId. Int_t modulecopyNr = modulenode->GetNumber(); diff --git a/core/detectors/trd/CbmTrdParModDigi.cxx b/core/detectors/trd/CbmTrdParModDigi.cxx index 29ce3c4ee229e4e6ca648c441eb6ffd6dc3d485c..9795e2b1ca9bfc8347e48eee561cecbf79f1931e 100644 --- a/core/detectors/trd/CbmTrdParModDigi.cxx +++ b/core/detectors/trd/CbmTrdParModDigi.cxx @@ -404,15 +404,15 @@ Bool_t CbmTrdParModDigi::GetPadInfo(const Double_t* local_point, Int_t& sectorId { // check, if the input is within the allowed range if (fabs(local_point[0]) > fSizeX) { - LOG(error) << "CbmTrdParModDigi::GetPadInfo - local point x must be within " - "gas volume, x=" - << std::setprecision(8) << local_point[0] << " fSizeX=" << std::setprecision(8) << fSizeX; + LOG(warn) << "CbmTrdParModDigi::GetPadInfo - local point x must be within " + "gas volume, x=" + << std::setprecision(8) << local_point[0] << " fSizeX=" << std::setprecision(8) << fSizeX; return kFALSE; } if (fabs(local_point[1]) > fSizeY) { - LOG(error) << "CbmTrdParModDigi::GetPadInfo - local point y must be within " - "gas volume, y=" - << std::setprecision(8) << local_point[1] << " fSizeY=" << std::setprecision(8) << fSizeY; + LOG(warn) << "CbmTrdParModDigi::GetPadInfo - local point y must be within " + "gas volume, y=" + << std::setprecision(8) << local_point[1] << " fSizeY=" << std::setprecision(8) << fSizeY; return kFALSE; } diff --git a/core/detectors/trd/CbmTrdParSetGeo.cxx b/core/detectors/trd/CbmTrdParSetGeo.cxx index 39e099fea55a0b41d60ba54b0ffb2fb475a7f2c2..0f367d6e779135efe2d4b8ba303e9a63ef345e6a 100644 --- a/core/detectors/trd/CbmTrdParSetGeo.cxx +++ b/core/detectors/trd/CbmTrdParSetGeo.cxx @@ -58,18 +58,24 @@ bool CbmTrdParSetGeo::Init() TObjArray* modules = layer->GetNodes(); for (Int_t iModule = 0; iModule < modules->GetEntriesFast(); iModule++) { TGeoNode* module = static_cast<TGeoNode*>(modules->At(iModule)); + TString path = TString("/") + topNode->GetName() + "/" + station->GetName() + "/" + layer->GetName() + "/" + + module->GetName(); TObjArray* parts = module->GetNodes(); for (Int_t iPart = 0; iPart < parts->GetEntriesFast(); iPart++) { TGeoNode* part = static_cast<TGeoNode*>(parts->At(iPart)); - if (!TString(part->GetName()).Contains("gas", TString::kIgnoreCase)) continue; // only active gas volume - // Put together the full path to the interesting volume, which // is needed to navigate with the geomanager to this volume. // Extract the geometry information (size, global position) // from this volume. - TString path = TString("/") + topNode->GetName() + "/" + station->GetName() + "/" + layer->GetName() + "/" - + module->GetName() + "/" + part->GetName(); - + if (TString(part->GetName()).Contains("gas", TString::kIgnoreCase)) { + // legacy naming convention for the active volume + path += Form("/%s", part->GetName()); + } + else if (TString(part->GetName()).Contains("Volume", TString::kIgnoreCase)) { + path += Form("/%s/gas_0", part->GetName()); + } + else + continue; // only active gas volume LOG(debug) << "Adding detector with path " << path.Data(); // Generate a physical node which has all needed information gGeoManager->cd(path.Data()); diff --git a/external/InstallGeometry.cmake b/external/InstallGeometry.cmake index 1593139294f2085c6258e8a066f72a52813d33c5..4f128189ab3b9f6cb62045e1baf271fa65ada5d6 100644 --- a/external/InstallGeometry.cmake +++ b/external/InstallGeometry.cmake @@ -1,4 +1,4 @@ -set(GEOMETRY_VERSION 96614cc81fb98a48ef05a66dcbaf897fe65ab42e) +set(GEOMETRY_VERSION 0468ee66532f92d2e9697b411e6fa9b489b1f0aa) set(GEOMETRY_SRC_URL "https://git.cbm.gsi.de/CbmSoft/cbmroot_geometry.git") diff --git a/external/InstallParameter.cmake b/external/InstallParameter.cmake index 8e6a6ce657c485f5b921f9870952aebc113b8552..b641940c3fe141cfe6a29d686a93bcdb040645f3 100644 --- a/external/InstallParameter.cmake +++ b/external/InstallParameter.cmake @@ -1,4 +1,4 @@ -set(PARAMETER_VERSION dc2b38b948f6df30685d616a000efe917a8bc800) +set(PARAMETER_VERSION ecf5ec6b427b30eaa3868e19a37776865f673e03) set(PARAMETER_SRC_URL "https://git.cbm.gsi.de/CbmSoft/cbmroot_parameter.git") diff --git a/sim/detectors/trd/CbmTrdDigitizer.cxx b/sim/detectors/trd/CbmTrdDigitizer.cxx index 651365f850533467794ca793d0c3a6923c7a40d9..e3469521d8b72cc82a56fd6616e919ab69f2d091 100644 --- a/sim/detectors/trd/CbmTrdDigitizer.cxx +++ b/sim/detectors/trd/CbmTrdDigitizer.cxx @@ -302,7 +302,10 @@ CbmTrdModuleSim* CbmTrdDigitizer::AddModule(Int_t detId) * is then stored in a CbmTrdModule object for each of the TRD modules. **/ - const char* path = gGeoManager->GetPath(); + const TString& path = gGeoManager->GetPath(); // decouple the local path variable from gGeoManager current path [AB] + LOG(debug) << GetName() << "::AddModule(" << path << ")" + << " det[" << detId << "]"; + CbmTrdGeoHandler geoHandler; Int_t moduleAddress = geoHandler.GetModuleAddress(path), moduleType = geoHandler.GetModuleType(path), orientation = geoHandler.GetModuleOrientation(path), lyId = CbmTrdAddress::GetLayerId(detId); @@ -311,8 +314,8 @@ CbmTrdModuleSim* CbmTrdDigitizer::AddModule(Int_t detId) << moduleAddress << ". Module init failed!"; return NULL; } - LOG(debug) << GetName() << "::AddModule(" << path << " " << (moduleType < 9 ? 'R' : 'T') << "] mod[" << moduleAddress - << "] ly[" << lyId << "] det[" << detId << "]"; + LOG(debug) << GetName() << "::AddModule[" << (moduleType < 9 ? '1' : '2') << "D] address[" << moduleAddress << "] ly[" + << lyId << "]"; CbmTrdModuleSim* module(NULL); if (moduleType >= 9) { // temporary fix for TRD-2Dh @ mCBM 2021 @@ -399,8 +402,8 @@ CbmTrdModuleSim* CbmTrdDigitizer::AddModule(Int_t detId) // try to load Gain parameters for module const CbmTrdParModGain* pGain(NULL); if (!fGainPar || !(pGain = (const CbmTrdParModGain*) fGainPar->GetModulePar(detId))) { - LOG(info) << GetName() << "::AddModule : No Gain params for module " << detId << " @ " << path - << ". Using default."; + LOG(debug) << GetName() << "::AddModule : No Gain params for module " << detId << " @ " << path + << ". Using default."; } else module->SetGainPar(pGain); diff --git a/sim/detectors/trd/CbmTrdModuleSim2D.cxx b/sim/detectors/trd/CbmTrdModuleSim2D.cxx index 7881716c5424fe6861ebd719eb56a2c487b92bd0..eb96e40625d5ccb7c1eb02e3db93d7a1eaf275a6 100644 --- a/sim/detectors/trd/CbmTrdModuleSim2D.cxx +++ b/sim/detectors/trd/CbmTrdModuleSim2D.cxx @@ -317,9 +317,8 @@ Bool_t CbmTrdModuleSim2D::ScanPadPlane(Double_t* point, Double_t DX, Double_t EL Int_t sec(-1), col(-1), row(-1); fDigiPar->GetPadInfo(point, sec, col, row); if (sec < 0 || col < 0 || row < 0) { - LOG(error) << "CbmTrdModuleSim2D::ScanPadPlane: Hit to pad matching failed for [" << std::setprecision(5) - << point[0] << ", " << std::setprecision(5) << point[1] << ", " << std::setprecision(5) << point[2] - << "]."; + LOG(warn) << "CbmTrdModuleSim2D::ScanPadPlane: Hit to pad matching failed for [" << std::setprecision(5) << point[0] + << ", " << std::setprecision(5) << point[1] << ", " << std::setprecision(5) << point[2] << "]."; return kFALSE; } for (Int_t is(0); is < sec; is++)