ATLAS Offline Software
CaloClusterRemoveBad.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // include header files
6 #include "CaloClusterRemoveBad.h"
7 #include "CaloEvent/CaloCell.h"
8 #include "CaloEvent/CaloClusterContainer.h"
9 #include "GaudiKernel/MsgStream.h"
11 
12 /********************************************************************
13 
14 NAME: CaloClusterRemoveBad.cxx
15 
16 AUTHORS: H. Ma
17 CREATED: July 2010
18 
19 PURPOSE: Remove bad cluster after corrections.
20 
21 ********************************************************************/
22 
23 
31  const std::string& name,
32  const IInterface* parent)
34 {
35  // Energy threshold for cluster removal.
36  declareProperty ("EMin", m_eThreshold = 0.0,
37  "Energy threshold for cluster removal.");
38 }
39 
40 
50 StatusCode CaloClusterRemoveBad::execute (const EventContext& /*ctx*/,
51  xAOD::CaloCluster* /*cluster*/) const
52 {
53  return StatusCode::SUCCESS;
54 }
55 
56 
63 CaloClusterRemoveBad::execute (const EventContext& /*ctx*/,
64  xAOD::CaloClusterContainer* clusColl) const
65 {
66 
67  ATH_MSG_DEBUG( "Executing CaloClusterRemoveBad" << endmsg);
68 
69  using clus_iterator = xAOD::CaloClusterContainer::iterator;
70  clus_iterator iter1 = clusColl->begin();
71 
72  ATH_MSG_DEBUG( "Collection has before dup rem size: " << clusColl->size() << endmsg);
73  for( ;iter1!=clusColl->end(); ) {
74  ATH_MSG_DEBUG( " cluster energy " << (*iter1)->e() << endmsg);
75  if ((*iter1)->e()<= m_eThreshold ){
76  ATH_MSG_DEBUG( " Removed cluster with energy below threshold, " << (*iter1)->e() << endmsg);
77  iter1 = clusColl->erase(iter1);
78  continue ;
79  }
80 
81  ++iter1;
82 
83  }
84  ATH_MSG_DEBUG( "Collection has after dup rem size: " << clusColl->size() << endmsg);
85 
86  return StatusCode::SUCCESS;
87 }
88 
DataVector::iterator
DataModel_detail::iterator< DataVector > iterator
Standard iterator.
Definition: DataVector.h:841
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CaloClusterProcessor
Definition: CaloClusterProcessor.h:33
CaloCell.h
CaloClusterRemoveBad::m_eThreshold
float m_eThreshold
Definition: CaloClusterRemoveBad.h:80
CaloClusterRemoveBad.h
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DataVector::erase
iterator erase(iterator position)
Remove element at a given position.
CaloClusterRemoveBad::execute
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloCluster *cluster) const override
Execute on a single cluster.
Definition: CaloClusterRemoveBad.cxx:50
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
CaloClusterRemoveBad::CaloClusterRemoveBad
CaloClusterRemoveBad()