4 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
8 ////////////////////////////////////////////////////
9 // Inlined Methods for MissingETAssociation::ConstVec //
10 ////////////////////////////////////////////////////
12 inline xAOD::MissingETAssociation_v1::ConstVec::ConstVec()
13 : m_cpx(MissingETBase::Numerical::cpxDefault())
14 , m_cpy(MissingETBase::Numerical::cpyDefault())
15 , m_cpz(MissingETBase::Numerical::cpzDefault())
16 , m_ce(MissingETBase::Numerical::ceDefault())
17 , m_sumpt(MissingETBase::Numerical::sumptDefault())
20 inline xAOD::MissingETAssociation_v1::ConstVec::ConstVec(float cpx,float cpy,float cpz,float ce,float sumpt)
21 : m_cpx(cpx), m_cpy(cpy), m_cpz(cpz), m_ce(ce), m_sumpt(sumpt)
24 inline xAOD::MissingETAssociation_v1::ConstVec::ConstVec(const IParticle& ipar)
25 : m_cpx(ipar.p4().Px()), m_cpy(ipar.p4().Py()), m_cpz(ipar.p4().Pz()), m_ce(ipar.e()), m_sumpt(ipar.pt())
28 // inline xAOD::MissingETAssociation_v1::ConstVec::ConstVec(const ConstVec& cvec)
29 // : m_cpx(cvec.cpx()), m_cpy(cvec.cpy()), m_cpz(cvec.cpz()), m_ce(cvec.ce()), m_sumpt(cvec.sumpt())
32 inline xAOD::MissingETAssociation_v1::ConstVec::~ConstVec()
35 inline bool xAOD::MissingETAssociation_v1::ConstVec::operator!=(const ConstVec& cvec) const
36 { return !this->operator==(cvec); }
38 // ------------------------------------------------------------------ Accessors
39 inline float xAOD::MissingETAssociation_v1::ConstVec::cpx() const { return m_cpx; }
40 inline float xAOD::MissingETAssociation_v1::ConstVec::cpy() const { return m_cpy; }
41 inline float xAOD::MissingETAssociation_v1::ConstVec::cpz() const { return m_cpz; }
42 inline float xAOD::MissingETAssociation_v1::ConstVec::ce() const { return m_ce; }
43 inline float xAOD::MissingETAssociation_v1::ConstVec::sumpt() const { return m_sumpt; }
44 inline float& xAOD::MissingETAssociation_v1::ConstVec::cpx() { return m_cpx; }
45 inline float& xAOD::MissingETAssociation_v1::ConstVec::cpy() { return m_cpy; }
46 inline float& xAOD::MissingETAssociation_v1::ConstVec::cpz() { return m_cpz; }
47 inline float& xAOD::MissingETAssociation_v1::ConstVec::ce() { return m_ce; }
48 inline float& xAOD::MissingETAssociation_v1::ConstVec::sumpt() { return m_sumpt; }
50 // -------------------------------------------------------------------- Setters
51 inline void xAOD::MissingETAssociation_v1::ConstVec::setCpx(float cpx) { this->cpx() = cpx; }
52 inline void xAOD::MissingETAssociation_v1::ConstVec::setCpy(float cpy) { this->cpy() = cpy; }
53 inline void xAOD::MissingETAssociation_v1::ConstVec::setCpz(float cpz) { this->cpz() = cpz; }
54 inline void xAOD::MissingETAssociation_v1::ConstVec::setCe(float ce) { this->ce() = ce; }
55 inline void xAOD::MissingETAssociation_v1::ConstVec::setSumpt(float sumpt) { this->sumpt() = sumpt; }
57 ////////////////////////////////////////////
58 // Inlined Methods for MissingETAssociation //
59 ////////////////////////////////////////////
61 template<class POBJ,class LINK>
62 void xAOD::MissingETAssociation_v1::f_setObject(const POBJ* pObj,LINK& elemLink)
64 if ( pObj == 0 ) { return; /* FIXME throw some kind of exception */ }
65 typename LINK::BaseConstPointer pCont =
66 dynamic_cast<typename LINK::BaseConstPointer>(pObj->container());
67 // valid pointer to container of (storable) object
68 if ( pCont != 0 ) { elemLink.toIndexedElement(*pCont,pObj->index()); }
69 // POD, not storable - we still use ElementLink to hold the pointer
70 else { elemLink.setElement(pObj); }
75 bool xAOD::MissingETAssociation_v1::f_setLink(LINK& elemLink)
78 if ( *(elemLink) == 0 ) { return false; }
79 // check if object is storable
82 typename LINK::BaseConstPointer pCont = dynamic_cast<typename LINK::BaseConstPointer>((*(elemLink))->container());
84 if ( pCont != 0 ) { elemLink.toIndexedElement(*pCont,(*(elemLink))->index()); return true; }
85 else { return false; }
89 // --------------------------------------------------------- reference jet link
90 inline const MissingETBase::Types::jetlink_t& xAOD::MissingETAssociation_v1::jetLink() const
91 { static const SG::AuxElement::Accessor<MissingETBase::Types::jetlink_t> acc("jetLink"); return acc(*this); }
92 inline MissingETBase::Types::jetlink_t& xAOD::MissingETAssociation_v1::f_jetLink()
93 { static const SG::AuxElement::Accessor<MissingETBase::Types::jetlink_t> acc("jetLink"); return acc(*this); }
95 // ---------------------------------------------------------------- object link
96 inline const MissingETBase::Types::objlink_vector_t& xAOD::MissingETAssociation_v1::objectLinks() const
97 { static const SG::AuxElement::Accessor<MissingETBase::Types::objlink_vector_t> acc("objectLinks"); return acc(*this); }
98 inline MissingETBase::Types::objlink_vector_t& xAOD::MissingETAssociation_v1::f_objectLinks()
99 { static const SG::AuxElement::Accessor<MissingETBase::Types::objlink_vector_t> acc("objectLinks"); return acc(*this); }
101 // ---------------------------------------------------------- constituent vectors
103 inline const std::vector<float>& xAOD::MissingETAssociation_v1::calpx() const
104 { return m_acc_calpx(*this); }
105 inline float xAOD::MissingETAssociation_v1::calpx(const IParticle* pPart) const
106 { return this->calpx(this->findIndex(pPart)); }
107 inline const std::vector<float>& xAOD::MissingETAssociation_v1::calpy() const
108 { return m_acc_calpy(*this); }
109 inline const std::vector<float>& xAOD::MissingETAssociation_v1::calpz() const
110 { return m_acc_calpz(*this); }
111 inline const std::vector<float>& xAOD::MissingETAssociation_v1::cale() const
112 { return m_acc_cale(*this); }
113 inline const std::vector<float>& xAOD::MissingETAssociation_v1::calsumpt() const
114 { return m_acc_calsumpt(*this); }
116 inline std::vector<float>& xAOD::MissingETAssociation_v1::f_calpx()
117 { return m_acc_calpx(*this); }
118 inline std::vector<float>& xAOD::MissingETAssociation_v1::f_calpy()
119 { return m_acc_calpy(*this); }
120 inline std::vector<float>& xAOD::MissingETAssociation_v1::f_calpz()
121 { return m_acc_calpz(*this); }
122 inline std::vector<float>& xAOD::MissingETAssociation_v1::f_cale()
123 { return m_acc_cale(*this); }
124 inline std::vector<float>& xAOD::MissingETAssociation_v1::f_calsumpt()
125 { return m_acc_calsumpt(*this); }
127 inline const std::vector<float>& xAOD::MissingETAssociation_v1::trkpx() const
128 { return m_acc_trkpx(*this); }
129 inline const std::vector<float>& xAOD::MissingETAssociation_v1::trkpy() const
130 { return m_acc_trkpy(*this); }
131 inline const std::vector<float>& xAOD::MissingETAssociation_v1::trkpz() const
132 { return m_acc_trkpz(*this); }
133 inline const std::vector<float>& xAOD::MissingETAssociation_v1::trke() const
134 { return m_acc_trke(*this); }
135 inline const std::vector<float>& xAOD::MissingETAssociation_v1::trksumpt() const
136 { return m_acc_trksumpt(*this); }
138 inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trkpx()
139 { return m_acc_trkpx(*this); }
140 inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trkpy()
141 { return m_acc_trkpy(*this); }
142 inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trkpz()
143 { return m_acc_trkpz(*this); }
144 inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trke()
145 { return m_acc_trke(*this); }
146 inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trksumpt()
147 { return m_acc_trksumpt(*this); }
149 inline float xAOD::MissingETAssociation_v1::jettrkpx() const
150 { return m_acc_jettrkpx(*this); }
151 inline float xAOD::MissingETAssociation_v1::jettrkpy() const
152 { return m_acc_jettrkpy(*this); }
153 inline float xAOD::MissingETAssociation_v1::jettrkpz() const
154 { return m_acc_jettrkpz(*this); }
155 inline float xAOD::MissingETAssociation_v1::jettrke() const
156 { return m_acc_jettrke(*this); }
157 inline float xAOD::MissingETAssociation_v1::jettrksumpt() const
158 { return m_acc_jettrksumpt(*this); }
160 inline float& xAOD::MissingETAssociation_v1::f_jettrkpx()
161 { return m_acc_jettrkpx(*this); }
162 inline float& xAOD::MissingETAssociation_v1::f_jettrkpy()
163 { return m_acc_jettrkpy(*this); }
164 inline float& xAOD::MissingETAssociation_v1::f_jettrkpz()
165 { return m_acc_jettrkpz(*this); }
166 inline float& xAOD::MissingETAssociation_v1::f_jettrke()
167 { return m_acc_jettrke(*this); }
168 inline float& xAOD::MissingETAssociation_v1::f_jettrksumpt()
169 { return m_acc_jettrksumpt(*this); }
171 // --------------------------------------------------------- misc association flag
172 inline bool xAOD::MissingETAssociation_v1::isMisc() const
173 { static const SG::AuxElement::Accessor<char> acc("isMisc"); return acc(*this)!=0; }
174 inline char& xAOD::MissingETAssociation_v1::f_isMisc()
175 { static const SG::AuxElement::Accessor<char> acc("isMisc"); return acc(*this); }
177 // -------------------------------------------------------------- overlap indices
179 inline const std::vector<std::vector<size_t> >& xAOD::MissingETAssociation_v1::overlapIndices() const
180 { static const SG::AuxElement::Accessor<std::vector<std::vector<size_t> > > acc("overlapIndices"); return acc(*this); }
181 inline std::vector<size_t> xAOD::MissingETAssociation_v1::overlapIndices(const IParticle* pPart) const
182 { return this->overlapIndices(this->findIndex(pPart)); }
184 inline std::vector<std::vector<size_t> >& xAOD::MissingETAssociation_v1::f_overlapIndices()
185 {static const SG::AuxElement::Accessor<std::vector<std::vector<size_t> > > acc("overlapIndices"); return acc(*this); }
187 inline const std::vector<MissingETBase::Types::bitmask_t>& xAOD::MissingETAssociation_v1::calkey() const
188 {static const SG::AuxElement::Accessor<std::vector<MissingETBase::Types::bitmask_t> > acc("calkey"); return acc(*this); }
190 inline std::vector<MissingETBase::Types::bitmask_t>& xAOD::MissingETAssociation_v1::f_calkey()
191 {static const SG::AuxElement::Accessor<std::vector<MissingETBase::Types::bitmask_t> > acc("calkey"); return acc(*this); }
193 inline const std::vector<MissingETBase::Types::bitmask_t>& xAOD::MissingETAssociation_v1::trkkey() const
194 {static const SG::AuxElement::Accessor<std::vector<MissingETBase::Types::bitmask_t> > acc("trkkey"); return acc(*this); }
196 inline std::vector<MissingETBase::Types::bitmask_t>& xAOD::MissingETAssociation_v1::f_trkkey()
197 {static const SG::AuxElement::Accessor<std::vector<MissingETBase::Types::bitmask_t> > acc("trkkey"); return acc(*this); }
199 inline const std::vector<std::vector<unsigned char> >& xAOD::MissingETAssociation_v1::overlapTypes() const
200 { static const SG::AuxElement::Accessor<std::vector<std::vector<unsigned char> > > acc("overlapTypes"); return acc(*this); }
201 inline std::vector<unsigned char> xAOD::MissingETAssociation_v1::overlapTypes(const IParticle* pPart) const
202 { return this->overlapTypes(this->findIndex(pPart)); }
204 inline std::vector<std::vector<unsigned char> >& xAOD::MissingETAssociation_v1::f_overlapTypes()
205 {static const SG::AuxElement::Accessor<std::vector<std::vector<unsigned char> > > acc("overlapTypes"); return acc(*this); }
207 // ------------------------------------------------ Reference jet and container
208 inline const xAOD::Jet* xAOD::MissingETAssociation_v1::refJet() const
209 { return (this->jetLink().isValid() ? *this->jetLink() : (const xAOD::Jet*)0); }
211 inline const xAOD::JetContainer* xAOD::MissingETAssociation_v1::refJetContainer() const
212 { return this->refJet() != 0 ? this->jetLink().getStorableObjectPointer() : (const JetContainer*)0; }
214 inline size_t xAOD::MissingETAssociation_v1::refJetIndex() const
215 { return this->refJet() != 0 ? this->jetLink().index() : MissingETBase::Numerical::invalidIndex(); }
216 // ------------------------------------------------------------ List management
217 inline size_t xAOD::MissingETAssociation_v1::size() const { return this->objectLinks().size(); }
218 inline size_t xAOD::MissingETAssociation_v1::sizeTrk() const { return this->trke().size(); }
219 inline size_t xAOD::MissingETAssociation_v1::sizeCal() const { return this->cale().size(); }
220 inline bool xAOD::MissingETAssociation_v1::empty() const { return this->objectLinks().empty(); }
221 inline bool xAOD::MissingETAssociation_v1::removeContrib(size_t pIdx)
222 { return ( pIdx != MissingETBase::Numerical::invalidIndex() && pIdx < this->size() ) ? this->f_removeContrib(pIdx) : false; }
223 inline bool xAOD::MissingETAssociation_v1::removeContrib(const IParticle* pPart) { return this->removeContrib(this->findIndex(pPart)); }
224 inline bool xAOD::MissingETAssociation_v1::resetContrib(const IParticle* pPart) { return this->resetContrib(this->findIndex(pPart)); }
225 // ---------------------------------------------------------------- Comparators
226 inline bool xAOD::MissingETAssociation_v1::operator!=(const xAOD::MissingETAssociation_v1& assocDescr) const
227 { return !this->operator==(assocDescr); }
228 // ------------------------------------------------ Set contribution parameters
229 inline bool xAOD::MissingETAssociation_v1::setCalVec(size_t pIdx,const MissingETBase::Types::constvec_t& cvec)
230 { return this->setCalVec(pIdx,cvec.cpx(),cvec.cpy(),cvec.cpz(),cvec.ce(),cvec.sumpt()); }
231 inline bool xAOD::MissingETAssociation_v1::setTrkVec(size_t pIdx,const MissingETBase::Types::constvec_t& cvec)
232 { return this->setTrkVec(pIdx,cvec.cpx(),cvec.cpy(),cvec.cpz(),cvec.ce(),cvec.sumpt()); }
234 inline bool xAOD::MissingETAssociation_v1::clearCalVecs()
236 if(this->sizeCal()==0) return false;
237 this->f_calkey().clear();
238 this->f_calpx().clear(); this->f_calpy().clear(); this->f_calpz().clear();
239 this->f_cale().clear(); this->f_calsumpt().clear();
242 inline bool xAOD::MissingETAssociation_v1::clearTrkVecs()
244 if(this->sizeTrk()==0) return false;
245 this->f_trkkey().clear();
246 this->f_trkpx().clear(); this->f_trkpy().clear(); this->f_trkpz().clear();
247 this->f_trke().clear(); this->f_trksumpt().clear();
252 inline void xAOD::MissingETAssociation_v1::setJetTrkVec(const MissingETBase::Types::constvec_t& cvec)
253 { this->setJetTrkVec(cvec.cpx(),cvec.cpy(),cvec.cpz(),cvec.ce(),cvec.sumpt()); }
255 inline bool xAOD::MissingETAssociation_v1::setOverlaps(const IParticle* pPart,const std::vector<size_t>& overlapIndices,
256 const std::vector<unsigned char>& overlapTypes)
257 { return this->setOverlaps(this->findIndex(pPart),overlapIndices,overlapTypes); }
259 inline void xAOD::MissingETAssociation_v1::setOverrideMom(const std::map<const IParticle*,MissingETBase::Types::constvec_t>& pOverride)
260 { this->m_override = pOverride;}
261 inline std::map<const xAOD::IParticle*,MissingETBase::Types::constvec_t> xAOD::MissingETAssociation_v1::overrideMom()
262 { return this->m_override;}
263 inline void xAOD::MissingETAssociation_v1::addOverrideMom(std::map<const IParticle*,MissingETBase::Types::constvec_t>& pOverride)
264 { this->m_override.insert(pOverride.begin(),pOverride.end());}
266 inline bool xAOD::MissingETAssociation_v1::identifyOverlaps(const IParticle* pPart)
267 { return this->identifyOverlaps(this->findIndex(pPart)); }
269 inline bool xAOD::MissingETAssociation_v1::hasOverlaps(const MissingETAssociationHelper& helper,const IParticle* pPart,MissingETBase::UsageHandler::Policy p) const
270 { return this->hasOverlaps(helper,this->findIndex(pPart),p); }
272 inline bool xAOD::MissingETAssociation_v1::addOverlap(const IParticle* pPart,size_t overlapIndex,unsigned char overlapType)
273 { return this->addOverlap(this->findIndex(pPart),overlapIndex,overlapType); }
275 ////////////////////////////////////////
276 // Inlined Global Namespace Operators //
277 ////////////////////////////////////////
279 inline MissingETBase::Types::constvec_t operator+(const MissingETBase::Types::constvec_t& v0,const MissingETBase::Types::constvec_t& v1)
280 { MissingETBase::Types::constvec_t v(v0); v += v1; return v; }
282 inline MissingETBase::Types::constvec_t operator-(const MissingETBase::Types::constvec_t& v0,const MissingETBase::Types::constvec_t& v1)
283 { MissingETBase::Types::constvec_t v(v0); v -= v1; return v; }
285 inline MissingETBase::Types::constvec_t operator*(const MissingETBase::Types::constvec_t& cvec,float scale)
286 { MissingETBase::Types::constvec_t v(cvec); v *= scale; return v; }
288 inline MissingETBase::Types::constvec_t operator*(float scale,const MissingETBase::Types::constvec_t& cvec)
289 { MissingETBase::Types::constvec_t v(cvec); v *= scale; return v; }
291 inline MissingETBase::Types::constvec_t operator/(const MissingETBase::Types::constvec_t& cvec,float scale)
292 { MissingETBase::Types::constvec_t v(cvec); v /= scale; return v; }
294 ///////////////////////////////////////////////////////////////
295 // The rest of the file contains doxygen documentation only! //
296 ///////////////////////////////////////////////////////////////
298 * (4) subtraction vectors
300 * The subtraction vectors @f$ (c_{x},c_{y},E) @f$ vectors to be subtracted from the object kinematics @f$ (p_{x},p_{y},p_{z},e) @f$ such that
301 * the contribution to the corresponding MET variables
302 * @f$ (p_{x}^{\rm miss}, p_{y}^{\rm miss}, \Sigma E_{\rm T}) @f$ is given by @f$ (p_{x} - c_{x}, p_{y} - c_{y}, e_{\rm T} - c_{e,\rm T}) @f$. The overall MET contribution
303 * of all @f$ i = 1 \ldots N @f$ objects of the same type (e.g., electrons, photons, jets,...) is then given by
305 * p_{x}^{\rm miss} & = & - \sum_{i = 1}^{N} p_{x,i} - c_{x,i} \ \
306 * p_{y}^{\rm miss} & = & - \sum_{i = 1}^{N} p_{y,i} - c_{y,i} \ \
307 * \Sigma E_{\rm T} & = & \sum_{i = 1}^{N} e_{\rm T} - c_{e,i}
309 * The individual constVecs are stored in vectors index-parallel to the link vector.