14 #include "CLHEP/Units/SystemOfUnits.h"
35 if( ! m_caloIsolationTool.empty() ) {
36 ATH_CHECK( m_caloIsolationTool.retrieve() );
37 ATH_MSG_INFO(
"Successfully retrived the CaloIsolationTool!" );
40 if( ! m_trackIsolationTool.empty() ) {
41 ATH_CHECK( m_trackIsolationTool.retrieve() );
42 ATH_MSG_INFO(
"Successfully retrived the TrackIsolationTool!" );
45 ATH_CHECK(m_trackContainerKey.initialize());
53 m_ptconeTypes.clear();
54 m_ptvarconeTypes.clear();
55 m_topoetconeTypes.clear();
57 for(
unsigned int i=0;
i<m_iso.size();
i++){
62 m_ptconeTypes.push_back(isoType);
63 m_ptconeDecoratorsKey.emplace_back(m_trackContainerKey.key() +
"." + m_prefix + m_iso_suffix[
i]);
66 m_ptvarconeTypes.push_back(isoType);
67 m_ptvarconeDecoratorsKey.emplace_back(m_trackContainerKey.key() +
"." + m_prefix + m_iso_suffix[
i]);
70 m_topoetconeTypes.push_back(isoType);
71 m_topoetconeDecoratorsKey.emplace_back(m_trackContainerKey.key() +
"." + m_prefix + m_iso_suffix[
i]);
72 m_topoetconeNonCoreConeDecoratorsKey.emplace_back(m_trackContainerKey.key() +
"." + m_prefix + m_iso_suffix[
i] +
"NonCoreCone");
75 ATH_CHECK(m_ptconeDecoratorsKey.initialize());
76 ATH_CHECK(m_ptvarconeDecoratorsKey.initialize());
77 ATH_CHECK(m_topoetconeDecoratorsKey.initialize());
78 ATH_CHECK(m_topoetconeNonCoreConeDecoratorsKey.initialize());
81 if (not m_selectionString.empty()) {
82 ATH_CHECK(initializeParser(m_selectionString));
85 if(not m_selFlag.empty()){
86 m_dec_trkFlagKey = m_trackContainerKey.key() +
"." + m_selFlag;
88 m_dec_trkFlagKey = m_trackContainerKey.key() +
".no_key";
92 return StatusCode::SUCCESS;
100 return StatusCode::SUCCESS;
105 const EventContext& ctx = Gaudi::Hive::currentContext();
113 entries = m_parser->evaluateAsVector();
115 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string used ID TrackParticles?");
116 return StatusCode::FAILURE;
121 std::vector<SG::WriteDecorHandle<xAOD::TrackParticleContainer, float>> ptconeDecorators;
122 for(
unsigned int i=0;
i<m_ptconeTypes.size();
i++){
123 ptconeDecorators.emplace_back(m_ptconeDecoratorsKey[
i], ctx);
125 std::vector<SG::WriteDecorHandle<xAOD::TrackParticleContainer, float>> ptvarconeDecorators;
126 for(
unsigned int i=0;
i<m_ptvarconeTypes.size();
i++){
127 ptvarconeDecorators.emplace_back(m_ptconeDecoratorsKey[
i], ctx);
129 std::vector<SG::WriteDecorHandle<xAOD::TrackParticleContainer, float>> topoetconeDecorators;
130 for(
unsigned int i=0;
i<m_topoetconeTypes.size();
i++){
131 topoetconeDecorators.emplace_back(m_topoetconeDecoratorsKey[
i], ctx);
133 std::vector<SG::WriteDecorHandle<xAOD::TrackParticleContainer, float>> topoetconeNonCoreConeDecorators;
134 for(
unsigned int i=0;
i<m_topoetconeTypes.size();
i++){
135 topoetconeNonCoreConeDecorators.emplace_back(m_topoetconeNonCoreConeDecoratorsKey[
i], ctx);
146 if (!
entries[ipar++]) IsPassed=
false;
149 if(not m_selFlag.empty()){
150 if(dec_trkFlag(*
particle)!=m_selFlagValue) IsPassed=
false;
160 if(m_ptconeTypes.size()) {
162 if (m_trackIsolationTool->trackIsolation(resultTrack, *
particle, m_ptconeTypes, m_trkCorrList)){
163 for(
unsigned int i=0;
i<m_ptconeTypes.size();
i++){
164 ptconeDecorators[
i](*particle) = resultTrack.
ptcones[
i];
171 if(m_ptvarconeTypes.size()) {
173 std::vector<xAOD::Iso::IsolationType> ptconeTypes = {};
174 for(
auto isoType : m_ptvarconeTypes) {
175 int iso_tmp =
static_cast<int>(isoType);
176 iso_tmp -= m_diff_ptvarcone;
180 if (m_trackIsolationTool->trackIsolation(resultTrackVar, *
particle, ptconeTypes, m_trkCorrList)){
181 for(
unsigned int i=0;
i<m_ptvarconeTypes.size();
i++){
189 if(m_topoetconeTypes.size()) {
191 if (m_caloIsolationTool->caloTopoClusterIsolation(resultCalo, *
particle, m_topoetconeTypes, m_topoconeCorrList)){
192 for(
unsigned int i=0;
i<m_topoetconeTypes.size();
i++){
193 topoetconeDecorators[
i](*particle) = resultCalo.
etcones[
i];
199 if (m_caloIsolationTool->caloTopoClusterIsolation(resultCaloNonCoreCone, *
particle, m_topoetconeTypes, m_topoclusCorrList)){
200 for(
unsigned int i=0;
i<m_topoetconeTypes.size();
i++){
201 topoetconeNonCoreConeDecorators[
i](*particle) = resultCaloNonCoreCone.
etcones[
i];
204 ATH_MSG_WARNING(
"Failed to apply the topo calo isolation for a particle ( non CoreCone )");
210 for(
unsigned int i=0;
i<m_ptconeTypes.size();
i++){
211 ptconeDecorators[
i](*particle) = -999.e3;
213 for(
unsigned int i=0;
i<m_ptvarconeTypes.size();
i++){
214 ptvarconeDecorators[
i](*particle) = -999.e3;
216 for(
unsigned int i=0;
i<m_topoetconeTypes.size();
i++){
217 topoetconeDecorators[
i](*particle) = -999.e3;
218 topoetconeNonCoreConeDecorators[
i](*particle) = -999.e3;
224 return StatusCode::SUCCESS;