ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
TCCHelpers::UFOBuilder Struct Reference

Implement a concrete CombinedUFOLoop dedicated to building UFO see TCCHelpers.h in TrackCaloClusterRecTools/. More...

Inheritance diagram for TCCHelpers::UFOBuilder:
Collaboration diagram for TCCHelpers::UFOBuilder:

Public Member Functions

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

Public Attributes

const xAOD::FlowElementContainerm_pfoContainer = nullptr
 
const TrackCaloClusterInfom_tccInfo = nullptr
 
xAOD::FlowElementContainerm_tccContainer = nullptr
 
std::vector< ElementLink< xAOD::FlowElementContainer > > m_pfoLinks
 
FourMom_t m_tcc_4p = {0.,0.,0.,0.}
 
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

Implement a concrete CombinedUFOLoop dedicated to building UFO see TCCHelpers.h in TrackCaloClusterRecTools/.

Definition at line 307 of file TrackCaloClusterTool.cxx.

Member Function Documentation

◆ combinedUFOLoop()

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

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();
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  }

◆ processPFO()

virtual void TCCHelpers::UFOBuilder::processPFO ( const xAOD::TrackParticle trk,
const xAOD::FlowElement pfo 
)
inlinevirtual

accumulate the total P4 and the pfos linked to trk

Implements TCCHelpers::CombinedUFOLoop.

Definition at line 316 of file TrackCaloClusterTool.cxx.

316  {
318 
320  m_pfoLinks.push_back(pfoLink);
321  double pfo_pt = m_useEnergy ? pfo->e() : pfo->pt();
322  const FourMom_t & totalP = m_tccInfo->trackTotalClusterPt.at(trk);
323  double totalpfo_pt = m_useEnergy ? totalP.E() : totalP.Pt();
324  m_tcc_4p += pfo->p4()*(( trk->pt() * pfo_pt / totalpfo_pt) / ((m_tccInfo->clusterToTracksWeightMap.at(pfo)).Pt()));
325  }

◆ processTrk()

virtual void TCCHelpers::UFOBuilder::processTrk ( const xAOD::TrackParticle trk)
inlinevirtual

Implements TCCHelpers::CombinedUFOLoop.

Definition at line 327 of file TrackCaloClusterTool.cxx.

327  {
328  // build the actual combined UFO
329  if(m_tcc_4p.Pt() <=0) return;
330 
335 
336  // reset accumulators for next track :
337  m_pfoLinks.clear();
338  m_tcc_4p = {0.,0.,0.,0.};
339  }

Member Data Documentation

◆ m_clusterEcut

float TCCHelpers::CombinedUFOLoop::m_clusterEcut
inherited

Definition at line 47 of file TCCHelpers.h.

◆ m_clustersLinkK

std::string TCCHelpers::CombinedUFOLoop::m_clustersLinkK
inherited

Definition at line 42 of file TCCHelpers.h.

◆ m_linkdecorkey

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

Definition at line 49 of file TCCHelpers.h.

◆ m_orig_FlowElemK

std::string TCCHelpers::CombinedUFOLoop::m_orig_FlowElemK
inherited

Definition at line 41 of file TCCHelpers.h.

◆ m_orig_pfoK

std::string TCCHelpers::CombinedUFOLoop::m_orig_pfoK
inherited

Definition at line 40 of file TCCHelpers.h.

◆ m_pfoContainer

const xAOD::FlowElementContainer* TCCHelpers::UFOBuilder::m_pfoContainer = nullptr

Definition at line 309 of file TrackCaloClusterTool.cxx.

◆ m_pfoLinks

std::vector<ElementLink< xAOD::FlowElementContainer > > TCCHelpers::UFOBuilder::m_pfoLinks

Definition at line 313 of file TrackCaloClusterTool.cxx.

◆ m_tcc_4p

FourMom_t TCCHelpers::UFOBuilder::m_tcc_4p = {0.,0.,0.,0.}

Definition at line 314 of file TrackCaloClusterTool.cxx.

◆ m_tccContainer

xAOD::FlowElementContainer* TCCHelpers::UFOBuilder::m_tccContainer = nullptr

Definition at line 311 of file TrackCaloClusterTool.cxx.

◆ m_tccInfo

const TrackCaloClusterInfo* TCCHelpers::UFOBuilder::m_tccInfo = nullptr

Definition at line 310 of file TrackCaloClusterTool.cxx.

◆ m_trackVertexAssoTool

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

Definition at line 46 of file TCCHelpers.h.

◆ m_useEnergy

bool TCCHelpers::CombinedUFOLoop::m_useEnergy
inherited

Definition at line 48 of file TCCHelpers.h.


