00001
00002 #ifndef XAODMISSINGET_MISSINGETCOMPOSITION_H
00003 #define XAODMISSINGET_MISSINGETCOMPOSITION_H
00004
00005 #include "xAODMissingET/versions/MissingETCompositionBase.h"
00006 #include "xAODMissingET/MissingET.h"
00007 #include "xAODMissingET/MissingETComponent.h"
00008 #include "xAODMissingET/MissingETComponentMap.h"
00009 #include "xAODMissingET/MissingETAssociation.h"
00010 #include "xAODMissingET/MissingETAssociationMap.h"
00011 #include "xAODJet/Jet.h"
00012
00013 namespace xAOD
00014 {
00015 struct MissingETComposition
00016 {
00034 static bool add(MissingETComponentMap* pMap,const MissingET* pMET,MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus());
00044 static bool insert(MissingETComponentMap* pMap,const MissingET* pMET,const IParticle* pPart,MissingETBase::Types::weight_t weight=MissingETBase::Types::weight_t());
00052 static bool insert(MissingETComponentMap* pMap,const MissingET* pMET,const IParticle* pPart,const MissingETBase::Types::object_vector_t& signalList,
00053 MissingETBase::Types::weight_t weight=MissingETBase::Types::weight_t(),
00054 MissingETBase::UsageHandler::Policy p=MissingETBase::UsageHandler::OnlyCluster);
00065 static bool insert(MissingETComponentMap* pMap,const MissingET* pMET,const IParticle* pPart,double wpx,double wpy,double wet);
00073 static bool insert(MissingETComponentMap* pMap,const MissingET* pMET,const IParticle* pPart,const MissingETBase::Types::object_vector_t& signalList,double wpx,double wpy,double wet,
00074 MissingETBase::UsageHandler::Policy p=MissingETBase::UsageHandler::OnlyCluster);
00098 static bool updateLinks(MissingETComponentMap* pMap);
00115 static bool updateMETLinks(MissingETComponentMap* pMap);
00130 static MissingETComponentMap::const_iterator find(const MissingETComponentMap* pMap,const MissingET* pmetObj);
00131 static MissingETComponentMap::iterator find(MissingETComponentMap* pMap,const MissingET* pmetObj);
00132 static MissingETComponentMap::const_iterator find(const MissingETComponentMap* pMap,const std::string& metName);
00133 static MissingETComponentMap::iterator find(MissingETComponentMap* pMap,const std::string& metName);
00134 static MissingETComponentMap::const_iterator find(const MissingETComponentMap* pMap,MissingETBase::Types::bitmask_t src);
00135 static MissingETComponentMap::iterator find(MissingETComponentMap* pMap,MissingETBase::Types::bitmask_t src);
00136 static size_t findIndex(const MissingETComponentMap* pMap,const MissingET* pmetObj);
00137 static size_t findIndex(const MissingETComponentMap* pMap,const std::string& metName);
00138 static size_t findIndex(const MissingETComponentMap* pMap,MissingETBase::Types::bitmask_t src);
00139
00140
00149 static MissingETComponentMap::const_iterator find(const MissingETComponentMap* pMap,const IParticle* pPart);
00158 static MissingETComponentMap::iterator find(MissingETComponentMap* pMap,const IParticle* pPart);
00172 static MissingETComponentMap::const_iterator begin(const MissingETComponentMap* pMap);
00182 static MissingETComponentMap::iterator begin(MissingETComponentMap* pMap);
00183 static MissingETComponentMap::const_iterator end(const MissingETComponentMap* pMap);
00184 static MissingETComponentMap::iterator end(MissingETComponentMap* pMap);
00194 static const MissingETComponent* getComponent(const MissingETComponentMap* pMap,const IParticle* pPart);
00195 static const MissingETComponent* getComponent(const MissingETComponentMap* pMap,const MissingET* pmetObj);
00196 static const MissingETComponent* getComponent(const MissingETComponentMap* pMap,const std::string& metName);
00197 static const MissingETComponent* getComponent(const MissingETComponentMap* pMap,MissingETBase::Types::bitmask_t src);
00203 static MissingETComponent* getComponent(MissingETComponentMap* pMap,const IParticle* pPart);
00204 static MissingETComponent* getComponent(MissingETComponentMap* pMap,const MissingET* pmetObj);
00205 static MissingETComponent* getComponent(MissingETComponentMap* pMap,const std::string& metName);
00206 static MissingETComponent* getComponent(MissingETComponentMap* pMap,MissingETBase::Types::bitmask_t src);
00211 static MissingETBase::Types::weight_t getWeight(const MissingETComponentMap* pMap,const IParticle* pPart);
00212 static MissingETBase::Types::weight_t getWeight(MissingETComponentMap::const_iterator fCont,const IParticle* pPart);
00213 static MissingETBase::Types::bitmask_t getStatusWord(const MissingETComponentMap* pMap,const MissingET* pmetObj);
00214 static MissingETBase::Types::bitmask_t getStatusWord(MissingETComponentMap::const_iterator fCont);
00215 static const MissingET* getMissingET(const MissingETComponentMap* pMap,const IParticle* pPart);
00216 static const MissingET* getMissingET(MissingETComponentMap::const_iterator fCont);
00217 static const MissingET* getMissingET(const MissingETComponentMap* pMap,const std::string& name);
00218 static const MissingET* getMissingET(const MissingETComponentMap* pMap,MissingETBase::Types::bitmask_t sw);
00235 template<int OBJTYPE>
00236 static bool fillMissingET(const MissingETComponentMap* pMap,MissingET* pMET,
00237 MissingETBase::Types::bitmask_t =MissingETBase::Status::clearedStatus())
00238 {
00239 if ( pMap == 0 || pMap->empty() ) return false;
00240
00241 double sumet(pMET->sumet());
00242 MissingETComponentMap::const_iterator fComp(pMap->begin());
00243 MissingETComponentMap::const_iterator lComp(pMap->end());
00244 for ( ; fComp != lComp; ++fComp )
00245 {
00246 const MissingETComponent* pCont = *fComp;
00247 if ( pCont != 0 )
00248 {
00249
00250 MissingETBase::Types::weight_vector_t kinePars;
00251 MissingETBase::Types::object_vector_t objs = pCont->objects(kinePars);
00252 for ( size_t iObj(0); iObj<objs.size(); ++iObj )
00253 {
00254 if ( objs[iObj]->type() == OBJTYPE )
00255 {
00256 pMET->add(objs.at(iObj)->p4().Px()*kinePars.at(iObj).wpx(),
00257 objs.at(iObj)->p4().Py()*kinePars.at(iObj).wpy(),
00258 objs.at(iObj)->pt()*kinePars.at(iObj).wet());
00259 }
00260 }
00261 }
00262 }
00263 return pMET->sumet() != sumet;
00264 }
00265
00283 static bool add(MissingETAssociationMap* pMap,const Jet* pJet,
00284 const std::vector<ElementLink<IParticleContainer> >& jetconst=std::vector<ElementLink<IParticleContainer> >(),
00285 const MissingETBase::Types::constvec_t& trkvec=MissingETBase::Types::constvec_t());
00299 static bool add(MissingETAssociationMap* pMap,const Jet* pJet,
00300 const std::vector<const IParticle*>& jetracks=std::vector<const IParticle*>());
00311 static bool addMiscAssociation(MissingETAssociationMap* pMap);
00321 static bool insert(MissingETAssociationMap* pMap,size_t jetIndex,const IParticle* pPart,const std::vector<const IParticle*>& constlist);
00331 static bool insert(MissingETAssociationMap* pMap,const Jet* pJet,const IParticle* pPart,const std::vector<const IParticle*>& constlist);
00339 static bool insert(MissingETAssociationMap* pMap,const IParticle* pPart,const std::vector<const IParticle*>& constlist,
00340 std::map<const IParticle*,MissingETBase::Types::constvec_t> pOverride=std::map<const IParticle*,MissingETBase::Types::constvec_t>());
00341
00342 static bool setJetConstSum(MissingETAssociationMap* metMap,const Jet* jet,const std::vector<const IParticle*>& altConsts,
00343 std::map<const IParticle*,MissingETBase::Types::constvec_t> pOverride);
00351 static bool insertMisc(MissingETAssociationMap* pMap,const IParticle* pPart,const std::vector<const IParticle*>& constlist);
00366 static MissingETAssociationMap::const_iterator find(const MissingETAssociationMap* pMap,const Jet* pJet);
00367 static MissingETAssociationMap::iterator find(MissingETAssociationMap* pMap,const Jet* pJet);
00368
00377 static MissingETAssociationMap::const_iterator find(const MissingETAssociationMap* pMap,const IParticle* pPart);
00386 static MissingETAssociationMap::iterator find(MissingETAssociationMap* pMap,const IParticle* pPart);
00400 static std::vector<const MissingETAssociation*> getAssociations(const MissingETAssociationMap* pMap,const IParticle* pPart);
00401 static MissingETBase::Types::constvec_t getConstVec(const MissingETAssociationMap* pMap,const IParticle* pPart,MissingETBase::UsageHandler::Policy p);
00402 static bool objSelected(const MissingETAssociationMap* pMap,const IParticle* obj);
00403 static bool selectIfNoOverlaps(const MissingETAssociationMap* pMap,const IParticle* obj,MissingETBase::UsageHandler::Policy p);
00404 static const MissingETAssociation* getAssociation(const MissingETAssociationMap* pMap,const Jet* pJet);
00405
00411 static std::vector<MissingETAssociation*> getAssociations(MissingETAssociationMap* pMap,const IParticle* pPart);
00412 static MissingETAssociation* getAssociation(MissingETAssociationMap* pMap,const Jet* pJet);
00413
00418
00419
00420
00421 static const Jet* getRefJet(const MissingETAssociationMap* pMap,const IParticle* pPart);
00422 static const Jet* getRefJet(MissingETAssociationMap::const_iterator fCont);
00425 };
00426 }
00427
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590 #endif