00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef TrEvent_TrState_H
00019 #define TrEvent_TrState_H 1
00020
00021
00022 #include "Kernel/CLHEPStreams.h"
00023 #include "CLHEP/Matrix/SymMatrix.h"
00024 #include "CLHEP/Matrix/Vector.h"
00025 #include "GaudiKernel/KeyedObject.h"
00026 #include "GaudiKernel/ObjectList.h"
00027 #include "GaudiKernel/ObjectVector.h"
00028 #include "GaudiKernel/StreamBuffer.h"
00029
00030
00031
00032 static const CLID& CLID_TrState = 10004;
00033
00034
00035 namespace TrStateLocation {
00036 static const std::string& Default = "Rec/Tr/States";
00037 }
00038
00039
00049 class TrState: public KeyedObject<int>
00050 {
00051
00052 public:
00053
00055 TrState(const TrState& state);
00056
00058 TrState()
00059 : m_stateVector(),
00060 m_stateCov(),
00061 m_stateZ(0.0) {}
00062
00064 virtual ~TrState() {}
00065
00067 virtual const CLID& clID() const;
00068 static const CLID& classID();
00069
00071 void positionAndMomentum(const HepPoint3D& pos, const HepVector3D& mom, const HepSymMatrix& cov6D) const;
00072
00074 HepPoint3D position() const;
00075
00077 HepVector3D slopes() const;
00078
00080 HepSymMatrix posMomCovariance() const;
00081
00083 std::vector errPosition() const;
00084
00086 std::vector errSlopes() const;
00087
00089 double p() const;
00090
00092 double pt() const;
00093
00095 HepVector3D momentum() const;
00096
00098 std::vector errMomentum() const;
00099
00101 virtual StreamBuffer& serialize(StreamBuffer& s) const;
00102
00104 virtual StreamBuffer& serialize(StreamBuffer& s);
00105
00107 virtual std::ostream& fillStream(std::ostream& s) const;
00108
00109 protected:
00110
00112 unsigned int nParameters() const;
00113
00114 private:
00115
00116 enum Type {StraightLine,HasMomentumInfo};
00117
00118 HepVector m_stateVector;
00119 HepSymMatrix m_stateCov;
00120 double m_stateZ;
00121
00122 };
00123
00124
00125
00126
00127
00128
00129 inline const CLID& TrState::clID() const
00130 {
00131 return TrState::classID();
00132 }
00133
00134 inline const CLID& TrState::classID()
00135 {
00136 return CLID_TrState;
00137 }
00138
00139 inline unsigned int TrState::nParameters() const
00140 {
00141
00142 return m_stateVector.size();
00143
00144 }
00145
00146 inline StreamBuffer& TrState::serialize(StreamBuffer& s) const
00147 {
00148 KeyedObject<int>::serialize(s);
00149 s << m_stateVector
00150 << m_stateCov
00151 << (float)m_stateZ;
00152 return s;
00153 }
00154
00155 inline StreamBuffer& TrState::serialize(StreamBuffer& s)
00156 {
00157 float l_stateZ;
00158 KeyedObject<int>::serialize(s);
00159 s >> m_stateVector
00160 >> m_stateCov
00161 >> l_stateZ;
00162 m_stateZ = l_stateZ;
00163 return s;
00164 }
00165
00166 inline std::ostream& TrState::fillStream(std::ostream& s) const
00167 {
00168 s << "{ "
00169 << " stateVector:\t" << m_stateVector << std::endl
00170 << " stateCov:\t" << m_stateCov << std::endl
00171 << " stateZ:\t" << (float)m_stateZ << " } ";
00172 return s;
00173 }
00174
00175
00176 typedef KeyedContainer<TrState, Containers::HashMap> TrStates;
00177
00178 #endif