Skip to content

Commit

Permalink
Move to std::shared_ptr from boost:: in SimG4Core
Browse files Browse the repository at this point in the history
  • Loading branch information
makortel committed Aug 5, 2014
1 parent ed78ffe commit 4a64912
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 45 deletions.
2 changes: 1 addition & 1 deletion SimG4Core/Application/interface/OscarMTProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class OscarMTProducer : public edm::stream::EDProducer<
>
{
public:
typedef std::vector<boost::shared_ptr<SimProducer> > Producers;
typedef std::vector<std::shared_ptr<SimProducer> > Producers;

explicit OscarMTProducer(edm::ParameterSet const & p, const OscarMTMasterThread *);
virtual ~OscarMTProducer();
Expand Down
2 changes: 1 addition & 1 deletion SimG4Core/Application/interface/OscarProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class OscarProducer : public edm::one::EDProducer<edm::one::SharedResources, edm::one::WatchRuns>
{
public:
typedef std::vector<boost::shared_ptr<SimProducer> > Producers;
typedef std::vector<std::shared_ptr<SimProducer> > Producers;

explicit OscarProducer(edm::ParameterSet const & p);
virtual ~OscarProducer();
Expand Down
7 changes: 3 additions & 4 deletions SimG4Core/Application/interface/RunManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"

#include <memory>
#include "boost/shared_ptr.hpp"

#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
#include "Geometry/Records/interface/IdealGeometryRecord.h"
Expand Down Expand Up @@ -85,7 +84,7 @@ class RunManager
std::vector<SensitiveCaloDetector*>& sensCaloDetectors() {
return m_sensCaloDets;
}
std::vector<boost::shared_ptr<SimProducer> > producers() const {
std::vector<std::shared_ptr<SimProducer> > producers() const {
return m_producers;
}

Expand Down Expand Up @@ -149,8 +148,8 @@ class RunManager
std::vector<SensitiveCaloDetector*> m_sensCaloDets;

SimActivityRegistry m_registry;
std::vector<boost::shared_ptr<SimWatcher> > m_watchers;
std::vector<boost::shared_ptr<SimProducer> > m_producers;
std::vector<std::shared_ptr<SimWatcher> > m_watchers;
std::vector<std::shared_ptr<SimProducer> > m_producers;

std::auto_ptr<SimTrackManager> m_trackManager;
sim::FieldBuilder *m_fieldBuilder;
Expand Down
3 changes: 1 addition & 2 deletions SimG4Core/Application/interface/RunManagerMTWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "SimDataFormats/Forward/interface/LHCTransportLinkContainer.h"

#include <memory>
#include "boost/shared_ptr.hpp"

namespace edm {
class ParameterSet;
Expand Down Expand Up @@ -58,7 +57,7 @@ class RunManagerMTWorker {
SimTrackManager* GetSimTrackManager();
std::vector<SensitiveTkDetector*>& sensTkDetectors();
std::vector<SensitiveCaloDetector*>& sensCaloDetectors();
std::vector<boost::shared_ptr<SimProducer> > producers();
std::vector<std::shared_ptr<SimProducer> > producers();

private:
void initializeTLS();
Expand Down
8 changes: 4 additions & 4 deletions SimG4Core/Application/src/RunManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
static
void createWatchers(const edm::ParameterSet& iP,
SimActivityRegistry& iReg,
std::vector<boost::shared_ptr<SimWatcher> >& oWatchers,
std::vector<boost::shared_ptr<SimProducer> >& oProds
std::vector<std::shared_ptr<SimWatcher> >& oWatchers,
std::vector<std::shared_ptr<SimProducer> >& oProds
)
{
using namespace std;
Expand All @@ -97,8 +97,8 @@ void createWatchers(const edm::ParameterSet& iP,
throw SimG4Exception("Unable to find the requested Watcher");
}

boost::shared_ptr<SimWatcher> watcherTemp;
boost::shared_ptr<SimProducer> producerTemp;
std::shared_ptr<SimWatcher> watcherTemp;
std::shared_ptr<SimProducer> producerTemp;
maker->make(*itWatcher,iReg,watcherTemp,producerTemp);
oWatchers.push_back(watcherTemp);
if(producerTemp) {
Expand Down
14 changes: 7 additions & 7 deletions SimG4Core/Application/src/RunManagerMTWorker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ namespace {

void createWatchers(const edm::ParameterSet& iP,
SimActivityRegistry& iReg,
std::vector<boost::shared_ptr<SimWatcher> >& oWatchers,
std::vector<boost::shared_ptr<SimProducer> >& oProds
std::vector<std::shared_ptr<SimWatcher> >& oWatchers,
std::vector<std::shared_ptr<SimProducer> >& oProds
)
{
using namespace std;
Expand All @@ -89,8 +89,8 @@ namespace {
throw SimG4Exception("Unable to find the requested Watcher");
}

boost::shared_ptr<SimWatcher> watcherTemp;
boost::shared_ptr<SimProducer> producerTemp;
std::shared_ptr<SimWatcher> watcherTemp;
std::shared_ptr<SimProducer> producerTemp;
maker->make(*itWatcher,iReg,watcherTemp,producerTemp);
oWatchers.push_back(watcherTemp);
if(producerTemp) {
Expand All @@ -108,8 +108,8 @@ struct RunManagerMTWorker::TLSData {
std::unique_ptr<SimTrackManager> trackManager;
std::vector<SensitiveTkDetector*> sensTkDets;
std::vector<SensitiveCaloDetector*> sensCaloDets;
std::vector<boost::shared_ptr<SimWatcher> > watchers;
std::vector<boost::shared_ptr<SimProducer> > producers;
std::vector<std::shared_ptr<SimWatcher> > watchers;
std::vector<std::shared_ptr<SimProducer> > producers;
std::unique_ptr<sim::FieldBuilder> fieldBuilder;
std::unique_ptr<G4Run> currentRun;
edm::RunNumber_t currentRunNumber = 0;
Expand Down Expand Up @@ -319,7 +319,7 @@ std::vector<SensitiveCaloDetector*>& RunManagerMTWorker::sensCaloDetectors() {
initializeTLS();
return m_tls->sensCaloDets;
}
std::vector<boost::shared_ptr<SimProducer> > RunManagerMTWorker::producers() {
std::vector<std::shared_ptr<SimProducer> > RunManagerMTWorker::producers() {
initializeTLS();
return m_tls->producers;
}
Expand Down
9 changes: 4 additions & 5 deletions SimG4Core/GeometryProducer/interface/GeometryProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "SimG4Core/SensitiveDetector/interface/SensitiveCaloDetector.h"

#include <memory>
#include "boost/shared_ptr.hpp"

namespace sim { class FieldBuilder; }
class SimWatcher;
Expand All @@ -29,13 +28,13 @@ class SimTrackManager;
class GeometryProducer : public edm::EDProducer
{
public:
typedef std::vector<boost::shared_ptr<SimProducer> > Producers;
typedef std::vector<std::shared_ptr<SimProducer> > Producers;
explicit GeometryProducer(edm::ParameterSet const & p);
virtual ~GeometryProducer();
virtual void beginJob();
virtual void endJob();
virtual void produce(edm::Event & e, const edm::EventSetup & c);
std::vector<boost::shared_ptr<SimProducer> > producers() const
std::vector<std::shared_ptr<SimProducer> > producers() const
{ return m_producers; }
std::vector<SensitiveTkDetector*>& sensTkDetectors() { return m_sensTkDets; }
std::vector<SensitiveCaloDetector*>& sensCaloDetectors() { return m_sensCaloDets; }
Expand All @@ -45,8 +44,8 @@ class GeometryProducer : public edm::EDProducer
edm::ParameterSet m_pField;
bool m_pUseSensitiveDetectors;
SimActivityRegistry m_registry;
std::vector<boost::shared_ptr<SimWatcher> > m_watchers;
std::vector<boost::shared_ptr<SimProducer> > m_producers;
std::vector<std::shared_ptr<SimWatcher> > m_watchers;
std::vector<std::shared_ptr<SimProducer> > m_producers;
std::auto_ptr<sim::FieldBuilder> m_fieldBuilder;
std::auto_ptr<SimTrackManager> m_trackManager;
AttachSD * m_attach;
Expand Down
8 changes: 4 additions & 4 deletions SimG4Core/GeometryProducer/src/GeometryProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

static
void createWatchers(const edm::ParameterSet& iP, SimActivityRegistry& iReg,
std::vector<boost::shared_ptr<SimWatcher> >& oWatchers,
std::vector<boost::shared_ptr<SimProducer> >& oProds)
std::vector<std::shared_ptr<SimWatcher> >& oWatchers,
std::vector<std::shared_ptr<SimProducer> >& oProds)
{
using namespace std;
using namespace edm;
Expand All @@ -46,8 +46,8 @@ void createWatchers(const edm::ParameterSet& iP, SimActivityRegistry& iReg,
maker(SimWatcherFactory::get()->create(itWatcher->getParameter<std::string> ("type")));
if(maker.get()==0) { throw SimG4Exception("Unable to find the requested Watcher"); }

boost::shared_ptr<SimWatcher> watcherTemp;
boost::shared_ptr<SimProducer> producerTemp;
std::shared_ptr<SimWatcher> watcherTemp;
std::shared_ptr<SimProducer> producerTemp;
maker->make(*itWatcher,iReg,watcherTemp,producerTemp);
oWatchers.push_back(watcherTemp);
if(producerTemp) oProds.push_back(producerTemp);
Expand Down
10 changes: 5 additions & 5 deletions SimG4Core/Watcher/interface/SimProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include <algorithm>
#include <string>
#include <vector>
#include "boost/bind.hpp"
#include "boost/shared_ptr.hpp"
#include <functional>
#include <memory>

// user include files
#include "SimG4Core/Watcher/interface/SimWatcher.h"
Expand Down Expand Up @@ -79,7 +79,7 @@ class SimProducer : public SimWatcher

void registerProducts(edm::ProducerBase& iProd) {
std::for_each(m_info.begin(), m_info.end(),
boost::bind(&simproducer::ProductInfoBase::registerProduct,_1, &iProd));
std::bind(&simproducer::ProductInfoBase::registerProduct, std::placeholders::_1, &iProd));
}
protected:
template<class T>
Expand All @@ -90,7 +90,7 @@ class SimProducer : public SimWatcher
template<class T>
void produces(const std::string& instanceName) {
m_info.push_back(
boost::shared_ptr<simproducer::ProductInfo<T> >(new simproducer::ProductInfo<T>(instanceName) ));
std::make_shared<simproducer::ProductInfo<T> >(instanceName) );
}

private:
Expand All @@ -99,7 +99,7 @@ class SimProducer : public SimWatcher
const SimProducer& operator=(const SimProducer&); // stop default

// ---------- member data --------------------------------
std::vector<boost::shared_ptr< simproducer::ProductInfoBase> > m_info;
std::vector<std::shared_ptr< simproducer::ProductInfoBase> > m_info;
};


Expand Down
18 changes: 9 additions & 9 deletions SimG4Core/Watcher/interface/SimWatcherMaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class SimWatcherMaker : public SimWatcherMakerBase
// ---------- const member functions ---------------------
virtual void make(const edm::ParameterSet& p,
SimActivityRegistry& reg,
boost::shared_ptr<SimWatcher>& oWatcher,
boost::shared_ptr<SimProducer>& oProd
std::shared_ptr<SimWatcher>& oWatcher,
std::shared_ptr<SimProducer>& oProd
) const
{
boost::shared_ptr<T> returnValue(new T(p));
std::shared_ptr<T> returnValue(new T(p));
SimActivityRegistryEnroller::enroll(reg, returnValue.get());
oWatcher = returnValue;

Expand All @@ -50,13 +50,13 @@ class SimWatcherMaker : public SimWatcherMakerBase
}

private:
boost::shared_ptr<SimProducer>
getSimProducer(SimProducer*, boost::shared_ptr<T>& iProd) const{
return boost::shared_ptr<SimProducer>(iProd);
std::shared_ptr<SimProducer>
getSimProducer(SimProducer*, std::shared_ptr<T>& iProd) const{
return std::shared_ptr<SimProducer>(iProd);
}
boost::shared_ptr<SimProducer>
getSimProducer(void*, boost::shared_ptr<T>& iProd) const{
return boost::shared_ptr<SimProducer>();
std::shared_ptr<SimProducer>
getSimProducer(void*, std::shared_ptr<T>& iProd) const{
return std::shared_ptr<SimProducer>();
}

};
Expand Down
6 changes: 3 additions & 3 deletions SimG4Core/Watcher/interface/SimWatcherMakerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//

// system include files
#include "boost/shared_ptr.hpp"
#include <memory>

// user include files

Expand All @@ -41,8 +41,8 @@ class SimWatcherMakerBase
// ---------- const member functions ---------------------
virtual void make(const edm::ParameterSet&,
SimActivityRegistry&,
boost::shared_ptr<SimWatcher>&,
boost::shared_ptr<SimProducer>&
std::shared_ptr<SimWatcher>&,
std::shared_ptr<SimProducer>&
) const = 0;
};

Expand Down

0 comments on commit 4a64912

Please sign in to comment.