Commit 2de17bb7 authored by Christos Anastopoulos's avatar Christos Anastopoulos
Browse files

fix conditionals

parent 13684e38
......@@ -66,10 +66,8 @@ Trk::CaloCluster_OnTrack& Trk::CaloCluster_OnTrack::operator=(const Trk::CaloClu
{
if ( &cot != this) {
if (m_surface && m_surface->isFree()) {delete m_surface;}
if (m_globalpos) { delete m_globalpos;
}
if (m_eloss) { delete m_eloss;
}
if (m_globalpos) { delete m_globalpos;}
if (m_eloss) { delete m_eloss;}
Trk::MeasurementBase::operator=(cot);
m_surface = cot.m_surface? (cot.m_surface->isFree() ? cot.m_surface->clone():cot.m_surface) : nullptr;
m_globalpos = cot.m_globalpos ? new Amg::Vector3D(*cot.m_globalpos) : nullptr;
......
......@@ -19,8 +19,7 @@ namespace Trk {
CaloExtension::~CaloExtension() {
delete m_caloEntryLayerIntersection;
delete m_muonEntryLayerIntersection;
for( auto ptr : m_caloLayerIntersections ) { delete ptr;
}
for( auto ptr : m_caloLayerIntersections ) { delete ptr;}
}
}
......@@ -140,7 +140,7 @@ inline CompetingRIOsOnTrack::AssignmentProb CompetingRIOsOnTrack::assignmentProb
assert ( indx < numberOfContainedROTs() );
if (indx < numberOfContainedROTs() ) {
return m_assignProb->operator[](indx);
}
}
return 0; // could consider throwing an exception here - EJWM
}
......
......@@ -188,13 +188,13 @@ inline bool LocalParameters::contains(ParamDefs par) const
{ return (m_parameterkey & (1<< int(par))); }
inline const double& LocalParameters::operator[](ParamDefs par) const
{ if (m_parameterkey == 31 || m_parameterkey == 1 || m_parameterkey == 3) { return Amg::VectorX::operator[](par);
}
{
if (m_parameterkey == 31 || m_parameterkey == 1 || m_parameterkey == 3) { return Amg::VectorX::operator[](par);}
return Amg::VectorX::operator[](s_projectionMatrices.accessor(m_parameterkey, par)); }
inline double& LocalParameters::operator[](ParamDefs par)
{ if (m_parameterkey == 31 || m_parameterkey == 1 || m_parameterkey == 3) { return Amg::VectorX::operator[](par);
}
{
if (m_parameterkey == 31 || m_parameterkey == 1 || m_parameterkey == 3) { return Amg::VectorX::operator[](par);}
return Amg::VectorX::operator[](s_projectionMatrices.accessor(m_parameterkey, par)); }
inline double LocalParameters::get(ParamDefs par) const { return (*this)[par]; }
......
......@@ -101,8 +101,7 @@ MsgStream& Trk::operator << ( MsgStream& sl, const Trk::JacobianCurvilinearToLoc
for (int irow = 0; irow<5; irow++){
for (int icol =0; icol<5; icol++){
sl << (jac)(irow,icol);
if (irow < 4 || icol < 4 ) { sl << " ";
}
if (irow < 4 || icol < 4 ) { sl << " "; }
}
sl << std::endl;
}
......@@ -119,8 +118,7 @@ std::ostream& Trk::operator << ( std::ostream& sl, const Trk::JacobianCurvilinea
for (int irow = 0; irow<5; irow++){
for (int icol =0; icol<5; icol++){
sl << (jac)(irow,icol);
if (irow < 4 || icol < 4 ) { sl << " ";
}
if (irow < 4 || icol < 4 ) { sl << " ";}
}
sl << std::endl;
}
......
......@@ -90,8 +90,7 @@ MsgStream& Trk::operator << ( MsgStream& sl, const Trk::JacobianLocalToCurviline
for (int irow = 0; irow<5; irow++){
for (int icol =0; icol<5; icol++){
sl << (jac)(irow,icol);
if (irow < 4 || icol < 4 ) { sl << " ";
}
if (irow < 4 || icol < 4 ) { sl << " ";}
}
sl << std::endl;
}
......@@ -108,8 +107,7 @@ std::ostream& Trk::operator << ( std::ostream& sl, const Trk::JacobianLocalToCur
for (int irow = 0; irow<5; irow++){
for (int icol =0; icol<5; icol++){
sl << (jac)(irow,icol);
if (irow < 4 || icol < 4 ) { sl << " ";
}
if (irow < 4 || icol < 4 ) { sl << " "; }
}
sl << std::endl;
}
......
......@@ -27,8 +27,7 @@ Trk::JacobianPerigeeToCartesian::JacobianPerigeeToCartesian(const double d0,
double cost = std::cos(theta);
double rho = std::fabs(qOverP);
int charge=+1;
if(qOverP<0) { charge = -1;
}
if(qOverP<0) { charge = -1;}
// transformation of track parameters
double px = cosp*sint/rho;
......
......@@ -124,15 +124,13 @@ MsgStream& operator << ( MsgStream& sl, const Trk::LocalParameters& lp)
for (int ipar=0; ipar<lp.dimension(); ++ipar)
{ sl << lp(ipar);
if (ipar+1 < lp.dimension()) { sl << ", ";
} else { sl << ") - key: "<< lp.m_parameterkey << "(";
}
} else { sl << ") - key: "<< lp.m_parameterkey << "(";}
}
for (int itag = 0, ipos=1; itag<5; ++itag, ipos*=2)
{ bool bit = (lp.m_parameterkey & ipos);
if (bit) { sl << "1";
} else { sl << "0";
}
} else { sl << "0";}
}
sl << ")";
sl.precision (ss); sl<<std::resetiosflags(std::ios::fixed);
......@@ -148,8 +146,7 @@ std::ostream& operator << ( std::ostream& sl, const Trk::LocalParameters& lp)
for (int ipar=0; ipar<lp.dimension(); ++ipar)
{ sl << lp(ipar);
if (ipar+1 < lp.dimension()) { sl << ", ";
} else { sl << ") - key: "<< lp.m_parameterkey << "(";
}
} else { sl << ") - key: "<< lp.m_parameterkey << "(";}
}
for (int itag = 0, ipos=1; itag<5; ++itag, ipos*=2)
......
......@@ -25,8 +25,7 @@ Trk::ProjectionMatricesSet::ProjectionMatricesSet(int maxdim) :
for (int itag = 0, ipos=1; itag<m_maxdim; ++itag, ipos*=2)
{ bool bit = (imatx & ipos);
parameterTag[itag] = bit;
if (bit) { ++cols;
}
if (bit) { ++cols;}
}
Amg::MatrixX* reduction = nullptr;
......@@ -51,8 +50,7 @@ Trk::ProjectionMatricesSet::ProjectionMatricesSet(int maxdim) :
++reduc;
}
else {
accessorInt[irow] = reduc;
}
accessorInt[irow] = reduc;}
}
// the expansion matrix is the transposed reduction matrix
......@@ -78,13 +76,11 @@ Trk::ProjectionMatricesSet::~ProjectionMatricesSet()
{
std::vector<const Amg::MatrixX*>::const_iterator matrixIter = m_expansions.begin();
std::vector<const Amg::MatrixX*>::const_iterator matrixIterEnd = m_expansions.end();
for ( ; matrixIter != matrixIterEnd; delete (*matrixIter), ++matrixIter) { ;
}
for ( ; matrixIter != matrixIterEnd; delete (*matrixIter), ++matrixIter) { ;}
matrixIter = m_reductions.begin();
matrixIterEnd = m_reductions.end();
for ( ; matrixIter != matrixIterEnd; delete (*matrixIter), ++matrixIter) { ;
}
for ( ; matrixIter != matrixIterEnd; delete (*matrixIter), ++matrixIter) { ;}
}
......@@ -19,8 +19,7 @@ void Trk::IdentifierExtractor::extract(std::vector<Identifier>& ids, const std::
for (; it!=itEnd ; it++)
{
Identifier id = extract(*it);
if( id.is_valid() ) { ids.push_back(id);
}
if( id.is_valid() ) { ids.push_back(id);}
}
}
......
......@@ -35,10 +35,8 @@ Trk::Perigee Trk::PerigeeFromVertexCreator::createPerigee(Amg::Vector3D& vertex,
double phi0 = phi - Q*rho;
// check phi0 for [-Pi,+Pi) range
while (phi0 > M_PI) { phi0 -= M_PI;
}
while (phi0 < -M_PI) { phi0 += M_PI;
}
while (phi0 > M_PI) { phi0 -= M_PI;}
while (phi0 < -M_PI) { phi0 += M_PI;}
return Trk::Perigee(d0,z0,phi0,theta,qOverP,PerigeeSurface());
}
......@@ -66,10 +64,8 @@ Trk::Perigee* Trk::PerigeeFromVertexCreator::createNewPerigee(Amg::Vector3D& ver
double phi0 = phi - Q*rho;
// check phi0 for [-Pi,+Pi) range
while (phi0 > M_PI) { phi0 -= M_PI;
}
while (phi0 < -M_PI) { phi0 += M_PI;
}
while (phi0 > M_PI) { phi0 -= M_PI;}
while (phi0 < -M_PI) { phi0 += M_PI;}
return new Trk::Perigee(d0,z0,phi0,theta,qOverP,PerigeeSurface());
}
......
......@@ -24,8 +24,9 @@ template <class S>
class SurfaceDeleter
{
public:
void operator() (const S* p) { if (p && p->isFree()) { delete p;
}}
void operator() (const S* p) {
if (p && p->isFree()) { delete p; }
}
};
......
......@@ -36,8 +36,7 @@ namespace Trk {
template< class T>
bool BitField<T>::encode( unsigned int value, T& id ) const {
// check that the value is in range
if( value >= m_maxValue ) { return false;
}
if( value >= m_maxValue ) { return false;}
// clear m_bits
id &= ~m_mask;
......@@ -63,8 +62,7 @@ namespace Trk {
}
// silly way of calculating 2^m_bits
m_maxValue = 1;
for( unsigned int i=0;i<m_bits;++i ) { m_maxValue *= 2;
}
for( unsigned int i=0;i<m_bits;++i ) { m_maxValue *= 2;}
}
}
......
......@@ -82,15 +82,13 @@ namespace Trk {
inline AtlasDetDescr::AtlasDetTechnology TrackParametersIdHelper::technology( TrackParametersIdentifier id ) const {
// check if identifier is valid
if( !isValid(id) ) { return AtlasDetDescr::fUndefined;
}
if( !isValid(id) ) { return AtlasDetDescr::fUndefined;}
return static_cast<AtlasDetDescr::AtlasDetTechnology>(m_technologyField.decode(id));
}
inline CaloSampling::CaloSample TrackParametersIdHelper::caloSample( TrackParametersIdentifier id ) const {
// check if identifier is valid
if( !isValid(id) ) { return CaloSampling::Unknown;
}
if( !isValid(id) ) { return CaloSampling::Unknown;}
return static_cast<CaloSampling::CaloSample>(m_caloSamplingField.decode(id));
}
......
......@@ -10,8 +10,7 @@ namespace Trk {
TrackParametersIdentifier TrackParametersIdentificationHelper::getIdentifier( const Trk::TrackParameters& pars ) {
const CurvilinearParameters* cpars = dynamic_cast<const CurvilinearParameters*>(&pars);
if( cpars) { return getIdentifier(*cpars);
}
if( cpars) { return getIdentifier(*cpars);}
return m_helper.encodeInValidIdentifier();
}
......
......@@ -138,7 +138,7 @@ MsgStream& Trk::PseudoMeasurementOnTrack::dump( MsgStream& sl ) const
sl << name << "\t global position ( " << this->globalPosition().x() << " , "
<< this->globalPosition().y() << " , " << this->globalPosition().z()
<< " ) " << std::endl;
}
}
sl << name << "\t has error matrix: " << std::endl;
sl << this->localCovariance() << std::endl;
sl << name << "\t has associated surface:" << std::endl;
......@@ -155,7 +155,7 @@ std::ostream& Trk::PseudoMeasurementOnTrack::dump( std::ostream& sl ) const
sl << name << "\t global position ( " << this->globalPosition().x() << " , "
<< this->globalPosition().y() << " , " << this->globalPosition().z()<<" ) "
<< std::endl;
}
}
sl << name << "\t has error matrix: " << std::endl;
sl << this->localCovariance() << std::endl;
sl << name << "\t has associated surface:" << std::endl;
......
......@@ -60,8 +60,7 @@ MsgStream& operator << ( MsgStream& sl, const SpacePointCollection& coll) {
<< ", SP=[";
SpacePointCollection::const_iterator it = coll.begin();
SpacePointCollection::const_iterator itEnd = coll.end();
for (;it!=itEnd;++it) { sl<< (**it)<<", ";
}
for (;it!=itEnd;++it) { sl<< (**it)<<", ";}
sl <<" ]"<<std::endl;
return sl;
}
......@@ -73,8 +72,7 @@ std::ostream& operator << ( std::ostream& sl, const SpacePointCollection& coll)
<< ", SP=[";
SpacePointCollection::const_iterator it = coll.begin();
SpacePointCollection::const_iterator itEnd = coll.end();
for (;it!=itEnd;++it) { sl<< (**it)<<", ";
}
for (;it!=itEnd;++it) { sl<< (**it)<<", ";}
sl <<" ]"<<std::endl;
return sl;
}
......@@ -393,8 +393,7 @@ inline void Trk::TrackInfo::setTrackProperties(const TrackProperties& property)
{
// std::cout<<"Set track properties "<<std::endl;
m_properties.set(property);
if(property == BremFitSuccessful && m_particleHypo == undefined ) { m_particleHypo = electron;
}
if(property == BremFitSuccessful && m_particleHypo == undefined ) { m_particleHypo = electron;}
}
inline void Trk::TrackInfo::setPatternRecognitionInfo(const TrackPatternRecoInfo& patternReco)
......
......@@ -358,23 +358,17 @@ inline const Trk::AlignmentEffectsOnTrack *Trk::TrackStateOnSurface::alignmentEf
inline bool Trk::TrackStateOnSurface::type( const TrackStateOnSurfaceType& type ) const
{
if (type==NumberOfTrackStateOnSurfaceTypes || type==Unknown) { return false;
}
if (type==NumberOfTrackStateOnSurfaceTypes || type==Unknown) { return false;}
return m_typeFlags.test(type);
}
inline void Trk::TrackStateOnSurface::setFlags()
{
if (m_measurementOnTrack) { m_typeFlags.set(Measurement,true);
}
if (m_materialEffectsOnTrack) { m_typeFlags.set(InertMaterial,true);
}
if (m_alignmentEffectsOnTrack) { m_typeFlags.set(Alignment,true);
}
if (m_trackParameters) { m_typeFlags.set(Parameter,true);
}
if (m_fitQualityOnSurface) { m_typeFlags.set(FitQuality,true);
}
if (m_measurementOnTrack) { m_typeFlags.set(Measurement,true); }
if (m_materialEffectsOnTrack) { m_typeFlags.set(InertMaterial,true); }
if (m_alignmentEffectsOnTrack) { m_typeFlags.set(Alignment,true); }
if (m_trackParameters) { m_typeFlags.set(Parameter,true); }
if (m_fitQualityOnSurface) { m_typeFlags.set(FitQuality,true); }
}
inline const std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes>&
......
......@@ -41,8 +41,7 @@ Trk::AlignmentEffectsOnTrack& Trk::AlignmentEffectsOnTrack::operator=(const Trk:
m_sigmaDeltaTranslation = rhs.m_sigmaDeltaTranslation;
m_deltaAngle = rhs.m_deltaAngle;
m_sigmaDeltaAngle = rhs.m_sigmaDeltaAngle;
if ( m_surface->isFree() ) { delete m_surface;
}
if ( m_surface->isFree() ) { delete m_surface;}
m_surface = ( rhs.m_surface->isFree() ? rhs.m_surface->clone() : rhs.m_surface );
m_affectedTSOS = rhs.m_affectedTSOS ;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment