ATLAS Offline Software
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 
8 #include "AsgMessaging/Check.h"
10 #include "TLorentzVector.h"
11 
12 using namespace std;
13 using namespace xAOD;
14 
17 
18  declareProperty("partMatchCone", m_partMatchCone = 0.8);
19  declareProperty("parentJetCone", m_parentJetCone = 1.0);
20 
21  return;
22  }
23 
24 
25 const 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 }
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
Check.h
ParticleSigStateImpl::eta
virtual double eta() const
pseudo rapidity
Definition: ParticleSigStateImpl.h:735
JetParticleAssociation
Definition: JetParticleAssociation.h:22
Jet
Basic data class defines behavior for all Jet objects The Jet class is the principal data class for...
Definition: Reconstruction/Jet/JetEvent/JetEvent/Jet.h:47
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
ParticleSigStateImpl::m
virtual double m() const
mass
Definition: ParticleSigStateImpl.h:695
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
JetParticleCenterOfMassAssociation::m_parentJetCone
double m_parentJetCone
Definition: JetParticleCenterOfMassAssociation.h:32
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
ParticleSigStateImpl::phi
virtual double phi() const
phi in [-pi,pi[
Definition: ParticleSigStateImpl.h:743
DMTest::EL
ElementLink< CVec > EL
Definition: xAODTestReadCLinks.cxx:20
JetParticleCenterOfMassAssociation::getAngleSize
double getAngleSize(const double &par_R) const
Definition: JetParticleCenterOfMassAssociation.h:24
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
JetParticleCenterOfMassAssociation::m_partMatchCone
double m_partMatchCone
Definition: JetParticleCenterOfMassAssociation.h:31
JetParticleCenterOfMassAssociation::match
virtual const std::vector< std::vector< ElementLink< xAOD::IParticleContainer > > > * match(const xAOD::JetContainer &, const xAOD::IParticleContainer &) const override
Definition: JetParticleCenterOfMassAssociation.cxx:26
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
ParticleSigStateImpl::pt
virtual double pt() const
transverse momentum
Definition: ParticleSigStateImpl.h:767
doL1CaloHVCorrections.parts
parts
Definition: doL1CaloHVCorrections.py:334
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
JetParticleCenterOfMassAssociation::JetParticleCenterOfMassAssociation
JetParticleCenterOfMassAssociation(const std::string &name)
Definition: JetParticleCenterOfMassAssociation.cxx:15
JetParticleCenterOfMassAssociation.h