00001 #ifndef XAOD_PARTICLECALOEXTENSION_H
00002 #define XAOD_PARTICLECALOEXTENSION_H
00003
00004 #include "xAODTracking/TrackingPrimitives.h"
00005 #include "EventPrimitives/EventPrimitivesHelpers.h"
00006
00007 #ifndef XAOD_STANDALONE
00008 #ifndef XAOD_MANACORE
00009
00010 #include "TrkParameters/TrackParameters.h"
00011 #endif // not XAOD_MANACORE
00012 #endif // not XAOD_STANDALONE
00013
00014 #include <vector>
00015 class CaloCell;
00016
00017 namespace xAOD {
00018
00020 class ParticleCaloExtension {
00021 public:
00023 ParticleCaloExtension( float charge,
00024 std::vector<std::vector<float> >&& parameters,
00025 std::vector<std::vector<float> >&& parametersCovariance,
00026 std::vector<int>&& identifiers );
00027
00029 ~ParticleCaloExtension();
00030
00032 ParticleCaloExtension(const ParticleCaloExtension&) = delete;
00033
00035 ParticleCaloExtension& operator=(const ParticleCaloExtension&) = delete;
00036
00038 size_t numberOfParameters() const;
00039
00041 const CurvilinearParameters_t trackParameters(unsigned int index) const;
00042
00044 int parameterIdentifier(unsigned int index) const;
00045
00047 bool trackParameterCovarianceMatrix(ParametersCovMatrix_t& matrix, unsigned int index) const;
00048
00049 #if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) )
00052 const Trk::CurvilinearParameters curvilinearParameters(unsigned int index) const;
00053 #endif // not XAOD_STANDALONE and not XAOD_MANACORE
00054
00056 bool cellsAreAssociated() const;
00057
00059 const std::vector<CaloCell*>& caloCells() const;
00060
00062 void setCaloCells(const std::vector<CaloCell*>& cells);
00063
00064 private:
00066 float m_charge;
00067
00069 std::vector<std::vector<float> > m_parameters;
00070
00072 std::vector<std::vector<float> > m_parametersCovariance;
00073
00075 std::vector<int> m_identifiers;
00076
00078 bool m_cellsAreSet;
00079 std::vector<CaloCell*> m_caloCells;
00080 };
00081
00083 inline size_t ParticleCaloExtension::numberOfParameters() const {
00084 return m_parameters.size();
00085 }
00086
00088 inline const CurvilinearParameters_t ParticleCaloExtension::trackParameters(unsigned int index) const {
00089 CurvilinearParameters_t tmp;
00090 tmp << m_parameters[index][0],m_parameters[index][1],m_parameters[index][2],
00091 m_parameters[index][3],m_parameters[index][4],m_parameters[index][5];
00092 return tmp;
00093 }
00094
00095 inline bool ParticleCaloExtension::trackParameterCovarianceMatrix(ParametersCovMatrix_t& cov, unsigned int index) const {
00096 const std::vector<float>& covVec = m_parametersCovariance[index];
00097 if( !covVec.empty() ) Amg::expand( covVec.begin(), covVec.end(),cov );
00098 else{
00099 cov.setIdentity();
00100 return false;
00101 }
00102 return true;
00103 }
00104
00106 inline int ParticleCaloExtension::parameterIdentifier(unsigned int index) const {
00107 return m_identifiers[index];
00108 }
00109
00110 inline bool ParticleCaloExtension::cellsAreAssociated() const {
00111 return m_cellsAreSet;
00112 }
00113
00114 inline const std::vector<CaloCell*>& ParticleCaloExtension::caloCells() const {
00115 return m_caloCells;
00116 }
00117
00118 inline void ParticleCaloExtension::setCaloCells(const std::vector<CaloCell*>& cells) {
00119 m_caloCells = cells;
00120 m_cellsAreSet=true;
00121 }
00122
00123 #if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) )
00124 inline const Trk::CurvilinearParameters ParticleCaloExtension::curvilinearParameters(unsigned int index) const {
00125
00126
00127 ParametersCovMatrix_t* cov = 0;
00128 if( !m_parametersCovariance[index].empty() ) {
00129 cov = new ParametersCovMatrix_t();
00130 trackParameterCovarianceMatrix(*cov,index);
00131 }
00132
00133 Amg::Vector3D pos( m_parameters[index][0],m_parameters[index][1],m_parameters[index][2]);
00134 Amg::Vector3D mom(m_parameters[index][3],m_parameters[index][4],m_parameters[index][5]);
00135 Trk::CurvilinearParameters param(pos,mom,m_charge,cov);
00136
00137 return param;
00138 }
00139 #endif // not XAOD_STANDALONE and not XAOD_MANACORE
00140
00141 }
00142
00143 #include "xAODCore/CLASS_DEF.h"
00144 #include "AthContainers/DataVector.h"
00145 typedef DataVector<xAOD::ParticleCaloExtension> ParticleCaloExtensionCollection;
00146 CLASS_DEF(ParticleCaloExtensionCollection, 1251279391 , 1 )
00147
00148 #endif