30 return StatusCode::SUCCESS;
44 ATH_CHECK(xaoda.
record (std::make_unique<xAOD::TrackParticleClusterAssociationContainer>(),
45 std::make_unique<xAOD::TrackParticleClusterAssociationAuxContainer>()));
49 unsigned int ntracks = 0;
50 for(
unsigned int i=0;i<trackParticles->size();++i ){
54 if( tp->pt() <
m_ptCut )
continue;
57 ATH_MSG_DEBUG(
" Selected track: pt " << tp->pt() <<
" eta " << tp->eta() <<
" phi " << tp->phi() );
58 std::unique_ptr<const Rec::ParticleCellAssociation> association
61 ATH_MSG_DEBUG(
"failed to obtain the ParticleCellAssociation");
66 if( !association->container() ){
67 ATH_MSG_WARNING(
"Failed to obtain CaloCellContainer from ParticleCellAssociation");
73 *association->container(),
76 ATH_MSG_WARNING(
"Failed to create cluster from ParticleCellAssociation");
79 ATH_MSG_DEBUG(
" New cluster: eta " << cluster->
eta() <<
" phi " << cluster->
phi() <<
" cells " << cluster->
size() <<
" nclusters " << clusColl->size() );
89 xaoda->push_back(trackAssociation);
91 std::vector< ElementLink< xAOD::CaloClusterContainer > > caloClusterLinks;
92 caloClusterLinks.push_back( clusterLink );
102 ATH_MSG_DEBUG(
" Total number of selected tracks: " << ntracks );
107 return StatusCode::SUCCESS;
113 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
An algorithm that can be simultaneously executed in multiple threads.
static StatusCode AddContainerWriteHandle(SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and recor...
static StatusCode finalizeClusters(SG::WriteHandle< CaloClusterCellLinkContainer > &h, xAOD::CaloClusterContainer *pClusterColl)
Finalize clusters (move CaloClusterCellLink to a separate container).
bool isValid() const
Test to see if the link can be dereferenced.
static xAOD::CaloCluster * crossedCells(const Rec::ParticleCellAssociation &association, const CaloCellContainer &cellContainer, xAOD::CaloClusterContainer &clusterContainer)
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
StatusCode initialize() override
StatusCode execute(const EventContext &ctx) const override
SG::WriteHandleKey< xAOD::TrackParticleClusterAssociationContainer > m_associationContainerName
SG::WriteHandleKey< xAOD::CaloClusterContainer > m_clusterContainerName
SG::WriteHandleKey< CaloClusterCellLinkContainer > m_clusterCellLinkName
ToolHandle< Rec::IParticleCaloCellAssociationTool > m_caloCellAssociationTool
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackParticleCollectionName
StatusCode finalize() override
~TrackParticleCellAssociationAlg()
TrackParticleCellAssociationAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual double eta() const
The pseudorapidity ( ) of the particle.
size_t size() const
size method (forwarded from CaloClusterCellLink obj)
virtual double phi() const
The azimuthal angle ( ) of the particle.
void setTrackParticleLink(const ElementLink< TrackParticleContainer > &trackParticleLink)
Sets.
void setCaloClusterLinks(const std::vector< ElementLink< CaloClusterContainer > > &caloClusterLinks)
Sets.
TrackParticleClusterAssociation_v1 TrackParticleClusterAssociation
Reference the current persistent version:
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TrackParticle_v1 TrackParticle
Reference the current persistent version: