Commit cd25e7fa authored by Christos Anastopoulos's avatar Christos Anastopoulos
Browse files

Egamma qualify auto, and use std::exp

parent 897be536
......@@ -507,7 +507,7 @@ AsgElectronEfficiencyCorrectionTool::applySystematicVariation(const CP::Systemat
if (filteredSys.empty() && !systConfig.empty()) {
ATH_MSG_DEBUG("systematics : ");
for (auto &syst : systConfig) {
for (const auto &syst : systConfig) {
ATH_MSG_DEBUG(syst.name());
}
ATH_MSG_DEBUG(" Not supported ");
......
......@@ -24,7 +24,7 @@
// #include "TRandom.h"
// STL includes
#include <stdlib.h> /* atoi */
#include <cstdlib> /* atoi */
// =============================================================================
......
......@@ -8,6 +8,8 @@
#include "MVAUtils/ForestXGBoost.h"
#include "TTree.h"
#include <cmath>
#include <memory>
#include <set>
#include <sstream>
......@@ -115,13 +117,13 @@ float BDT::GetClassification(const std::vector<float*>& pointers) const
float BDT::GetGradBoostMVA(const std::vector<float>& values) const
{
const float sum = m_forest->GetRawResponse(values); // ignores the offset
return 2. / (1 + exp(-2 * sum)) - 1; //output shaping for gradient boosted decision tree (-1,1)
return 2. / (1 + std::exp(-2 * sum)) - 1; //output shaping for gradient boosted decision tree (-1,1)
}
float BDT::GetGradBoostMVA(const std::vector<float*>& pointers) const
{
const float sum = m_forest->GetRawResponse(pointers); // ignores the offset
return 2. / (1 + exp(-2 * sum)) - 1; //output shaping for gradient boosted decision tree (-1,1)
return 2. / (1 + std::exp(-2 * sum)) - 1; //output shaping for gradient boosted decision tree (-1,1)
}
......
......@@ -17,7 +17,7 @@
TTree* get_tree(const std::string& filename)
{
TFile* f = TFile::Open(filename.c_str());
auto keys = f->GetListOfKeys();
auto *keys = f->GetListOfKeys();
TTree* tree = nullptr;
for (int ikey=0; ikey != keys->GetSize(); ++ikey)
{
......
......@@ -71,7 +71,7 @@ EMGSFCaloExtensionBuilder::execute(const EventContext& ctx) const
CaloExtensionCollection* ptrPerigee = perigeeCache.ptr();
CaloExtensionCollection* ptrLast = lastCache.ptr();
std::vector<bool> mask(ptrTracks->size(), true);
for (auto trkIt : *ptrTracks) {
for (const auto *trkIt : *ptrTracks) {
// If we have TRT-SA tracks we don't extrapolate
if (xAOD::EgammaHelpers::numberOfSiHits(trkIt) < 4) {
mask[trkIt->index()] = false;
......
......@@ -150,7 +150,7 @@ StatusCode egammaForwardBuilder::execute(const EventContext& ctx) const
// Now finalize the cluster: based on code in CaloClusterStoreHelper::finalizeClusters
// Note: I don't specifically set the IProxyDict, since I also don't set it when I create
// data handles, either.
auto sg = outClusterContainer.storeHandle().get();
auto *sg = outClusterContainer.storeHandle().get();
for (xAOD::CaloCluster* cl : *outClusterContainer) {
cl->setLink(outClusterContainerCellLink.ptr(), sg);
}
......
......@@ -589,7 +589,7 @@ egammaSuperClusterBuilder::makeCorrection1(xAOD::CaloCluster* cluster,
// Given the range refine the position employing the smaller window
if (detastr > 0 && dphistr > 0) {
CaloLayerCalculator helper;
const auto cellLink = cluster->getCellLinks();
const auto *const cellLink = cluster->getCellLinks();
helper.fill(cellLink->begin(), cellLink->end(), etamax, phimax, detastr, dphistr, sample);
// Here is where we (re-)fill the eta in the 1st sampling
......@@ -632,7 +632,7 @@ egammaSuperClusterBuilder::addTileGap3CellsinWindow(xAOD::CaloCluster* myCluster
cells.insert(cells.end(), myList.begin(), myList.end());
}
for (auto cell : cells) {
for (const auto *cell : cells) {
if (!cell || !cell->caloDDE()) {
continue;
}
......@@ -652,7 +652,7 @@ egammaSuperClusterBuilder::findCentralPosition(
{
CentralPosition cp;
for (auto cluster : clusters) {
for (const auto *cluster : clusters) {
if (cluster->hasSampling(CaloSampling::EMB2)) {
float thisEmax = cluster->energy_max(CaloSampling::EMB2);
if (thisEmax > cp.emaxB) {
......
......@@ -105,7 +105,7 @@ StatusCode egammaTrackSlimmer::execute (const EventContext& ctx) const {
*/
ATH_MSG_DEBUG("Number of In Det TrackParticles "<< indetTrackPC->size());
keptInDetTrackParticles.resize( indetTrackPC->size(), true );
for (auto trkIt : *indetTrackPC) {
for (const auto *trkIt : *indetTrackPC) {
if (xAOD::EgammaHelpers::numberOfSiHits(trkIt) < 4) {
keptInDetTrackParticles[trkIt->index()] = false;
}
......
......@@ -91,7 +91,7 @@ electronSuperClusterBuilder::execute(const EventContext& ctx) const
isUsedRevert = isUsed;
// Check if used
auto egRec = egammaRecs->at(i);
const auto *egRec = egammaRecs->at(i);
if (isUsed.at(i)) {
continue;
}
......@@ -155,7 +155,7 @@ electronSuperClusterBuilder::execute(const EventContext& ctx) const
const std::vector<std::size_t> secondaryIndices =
searchForSecondaryClusters(i, egammaRecs.cptr(), isUsed);
for (const auto& secIndex : secondaryIndices) {
const auto secRec = egammaRecs->at(secIndex);
const auto *const secRec = egammaRecs->at(secIndex);
accumulatedClusters.push_back(secRec->caloCluster());
}
......@@ -198,7 +198,7 @@ electronSuperClusterBuilder::searchForSecondaryClusters(const std::size_t electr
if (!egammaRecs) {
return secondaryClusters;
}
const auto seedEgammaRec = egammaRecs->at(electronIndex);
const auto *const seedEgammaRec = egammaRecs->at(electronIndex);
const xAOD::CaloCluster* seedCluster = seedEgammaRec->caloCluster();
const xAOD::TrackParticle* seedTrackParticle = seedEgammaRec->trackParticle();
......@@ -210,7 +210,7 @@ electronSuperClusterBuilder::searchForSecondaryClusters(const std::size_t electr
continue;
}
// if not retrieve the relevant info
const auto egRec = egammaRecs->at(i);
const auto *const egRec = egammaRecs->at(i);
const xAOD::CaloCluster* clus = egRec->caloCluster();
float seedSecdEta(fabs(seedCluster->eta() - clus->eta()));
float seedSecdPhi(fabs(P4Helpers::deltaPhi(seedCluster->phi(), clus->phi())));
......
......@@ -91,8 +91,8 @@ photonSuperClusterBuilder::execute(const EventContext& ctx) const
// Used to revert status of topos
// in case we fail to make a supercluser.
std::vector<bool> isUsedRevert(isUsed);
const auto egRec = egammaRecs->at(i);
const auto clus = egRec->caloCluster();
const auto *const egRec = egammaRecs->at(i);
const auto *const clus = egRec->caloCluster();
// First some basic seed cuts
if (isUsed.at(i)) {
continue;
......@@ -132,7 +132,7 @@ photonSuperClusterBuilder::execute(const EventContext& ctx) const
searchForSecondaryClusters(i, egammaRecs.cptr(), isUsed, nWindowClusters, nExtraClusters);
for (auto secClus : secondaryClusters) {
const auto secRec = egammaRecs->at(secClus);
const auto *const secRec = egammaRecs->at(secClus);
accumulatedClusters.push_back(secRec->caloCluster());
// no need to add vertices
}
......@@ -206,8 +206,8 @@ photonSuperClusterBuilder::searchForSecondaryClusters(std::size_t photonInd,
return secondaryClusters;
}
const auto seedPhoton = egammaRecs->at(photonInd);
const auto seedCaloClus = seedPhoton->caloCluster();
const auto *const seedPhoton = egammaRecs->at(photonInd);
const auto *const seedCaloClus = seedPhoton->caloCluster();
if (!seedCaloClus) {
ATH_MSG_WARNING("The seed egammaRec does not have a cluster");
return secondaryClusters;
......@@ -224,7 +224,7 @@ photonSuperClusterBuilder::searchForSecondaryClusters(std::size_t photonInd,
}
for (std::size_t vx = 0; vx < numVertices; ++vx) {
const auto vertex = seedPhoton->vertex(vx);
const auto *const vertex = seedPhoton->vertex(vx);
const auto convType = xAOD::EgammaHelpers::conversionType(vertex);
seedVertices.push_back(vertex);
seedVertexType.push_back(convType);
......@@ -245,8 +245,8 @@ photonSuperClusterBuilder::searchForSecondaryClusters(std::size_t photonInd,
continue;
}
const auto egRec = egammaRecs->at(i);
const auto caloClus = egRec->caloCluster();
const auto *const egRec = egammaRecs->at(i);
const auto *const caloClus = egRec->caloCluster();
if (!caloClus) {
ATH_MSG_WARNING("The potentially secondary egammaRec does not have a cluster");
continue;
......@@ -309,7 +309,7 @@ photonSuperClusterBuilder::matchesVtxTrack(
if (m_useOnlyLeadingTrack && numTestTracks > 0) {
numTestTracks = 1;
}
for (auto seedVertexTrack : seedVertexTracks) {
for (const auto *seedVertexTrack : seedVertexTracks) {
// selected tracks alread are just Si if we are only looking at Si tracks
for (size_t testTk = 0; testTk < numTestTracks; ++testTk) {
if (seedVertexTrack == egRec->trackParticle(testTk)) {
......
......@@ -231,18 +231,18 @@ topoEgammaBuilder::execute(const EventContext& ctx) const
// Tools for ToolHandleArrays
// First common photon/electron tools*/
for (auto& tool : m_egammaTools) {
for (const auto & tool : m_egammaTools) {
ATH_CHECK(CallTool(ctx, tool, electrons, photons));
}
// Tools for only electrons
if (m_doElectrons) {
for (auto& tool : m_electronTools) {
for (const auto & tool : m_electronTools) {
ATH_CHECK(CallTool(ctx, tool, electrons, nullptr));
}
}
// Tools for only photons
if (m_doPhotons) {
for (auto& tool : m_photonTools) {
for (const auto & tool : m_photonTools) {
ATH_CHECK(CallTool(ctx, tool, nullptr, photons));
}
}
......
......@@ -144,13 +144,13 @@ EMClusterTool::contExecute(const EventContext& ctx,
}
// Now finalize the cluster: based on code in
// CaloClusterStoreHelper::finalizeClusters
auto sg = outputClusterContainer.storeHandle().get();
auto *sg = outputClusterContainer.storeHandle().get();
for (xAOD::CaloCluster* cl : *outputClusterContainer) {
cl->setLink(outputClusterContainerCellLink.ptr(), sg);
}
if (m_doTopoSeededContainer) {
auto tssg = outputTopoSeededClusterContainer.storeHandle().get();
auto *tssg = outputTopoSeededClusterContainer.storeHandle().get();
for (xAOD::CaloCluster* cl : *outputTopoSeededClusterContainer) {
cl->setLink(outputTopoSeededClusterContainerCellLink.ptr(), tssg);
}
......
......@@ -54,7 +54,7 @@ egammaLargeClusterMaker::execute(const EventContext& ctx,
ATH_CHECK(detStore()->retrieve(dd_man, "CaloMgr"));
// The main loop over clusters
for (auto cluster : *inputClusters) {
for (const auto *cluster : *inputClusters) {
// find the center of the cluster, copying the logic of
// egammaMiddleShape.cxx
......
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