|
ATLAS Offline Software
|
Go to the documentation of this file.
28 static std::atomic< bool > uninitCovarianceAccessPrinted =
false;
29 if( ! uninitCovarianceAccessPrinted ) {
30 std::cout <<
"xAOD::TrackParticle WARNING Uninitialised covariance matrix was "
32 " Debug it by breaking on "
33 "xAODTrackParticlePrivate::covarianceUnsetHook function calls!"
35 uninitCovarianceAccessPrinted =
true;
58 if(
this == &
tp)
return *
this;
67 #endif // not XAOD_ANALYSIS
93 uint8_t hypo = particleHypothesis();
120 float thetaT =
theta();
122 float sinTheta=
sin(thetaT);
123 float px =
p*sinTheta*
cos(phiT);
124 float py =
p*sinTheta*
sin(phiT);
134 float thetaT =
theta();
136 float sinTheta=
sin(thetaT);
137 float px =
p*sinTheta*
cos(phiT);
138 float py =
p*sinTheta*
sin(phiT);
140 float e =
pow (
m(),2) +
172 DefiningParameters_t
tmp;
178 #ifndef XAOD_ANALYSIS
183 #endif // not XAOD_ANALYSIS
209 accCovMatrixDiag(
"definingParametersCovMatrixDiag" );
211 accCovMatrixOffDiag(
"definingParametersCovMatrixOffDiag" );
215 #ifndef XAOD_ANALYSIS
220 #endif // not XAOD_ANALYSIS
223 std::vector< float > diagVec;
224 diagVec.reserve(
cov.rows() );
225 for(
int i = 0;
i <
cov.rows(); ++
i ) {
226 diagVec.push_back(
cov(
i,
i ) );
232 std::vector< float > offDiagVec;
233 offDiagVec.reserve( ( (
cov.rows() - 1 ) *
cov.rows() ) / 2 );
234 for(
int i = 1;
i <
cov.rows(); ++
i ) {
235 for(
int j = 0; j <
i; ++j ) {
236 float offDiagCoeff = (
cov(
i,
i )>0 &&
cov( j, j )>0) ?
cov(
i, j )/sqrt(
cov(
i,
i )*
cov( j, j )) : 0;
237 offDiagVec.push_back( offDiagCoeff );
249 xAOD::ParametersCovMatrix_t
cov;
253 if( accCovMatrixDiag.isAvailable( *
this ) &&
254 (
static_cast< int >( accCovMatrixDiag( *this ).size() ) ==
cov.rows() ) ) {
257 const std::vector< float >& diagVec = accCovMatrixDiag( *
this );
259 for(
int i = 0;
i <
cov.rows(); ++
i ) {
260 cov(
i,
i ) = diagVec[
i ];
273 if( accCovMatrixOffDiag.isAvailable( *
this ) &&
274 (
static_cast< int >( accCovMatrixOffDiag( *this ).size() ) ==
275 ( ( (
cov.rows() - 1 ) *
cov.rows() ) / 2 ) ) ) {
278 const std::vector< float >& offDiagVec = accCovMatrixOffDiag( *
this );
280 std::size_t vecIndex = 0;
281 for(
int i = 1;
i <
cov.rows(); ++
i ) {
282 for(
int j = 0; j <
i; ++j, ++vecIndex ) {
283 float offDiagCoeff =
cov(
i,
i)>0 &&
cov(j,j)>0 ? offDiagVec[vecIndex]*sqrt(
cov(
i,
i)*
cov(j,j)) : 0;
284 cov.fillSymmetric(
i, j, offDiagCoeff );
295 if( accCovMatrixOffDiag.isAvailable( *
this ) &&
298 const std::vector< float >& offDiagVec = accCovMatrixOffDiag( *
this );
304 std::pair<covMatrixIndex,covMatrixIndex> pairIndex = vecPairIndex[
k];
307 float offDiagCoeff =
cov(
i,
i)>0 &&
cov(j,j)>0 ? offDiagVec[
k]*sqrt(
cov(
i,
i)*
cov(j,j)) : 0;
308 cov.fillSymmetric(
i, j, offDiagCoeff );
330 if( accCovMatrixDiag.isAvailable( *
this ) &&
331 (
static_cast< int >( accCovMatrixDiag( *this ).size() ) ==
result.rows() ) ) {
341 if( accCovMatrixOffDiag.isAvailable( *
this ) &&
342 (
static_cast< int >( accCovMatrixOffDiag( *this ).size() ) ==
345 for(
int i = 1;
i <
result.rows(); ++
i ) {
346 for(
int j = 0; j <
i; ++j ) {
347 result.fillSymmetric(
i, j,
true );
356 if( accCovMatrixOffDiag.isAvailable( *
this ) &&
361 for(
const auto& pairIndex : vecPairIndex){
364 result.fillSymmetric(
i, j,
true );
377 return accCovMatrixDiag( *
this );
382 return accCovMatrixOffDiag( *
this );
387 std::vector< float >
vec;
396 if (
vec.size() != ParametersCovMatrix_t::RowsAtCompileTime) {
397 throw std::runtime_error(
398 "Setting track definingParametersCovMatrixDiag with vector of size " +
401 " is not supported");
404 accCovMatrixDiag( *
this ) =
vec;
412 unsigned int uncompr_size = ( ( ( ParametersCovMatrix_t::RowsAtCompileTime - 1 ) *
413 ParametersCovMatrix_t::RowsAtCompileTime ) / 2 );
416 if( !(
vec.size() ==
size ||
vec.size() == uncompr_size) ){
417 throw std::runtime_error(
418 "Setting track definingParametersCovMatrixOffDiag with vector of "
422 " is not supported");
425 accCovMatrixOffDiag( *
this ) =
vec;
439 std::vector< float > offDiagVecCompr;
445 std::pair<covMatrixIndex,covMatrixIndex> pairIndex = vecPairIndex[
k];
449 offDiagVecCompr[
k] = offDiagElement;
452 accCovMatrixOffDiag( *
this ) = offDiagVecCompr;
484 #ifndef XAOD_ANALYSIS
515 Amg::Transform3D pAmgTransf = amgtranslation * Amg::RotationMatrix3D::Identity();
529 #endif // not XAOD_ANALYSIS
556 if(! acc.isAvailable( *
this ))
return 0;
557 return acc(*this).size();
561 CurvilinearParameters_t
tmp;
584 unsigned int index=0;
587 assert((*it).size()==6);
599 return acc(*this).at(
index);
604 return acc(*this).at(
index);
609 return acc(*this).at(
index);
614 return acc(*this).at(
index);
619 return acc(*this).at(
index);
624 return acc(*this).at(
index);
632 xAOD::ParametersCovMatrix_t
tmp;
633 std::vector<float>::const_iterator
it = acc(*this).begin()+
offset;
639 assert(
cov.size()==15);
642 std::vector<float>&
v = acc(*
this);
656 bool foundParameters=
false;
657 for (
size_t i=0;
i<maxParameters; ++
i){
659 foundParameters=
true;
664 return foundParameters;
672 #ifndef XAOD_ANALYSIS
678 ParametersCovMatrix_t
cov;
679 auto it = acc(*this).begin()+
offset;
688 #endif // not XAOD_ANALYSIS
700 if (!acc.isAvailable(*
this)) {
709 std::bitset<xAOD::NumberOfTrackRecoInfo>
tmp(acc(*
this));
715 acc( *
this ) = patternReco;
720 acc( *
this ) = patternReco.to_ullong();
730 if (!acc.isAvailable(*
this)) {
738 if( ( ! acc ) || ( ! acc->isAvailable( *
this ) ) )
return false;
740 value = ( *acc )( *this );
746 if( ( ! acc ) || ( ! acc->isAvailable( *
this ) ) )
return false;
748 value = ( *acc )( *this );
755 ( *acc )( *this ) =
value;
761 ( *acc )( *this ) =
value;
772 #ifndef XAOD_ANALYSIS
782 static const ConstAccessor< ElementLink< TrackCollection > > acc(
"trackLink" );
785 if( acc.isAvailable( *
this ) ) {
810 if( ! acc.isAvailable( *
this ) ) {
813 if( ! acc( *this ).isValid() ) {
817 return *( acc( *
this ) );
819 #endif // not XAOD_ANALYSIS
822 #ifndef XAOD_ANALYSIS
824 #endif // not XAOD_ANALYSIS
const Trk::CurvilinearParameters curvilinearParameters(unsigned int index) const
Returns a curvilinear representation of the parameters at 'index'.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzM4D< double > > GenVecFourMom_t
Base 4 Momentum type for TrackParticle.
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
const ShapeFitter * fitter
void resetCache()
Reset the internal cache of the object.
float beamlineTiltY() const
void setTrackFitter(const TrackFitter fitter)
Method for setting the fitter, using the TrackFitter enum.
void setNumberOfIBLOverflowsdEdx(uint8_t numoverflows)
virtual double m() const override final
The invariant mass of the particle..
const SG::AuxElement::Accessor< float > * trackSummaryAccessorV1< float >(xAOD::SummaryType type)
void setNumberOfUsedHitsdEdx(uint8_t numhits)
void compress(const AmgSymMatrix(N) &covMatrix, std::vector< float > &vec)
void compressDefiningParametersCovMatrixOffDiag()
Delete some off-diagonal elements for compression.
~TrackParticle_v1()
Destructor.
void setTrackParameters(std::vector< std::vector< float > > ¶meters)
Set the parameters via the passed vector of vectors.
float vx() const
The x origin for the parameters.
void setDefiningParametersCovMatrixDiagVec(const std::vector< float > &vec)
Set the defining parameters covariance matrix using a length 15 vector.
float charge() const
Returns the charge.
TrackFitter
Enums to identify who created this track and which properties does it have.
void setRadiusOfFirstHit(float radius)
Set the radius of the first hit.
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
float vz() const
The z origin for the parameters.
float parameterPX(unsigned int index) const
Returns the parameter x momentum component, for 'index'.
const CurvilinearParameters_t trackParameters(unsigned int index) const
Returns the track parameter vector at 'index'.
CxxUtils::CachedValue< Trk::Perigee > m_perigeeParameters
Cached MeasuredPerigee, built from this object.
IParticle::FourMom_t FourMom_t
Definition of the 4-momentum type.
void setTrackLink(const ElementLink< TrackCollection > &track)
Set the link to the original track.
float z0() const
Returns the parameter.
float chiSquared() const
Returns the of the overall track fit.
void setDefiningParameters(float d0, float z0, float phi0, float theta, float qOverP)
Set the defining parameters.
std::vector< float > definingParametersCovMatrixVec() const
Returns the length 6 vector containing the elements of defining parameters covariance matrix.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
TrackProperties trackProperties() const
Access methods for track properties, which returns 'true' if a logical AND of the parameter 'proprty'...
std::vector< size_t > vec
Helper class to provide constant type-safe access to aux data.
void setTrackParameterCovarianceMatrix(unsigned int index, std::vector< float > &cov)
Set the cov matrix of the parameter at 'index', using a vector of floats.
const SG::AuxElement::Accessor< uint8_t > * trackSummaryAccessorV1< uint8_t >(xAOD::SummaryType type)
ParameterPosition
Enum allowing us to know where in ATLAS the parameters are defined.
Class providing the definition of the 4-vector interface.
float d0() const
Returns the parameter.
void expand(std::vector< float >::const_iterator it, std::vector< float >::const_iterator, AmgSymMatrix(N) &covMatrix)
float parameterX(unsigned int index) const
Returns the parameter x position, for 'index'.
bool indexOfParameterAtPosition(unsigned int &index, ParameterPosition position) const
Function to determine if this TrackParticle contains track parameters at a certain position,...
void setBeamlineTiltY(float tiltY)
void setParameterPosition(unsigned int index, ParameterPosition pos)
Set the 'position' (i.e. where it is in ATLAS) of the parameter at 'index', using the ParameterPositi...
TrackParticle_v1 TrackParticle
Reference the current persistent version:
void setHitPattern(uint32_t hitpattern)
virtual Type::ObjectType type() const override final
The type of the object as a simple enumeration.
uint32_t hitPattern() const
void setFitQuality(float chiSquared, float numberDoF)
Set the 'Fit Quality' information.
size_t index() const
Return the index of this element within its container.
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
float parameterY(unsigned int index) const
Returns the parameter y position, for 'index'.
float parameterPY(unsigned int index) const
Returns the parameter y momentum component, for 'index'.
const Trk::Perigee & perigeeParameters() const
Returns the Trk::MeasuredPerigee track parameters.
SummaryType
Enumerates the different types of information stored in Summary.
AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(CompositeParticle_v1, float, double, px, setPx) AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(CompositeParticle_v1
bool definingParametersCovMatrixOffDiagCompr() const
TrackFitter trackFitter() const
Returns the fitter.
uint64_t identifierOfFirstHit() const
Returns the offline identifier of the first hit.
AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(Muon_v1, uint8_t, Muon_v1::EnergyLossType, energyLossType) AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(Muon_v1
@ GaussianSumFilter
Tracks from Gaussian Sum Filter.
float radiusOfFirstHit() const
Returns the radius of the first hit.
Eigen::Affine3d Transform3D
uint8_t numberOfUsedHitsdEdx() const
float beamlineTiltX() const
std::vector< std::pair< covMatrixIndex, covMatrixIndex > > covMatrixIndexPairVec
GenVecFourMom_t genvecP4() const
The full 4-momentum of the particle : GenVector form.
xAOD::ParameterPosition parameterPosition(unsigned int index) const
Return the ParameterPosition of the parameters at 'index'.
void setParticleHypothesis(const ParticleHypothesis hypo)
Method for setting the particle type, using the ParticleHypothesis enum.
void setTrackProperties(const TrackProperties properties)
Methods setting the TrackProperties.
TrackParticle_v1()
Default constructor.
ParticleHypothesis particleHypothesis() const
Returns the particle hypothesis used for Track fitting.
float phi0() const
Returns the parameter, which has range to .
float qOverP() const
Returns the parameter.
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
std::bitset< NumberOfTrackRecoInfo > patternRecoInfo() const
Access method for pattern recognition algorithm.
float vy() const
The y origin for the parameters.
uint8_t hasValidTime() const
Returns whether or not the track has a valid time.
uint8_t numberOfIBLOverflowsdEdx() const
float parameterPZ(unsigned int index) const
Returns the parameter z momentum component, for 'index'.
std::string to_string(const DetectorType &type)
const ElementLink< TrackCollection > & trackLink() const
Returns a link (which can be invalid) to the Trk::Track which was used to make this TrackParticle.
void setIdentifierOfFirstHit(uint64_t id)
Set the offline identifier of the first hit.
void makePrivateStore()
Create a new (empty) private store for this object.
virtual double e() const override final
The total energy of the particle.
size_t numberOfParameters() const
Returns the number of additional parameters stored in the TrackParticle.
void setDefiningParametersCovMatrix(const ParametersCovMatrix_t &cov)
Set the defining parameters covariance matrix.
Eigen::Matrix< double, 3, 1 > Vector3D
DefiningParameters_t definingParameters() const
Returns a SVector of the Perigee track parameters.
virtual double rapidity() const override final
The true rapidity (y) of the particle.
float time() const
Returns the time.
const std::vector< float > & definingParametersCovMatrixOffDiagVec() const
Returns the correlation coefficient associated with the off-diagonal elements of the covariance matri...
bool hasStore() const
Return true if this object has an associated store.
void setDefiningParametersCovMatrixVec(const std::vector< float > &cov)
void setSummaryValue(uint8_t &value, const SummaryType &information)
Set method for TrackSummary values.
ParametersCovMatrixFilled_t definingParametersCovMatrixFilled() const
Returns a 5x5 matrix describing which elements of the covariance matrix are known.
void setTimeResolution(float timeResolution)
void setHasValidTime(uint8_t hasValidTime)
@ NumberOfTrackFitters
maximum number of enums
const std::vector< float > & definingParametersCovMatrixDiagVec() const
Returns the diagonal elements of the defining parameters covariance matrix.
static const std::size_t COVMATRIX_OFFDIAG_VEC_COMPR_SIZE
Eigen::Translation< double, 3 > Translation3D
ParametersCovMatrix_t trackParameterCovarianceMatrix(unsigned int index) const
Returns the TrackParticleCovMatrix_t (covariance matrix) at 'index', which corresponds to the paramet...
TrackParticle_v1 & operator=(const TrackParticle_v1 &tp)
Assignment operator. This can involve creating and copying an Auxilary store, and so should be used s...
#define AUXSTORE_PRIMITIVE_GETTER(CL, TYPE, NAME)
Macro creating the reader function for a primitive auxiliary property.
void setDefiningParametersCovMatrixOffDiagVec(const std::vector< float > &vec)
Set the off-diagonal elements of the defining parameters covariance matrix.
float parameterZ(unsigned int index) const
Returns the parameter z position, for 'index'.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Eigen::AngleAxisd AngleAxis3D
float numberDoF() const
Returns the number of degrees of freedom of the overall track or vertex fit as float.
Class describing a TrackParticle.
const Trk::Track * track() const
Returns a pointer (which can be NULL) to the Trk::Track which was used to make this TrackParticle.
const SG::AuxVectorData * container() const
Return the container holding this element.
Eigen::Matrix< bool, 5, 5, 0, 5, 5 > ParametersCovMatrixFilled_t
float timeResolution() const
Returns the time resolution.
void covarianceUnsetHook()
Function that would be possible to use to debug what client is trying to access covariance matrix fro...
ObjectType
Type of objects that have a representation in the xAOD EDM.
void setParametersOrigin(float x, float y, float z)
Set the origin for the parameters.
float theta() const
Returns the parameter, which has range 0 to .
IParticle & operator=(const IParticle &)=default
static const covMatrixIndexPairVec & covMatrixComprIndexPairs()
void setBeamlineTiltX(float tiltX)
AmgSymMatrix(N) toEigen(const ConstMatrixMap< N > &xAODmat)
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
void setPatternRecognitionInfo(const std::bitset< xAOD::NumberOfTrackRecoInfo > &patternReco)
Method setting the pattern recognition algorithm, using a bitset.