ATLAS Offline Software
PFClusterCollectionTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 PFClusterCollectionTool::PFClusterCollectionTool(const std::string& type,const std::string& name,const IInterface* parent) : base_class( type, name, parent)
10 {
11 }
12 
14  return StatusCode::SUCCESS;
15 }
16 
17 std::unique_ptr<eflowRecClusterContainer> PFClusterCollectionTool::retrieve(eflowCaloObjectContainer& theEflowCaloObjectContainer, bool useNonModifiedClusters) {
18 
19  std::unique_ptr<eflowRecClusterContainer> result = std::make_unique<eflowRecClusterContainer>();
20 
21  /* Loop over all eflowCaloObjects */
22  for (auto thisEflowCaloObject : theEflowCaloObjectContainer){
23 
24  /* Add all clusters on the eflowCaloObject to the container */
25  unsigned int nClusters = thisEflowCaloObject->nClusters();
26  for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster) {
27  eflowRecCluster* thisEfRecCluster = thisEflowCaloObject->efRecCluster(iCluster);
28 
29  /* Only add clusters if should run calibration tools or if touchable (i.e. we modified them */
30  if (!useNonModifiedClusters && !thisEfRecCluster->isTouchable() ) {
31  continue;
32  }
33 
34  result->push_back(thisEfRecCluster);
35  }
36 }
37  return result;
38 }
39 
40 
41 std::unique_ptr<xAOD::CaloClusterContainer> PFClusterCollectionTool::execute(eflowCaloObjectContainer& theEflowCaloObjectContainer, bool useNonModifiedClusters) {
42 
43  std::unique_ptr<xAOD::CaloClusterContainer> result = std::make_unique<xAOD::CaloClusterContainer>(SG::VIEW_ELEMENTS);
44 
45  /* Loop over all eflowCaloObjects */
46  for (auto thisEflowCaloObject : theEflowCaloObjectContainer){
47 
48  /* Add all clusters on the eflowCaloObject to the container */
49  unsigned int nClusters = thisEflowCaloObject->nClusters();
50  for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster) {
51  eflowRecCluster* thisEfRecCluster = thisEflowCaloObject->efRecCluster(iCluster);
52 
53  /* Only add clusters if should run calibration tools or if touchable (i.e. we modified them */
54  if (!useNonModifiedClusters && !thisEfRecCluster->isTouchable() ) {
55  continue;
56  }
57 
58  xAOD::CaloCluster* thisCluster = thisEfRecCluster->getCluster();
59  result->push_back(thisCluster);
60 
61  ATH_MSG_DEBUG("Adding cluster with E, eta and phi to moments maker " << thisCluster->e() << ", " << thisCluster->eta() << " and " << thisCluster->phi());
62  }
63  }
64  std::sort(result->begin(), result->end(), [](xAOD::CaloCluster* c1, xAOD::CaloCluster* c2) {return c1->e()>c2->e();});
65  return result;
66 }
67 
69  return StatusCode::SUCCESS;
70 }
eflowRecCluster
This class extends the information about a xAOD::CaloCluster.
Definition: eflowRecCluster.h:40
xAOD::CaloCluster_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: CaloCluster_v1.cxx:256
PFClusterCollectionTool::PFClusterCollectionTool
PFClusterCollectionTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: PFClusterCollectionTool.cxx:9
PFClusterCollectionTool::finalize
StatusCode finalize()
Definition: PFClusterCollectionTool.cxx:68
get_generator_info.result
result
Definition: get_generator_info.py:21
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
PFClusterCollectionTool::execute
std::unique_ptr< xAOD::CaloClusterContainer > execute(eflowCaloObjectContainer &theEflowCaloObjectContainer, bool useNonModifiedClusters)
Definition: PFClusterCollectionTool.cxx:41
extractSporadic.c1
c1
Definition: extractSporadic.py:134
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
xAOD::CaloCluster_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: CaloCluster_v1.cxx:251
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
PFClusterCollectionTool::retrieve
std::unique_ptr< eflowRecClusterContainer > retrieve(eflowCaloObjectContainer &theEflowCaloObjectContainer, bool useNonModifiedClusters)
Definition: PFClusterCollectionTool.cxx:17
eflowRecCluster::getCluster
xAOD::CaloCluster * getCluster()
Definition: eflowRecCluster.h:49
eflowRecCluster.h
PFClusterCollectionTool::initialize
StatusCode initialize()
Definition: PFClusterCollectionTool.cxx:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
compileRPVLLRates.c2
c2
Definition: compileRPVLLRates.py:361
eflowCaloObject.h
eflowRecCluster::isTouchable
bool isTouchable() const
Definition: eflowRecCluster.h:91
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
eflowCaloObjectContainer
Definition: eflowCaloObject.h:100
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
PFClusterCollectionTool.h