Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
athena
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
atlas
athena
Commits
a69f6e55
Commit
a69f6e55
authored
1 year ago
by
Johannes Junggeburth
Browse files
Options
Downloads
Patches
Plain Diff
Fix BMG cut tubes
parent
7997a647
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!68867
MdtSensitiveDetectorsR4 --- Fix BMG cut tubes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MuonSpectrometer/MuonPhaseII/MuonG4/MuonSensitiveDetectorsR4/src/MdtSensitiveDetector.cxx
+20
-22
20 additions, 22 deletions
...nG4/MuonSensitiveDetectorsR4/src/MdtSensitiveDetector.cxx
with
20 additions
and
22 deletions
MuonSpectrometer/MuonPhaseII/MuonG4/MuonSensitiveDetectorsR4/src/MdtSensitiveDetector.cxx
+
20
−
22
View file @
a69f6e55
/*
Copyright (C) 2002-202
3
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-202
4
CERN for the benefit of the ATLAS collaboration
*/
#include
"MuonSensitiveDetectorsR4/Utils.h"
...
...
@@ -138,33 +138,29 @@ Identifier MdtSensitiveDetector::getIdentifier(const MuonGMR4::MdtReadoutElement
const
Amg
::
Transform3D
localToGlobal
{
getTransform
(
touchHist
,
0
)};
/// The Geant transform takes a hit global -> local --> inverse goes back to the global system
/// Compose this one with the global to local transformation of the first tube in the layer -->
const
Amg
::
Vector3D
refTubePos
=
(
readOutEle
->
globalToLocalTrans
(
m_gctx
,
readOutEle
->
measurementHash
(
1
,
1
))
*
localToGlobal
).
translation
();
Amg
::
Vector3D
refTubePos
=
(
readOutEle
->
globalToLocalTrans
(
m_gctx
,
readOutEle
->
measurementHash
(
1
,
1
))
*
localToGlobal
).
translation
();
ATH_MSG_VERBOSE
(
"Position of the tube wire w.r.t. the first tube in the multi layer "
<<
Amg
::
toString
(
refTubePos
,
2
));
/// equilateral triangle
static
const
double
layerPitch
=
1.
/
std
::
sin
(
60
*
Gaudi
::
Units
::
deg
);
const
int
layer
=
std
::
round
(
refTubePos
.
x
()
*
layerPitch
/
readOutEle
->
tubePitch
())
+
1
;
unsigned
int
tube
=
std
::
round
(
refTubePos
.
y
()
/
readOutEle
->
tubePitch
())
+
1
;
tube
=
std
::
min
(
readOutEle
->
numTubesInLay
(),
tube
);
/// It can happen that the tube is assigned to zero by numerical precision
/// Catch these cases if the layer is fine
if
(
tube
==
0
&&
layer
>=
1
)
{
const
Amg
::
Vector3D
tubeInLay
=
(
readOutEle
->
globalToLocalTrans
(
m_gctx
,
readOutEle
->
measurementHash
(
layer
,
1
))
*
localToGlobal
).
translation
();
if
(
tubeInLay
.
perp
()
<=
readOutEle
->
tubeRadius
())
tube
=
1
;
}
if
(
layer
<=
0
||
tube
<=
0
)
{
if
(
layer
<=
0
)
{
ATH_MSG_FATAL
(
__FILE__
<<
":"
<<
__LINE__
<<
" It seems that the tube position "
<<
Amg
::
toString
(
refTubePos
,
2
)
<<
", perp: "
<<
refTubePos
.
perp
()
<<
" is outside of the volume envelope "
<<
m_detMgr
->
idHelperSvc
()
->
toStringDetEl
(
readOutEle
->
identify
())
<<
". "
<<
"Layer: "
<<
layer
<<
", tube: "
<<
tube
<<
","
<<
touchHist
->
GetVolume
(
2
)
->
GetName
());
<<
Amg
::
toString
(
refTubePos
,
2
)
<<
", perp: "
<<
refTubePos
.
perp
()
<<
" is outside of the volume envelope "
<<
m_detMgr
->
idHelperSvc
()
->
toStringDetEl
(
readOutEle
->
identify
())
<<
". "
);
throw
std
::
runtime_error
(
"Tube hit in Nirvana"
);
}
const
Amg
::
Transform3D
closureCheck
{
readOutEle
->
globalToLocalTrans
(
m_gctx
,
readOutEle
->
measurementHash
(
layer
,
tube
))
*
localToGlobal
};
/// Update the reference tube position to be in the proper layer
refTubePos
=
(
readOutEle
->
globalToLocalTrans
(
m_gctx
,
readOutEle
->
measurementHash
(
layer
,
1
))
*
localToGlobal
).
translation
();
const
double
tubePitches
=
refTubePos
.
y
()
/
readOutEle
->
tubePitch
();
unsigned
int
tube
=
std
::
round
(
tubePitches
)
+
1
;
tube
=
std
::
max
(
1u
,
std
::
min
(
readOutEle
->
numTubesInLay
(),
tube
));
/// It can happen that the tube is assigned to zero by numerical precision
/// Catch these cases if the layer is fine
const
Amg
::
Transform3D
closureCheck
{
readOutEle
->
globalToLocalTrans
(
m_gctx
,
readOutEle
->
measurementHash
(
layer
,
tube
))
*
localToGlobal
};
if
(
!
Amg
::
isIdentity
(
closureCheck
))
{
ATH_MSG_
VERBOSE
(
"Correction needed "
<<
layer
<<
","
<<
tube
<<
" "
<<
Amg
::
toString
(
closureCheck
));
ATH_MSG_
WARNING
(
"Correction needed "
<<
layer
<<
","
<<
tube
<<
" "
<<
Amg
::
toString
(
closureCheck
));
if
(
closureCheck
.
translation
().
y
()
>
0
)
++
tube
;
else
--
tube
;
}
...
...
@@ -178,8 +174,10 @@ Identifier MdtSensitiveDetector::getIdentifier(const MuonGMR4::MdtReadoutElement
<<
Amg
::
toString
(
refTubePos
,
2
)
<<
", perp: "
<<
refTubePos
.
perp
()
<<
" is outside of the volume envelope "
<<
m_detMgr
->
idHelperSvc
()
->
toStringDetEl
(
readOutEle
->
identify
())
<<
". "
<<
"Layer: "
<<
layer
<<
", tube: "
<<
tube
<<
Amg
::
toString
(
closureCheck
));
<<
"Layer: "
<<
layer
<<
", tube: "
<<
tube
<<
" "
<<
Amg
::
toString
(
closureCheck
)
<<
"tube volume : "
<<
touchHist
->
GetVolume
(
0
)
->
GetName
()
<<
" mdt chamber: "
<<
touchHist
->
GetVolume
(
2
)
->
GetName
());
throw
std
::
runtime_error
(
"Tube hit in Nirvana"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment