ATLAS Offline Software
Loading...
Searching...
No Matches
ClusterFilterTool Class Reference

#include <ClusterFilterTool.h>

Inheritance diagram for ClusterFilterTool:
Collaboration diagram for ClusterFilterTool:

Public Member Functions

 ClusterFilterTool (const std::string &, const std::string &, const IInterface *)
virtual ~ClusterFilterTool ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
bool rejectCluster (const xAOD::CaloCluster &cluster) const final
 Method to check if a given cluster has to be rejected or not based on primary vertices requirements.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

template<class T>
const T * getContainer (const std::string &containerName) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::string m_caloEntryMapName
ToolHandle< CP::ITrackVertexAssociationToolm_loosetrackvertexassoTool
std::string m_trackParticleCollectionName
std::string m_vertexCollectionName
double m_coneSize
double m_ptFractionPV0
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 21 of file ClusterFilterTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ClusterFilterTool()

ClusterFilterTool::ClusterFilterTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 12 of file ClusterFilterTool.cxx.

13 : AthAlgTool(t,n,p),
14 m_caloEntryMapName("ParticleToCaloExtensionMap"),
15 m_loosetrackvertexassoTool("LooseTrackVertexAssociationTool")
16{
17 declareInterface<IClusterFilterTool>(this);
18 declareProperty("LooseTrackVertexAssoTool", m_loosetrackvertexassoTool );
19 declareProperty("ParticleCaloEntryMapName", m_caloEntryMapName );
20 declareProperty("TrackParticleContainerName", m_trackParticleCollectionName = "InDetTrackParticles" );
21 declareProperty("VertexCollection", m_vertexCollectionName = "PrimaryVertices" );
22 declareProperty("ConeSize", m_coneSize = 0.2 );
23 declareProperty("PtFractionAtPV0", m_ptFractionPV0 = 0.1 );
24}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::string m_caloEntryMapName
std::string m_trackParticleCollectionName
ToolHandle< CP::ITrackVertexAssociationTool > m_loosetrackvertexassoTool
std::string m_vertexCollectionName

◆ ~ClusterFilterTool()

ClusterFilterTool::~ClusterFilterTool ( )
virtualdefault

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode ClusterFilterTool::finalize ( )
virtual

Definition at line 34 of file ClusterFilterTool.cxx.

34 {
35 ATH_MSG_INFO ("Finalizing " << name() << "...");
36 return StatusCode::SUCCESS;
37}
#define ATH_MSG_INFO(x)

◆ getContainer()

template<class T>
const T * ClusterFilterTool::getContainer ( const std::string & containerName) const
inlineprivate

Definition at line 57 of file ClusterFilterTool.h.

57 {
58 const T * ptr = evtStore()->retrieve< const T >( containerName );
59 if (!ptr) {
60 ATH_MSG_WARNING("Container '"<<containerName<<"' could not be retrieved");
61 }
62 return ptr;
63}
#define ATH_MSG_WARNING(x)
ServiceHandle< StoreGateSvc > & evtStore()
unsigned long long T
void * ptr(T *p)
Definition SGImplSvc.cxx:74

◆ initialize()

StatusCode ClusterFilterTool::initialize ( )
virtual

Definition at line 28 of file ClusterFilterTool.cxx.

28 {
29 ATH_MSG_INFO ("Initializing " << name() << "...");
31 return StatusCode::SUCCESS;
32}
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & IClusterFilterTool::interfaceID ( )
inlinestaticinherited

Definition at line 31 of file IClusterFilterTool.h.

31 {
33}
static const InterfaceID IID_IClusterFilterTool("IClusterFilterTool", 1, 0)

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ rejectCluster()

bool ClusterFilterTool::rejectCluster ( const xAOD::CaloCluster & cluster) const
finalvirtual

Method to check if a given cluster has to be rejected or not based on primary vertices requirements.

Parameters
CaloClusterreference to the cluster
Returns
true if the cluster has been rejected

Implements IClusterFilterTool.

Definition at line 39 of file ClusterFilterTool.cxx.

39 {
40
41 // loop on all the tracks
43 if (not allTracks) {
44 ATH_MSG_DEBUG ("No rejection applied... returning");
45 return false;
46 }
47
48 const auto *const allVertices = getContainer<xAOD::VertexContainer>(m_vertexCollectionName);
49 if (not allVertices) {
50 ATH_MSG_DEBUG ("No rejection applied... returning");
51 return false;
52 }
53
54 bool matchedPV0 = false;
55 bool matchedPVX = false;
56
57 for (const auto *const track : *allTracks) {
58 // check compatibility with PVX where X>0
59 // retrieve the caloExtensionContainer to get the track position at the calo entrance
60 IParticleToCaloExtensionMap * caloExtensionMap = nullptr;
61 if(evtStore()->retrieve(caloExtensionMap,m_caloEntryMapName).isFailure())
62 ATH_MSG_WARNING( "Unable to retrieve " << m_caloEntryMapName << " will leak the ParticleCaloExtension" );
63 const Trk::TrackParameters* pars = caloExtensionMap->readCaloEntry(track);
64 if (not pars) {
65 ATH_MSG_DEBUG( "Extrapolated parameters non existing --> No rejection applied... returning" );
66 continue;
67 }
68
69 float eta = pars->position().eta();
70 float phi = pars->position().phi();
71
72 float dPhi = P4Helpers::deltaPhi( cluster.phi(), phi);
73 float dEta = cluster.eta()-eta;
74 float dr2 = dPhi*dPhi+ dEta*dEta;
75
76 // check if the track is matching the cluster
77 if (dr2<m_coneSize*m_coneSize) {
78 if (allVertices && !allVertices->empty()) {
79 if (m_loosetrackvertexassoTool->isCompatible(*track, *(allVertices->at(0)))) {
80 ATH_MSG_DEBUG ("PV0 is matched");
81 matchedPV0 = true;
82 } else matchedPVX = true;
83 } else {
84 ATH_MSG_WARNING ("Vertex container " << m_vertexCollectionName << " is empty! Can't perform TVA! --> No rejection applied... returning");
85 return false;
86 }
87 }
88 }
89
90 return not matchedPV0 and matchedPVX;
91
92}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_DEBUG(x)
const T * getContainer(const std::string &containerName) const
const Trk::TrackParameters * readCaloEntry(const xAOD::IParticle *particle) const
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition P4Helpers.h:34
bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
bool dEta(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
ParametersBase< TrackParametersDim, Charged > TrackParameters
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_caloEntryMapName

std::string ClusterFilterTool::m_caloEntryMapName
private

Definition at line 41 of file ClusterFilterTool.h.

◆ m_coneSize

double ClusterFilterTool::m_coneSize
private

Definition at line 49 of file ClusterFilterTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_loosetrackvertexassoTool

ToolHandle<CP::ITrackVertexAssociationTool> ClusterFilterTool::m_loosetrackvertexassoTool
private

Definition at line 43 of file ClusterFilterTool.h.

◆ m_ptFractionPV0

double ClusterFilterTool::m_ptFractionPV0
private

Definition at line 52 of file ClusterFilterTool.h.

◆ m_trackParticleCollectionName

std::string ClusterFilterTool::m_trackParticleCollectionName
private

Definition at line 45 of file ClusterFilterTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexCollectionName

std::string ClusterFilterTool::m_vertexCollectionName
private

Definition at line 46 of file ClusterFilterTool.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: