Skip to content
Snippets Groups Projects
Commit 44481679 authored by Lukas Chlad's avatar Lukas Chlad Committed by Florian Uhlig
Browse files

Fix FSD hit position

It was found that in ideal digitization and hit production the points position do not match hits position. This was caused by missing the rotation information in the previous FsdGeoHandler implementation. Now this issue is fixed using correction here
parent 7154c397
No related branches found
No related tags found
1 merge request!1564Fix FSD hit position
Pipeline #26403 passed
......@@ -14,6 +14,7 @@
#include <TGeoMatrix.h> // for TGeoMatrix
#include <TGeoNode.h> // for TGeoIterator, TGeoNode
#include <TGeoVolume.h> // for TGeoVolume
#include <TVector3.h> // for TVector3
#include <TVirtualMC.h> // for TVirtualMC, gMC
#include <string> // for operator<, stoul
......@@ -37,6 +38,7 @@ void CbmFsdGeoHandler::InitMaps()
TGeoIterator geoIterator(gGeoManager->GetTopNode()->GetVolume());
TGeoNode* curNode;
TGeoCombiTrans* unitToGlobalMatrix = nullptr;
geoIterator.Reset(); // safety to reset to "cave" befor the loop starts
while ((curNode = geoIterator())) {
TString nodePath;
......@@ -50,6 +52,9 @@ void CbmFsdGeoHandler::InitMaps()
if (nodeName.Contains(fUnitStr)) {
currentUnitId = curNode->GetNumber();
const TGeoMatrix* curUnitMatrix = geoIterator.GetCurrentMatrix();
unitToGlobalMatrix = new TGeoCombiTrans(*(curUnitMatrix));
CbmFsdUnitSpecs* unitSpecs = new CbmFsdUnitSpecs();
unitSpecs->fUnitId = currentUnitId;
unitSpecs->fUnitName = static_cast<TString>(curNode->GetVolume()->GetName());
......@@ -58,8 +63,14 @@ void CbmFsdGeoHandler::InitMaps()
}
if (nodeName.Contains(fModuleStr)) {
currentModuleId = curNode->GetNumber();
const TGeoMatrix* curMatrix = geoIterator.GetCurrentMatrix();
const Double_t* curNodeTr = curMatrix->GetTranslation();
TGeoMatrix* moduleToUnitMatrix = curNode->GetMatrix();
TVector3 localModuleCoord(moduleToUnitMatrix->GetTranslation());
TVector3 globalModuleCoord;
if (!unitToGlobalMatrix) {
LOG(fatal) << "No parent (unit) matrix initialized!!";
}
unitToGlobalMatrix->LocalToMaster(&localModuleCoord[0], &globalModuleCoord[0]);
TGeoVolume* curScintillator = nullptr;
for (int idn = 0; idn < curNode->GetNdaughters(); idn++) {
......@@ -72,9 +83,9 @@ void CbmFsdGeoHandler::InitMaps()
const TGeoBBox* shape = (const TGeoBBox*) (curScintillator->GetShape());
CbmFsdModuleSpecs* moduleSpecs = new CbmFsdModuleSpecs();
moduleSpecs->fX = curNodeTr[0];
moduleSpecs->fY = curNodeTr[1];
moduleSpecs->fZ = curNodeTr[2];
moduleSpecs->fX = globalModuleCoord[0];
moduleSpecs->fY = globalModuleCoord[1];
moduleSpecs->fZ = globalModuleCoord[2];
moduleSpecs->dX = shape->GetDX();
moduleSpecs->dY = shape->GetDY();
moduleSpecs->dZ = shape->GetDZ();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment