ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::IsolationTrackDecorator Class Reference

#include <IsolationTrackDecorator.h>

Inheritance diagram for DerivationFramework::IsolationTrackDecorator:
Collaboration diagram for DerivationFramework::IsolationTrackDecorator:

Public Member Functions

virtual StatusCode initialize () override final
virtual StatusCode finalize () override final
virtual StatusCode addBranches (const EventContext &ctx) const override final

Private Attributes

SG::ReadHandleKey< xAOD::TrackParticleContainerm_trackContainerKey
StringProperty m_selectionString
StringProperty m_prefix
StringArrayProperty m_iso_suffix
StringProperty m_selFlag
IntegerProperty m_diff_ptvarcone
IntegerProperty m_selFlagValue
ToolHandle< xAOD::ITrackIsolationToolm_trackIsolationTool {this, "TrackIsolationTool", ""}
 Athena configured tools.
ToolHandle< xAOD::ICaloTopoClusterIsolationToolm_caloIsolationTool {this, "CaloIsolationTool", ""}
std::vector< xAOD::Iso::IsolationTypem_ptconeTypes
std::vector< xAOD::Iso::IsolationTypem_ptvarconeTypes
std::vector< xAOD::Iso::IsolationTypem_topoetconeTypes
IntegerArrayProperty m_iso
xAOD::TrackCorrection m_trkCorrList
xAOD::CaloCorrection m_topoconeCorrList
xAOD::CaloCorrection m_topoclusCorrList
SG::WriteDecorHandleKeyArray< xAOD::TrackParticleContainerm_ptconeDecoratorsKey
SG::WriteDecorHandleKeyArray< xAOD::TrackParticleContainerm_ptvarconeDecoratorsKey
SG::WriteDecorHandleKeyArray< xAOD::TrackParticleContainerm_topoetconeDecoratorsKey
SG::WriteDecorHandleKeyArray< xAOD::TrackParticleContainerm_topoetconeNonCoreConeDecoratorsKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainerm_dec_trkFlagKey

Detailed Description

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::IsolationTrackDecorator::addBranches ( const EventContext & ctx) const
finaloverridevirtual

Loop over tracks

Only decorate those passed selection

check flag

track isolation

Definition at line 97 of file IsolationTrackDecorator.cxx.

98{
99 // retrieve track container
100 SG::ReadHandle<xAOD::TrackParticleContainer> toDecorate(m_trackContainerKey,ctx);
101 ATH_CHECK( toDecorate.isValid() );
102
103 // Execute the text parser and update the mask
104 std::vector<int> entries(toDecorate->size(), 1);
105 if (m_parser) {
106 entries = m_parser->evaluateAsVector();
107 if (entries.size() != toDecorate->size()) {
108 ATH_MSG_ERROR("Sizes incompatible! Are you sure your selection string used ID TrackParticles?");
109 return StatusCode::FAILURE;
110 }
111 }
112
113 // build the decorators
114 std::vector<SG::WriteDecorHandle<xAOD::TrackParticleContainer, float>> ptconeDecorators;
115 for(unsigned int i=0; i<m_ptconeTypes.size(); i++){
116 ptconeDecorators.emplace_back(m_ptconeDecoratorsKey[i], ctx);
117 }
118 std::vector<SG::WriteDecorHandle<xAOD::TrackParticleContainer, float>> ptvarconeDecorators;
119 for(unsigned int i=0; i<m_ptvarconeTypes.size(); i++){
120 ptvarconeDecorators.emplace_back(m_ptconeDecoratorsKey[i], ctx);
121 }
122 std::vector<SG::WriteDecorHandle<xAOD::TrackParticleContainer, float>> topoetconeDecorators;
123 for(unsigned int i=0; i<m_topoetconeTypes.size(); i++){
124 topoetconeDecorators.emplace_back(m_topoetconeDecoratorsKey[i], ctx);
125 }
126 std::vector<SG::WriteDecorHandle<xAOD::TrackParticleContainer, float>> topoetconeNonCoreConeDecorators;
127 for(unsigned int i=0; i<m_topoetconeTypes.size(); i++){
128 topoetconeNonCoreConeDecorators.emplace_back(m_topoetconeNonCoreConeDecoratorsKey[i], ctx);
129 }
130
131 SG::WriteDecorHandle<xAOD::TrackParticleContainer, int> dec_trkFlag(m_dec_trkFlagKey, ctx);
132
134 int ipar=0;
135 for(auto particle : *toDecorate) {
136 bool IsPassed=true;
137
139 if (!entries[ipar++]) IsPassed=false;
140
142 if(not m_selFlag.empty()){
143 if(dec_trkFlag(*particle)!=m_selFlagValue) IsPassed=false;
144 }
145
146 if(m_iso.size()>0){
147 if(IsPassed){
149 xAOD::TrackIsolation resultTrack;
150 xAOD::TrackIsolation resultTrackVar;
151 xAOD::CaloIsolation resultCalo;
152 xAOD::CaloIsolation resultCaloNonCoreCone;
153 if(m_ptconeTypes.size()) {
154
155 if (m_trackIsolationTool->trackIsolation(resultTrack, *particle, m_ptconeTypes, m_trkCorrList)){
156 for(unsigned int i=0; i<m_ptconeTypes.size(); i++){
157 ptconeDecorators[i](*particle) = resultTrack.ptcones[i];
158 }
159 }else{
160 ATH_MSG_WARNING("Failed to apply the track isolation for a particle");
161 }
162 }
163
164 if(m_ptvarconeTypes.size()) {
165
166 std::vector<xAOD::Iso::IsolationType> ptconeTypes = {};
167 for(auto isoType : m_ptvarconeTypes) {
168 int iso_tmp = static_cast<int>(isoType);
169 iso_tmp -= m_diff_ptvarcone;
170 ptconeTypes.push_back(static_cast<xAOD::Iso::IsolationType>(iso_tmp));
171 }
172
173 if (m_trackIsolationTool->trackIsolation(resultTrackVar, *particle, ptconeTypes, m_trkCorrList)){
174 for(unsigned int i=0; i<m_ptvarconeTypes.size(); i++){
175 ptvarconeDecorators[i](*particle) = resultTrackVar.ptvarcones_10GeVDivPt[i];
176 }
177 }else{
178 ATH_MSG_WARNING("Failed to apply the track isolation for a particle");
179 }
180 }
181
182 if(m_topoetconeTypes.size()) {
183
184 if (m_caloIsolationTool->caloTopoClusterIsolation(resultCalo, *particle, m_topoetconeTypes, m_topoconeCorrList)){
185 for(unsigned int i=0; i<m_topoetconeTypes.size(); i++){
186 topoetconeDecorators[i](*particle) = resultCalo.etcones[i];
187 }
188 }else{
189 ATH_MSG_WARNING("Failed to apply the track isolation for a particle");
190 }
191
192 if (m_caloIsolationTool->caloTopoClusterIsolation(resultCaloNonCoreCone, *particle, m_topoetconeTypes, m_topoclusCorrList)){
193 for(unsigned int i=0; i<m_topoetconeTypes.size(); i++){
194 topoetconeNonCoreConeDecorators[i](*particle) = resultCaloNonCoreCone.etcones[i];
195 }
196 }else {
197 ATH_MSG_WARNING("Failed to apply the topo calo isolation for a particle ( non CoreCone )");
198 }
199
200 }
201
202 }else{
203 for(unsigned int i=0; i<m_ptconeTypes.size(); i++){
204 ptconeDecorators[i](*particle) = -999.e3;
205 }
206 for(unsigned int i=0; i<m_ptvarconeTypes.size(); i++){
207 ptvarconeDecorators[i](*particle) = -999.e3;
208 }
209 for(unsigned int i=0; i<m_topoetconeTypes.size(); i++){
210 topoetconeDecorators[i](*particle) = -999.e3;
211 topoetconeNonCoreConeDecorators[i](*particle) = -999.e3;
212 }
213 }
214 }
215 }
216
217 return StatusCode::SUCCESS;
218}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackContainerKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_dec_trkFlagKey
SG::WriteDecorHandleKeyArray< xAOD::TrackParticleContainer > m_ptconeDecoratorsKey
std::vector< xAOD::Iso::IsolationType > m_ptvarconeTypes
std::vector< xAOD::Iso::IsolationType > m_topoetconeTypes
ToolHandle< xAOD::ICaloTopoClusterIsolationTool > m_caloIsolationTool
SG::WriteDecorHandleKeyArray< xAOD::TrackParticleContainer > m_topoetconeDecoratorsKey
SG::WriteDecorHandleKeyArray< xAOD::TrackParticleContainer > m_topoetconeNonCoreConeDecoratorsKey
std::vector< xAOD::Iso::IsolationType > m_ptconeTypes
ToolHandle< xAOD::ITrackIsolationTool > m_trackIsolationTool
Athena configured tools.
double entries
Definition listroot.cxx:49
IsolationType
Overall enumeration for isolation types in xAOD files.
std::vector< float > etcones
std::vector< float > ptcones
std::vector< float > ptvarcones_10GeVDivPt

