ATLAS Offline Software
Loading...
Searching...
No Matches
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
9PFClusterCollectionTool::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
17std::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
41std::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}
#define ATH_MSG_DEBUG(x)
std::unique_ptr< eflowRecClusterContainer > retrieve(eflowCaloObjectContainer &theEflowCaloObjectContainer, bool useNonModifiedClusters)
PFClusterCollectionTool(const std::string &type, const std::string &name, const IInterface *parent)
std::unique_ptr< xAOD::CaloClusterContainer > execute(eflowCaloObjectContainer &theEflowCaloObjectContainer, bool useNonModifiedClusters)
This class extends the information about a xAOD::CaloCluster.
bool isTouchable() const
xAOD::CaloCluster * getCluster()
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.