69 return StatusCode::SUCCESS;
75 return StatusCode::SUCCESS;
89 return StatusCode::FAILURE;
95 return StatusCode::FAILURE;
101 return StatusCode::FAILURE;
107 return StatusCode::FAILURE;
113 return StatusCode::FAILURE;
119 return StatusCode::FAILURE;
125 return StatusCode::FAILURE;
130 return StatusCode::FAILURE;
135 return StatusCode::FAILURE;
138 return StatusCode::SUCCESS;
150 return StatusCode::FAILURE;
155 std::vector<const IParticle*> chargedTruth;
156 std::vector<const IParticle*> jetTruth;
157 std::vector<ElementLink<IParticleContainer> > jetconst;
158 jetTruth.reserve(20);
159 for(
const auto *
const jet : *jetCont) {
171 if(fabs(truth->
charge())>1
e-6) {
175 jetconst.push_back(el);
176 jetTruth.push_back(truth);
194 return StatusCode::SUCCESS;
206 metCont->
push_back(metCoreChargedCentralTruth);
212 if (!truthEventCont.
isValid()) {
214 return StatusCode::FAILURE;
218 const TruthEvent* hsevent = truthEventCont->front();
230 <<
" unique truth particles.");
231 for(
const auto *
const part : *uniqueTruth) {
237 if(truth->
pt()<1 || fabs(truth->
eta())>5)
continue;
239 <<
" status " << truth->
status()
240 <<
" pdgId " << truth->
pdgId() );
241 if(fabs(truth->
charge())>1
e-6) {
243 if(fabs(truth->
eta())<2.5) *metCoreChargedCentralTruth += truth;
244 *metCoreChargedTruth += truth;
246 if(!truth->
isMuon()) *metCoreAllTruth += truth;
249 return StatusCode::SUCCESS;
255 std::vector<const xAOD::IParticle*>& truthlist)
const
257 switch(obj->type()) {
267 ATH_MSG_WARNING(
"Invalid object type " << obj->type() <<
" passed to extractTruthParticle");
271 return StatusCode::FAILURE;
275 std::vector<const xAOD::IParticle*>& truthlist)
const
281 truthlist.push_back(eltruth);
292 if (!truthEventCont.
isValid()) {
294 return StatusCode::SUCCESS;
299 const TruthEvent* hsevent = truthEventCont->front();
308 for(
const auto truth : truthParticleCont) {
309 if(truth->pt()<1)
continue;
311 if(!truth->isGenStable())
continue;
314 float etasize = 0.025/2;
315 float phisize = 0.025/2;
316 bool isSuperCluster =
false;
318 switch(el->caloCluster()->clusterSize()) {
320 etasize *= 5; phisize *=5;
323 etasize *= 3; phisize *=5;
326 etasize *= 3; phisize *=7;
329 isSuperCluster =
true;
334 ATH_MSG_WARNING(
"Unexpected electron cluster size " << el->caloCluster()->clusterSize() <<
" received!");
337 float deltaEta(fabs(truth->eta()-el->caloCluster()->eta()));
338 float deltaPhi(fabs(truth->p4().DeltaPhi(el->caloCluster()->p4())));
339 if( (isSuperCluster && (deltaEta*deltaEta+
deltaPhi*
deltaPhi)<Rsize*Rsize ) ||
340 (deltaEta<etasize &&
deltaPhi<phisize) ) {
342 for(
const auto& truthobj : truthlist) {
344 if(truth==truth2) {
skip =
true;
break;}
347 truthlist.push_back(truth);
352 return StatusCode::SUCCESS;
356 std::vector<const xAOD::IParticle*>& truthlist)
const
362 truthlist.push_back(phtruth);
386 if (!truthEventCont.
isValid()) {
388 return StatusCode::SUCCESS;
392 const TruthEvent* hsevent = truthEventCont->front();
401 for(
const auto truth : truthParticleCont) {
402 if(!truth || truth->pt()<1)
continue;
404 if(!truth->isGenStable())
continue;
407 float etasize(0.025/2);
408 float phisize(0.025/2);
409 bool isSuperCluster =
false;
414 etasize *= 5; phisize *=5;
419 etasize *= 3; phisize *=5;
423 etasize *= 3; phisize *=7;
426 isSuperCluster =
true;
436 if( (isSuperCluster && (deltaEta*deltaEta+
deltaPhi*
deltaPhi)<Rsize*Rsize ) ||
437 (deltaEta<etasize &&
deltaPhi<phisize) ) {
439 for(
const auto& truthobj : truthlist) {
441 if(truth==truth2) {
skip =
true;
break;}
444 truthlist.push_back(truth);
449 return StatusCode::SUCCESS;
453 std::vector<const xAOD::IParticle*>& truthlist)
460 truthlist.push_back(truth);
461 return StatusCode::SUCCESS;
465 std::vector<const xAOD::IParticle*>& truthlist)
const
469 std::vector<ElementLink<IParticleContainer> > jetconst =
cacc_ghosttruth(*seedjet);
470 for(
const auto& truth : jetconst) {
475 truthlist.push_back(*truth);
478 return StatusCode::SUCCESS;
488 std::vector<const IParticle*> constlist;
489 constlist.reserve(20);
490 std::vector<const IParticle*> hardObjs_tmp;
491 for(
const auto *
const obj : *hardObjs) {
492 hardObjs_tmp.push_back(obj);
496 for(
const auto& obj : hardObjs_tmp) {
499 ATH_MSG_VERBOSE(
"Object type, pt, eta, phi = " << obj->type() <<
", " << obj->pt() <<
", " << obj->eta() <<
"," << obj->phi() );
505 for(
const auto& truthobj : constlist) {
508 <<
" status " << truth->
status()
509 <<
" pdgId " << truth->
pdgId()
510 <<
" charge " << truth->
charge());
524 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
DataVector adapter that acts like it holds const pointers.
ATLAS-specific HepMC functions.
DataVector adapter that acts like it holds const pointers.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const DV * asDataVector() const
Return a pointer to this object, as a const DataVector.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
SG::ConstAccessor< T, ALLOC > ConstAccessor
size_t index() const
Return the index of this element within its container.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
static StatusCode extractTruthFromMuon(const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &truthlist)
SG::ReadHandleKey< xAOD::JetContainer > m_recoJetKey
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truthEventKey
StatusCode extractTruthParticles(const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &truthlist) const
SG::ReadHandleKey< xAOD::ElectronContainer > m_recoElKey
StatusCode computeSoftTerms(xAOD::MissingETContainer *metCont, xAOD::MissingETAssociationMap *metMap) const
METTruthAssociator()
Default constructor:
StatusCode initialize()
Dummy implementation of the initialisation function.
StatusCode extractTruthFromElectron(const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &truthlist) const
SG::ReadHandleKey< xAOD::TauJetContainer > m_recoTauKey
StatusCode extractTruthFromPhoton(const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &truthlist) const
StatusCode executeTool(xAOD::MissingETContainer *metCont, xAOD::MissingETAssociationMap *metMap) const
SG::ReadHandleKey< xAOD::MuonContainer > m_recoMuKey
SG::ReadHandleKey< xAOD::PhotonContainer > m_recoGamKey
StatusCode associateJets(xAOD::MissingETAssociationMap *metMap) const
StatusCode extractTruthFromTau(const xAOD::IParticle *obj, std::vector< const xAOD::IParticle * > &truthlist) const
StatusCode fillAssocMap(xAOD::MissingETAssociationMap *metMap, const xAOD::IParticleContainer *hardObjs) const final
ClusterSize clusterSize() const
Get cluster size.
double getMomentValue(MomentType type) const
Retrieve individual moment - no check for existance! Returns -999 on error.
virtual double eta() const
The pseudorapidity ( ) of the particle.
@ SECOND_R
Second Moment in .
virtual FourMom_t p4() const
The full 4-momentum of the particle.
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
Class providing the definition of the 4-vector interface.
const IParticleContainer * getUniqueSignals(const IParticleContainer *signals, MissingETBase::UsageHandler::Policy p=MissingETBase::UsageHandler::TrackCluster) const
Extract a container of constituents that are not in jets.
size_t findIndex(const Jet *pJet) const
float cpt() const
Returns .
const JetLink_t & jetLink() const
const TruthParticle * truthParticle(size_t index) const
Get a pointer to one of the truth particles.
size_t nTruthParticles() const
Get the number of truth particles.
int status() const
Status code.
int pdgId() const
PDG ID code.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
bool isGenStable() const
Check if this is generator stable particle.
double charge() const
Physical charge.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
bool isMuon() const
Whether the particle is a muon (or antimuon)
bool isInteracting(const T &p)
Identify if the particle with given PDG ID would not interact with the detector, i....
xAOD::MissingETAssociation_v1::ConstVec constvec_t
Type for constituent vector.
@ TruthParticle
Truth particle based.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
static const SG::AuxElement::ConstAccessor< std::vector< ElementLink< IParticleContainer > > > cacc_ghosttruth("GhostTruth")
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
@ Photon
The object is a photon.
@ Muon
The object is a muon.
@ Electron
The object is an electron.
@ Tau
The object is a tau (jet)
bool isInDeltaR(const xAOD::IParticle &p1, const xAOD::IParticle &p2, double dR, bool useRapidity=true)
Check if 2 xAOD::IParticle are in a cone.
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
Return the truthParticle associated to the given IParticle (if any)
Jet_v1 Jet
Definition of the current "jet version".
MissingET_v1 MissingET
Version control by type defintion.
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TauJet_v3 TauJet
Definition of the current "tau version".
MissingETContainer_v1 MissingETContainer
TruthEvent_v1 TruthEvent
Typedef to implementation.
TruthParticle_v1 TruthParticle
Typedef to implementation.
Muon_v1 Muon
Reference the current persistent version:
Photon_v1 Photon
Definition of the current "egamma version".
MissingETAssociationMap_v1 MissingETAssociationMap
Version control by type defintion.
Electron_v1 Electron
Definition of the current "egamma version".
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
@ Calo
Indicator for MET terms reconstructed from calorimeter signals alone.
@ ID
Indicator for MET terms reconstructed from inner detector (ID) tracks alone.
static Types::bitmask_t truthInt(Region reg=Region::FullAcceptance)
Standard bit pattern indicating effective true MET.
static Types::bitmask_t softEvent(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed soft event.
@ Central
Indicator for MET contribution from the central region.
static bool addMiscAssociation(MissingETAssociationMap *pMap)
Add an association to hold objects not associated to any jet.
static bool insert(MissingETComponentMap *pMap, const MissingET *pMET, const IParticle *pPart, MissingETBase::Types::weight_t weight=MissingETBase::Types::weight_t())
Insert contributing signal or physics object by pointer, with optional kinematic weight object.
static bool add(MissingETComponentMap *pMap, const MissingET *pMET, MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus())
Adding a MissingET object to the map.