00001
00048 #ifndef XAOD_BPHYSHELPER_H
00049 #define XAOD_BPHYSHELPER_H
00050
00051 #include "xAODTracking/TrackParticleFwd.h"
00052 #include "xAODTracking/VertexFwd.h"
00053 #include "xAODTracking/VertexContainerFwd.h"
00054 #include "xAODMuon/MuonContainer.h"
00055
00056
00057 #include "TVector3.h"
00058 #include "TLorentzVector.h"
00059 #include "TMatrixTSym.h"
00060
00061 #include <assert.h>
00062
00063
00065 namespace xAOD {
00066
00067 class BPhysHelper {
00068
00069 public:
00070
00071
00080 BPhysHelper(const xAOD::Vertex* b) :
00081 m_b(b),
00082 m_covCached(false),
00083 m_cachedCov(0),
00084 m_refTracksCached(false),
00085 m_cachedRefTracks(0),
00086 m_muonsCached(false),
00087 m_cachedMuons(0),
00088 m_precedingVerticesCached(false),
00089 m_cachedPrecedingVertices(0),
00090 m_cascadeVerticesCached(false),
00091 m_cachedCascadeVertices(0)
00092 {
00093 assert(m_b!=0);
00094 }
00095
00096
00101 const xAOD::Vertex* vtx() const { return m_b; }
00102
00103
00116 const TMatrixTSym<double>& covariance();
00117
00118
00128 int nRefTrks();
00129
00135 TVector3 refTrk(const size_t index);
00136
00143 const std::vector<TVector3>& refTrks();
00144
00151 TLorentzVector refTrk(const size_t index, const float mass);
00152
00179 const xAOD::IParticle* refTrkOrigin(const size_t index) const;
00180
00191 TVector3 refTrkOriginP(const size_t index) const;
00192
00209 TLorentzVector refTrkOriginP(const size_t index, const float mass) const;
00210
00221 float refTrkCharge(const size_t index) const;
00222
00228 bool setRefTrks(const std::vector<float>& px,
00229 const std::vector<float>& py,
00230 const std::vector<float>& pz);
00231
00237 bool setRefTrks(const std::vector<TVector3>& refTrks);
00238
00239 #if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) )
00240
00256 bool setRefTrks();
00257
00258
00259 #endif // not XAOD_STANDALONE and not XAOD_MANACORE
00260
00263
00279 TVector3 totalP();
00280
00288 TLorentzVector totalP(const std::vector<double>& masses);
00289
00295 float ptErr();
00296
00303 bool setPtErr(const float val);
00304
00307
00320 int nMuons();
00321
00327 const xAOD::Muon* muon(const size_t index);
00328
00333 const std::vector<const xAOD::Muon*>& muons();
00334
00341 bool setMuons(const std::vector<const xAOD::Muon*>& muons,
00342 const xAOD::MuonContainer* muonContainer);
00343
00346
00364 int nPrecedingVertices();
00365
00372 const xAOD::Vertex* precedingVertex(const size_t index);
00373
00379 const std::vector<const xAOD::Vertex*>& precedingVertices();
00380
00387 bool setPrecedingVertices(const std::vector<const xAOD::Vertex*>& vertices,
00388 const xAOD::VertexContainer* vertexContainer);
00389
00390
00393
00408 int nCascadeVertices();
00409
00416 const xAOD::Vertex* cascadeVertex(const size_t index);
00417
00423 const std::vector<const xAOD::Vertex*>& cascadeVertices();
00424
00431 bool setCascadeVertices(const std::vector<const xAOD::Vertex*>& vertices,
00432 const xAOD::VertexContainer* vertexContainer);
00433
00440 int nRefTrksCascade();
00441
00444
00463 enum pv_type {PV_MAX_SUM_PT2, PV_MIN_A0, PV_MIN_Z0, PV_MIN_Z0_BA};
00464
00465
00479 const xAOD::Vertex* pv (const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00480 const xAOD::Vertex* origPv(const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00481
00489 bool setOrigPv(const xAOD::Vertex* pv,
00490 const xAOD::VertexContainer* vertexContainer,
00491 const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00492
00501 bool setPv(const xAOD::Vertex* pv,
00502 const xAOD::VertexContainer* vertexContainer,
00503 const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00504
00510 bool setRefitPVStatus(int code, const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00511
00517 int RefitPVStatus(const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00518
00521
00533 float lxy (const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00534 float lxyErr(const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00535
00544 bool setLxy (const float val, const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00545 bool setLxyErr(const float val, const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00546
00549
00560 float a0 (const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00561 float a0Err (const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00562 float a0xy (const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00563 float a0xyErr(const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00564 float z0 (const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00565 float z0Err (const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00566
00574 float setA0 (const float val, const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00575 float setA0Err (const float val, const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00576 float setA0xy (const float val, const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00577 float setA0xyErr(const float val, const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00578 float setZ0 (const float val, const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00579 float setZ0Err (const float val, const pv_type vertexType = BPhysHelper::PV_MIN_A0);
00580
00583
00584
00585 protected:
00586
00595 bool cacheCov();
00596
00605 bool cacheRefTracks();
00606
00615 bool cacheMuons();
00616
00617
00626 bool cachePrecedingVertices();
00627
00636 bool cacheCascadeVertices();
00637
00638
00640 const xAOD::Vertex* m_b;
00641
00642
00647 bool m_covCached;
00648 TMatrixTSym<double> m_cachedCov;
00649
00652
00657 bool m_refTracksCached;
00658 std::vector<TVector3> m_cachedRefTracks;
00659
00662
00667 bool m_muonsCached;
00668 std::vector<const xAOD::Muon*> m_cachedMuons;
00669
00672
00677 bool m_precedingVerticesCached;
00678 std::vector<const xAOD::Vertex*> m_cachedPrecedingVertices;
00679 bool m_cascadeVerticesCached;
00680 std::vector<const xAOD::Vertex*> m_cachedCascadeVertices;
00681
00684
00689 static const std::vector<TVector3> emptyVectorOfTVector3;
00690 static const std::vector<const xAOD::Muon*> emptyVectorOfMuons;
00691 static const TMatrixTSym<double> emptyMatrix;
00692 static const std::vector<const xAOD::Vertex*> emptyVectorOfVertices;
00695 };
00696
00697 }
00698
00701 #ifdef ATH_MSG_WARNING
00702 #define BPHYS_CHECK( EXP ) { if( ! EXP ) ATH_MSG_WARNING ( "Call of \"" << #EXP << "\" failed" ); }
00703 #else
00704 #define BPHYS_CHECK( EXP ) { if( ! EXP ) std::cout << "Warning in <BPhysHelper::BPHYS_CHECK> Call of \"" << #EXP << "\" failed" << std::endl; }
00705 #endif
00706
00707 #endif // XAOD_BPHYSHELPER_H