ATLAS Offline Software
Loading...
Searching...
No Matches
JetParticleCenterOfMassAssociation.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5// author: jie.yu@cern.ch
6
10#include "TLorentzVector.h"
11
12using namespace std;
13using namespace xAOD;
14
17
18 declareProperty("partMatchCone", m_partMatchCone = 0.8);
19 declareProperty("parentJetCone", m_parentJetCone = 1.0);
20
21 return;
22 }
23
24
25const vector<vector<ElementLink<IParticleContainer> > >*
27
28 // up limit of the delta angle in center-of-mass frame
29 double partAngleMax = getAngleSize( m_partMatchCone );
30
31 vector<vector<ElementLink<IParticleContainer> > >* matchedparts =
32 new vector<vector<ElementLink<IParticleContainer> > >(jets.size());
33
34 for (IParticleContainer::const_iterator part_itr = parts.begin();
35 part_itr != parts.end(); ++part_itr) {
36
37 const IParticle& part = **part_itr;
38
39 static const SG::ConstAccessor< ElementLink< JetContainer > > ParentAcc ("Parent");
40 double deltaAngleMatch = 999.;
41 int matchjetidx = -1;
42 for (unsigned int iJet = 0; iJet < jets.size(); iJet++) {
43 const Jet& jet = *jets[iJet];
44
45 bool foundEL = ParentAcc.isAvailable (jet);
46 if ( ! foundEL ){
47 ATH_MSG_WARNING("PARTICLE to JET center-of-mass Associator: PARENT jet not available.");
48 continue;
49 }
50 ElementLink< JetContainer > assoParentJet = ParentAcc (jet);
51 if ( ! assoParentJet.isValid()){
52 ATH_MSG_WARNING("PARTICLE to JET center-of-mass Associator: Unable to get parent link Null ptr is returned.");
53 continue;
54 }
55 const Jet* parentJet = *(assoParentJet);
56 double jetMass = parentJet->m();
57 if (jetMass < 1000. ) jetMass = 1000.;
58
59 TLorentzVector tlv_parentj(0, 0, 0, 0);
60 tlv_parentj.SetPtEtaPhiM(parentJet->pt(), parentJet->eta(), parentJet->phi(), jetMass);
61 TVector3 t3_boost = -1. * tlv_parentj.BoostVector();
62
63 TLorentzVector tlv_subj(0, 0, 0, 0);
64 tlv_subj.SetPtEtaPhiM(jet.pt(), jet.eta(), jet.phi(), jet.m());
65
66 TLorentzVector tlv_part(0, 0, 0, 0);
67 tlv_part.SetPtEtaPhiM(part.pt(), part.eta(), part.phi(), part.m());
68
69 double dR = tlv_part.DeltaR(tlv_parentj);
70
71 // the part is first matched to the parent jet by requiring dR < parent-jet-Cone
72 if (dR < m_parentJetCone){
73 tlv_part.Boost( t3_boost );
74 tlv_subj.Boost( t3_boost );
75 double angleSubTrk = tlv_subj.Angle(tlv_part.Vect());
76 if ( angleSubTrk < deltaAngleMatch){
77 deltaAngleMatch = angleSubTrk;
78 matchjetidx = iJet;
79 }
80 }
81 }
82
83 if (matchjetidx >= 0 && deltaAngleMatch < partAngleMax) {
85 EL.toContainedElement(parts, *part_itr);
86 (*matchedparts)[matchjetidx].push_back(EL);
87 }
88 }
89
90 return matchedparts;
91}
#define ATH_MSG_WARNING(x)
Helper class to provide constant type-safe access to aux data.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
JetParticleAssociation(const std::string &name)
virtual const std::vector< std::vector< ElementLink< xAOD::IParticleContainer > > > * match(const xAOD::JetContainer &, const xAOD::IParticleContainer &) const override
virtual double eta() const
pseudo rapidity
virtual double phi() const
phi in [-pi,pi[
virtual double m() const
mass
virtual double pt() const
transverse momentum
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Class providing the definition of the 4-vector interface.
This module defines the arguments passed from the BATCH driver to the BATCH worker.
STL namespace.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
JetContainer_v1 JetContainer
Definition of the current "jet container version".
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.