ATLAS Offline Software
Loading...
Searching...
No Matches
TCCHelpers::CombinedUFOLoop Struct Referenceabstract

Implements a loop over tracks and pflow object to build UFOs. More...

#include <TCCHelpers.h>

Inheritance diagram for TCCHelpers::CombinedUFOLoop:
Collaboration diagram for TCCHelpers::CombinedUFOLoop:

Public Member Functions

virtual ~CombinedUFOLoop ()
virtual void processPFO (const xAOD::TrackParticle *trk, const xAOD::FlowElement *pfo)=0
virtual void processTrk (const xAOD::TrackParticle *trk)=0
virtual void combinedUFOLoop (const TrackCaloClusterInfo *tccInfo, const xAOD::FlowElementContainer *pfos)

Public Attributes

std::string m_orig_pfoK
std::string m_orig_FlowElemK
std::string m_clustersLinkK
const CP::ITrackVertexAssociationToolm_trackVertexAssoTool
float m_clusterEcut
bool m_useEnergy
const SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > * m_linkdecorkey =nullptr

Detailed Description

Implements a loop over tracks and pflow object to build UFOs.

Building UFO implies running a nested loop on tracks and pflows 2 times :

  • to collect and normalize energy sharing weights
  • to use these weights to actually build the UFO The loop contains several condition and tests and so is relatively complex. Thus it is factorized in this helper base class so we avoid to copy-paste it and risk to introduce buggy differences.

The 2 clients : TrackCaloClusterInfoAlg (in TrackCaloClusterRecAlgs/) UFOTool (in TrackCaloClusterRecTools/) define derived classes which implement the only differing parts : the methods processPFO() and processTrk()

Definition at line 34 of file TCCHelpers.h.

Constructor & Destructor Documentation

◆ ~CombinedUFOLoop()

virtual TCCHelpers::CombinedUFOLoop::~CombinedUFOLoop ( )
inlinevirtual

Definition at line 36 of file TCCHelpers.h.

36{}

Member Function Documentation

◆ combinedUFOLoop()

virtual void TCCHelpers::CombinedUFOLoop::combinedUFOLoop ( const TrackCaloClusterInfo * tccInfo,
const xAOD::FlowElementContainer * pfos )
inlinevirtual

Definition at line 54 of file TCCHelpers.h.

