64 this->
cpx() *= scale; this->
cpy() *= scale; this->
cpz() *= scale; this->
ce() *= scale;
65 this->
sumpt() *= scale;
71 if ( scale <1
e-9 ) { this->
cpx() = 0.; this->
cpy() = 0.; this->
cpz() = 0.; this->
ce() = 0.; this->
sumpt() = 0.;
return *
this; }
87 return sqrt(this->
cpx()*this->
cpx()+this->
cpy()*this->
cpy());
121 if((&assocDescr) !=
this) {
162 for(
const auto& signal : constlist) {
174 vector<MissingETBase::Types::objlink_t > linklist;
175 linklist.reserve(constlist.size());
176 for(
const auto& signal : constlist) {
179 linklist.push_back(el);
213 if ( this->
empty() ) {
return false; }
215 {
size_t nEnt(this->
size());
for (
size_t objIdx(0); objIdx<nEnt; ++objIdx ) { this->
f_removeContrib(objIdx); }
return true; }
220 objlink_vector_t::iterator fCon(this->
f_objectLinks().begin()); std::advance<objlink_vector_t::iterator>(fCon,objIdx);
268 objlink_vector_t::const_iterator fLnk(this->
objectLinks().begin());
271 if((*fLnk).isValid()) {
272 if(*(*fLnk) == pPart)
break;
277 return std::distance(this->
objectLinks().begin(),fLnk);
283 for (
size_t ind = 0; ind < this->
sizeCal(); ind++)
if (mask==this->
calkey()[ind])
return ind;
289 for (
size_t ind = 0; ind < this->
sizeTrk(); ind++)
if (mask==this->
trkkey()[ind])
return ind;
298 { this->
f_calpx().clear(); this->
f_calpx().insert(this->
f_calpx().end(),calpxvec.begin(),calpxvec.end());
return !this->
f_calpx().empty(); }
300 { this->
f_calpy().clear(); this->
f_calpy().insert(this->
f_calpy().end(),calpyvec.begin(),calpyvec.end());
return !this->
f_calpy().empty(); }
302 { this->
f_calpz().clear(); this->
f_calpz().insert(this->
f_calpz().end(),calpzvec.begin(),calpzvec.end());
return !this->
f_calpz().empty(); }
304 { this->
f_cale().clear(); this->
f_cale().insert(this->
f_cale().end(),calevec.begin(),calevec.end());
return !this->
f_cale().empty(); }
311 { this->
f_trkpx().clear(); this->
f_trkpx().insert(this->
f_trkpx().end(),trkpxvec.begin(),trkpxvec.end());
return !this->
f_trkpx().empty(); }
313 { this->
f_trkpy().clear(); this->
f_trkpy().insert(this->
f_trkpy().end(),trkpyvec.begin(),trkpyvec.end());
return !this->
f_trkpy().empty(); }
315 { this->
f_trkpz().clear(); this->
f_trkpz().insert(this->
f_trkpz().end(),trkpzvec.begin(),trkpzvec.end());
return !this->
f_trkpz().empty(); }
317 { this->
f_trke().clear(); this->
f_trke().insert(this->
f_trke().end(),trkevec.begin(),trkevec.end());
return !this->
f_trke().empty(); }
342 this->
f_calsumpt()[keyIdx] = sumpt;
return true;
343 }
else {
return false; }
348 if(key==testkey)
return false;
351 this->
f_calpx().push_back(calpx);
352 this->
f_calpy().push_back(calpy);
353 this->
f_calpz().push_back(calpz);
354 this->
f_cale().push_back(cale);
376 this->
f_trksumpt()[keyIdx] = sumpt;
return true;
377 }
else {
return false; }
382 if(key==testkey)
return false;
385 this->
f_trkpx().push_back(trkpx);
386 this->
f_trkpy().push_back(trkpy);
387 this->
f_trkpz().push_back(trkpz);
388 this->
f_trke().push_back(trke);
430 }
else {
return false; }
436 bool wasSet(this->
f_jetLink().getStorableObjectPointer() !=
nullptr);
443 bool wasSet(this->
f_jetLink().getStorableObjectPointer() !=
nullptr);
450 bool wasSet(this->
f_jetLink().getStorableObjectPointer() !=
nullptr);
505 vector<const IParticle*> pVec;
506 for ( objlink_vector_t::const_iterator fLnk(this->
objectLinks().begin()); fLnk != this->
objectLinks().end(); ++fLnk) {pVec.push_back((*fLnk).isValid()?*(*fLnk):
nullptr); }
513 vector<const IParticle*> pVec(nEnt,(
const IParticle*)
nullptr);
516 for (
size_t idx(0); idx < nEnt; ++idx ) pVec[idx] = *(this->
objectLinks().at(idx));
523 const std::vector<float>*& calpzPtr,
const std::vector<float>*& calePtr,
524 const std::vector<float>*& calsumptPtr,
525 const std::vector<float>*& trkpxPtr,
const std::vector<float>*& trkpyPtr,
526 const std::vector<float>*& trkpzPtr,
const std::vector<float>*& trkePtr,
527 const std::vector<float>*& trksumptPtr)
const
529 calpxPtr = &(this->
calpx()); calpyPtr = &(this->
calpy()); calpzPtr = &(this->
calpz()); calePtr = &(this->
cale()); calsumptPtr = &(this->
calsumpt());
530 trkpxPtr = &(this->
trkpx()); trkpyPtr = &(this->
trkpy()); trkpzPtr = &(this->
trkpz()); trkePtr = &(this->
trke()); trksumptPtr = &(this->
trksumpt());
541 for (
size_t iKey = 0; iKey < this->
sizeCal(); iKey++) {
543 totalvec+=this->
calVec(iKey);
551 for (
size_t iKey = 0; iKey < this->
sizeTrk(); iKey++) {
553 totalvec+=this->
trkVec(iKey);
595 }
else {
return false; }
602 std::map<MissingETBase::Types::bitmask_t,MissingETBase::Types::constvec_t> trkOverlaps;
603 std::map<MissingETBase::Types::bitmask_t,MissingETBase::Types::constvec_t> calOverlaps;
605 for(
size_t iObj=0; iObj<this->
objectLinks().size(); ++iObj) {
606 const vector<ElementLink<IParticleContainer> >& myConst =
m_objConstLinks[iObj];
607 for (
size_t iConst=0; iConst<myConst.size(); ++iConst) {
611 for (
const auto& objpair :
objects) {
635 const PFO* pfo =
static_cast<const PFO*
>(obj);
653 if(fabs(tp->charge())>0.)
660 for (
const auto& calpair : calOverlaps) {
665 for (
const auto& trkpair : trkOverlaps) {
671 bool foundOverlaps(
false);
672 for(
size_t iObj=0; iObj<this->
objectLinks().size(); ++iObj) {
675 return foundOverlaps;
682 const vector<MissingETBase::Types::objlink_t >& myConst =
m_objConstLinks[objIdx];
686 for(
size_t iTargetObj=objIdx+1; iTargetObj<this->
objectLinks().size(); ++iTargetObj) {
687 const vector<MissingETBase::Types::objlink_t >& checkConst =
m_objConstLinks[iTargetObj];
688 bool overlapFound(
false);
691 for(vector<size_t>::const_iterator iOverlap=myOverlaps.begin();
692 iOverlap!=myOverlaps.end() && !overlapFound; ++iOverlap) {
693 overlapFound = (*iOverlap) == iTargetObj;
695 if(overlapFound)
continue;
697 for(
const auto& mine : myConst) {
698 for(
const auto& target : checkConst) {
699 overlapFound |= ( mine == target );
722 for(
size_t iOL=0; iOL<indices.size(); ++iOL) {
723 if(helper.objSelected(
this, indices[iOL])) {
739 if(
types[iOL] & 1) {
break;}
765 for (
size_t iKey = 0; iKey < this->
sizeCal(); iKey++)
if (mask & this->
calkey()[iKey]) newpt += this->
calVec(iKey);
766 newvec.SetPxPyPzE(newpt.
cpx(),newpt.
cpy(),newpt.
cpz(),newpt.
ce());
773 for (
size_t iKey = 0; iKey < this->
sizeCal(); iKey++) {
774 bool selector = (helper.getObjSelectionFlags(
this) & this->
calkey()[iKey]) ? !this->
isMisc() : this->
isMisc();
775 if (selector) calvec+=this->
calVec(iKey);
783 for (
size_t iKey = 0; iKey < this->
sizeTrk(); iKey++) {
784 bool selector = (helper.getObjSelectionFlags(
this) & this->
trkkey()[iKey]) ? !this->
isMisc() : this->
isMisc();
804 for(
size_t iObj=0; iObj<this->
objectLinks().size(); ++iObj) {
821 for(
size_t iObj=0; iObj<this->
objectLinks().size(); ++iObj) {
822 if(helper.objSelected(
this,iObj)) {
824 if(el == link)
return true;
bool toIndexedElement(BaseConstReference data, index_type elemID, IProxyDict *sg=0)
Set the link to an element given by index and pointer to container.
void makePrivateStore()
Create a new (empty) private store for this object.
SG::Accessor< T, ALLOC > Accessor
const SG::AuxVectorData * container() const
Return the container holding this element.
AuxElement()
Default constructor.
size_t index() const
Return the index of this element within its container.
Class providing the definition of the 4-vector interface.
Vector sum of constituents for subtractive overlap removal.
ConstVec & operator+=(const ConstVec &cvec)
Add another vector.
float ce() const
Returns .
float sumpt() const
Returns sum of component pt.
bool operator==(const ConstVec &cvec) const
Equality comparator.
float cpz() const
Returns .
float cpt() const
Returns .
ConstVec & operator-=(const ConstVec &cvec)
Subtract another vector.
float cpx() const
Returns .
float cpy() const
Returns .
ConstVec & operator*=(float scale)
Scale vector by multiplication.
ConstVec()
Default constructor.
ConstVec & operator/=(float scale)
Scale vector by division.
bool isMisc() const
Check if this association is a miscellaneous association.
const std::vector< float > & cale() const
Get the vector of .
bool setCalSumpt(const std::vector< float > &calsumptvec)
Set the vector of sumpt.
std::vector< float > & f_calpz()
bool setOverlaps(const std::vector< std::vector< size_t > > &overlapIndices, const std::vector< std::vector< unsigned char > > &overlapTypes)
Set the vector of overlap indices and types.
const Jet * refJet() const
Access reference jet.
std::vector< float > & f_cale()
const MissingETBase::Types::objlink_vector_t & objectLinks() const
Get the vector of links to the contributing physics or signal objects.
const std::vector< MissingETBase::Types::bitmask_t > & calkey() const
Get the vector of cal keys.
bool checkUsage(const MissingETAssociationHelper &helper, const IParticle *pSig, MissingETBase::UsageHandler::Policy p) const
Check if this signal object matches the constituents of any flagged contributing objects.
static const SG::AuxElement::Accessor< float > m_acc_jettrke
std::vector< std::vector< ElementLink< IParticleContainer > > > m_objConstLinks
Cache object constituents for overlap-finding.
float jettrkpx() const
Get the vector for a given object referenced by index.
const std::vector< float > & trksumpt() const
Get the vector of .
void setJetTrkPy(float py)
Set track constituent vector for the reference jet.
size_t size() const
Update all internally used ElementLink instances.
bool setTrkPy(const std::vector< float > &trkpyvec)
Set the vector of .
void setJetTrkE(float e)
Set track constituent vector for the reference jet.
bool f_setLink(LINK &elemLink)
ConstVec trkVec(const IParticle *pPart) const
Get track constituent vector for a given object.
static const SG::AuxElement::Accessor< std::vector< float > > m_acc_trkpz
const std::vector< float > & calsumpt() const
Get the vector of sumpt.
void clearOverlaps()
Clear the vectors of overlap indices.
const std::vector< std::vector< unsigned char > > & overlapTypes() const
Get the list of object overlapTypes.
static const SG::AuxElement::Accessor< std::vector< float > > m_acc_calsumpt
static const SG::AuxElement::Accessor< std::vector< float > > m_acc_calpz
bool setCalE(const std::vector< float > &calevec)
Set the vector of .
bool setRefJet(const Jet *pJet)
Set reference jet by object pointer reference.
const std::vector< float > & calpy() const
Get the vector of .
void setJetTrkPx(float px)
Set track constituent vector for the reference jet.
ConstVec overlapTrkVec(const MissingETAssociationHelper &helper) const
Retrieve total track-based vector to be subtracted from the jet.
std::vector< const IParticle * > objects() const
Access contributing objects.
static const SG::AuxElement::Accessor< float > m_acc_jettrkpz
bool addOverlap(const IParticle *pPart, size_t index, unsigned char type)
Add overlap index for a given contributing object referenced by pointer.
float jettrkpy() const
Get the vector for a given object referenced by pointer.
const std::vector< MissingETBase::Types::bitmask_t > & trkkey() const
Get the vector of trk keys.
std::vector< float > & f_calsumpt()
bool addTrkVec(MissingETBase::Types::bitmask_t key, float trkpx, float trkpy, float trkpz, float ce, float sumpt)
Add a key/vector pair for calo contributions.
MissingETBase::Types::objlink_vector_t & f_objectLinks()
Non-const link reference.
const std::vector< float > & trkpy() const
Get the vector of .
static const SG::AuxElement::Accessor< std::vector< float > > m_acc_trksumpt
bool setTrkPx(const std::vector< float > &trkpxvec)
Set the vector of .
xAOD::JetFourMom_t getAlternateConstVec() const
bool hasAlternateConstVec() const
size_t findTrkIndex(MissingETBase::Types::bitmask_t mask) const
bool hasOverlaps(const MissingETAssociationHelper &helper, size_t objIdx, MissingETBase::UsageHandler::Policy p=MissingETBase::UsageHandler::OnlyCluster) const
Check if any selected particles overlap this one.
ConstVec overlapCalVec(const MissingETAssociationHelper &helper) const
Retrieve total cluster-based vector to be subtracted from the jet.
bool setJetLink(const MissingETBase::Types::jetlink_t &jetLnk)
Set the link to the reference jet.
bool removeContrib()
Remove all contributions.
bool setObjectLinks(const MissingETBase::Types::objlink_vector_t &objLnks)
Set the vector of links to the contributing physics or signal objects.
const std::vector< float > & trkpz() const
Get the vector of .
bool containsSignal(const IParticle *pSig) const
Check if this signal object matches the constituents of any contributing objects.
static const SG::AuxElement::Accessor< float > m_acc_jettrkpx
void setJetTrkPz(float pz)
Set track constituent vector for the reference jet.
std::vector< std::vector< size_t > > & f_overlapIndices()
record overlapIndices between constributing objects
std::vector< float > & f_trkpz()
bool setCalPx(const std::vector< float > &calpxvec)
Set the vector of .
static const SG::AuxElement::Accessor< std::vector< float > > m_acc_calpy
void setJetTrkSumpt(float sumpt)
Set track constituent vector for the reference jet.
virtual ~MissingETAssociation_v1()
Assignment operator.
std::map< const IParticle *, ConstVec > m_override
std::vector< float > & f_trkpx()
const std::vector< float > & trke() const
Get the vector of .
bool addObject(const IParticle *pPart, const std::vector< const IParticle * > &constlist)
Add object (particle) from pointer reference with individual constituent vectors.
const MissingETBase::Types::jetlink_t & jetLink() const
Get the link to the reference jet.
bool setTrkE(const std::vector< float > &trkevec)
Set the vector of .
static const SG::AuxElement::Accessor< std::vector< float > > m_acc_trke
static const SG::AuxElement::Accessor< std::vector< float > > m_acc_trkpy
ConstVec jetTrkVec() const
Get track constituent vector for the reference jet.
static const SG::AuxElement::Accessor< std::vector< float > > m_acc_trkpx
std::vector< MissingETBase::Types::bitmask_t > & f_calkey()
bool setCalVec(size_t keyIdx, const ConstVec &cvec=ConstVec())
Set the calo constituent vector of an object contribution referenced by index.
std::vector< float > & f_trkpy()
static const SG::AuxElement::Accessor< float > m_acc_jettrksumpt
const std::vector< float > & calpz() const
Get the vector of .
bool containsPhysics(const IParticle *pPhys) const
Check if this physics object matches any contributing objects.
bool identifyOverlaps()
Loop over contributing objects to identify those that share constituents.
std::vector< float > & f_trksumpt()
bool f_removeContrib(size_t objIdx)
Copy the contribution data from a source.
bool empty() const
Empty list of contributing objects indicator.
void f_setObject(const POBJ *pObj, LINK &elemLink)
Generalized link manager.
static const SG::AuxElement::Accessor< std::vector< float > > m_acc_cale
size_t findCalIndex(MissingETBase::Types::bitmask_t mask) const
MissingETAssociation_v1 & operator=(const MissingETAssociation_v1 &assocDescr)
std::vector< std::vector< unsigned char > > & f_overlapTypes()
record overlapTypes between constributing objects
bool setTrkPz(const std::vector< float > &trkpzvec)
Set the vector of .
void createPrivateStore()
Function initialising the object to work in standalone mode.
float jettrkpz() const
Get the vector for a given object referenced by pointer.
static const SG::AuxElement::Accessor< std::vector< float > > m_acc_calpx
float jettrksumpt() const
Get the sumpt for a given object referenced by index.
const std::vector< float > & trkpx() const
Get the vector of .
bool setCalPz(const std::vector< float > &calpzvec)
Set the vector of .
bool setCalKey(const std::vector< MissingETBase::Types::bitmask_t > &calkeyvec)
Set the vector of keys.
bool resetContrib()
Reset all contribution parameters.
bool operator==(const MissingETAssociation_v1 &contrib) const
bool addCalVec(MissingETBase::Types::bitmask_t key, float calpx, float calpy, float calpz, float cale, float sumpt)
Add a key/vector pair for calo contributions.
std::vector< float > & f_calpy()
bool setTrkKey(const std::vector< MissingETBase::Types::bitmask_t > &trkkeyvec)
Set the vector of keys.
size_t findIndex(const IParticle *pPart) const
Find index of given object in contributing object store.
float jettrke() const
Get the vector for a given object referenced by index.
void setJetTrkVec(const ConstVec &cvec=ConstVec())
Set the track constituent vector for the reference jet.
const std::vector< float > & calpx() const
Get the vector of .
std::vector< float > & f_calpx()
MissingETBase::Types::jetlink_t & f_jetLink()
Non-const link reference.
void initCache()
initialise cache for overlap removal decisions
bool setCalPy(const std::vector< float > &calpyvec)
Set the vector of .
static bool testPolicy(const xAOD::IParticle &part, MissingETBase::UsageHandler::Policy p)
std::vector< MissingETBase::Types::bitmask_t > & f_trkkey()
const std::vector< std::vector< size_t > > & overlapIndices() const
Get the list of object overlapIndices.
ConstVec calVec(const IParticle *pPart) const
Get calo constituent vector for a given object.
MissingETAssociation_v1(bool createStore=false)
Default constructor.
bool setTrkSumpt(const std::vector< float > &trksumptvec)
Set the vector of .
bool setTrkVec(size_t keyIdx, const ConstVec &cvec=ConstVec())
Set the track constituent vector of an object contribution referenced by index.
static const SG::AuxElement::Accessor< float > m_acc_jettrkpy
std::vector< float > & f_trke()
bool isCharged() const
is a charged PFO
xAOD::Type::ObjectType signalToXAODType(const xAOD::FlowElement &fe)
Namespace for generally used type definitions.
xAOD::MissingETAssociation_v1::ConstVec constvec_t
Type for constituent vector.
uint64_t bitmask_t
Type for status word bit mask.
ElementLink< xAOD::JetContainer > jetlink_t
Link to Jet object.
std::vector< objlink_t > objlink_vector_t
Vector of object links type.
ElementLink< xAOD::IParticleContainer > objlink_t
Link to contributing object.
Policy
Policies on usage checks.
@ AllCalo
Inclusive except tracks.
@ OnlyTrack
Track based only.
@ OnlyCluster
CaloCluster based only.
@ TruthParticle
Truth particle based.
@ ParticleFlow
Particle Flow Object based.
@ TrackCluster
Both cluster and track based.
ObjectType
Type of objects that have a representation in the xAOD EDM.
@ TrackParticle
The object is a charged track particle.
@ ParticleFlow
The object is a particle-flow object.
@ Other
An object not falling into any of the other categories.
@ FlowElement
The object is a track-calo-cluster.
@ CaloCluster
The object is a calorimeter cluster.
@ TruthParticle
The object is a truth particle.
@ NeutralParticle
The object is a neutral particle.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Jet_v1 Jet
Definition of the current "jet version".
FlowElement_v1 FlowElement
Definition of the current "pfo version".
static const EventInfo_v1::Accessor< std::vector< std::string > > types("streamTagTypes")
TruthParticle_v1 TruthParticle
Typedef to implementation.
JetConstituentVector::iterator iterator
JetContainer_v1 JetContainer
Definition of the current "jet container version".
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
MissingETBase::Types::bitmask_t getObjMask(size_t objIndex)
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
static double cpyError()
Access error return value for constituent vector .
static double cpxError()
Access error return value for constituent vector .
static double ceError()
Access error return value for constituent vector .
static bool isEqual(double x, double y)
Test of equality.
static size_t invalidIndex()
Access invalid index indicator.
static double cpzError()
Access error return value for constituent vector .
static double sumptError()
Access error return value for constituent vector sumpt.