◆ finalize()

StatusCode DerivationFramework::IsolationTrackDecorator::finalize ( )
finaloverridevirtual

Definition at line 89 of file IsolationTrackDecorator.cxx.

90{
91 ATH_MSG_DEBUG("finalize() ...");
92 ATH_CHECK(finalizeParser());
93
94 return StatusCode::SUCCESS;
95}
#define ATH_MSG_DEBUG(x)

◆ initialize()

StatusCode DerivationFramework::IsolationTrackDecorator::initialize ( )
finaloverridevirtual

create decorator list

Definition at line 24 of file IsolationTrackDecorator.cxx.

25{
26 ATH_MSG_DEBUG("initialize() ...");
27
28 // load the matching tool
29 if( ! m_caloIsolationTool.empty() ) {
30 ATH_CHECK( m_caloIsolationTool.retrieve() );
31 ATH_MSG_INFO( "Successfully retrieved the CaloIsolationTool!" );
32 }
33
34 if( ! m_trackIsolationTool.empty() ) {
35 ATH_CHECK( m_trackIsolationTool.retrieve() );
36 ATH_MSG_INFO( "Successfully retrieved the TrackIsolationTool!" );
37 }
38
39 ATH_CHECK(m_trackContainerKey.initialize());
40
41 m_trkCorrList.trackbitset.set(static_cast<unsigned int>(xAOD::Iso::coreTrackPtr));
42 m_topoconeCorrList.calobitset.set(static_cast<unsigned int>(xAOD::Iso::coreCone));
43 m_topoconeCorrList.calobitset.set(static_cast<unsigned int>(xAOD::Iso::pileupCorrection));
44 m_topoclusCorrList.calobitset.set(static_cast<unsigned int>(xAOD::Iso::pileupCorrection));
45
47 m_ptconeTypes.clear();
48 m_ptvarconeTypes.clear();
49 m_topoetconeTypes.clear();
50
51 for(unsigned int i=0; i<m_iso.size(); i++){
53 xAOD::Iso::IsolationFlavour flavour = static_cast<xAOD::Iso::IsolationFlavour>(isoType/10.);
54
55 if(flavour == xAOD::Iso::ptcone) {
56 m_ptconeTypes.push_back(isoType);
57 m_ptconeDecoratorsKey.emplace_back(m_trackContainerKey.key() + "." + m_prefix + m_iso_suffix[i]);
58 }
59 if(flavour == xAOD::Iso::ptvarcone) {
60 m_ptvarconeTypes.push_back(isoType);
62 }
63 if(flavour == xAOD::Iso::topoetcone) {
64 m_topoetconeTypes.push_back(isoType);
66 m_topoetconeNonCoreConeDecoratorsKey.emplace_back(m_trackContainerKey.key() + "." + m_prefix + m_iso_suffix[i] + "NonCoreCone");
67 }
68 }
69 ATH_CHECK(m_ptconeDecoratorsKey.initialize());
73
74 // Set up the text-parsing machinery for thinning the tracks directly according to user cuts
75 if (not m_selectionString.empty()) {
76 ATH_CHECK(initializeParser(m_selectionString));
77 }
78
79 if(not m_selFlag.empty()){
81 } else {
82 m_dec_trkFlagKey = m_trackContainerKey.key() + ".no_key";
83 }
84 ATH_CHECK(m_dec_trkFlagKey.initialize());
85
86 return StatusCode::SUCCESS;
87}
#define ATH_MSG_INFO(x)
SG::WriteDecorHandleKeyArray< xAOD::TrackParticleContainer > m_ptvarconeDecoratorsKey
IsolationFlavour
Enumeration for different ways of calculating isolation in xAOD files.
@ topoetcone
Topo-cluster ET-sum.
@ ptcone
Track isolation.
@ ptvarcone
mini isolation

