Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
athena
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
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
Shaun Roe
athena
Commits
336f7533
Commit
336f7533
authored
3 years ago
by
Walter Lampl
Browse files
Options
Downloads
Patches
Plain Diff
Make StandardCellWeightCalib.py CA-compatible
parent
44e7ffb4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Calorimeter/CaloClusterCorrection/python/StandardCellWeightCalib.py
+53
-21
53 additions, 21 deletions
...r/CaloClusterCorrection/python/StandardCellWeightCalib.py
with
53 additions
and
21 deletions
Calorimeter/CaloClusterCorrection/python/StandardCellWeightCalib.py
+
53
−
21
View file @
336f7533
...
...
@@ -5,9 +5,12 @@
#--
#-- Note the input for this calibration is jet driven. The fitted default
#Remark: This code is supposed to work with both old-style config and ComponentAccumulator based config.
#CA-based config is assumed if the additional parameter 'flags' is set to a AthConfigFlags container (and not None)
from
AthenaConfiguration.ComponentFactory
import
CompFactory
from
AthenaCommon.Logging
import
logging
from
AthenaCommon.GlobalFlags
import
globalflags
_logger
=
logging
.
getLogger
(
'
Calorimeter::StandardCellWeightCalibration
'
)
...
...
@@ -96,15 +99,22 @@ class H1Calibration(object):
# folder overriding -----------------------
forceOverrideFolder
=
False
@staticmethod
def
overrideFolder
():
return
H1Calibration
.
forceOverrideFolder
or
globalflags
.
DataSource
()
!=
"
data
"
def
overrideFolder
(
flags
=
None
):
if
flags
is
None
:
#Assume non-CA case, old-style config flags
from
AthenaCommon.GlobalFlags
import
globalflags
isMC
=
(
globalflags
.
DataSource
()
!=
"
data
"
)
else
:
isMC
=
flags
.
isMC
return
H1Calibration
.
forceOverrideFolder
or
isMC
#--
#-- Helper functions to access DB parameters. Note that providing a dbtag (like from JetCalibrationDBTag)
#-- overwrites the default tag extracted from the detector description version
#--
@staticmethod
def
calibration_dict
(
dbtag
=
""
):
def
calibration_dict
(
dbtag
=
""
,
flags
=
None
):
#-- DB tag provided
if
dbtag
!=
""
:
calibdic
=
{
...
...
@@ -120,8 +130,15 @@ class H1Calibration(object):
return
calibdic
#-- default extraction
else
:
from
AthenaCommon.GlobalFlags
import
globalflags
ddv
=
globalflags
.
DetDescrVersion
()
if
flags
is
None
:
#Assume non-CA case, old-style config flags
from
AthenaCommon.GlobalFlags
import
globalflags
ddv
=
globalflags
.
DetDescrVersion
()
else
:
#Assume ComponentAccumulator case
ddv
=
flags
.
GeoModel
.
AtlasVersion
#-- establish relation between detector description and calibration
if
ddv
.
startswith
(
"
ATLAS-CSC
"
):
if
ddv
>=
"
ATLAS-CSC-01-00-01
"
:
...
...
@@ -196,7 +213,7 @@ class H1Calibration(object):
H1Calibration
.
loaded_folder
.
append
(
(
folder
,
tag
)
)
def
getCellWeightTool
(
finder
=
"
Cone
"
,
mainparam
=
0.4
,
input
=
"
Topo
"
,
onlyCellWeight
=
False
):
def
getCellWeightTool
(
finder
=
"
Cone
"
,
mainparam
=
0.4
,
input
=
"
Topo
"
,
onlyCellWeight
=
False
,
flags
=
None
):
"""
Returns a fully configured H1-style cell weighting calibration tool. This tool only uses cell weights!
Parameters/type:
...
...
@@ -205,17 +222,32 @@ def getCellWeightTool(finder="Cone",mainparam=0.4,input="Topo", onlyCellWeight=F
mainparam/float: size parameter for jet
"""
H1WeightToolCSC12Generic
=
CompFactory
.
H1WeightToolCSC12Generic
# CaloClusterCorrection
if
globalflags
.
DataSource
()
==
'
data
'
:
isMC
=
False
else
:
isMC
=
True
#-- DB access
(
key
,
folder
,
tag
)
=
H1Calibration
.
getCalibDBParams
(
finder
,
mainparam
,
input
,
onlyCellWeight
,
isMC
)
H1Calibration
.
loadCaloFolder
(
folder
,
tag
,
isMC
)
#-- configure tool
toolName
=
finder
+
editParm
(
mainparam
)
+
input
cellcalibtool
=
H1WeightToolCSC12Generic
(
"
H1Weight
"
+
toolName
)
cellcalibtool
.
DBHandleKey
=
key
# --
return
cellcalibtool
if
flags
is
None
:
#old-style case
from
AthenaCommon.GlobalFlags
import
globalflags
isMC
=
globalflags
.
DataSource
()
!=
'
data
'
#-- DB access
(
key
,
folder
,
tag
)
=
H1Calibration
.
getCalibDBParams
(
finder
,
mainparam
,
input
,
onlyCellWeight
,
isMC
)
H1Calibration
.
loadCaloFolder
(
folder
,
tag
,
isMC
)
#-- configure tool
toolName
=
finder
+
editParm
(
mainparam
)
+
input
cellcalibtool
=
H1WeightToolCSC12Generic
(
"
H1Weight
"
+
toolName
)
cellcalibtool
.
DBHandleKey
=
key
# --
return
cellcalibtool
else
:
#ComponentAccumulator case
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
result
=
ComponentAccumulator
()
(
key
,
folder
,
tag
)
=
H1Calibration
.
getCalibDBParams
(
finder
,
mainparam
,
input
,
onlyCellWeight
,
flags
.
isMC
)
from
IOVDbSvc.IOVDbSvcConfig
import
addFolders
result
.
merge
(
addFolders
(
flags
,
folder
,
'
CALO_OFL
'
if
flags
.
isMC
else
'
CALO
'
,
className
=
'
CaloRec::ToolConstants
'
,
tag
=
tag
if
H1Calibration
.
overrideFolder
()
else
None
))
#-- configure tool
toolName
=
finder
+
editParm
(
mainparam
)
+
input
cellcalibtool
=
H1WeightToolCSC12Generic
(
"
H1Weight
"
+
toolName
)
cellcalibtool
.
DBHandleKey
=
key
result
.
setPrivateAlgTools
(
cellcalibtool
)
return
result
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