The documentation for this struct was generated from the following file:
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:73
xAOD::CaloCluster_v1::rawE
flt_t rawE() const
xAOD::CaloCluster_v1::rawEta
flt_t rawEta() const
Get in signal state UNCALIBRATED.
xAOD::TrackParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TrackParticle_v1.cxx:77
CP::ITrackVertexAssociationTool::isCompatible
virtual bool isCompatible(const xAOD::TrackParticle &trk, const xAOD::Vertex &vx) const =0
This function just return the decision of whether the track is matched to the Vertex Not sure whether...
TCCHelpers::CombinedUFOLoop::m_orig_pfoK
std::string m_orig_pfoK
Definition: TCCHelpers.h:40
TCCHelpers::UFOBuilder::m_tccContainer
xAOD::FlowElementContainer * m_tccContainer
Definition: TrackCaloClusterTool.cxx:311
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
TrackCaloClusterInfo::allTracks
const xAOD::TrackParticleContainer * allTracks
Definition: TrackCaloClusterInfo.h:32
TrackCaloClusterInfo::trackTotalClusterPt
std::map< const xAOD::TrackParticle *, FourMom_t > trackTotalClusterPt
Definition: TrackCaloClusterInfo.h:29
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
xAOD::FlowElement_v1::pt
virtual double pt() const override
TCCHelpers::UFOBuilder::m_tccInfo
const TrackCaloClusterInfo * m_tccInfo
Definition: TrackCaloClusterTool.cxx:310
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
TCCHelpers::CombinedUFOLoop::processTrk
virtual void processTrk(const xAOD::TrackParticle *trk)=0
TCCHelpers::UFOBuilder::m_pfoContainer
const xAOD::FlowElementContainer * m_pfoContainer
Definition: TrackCaloClusterTool.cxx:309
TCCHelpers::CombinedUFOLoop::processPFO
virtual void processPFO(const xAOD::TrackParticle *trk, const xAOD::FlowElement *pfo)=0
TCCHelpers::CombinedUFOLoop::m_trackVertexAssoTool
const CP::ITrackVertexAssociationTool * m_trackVertexAssoTool
Definition: TCCHelpers.h:46
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:94
TCCHelpers::UFOBuilder::m_tcc_4p
FourMom_t m_tcc_4p
Definition: TrackCaloClusterTool.cxx:314
setParameters
void setParameters(T *h, TGraphAsymmErrors *tg)
Definition: computils.h:432
xAOD::FlowElement
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition: FlowElement.h:16
Prompt::FourMom_t
TLorentzVector FourMom_t
Definition: DecoratePLIT.h:31
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
TCCHelpers::UFOBuilder::m_pfoLinks
std::vector< ElementLink< xAOD::FlowElementContainer > > m_pfoLinks
Definition: TrackCaloClusterTool.cxx:313
TCCHelpers::CombinedUFOLoop::m_clustersLinkK
std::string m_clustersLinkK
Definition: TCCHelpers.h:42
Trk::Combined
@ Combined
Definition: TrackSummaryTool.h:32
TCCHelpers::CombinedUFOLoop::m_useEnergy
bool m_useEnergy
Definition: TCCHelpers.h:48
xAOD::FlowElement_v1::e
virtual double e() const override
The total energy of the particle.
Definition: FlowElement_v1.cxx:25
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
TrackCaloClusterInfo::clusterToTracksWeightMap
std::map< const xAOD::IParticle *, FourMom_t > clusterToTracksWeightMap
Definition: TrackCaloClusterInfo.h:30
TrackCaloClusterInfo::pv0
const xAOD::Vertex * pv0
Definition: TrackCaloClusterInfo.h:34
xAOD::FlowElement_v1::p4
virtual FourMom_t p4() const override
The full 4-momentum of the particle.
Definition: FlowElement_v1.cxx:33
xAOD::CaloCluster_v1::rawPhi
flt_t rawPhi() const
Get in signal state UNCALIBRATED.
xAOD::IParticle::eta
virtual double eta() const =0
The pseudorapidity ( ) of the particle.
TCCHelpers::CombinedUFOLoop::m_clusterEcut
float m_clusterEcut
Definition: TCCHelpers.h:47
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
xAOD::IParticle::phi
virtual double phi() const =0
The azimuthal angle ( ) of the particle.
TCCHelpers::CombinedUFOLoop::m_linkdecorkey
const SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > * m_linkdecorkey
Definition: TCCHelpers.h:49
xAOD::TrackParticle_v1::phi
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
xAOD::FlowElement_v1
A detector object made of other lower level object(s)
Definition: FlowElement_v1.h:25