Member Data Documentation

◆ m_caloIsolationTool

ToolHandle<xAOD::ICaloTopoClusterIsolationTool> DerivationFramework::IsolationTrackDecorator::m_caloIsolationTool {this, "CaloIsolationTool", ""}
private

Definition at line 76 of file IsolationTrackDecorator.h.

76{this, "CaloIsolationTool", ""};

◆ m_dec_trkFlagKey

SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> DerivationFramework::IsolationTrackDecorator::m_dec_trkFlagKey
private
Initial value:
{
this, "dec_trkFlagKey", ""}

Definition at line 95 of file IsolationTrackDecorator.h.

95 {
96 this, "dec_trkFlagKey", ""};

◆ m_diff_ptvarcone

IntegerProperty DerivationFramework::IsolationTrackDecorator::m_diff_ptvarcone
private
Initial value:
{
this, "DiffPtvarcone", xAOD::Iso::ptvarcone20 - xAOD::Iso::ptcone20, "difference between Iso::ptvarcone20 and Iso::ptcone20"}
@ ptcone20
Track isolation.
@ ptvarcone20
Mini-Isolation http://arxiv.org/abs/1007.2221.

Definition at line 69 of file IsolationTrackDecorator.h.

69 {
70 this, "DiffPtvarcone", xAOD::Iso::ptvarcone20 - xAOD::Iso::ptcone20, "difference between Iso::ptvarcone20 and Iso::ptcone20"};

◆ m_iso

IntegerArrayProperty DerivationFramework::IsolationTrackDecorator::m_iso
private
Initial value:
{
this, "iso", {}, "isolation types vector<int>"}

Definition at line 81 of file IsolationTrackDecorator.h.

81 {
82 this, "iso", {}, "isolation types vector<int>"};

◆ m_iso_suffix

StringArrayProperty DerivationFramework::IsolationTrackDecorator::m_iso_suffix
private
Initial value:
{
this, "isoSuffix", {""}, "suffix for the isolations"}

Definition at line 65 of file IsolationTrackDecorator.h.

65 {
66 this, "isoSuffix", {""}, "suffix for the isolations"};

◆ m_prefix

StringProperty DerivationFramework::IsolationTrackDecorator::m_prefix
private
Initial value:
{
this, "Prefix", "", "prefix"}

Definition at line 63 of file IsolationTrackDecorator.h.

63 {
64 this, "Prefix", "", "prefix"};

◆ m_ptconeDecoratorsKey

SG::WriteDecorHandleKeyArray<xAOD::TrackParticleContainer> DerivationFramework::IsolationTrackDecorator::m_ptconeDecoratorsKey
private
Initial value:
{
this, "ptconeDecoratorsKey", {}}

Definition at line 87 of file IsolationTrackDecorator.h.

87 {
88 this, "ptconeDecoratorsKey", {}};

◆ m_ptconeTypes

std::vector<xAOD::Iso::IsolationType> DerivationFramework::IsolationTrackDecorator::m_ptconeTypes
private

Definition at line 78 of file IsolationTrackDecorator.h.

◆ m_ptvarconeDecoratorsKey

SG::WriteDecorHandleKeyArray<xAOD::TrackParticleContainer> DerivationFramework::IsolationTrackDecorator::m_ptvarconeDecoratorsKey
private
Initial value:
{
this, "ptvarconeDecoratorsKey", {}}

