From b598da3c95b3aa697325480f773b3a6315aae648 Mon Sep 17 00:00:00 2001
From: Atlas-Software Librarian <Atlas-Software.Librarian@cern.ch>
Date: Fri, 8 Apr 2016 17:08:11 +0200
Subject: [PATCH] 'CMakeLists.txt' (LumiCalc-00-04-03)

	* Put LumiBlockCollection back into library to avoid compilation errors in clients
	* Tag as LumiCalc-00-04-03

2015-06-09 Marjorie Shapiro <mdshapiro@lbl.gov>
	* Update to use Run 2 LumiBlockRangeContainer instead of Run 1 LumiBlockCollection
	* Tag as LumiCalc-00-04-02

2015-04-01 Eric Torrence <torrence@cern.ch>
	* Updates for Run2
	* Tag as LumiCalc-00-04-01

2015-03-31 Eric Torrence <torrence@cern.ch>
	* Add new OflLumi-HI-003 tag
	* Tag as LumiCalc-00-03-07

2015-03-20  scott snyder  <snyder@bnl.gov>
	* Tagging LumiCalc-00-03-06.
	* LumiCalc/LumiCalculator.h: Fix header guard.
	* src/iLumiCalc.cxx: Fix clang warning: remove spurious parens.
---
 LumiBlock/LumiCalc/CMakeLists.txt             |  57 ++++
 LumiBlock/LumiCalc/LumiCalc/CoolQuery.h       |   8 +-
 .../LumiBlockRangeContainerConverter.h        |  73 +++++
 LumiBlock/LumiCalc/LumiCalc/LumiCalculator.h  |  10 +-
 LumiBlock/LumiCalc/cmt/requirements           |   5 +-
 .../LumiCalc/config/25-lumicalc-vhost.conf    |  30 +-
 LumiBlock/LumiCalc/html/index.html            |  25 +-
 LumiBlock/LumiCalc/html/version.html          |   2 +-
 .../src/LumiBlockRangeContainerConverter.cxx  | 270 ++++++++++++++++++
 LumiBlock/LumiCalc/src/LumiCalculator.cxx     |  63 +++-
 LumiBlock/LumiCalc/src/cmdline.cxx            |   2 +-
 LumiBlock/LumiCalc/src/iLumiCalc.cxx          |  57 ++--
 LumiBlock/LumiCalc/src/iLumiCalc.h            |   2 +-
 13 files changed, 539 insertions(+), 65 deletions(-)
 create mode 100644 LumiBlock/LumiCalc/CMakeLists.txt
 create mode 100644 LumiBlock/LumiCalc/LumiCalc/LumiBlockRangeContainerConverter.h
 create mode 100644 LumiBlock/LumiCalc/src/LumiBlockRangeContainerConverter.cxx

