Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Samuel Van Stroud
training-dataset-dumper
Commits
4f747fab
Commit
4f747fab
authored
Apr 20, 2022
by
Samuel Van Stroud
Browse files
Update track leptonID
parent
71670f23
Pipeline
#3871625
failed with stages
in 12 minutes and 52 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
BTagTrainingPreprocessing/CMakeLists.txt
View file @
4f747fab
...
...
@@ -37,6 +37,7 @@ set(LINK_LIBRARIES
InDetTrackSystematicsToolsLib
xAODHIEvent
MCTruthClassifierLib
ElectronPhotonSelectorToolsLib
)
# anything that is built conditionally goes here
if
(
NOT XAOD_STANDALONE
)
...
...
BTagTrainingPreprocessing/src/TrackLeptonDecorator.cxx
View file @
4f747fab
...
...
@@ -2,12 +2,21 @@
#include "xAODEgamma/ElectronxAODHelpers.h"
// the constructor just builds the decorator
TrackLeptonDecorator
::
TrackLeptonDecorator
(
const
std
::
string
&
prefix
)
:
m_track_lepton_id
(
prefix
+
"leptonID"
)
{
#include "xAODEgamma/ElectronxAODHelpers.h"
#include "ElectronPhotonSelectorTools/ElectronSelectorHelpers.h"
void
check_rc
(
StatusCode
code
)
{
if
(
!
code
.
isSuccess
())
throw
std
::
runtime_error
(
"bad return code"
);
}
// the constructor just builds the decorator
TrackLeptonDecorator
::
TrackLeptonDecorator
(
const
std
::
string
&
prefix
)
:
m_track_lepton_id
(
prefix
+
"leptonID"
),
m_electronID_tool
(
"AsgElectronLikelihoodTool/electronID_tool"
)
{
check_rc
(
m_electronID_tool
.
setProperty
(
"WorkingPoint"
,
m_electronID_wp
));
check_rc
(
m_electronID_tool
.
initialize
());
}
// this call actually does the work on the track
void
TrackLeptonDecorator
::
decorate
(
const
xAOD
::
TrackParticleContainer
&
tracks
,
const
xAOD
::
MuonContainer
&
muons
,
const
xAOD
::
ElectronContainer
&
electrons
)
const
{
...
...
@@ -17,35 +26,38 @@ void TrackLeptonDecorator::decorate(const xAOD::TrackParticleContainer& tracks,
m_track_lepton_id
(
*
track
)
=
0
;
}
// loop over
mu
ons
for
(
const
auto
muon
:
mu
ons
)
{
// loop over
electr
ons
for
(
const
auto
electron
:
electr
ons
)
{
// get associated InDet track link
auto
track_link
=
muon
->
inDetTrackParticleLink
();
if
(
!
track_link
.
isValid
()
)
{
continue
;
}
// get associated InDet track (not the GSF track which is likely to have improved parameters,
// more info: https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/EGammaD3PDtoxAOD#TrackParticle)
const
xAOD
::
TrackParticle
*
track
=
xAOD
::
EgammaHelpers
::
getOriginalTrackParticle
(
electron
);
if
(
!
track
)
{
continue
;
}
// access track
auto
track
=
*
track_link
;
// apply electron ID requirement
bool
LH_selection
=
(
bool
)
m_electronID_tool
.
accept
(
electron
);
if
(
!
LH_selection
)
{
continue
;
}
// decorate the track
m_track_lepton_id
(
*
track
)
=
-
1
3
*
mu
on
->
charge
();
}
// decorate the track
m_track_lepton_id
(
*
track
)
=
-
1
1
*
electr
on
->
charge
();
}
// loop over electrons
for
(
const
auto
electron
:
electrons
)
{
// loop over muons - do it last in case we have a track that was used in the
// reconstruction of an electron and a muon (which can happen in rare cases)
for
(
const
auto
muon
:
muons
)
{
// get associated InDet track link (not the GSF track which is likely to have improved parameters,
// more info: https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/EGammaD3PDtoxAOD#TrackParticle)
const
xAOD
::
TrackParticle
*
track
=
xAOD
::
EgammaHelpers
::
getOriginalTrackParticle
(
electron
);
// minimal quality requirement: check we have a combined muon
if
(
muon
->
muonType
()
!=
xAOD
::
Muon
::
Combined
)
{
continue
;
}
if
(
!
track
)
{
continue
;
// get associated InDet track
auto
track_link
=
muon
->
inDetTrackParticleLink
();
if
(
!
track_link
.
isValid
()
)
{
continue
;
}
auto
track
=
*
track_link
;
// decorate the track
m_track_lepton_id
(
*
track
)
=
-
13
*
muon
->
charge
();
}
// decorate the track
m_track_lepton_id
(
*
track
)
=
-
11
*
electron
->
charge
();
}
}
BTagTrainingPreprocessing/src/TrackLeptonDecorator.hh
View file @
4f747fab
...
...
@@ -10,6 +10,7 @@
#include "xAODMuon/MuonContainer.h"
#include "xAODEgamma/ElectronContainer.h"
#include "ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h"
#include <string>
...
...
@@ -32,6 +33,9 @@ private:
SG
::
AuxElement
::
Decorator
<
int
>
m_track_lepton_id
;
// electron ID tool
std
::
string
m_electronID_wp
=
"VeryLooseLHElectron"
;
AsgElectronLikelihoodTool
m_electronID_tool
;
};
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment