ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloClusterCorrection
src
CaloClusterRemoveDuplicates.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// include header files
6
#include "
CaloClusterRemoveDuplicates.h
"
7
#include "
CaloEvent/CaloCell.h
"
8
#include "CaloEvent/CaloClusterContainer.h"
9
#include "CaloDetDescr/CaloDetDescrElement.h"
10
#include "
CaloDetDescr/CaloDetDescrManager.h
"
11
#include "
CaloIdentifier/CaloCell_ID.h
"
12
#include "GaudiKernel/MsgStream.h"
13
#include "
AthContainers/DataVector.h
"
14
15
/********************************************************************
16
17
NAME: CaloClusterRemoveDuplicates.cxx
18
19
AUTHORS: M. Cooke
20
CREATED: May 2008
21
22
PURPOSE: Remove duplicate clusters (pathology under investigation)
23
24
********************************************************************/
25
26
27
// -------------------------------------------------------------
28
// Constructor
29
// -------------------------------------------------------------
30
31
CaloClusterRemoveDuplicates::CaloClusterRemoveDuplicates
(
const
std::string&
type
,
32
const
std::string& name,
33
const
IInterface* parent)
34
:
AthAlgTool
(
type
, name, parent)
35
{
36
}
37
38
StatusCode
39
CaloClusterRemoveDuplicates::execute
(
const
EventContext&
/*ctx*/
,
40
xAOD::CaloClusterContainer
* clusColl)
const
41
{
42
43
ATH_MSG_DEBUG
(
"Executing CaloClusterRemoveDuplicates"
<<
endmsg
);
44
45
using
clus_iterator =
xAOD::CaloClusterContainer::iterator
;
46
clus_iterator iter1 = clusColl->
begin
();
47
48
ATH_MSG_DEBUG
(
"Collection has before dup rem size: "
<< clusColl->
size
() <<
endmsg
);
49
for
( ;iter1!=clusColl->
end
(); ) {
50
int
comparison = 0;
51
52
clus_iterator iter2 = iter1;
53
for
( iter2++ ; iter2!=clusColl->
end
() ; ){
54
// Compare cluster pairs
55
comparison =
compare
( (*iter1) , (*iter2) );
56
57
if
( comparison == 1 ){
58
break
;
// Want to delete 1, break out of loop over 2nd list and delete below
59
}
60
else
if
( comparison == 2 ){
61
//std::cout << "about to delete 2" << std::endl;
62
// Want to delete 2, delete here and continue through 2nd list
63
iter2 = clusColl->
erase
(iter2);
64
}
65
else
{
66
// No match, keep going through 2nd list
67
iter2++;
68
}
69
}
70
71
if
( comparison == 1){
72
//std::cout << "about to delete 1" << std::endl;
73
// Want to delete 1, delete here and continue through 1st list
74
iter1 = clusColl->
erase
(iter1);
75
}
76
else
{
77
// Did not need to delete 1, continue going through 1st list
78
++iter1;
79
}
80
}
81
ATH_MSG_DEBUG
(
"Collection has after dup rem size: "
<< clusColl->
size
() <<
endmsg
);
82
83
return
StatusCode::SUCCESS;
84
}
85
86
87
int
CaloClusterRemoveDuplicates::compare
(
xAOD::CaloCluster
* clus1 ,
88
xAOD::CaloCluster
* clus2 )
const
89
{
90
91
double
deta = fabs ( clus1->
eta
() - clus2->
eta
() );
92
double
dphi = fabs ( clus1->
phi
() - clus2->
phi
() );
93
94
// Check for special equivalence by 2pi case
95
if
( fabs( dphi - 6.283185 ) <
m_dphi_cut
) dphi = dphi - 6.283185;
96
97
if
( deta <=
m_deta_cut
&& dphi <=
m_dphi_cut
){
98
99
if
( clus2->
et
() > clus1->
et
() ){
// Cluster 2 has greater E, request to eliminate Cluster 1
100
return
1;
101
}
102
else
if
( clus1->
et
() >= clus2->
et
() ){
// Cluster 1 has greater E, request to eliminate Cluster 2
103
return
2;
104
}
105
}
106
107
return
0 ;
// No Match
108
109
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:61
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloCell.h
CaloCell_ID.h
CaloClusterRemoveDuplicates.h
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
CaloClusterRemoveDuplicates::compare
int compare(xAOD::CaloCluster *clus1, xAOD::CaloCluster *clus2) const
Definition
CaloClusterRemoveDuplicates.cxx:87
CaloClusterRemoveDuplicates::m_dphi_cut
Gaudi::Property< float > m_dphi_cut
Definition
CaloClusterRemoveDuplicates.h:47
CaloClusterRemoveDuplicates::execute
StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *clusColl) const override
Execute on an entire collection of clusters.
Definition
CaloClusterRemoveDuplicates.cxx:39
CaloClusterRemoveDuplicates::CaloClusterRemoveDuplicates
CaloClusterRemoveDuplicates(const std::string &type, const std::string &name, const IInterface *parent)
Definition
CaloClusterRemoveDuplicates.cxx:31
CaloClusterRemoveDuplicates::m_deta_cut
Gaudi::Property< float > m_deta_cut
Definition
CaloClusterRemoveDuplicates.h:46
DataVector< CaloCluster_v1 >::iterator
DataModel_detail::iterator< DataVector > iterator
Definition
DataVector.h:842
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::erase
iterator erase(iterator position)
Remove element at a given position.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
xAOD::CaloCluster_v1::et
double et() const
Definition
CaloCluster_v1.h:859
xAOD::CaloCluster_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition
CaloCluster_v1.cxx:251
xAOD::CaloCluster_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition
CaloCluster_v1.cxx:256
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
xAOD::CaloClusterContainer
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloClusterContainer.h:17
type
Generated on
for ATLAS Offline Software by
1.17.0