Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DaVinci
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
Model registry
Operate
Environments
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
DaVinci
Commits
e6482bab
Commit
e6482bab
authored
3 years ago
by
Eduardo Rodrigues
Committed by
Patrick Koppenburg
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix ConfiguredMCTruthAndBkgCatAlg correctly propagating RootInTES
parent
af145852
No related branches found
No related tags found
2 merge requests
!1103
Draft: Add AnalysisHelpers to DaVinci Stack
,
!640
Fix ConfiguredMCTruthAndBkgCatAlg correctly propagating RootInTES
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Phys/DaVinci/python/DaVinci/truth_matching.py
+48
-14
48 additions, 14 deletions
Phys/DaVinci/python/DaVinci/truth_matching.py
with
48 additions
and
14 deletions
Phys/DaVinci/python/DaVinci/truth_matching.py
+
48
−
14
View file @
e6482bab
...
...
@@ -9,48 +9,82 @@
# or submit itself to any jurisdiction. #
###############################################################################
from
Gaudi.Configuration
import
INFO
from
PyConf.Algorithms
import
MCTruthAndBkgCatAlg
from
PyConf.Tools
import
DaVinciSmartAssociator
,
MCMatchObjP2MCRelator
,
ParticleDescendants
from
PyConf.Tools
import
BackgroundCategory
,
BackgroundCategoryViaRelations
from
PyConf.Tools
import
P2MCPFromProtoP
def
ConfiguredMCTruthAndBkgCatAlg
(
inputs
,
relations_locs
=
[
"
Relations/ChargedPP2MCP
"
,
"
Relations/NeutralPP2MCP
"
],
root_in_tes
=
"
/Event/HLT2
"
,
redo_neutral_assoc
=
False
,
root_in_tes
=
"
/Event/HLT2
"
):
output_level
=
INFO
):
"""
Function that configures the tools related to the `MCTruthAndBkgCatAlg` algorithm for HLT2 output
(configuration for Sprucing output is the same if the correct
"
`relations_locs` and `root_in_tes` are set).
Function to help configure the tools instantiated by the `MCTruthAndBkgCatAlg` algorithm.
The tools configured are `DaVinciSmartAssociator`, `MCMatchObjP2MCRelator`,
`BackgroundCategory`, `BackgroundCategoryViaRelations` and `P2MCPFromProtoP`.
The tools configured are DaVinciSmartAssociator, P2MCPFromProtoP, MCMatchObjP2MCRelator, BackgroundCategory.
The output of this algorithm is two relation tables: one for MC association (P->MCP) and one for background category (P->BKGCAT).
The MC association table can be used as input to MAP_INPUT functor and the background category table serves as input for BKGCAT functor.
The configuration for Sprucing output is the same as for HLT2 output
provided the correct `relations_locs` and `root_in_tes` arguments are set.
The output of this algorithm is two relation tables:
one for MC association (P->MCP) and one for background category (P->BKGCAT).
The MC association table can be used as input to the `MAP_INPUT` functor
and the background category table serves as input for `BKGCAT` functor.
Args:
inputs (DataHandle): Output of `Gaudi::Hive::FetchDataFromFile` (the input TES location to the particles).
relations_locs (list, optional): TES locations to the pre-existing relations for charged and neutral particles.
Defaults to [
"
Relations/ChargedPP2MCP
"
,
"
Relations/NeutralPP2MCP
"
].
root_in_tes (str, optional): RootInTES location that can be different for Sprucing output. Defaults to
"
/Event/HLT2
"
.
redo_neutral_assoc (bool, optional): Whether or not to redo MC association of pure neutral calorimetric basic particle,
i.e. gamma and pi0-merged with pi0-resolved treated as composite.
Defaults to False.
root_in_tes (str, optional): RootInTES location that can be different for sprucing output. Defaults to
"
/Event/HLT2
"
.
output_level (int, optional): the standard `OutputLevel` from `Gaudi.Configuration`
to set for all instantiated algorithms and tools. Defaults to `output_level=INFO=3`.
Returns:
MCTruthAndBkgCatAlg: configured instance of algorithm MCTruthAndBkgCatAlg.
"""
from
PyConf.Algorithms
import
MCTruthAndBkgCatAlg
from
PyConf.Tools
import
DaVinciSmartAssociator
,
P2MCPFromProtoP
,
MCMatchObjP2MCRelator
,
BackgroundCategory
# Tool used by DaVinciSmartAssociator
p2mctool
=
P2MCPFromProtoP
(
Locations
=
relations_locs
,
RootInTES
=
root_in_tes
,
OutputLevel
=
output_level
)
p2mctool
=
P2MCPFromProtoP
(
Locations
=
relations_locs
)
# Tools used by MCTruthAndBkgCatAlg
bkg_cat
=
BackgroundCategory
(
P2MCTool
=
p2mctool
,
vetoNeutralRedo
=
not
redo_neutral_assoc
)
P2MCTool
=
p2mctool
,
vetoNeutralRedo
=
not
redo_neutral_assoc
,
RootInTES
=
root_in_tes
,
OutputLevel
=
output_level
)
bkg_cat_via_rel
=
BackgroundCategoryViaRelations
(
RootInTES
=
root_in_tes
,
OutputLevel
=
output_level
)
dv_assc
=
DaVinciSmartAssociator
(
P2MCTool
=
p2mctool
,
RedoNeutral
=
redo_neutral_assoc
,
RootInTES
=
root_in_tes
,
BackgroundCategoryTool
=
bkg_cat
)
mcrel_assc
=
MCMatchObjP2MCRelator
(
RelTableLocations
=
relations_locs
)
BackgroundCategoryTool
=
bkg_cat
,
OutputLevel
=
output_level
)
mcrel_assc
=
MCMatchObjP2MCRelator
(
RelTableLocations
=
relations_locs
,
RootInTES
=
root_in_tes
,
OutputLevel
=
output_level
)
part_desc
=
ParticleDescendants
(
RootInTES
=
root_in_tes
,
OutputLevel
=
output_level
)
mctruth
=
MCTruthAndBkgCatAlg
(
Input
=
inputs
,
DaVinciSmartAssociator
=
dv_assc
,
MCMatchObjP2MCRelator
=
mcrel_assc
,
BackgroundCategory
=
bkg_cat
)
BackgroundCategory
=
bkg_cat
,
BackgroundCategoryViaRelations
=
bkg_cat_via_rel
,
ParticleDescendants
=
part_desc
,
OutputLevel
=
output_level
)
return
mctruth
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