Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Detector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
LHCb
Detector
Merge requests
!158
Changes to support complete use of RICH PMTs/panels in the reco
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Changes to support complete use of RICH PMTs/panels in the reco
jonrob/Detector:implement-detectionPoint-dd4hep
into
master
Overview
1
Commits
4
Pipelines
6
Changes
3
Merged
Christopher Rob Jones
requested to merge
jonrob/Detector:implement-detectionPoint-dd4hep
into
master
3 years ago
Overview
1
Commits
4
Pipelines
6
Changes
3
Expand
Supports changes in
LHCb!3454 (merged)
Edited
3 years ago
by
Christopher Rob Jones
0
0
Merge request reports
Viewing commit
2d9331ab
Prev
Next
Show latest version
3 files
+
85
−
76
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
2d9331ab
Move Rich param<TYPE>(name) method to Utilities.h
· 2d9331ab
Christopher Rob Jones
authored
3 years ago
Detector/Rich/include/Detector/Rich/DeRich.h
+
1
−
46
Options
@@ -17,7 +17,6 @@
#include
<cstdint>
#include
<string>
#include
<type_traits>
#include
<unordered_map>
#include
<utility>
namespace
LHCb
::
Detector
{
@@ -51,51 +50,7 @@ namespace LHCb::Detector {
// mimic 'param' method from DetDesc
template
<
typename
TYPE
>
inline
auto
param
(
std
::
string
name
)
const
{
// temporary work around for different parameter names between DetDesc and dd4hep.
// To be removed once DetDesc is gone, and then the names passed should be updated
// to be the dd4hep ones.
using
NameMap
=
std
::
unordered_map
<
std
::
string
,
std
::
string
>
;
const
NameMap
name_map
=
//
{{
"Rich1GasQuartzWindowThickness"
,
"Rh1QuartzWindowZSize"
},
{
"Rich2GasQuartzWindowThickness"
,
"Rh2QuartzWindowSizeZ"
},
{
"SellC4F10F1Param"
,
"SellC4F10F1"
},
{
"SellC4F10F2Param"
,
"SellC4F10F2"
},
{
"SellC4F10E1Param"
,
"SellC4F10E1"
},
{
"SellC4F10E2Param"
,
"SellC4F10E2"
},
{
"SellCF4F1Param"
,
"SellCF4F1"
},
{
"SellCF4F2Param"
,
"SellCF4F2"
},
{
"SellCF4E1Param"
,
"SellCF4E1"
},
{
"SellCF4E2Param"
,
"SellCF4E2"
},
{
"GasMolWeightC4F10Param"
,
"GasMolWeightC4F10"
},
{
"GasMolWeightCF4Param"
,
"GasMolWeightCF4"
},
{
"RhoEffectiveSellC4F10Param"
,
"RhoEffectiveSellC4F10"
},
{
"RhoEffectiveSellCF4Param"
,
"GasRhoCF4atSTP"
},
// double check this one
{
"SellLorGasFacParam"
,
"SellLorGasFac"
}};
const
auto
mapped_name
=
name_map
.
find
(
name
);
if
(
mapped_name
!=
name_map
.
end
()
)
{
name
=
mapped_name
->
second
;
}
// convert template type to irritating dd4hep syntax...
try
{
if
constexpr
(
std
::
is_arithmetic_v
<
TYPE
>
)
{
// deal with really (really) annoying units mis-match between dd4hep and everyone else
// to be removed once the units are corrected 'at source' to be the expected Gaudi ones.
using
ScaleMap
=
std
::
unordered_map
<
std
::
string
,
TYPE
>
;
const
ScaleMap
scale_map
=
{
{
"Rh1QuartzWindowZSize"
,
TYPE
(
10
)},
// cm -> mm
{
"Rh2QuartzWindowSizeZ"
,
TYPE
(
10
)},
// cm -> mm
};
const
auto
scale
=
scale_map
.
find
(
name
);
const
auto
F
=
(
scale
==
scale_map
.
end
()
?
TYPE
(
1
)
:
scale
->
second
);
if
constexpr
(
std
::
is_integral_v
<
TYPE
>
)
{
return
F
*
dd4hep
::
_toInt
(
name
.
c_str
()
);
}
if
constexpr
(
std
::
is_same_v
<
double
,
TYPE
>
)
{
return
F
*
dd4hep
::
_toDouble
(
name
.
c_str
()
);
}
if
constexpr
(
std
::
is_same_v
<
float
,
TYPE
>
)
{
return
F
*
dd4hep
::
_toFloat
(
name
.
c_str
()
);
}
}
if
constexpr
(
std
::
is_same_v
<
std
::
string
,
TYPE
>
)
{
return
dd4hep
::
_toString
(
name
.
c_str
()
);
}
// compiler error if we get here ...
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cerr
<<
"ERROR : Cannot load parameter '"
<<
name
<<
"' as type '"
<<
dd4hep
::
typeName
(
typeid
(
TYPE
)
)
<<
"' : "
<<
e
.
what
()
<<
std
::
endl
;
throw
e
;
}
return
dd4hep_param
<
TYPE
>
(
std
::
move
(
name
)
);
}
};
Loading