Commit 3444908a authored by Chris Burr's avatar Chris Burr
Browse files

Replace BOOST_FOREACH with c++11 for loops

parent 76008493
......@@ -28,7 +28,6 @@
// Boost
#include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/foreach.hpp>
using namespace boost::lambda;
//===========================================================================
......
// Include files
// Include files
// from STD
#include <algorithm>
......@@ -13,7 +13,6 @@
#include "Event/State.h"
// BOOST
#include "boost/foreach.hpp"
#include "boost/lambda/bind.hpp"
// local
......@@ -190,7 +189,7 @@ void OTMuonCosmicsMatching::filter( const std::vector< MatchingHelpers::MatchedT
void OTMuonCosmicsMatching::merge( const LHCb::Track& tTrack, const LHCb::Track& muonTrack, LHCb::Track& track ) const {
track.copy( tTrack );
if ( m_addMuonIDs ) {
BOOST_FOREACH( LHCbID id, muonTrack.lhcbIDs() ) {
for( LHCbID id : muonTrack.lhcbIDs() ) {
track.addToLhcbIDs( id );
}
}
......
......@@ -17,7 +17,6 @@
#include <string>
#include "Event/Track.h"
#include "Event/Particle.h"
#include <boost/foreach.hpp>
class ParticleToTrackContainer: public GaudiAlgorithm {
......@@ -91,8 +90,7 @@ namespace {
{
if( p.proto() && p.proto()->track() )
tracks.push_back(p.proto()->track() ) ;
BOOST_FOREACH( const LHCb::Particle* dau,
p.daughters() )
for( const LHCb::Particle* dau : p.daughters() )
extractTracks( *dau, tracks ) ;
}
}
......@@ -105,7 +103,7 @@ StatusCode ParticleToTrackContainer::execute()
// get all the tracks
std::vector<const LHCb::Track*> alltracks ;
BOOST_FOREACH( const LHCb::Particle* p, particles)
for( const LHCb::Particle* p : particles )
extractTracks( *p, alltracks) ;
// make sure all tracks are unique
......@@ -113,7 +111,7 @@ StatusCode ParticleToTrackContainer::execute()
std::vector<const LHCb::Track*>::iterator it = std::unique( alltracks.begin(), alltracks.end() ) ;
alltracks.erase( it, alltracks.end()) ;
BOOST_FOREACH( const LHCb::Track* tr, alltracks) {
for( const LHCb::Track* tr : alltracks ) {
bool accept = true ;
if ( !m_selector.empty() )
accept = m_selector->accept( *tr ) ;
......
......@@ -12,7 +12,6 @@
#include "Event/Node.h"
#include <string>
#include <boost/foreach.hpp>
class TrackDoubleHitPruner: public GaudiAlgorithm {
......@@ -93,14 +92,14 @@ StatusCode TrackDoubleHitPruner::execute()
{
// get them as a range .... hen const-cast:-)
LHCb::Track::Range tracks = get<LHCb::Track::Range>(m_inputLocation) ;
BOOST_FOREACH(const LHCb::Track* track, tracks) {
for(const LHCb::Track* track : tracks) {
// we assume that the nodes are sorted. we now check if there are
// neighbouring nodes in the same detector layer. this is rather
// detector specific.
if( track->fitResult() ) {
const LHCb::Node* prevnode(0) ;
bool trackWasModified(false) ;
BOOST_FOREACH(const LHCb::Node* node, track->fitResult()->nodes()) {
for(const LHCb::Node* node : track->fitResult()->nodes()) {
if( node->type()==LHCb::Node::HitOnTrack ) {
if( prevnode ) {
LHCb::LHCbID idA = prevnode->measurement().lhcbID() ;
......
// Include files
// Include files
// from STD
#include <functional>
......@@ -14,7 +14,6 @@
#include "Event/MCHit.h"
// BOOST
#include "boost/foreach.hpp"
#include "boost/lambda/bind.hpp"
#include "Event/ODIN.h"
#include "Event/L0DUReport.h"
......@@ -172,7 +171,8 @@ StatusCode TrackMuonMatching::execute() {
matchedTrack->copy( *(*t) );
matchedTrack->addToStates( *tState );
/// Add muon ids to copied T track
BOOST_FOREACH( LHCbID id, (*m)->lhcbIDs() ) matchedTrack->addToLhcbIDs( id );
for( LHCbID id : (*m)->lhcbIDs() )
matchedTrack->addToLhcbIDs( id );
matchedTracks->insert( matchedTrack );
}
......@@ -184,7 +184,8 @@ StatusCode TrackMuonMatching::execute() {
best_matchedTrack->addToStates( *tState );
/// Add muon ids to copied T track
BOOST_FOREACH( LHCbID id, (*m)->lhcbIDs() ) best_matchedTrack->addToLhcbIDs( id );
for( LHCbID id : (*m)->lhcbIDs() )
best_matchedTrack->addToLhcbIDs( id );
}
}
} else {
......
......@@ -6,7 +6,6 @@
#include "Event/Track.h"
#include "Event/TrackFitResult.h"
#include <string>
#include <boost/foreach.hpp>
class TrackMuonUpgradeAlg: public GaudiAlgorithm {
......@@ -57,7 +56,7 @@ StatusCode TrackMuonUpgradeAlg::execute()
}
const LHCb::Tracks* besttracks(0) ;
BOOST_FOREACH(const LHCb::Track* muontrack, muontracks) {
for(const LHCb::Track* muontrack : muontracks) {
const LHCb::Track* origtrack(0) ;
if( muontrack->ancestors().empty() ) {
......
......@@ -11,7 +11,6 @@
#endif
#include <string>
#include <boost/foreach.hpp>
#include "GaudiAlg/GaudiAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
#include "TrackInterfaces/ITrackFitter.h"
......@@ -105,9 +104,8 @@ namespace
tracks.push_back(p.proto()->track() ) ;
masshypos.push_back(p.momentum().M()) ;
} else {
BOOST_FOREACH( const LHCb::Particle* dau,
p.daughters() )
addTracks( *dau, tracks, masshypos ) ;
for( const LHCb::Particle* dau : p.daughters() )
addTracks( *dau, tracks, masshypos ) ;
}
}
}
......@@ -115,7 +113,7 @@ namespace
StatusCode TrackParticleRefitter::execute()
{
LHCb::Particle::Range inputparticles = get<LHCb::Particle::Range>(m_inputLocation) ;
BOOST_FOREACH( const LHCb::Particle* p, inputparticles) {
for( const LHCb::Particle* p : inputparticles) {
double z = p->referencePoint().z() ;
std::vector< const LHCb::Track* > tracks ;
......@@ -127,16 +125,16 @@ StatusCode TrackParticleRefitter::execute()
} else {
std::vector< const LHCb::State* > states ;
BOOST_FOREACH( const LHCb::Track* tr, tracks) {
if( !dynamic_cast<const LHCb::KalmanFitResult*>(tr->fitResult())) {
StatusCode sc = m_trackfitter->operator()( const_cast<LHCb::Track&>(*tr) ) ;
if(!sc.isSuccess())
warning() << "problem fitting track" << endmsg ;
}
LHCb::State* state = new LHCb::State() ;
StatusCode sc = m_stateprovider->stateFromTrajectory(*state,*tr,z) ;
if(!sc.isSuccess()) warning() << "problem getting state from stateprovider" << endmsg ;
states.push_back(state) ;
for( const LHCb::Track* tr : tracks) {
if( !dynamic_cast<const LHCb::KalmanFitResult*>(tr->fitResult())) {
StatusCode sc = m_trackfitter->operator()( const_cast<LHCb::Track&>(*tr) ) ;
if(!sc.isSuccess())
warning() << "problem fitting track" << endmsg ;
}
LHCb::State* state = new LHCb::State() ;
StatusCode sc = m_stateprovider->stateFromTrajectory(*state,*tr,z) ;
if(!sc.isSuccess()) warning() << "problem getting state from stateprovider" << endmsg ;
states.push_back(state) ;
}
LHCb::TrackStateVertex vertex( states ) ;
......@@ -156,13 +154,14 @@ StatusCode TrackParticleRefitter::execute()
ncp->momCovMatrix() ).m().error() ) ;
LHCb::Vertex* endvertex = ncp->endVertex() ;
if( endvertex ) {
endvertex->setPosition( vertex.position() ) ;
endvertex->setChi2AndDoF( vertex.chi2(), vertex.nDoF() ) ;
endvertex->setCovMatrix( vertex.covMatrix() ) ;
endvertex->setPosition( vertex.position() ) ;
endvertex->setChi2AndDoF( vertex.chi2(), vertex.nDoF() ) ;
endvertex->setCovMatrix( vertex.covMatrix() ) ;
}
// don't forget to delete all states !
BOOST_FOREACH( const LHCb::State* s, states) delete s ;
for( const LHCb::State* s : states)
delete s;
}
}
......
......@@ -17,7 +17,6 @@
#include <string>
#include "Event/Track.h"
#include "Event/Particle.h"
#include <boost/foreach.hpp>
class TrackToParticleRelinker: public GaudiAlgorithm {
......@@ -85,8 +84,8 @@ namespace {
proto->setTrack( *itrack ) ;
}
} else {
BOOST_FOREACH( const LHCb::Particle* dau,p.daughters() )
success = replaceTracks(*dau,tracks) && success ;
for( const LHCb::Particle* dau : p.daughters() )
success = replaceTracks(*dau,tracks) && success ;
}
return success ;
}
......@@ -99,7 +98,7 @@ StatusCode TrackToParticleRelinker::execute()
LHCb::Particle::Selection* outputparticles = new LHCb::Particle::Selection() ;
put( outputparticles, m_outputLocation) ;
BOOST_FOREACH( const LHCb::Particle* p, inputparticles) {
for( const LHCb::Particle* p : inputparticles ) {
if( replaceTracks( *p, tracks ) )
outputparticles->insert( p ) ;
}
......
......@@ -24,8 +24,6 @@
#include "LHCbMath/GeomFun.h"
#include "LHCbMath/Line.h"
#include <boost/foreach.hpp>
namespace Al {
class Equations;
class Residuals ;
......@@ -212,7 +210,7 @@ StatusCode AlRobustAlignAlg::execute()
// now loop over all tracks, create a line from the last state, loop
// over all hits, etc
BOOST_FOREACH( const LHCb::Track* track, tracks) {
for( const LHCb::Track* track : tracks ) {
if( track->nStates() > 0 ) {
//
const LHCb::State* laststate = track->states().back() ;
......
......@@ -35,7 +35,6 @@
#include "AlignKernel/AlEquations.h"
#include "Event/AlignSummaryData.h"
#include <boost/foreach.hpp>
#include "DetDesc/RunChangeIncident.h"
#include <vector>
......@@ -401,7 +400,7 @@ StatusCode AlignAlgorithm::execute() {
size_t numuseddimuons(0) ;
if( !m_particleLocation.empty() ) {
LHCb::Particle::Range particles = get<LHCb::Particle::Range>(m_particleLocation) ;
BOOST_FOREACH( const LHCb::Particle* p, particles ) {
for( const LHCb::Particle* p : particles ) {
const Al::MultiTrackResiduals* res = m_vertexresidualtool->get(*p) ;
if( res && accumulate( *res ) ) {
m_equations->addVertexChi2Summary( res->vertexChi2(), res->vertexNDoF() ) ;
......@@ -725,8 +724,7 @@ namespace {
{
if( p.proto() && p.proto()->track() )
tracks.push_back(p.proto()->track() ) ;
BOOST_FOREACH( const LHCb::Particle* dau,
p.daughters() )
for( const LHCb::Particle* dau : p.daughters() )
extractTracks( *dau, tracks ) ;
}
......@@ -880,7 +878,7 @@ void AlignAlgorithm::removeParticleTracks( const LHCb::Particle& particle,
bool AlignAlgorithm::testNodes( const LHCb::Track& track ) const
{
bool success = true ;
BOOST_FOREACH( const LHCb::Node* node, track.nodes() )
for( const LHCb::Node* node : track.nodes() )
if( node->hasMeasurement() && node->type() == LHCb::Node::HitOnTrack ) {
if( !(node->errResidual2() > TrackParameters::lowTolerance )) {
......
......@@ -13,7 +13,6 @@
#include <boost/lexical_cast.hpp>
#include <boost/regex.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/foreach.hpp>
namespace Al
{
......@@ -338,7 +337,7 @@ namespace Al
// always take the last one:
const Gaudi::Vector6* rc=0 ;
const NamedXmlUncertainty* foundentry(0) ;
BOOST_FOREACH( const NamedXmlUncertainty& entry, m_xmlUncertaintyMap ) {
for( const NamedXmlUncertainty& entry : m_xmlUncertaintyMap ) {
if( match( name, entry.first) ) foundentry = &entry ;
}
if(foundentry) {
......@@ -416,7 +415,7 @@ namespace Al
size_t numfound(0) ;
// now loop over all daughter elements
BOOST_FOREACH( const DetectorElement* detelem,element.detelements() ) {
for( const DetectorElement* detelem : element.detelements() ) {
// find this element in the XML catalogue
std::string condname ;
if((geom=detelem->geometry()) &&
......@@ -452,7 +451,7 @@ namespace Al
// alignable) set the survey for these parameters to
// 0. otherwise, it cannot converge.
std::vector<int> shareddofs = element.redundantDofs() ;
BOOST_FOREACH(int idof, shareddofs) {
for(int idof : shareddofs) {
sumparameters(idof) = 0 ;
for(int jdof=0; jdof<6; ++jdof)
sumcovmatrix(idof,jdof) = 0 ;
......
......@@ -15,7 +15,6 @@
#include <sstream>
#include <fstream>
#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
#include "TH1D.h"
#include "TMath.h"
......@@ -913,7 +912,7 @@ namespace Al
std::vector<DofChisq> dofchi2s ;
dofchi2s.reserve(6*elements.size()) ;
DofChisq dofchi2 ;
BOOST_FOREACH( const AlignmentElement* element, elements ) {
for( const AlignmentElement* element : elements ) {
const AlParameters * psurvey = m_chisqconstrainttool->surveyParameters(*element) ;
if( psurvey ) {
AlParameters::TransformParameters surveypars = psurvey->transformParameters() ;
......
......@@ -88,7 +88,6 @@ namespace Al
#include "TrackInterfaces/ITrackExtrapolator.h"
#include "ITrackResidualTool.h"
#include <boost/assign/list_of.hpp>
#include <boost/foreach.hpp>
#include "GaudiKernel/ParticleProperty.h"
#include "Kernel/ParticleID.h"
......@@ -181,7 +180,7 @@ namespace Al
// info() << "Mothermass: " << mconstraint.mothermass << "\t width: " << mconstraint.motherwidth << endmsg ;
bool success(true) ;
BOOST_FOREACH( const LHCb::Particle* daughter, p.daughters()) {
for( const LHCb::Particle* daughter : p.daughters() ) {
if( daughter->proto() && daughter->proto()->track()) {
const LHCb::Track* track = daughter->proto()->track() ;
const Al::TrackResiduals* trackres = m_trackresidualtool->get( *track ) ;
......@@ -314,7 +313,7 @@ namespace Al
totalchisq += vchi2 ;
totalndof += ndof ;
std::vector<const Al::TrackResiduals*> tracks ;
BOOST_FOREACH( const TrackContribution& atrack, states)
for( const TrackContribution& atrack : states )
tracks.push_back( atrack.trackresiduals ) ;
rc = new Al::MultiTrackResiduals( totalchisq, totalndof, numexternalhits, tracks, vchi2, ndof ) ;
rc->m_residuals.reserve(numresiduals) ;
......
......@@ -35,7 +35,6 @@
#include <sstream>
#include <fstream>
#include <algorithm>
#include <boost/foreach.hpp>
DECLARE_COMPONENT( OTCalibrationAlg )
......@@ -196,7 +195,7 @@ void OTCalibrationAlg::accumulate(const LHCb::Track& track)
// select all the OT hits and convert them into local hit format
std::vector<OTCal::StrawHit> hits ;
size_t numvelohits(0), numithits(0), numothits(0) ;
BOOST_FOREACH( const LHCb::Node* node, track.nodes() ) {
for( const LHCb::Node* node : track.nodes() ) {
if(node->hasMeasurement() &&
node->errMeasure2()>0 ) {
switch( node->measurement().type() ) {
......
......@@ -19,8 +19,6 @@
#include <boost/assign.hpp>
using namespace boost::assign;
#include <boost/foreach.hpp>
#define PHOENIX_LIMIT 6
#include <boost/spirit/home/classic.hpp>
#include <boost/phoenix.hpp>
......@@ -210,13 +208,13 @@ StatusCode OTModuleClbrAlg::execute()
LHCb::Tracks* tracks = exist<LHCb::Tracks>(trackLocation) ? get<LHCb::Tracks>(trackLocation) : 0;
if(tracks == 0) return StatusCode::SUCCESS;
BOOST_FOREACH(const LHCb::Track* track, *tracks)
for( const LHCb::Track* track : *tracks )
{
if(track->fitStatus() != LHCb::Track::Fitted || track->nDoF() < 4) continue;
double trackChi2 = track->chi2() / track->nDoF();
BOOST_FOREACH(const LHCb::Node* node, track->nodes())
for(const LHCb::Node* node : track->nodes())
{
if(node->type() != LHCb::Node::HitOnTrack && node->type() != LHCb::Node::Outlier) continue;
if(node->measurement().type() != LHCb::Measurement::OT) continue;
......@@ -303,7 +301,7 @@ StatusCode OTModuleClbrAlg::fitT0s()
{
// read current module T0's
BOOST_FOREACH(const DeOTModule* module, detector->modules())
for( const DeOTModule* module : detector->modules() )
{
if(module != 0)
{
......
......@@ -17,7 +17,6 @@ using namespace LHCb;
#include <fstream>
#include <boost/preprocessor/seq.hpp>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/filesystem.hpp>
......@@ -338,7 +337,7 @@ StatusCode OTModuleClbrMon::execute()
unsigned int gpsTime = odin->gpsTime() / 1000000;
int clbrStep = odin->calibrationStep();
BOOST_FOREACH(LHCb::Track* track, *tracks)
for( LHCb::Track* track : *tracks )
{
if(track->fitStatus() != LHCb::Track::Fitted) fitter->operator()(*track);
if(!(track->fitStatus() == LHCb::Track::Fitted && track->nDoF() >= minNDF && track->p() / 1000.0 > minP)) continue;
......@@ -365,7 +364,7 @@ StatusCode OTModuleClbrMon::execute()
Track* clone = track->clone();
BOOST_FOREACH(const Node* node_, clone->nodes())
for( const Node* node_ : clone->nodes() )
{
if(!(node_->type() == LHCb::Node::HitOnTrack)) continue; // || node_->type() == LHCb::Node::Outlier)) continue;
if(!(node_->measurement().type() == LHCb::Measurement::OT)) continue;
......
......@@ -14,7 +14,6 @@ using namespace LHCb;
#include <iostream>
#include <boost/preprocessor/seq.hpp>
#include <boost/foreach.hpp>
#include <boost/assign.hpp>
using namespace boost::assign;
......@@ -97,7 +96,7 @@ StatusCode TrackMon::execute()
LHCb::Tracks* tracks = exist<LHCb::Tracks>(trackLocation) ? get<LHCb::Tracks>(trackLocation) : 0;
if(tracks == 0) return StatusCode::SUCCESS;
BOOST_FOREACH(LHCb::Track* track, *tracks)
for( LHCb::Track* track : *tracks )
{
if(track->fitStatus() != LHCb::Track::Fitted) fitter->operator()(*track);
if(!(track->fitStatus() == LHCb::Track::Fitted && track->nDoF() >= minNDF && track->p() / 1000.0 > minP)) continue;
......@@ -114,7 +113,7 @@ StatusCode TrackMon::execute()
int nhit = 0;
BOOST_FOREACH(const LHCb::Node* node, track->nodes())
for( const LHCb::Node* node : track->nodes() )
{
if(!(node->type() == LHCb::Node::HitOnTrack)) continue; // || node->type() == LHCb::Node::Outlier)) continue;
if(!(node->measurement().type() == LHCb::Measurement::OT)) continue;
......@@ -212,11 +211,11 @@ StatusCode TrackMon::execute()
tuple->write();
}
BOOST_FOREACH(const DeOTModule* module, detector->modules())
for( const DeOTModule* module : detector->modules() )
{
LHCb::OTChannelID modid = module->elementID();
LHCb::OTLiteTimeRange ottimes = decoder->decodeModule(modid);
BOOST_FOREACH(const LHCb::OTLiteTime& ottime, ottimes)
for( const LHCb::OTLiteTime& ottime : ottimes )
{
tupleHits->column("s", ottime.channel().station());
tupleHits->column("l", ottime.channel().layer());
......@@ -253,7 +252,7 @@ void TrackMon::fillUnbiasedResiduals(const Track* track, int mode, std::vector<d
int nhit = 0;
BOOST_FOREACH(const Node* node_, clone->nodes())
for( const Node* node_ : clone->nodes() )
{
if(!(node_->type() == LHCb::Node::HitOnTrack)) continue; // || node_->type() == LHCb::Node::Outlier)) continue;
if(!(node_->measurement().type() == LHCb::Measurement::OT)) continue;
......
......@@ -8,7 +8,6 @@
#include <Event/Track.h>
#include <Event/FitNode.h>
#include <Event/OTMeasurement.h>
#include <boost/foreach.hpp>
// local
class TrackRemoveOddOTClusters : public GaudiHistoAlg
......@@ -54,7 +53,7 @@ StatusCode TrackRemoveOddOTClusters::execute()
// all other hits that are within one cell-radius.
std::map<int, std::vector< LHCb::FitNode* > > nodesInMono ;
BOOST_FOREACH( const LHCb::Node* node, (*itrk)->nodes())
for( const LHCb::Node* node : (*itrk)->nodes() )
if( node->type() == LHCb::Node::HitOnTrack &&
node->measurement().type() == LHCb::Measurement::OT ) {
// unique mono-layer = mono + 2 * ( layer + 4 * (station-1) )
......
......@@ -2,7 +2,6 @@
#include <GaudiAlg/GaudiHistoAlg.h>
#include <sstream>
#include <boost/foreach.hpp>
// from Gaudi
#include "GaudiKernel/PhysicalConstants.h"
......@@ -143,7 +142,7 @@ StatusCode TrackSeedT0Alg::execute()
size_t nmeas(0) ;
std::vector< NodeT0 > t0vec ;
size_t nodeindex(0) ;
BOOST_FOREACH( const LHCb::Node* node, (*itrk)->nodes()) {
for( const LHCb::Node* node : (*itrk)->nodes() ) {
++nodeindex ;
if( node->type() == LHCb::Node::HitOnTrack &&
node->measurement().type() == LHCb::Measurement::OT ) {
......@@ -218,7 +217,7 @@ StatusCode TrackSeedT0Alg::execute()
istate != (*itrk)->states().end(); ++istate )
(const_cast<LHCb::State*>(*istate))->setQOverP(eventT0) ;
// it could also be that this track was fitted already. in that case we update all nodes
BOOST_FOREACH( const LHCb::Node* node, (*itrk)->nodes())
for( const LHCb::Node* node : (*itrk)->nodes() )
(const_cast<LHCb::State&>(node->state())).setQOverP(eventT0) ;
}
......
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