00001
00002 #ifndef XAODMISSINGET_VERSIONS_MISSINGETCOMPONENT_V1_H
00003 #define XAODMISSINGET_VERSIONS_MISSINGETCOMPONENT_V1_H
00004
00005 #include "AthContainers/AuxElement.h"
00006
00007 #include "xAODBase/IParticle.h"
00008 #include "xAODBase/IParticleContainer.h"
00009
00010 #include "xAODMissingET/versions/MissingETCompositionBase.h"
00011 #include "xAODMissingET/MissingETContainer.h"
00012
00013 #include <vector>
00014
00015 namespace xAOD
00016 {
00018 class MissingETComponent_v1 : public SG::AuxElement
00019 {
00020 public:
00022 class Weight
00023 {
00024 public:
00025 Weight();
00026 Weight(double wpx,double wpy,double wet);
00027
00028 ~Weight();
00031 double wpx() const;
00032 double wpy() const;
00033 double wet() const;
00037 void setWpx(double wpx);
00038 void setWpy(double wpy);
00039 void setWet(double wet);
00043 double& wpx();
00044 double& wpy();
00045 double& wet();
00046 Weight& operator+=(const Weight& wght);
00047 Weight& operator-=(const Weight& wght);
00048 Weight& operator*=(const Weight& wght);
00049 Weight& operator*=(double scale);
00050 Weight& operator/=(const Weight& wght);
00051 Weight& operator/=(double scale);
00055 bool operator==(const Weight& wght) const;
00056 bool operator!=(const Weight& wght) const;
00058 private:
00061 double m_wpx;
00062 double m_wpy;
00063 double m_wet;
00065 };
00066
00067 MissingETComponent_v1(bool createStore=false);
00068 MissingETComponent_v1(const MissingET* pmetObj,MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus());
00070 MissingETComponent_v1(const MissingET* pmetObj,const IParticle* pPart,const Weight& wght=Weight(),MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus());
00072 MissingETComponent_v1(const MissingET* pmetObj,const IParticle* pPart,double wpx,double wpy,double wet,MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus());
00073 MissingETComponent_v1(const MissingETComponent_v1& compDescr);
00074 MissingETComponent_v1(const MissingETComponent_v1& compDescr,MissingETBase::Types::bitmask_t sw);
00075 MissingETComponent_v1& operator=(const MissingETComponent_v1& compDescr);
00076 virtual ~MissingETComponent_v1();
00083 bool setMET(const MissingET* pmetObj,MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus());
00085 bool setMET(const MissingETContainer_v1* pmetCont,size_t pmedIdx,MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus());
00091 bool addObject(const IParticle* pPart,const Weight& wght=Weight());
00092 bool addObject(const IParticle* pPart,double wpx,double wpy,double wet);
00099 const std::vector<double>& wpx() const;
00100 double wpx(const IParticle* pPart) const;
00101 double wpx(size_t pIdx) const;
00102
00103 bool setWpx(const std::vector<double>& wcv);
00104 bool setWpx(const IParticle* pPart,double wpx);
00105 bool setWpx(size_t pIdx,double wpx);
00106
00107 const std::vector<double>& wpy() const;
00108 double wpy(const IParticle* pPart) const;
00109 double wpy(size_t pIdx) const;
00110
00111 bool setWpy(const std::vector<double>& wpyVector);
00112 bool setWpy(const IParticle* pPart,double wpy);
00113 bool setWpy(size_t pIdx,double wpy);
00114
00115 const std::vector<double>& wet() const;
00116 double wet(const IParticle* pPart) const;
00117 double wet(size_t pIdx) const;
00118
00119 bool setWet(const std::vector<double>& wcv);
00120 bool setWet(const IParticle* pPart,double wet);
00121 bool setWet(size_t pIdx,double wet);
00122
00123 bool setWeight(const IParticle* pPart,const Weight& wght=Weight());
00124 bool setWeight(const IParticle* pPart,double wpx,double wpy,double wet);
00125 bool setWeight(size_t pIdx,const Weight& wght=Weight());
00126 bool setWeight(size_t pIdx,double wpx,double wpy,double wet);
00127
00128 const MissingETBase::Types::metlink_t& metLink() const;
00129 bool setMetLink(const MissingETBase::Types::metlink_t& metLnk);
00130 const MissingETBase::Types::objlink_vector_t& objectLinks() const;
00131 bool setObjectLinks(const MissingETBase::Types::objlink_vector_t& objLnks);
00132 MissingETBase::Types::bitmask_t statusWord() const;
00133 bool setStatusWord(MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus());
00140 bool removeContrib(const IParticle* pPart);
00141 bool removeContrib(size_t pIdx);
00142 bool removeContrib();
00143 bool resetContrib(const IParticle* pPart);
00144 bool resetContrib(size_t pIdx);
00145 bool resetContrib();
00146 bool mergeStatusWord(MissingETBase::Types::bitmask_t sw);
00147 bool clearStatusWord();
00152 const MissingET* metObject() const;
00153 const MissingETContainer_v1* metObjectContainer() const;
00154 size_t metObjectIndex() const;
00155 std::vector<const IParticle*> objects() const;
00156 std::vector<const IParticle*> objects(std::vector<Weight>& kinePars) const;
00157 std::vector<const IParticle*> objects(const std::vector<double>*& wpxPtr,
00158 const std::vector<double>*& wpyPtr,
00159 const std::vector<double>*& wetPtr) const;
00160 Weight weight(const IParticle* pPart) const;
00161 Weight weight(size_t pIdx) const;
00185 size_t findIndex(const IParticle* pPart) const;
00195 void updateLinks();
00197 void updateMETLink();
00198 size_t size() const;
00200 bool empty() const;
00208 bool operator==(const MissingETComponent_v1& contrib) const;
00209 bool operator!=(const MissingETComponent_v1& contrib) const;
00212 protected:
00214 void createPrivateStore();
00215
00222 MissingETBase::Types::objlink_vector_t& f_objectLinks();
00223 MissingETBase::Types::metlink_t& f_metLink();
00224 std::vector<double>& f_wpx();
00225 std::vector<double>& f_wpy();
00226 std::vector<double>& f_wet();
00227 MissingETBase::Types::bitmask_t& f_statusWord();
00235 bool f_removeContrib(size_t pIdx);
00236 void copyData(const MissingETComponent_v1& compDescr,MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus());
00249 template<class POBJ,class LINK> void f_setObject(const POBJ* pObj,LINK& elemLink);
00250 template<class LINK> bool f_setLink(LINK& elemLink);
00252 private:
00255 mutable const IParticle* m_lastObjectPointer;
00256 mutable size_t m_lastObjectIndex;
00258 };
00259 }
00260
00261 namespace MissingETBase
00262 {
00263 namespace Types
00264 {
00265 typedef xAOD::MissingETComponent_v1::Weight weight_t;
00266 typedef std::vector<weight_t> weight_vector_t;
00267 }
00268 }
00269
00274 MissingETBase::Types::weight_t operator+(const MissingETBase::Types::weight_t& w0,const MissingETBase::Types::weight_t& w1);
00276 MissingETBase::Types::weight_t operator-(const MissingETBase::Types::weight_t& w0,const MissingETBase::Types::weight_t& w1);
00278 MissingETBase::Types::weight_t operator*(const MissingETBase::Types::weight_t& w0,const MissingETBase::Types::weight_t& w1);
00280 MissingETBase::Types::weight_t operator/(const MissingETBase::Types::weight_t& w0,const MissingETBase::Types::weight_t& w1);
00282 MissingETBase::Types::weight_t operator*(const MissingETBase::Types::weight_t& wght,double scale);
00284 MissingETBase::Types::weight_t operator*(double scale,const MissingETBase::Types::weight_t& wght);
00286 MissingETBase::Types::weight_t operator/(const MissingETBase::Types::weight_t& wght,double scale);
00288 #include "xAODMissingET/versions/MissingETComponent_v1.icc"
00289 #endif