54 {
57
58
59
60 // For performance reasons, we create a map<track, bool> before looping on the tracks.
61 std::map<const xAOD::TrackParticle*, bool> isIsolatedMatchedTrack;
62 for(const xAOD::FlowElement* pfo: *pfos ){
63 if( ! pfo->isCharged() ) continue;
64
65 static const SG::AuxElement::ConstAccessor<int> acc_isInDenseEnvironment("IsInDenseEnvironment");
66 if(!acc_isInDenseEnvironment.isAvailable(*pfo)){
67 asg::msgUserCode::ANA_MSG_ERROR("TCCHelpers.h: Dense environ variable not found, skipping given FE");
68 continue;
69 }
70 if(acc_isInDenseEnvironment(*pfo)==1){
71 continue;
72 }
73 const xAOD::IParticle* pfo_iparticle=pfo->chargedObjects().at(0);
74 //cast to track, since output of chargedObjects is an IParticle
75 const xAOD::TrackParticle* pfoTrack=dynamic_cast<const xAOD::TrackParticle*>(pfo_iparticle);
76 isIsolatedMatchedTrack[pfoTrack] = true;
77 }
78
79 if(m_linkdecorkey==nullptr){
80 asg::msgUserCode::ANA_MSG_ERROR("TCCHelpers.h m_linkdecorkey is not initialised in the struct to do anything, not sure what this means? Skip this case");
81 return;
82 }
83 const EventContext& ctx =Gaudi::Hive::currentContext();
84 SG::ReadDecorHandle<xAOD::TrackParticleContainer, std::vector<ElementLink<xAOD::CaloClusterContainer>> > trackcalodecor(*m_linkdecorkey,ctx); //init the handle
85
86 if(!trackcalodecor.isPresent()){
87 asg::msgUserCode::ANA_MSG_ERROR("TCCHelpers.h: no link between track and cluster. We need these links : "<<m_linkdecorkey->key());
88 }
89
90 for(const xAOD::TrackParticle * trk: *tccInfo->allTracks){
91 // Only include tracks which aren't associated to a charged PFO -- don't want to double count!
92 if (isIsolatedMatchedTrack.find(trk) != isIsolatedMatchedTrack.end() ) continue;
93
94 // if not matched to PV0, ignore track
95 if (! m_trackVertexAssoTool->isCompatible(*trk, *tccInfo->pv0) ) continue ;
96 //access the link ReadDecorHandle (saved as struct), and then apply it
97
98
99
100
101
102 const auto& clustLinks=trackcalodecor(*trk);
103 if(clustLinks.empty() ){
104 continue;
105 }
106
107
108 // follow the link to the calorimeter clusters
109 for( const auto& clLink : clustLinks) {
110
111 const xAOD::CaloCluster* cluster = *clLink;
112
113 // See if any of the PFO are matched to this cluster
114 for ( const xAOD::FlowElement* pfo : *pfos ){
115 if(pfo->pt()<=0.) continue;
116
117 const xAOD::IParticle* pfo_orig = nullptr;
118 if ( orig_pfo.isAvailable(*pfo) ) pfo_orig = *orig_pfo( *pfo ) ;
119 else pfo_orig = pfo;
120
121 if( !(std::abs(pfo_orig->eta() - cluster->rawEta() )<0.01 && std::abs( pfo_orig->phi() - cluster->rawPhi() )<0.01)) continue; // temp disable origin logic. Matt A: not 100% sure if its needed now anyway
122
123 if( ! pfo->isCharged() ){
124 // Only want to apply this to PFO which aren't able to be subtracted with E/p
125 if(cluster->rawE() < m_clusterEcut) continue;
126 }
127
128 // this pfo is matched to a cluster associated to the track -->
129 // Call the specialized function to accumulate either :
130 // - E sharing weights (ex: in TrackCaloClusterInfoAlg.cxx)
131 // - clusters/pfo mometum associated to the current trk (ex: TrackCaloClusterTool)
132 processPFO(trk, pfo);
133
134 } // pfo loop
135 } // cluster associated to trk loop
136
137 // When building UFO, the specialized func below will create a combined UFO from this
138 // track and the accumulated momentum from the associated cluster/pfo
139 processTrk(trk);
140
141 } // track loop
142
143
144 }
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:569
flt_t rawE() const
flt_t rawPhi() const
Get in signal state UNCALIBRATED.
flt_t rawEta() const
Get in signal state UNCALIBRATED.
virtual double eta() const =0
The pseudorapidity ( ) of the particle.
virtual double phi() const =0
The azimuthal angle ( ) of the particle.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition FlowElement.h:16
TrackParticle_v1 TrackParticle
Reference the current persistent version:
const SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > * m_linkdecorkey
Definition TCCHelpers.h:49
const CP::ITrackVertexAssociationTool * m_trackVertexAssoTool
Definition TCCHelpers.h:46
virtual void processPFO(const xAOD::TrackParticle *trk, const xAOD::FlowElement *pfo)=0
virtual void processTrk(const xAOD::TrackParticle *trk)=0
const xAOD::Vertex * pv0
const xAOD::TrackParticleContainer * allTracks

◆ processPFO()

virtual void TCCHelpers::CombinedUFOLoop::processPFO ( const xAOD::TrackParticle * trk,
const xAOD::FlowElement * pfo )
pure virtual

◆ processTrk()

virtual void TCCHelpers::CombinedUFOLoop::processTrk ( const xAOD::TrackParticle * trk)
pure virtual

Member Data Documentation

◆ m_clusterEcut

float TCCHelpers::CombinedUFOLoop::m_clusterEcut

Definition at line 47 of file TCCHelpers.h.

◆ m_clustersLinkK

std::string TCCHelpers::CombinedUFOLoop::m_clustersLinkK

Definition at line 42 of file TCCHelpers.h.

◆ m_linkdecorkey

const SG::ReadDecorHandleKey<xAOD::TrackParticleContainer>* TCCHelpers::CombinedUFOLoop::m_linkdecorkey =nullptr

Definition at line 49 of file TCCHelpers.h.

◆ m_orig_FlowElemK

std::string TCCHelpers::CombinedUFOLoop::m_orig_FlowElemK

Definition at line 41 of file TCCHelpers.h.

◆ m_orig_pfoK

std::string TCCHelpers::CombinedUFOLoop::m_orig_pfoK

Definition at line 40 of file TCCHelpers.h.

◆ m_trackVertexAssoTool

const CP::ITrackVertexAssociationTool* TCCHelpers::CombinedUFOLoop::m_trackVertexAssoTool

Definition at line 46 of file TCCHelpers.h.

◆ m_useEnergy

bool TCCHelpers::CombinedUFOLoop::m_useEnergy

Definition at line 48 of file TCCHelpers.h.


The documentation for this struct was generated from the following file: