71 return StatusCode::SUCCESS;
77 return StatusCode::SUCCESS;
91 return StatusCode::FAILURE;
97 return StatusCode::FAILURE;
103 return StatusCode::FAILURE;
109 return StatusCode::FAILURE;
115 return StatusCode::FAILURE;
121 return StatusCode::FAILURE;
127 return StatusCode::FAILURE;
132 return StatusCode::FAILURE;
137 return StatusCode::FAILURE;
140 return StatusCode::SUCCESS;
152 return StatusCode::FAILURE;
157 std::vector<const IParticle*> chargedTruth;
158 std::vector<const IParticle*> jetTruth;
159 std::vector<ElementLink<IParticleContainer> > jetconst;
160 jetTruth.reserve(20);
161 for(
const auto *
const jet : *jetCont) {
173 if(fabs(truth->
charge())>1
e-6) {
177 jetconst.push_back(el);
178 jetTruth.push_back(truth);
196 return StatusCode::SUCCESS;
208 metCont->
push_back(metCoreChargedCentralTruth);
214 if (!truthEventCont.
isValid()) {
216 return StatusCode::FAILURE;
220 const TruthEvent* hsevent = truthEventCont->front();
226 ATH_MSG_VERBOSE(
"Extracted truth particle with index " << tp->index() );
232 <<
" unique truth particles.");
233 for(
const auto *
const part : *uniqueTruth) {
239 if(truth->
pt()<1 || fabs(truth->
eta())>5)
continue;
241 <<
" status " << truth->
status()
242 <<
" pdgId " << truth->
pdgId() );
243 if(fabs(truth->
charge())>1
e-6) {
245 if(fabs(truth->
eta())<2.5) *metCoreChargedCentralTruth += truth;
246 *metCoreChargedTruth += truth;
248 if(!truth->
isMuon()) *metCoreAllTruth += truth;
251 return StatusCode::SUCCESS;
257 std::vector<const xAOD::IParticle*>& truthlist)
const
259 switch(obj->type()) {
269 ATH_MSG_WARNING(
"Invalid object type " << obj->type() <<
" passed to extractTruthParticle");
273 return StatusCode::FAILURE;
277 std::vector<const xAOD::IParticle*>& truthlist)
const
283 truthlist.push_back(eltruth);
294 if (!truthEventCont.
isValid()) {
296 return StatusCode::SUCCESS;
301 const TruthEvent* hsevent = truthEventCont->front();
310 for(
const auto truth : truthParticleCont) {
311 if(truth->pt()<1)
continue;
313 if(!truth->isGenStable())
continue;
316 float etasize = 0.025/2;
317 float phisize = 0.025/2;
318 bool isSuperCluster =
false;
320 switch(el->caloCluster()->clusterSize()) {
322 etasize *= 5; phisize *=5;
325 etasize *= 3; phisize *=5;
328 etasize *= 3; phisize *=7;
331 isSuperCluster =
true;
336 ATH_MSG_WARNING(
"Unexpected electron cluster size " << el->caloCluster()->clusterSize() <<
" received!");
339 float deltaEta(fabs(truth->eta()-el->caloCluster()->eta()));
340 float deltaPhi(fabs(truth->p4().DeltaPhi(el->caloCluster()->p4())));
341 if( (isSuperCluster && (deltaEta*deltaEta+
deltaPhi*
deltaPhi)<Rsize*Rsize ) ||
342 (deltaEta<etasize &&
deltaPhi<phisize) ) {
344 for(
const auto& truthobj : truthlist) {
346 if(truth==truth2) {
skip =
true;
break;}
349 truthlist.push_back(truth);
354 return StatusCode::SUCCESS;
358 std::vector<const xAOD::IParticle*>& truthlist)
const
364 truthlist.push_back(phtruth);
388 if (!truthEventCont.
isValid()) {
390 return StatusCode::SUCCESS;
394 const TruthEvent* hsevent = truthEventCont->front();
403 for(
const auto truth : truthParticleCont) {
404 if(!truth || truth->pt()<1)
continue;
406 if(!truth->isGenStable())
continue;
409 float etasize(0.025/2);
410 float phisize(0.025/2);
411 bool isSuperCluster =
false;
416 etasize *= 5; phisize *=5;
421 etasize *= 3; phisize *=5;
425 etasize *= 3; phisize *=7;
428 isSuperCluster =
true;
438 if( (isSuperCluster && (deltaEta*deltaEta+
deltaPhi*
deltaPhi)<Rsize*Rsize ) ||
439 (deltaEta<etasize &&
deltaPhi<phisize) ) {
441 for(
const auto& truthobj : truthlist) {
443 if(truth==truth2) {
skip =
true;
break;}
446 truthlist.push_back(truth);
451 return StatusCode::SUCCESS;
455 std::vector<const xAOD::IParticle*>& truthlist)
462 truthlist.push_back(truth);
463 return StatusCode::SUCCESS;
467 std::vector<const xAOD::IParticle*>& truthlist)
const
471 std::vector<ElementLink<IParticleContainer> > jetconst =
cacc_ghosttruth(*seedjet);
472 for(
const auto& truth : jetconst) {
477 truthlist.push_back(*truth);
480 return StatusCode::SUCCESS;
490 std::vector<const IParticle*> constlist;
491 constlist.reserve(20);
492 std::vector<const IParticle*> hardObjs_tmp;
493 for(
const auto *
const obj : *hardObjs) {
494 hardObjs_tmp.push_back(obj);
498 for(
const auto& obj : hardObjs_tmp) {
501 ATH_MSG_VERBOSE(
"Object type, pt, eta, phi = " << obj->type() <<
", " << obj->pt() <<
", " << obj->eta() <<
"," << obj->phi() );
507 for(
const auto& truthobj : constlist) {
510 <<
" status " << truth->
status()
511 <<
" pdgId " << truth->
pdgId()
512 <<
" charge " << truth->
charge());
526 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.
defines an "iterator" over instances of a given type in StoreGateSvc
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
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.