|
[Rivet-svn] rivet: Removal of superfluous allocations (4/n)Rivet Mercurial rivet at projects.hepforge.orgFri Apr 8 20:30:01 BST 2016
details: https://rivet.hepforge.org/hg/rivet/rev/390abc054512 branches: changeset: 5114:390abc054512 user: David Grellscheid <david.grellscheid at durham.ac.uk> date: Fri Apr 08 20:17:04 2016 +0100 description: Removal of superfluous allocations (4/n) diffs (truncated from 88 to 50 lines): --- a/include/Rivet/ParticleName.hh Fri Apr 08 18:30:28 2016 +0100 +++ b/include/Rivet/ParticleName.hh Fri Apr 08 20:17:04 2016 +0100 @@ -159,13 +159,13 @@ static const std::string& particleName(PdgId pid) { /// @todo Isn't there a nicer, pointerless way to do singletons? - if (!_instance) _instance = new ParticleNames(); + if (!_instance) _instance = unique_ptr<ParticleNames>(new ParticleNames); return _instance->_particleName(pid); } static PdgId particleId(const std::string& pname) { /// @todo Isn't there a nicer, pointerless way to do singletons? - if (!_instance) _instance = new ParticleNames(); + if (!_instance) _instance = unique_ptr<ParticleNames>(new ParticleNames); return _instance->_particleId(pname); } @@ -208,7 +208,7 @@ _names_ids[pname] = pid; } - static ParticleNames* _instance; + static unique_ptr<ParticleNames> _instance; std::map<PdgId, std::string> _ids_names; --- a/src/Analyses/ATLAS_2012_I1084540.cc Fri Apr 08 18:30:28 2016 +0100 +++ b/src/Analyses/ATLAS_2012_I1084540.cc Fri Apr 08 20:17:04 2016 +0100 @@ -26,8 +26,7 @@ class ATLAS_2012_I1084540 : public Analysis { public: - ATLAS_2012_I1084540() : Analysis("ATLAS_2012_I1084540"), _etaBins(49), _etaMax(4.9) { - } + ATLAS_2012_I1084540() : Analysis("ATLAS_2012_I1084540") {} /// @name Analysis methods @@ -83,10 +82,10 @@ const FinalState& fs8 = applyProjection<FinalState>(event, "CNFS8"); // Set up Yes/No arrays for energy in each eta bin at each pT cut - bool* energyMap_200 = new bool[_etaBins]; - bool* energyMap_400 = new bool[_etaBins]; - bool* energyMap_600 = new bool[_etaBins]; - bool* energyMap_800 = new bool[_etaBins]; + bool energyMap_200[_etaBins]; + bool energyMap_400[_etaBins]; + bool energyMap_600[_etaBins];
More information about the Rivet-svn mailing list |