diff --git a/LumiBlock/LumiCalc/CMakeLists.txt b/LumiBlock/LumiCalc/CMakeLists.txt
new file mode 100644
index 00000000000..858e763e076
--- /dev/null
+++ b/LumiBlock/LumiCalc/CMakeLists.txt
@@ -0,0 +1,57 @@
+################################################################################
+# Package: LumiCalc
+################################################################################
+
+# Declare the package name:
+atlas_subdir( LumiCalc )
+
+# Declare the package's dependencies:
+atlas_depends_on_subdirs( PUBLIC
+                          Control/AthenaKernel
+                          DataQuality/GoodRunsLists
+                          Event/xAOD/xAODLuminosity
+                          LumiBlock/LumiBlockData
+                          PRIVATE
+                          Control/DataModelRoot
+                          Database/APR/CollectionBase
+                          Database/APR/CollectionUtilities
+                          Database/APR/POOLCore
+                          Database/APR/PersistencySvc
+                          Database/APR/StorageSvc
+                          Database/AthenaPOOL/DBDataModel
+                          Database/CoolConvUtilities
+                          Database/CoraCool )
+
+# External dependencies:
+find_package( COOL COMPONENTS CoolKernel )
+find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess )
+find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
+
+# tag ROOTCintexLibs was not recognized in automatic conversion in cmt2cmake
+
+# Component(s) in the package:
+atlas_add_library( LumiBlockCoolQuery
+                   src/CoolQuery.cxx
+                   src/LumiBlockRangeContainerConverter.cxx
+                   src/LumiCalculator.cxx
+                   src/ReplicaSorter.cxx
+                   src/LumiBlockCollectionConverter.cxx
+                   PUBLIC_HEADERS LumiCalc
+                   INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaKernel xAODLuminosity LumiBlockData GoodRunsListsLib
+                   PRIVATE_LINK_LIBRARIES DataModelRoot CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc DBDataModel )
+
+atlas_add_executable( iLumiCalc
+                      src/iLumiCalc.cxx
+                      src/cmdline.cxx
+                      src/CoolQuery.cxx
+                      src/LumiBlockRangeContainerConverter.cxx
+                      src/LumiCalculator.cxx
+                      src/ReplicaSorter.cxx
+                      INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
+                      LINK_LIBRARIES ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaKernel GoodRunsListsLib xAODLuminosity LumiBlockData DataModelRoot CollectionBase CollectionUtilities POOLCore PersistencySvc StorageSvc DBDataModel LumiBlockCoolQuery )
+
+# Install files from the package:
+atlas_install_python_modules( python/*.py )
+atlas_install_scripts( share/*.py )
+
diff --git a/LumiBlock/LumiCalc/LumiCalc/CoolQuery.h b/LumiBlock/LumiCalc/LumiCalc/CoolQuery.h
index 75915ca6836..232ba983de1 100644
--- a/LumiBlock/LumiCalc/LumiCalc/CoolQuery.h
+++ b/LumiBlock/LumiCalc/LumiCalc/CoolQuery.h
@@ -29,8 +29,12 @@
 #include "RelationalAccess/IQuery.h"
 #include "RelationalAccess/ICursor.h"
 
-// LumiBlock includes
+// Need this to keep other packages from failing, should be fixed properly
 #include "LumiBlockData/LumiBlockCollection.h"
+
+// LumiBlock includes
+#include "xAODLuminosity/LumiBlockRangeContainer.h"
+#include "xAODLuminosity/LumiBlockRangeAuxContainer.h"
 #include "AthenaKernel/IOVRange.h"
 #include "AthenaKernel/IOVTime.h"
 
@@ -240,7 +244,7 @@ class CoolQuery{
   // set the "central" IOV range to this time (presumable this comes from some LumiBlockCollection's IOVRange
   // but one in general can create one such object via e.g.:
   //
-  // LumiBlockCollection * iovc = new LumiBlockCollection();
+  //  * iovc = new LumiBlockCollection();
   // iovc->push_back(new IOVRange(IOVTime(runnumber, LBstart), IOVTime(runnumber,LBend)));
   // LumiBlockCollection::const_iterator i = iovc->begin();
   //  
diff --git a/LumiBlock/LumiCalc/LumiCalc/LumiBlockRangeContainerConverter.h b/LumiBlock/LumiCalc/LumiCalc/LumiBlockRangeContainerConverter.h
new file mode 100644
index 00000000000..6860d78b2c8
--- /dev/null
+++ b/LumiBlock/LumiCalc/LumiCalc/LumiBlockRangeContainerConverter.h
@@ -0,0 +1,73 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+
+/**********************************************************************************
+ * Class  : LumiBlockRangeContainerConverter
+ *                                                                                *
+ * Authors (alphabetical):                                                        *
+ *      Max Baak <mbaak@cern.ch> - CERN, Switzerland                              *
+ *      Marjorie Shapiro <mdshapiro@lbl.gov>
+ **********************************************************************************/
+
+#ifndef __LumiBlockRangeContainerConverter__
+#define __LumiBlockRangeContainerConverter__
+
+#include <map>
+#include <vector>
+#include "TString.h"
+
+namespace Root {
+  class TGoodRunsList;
+  class TGRLCollection;
+  class TGoodRunsListReader;
+  class TGoodRunsListWriter;
+}
+
+#include "xAODLuminosity/LumiBlockRangeContainer.h"
+#include "xAODLuminosity/LumiBlockRangeAuxContainer.h"
+
+typedef std::map<TString,TString> grlmetadatamap;
+
+class LumiBlockRangeContainerConverter {
+   
+ public:
+
+  LumiBlockRangeContainerConverter();      
+  virtual ~LumiBlockRangeContainerConverter();
+
+  xAOD::LumiBlockRangeContainer* GetLumiBlockRangeContainer(const Root::TGoodRunsList& grl, std::map<TString,TString>& metadata, TString& version) ;
+  xAOD::LumiBlockRangeContainer* GetLumiBlockRangeContainer(const Root::TGoodRunsList& grl) const;
+  xAOD::LumiBlockRangeContainer* GetLumiBlockRangeContainer(const char* xmlfile) const;
+  xAOD::LumiBlockRangeContainer* GetLumiBlockRangeContainerFromString( const TString& xmlstring ) const;
+
+  void CreateXMLFile(const Root::TGoodRunsList& grl, const TString& xmlfilename="", const TString& prefix="" ) const;
+  void CreateXMLFile(const Root::TGRLCollection& grlcollection, const char* xmlfilename) const;
+  void CreateXMLFile(const xAOD::LumiBlockRangeContainer& lbc, const grlmetadatamap& metadata = grlmetadatamap(), const char* version="", 
+                     const TString& xmlfilename="", const TString& prefix="" ) const;
+  void CreateXMLFiles(const Root::TGRLCollection& grlcollection, const char* prefix) const;
+
+  const TString GetXMLString(const Root::TGoodRunsList& grl) const;
+  const TString GetXMLString(const Root::TGRLCollection& grlcollection) const;
+  const TString GetXMLString(const xAOD::LumiBlockRangeContainer& lbc, const grlmetadatamap& metadata = grlmetadatamap(), const char* version="" ) const;
+  const std::vector<TString> GetXMLStrings(const Root::TGRLCollection& grlcollection) const;
+
+  Root::TGoodRunsList* GetGRLObject( const xAOD::LumiBlockRangeContainer& lbc, const grlmetadatamap& metadata = grlmetadatamap(), const char* version="" ) const;
+  Root::TGoodRunsList* GetGRLObject( const char* xmlfile ) const;
+  Root::TGoodRunsList* GetGRLObjectFromString( const TString& xmlstring ) const;
+
+  Root::TGRLCollection* GetGRLCollection( const char* xmlfile ) const;
+  Root::TGRLCollection* GetGRLCollectionFromString( const TString& xmlstring ) const;
+
+  const TString GetSuggestedName( const xAOD::LumiBlockRangeContainer& lbc ) const ;
+
+ private:
+
+  Root::TGoodRunsListReader* m_reader;   
+  Root::TGoodRunsListWriter* m_writer;
+
+};
+
+#endif
+
diff --git a/LumiBlock/LumiCalc/LumiCalc/LumiCalculator.h b/LumiBlock/LumiCalc/LumiCalc/LumiCalculator.h
index 4318be3ea1b..aea6099dd27 100644
--- a/LumiBlock/LumiCalc/LumiCalc/LumiCalculator.h
+++ b/LumiBlock/LumiCalc/LumiCalc/LumiCalculator.h
@@ -2,12 +2,12 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-#ifndef LUMICALCULATOR_H
-#define LUMICACLULATOR_H
+#ifndef LUMICALC_LUMICALCULATOR_H
+#define LUMICALC_LUMICALCULATOR_H
 
 
 #include "LumiCalc/CoolQuery.h"
-#include "LumiCalc/LumiBlockCollectionConverter.h"
+#include "LumiCalc/LumiBlockRangeContainerConverter.h"
 #include <vector>
 #include "TH1F.h"
 #include "TTree.h"
@@ -35,7 +35,7 @@ class LumiCalculator{
   void UseLumiMethod(const std::string& method);// i.e. COOL Folder channel
   void UseLumiChannel(int chan);
   void UseLiveTrigger(bool live, std::string& livetrigger);
-  void IntegrateLumi(const LumiBlockCollection * iovc, const std::string& triggerchain);
+  void IntegrateLumi(const xAOD::LumiBlockRangeContainer * iovc, const std::string& triggerchain);
   void SetCollName(const std::string& lbcollname);
   void setTree(TTree * tree = 0);
 
@@ -245,4 +245,4 @@ class LumiCalculator{
 };
 
 
-#endif //> LUMICALCULATOR_H
+#endif //> LUMICALC_LUMICALCULATOR_H
diff --git a/LumiBlock/LumiCalc/cmt/requirements b/LumiBlock/LumiCalc/cmt/requirements
index 4c85311c55c..349c172d112 100755
--- a/LumiBlock/LumiCalc/cmt/requirements
+++ b/LumiBlock/LumiCalc/cmt/requirements
@@ -11,6 +11,7 @@ use AtlasCORAL 			AtlasCORAL-* 	     External
 use AtlasROOT                   AtlasROOT-*          External
 use LumiBlockData               LumiBlockData-*      LumiBlock
 use GoodRunsLists		GoodRunsLists-*	     DataQuality
+use xAODLuminosity              xAODLuminosity-*     Event/xAOD
 
 private
 use CoraCool   			CoraCool-*   		Database -no_auto_imports
@@ -22,12 +23,12 @@ use AtlasPOOL                   AtlasPOOL-*             External
 public
 
 # Create a named installed library
-library LumiBlockCoolQuery CoolQuery.cxx LumiBlockCollectionConverter.cxx LumiCalculator.cxx ReplicaSorter.cxx
+library LumiBlockCoolQuery CoolQuery.cxx LumiBlockRangeContainerConverter.cxx LumiCalculator.cxx ReplicaSorter.cxx LumiBlockCollectionConverter.cxx
 #apply_pattern component_library
 apply_pattern named_installed_library library=LumiBlockCoolQuery
 
 # Create a binary executable
-application iLumiCalc iLumiCalc.cxx cmdline.cxx CoolQuery.cxx LumiBlockCollectionConverter.cxx LumiCalculator.cxx ReplicaSorter.cxx
+application iLumiCalc iLumiCalc.cxx cmdline.cxx CoolQuery.cxx LumiBlockRangeContainerConverter.cxx LumiCalculator.cxx ReplicaSorter.cxx
 macro_append iLumiCalc_dependencies " LumiBlockCoolQuery"
 apply_tag ROOTCintexLibs
 
diff --git a/LumiBlock/LumiCalc/config/25-lumicalc-vhost.conf b/LumiBlock/LumiCalc/config/25-lumicalc-vhost.conf
index 709376fa922..d98996b8196 100644
--- a/LumiBlock/LumiCalc/config/25-lumicalc-vhost.conf
+++ b/LumiBlock/LumiCalc/config/25-lumicalc-vhost.conf
@@ -7,21 +7,32 @@
   ServerName default
 
   ## Vhost docroot
-  DocumentRoot /var/www/lumicalc/LumiBlock/LumiCalc/html
-  Alias	       /results/ /tmp/lumifiles/
-  ScriptAlias  /cgi-bin/ /var/www/lumicalc/LumiBlock/LumiCalc/python/
+  DocumentRoot "/var/www/lumicalc"
+  ## Alias declarations for resources outside the DocumentRoot
+  Alias /results/ "/tmp/lumifiles/"
+  Alias /cgi-bin/ "/var/www/lumicalc/LumiBlock/LumiCalc/python/"
+  Alias / "/var/www/lumicalc/LumiBlock/LumiCalc/html/"
+
 
 
   ## Directories, there should at least be a declaration for /var/www/lumicalc
 
 
+  <Location "/cgi-bin">
+    Options +ExecCGI
+    Order allow,deny
+    Allow from all
+    SetHandler cgi-script
+  </Location>
+
+
   <Directory "/var/www/lumicalc/LumiBlock/LumiCalc/html">
     Options +Indexes +Includes
     AllowOverride None
     Order Allow,Deny
     Allow from all
+    AddHandler server-parsed .html
     AddType text/html .html
-    AddHandler server-parsed .html    
   </Directory>
 
 
@@ -35,6 +46,9 @@
 
   <Directory "/tmp/lumifiles/*">
     Options +ExecCGI
+    AllowOverride None
+    Order allow,deny
+    Allow from all
     AddHandler cgi-script .py
   </Directory>
 
@@ -55,9 +69,9 @@
   SSLCertificateKeyFile   "/etc/pki/tls/private/localhost.key"
   SSLCACertificatePath    "/etc/pki/tls/certs"
 
-  ## Custom fragment
-  LimitRequestFieldSize 262144
+  ## More time for scripts to run
+  TimeOut 900
 
-  ## Allow scripts to run longer
-  TimeOut 600
+  ## Custom fragment
+LimitRequestFieldSize 262144
 </VirtualHost>
diff --git a/LumiBlock/LumiCalc/html/index.html b/LumiBlock/LumiCalc/html/index.html
index 62bec65c4f0..97f7e832d86 100755
--- a/LumiBlock/LumiCalc/html/index.html
+++ b/LumiBlock/LumiCalc/html/index.html
@@ -26,11 +26,13 @@
 </ul>
 <h3>LumiCalc News</h3>
 <ul>
+<li><font color="red">6 June, 2015</font> - Updated defaults for Run2 data.</li>
+<li><font color="red">31 March, 2015</font> - Tag OflLumi-HI-003 available for proton-lead.</li>
 <li><font color="red">19 Oct, 2014</font> - Tag OflLumi-2p76TeV-002 now final for 2013.</li>
-<li><font color="red">7 Oct, 2014</font> - Move to new server infrastructure.</li>
-<li><font color="red">9 May, 2014</font> - Tag OflLumi-HI-002 available for proton-lead.</li>
-<li><font color="red">21 Jun, 2013</font> - Tag OflLumi-7TeV-004 available with beam-beam corrections.</li>
-<li><font color="red">12 Feb, 2013</font> - Tag OflLumi-8TeV-003 available for Winter 2013.</li>  
+<!-- <li><font color="red">7 Oct, 2014</font> - Move to new server infrastructure.</li> -->
+<!-- <li><font color="red">9 May, 2014</font> - Tag OflLumi-HI-002 available for proton-lead.</li> -->
+<!-- <li><font color="red">21 Jun, 2013</font> - Tag OflLumi-7TeV-004 available with beam-beam corrections.</li> -->
+<!-- <li><font color="red">12 Feb, 2013</font> - Tag OflLumi-8TeV-003 available for Winter 2013.</li>   -->
 <!-- <li><font color="red">17 Jan, 2013</font> - Create CSV file of luminosity table.</li>   -->
 <!-- <li><font color="red">13 Jan, 2013</font> - Updated LAr EventVeto tag now default.</li>   -->
 <!-- <li><font color="red">21 Dec, 2012</font> - Updated LAr EventVeto tag for reprocessing available.</li>   -->
@@ -56,7 +58,8 @@
 <h3>Recommendations</h3>
 <table class="lumitable">
 <tr><th width=200pt>Data Sample</th><th width=200pt>Recommended<br />Luminosity Tag</th><th width=200pt>Recommended<br />Livefraction Trigger</th><th width=200pt>Comments</th></tr>
-<tr><td>data13_hip</td><td>OflLumi-HI-002</td><td>L1_LUCID_A_C</td><td>Preliminary vdM calibration</td></tr>
+<tr><td>data15_13TeV</td><td>OflPrefLumi-RUN2-UPD4-00</td><td>L1_EM12</td><td>Initial online estimate</td></tr>
+<tr><td>data13_hip</td><td>OflLumi-HI-003</td><td>L1_LUCID_A_C</td><td>Final vdM calibration</td></tr>
 <tr><td>data13_2p76TeV</td><td>OflLumi-2p76TeV-002</td><td>L1_LUCID_A_C</td><td>Final 2.76 lumi</td></tr>
 <tr><td>data12_8TeV</td><td>OflLumi-8TeV-003</td><td>L1_EM30</td><td>Preliminary 2012 vdM calibration</td></tr>
 <tr><td>data11_7TeV</td><td>OflLumi-7TeV-004</td><td>L1_EM30</td><td>Final 2011 results<br />(with beam-beam corrections)</td></tr>
@@ -77,7 +80,8 @@
 <tr>
 <td>Luminosity Tag:</td> 
 <td><select name="lumitag">
-<option value="OflLumi-8TeV-003" SELECTED>OflLumi-8TeV-003 (preferred 2012)</option>
+<option value="OflPrefLumi-RUN2-UPD4-00" SELECTED>OflPrefLumi-RUN2-UPD4-00 (online 2015)</option>
+<option value="OflLumi-8TeV-003">OflLumi-8TeV-003 (preferred 2012)</option>
 <option value="OflLumi-8TeV-002">OflLumi-8TeV-002</option>
 <option value="OflLumi-8TeV-001">OflLumi-8TeV-001</option>
 <option value="OflLumi-8TeV-000">OflLumi-8TeV-000</option>
@@ -90,7 +94,8 @@
 <option value="OflLumi-2p76TeV-001">OflLumi-2p76TeV-001 (initial vdM calibration)</option>
 <option value="OflLumi-2p76TeV-000">OflLumi-2p76TeV-000 (initial offline estimate)</option>
 <option value="OflLumi-900GeV-001">OflLumi-900GeV-001 (900 GeV data only)</option> 
-<option value="OflLumi-HI-002">OflLumi-HI-002 (preferred 2013 p-Pb)</option> 
+<option value="OflLumi-HI-003">OflLumi-HI-003 (final 2013 p-Pb)</option> 
+<option value="OflLumi-HI-002">OflLumi-HI-002</option> 
 <option value="OflLumi-HI-001">OflLumi-HI-001</option> 
 <option value="OflLumi-HI-000">OflLumi-HI-000 (preliminary heavy ion luminosity)</option> 
 <option value="OflLumi-UPD2-002">OflLumi-UPD2-002 (testing)</option> 
@@ -101,7 +106,7 @@
 </tr>
 <tr>
 <td>Live Fraction Trigger:</td>
-<td><input type="text" name="livetrig" size="40" value="L1_EM30" />
+<td><input type="text" name="livetrig" size="40" value="L1_EM12" />
 </td>
 <td>This trigger is only used to compute the L1 live fraction.  Any high rate L1 trigger can be used.  Please see below for recommendations.</td>
 </tr>
@@ -113,7 +118,8 @@
 <tr>
 <td>LAr EventVeto Tag:</td>
 <td><select name="lartag">
-<option value="LARBadChannelsOflEventVeto-UPD4-04" SELECTED>LARBadChannelsOflEventVeto-UPD4-04 (recommended)</option> 
+<option value="LARBadChannelsOflEventVeto-RUN2-UPD4-04" SELECTED>LARBadChannelsOflEventVeto-RUN2-UPD4-04 (Run2 recommended)</option>
+<option value="LARBadChannelsOflEventVeto-UPD4-04">LARBadChannelsOflEventVeto-UPD4-04 (Run1 recommended)</option> 
 <option value="LARBadChannelsOflEventVeto-UPD4-03">LARBadChannelsOflEventVeto-UPD4-03</option> 
 <option value="LARBadChannelsOflEventVeto-UPD4-02">LARBadChannelsOflEventVeto-UPD4-02 (HCP dataset)</option> 
 <option value="LARBadChannelsOflEventVeto-UPD4-01">LARBadChannelsOflEventVeto-UPD4-01</option> 
@@ -154,6 +160,7 @@
 <li>2011 pp: L1_EM30 - present for all of 2011, still has adequate rate, this is the best option for the complete 2011 data sample</li>
 <li>2012 pp: L1_EM30 - present for all of 2012</li>
 <li>2013: L1_LUCID_A_C - best minbias trigger for both pp at 2.76 TeV and p-Pb.</li>
+<li>2015: L1_EM12 - highest pT L1 EM trigger </li>
 </ul>
 <p> One can also check the livefraction using any L1 physics trigger and similar results should be obtained.  Problems can be found if the prescaled trigger has a low enough rate to be in the range of Poisson statistics per lumi block, although summed over many luminosity blocks, the overall livefraction rate should still be accurate.</p>
 <h4>Physics Trigger</h4>
diff --git a/LumiBlock/LumiCalc/html/version.html b/LumiBlock/LumiCalc/html/version.html
index 88db430055f..7fdfb2b5990 100644
--- a/LumiBlock/LumiCalc/html/version.html
+++ b/LumiBlock/LumiCalc/html/version.html
@@ -1 +1 @@
-LumiCalc-00-03-04
+LumiCalc-00-03-07
diff --git a/LumiBlock/LumiCalc/src/LumiBlockRangeContainerConverter.cxx b/LumiBlock/LumiCalc/src/LumiBlockRangeContainerConverter.cxx
new file mode 100644
index 00000000000..5b0259a9182
--- /dev/null
+++ b/LumiBlock/LumiCalc/src/LumiBlockRangeContainerConverter.cxx
@@ -0,0 +1,270 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "LumiCalc/LumiBlockRangeContainerConverter.h"
+#include "xAODLuminosity/SortLumiBlockRangeByStart.h"
+
+#include "GoodRunsLists/TLumiBlockRange.h"
+#include "GoodRunsLists/TGoodRun.h"
+#include "GoodRunsLists/TGoodRunsList.h"
+#include "GoodRunsLists/TGRLCollection.h"
+#include "GoodRunsLists/TGoodRunsListReader.h"
+#include "GoodRunsLists/TGoodRunsListWriter.h"
+
+#include "TROOT.h"
+
+#include <stdlib.h>
+
+LumiBlockRangeContainerConverter::LumiBlockRangeContainerConverter()
+ : m_reader(new Root::TGoodRunsListReader())
+ , m_writer(new Root::TGoodRunsListWriter())
+{
+}
+
+
+LumiBlockRangeContainerConverter::~LumiBlockRangeContainerConverter()
+{
+  if (m_reader!=0) { delete m_reader; m_reader=0; }
+  if (m_writer!=0) { delete m_writer; m_writer=0; }
+}
+
+
+xAOD::LumiBlockRangeContainer* 
+LumiBlockRangeContainerConverter::GetLumiBlockRangeContainer(const Root::TGoodRunsList& grl, std::map<TString,TString>& metadata, TString& version) 
+{
+  metadata = grl.GetMetaData();
+  version = grl.GetVersion();
+  return this->GetLumiBlockRangeContainer( grl );
+}
+
+
+xAOD::LumiBlockRangeContainer* 
+LumiBlockRangeContainerConverter::GetLumiBlockRangeContainer(const Root::TGoodRunsList& grl) const 
+{
+  //  xAOD::LumiBlockRangeContainer* iovc = new xAOD::LumiBlockRangeContainer();
+  xAOD::LumiBlockRangeContainer* piovComplete = new xAOD::LumiBlockRangeContainer();
+  xAOD::LumiBlockRangeAuxContainer* piovCompleteAux = new xAOD::LumiBlockRangeAuxContainer();
+  piovComplete->setStore( piovCompleteAux );
+
+  Root::TGoodRun goodrun;
+  std::map<Int_t, Root::TGoodRun>::const_iterator it;
+  std::vector< Root::TLumiBlockRange >::const_iterator itlbr;
+  int RunNumber(-1), LumiBlockStart(-1), LumiBlockEnd(-1);
+
+  for(it = grl.begin(); it != grl.end(); ++it) {
+    RunNumber = it->first;
+    goodrun = it->second;
+    for(itlbr = goodrun.begin(); itlbr != goodrun.end(); ++itlbr) {
+      LumiBlockStart = itlbr->Begin();
+      LumiBlockEnd = itlbr->End();
+      xAOD::LumiBlockRange* iovr = new xAOD::LumiBlockRange();
+      piovComplete->push_back(iovr);
+      iovr->setStartRunNumber(RunNumber);
+      iovr->setStartLumiBlockNumber(LumiBlockStart);
+      iovr->setStopRunNumber(RunNumber);
+      iovr->setStopLumiBlockNumber(LumiBlockEnd);
+      iovr->setEventsExpected(0);
+      iovr->setEventsSeen(0);
+      //      iovc->push_back(new LB_IOVRange(IOVTime(RunNumber, LumiBlockStart), IOVTime(RunNumber,LumiBlockEnd)));
+    }
+  }
+  //  iovc->sort(xAOD::LumiBlockRangeContainer::SortIOVRangeByStart());
+  piovComplete->sort(xAOD::SortLumiBlockRangeByStart());
+  return piovComplete;
+}
+
+
+xAOD::LumiBlockRangeContainer* 
+LumiBlockRangeContainerConverter::GetLumiBlockRangeContainer(const char* xmlfile) const
+{
+  Root::TGoodRunsList* pgrl = this->GetGRLObject( xmlfile );
+  xAOD::LumiBlockRangeContainer* iovc = this->GetLumiBlockRangeContainer( *pgrl );
+  delete pgrl;
+  return iovc;
+}
+
+
+xAOD::LumiBlockRangeContainer* 
+LumiBlockRangeContainerConverter::GetLumiBlockRangeContainerFromString( const TString& xmlstring ) const
+{
+  m_reader->SetXMLString( xmlstring );
+  (void) m_reader->Interpret();
+  return this->GetLumiBlockRangeContainer( m_reader->GetMergedGoodRunsList() );
+}
+
+
+void 
+LumiBlockRangeContainerConverter::CreateXMLFile(const Root::TGRLCollection& grlcollection, const char* xmlfilename) const
+{
+  m_writer->SetGRLCollection( grlcollection ) ;
+  m_writer->SetFilename( xmlfilename ) ;
+  m_writer->WriteXMLFile() ;
+}
+
+
+void
+LumiBlockRangeContainerConverter::CreateXMLFile(const Root::TGoodRunsList& grl, const TString& xmlfilename, const TString& prefix) const
+{
+  m_writer->SetGoodRunsList( grl ) ;
+  TString xmlfile = ( xmlfilename.IsNull() ? prefix + grl.GetSuggestedName() + ".xml" : xmlfilename );
+  m_writer->SetFilename( xmlfile.Data() ) ;
+  m_writer->WriteXMLFile() ;
+}
+
+
+void 
+LumiBlockRangeContainerConverter::CreateXMLFile(const xAOD::LumiBlockRangeContainer& lbc, const grlmetadatamap& metadata, const char* version, 
+                                            const TString& xmlfilename, const TString& prefix ) const
+{
+  Root::TGoodRunsList* pgrl = this->GetGRLObject(lbc,metadata,version);
+  m_writer->SetGoodRunsList( *pgrl ) ;
+  TString xmlfile = ( xmlfilename.IsNull() ? prefix+pgrl->GetSuggestedName()+".xml" : xmlfilename );
+  m_writer->SetFilename( xmlfile.Data() ) ;
+  m_writer->WriteXMLFile() ;  
+  delete pgrl;
+}
+
+
+void
+LumiBlockRangeContainerConverter::CreateXMLFiles(const Root::TGRLCollection& grlcollection, const char* prefix) const
+{
+  m_writer->SetGRLCollection( grlcollection ) ;
+  m_writer->SetPrefix( prefix ) ;
+  m_writer->WriteXMLFiles() ;
+}
+
+
+const TString 
+LumiBlockRangeContainerConverter::GetXMLString(const Root::TGoodRunsList& grl) const
+{
+  m_writer->SetGoodRunsList( grl ) ;
+  return m_writer->GetXMLString() ;
+}
+
+
+const TString
+LumiBlockRangeContainerConverter::GetXMLString(const Root::TGRLCollection& grlcollection) const
+{
+  m_writer->SetGRLCollection( grlcollection ) ;
+  return m_writer->GetXMLString() ;
+}
+
+
+const std::vector<TString> 
+LumiBlockRangeContainerConverter::GetXMLStrings(const Root::TGRLCollection& grlcollection) const
+{
+  m_writer->SetGRLCollection( grlcollection ) ;
+  return m_writer->GetXMLStrings() ;
+}
+
+
+const TString 
+LumiBlockRangeContainerConverter::GetXMLString( const xAOD::LumiBlockRangeContainer& lbc, const std::map<TString,TString>& metadata, const char* version ) const
+{
+  Root::TGoodRunsList* pgrl = this->GetGRLObject(lbc,metadata,version);
+  m_writer->SetGoodRunsList( *pgrl ) ;
+  TString xmlstring = m_writer->GetXMLString() ;
+  delete pgrl;
+  return xmlstring;
+}
+
+
+Root::TGoodRunsList* 
+LumiBlockRangeContainerConverter::GetGRLObject( const xAOD::LumiBlockRangeContainer& lbc, const std::map<TString,TString>& metadata, const char* version ) const
+{
+  Root::TGoodRunsList* grl = new Root::TGoodRunsList();
+  grl->SetVersion(version);
+  grl->SetMetaData(metadata);
+
+  if (!lbc.empty()) {
+    Root::TGoodRun goodrun;
+    int prev_runnbr(-1), cur_runnbr(-1), cur_lbstart(-1), cur_lbstop(-1);
+
+
+    xAOD::LumiBlockRangeContainer::const_iterator ib = lbc.begin();
+    xAOD::LumiBlockRangeContainer::const_iterator ie = lbc.end();
+  
+    for( xAOD::LumiBlockRangeContainer::const_iterator i=ib; i!=ie; i++) {
+      //    for( xAOD::LumiBlockRangeContainer::const_iterator it=lbc.begin(); it != lbc.end(); ++it ) {
+      //      const LB_IOVRange* iovr = (*it);
+      cur_runnbr = (*i)->startRunNumber();
+      cur_lbstart = (*i)->startLumiBlockNumber();
+      cur_lbstop = (*i)->stopLumiBlockNumber();
+      // store previous run and reset
+      if (prev_runnbr!=cur_runnbr) {
+        if (prev_runnbr>=0) { (*grl)[prev_runnbr]=goodrun; }
+        goodrun.clear();
+        goodrun.SetRunNumber(cur_runnbr);
+      }
+      // store lumiblock range
+      goodrun.push_back( Root::TLumiBlockRange(cur_lbstart,cur_lbstop) ) ;
+      prev_runnbr = cur_runnbr;
+    } // loop over lbs
+    (*grl)[prev_runnbr]=goodrun; // also store last goodrun
+  } // lbc !empty
+
+
+  grl->Compress();
+  return grl;
+}
+
+
+Root::TGoodRunsList* 
+LumiBlockRangeContainerConverter::GetGRLObject( const char* xmlfile ) const
+{
+  m_reader->SetXMLFile( xmlfile );
+  (void) m_reader->Interpret();
+  return (new Root::TGoodRunsList( m_reader->GetMergedGoodRunsList() )); 
+}
+
+
+Root::TGoodRunsList* 
+LumiBlockRangeContainerConverter::GetGRLObjectFromString( const TString& xmlstring ) const
+{
+  m_reader->SetXMLString( xmlstring );
+  (void) m_reader->Interpret();
+  return (new Root::TGoodRunsList( m_reader->GetMergedGoodRunsList() ));
+}
+
+
+Root::TGRLCollection*
+LumiBlockRangeContainerConverter::GetGRLCollection( const char* xmlfile ) const
+{
+  m_reader->SetXMLFile( xmlfile );
+  (void) m_reader->Interpret();
+  return (new Root::TGRLCollection( m_reader->GetMergedGRLCollection() ));
+} 
+
+
+Root::TGRLCollection*
+LumiBlockRangeContainerConverter::GetGRLCollectionFromString( const TString& xmlstring ) const
+{
+  m_reader->SetXMLString( xmlstring );
+  (void) m_reader->Interpret();
+  return (new Root::TGRLCollection( m_reader->GetMergedGRLCollection() ));
+}
+
+
+const TString
+LumiBlockRangeContainerConverter::GetSuggestedName( const xAOD::LumiBlockRangeContainer& lbc ) const
+{
+  if (lbc.empty()) return "grl_empty";
+
+  Int_t beginrun(-1), endrun(-1), beginlb(-1), endlb(-1);
+
+  xAOD::LumiBlockRangeContainer::const_iterator itb=lbc.begin();
+  xAOD::LumiBlockRangeContainer::const_reverse_iterator ite=lbc.rbegin();
+
+  //      cur_runnbr = (*i)->startRunNumber();
+  //      cur_lbstart = (*i)->startLumiBlockNumber();
+  //      cur_lbstop = (*i)->stopLumiBlockNumber();
+
+  beginrun = (*itb)->startRunNumber();
+  beginlb  = (*itb)->startLumiBlockNumber();
+  endrun = (*ite)->stopRunNumber();
+  endlb  = (*ite)->stopLumiBlockNumber();
+
+  return Form("grl_%d.%d-%d.%d",beginrun,beginlb,endrun,endlb);
+}
+
diff --git a/LumiBlock/LumiCalc/src/LumiCalculator.cxx b/LumiBlock/LumiCalc/src/LumiCalculator.cxx
index 6e0fe1d3599..399827a29e9 100644
--- a/LumiBlock/LumiCalc/src/LumiCalculator.cxx
+++ b/LumiBlock/LumiCalc/src/LumiCalculator.cxx
@@ -121,10 +121,11 @@ LumiCalculator::LumiCalculator()
   m_laroff="COOLOFL_LAR/"; 
   m_bsonl="COOLONL_INDET/";
 
-  m_data_db="COMP200";
-  m_parofflumiestfolder = "/TRIGGER/OFLLUMI/LBLESTOFL";
-  m_paronllumiestfolder = "/TRIGGER/LUMI/LBLESTOFL";
-  m_parlumiestfolder = "/TRIGGER/OFLLUMI/LBLESTOFL";
+  // These now need to be set after we know the run number (Run1 or Run2)
+  m_data_db="";
+  m_parofflumiestfolder = "";
+  m_paronllumiestfolder = "";
+  m_parlumiestfolder = "";
   m_parlvl1menufolder = "/TRIGGER/LVL1/Menu";
   m_parhltmenufolder = "/TRIGGER/HLT/Menu";// ChainCounter is here for COOLONL_TRIGGER/COMP20
   m_parhltprescalesfolder = "/TRIGGER/HLT/Prescales";// ChainCounter is here for COOLONL_TRIGGER/COMP20
@@ -149,7 +150,7 @@ LumiCalculator::LumiCalculator()
 
   m_lumitag = "OflLumi-8TeV-002";// for offline:  OflLumi_CosmicFake, OflLumi_TopMix
   m_lumichannel = 0;
-  m_lumimethod = "ATLAS_PREFERRED";// offline channels: ATLAS_PREFERRED, OflLumi_Fake0, OflLumi_Fake:, TopMixLumi 
+  m_lumimethod = "";// offline channels: ATLAS_PREFERRED, OflLumi_Fake0, OflLumi_Fake:, TopMixLumi 
   m_State = true;
   m_LumiTree = 0;
   
@@ -253,11 +254,8 @@ void LumiCalculator::UseMC(bool mc){
 
 void LumiCalculator::UseOnlineLumi(bool online){
 
-  if(online == true){
-    m_onlinelumi = true;
-    lumi_database = m_lumionl + m_data_db;
-    m_parlumiestfolder = "/TRIGGER/LUMI/LBLESTONL";
-  }
+  m_onlinelumi = online;
+
 }
 
 void LumiCalculator::UseLumiTag(const std::string& tag){
@@ -295,7 +293,7 @@ TTree * LumiCalculator::getTree(){
 }
 
 //______________________________________________________________________________
-void  LumiCalculator::IntegrateLumi(const LumiBlockCollection * iovc, const std::string& triggerchain){
+void  LumiCalculator::IntegrateLumi(const xAOD::LumiBlockRangeContainer * iovc, const std::string& triggerchain){
 
 
   CoolQuery * cq_lumi = NULL;
@@ -303,6 +301,40 @@ void  LumiCalculator::IntegrateLumi(const LumiBlockCollection * iovc, const std:
   CoolQuery* cq_lar = NULL;
   CoolQuery* cq_bs = NULL;
 
+  // Peek at first run in iovc to check if we want Run1 or Run2 data
+  xAOD::LumiBlockRangeContainer::const_iterator it = iovc->begin();
+  //  const IOVRange * iovr = (*it);
+  const IOVRange* iovr = new IOVRange(IOVTime((*it)->startRunNumber(),(*it)->startLumiBlockNumber()), 
+                                      IOVTime((*it)->stopRunNumber(),(*it)->stopLumiBlockNumber()));
+
+  std::string onlfolder;
+  std::string oflfolder;
+  if (iovr->start().run() > 222222) {
+    m_data_db="CONDBR2";
+    onlfolder = "/TRIGGER/LUMI/OnlPrefLumi";
+    oflfolder = "/TRIGGER/OFLLUMI/OflPrefLumi";
+  } else {
+    m_data_db="COMP200";
+    onlfolder = "/TRIGGER/LUMI/LBLESTONL";
+    oflfolder = "/TRIGGER/OFLLUMI/LBLESTOFL";
+  }
+
+  // define all connection strings
+
+  // check for online DB
+  if(m_onlinelumi){
+    lumi_database = m_lumionl + m_data_db;
+    m_parlumiestfolder = onlfolder;
+  } else {
+    lumi_database = m_lumioff + m_data_db;
+    m_parlumiestfolder = oflfolder;
+  }
+
+  trig_database = m_trigger + m_data_db;
+  lar_database = m_laroff + m_data_db;
+  bs_database = m_bsonl + m_data_db;
+
+
   m_logger << Root::kINFO << "Luminosity database: " << lumi_database << Root::GEndl;
   m_logger << Root::kINFO << "Trigger database: " << trig_database << Root::GEndl;
 
@@ -466,8 +498,10 @@ void  LumiCalculator::IntegrateLumi(const LumiBlockCollection * iovc, const std:
   std::map<cool::ValidityKey, CoolQuery::L1CountFolderData> Livetime_map;
   std::map<cool::ValidityKey, CoolQuery::L1CountFolderData> L1accept_map;
 
-  for(LumiBlockCollection::const_iterator it = iovc->begin(); it != iovc->end(); ++it){
-    const IOVRange * iovr = (*it);
+  for(xAOD::LumiBlockRangeContainer::const_iterator it = iovc->begin(); it != iovc->end(); ++it){
+    //    const IOVRange * iovr = (*it);
+    const IOVRange* iovr = new IOVRange(IOVTime((*it)->startRunNumber(),(*it)->startLumiBlockNumber()), 
+                                        IOVTime((*it)->stopRunNumber(),(*it)->stopLumiBlockNumber()));
     
     // Bookkeeping temporary results
     mt_totalDelL = 0.;
@@ -874,6 +908,9 @@ void  LumiCalculator::IntegrateLumi(const LumiBlockCollection * iovc, const std:
 	  if (it->second == 0) continue;
 	  float dtime = (it->first.stop().re_time() - it->first.start().re_time())/1.E9;
 	  m_lartime += dtime;
+	  if (m_verbose == true) {
+	    m_logger << Root::kINFO << "Found LAr veto from " << it->first.start().re_time() << " to " << it->first.stop().re_time() << " = " << dtime << " seconds" << Root::GEndl;
+	  }
 	}
       }
 
diff --git a/LumiBlock/LumiCalc/src/cmdline.cxx b/LumiBlock/LumiCalc/src/cmdline.cxx
index e363a3c21cf..254f5489012 100644
--- a/LumiBlock/LumiCalc/src/cmdline.cxx
+++ b/LumiBlock/LumiCalc/src/cmdline.cxx
@@ -146,7 +146,7 @@ void clear_args (struct gengetopt_args_info *args_info)
   args_info->online_flag = 0;
   args_info->lumichannel_arg = 0;
   args_info->lumichannel_orig = NULL;
-  args_info->lumimethod_arg = gengetopt_strdup ("ATLAS_PREFERRED");
+  args_info->lumimethod_arg = gengetopt_strdup ("");
   args_info->lumimethod_orig = NULL;
   args_info->trigger_arg = NULL;
   args_info->trigger_orig = NULL;
diff --git a/LumiBlock/LumiCalc/src/iLumiCalc.cxx b/LumiBlock/LumiCalc/src/iLumiCalc.cxx
index 0b78933d886..107573cc743 100644
--- a/LumiBlock/LumiCalc/src/iLumiCalc.cxx
+++ b/LumiBlock/LumiCalc/src/iLumiCalc.cxx
@@ -343,10 +343,10 @@ int main(int argc, char * argv[]){
 
   //==========================================================================
   // Set up LumiBlockCollection for the different scenarios
-  std::vector< LumiBlockCollection* > iovcVec;
+  std::vector< xAOD::LumiBlockRangeContainer* > iovcVec;
   std::vector< std::vector<std::string> > m_triggerchainVec;
   Root::TGRLCollection m_grlcollection;
-  LumiBlockCollectionConverter m_converter;
+  LumiBlockRangeContainerConverter m_converter;
   TString m_version("30"); // [0-10): ATLRunQuery, [10-20): ntuple production, [20-30): xml merging, [30-40): LumiCalc
 
   //==========================================================================
@@ -374,8 +374,10 @@ int main(int argc, char * argv[]){
     uint32_t _lbstart;
     uint32_t _lbend;
 
-    LumiBlockCollection* iovc = new LumiBlockCollection();
-    
+    xAOD::LumiBlockRangeContainer* iovc = new xAOD::LumiBlockRangeContainer();
+    xAOD::LumiBlockRangeAuxContainer* iovcAux = new xAOD::LumiBlockRangeAuxContainer();
+    iovc->setStore( iovcAux );
+
     std::vector<uint32_t>::iterator itstart;
     std::vector<uint32_t>::iterator itend;
     std::vector<uint32_t>::iterator itrun;
@@ -392,7 +394,12 @@ int main(int argc, char * argv[]){
 	    m_logger << Root::kERROR << "lbstart > lbend! Should be: lbstart < = lbend" << Root::GEndl;
 	    exit(-1);
 	  } else {
-	    iovc->push_back(new LB_IOVRange(IOVTime(runnumber[0], _lbstart), IOVTime(runnumber[0], _lbend)));
+	    xAOD::LumiBlockRange* iovr = new xAOD::LumiBlockRange();
+	    iovr->setStartRunNumber(runnumber[0]);
+	    iovr->setStartLumiBlockNumber(_lbstart);
+	    iovr->setStopRunNumber(runnumber[0]);
+	    iovr->setStopLumiBlockNumber(_lbend);
+	    iovc->push_back(iovr);
 	  }
 	}
 
@@ -403,7 +410,12 @@ int main(int argc, char * argv[]){
 	  ++itrun, ++itstart, ++itend) {
 	m_logger << Root::kINFO << "Runnumbers [" << *itrun <<  "]" << Root::GEndl;
 	m_logger << Root::kINFO << "lbstart-lbend [" << *itstart << "-" << *itend << "]" << Root::GEndl; 
-	iovc->push_back(new LB_IOVRange(IOVTime(*itrun, *itstart), IOVTime(*itrun, *itend)));
+	    xAOD::LumiBlockRange* iovr = new xAOD::LumiBlockRange();
+	    iovr->setStartRunNumber(*itrun);
+	    iovr->setStartLumiBlockNumber(*itstart);
+	    iovr->setStopRunNumber(*itrun);
+	    iovr->setStopLumiBlockNumber(*itend);
+	    iovc->push_back(iovr);
       }
     }
 
@@ -417,9 +429,9 @@ int main(int argc, char * argv[]){
   
 
   //==========================================================================
-  // Fetch up LumiBlockCollection from input TAG file
+  // Fetch up xAOD::LumiBlockRangeContainer from input TAG file
   if (runtype == 1) {
-    // open TAG files to build LumiBlockCollection
+    // open TAG files to build xAOD::LumiBlockRangeContainer
     m_logger << Root::kINFO << "Being in TAG file mode..." << Root::GEndl;
 
     Root::TGoodRunsListReader m_reader;
@@ -457,7 +469,7 @@ int main(int argc, char * argv[]){
     m_grlcollection = m_reader.GetMergedGRLCollection();
     
     for (unsigned int j=0; j<m_grlcollection.size(); ++j) {
-      iovcVec.push_back( m_converter.GetLumiBlockCollection(m_grlcollection[j]) );
+      iovcVec.push_back( m_converter.GetLumiBlockRangeContainer(m_grlcollection[j]) );
       // default: trigger names taken from xml metadata. Overwrite any existing cmd-line triggers.
       if ( m_grlcollection[j].HasTriggerInfo() ) {
         m_triggerchainVec.push_back(m_grlcollection[j].GetTriggerList()); // use existing trigger names
@@ -473,9 +485,9 @@ int main(int argc, char * argv[]){
   }
 
   //==========================================================================
-  // Fetch up LumiBlockCollection from input XML file
+  // Fetch up xAOD::LumiBlockRangeContainer from input XML file
   if(runtype == 3){
-    // open XML files to build LumiBlockCollection
+    // open XML files to build xAOD::LumiBlockRangeContainer
     m_logger << Root::kINFO << "Being in XML file mode..." << Root::GEndl;
     Root::TGoodRunsListReader m_reader;
     // looping over XML files
@@ -487,7 +499,7 @@ int main(int argc, char * argv[]){
     m_grlcollection = m_reader.GetMergedGRLCollection();
 
     for (unsigned int j=0; j<m_grlcollection.size(); ++j) {
-      iovcVec.push_back( m_converter.GetLumiBlockCollection(m_grlcollection[j]) );
+      iovcVec.push_back( m_converter.GetLumiBlockRangeContainer(m_grlcollection[j]) );
       // default: trigger names taken from xml metadata. Overwrite any existing cmd-line triggers.
       if ( m_grlcollection[j].HasTriggerInfo() ) {
         m_triggerchainVec.push_back(m_grlcollection[j].GetTriggerList()); // use existing trigger names
@@ -504,7 +516,7 @@ int main(int argc, char * argv[]){
 
 
   //==========================================================================
-  // Fetch up LumiBlockCollection from input ROOT files - Tree mode
+  // Fetch up xAOD::LumiBlockRangeContainer from input ROOT files - Tree mode
   if(runtype == 4){
     // open ntuples to fetch xmlstrings
     m_logger << Root::kINFO << "Being in ROOT ntuple file mode..." << Root::GEndl;
@@ -527,7 +539,7 @@ int main(int argc, char * argv[]){
 	// add xml string to TGoodRunsListReader. Sort out strings below
 	for(int j=0; j<list->GetEntries();++j) {
 	  TObjString* objstr = dynamic_cast<TObjString*>(list->At(j));
-	  if ((objstr==0)) continue;
+	  if (objstr==0) continue;
 	  if ( objstr->GetString().BeginsWith("<?xml version=\"1.0\"?") &&
 	       objstr->GetString().Contains("DOCTYPE LumiRangeCollection") ) // xml identifier
 	    m_reader.AddXMLString(objstr->GetString());
@@ -541,7 +553,7 @@ int main(int argc, char * argv[]){
     m_grlcollection = m_reader.GetMergedGRLCollection();
     
     for (unsigned int j=0; j<m_grlcollection.size(); ++j) {
-      iovcVec.push_back( m_converter.GetLumiBlockCollection(m_grlcollection[j]) );
+      iovcVec.push_back( m_converter.GetLumiBlockRangeContainer(m_grlcollection[j]) );
       // default: trigger names taken from xml metadata. Overwrite any existing cmd-line triggers.
       if ( m_grlcollection[j].HasTriggerInfo() ) {
 	m_triggerchainVec.push_back(m_grlcollection[j].GetTriggerList()); // use existing trigger names
@@ -557,7 +569,7 @@ int main(int argc, char * argv[]){
   }
   
   //==========================================================================
-  // Fetch up LumiBlockCollection from input ROOT files - D3PD mode
+  // Fetch up xAOD::LumiBlockRangeContainer from input ROOT files - D3PD mode
   if(runtype == 5){
     // open ntuples to fetch xmlstrings
     m_logger << Root::kINFO << "Being in ROOT D3PD ntuple file mode..." << Root::GEndl;
@@ -607,7 +619,7 @@ int main(int argc, char * argv[]){
     m_reader.Interpret();
     m_grlcollection = m_reader.GetMergedGRLCollection();
     for (unsigned int j=0; j<m_grlcollection.size(); ++j) {
-      iovcVec.push_back( m_converter.GetLumiBlockCollection(m_grlcollection[j]) );
+      iovcVec.push_back( m_converter.GetLumiBlockRangeContainer(m_grlcollection[j]) );
       // default: trigger names taken from xml metadata. Overwrite any existing cmd-line triggers.
       if ( m_grlcollection[j].HasTriggerInfo() ) {
         m_triggerchainVec.push_back(m_grlcollection[j].GetTriggerList()); // use existing trigger names
@@ -630,16 +642,15 @@ int main(int argc, char * argv[]){
     // If runtype != 0 and a run range has been specified, use that to filter runs
     // ===========================================================================
     if (runtype != 0 && runList.size() > 0) {
-      std::vector<LumiBlockCollection*>::iterator iovIt = iovcVec.begin();
+      std::vector<xAOD::LumiBlockRangeContainer*>::iterator iovIt = iovcVec.begin();
       // std::vector<std::vector<std::string> >::iterator trigIt = m_triggerchainVec.begin();
 
       for (;iovIt != iovcVec.end(); iovIt++) {
 
-	LumiBlockCollection::iterator it = (*iovIt)->begin();
+	xAOD::LumiBlockRangeContainer::iterator it = (*iovIt)->begin();
 	while (it != (*iovIt)->end()) {
 
-	  LB_IOVRange * iovr = *it;
-	  unsigned int runnum = iovr->start().run();
+	  unsigned int runnum = (*it)->startRunNumber() ;
 
 	  bool found = false;
 	  std::list<std::pair<unsigned int, unsigned int> >::iterator runIt = runList.begin();
@@ -651,7 +662,7 @@ int main(int argc, char * argv[]){
 	  }
 
 	  if (!found) {
-	    m_logger << Root::kDEBUG << "Skipping run " << iovr->start().run() << " LB [" << iovr->start().event() << "-" << iovr->stop().event() << "] due to command-line run range" << Root::GEndl;
+	    m_logger << Root::kDEBUG << "Skipping run " << (*it)->startRunNumber() << " LB [" << (*it)->startLumiBlockNumber() << "-" << (*it)->stopLumiBlockNumber() << "] due to command-line run range" << Root::GEndl;
 	    (*iovIt)->erase(it);
 
 	    it = (*iovIt)->begin();
@@ -669,7 +680,7 @@ int main(int argc, char * argv[]){
 
     LumiCalculator m_lumicalc;
     for (unsigned int j=0; j<iovcVec.size(); ++j) {
-      LumiBlockCollection* iovc = iovcVec[j];
+      xAOD::LumiBlockRangeContainer* iovc = iovcVec[j];
       m_triggerchain = m_triggerchainVec[j];
       
       for(std::vector<std::string>::iterator it = m_triggerchain.begin(); it != m_triggerchain.end(); ++it){
diff --git a/LumiBlock/LumiCalc/src/iLumiCalc.h b/LumiBlock/LumiCalc/src/iLumiCalc.h
index ad3d343a209..998b72ebf70 100644
--- a/LumiBlock/LumiCalc/src/iLumiCalc.h
+++ b/LumiBlock/LumiCalc/src/iLumiCalc.h
@@ -5,7 +5,7 @@
 #include "cmdline.h"
 #include "LumiCalc/LumiCalculator.h"
 #include "LumiCalc/CoolQuery.h"
-#include "LumiCalc/LumiBlockCollectionConverter.h"
+#include "LumiCalc/LumiBlockRangeContainerConverter.h"
 #include "GoodRunsLists/TGoodRunsListReader.h"
 #include "GoodRunsLists/TGoodRunsList.h"
 #include "GoodRunsLists/TGRLCollection.h"
-- 
GitLab