Commit 65000d3f authored by Christos Anastopoulos's avatar Christos Anastopoulos
Browse files

egammaTools,STEP_Propagator, clang-tidy fixes

parent d73a6821
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
/**
......@@ -66,7 +66,7 @@ AsgElectronChargeIDSelectorTool::AsgElectronChargeIDSelectorTool(const std::stri
//=============================================================================
AsgElectronChargeIDSelectorTool::~AsgElectronChargeIDSelectorTool()
{
for (auto bdt: m_v_bdts) if (bdt) delete bdt;
for (auto *bdt: m_v_bdts) if (bdt) delete bdt;
}
......@@ -93,7 +93,7 @@ StatusCode AsgElectronChargeIDSelectorTool::initialize()
if (!m_trainingFile.empty()) { //If the property was set by the user, take that.
TrainingFile= PathResolverFindCalibFile( m_trainingFile );
if(TrainingFile==""){//Error if it cant find the conf
if(TrainingFile.empty()){//Error if it cant find the conf
ATH_MSG_ERROR("Could not locate " << m_trainingFile );
return StatusCode::FAILURE;
}
......@@ -120,9 +120,9 @@ StatusCode AsgElectronChargeIDSelectorTool::initialize()
TDirectory *td = (TDirectoryFile*)key->ReadObj();
std::string dirName =td->GetName();
if (dirName.find(m_pid_name)!=std::string::npos) {
std::string foldconf=dirName.substr(dirName.rfind("_")+1,-1);
std::string foldconf=dirName.substr(dirName.rfind('_')+1,-1);
// std::string f_index=foldconf.substr(0,foldconf.find("o"));
std::string s_nfold=foldconf.substr(foldconf.find("o")+1,-1);
std::string s_nfold=foldconf.substr(foldconf.find('o')+1,-1);
nfold=atoi(s_nfold.data());
break;
}
......@@ -134,7 +134,7 @@ StatusCode AsgElectronChargeIDSelectorTool::initialize()
TObjArray* toa= (TObjArray*) bdtfile->Get("/ECIDS_"+m_pid_name+TString::Format("_0o%d",nfold)+"/variables");
std::string commaSepVars="";
if (toa) {
TObjString *tos= 0;
TObjString *tos= nullptr;
if (toa->GetEntries()>0) tos= (TObjString*) toa->At(0);
commaSepVars=tos->GetString().Data();
ATH_MSG_INFO("Variables for ECIDS= "<<commaSepVars);
......@@ -143,9 +143,9 @@ StatusCode AsgElectronChargeIDSelectorTool::initialize()
//prepare m_inputVars
m_inputVars.clear();
while (commaSepVars.find(",")!=std::string::npos) {
m_inputVars.push_back(commaSepVars.substr(0,commaSepVars.find(",")));
commaSepVars.erase(0,commaSepVars.find(",")+1);
while (commaSepVars.find(',')!=std::string::npos) {
m_inputVars.push_back(commaSepVars.substr(0,commaSepVars.find(',')));
commaSepVars.erase(0,commaSepVars.find(',')+1);
}
m_inputVars.push_back(commaSepVars.substr(0,-1));//push back the last element
......@@ -376,7 +376,7 @@ double AsgElectronChargeIDSelectorTool::calculate( const EventContext& ctx, cons
unsigned bdt_index=eventInfo->eventNumber()%unsigned(m_v_bdts.size());
std::vector<float> v_inputs;
for (auto var: m_inputVars) {
for (const auto& var: m_inputVars) {
if (var == "pt" ) v_inputs.push_back(et );
if (var == "eta" ) v_inputs.push_back(eta );
if (var == "abs_eta" ) v_inputs.push_back(fabs(eta) );
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "egammaStripsShape.h"
......@@ -328,7 +328,7 @@ void egammaStripsShape::setArray(const xAOD::CaloCluster& cluster,
// =====================================================================
void egammaStripsShape::setIndexSeed(Info& info,
double* etacell, double* gracell) const {
const double* etacell, const double* gracell) const {
//
// Look for the index of the seed in the array previously filled
//
......@@ -349,7 +349,7 @@ void egammaStripsShape::setIndexSeed(Info& info,
}
void egammaStripsShape::setWstot(Info& info, double deta,
double* enecell, double* etacell, int* ncell) const {
const double* enecell, const double* etacell, const int* ncell) const {
//
// calculate width in half the region (that's the one used for e-ID)
//
......@@ -378,7 +378,7 @@ void egammaStripsShape::setWstot(Info& info, double deta,
}
}
void egammaStripsShape::setF2(Info& info, double* enecell,const double eallsamples) const {
void egammaStripsShape::setF2(Info& info, const double* enecell,const double eallsamples) const {
//
// Fraction of energy in two highest energy strips
//
......@@ -393,7 +393,7 @@ void egammaStripsShape::setF2(Info& info, double* enecell,const double eallsampl
info.f2 = eallsamples > 0. ? (e1+e2)/eallsamples : 0.;
}
void egammaStripsShape::setEnergy(Info& info , double* enecell) const{
void egammaStripsShape::setEnergy(Info& info , const double* enecell) const{
//
// Energy in the strips in a cluster of 15 strips
// and in a cluster of 3 strips - two cells are merge in phi
......@@ -416,7 +416,7 @@ void egammaStripsShape::setEnergy(Info& info , double* enecell) const{
info.e1152=energy;
}
void egammaStripsShape::setAsymmetry(Info& info , double* enecell) const {
void egammaStripsShape::setAsymmetry(Info& info , const double* enecell) const {
//
// Asymmetry of the shower in +/- 3 strips
// (E(-1)-E(+1))/(E(-1)+E(+1))
......@@ -438,7 +438,7 @@ void egammaStripsShape::setAsymmetry(Info& info , double* enecell) const {
void egammaStripsShape::setWs3(Info& info,
const xAOD::CaloCluster::CaloSample sam, const xAOD::CaloCluster& cluster,
double* enecell, double* etacell,int* ncell) const {
const double* enecell, const double* etacell,const int* ncell) const {
//
// Width in three strips centered on the strip with the largest energy
//
......@@ -469,7 +469,7 @@ void egammaStripsShape::setWs3(Info& info,
}
double egammaStripsShape::setDeltaEtaTrackShower(int nstrips,int ieta,
double* enecell) const {
const double* enecell) const {
//
// Shower position
// using +/- "nstrips" strips centered on the strip ieta
......@@ -497,7 +497,7 @@ double egammaStripsShape::setDeltaEtaTrackShower(int nstrips,int ieta,
return -9999.;
}
void egammaStripsShape::setWidths5(Info& info, double* enecell) const {
void egammaStripsShape::setWidths5(Info& info, const double* enecell) const {
//
// Shower width using 5 strips
//
......@@ -536,7 +536,7 @@ void egammaStripsShape::setWidths5(Info& info, double* enecell) const {
info.widths5 = sqrt(width5);
}
void egammaStripsShape::setEmax(Info& info, double* enecell) const {
void egammaStripsShape::setEmax(Info& info, const double* enecell) const {
//
// calculate energy of strip with maximum energy
//
......@@ -548,8 +548,8 @@ void egammaStripsShape::setEmax(Info& info, double* enecell) const {
}
}
int egammaStripsShape::setEmax2(Info& info, double* enecell,
double* gracell, int* ncell) const {
int egammaStripsShape::setEmax2(Info& info, const double* enecell,
const double* gracell, const int* ncell) const {
//
// energy of the second local maximum (info.esec)
// energy of the strip with second max 2 (info.esec1)
......@@ -608,8 +608,8 @@ int egammaStripsShape::setEmax2(Info& info, double* enecell,
return ncetasec1;
}
void egammaStripsShape::setEmin(int ncsec1,Info& info, double* enecell,
double* gracell, int* ncell ) const {
void egammaStripsShape::setEmin(int ncsec1,Info& info, const double* enecell,
const double* gracell, const int* ncell ) const {
//
// energy deposit in the strip with the minimal value
// between the first and the second maximum
......@@ -685,7 +685,7 @@ void egammaStripsShape::setValley(Info& info, double* enecell) const {
if ( fabs(e1+e2) > 0. ) info.val = val/(e1+e2);
}
void egammaStripsShape::setFside(Info& info, double* enecell, double* gracell, int* ncell) const {
void egammaStripsShape::setFside(Info& info, const double* enecell, const double* gracell, const int* ncell) const {
//
// fraction of energy outside shower core
// (E(+/-3strips)-E(+/-1strips))/ E(+/-1strips)
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef EGAMMACALOTOOLS_EGAMMASTRIPSSHAPE_H
......@@ -58,33 +58,33 @@ public:
double deta, double dphi, double* enecell, double* etacell,
double* gracell, int* ncell) const;
/** @brief check index of seed in the array*/
void setIndexSeed(Info& info, double* etacell, double* gracell) const;
void setIndexSeed(Info& info, const double* etacell, const double* gracell) const;
/** @brief set total width in strips*/
void setWstot(Info& info, double deta, double* enecell, double* etacell, int* ncell) const;
void setWstot(Info& info, double deta, const double* enecell, const double* etacell, const int* ncell) const;
/** @brief set fraction of energy in 2nd sampling*/
void setF2(Info& info, double* enecell,const double eallsamples) const ;
void setF2(Info& info, const double* enecell,const double eallsamples) const ;
/** @brief set energy in 3x1 and in 15x3 strips*/
void setEnergy(Info& info, double* enecell) const;
void setEnergy(Info& info, const double* enecell) const;
/** @brief set asymmetry*/
void setAsymmetry(Info& info, double* enecell) const;
void setAsymmetry(Info& info, const double* enecell) const;
/** @brief set width in three strips*/
void setWs3(Info& info, const xAOD::CaloCluster::CaloSample sam, const xAOD::CaloCluster& cluster,
double* enecell, double* etacell,int* ncell) const;
const double* enecell, const double* etacell,const int* ncell) const;
/** @brief set difference between eta of max and eta of cells*/
double setDeltaEtaTrackShower(int nstrips,int ieta, double* enecell) const;
double setDeltaEtaTrackShower(int nstrips,int ieta, const double* enecell) const;
/** @brief set width in 5 strips*/
void setWidths5(Info& info, double* enecell) const;
void setWidths5(Info& info, const double* enecell) const;
/** @brief set energy of strip with maximum energy*/
void setEmax(Info& info, double* enecell) const;
void setEmax(Info& info, const double* enecell) const;
/** @brief set energy of the second local maximum*/
int setEmax2(Info& info, double* enecell, double* gracell, int* ncell) const;
int setEmax2(Info& info, const double* enecell, const double* gracell, const int* ncell) const;
/** @brief set energy of strip with minimum energy*/
void setEmin(int ncsec1,Info& info, double* enecell, double* gracell, int* ncell ) const;
void setEmin(int ncsec1,Info& info, const double* enecell, const double* gracell, const int* ncell ) const;
/** @brief set M.S's valley*/
void setValley(Info& info, double* enecell) const;
/** @brief set fraction of energy outside shower core
(E(+/-3strips)-E(+/-1strips))/ E(+/-1strips) */
void setFside(Info& info, double* enecell, double* gracell, int* ncell) const;
void setFside(Info& info, const double* enecell, const double* gracell, const int* ncell) const;
/** @brief set F1core*/
void setF1core(Info& info, const xAOD::CaloCluster& cluster) const;
......
......@@ -447,7 +447,7 @@ EMTrackMatchBuilder::isCandidateMatch(const xAOD::CaloCluster* cluster,
bool
EMTrackMatchBuilder::TrackMatchSorter::operator()(
const EMTrackMatchBuilder::TrackMatch& match1,
const EMTrackMatchBuilder::TrackMatch& match2)
const EMTrackMatchBuilder::TrackMatch& match2) const
{
if (match1.hasPix != match2.hasPix) { // prefer pixels first
return match1.hasPix;
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef EGAMMATOOLS_EMTRACKMATCHBUILDER_H
......@@ -82,7 +82,7 @@ private:
public:
TrackMatchSorter(double distance = 0.0)
: m_distance(distance){};
bool operator()(const TrackMatch& match1, const TrackMatch& match2);
bool operator()(const TrackMatch& match1, const TrackMatch& match2) const;
private:
double m_distance;
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
/////////////////////////////////////////////////////////////////////////////////
......@@ -12,6 +12,10 @@
// Version 1.0 27/7/2006 Esben Lund
/////////////////////////////////////////////////////////////////////////////////
#include <cmath>
#include "TrkExSTEP_Propagator/STEP_Propagator.h"
#include "TrkDetDescrUtils/BinUtility.h"
#include "TrkSurfaces/Surface.h"
......@@ -1655,7 +1659,7 @@ Trk::STEP_Propagator::propagateWithJacobian (Cache& cache,
std::pair<size_t,float> d2n = lbu->distanceToNext(probe,propDir*direction);
distanceToNextBin += d2n.second+h;
}
} else if ( dist2next.first < lbu->bins() && fabs(distanceToNextBin) < 0.01 && h>0.01 ) { // tolerance 10 microns ?
} else if ( dist2next.first < lbu->bins() && std::fabs(distanceToNextBin) < 0.01 && h>0.01 ) { // tolerance 10 microns ?
double localp[5];
Trk::RungeKuttaUtils::transformGlobalToLocal(P, localp);
const Trk::CurvilinearParameters* cPar =
......@@ -1873,7 +1877,7 @@ Trk::STEP_Propagator::propagateWithJacobian (Cache& cache,
if (fabs( h) > fabs( distanceToTarget)) h = distanceToTarget;
//don't step beyond bin boundary - adjust step
if (cache.m_binMat && fabs( h) > fabs(distanceToNextBin)+0.001 ) {
if (cache.m_binMat && fabs( h) > std::fabs(distanceToNextBin)+0.001 ) {
if ( distanceToNextBin>0 ) { // TODO : investigate source of negative distance in BinningData
//std::cout <<"adjusting step because of bin boundary:"<< h<<"->"<< distanceToNextBin*propDir<< std::endl;
h = distanceToNextBin*propDir;
......
Supports Markdown
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