diff --git a/LArCalorimeter/LArCafJobs/LArCafJobs/HistoryContainer.h b/LArCalorimeter/LArCafJobs/LArCafJobs/HistoryContainer.h
index 0d076f7e6762680eb386ac3c65b4e9c89513a8e0..37b030810ffad948c6059d1c748663dbf38157bb 100644
--- a/LArCalorimeter/LArCafJobs/LArCafJobs/HistoryContainer.h
+++ b/LArCalorimeter/LArCafJobs/LArCafJobs/HistoryContainer.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -39,7 +39,7 @@ namespace LArSamples {
     unsigned int nDataContainers() const { return m_data.size(); }
     const DataContainer* dataContainer(unsigned int i) const { return m_data[i]; }
   
-    const CellInfo* cellInfo() const { return m_cellInfo; }
+    const CellInfo* cellInfo() const { return m_cellInfo.get(); }
     
     /** @brief append data (takes ownership) */
     void add(const DataContainer* data) { m_data.push_back(data); }
@@ -53,10 +53,10 @@ namespace LArSamples {
 
    private:
    
-    CellInfo* cell_info() const { return m_cellInfo; }
+    CellInfo* cell_info() const { return m_cellInfo.get(); }
 
     std::vector<const DataContainer*> m_data;
-    CellInfo* m_cellInfo;
+    std::unique_ptr<CellInfo> m_cellInfo;
 
     HistoryContainer& operator= (const HistoryContainer&);
   };
diff --git a/LArCalorimeter/LArCafJobs/LArCafJobs/PersistentAccessor.h b/LArCalorimeter/LArCafJobs/LArCafJobs/PersistentAccessor.h
index e824c98cdad346089bde22c59aa0a82bada3d775..8a756d057ec6341ead5fb5363f014b2bed6864cf 100644
--- a/LArCalorimeter/LArCafJobs/LArCafJobs/PersistentAccessor.h
+++ b/LArCalorimeter/LArCafJobs/LArCafJobs/PersistentAccessor.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -29,6 +29,9 @@ namespace LArSamples {
       PersistentAccessor(TTree& cellTree, TTree& eventTree, TTree* runTree, TFile* file);
       PersistentAccessor(const TString& fileName);
 
+      PersistentAccessor (const PersistentAccessor&);
+      PersistentAccessor& operator= (const PersistentAccessor&);
+
       static PersistentAccessor* open(const TString& fileName);
 
       virtual ~PersistentAccessor();
diff --git a/LArCalorimeter/LArCafJobs/src/ClassCounts.cxx b/LArCalorimeter/LArCafJobs/src/ClassCounts.cxx
index 5dbefd84c43a83fca1f379d74c2db5c80003e50b..48a711500c504c0f9f54186747deea340066d71f 100644
--- a/LArCalorimeter/LArCafJobs/src/ClassCounts.cxx
+++ b/LArCalorimeter/LArCafJobs/src/ClassCounts.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "LArCafJobs/ClassCounts.h"
@@ -41,7 +41,6 @@ void ClassCounts::printCountsTable()
 {
   cout << "Class instance counts : " << endl;
   if (!m_counts) return;
-  for (std::map<TString, int>::const_iterator count = counts().begin();
-       count != counts().end(); count++)
-    cout << Form("%20s : %-d", count->first.Data(), count->second) << endl;
+  for (const std::pair<const TString, int>& p : counts())
+    cout << Form("%20s : %-d", p.first.Data(), p.second) << endl;
 }
diff --git a/LArCalorimeter/LArCafJobs/src/DataStore.cxx b/LArCalorimeter/LArCafJobs/src/DataStore.cxx
index a48cb17977e3caaae92011371ccf004554fe508c..09d06c066cedd9a1007888214c1008b18ca1ec64 100644
--- a/LArCalorimeter/LArCafJobs/src/DataStore.cxx
+++ b/LArCalorimeter/LArCafJobs/src/DataStore.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "LArCafJobs/DataStore.h"
@@ -31,9 +31,8 @@ DataStore::DataStore()
   
 DataStore::~DataStore()
 {
-  for (std::vector<HistoryContainer*>::iterator hist = m_cellHistories.begin(); 
-       hist != m_cellHistories.end(); hist++) 
-    if (*hist) delete *hist;
+  for (HistoryContainer* h : m_cellHistories)
+    delete h;
 }
 
 
diff --git a/LArCalorimeter/LArCafJobs/src/EventData.cxx b/LArCalorimeter/LArCafJobs/src/EventData.cxx
index c228355577e0c565cae2abe7d13d32573e27c275..1b273bc1a0f2e41b071fd8b5b0fef7dab2c700f8 100644
--- a/LArCalorimeter/LArCafJobs/src/EventData.cxx
+++ b/LArCalorimeter/LArCafJobs/src/EventData.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 */
 
 
@@ -108,12 +108,13 @@ TString EventData::triggers() const
 {
   TString triggers = "";
   if (!runData()) return triggers;
-  for (std::map<TString, unsigned int>::const_iterator trigger = runData()->triggerConfig().begin();
-       trigger != runData()->triggerConfig().end(); trigger++)
-    if (isPassed(trigger->first)) {
+  for (const std::pair<const TString, unsigned int>& p : runData()->triggerConfig())
+  {
+    if (isPassed(p.first)) {
       if (triggers != "") triggers += " ";
-      triggers += trigger->first;
+      triggers += p.first;
     }
+  }
   return triggers;
 }
 
diff --git a/LArCalorimeter/LArCafJobs/src/HistoryContainer.cxx b/LArCalorimeter/LArCafJobs/src/HistoryContainer.cxx
index 085065716f5dbe7bca2ae418e05849a779c3997d..476ce7968c4c8fd698441c528899edc0041d72f8 100644
--- a/LArCalorimeter/LArCafJobs/src/HistoryContainer.cxx
+++ b/LArCalorimeter/LArCafJobs/src/HistoryContainer.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "LArCafJobs/HistoryContainer.h"
@@ -22,21 +22,18 @@ HistoryContainer::HistoryContainer(CellInfo* cellInfo)
 }
 
 HistoryContainer::HistoryContainer(const HistoryContainer& other) 
-  : m_data(other.m_data), 
-    m_cellInfo(0)
+  : m_data(other.m_data)
 { 
   ClassCounts::incrementInstanceCount("HistoryContainer"); 
-  if (other.m_cellInfo) m_cellInfo = new CellInfo(*other.m_cellInfo); 
+  if (other.m_cellInfo) m_cellInfo = std::make_unique<CellInfo>(*other.m_cellInfo); 
 }
 
 
 HistoryContainer::~HistoryContainer()
 {
-  ClassCounts::decrementInstanceCount("HistoryContainer"); 
-  for (std::vector<const DataContainer*>::iterator data = m_data.begin(); 
-       data != m_data.end(); data++) 
-    if (*data) delete *data;
-  if (m_cellInfo) delete m_cellInfo;
+  ClassCounts::decrementInstanceCount("HistoryContainer");
+  for (const DataContainer* data : m_data)
+    delete data;
 }
   
 
@@ -56,10 +53,10 @@ bool HistoryContainer::isValid() const
 {
   if (!m_cellInfo || !m_cellInfo->isValid()) return false;
   if (nDataContainers() == 0) return false;
-  
-  for (std::vector<const DataContainer*>::const_iterator data = m_data.begin(); 
-       data != m_data.end(); data++) 
-    if (!(*data)->isValid()) return false;
+
+  for (const DataContainer* data : m_data) {
+    if (!data->isValid()) return false;
+  }
   
   return true;
 }
diff --git a/LArCalorimeter/LArCafJobs/src/PersistentAccessor.cxx b/LArCalorimeter/LArCafJobs/src/PersistentAccessor.cxx
index 075afe156d6f7b839494d41240a445e9d6879252..414b0fb41bc98dbf5b25d1a978c1448dc758662e 100644
--- a/LArCalorimeter/LArCafJobs/src/PersistentAccessor.cxx
+++ b/LArCalorimeter/LArCafJobs/src/PersistentAccessor.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "LArCafJobs/PersistentAccessor.h"
@@ -191,18 +191,17 @@ PersistentAccessor* PersistentAccessor::merge(const std::vector<const Persistent
   std::map< std::pair<const PersistentAccessor*, int>, int > evtAccMap;
   
   cout << "Merging runs" << endl;
-  for (std::vector<const PersistentAccessor*>::const_iterator accessor = accessors.begin();
-       accessor != accessors.end(); accessor++) {
-    if (!*accessor) {
+  for (const PersistentAccessor* accessor : accessors) {
+    if (!accessor) {
       cout << "Cannot merge: one of the inputs is null!" << endl;
       delete newAcc;
       return 0;
     }
-    for (unsigned int i = 0; i < (*accessor)->nRuns(); i++) {
-      int run = (*accessor)->runData(i)->run();
+    for (unsigned int i = 0; i < accessor->nRuns(); i++) {
+      int run = accessor->runData(i)->run();
       if (runMap.find(run) != runMap.end()) continue;
       runMap[run] = runIndex;
-      RunData* newRun = new RunData(*(*accessor)->runData(i));
+      RunData* newRun = new RunData(*accessor->runData(i));
       newAcc->addRun(newRun);
       delete newRun;
       runIndex++;
@@ -211,25 +210,25 @@ PersistentAccessor* PersistentAccessor::merge(const std::vector<const Persistent
   
   cout << "Merging events" << endl;
   unsigned int nEventsTotal = 0, iEvt = 0;
-    for (std::vector<const PersistentAccessor*>::const_iterator accessor = accessors.begin();
-       accessor != accessors.end(); accessor++) nEventsTotal += (*accessor)->nEvents();  
-  for (std::vector<const PersistentAccessor*>::const_iterator accessor = accessors.begin();
-       accessor != accessors.end(); accessor++) {
-    for (unsigned int i = 0; i < (*accessor)->nEvents(); i++) {
+  for (const PersistentAccessor* accessor : accessors) {
+    nEventsTotal += accessor->nEvents();
+  }
+  for (const PersistentAccessor* accessor : accessors) {
+    for (unsigned int i = 0; i < accessor->nEvents(); i++) {
       iEvt++;
       if (iEvt % 100000 == 0) cout << "Merging event " << iEvt << "/" << nEventsTotal << endl;
-      std::pair<int, int> evtId((*accessor)->eventData(i)->run(), (*accessor)->eventData(i)->event());
-      std::pair<const PersistentAccessor*, int> evtAccId(*accessor, i);
+      std::pair<int, int> evtId(accessor->eventData(i)->run(), accessor->eventData(i)->event());
+      std::pair<const PersistentAccessor*, int> evtAccId(accessor, i);
       if (evtMap.find(evtId) != evtMap.end()) {
-        cout << "ERROR: Skipping duplicate entry for run " << (*accessor)->eventData(i)->run() << ", event " << (*accessor)->eventData(i)->event() << endl;
+        cout << "ERROR: Skipping duplicate entry for run " << accessor->eventData(i)->run() << ", event " << accessor->eventData(i)->event() << endl;
         continue;
       }
       evtAccMap[evtAccId] = evtIndex;
       evtMap[evtId] = evtIndex;
-      std::map<int, int>::const_iterator idx = runMap.find((*accessor)->eventData(i)->run());
+      std::map<int, int>::const_iterator idx = runMap.find(accessor->eventData(i)->run());
       int newRunIndex = (idx == runMap.end() ? -999 : idx->second);
-      //cout << "Storing eventData for run " << (*accessor)->eventData(i)->run() << " at index " << newRunIndex << " instead of " << (*accessor)->eventData(i)->runIndex() << endl;
-      EventData* newEvent = new EventData(*(*accessor)->eventData(i), newRunIndex);
+      //cout << "Storing eventData for run " << accessor->eventData(i)->run() << " at index " << newRunIndex << " instead of " << accessor->eventData(i)->runIndex() << endl;
+      EventData* newEvent = new EventData(*accessor->eventData(i), newRunIndex);
       newAcc->addEvent(newEvent);
       delete newEvent;
       evtIndex++;
@@ -242,9 +241,8 @@ PersistentAccessor* PersistentAccessor::merge(const std::vector<const Persistent
       //ClassCounts::printCountsTable();
     }
     HistoryContainer* newHistory = 0;
-    for (std::vector<const PersistentAccessor*>::const_iterator accessor = accessors.begin();
-         accessor != accessors.end(); accessor++) {
-      const HistoryContainer* history = (*accessor)->historyContainer(i);
+    for (const PersistentAccessor* accessor : accessors) {
+      const HistoryContainer* history = accessor->historyContainer(i);
       if (!history || !history->isValid()) continue;
       if (!newHistory) {
         info = new CellInfo(*history->cellInfo());
@@ -253,7 +251,7 @@ PersistentAccessor* PersistentAccessor::merge(const std::vector<const Persistent
       for (unsigned int j = 0; j < history->nDataContainers(); j++) {
         DataContainer* newDC = new DataContainer(*history->dataContainer(j));
         std::map<std::pair<const PersistentAccessor*, int>, int>::const_iterator newIndex 
-          = evtAccMap.find(std::make_pair(*accessor, history->dataContainer(j)->eventIndex()));
+          = evtAccMap.find(std::make_pair(accessor, history->dataContainer(j)->eventIndex()));
         if (newIndex == evtAccMap.end()) cout << "Event not found for cell " << i << ", data " << j << "." << endl;
         newDC->setEventIndex(newIndex != evtAccMap.end() ? newIndex->second : -1);
         newHistory->add(newDC);
@@ -279,16 +277,17 @@ PersistentAccessor* PersistentAccessor::merge(const std::vector<const Persistent
 PersistentAccessor* PersistentAccessor::merge(const std::vector<TString>& inputFiles, const TString& fileName)
 {
   std::vector<const PersistentAccessor*> accessors;
-  for (std::vector<TString>::const_iterator inputFile = inputFiles.begin(); inputFile != inputFiles.end(); inputFile++) {
-    PersistentAccessor* accessor = open(*inputFile);
+  for (const TString& inputFile : inputFiles) {
+    PersistentAccessor* accessor = open(inputFile);
     if (!accessor) {
-      cout << "ERROR : could not open file " << *inputFile << endl;
+      cout << "ERROR : could not open file " << inputFile << endl;
       return 0;
     }
     accessors.push_back(accessor);
   }
   PersistentAccessor* result = merge(accessors, fileName);
-  for (std::vector<const PersistentAccessor*>::iterator accessor = accessors.begin(); accessor != accessors.end(); accessor++) 
-    delete *accessor;
+  for (const PersistentAccessor* accessor : accessors) {
+    delete accessor;
+  }
   return result;
 }
diff --git a/LArCalorimeter/LArCafJobs/src/RunData.cxx b/LArCalorimeter/LArCafJobs/src/RunData.cxx
index 236c1150562d218833af23d33e7e67913561f452..0a3c0ef8870a8cc2e1c2ad78422ee4495663e35e 100644
--- a/LArCalorimeter/LArCafJobs/src/RunData.cxx
+++ b/LArCalorimeter/LArCafJobs/src/RunData.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 */
 
 
@@ -45,10 +45,9 @@ int RunData::triggerBitPosition(const TString& triggerBitName) const
 TString RunData::triggerBits() const
 {
   TString bits;
-  for (std::map<TString, unsigned int>::const_iterator bit = m_triggerConfig.begin();
-       bit != m_triggerConfig.end(); bit++) {
+  for (const std::pair<const TString, unsigned int>& bit : m_triggerConfig) {
     if (bits != "") bits += "\n";
-    bits += bit->first;
+    bits += bit.first;
   }
   return bits;
 }