Definition at line 89 of file IsolationTrackDecorator.h.

89 {
90 this, "ptvarconeDecoratorsKey", {}};

◆ m_ptvarconeTypes

std::vector<xAOD::Iso::IsolationType> DerivationFramework::IsolationTrackDecorator::m_ptvarconeTypes
private

Definition at line 79 of file IsolationTrackDecorator.h.

◆ m_selectionString

StringProperty DerivationFramework::IsolationTrackDecorator::m_selectionString
private
Initial value:
{
this, "SelectionString", "", "selection string"}

Definition at line 61 of file IsolationTrackDecorator.h.

61 {
62 this, "SelectionString", "", "selection string"};

◆ m_selFlag

StringProperty DerivationFramework::IsolationTrackDecorator::m_selFlag
private
Initial value:
{
this, "SelectionFlag", "", "selection flag"}

Definition at line 67 of file IsolationTrackDecorator.h.

67 {
68 this, "SelectionFlag", "", "selection flag"};

◆ m_selFlagValue

IntegerProperty DerivationFramework::IsolationTrackDecorator::m_selFlagValue
private
Initial value:
{
this, "SelectionFlagValue", 1, "selection flag value"}

Definition at line 71 of file IsolationTrackDecorator.h.

71 {
72 this, "SelectionFlagValue", 1, "selection flag value"};

◆ m_topoclusCorrList

xAOD::CaloCorrection DerivationFramework::IsolationTrackDecorator::m_topoclusCorrList
private

Definition at line 85 of file IsolationTrackDecorator.h.

◆ m_topoconeCorrList

xAOD::CaloCorrection DerivationFramework::IsolationTrackDecorator::m_topoconeCorrList
private

Definition at line 84 of file IsolationTrackDecorator.h.

◆ m_topoetconeDecoratorsKey

SG::WriteDecorHandleKeyArray<xAOD::TrackParticleContainer> DerivationFramework::IsolationTrackDecorator::m_topoetconeDecoratorsKey
private
Initial value:
{
this, "topoetconeDecoratorsKey", {}}

Definition at line 91 of file IsolationTrackDecorator.h.

91 {
92 this, "topoetconeDecoratorsKey", {}};

◆ m_topoetconeNonCoreConeDecoratorsKey

SG::WriteDecorHandleKeyArray<xAOD::TrackParticleContainer> DerivationFramework::IsolationTrackDecorator::m_topoetconeNonCoreConeDecoratorsKey
private
Initial value:
{
this, "topoetconeNonCoreConeDecoratorsKey", {}}

Definition at line 93 of file IsolationTrackDecorator.h.

93 {
94 this, "topoetconeNonCoreConeDecoratorsKey", {}};

◆ m_topoetconeTypes

std::vector<xAOD::Iso::IsolationType> DerivationFramework::IsolationTrackDecorator::m_topoetconeTypes
private

Definition at line 80 of file IsolationTrackDecorator.h.

◆ m_trackContainerKey

SG::ReadHandleKey<xAOD::TrackParticleContainer> DerivationFramework::IsolationTrackDecorator::m_trackContainerKey
private
Initial value:
{
this, "TargetContainer", "InDetTrackParticles", "track particle container name"}

Definition at line 59 of file IsolationTrackDecorator.h.

59 {
60 this, "TargetContainer", "InDetTrackParticles", "track particle container name"};

◆ m_trackIsolationTool

ToolHandle<xAOD::ITrackIsolationTool> DerivationFramework::IsolationTrackDecorator::m_trackIsolationTool {this, "TrackIsolationTool", ""}
private

Athena configured tools.

Definition at line 75 of file IsolationTrackDecorator.h.

75{this, "TrackIsolationTool", ""};

◆ m_trkCorrList

xAOD::TrackCorrection DerivationFramework::IsolationTrackDecorator::m_trkCorrList
private

Definition at line 83 of file IsolationTrackDecorator.h.


The documentation for this class was generated from the following files: