From 304b2e8d1f5de1623f5bede895078f4eb728ea76 Mon Sep 17 00:00:00 2001
From: Pavol Strizenec <pavol.strizenec@cern.ch>
Date: Mon, 28 Oct 2019 18:28:45 +0000
Subject: [PATCH] LAr electronics calibration  fixes

---
 LArCalorimeter/LArCalibTools/CMakeLists.txt   |   6 +-
 .../LArCalibTools/LArCond2NtupleBase.h        |   5 +-
 .../LArCalibTools/LArDigits2Ntuple.h          |   7 +
 .../LArCalibTools/LArPulseShape.h             |   7 +-
 .../share/LArDigits2Ntuple_jobOptions.py      | 133 ++++++++---
 .../LArCalibTools/src/LArCond2NtupleBase.cxx  | 208 ++++++++++++------
 .../LArCalibTools/src/LArDigits2Ntuple.cxx    |  29 ++-
 .../LArCalibTools/src/LArPulseShape.cxx       |   1 +
 .../LArCalibUtils/src/LArCaliWaveBuilder.cxx  |   5 +-
 .../LArCalib_Delay_OFC_Cali_jobOptions.py     |  49 +++--
 .../LArCalib_PedestalAutoCorr_jobOptions.py   |  34 +--
 .../share/LArCalib_Ramp_jobOptions.py         |  40 ++--
 12 files changed, 365 insertions(+), 159 deletions(-)

diff --git a/LArCalorimeter/LArCalibTools/CMakeLists.txt b/LArCalorimeter/LArCalibTools/CMakeLists.txt
index 46a6cd871138..bc5520802b16 100644
--- a/LArCalorimeter/LArCalibTools/CMakeLists.txt
+++ b/LArCalorimeter/LArCalibTools/CMakeLists.txt
@@ -17,8 +17,8 @@ atlas_depends_on_subdirs( PUBLIC
                           LArCalorimeter/LArRawConditions
                           LArCalorimeter/LArRecConditions
                           LArCalorimeter/LArRawEvent
-                          Trigger/TrigAnalysis/TrigDecisionTool
                           LumiBlock/LumiBlockComps
+                          Trigger/TrigAnalysis/TrigDecisionTool
                           PRIVATE
                           Calorimeter/CaloCondBlobObjs
                           Control/AthenaKernel
@@ -39,8 +39,8 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minui
 atlas_add_component( LArCalibTools
                      src/*.cxx
                      src/components/*.cxx
-                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} CaloIdentifier AthenaBaseComps StoreGateLib SGtests GaudiKernel LArCablingLib LArIdentifier LArRawConditions LArRecConditions CaloCondBlobObjs AthenaKernel AthenaPoolUtilities EventInfo LArCOOLConditions LArRawEvent LArToolsLib TrigDecisionToolLib LumiBlockCompsLib LumiBlockData )
+                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} 
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} CaloIdentifier AthenaBaseComps StoreGateLib SGtests GaudiKernel LArCablingLib LArIdentifier LArRawConditions LArRecConditions CaloCondBlobObjs AthenaKernel AthenaPoolUtilities EventInfo LArCOOLConditions LArRawEvent LArToolsLib TrigDecisionToolLib LumiBlockCompsLib )
 
 # Install files from the package:
 atlas_install_headers( LArCalibTools )
diff --git a/LArCalorimeter/LArCalibTools/LArCalibTools/LArCond2NtupleBase.h b/LArCalorimeter/LArCalibTools/LArCalibTools/LArCond2NtupleBase.h
index 643e17f72786..fc8cff6d5a1f 100644
--- a/LArCalorimeter/LArCalibTools/LArCalibTools/LArCond2NtupleBase.h
+++ b/LArCalorimeter/LArCalibTools/LArCalibTools/LArCond2NtupleBase.h
@@ -26,6 +26,7 @@ class LArEM_Base_ID;
 class LArHEC_Base_ID;
 class LArFCAL_Base_ID;
 class MsgStream;
+class CaloDetDescrManager_Base;
 
 class LArCond2NtupleBase : public AthAlgorithm {
 
@@ -63,6 +64,7 @@ class LArCond2NtupleBase : public AthAlgorithm {
   NTuple::Item<long> m_isConnected;
   NTuple::Item<long> m_chanHash, m_febHash, m_oflHash;
   
+  NTuple::Item<float> m_reta, m_rphi;
   NTuple::Item<float> m_FEBTemp1, m_FEBTemp2;
 
 
@@ -72,6 +74,7 @@ class LArCond2NtupleBase : public AthAlgorithm {
   const LArFCAL_Base_ID* m_fcalId;
   const LArOnlineID_Base* m_onlineId;
   const CaloCell_Base_ID* m_caloId;
+  const CaloDetDescrManager_Base* m_dd_man;
   ToolHandle<ILArFEBTempTool> m_FEBTempTool;
 
   SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};
@@ -82,6 +85,6 @@ class LArCond2NtupleBase : public AthAlgorithm {
   bool m_isFlat;
   bool m_OffId;
   bool m_addHash;
-
+  bool m_realgeom;
 };
 #endif
diff --git a/LArCalorimeter/LArCalibTools/LArCalibTools/LArDigits2Ntuple.h b/LArCalorimeter/LArCalibTools/LArCalibTools/LArDigits2Ntuple.h
index 393189d2a9dc..92c32658bcc8 100644
--- a/LArCalorimeter/LArCalibTools/LArCalibTools/LArDigits2Ntuple.h
+++ b/LArCalorimeter/LArCalibTools/LArCalibTools/LArDigits2Ntuple.h
@@ -6,6 +6,8 @@
 #define LARDIGITS2NTUPLE_H
 
 #include "LArCalibTools/LArCond2NtupleBase.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "StoreGate/ReadCondHandleKey.h"
 
 class LArDigits2Ntuple : public LArCond2NtupleBase
 {
@@ -30,6 +32,11 @@ class LArDigits2Ntuple : public LArCond2NtupleBase
   NTuple::Item<short> m_gain;
   NTuple::Item<long> m_IEvent;
   NTuple::Array<short>  m_samples;
+  NTuple::Item<long> m_bcid;
+
+  bool m_fillBCID;
+  SG::ReadHandleKey<xAOD::EventInfo> m_evtInfoKey { this, "EventInfoKey", "EventInfo", "SG for EventInfo Key" };
+
 };
 
 #endif
diff --git a/LArCalorimeter/LArCalibTools/LArCalibTools/LArPulseShape.h b/LArCalorimeter/LArCalibTools/LArCalibTools/LArPulseShape.h
index d1ee504030d6..f1aae4f45470 100644
--- a/LArCalorimeter/LArCalibTools/LArCalibTools/LArPulseShape.h
+++ b/LArCalorimeter/LArCalibTools/LArCalibTools/LArPulseShape.h
@@ -14,7 +14,6 @@
 
 #include "CaloIdentifier/CaloIdManager.h"
 #include "CaloIdentifier/CaloCell_ID.h"
-#include "TrigDecisionTool/TrigDecisionTool.h"
 #include <iostream>
 #include "TProfile.h"
 #include "TH1.h"
@@ -35,6 +34,10 @@ class LArHEC_Base_ID;
 class LArFCAL_Base_ID;
 class CaloCell_ID;
 
+namespace Trig{
+   class TrigDecisionTool;
+}
+
 class LArPulseShape : public AthAlgorithm {
 
  public:
@@ -81,7 +84,7 @@ class LArPulseShape : public AthAlgorithm {
 
    const ILArPedestal* m_larPedestal;
 
-   std::map<std::string, TProfile*> m_effhistos;  
+   std::map<std::string, TProfile*> m_effhistos;
    std::map<int, TProfile*> m_cellHistos;     
    TProfile* m_TProfpulse_diff;    
    std::map<std::string, TH1*> m_histos;
diff --git a/LArCalorimeter/LArCalibTools/share/LArDigits2Ntuple_jobOptions.py b/LArCalorimeter/LArCalibTools/share/LArDigits2Ntuple_jobOptions.py
index dc5e930b2747..96c3471e2d64 100755
--- a/LArCalorimeter/LArCalibTools/share/LArDigits2Ntuple_jobOptions.py
+++ b/LArCalorimeter/LArCalibTools/share/LArDigits2Ntuple_jobOptions.py
@@ -1,7 +1,5 @@
 import commands
 
-include("LArCalibProcessing/LArCalib_Flags.py")
-include("RecExCommission/GetInputFiles.py")
 
 if not 'SubDet' in dir():
    SubDet = "Barrel"
@@ -18,6 +16,9 @@ if not 'BaseFileName' in dir():
 if not 'OutputRootFileName' in dir():
    OutputRootFileName = BaseFileName+".root"
    
+if not 'OutputDir' in dir():
+      OutputDir  = commands.getoutput("pwd")
+
 if not 'FilePrefix' in dir():
    if (int(RunNumberList[0]))<99800 :
       FilePrefix = "daq.Ramp"
@@ -50,17 +51,80 @@ if not 'EvtMax' in dir():
 if not 'WriteNtuple' in dir():
    WriteNtuple = LArCalib_Flags.WriteNtuple
 
-include ("LArConditionsCommon/LArMinimalSetup.py")
+if not 'SuperCells' in dir():
+   SuperCells=False
+
+if not SuperCells: include("LArCalibProcessing/LArCalib_Flags.py")
+else: include("LArCalibProcessing/LArCalib_FlagsSC.py")
+include("RecExCommission/GetInputFiles.py")
+
+if SuperCells:
+   from AthenaCommon.GlobalFlags import globalflags
+   globalflags.DetGeo.set_Value_and_Lock('atlas')
+   globalflags.Luminosity.set_Value_and_Lock('zero')
+   globalflags.DataSource.set_Value_and_Lock('data')
+   globalflags.InputFormat.set_Value_and_Lock('bytestream')
+   globalflags.DatabaseInstance.set_Value_and_Lock('CONDBR2')
+   
+   from AthenaCommon.JobProperties import jobproperties
+   jobproperties.Global.DetDescrVersion = "ATLAS-R2-2016-01-00-01"
+   
+   from AthenaCommon.DetFlags import DetFlags
+   DetFlags.Calo_setOn()  
+   DetFlags.ID_setOff()
+   DetFlags.Muon_setOff()
+   DetFlags.Truth_setOff()
+   DetFlags.LVL1_setOff()
+   DetFlags.digitize.all_setOff()
+   #DetFlags.Print()
+   
+   #Set up GeoModel (not really needed but crashes without)
+   from AtlasGeoModel import SetGeometryVersion
+   from AtlasGeoModel import GeoModelInit
+   
+   #Get identifier mapping
+   include( "LArConditionsCommon/LArIdMap_comm_jobOptions.py" )
+   include( "LArIdCnv/LArIdCnv_joboptions.py" )
+   include( "ByteStreamCnvSvc/BSEventStorageEventSelector_jobOptions.py" )
+else:
+   include ("LArConditionsCommon/LArMinimalSetup.py")
+
+from LArCabling.LArCablingAccess import  LArOnOffIdMapping,LArFebRodMapping,LArCalibIdMapping
+LArOnOffIdMapping()
+LArFebRodMapping()
+LArCalibIdMapping()
+if SuperCells:
+   from LArCabling.LArCablingAccess import  LArOnOffIdMappingSC, LArCalibIdMappingSC
+   LArOnOffIdMappingSC()
+   LArCalibIdMappingSC()
+
+
+
 svcMgr.IOVDbSvc.GlobalTag=LArCalib_Flags.globalFlagDB
 svcMgr.IOVDbSvc.DBInstance=""
 
-InputDBConnectionBadChannel = "COOLONL_LAR/CONDBR2"
-BadChannelsFolder="/LAR/BadChannels/BadChannels"
-BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,"-RUN2-UPD1-00")
-conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag><dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
-MissingFEBsFolder="/LAR/BadChannels/MissingFEBs"
-MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,"-RUN2-UPD1-01")
-conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag> <dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+from LArBadChannelTool.LArBadChannelAccess import LArBadChannelAccess
+
+if 'InputDBConnectionBadChannel' not in dir():
+   InputDBConnectionBadChannel = "<db>COOLONL_LAR/CONDBR2</db>"
+   BadChannelsFolder="/LAR/BadChannels/BadChannels"
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,"-RUN2-UPD1-00")
+   LArBadChannelAccess(dbString=BadChannelsFolder+InputDBConnectionBadChannel+"<tag>"+BadChannelsTagSpec+"</tag>")
+else:
+   BadChannelsFolder="/LAR/BadChannelsOfl/BadChannels"
+   #def DBConnectionFile(sqlitefile):  
+   #   return "sqlite://;schema="+sqlitefile+";dbname=CONDBR2"
+   #InputDBConnectionBadChannel = DBConnectionFile(InputDBConnectionBadChannel)
+   #BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,"")
+   LArBadChannelAccess(dbString=BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+
+if not SuperCells:
+   from LArBadChannelTool.LArBadFebAccess import LArBadFebAccess
+   MissingFEBsFolder="/LAR/BadChannels/MissingFEBs"
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,"-RUN2-UPD1-01")
+   LArBadFebAccess(dbString=MissingFEBsFolder+InputDBConnectionBadChannel+"<tag>"+MissingFEBsTagSpec+"</tag>")
+
 from AthenaCommon.AlgSequence import AlgSequence 
 topSequence = AlgSequence()  
 
@@ -78,25 +142,29 @@ else :
 theByteStreamInputSvc.MaxBadEvents=0
 svcMgr.ByteStreamCnvSvc.InitCnvs += [ "EventInfo"]
 
-from LArByteStream.LArByteStreamConf import LArRodDecoder
-svcMgr.ToolSvc += LArRodDecoder()
-
 theByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
-theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
-theByteStreamAddressProviderSvc.TypeNames += [ "LArDigitContainer/HIGH"  ]
-theByteStreamAddressProviderSvc.TypeNames += [ "LArDigitContainer/MEDIUM"]
-theByteStreamAddressProviderSvc.TypeNames += [ "LArDigitContainer/LOW"   ]
-theByteStreamAddressProviderSvc.TypeNames += [ "LArDigitContainer/FREE"   ]
-
-include ("LArROD/LArFebErrorSummaryMaker_jobOptions.py")       
-topSequence.LArFebErrorSummaryMaker.CheckAllFEB=False
-from LArCalibDataQuality.LArCalibDataQualityConf import LArBadEventCatcher
-theLArBadEventCatcher=LArBadEventCatcher()
-theLArBadEventCatcher.CheckAccCalibDigitCont=False
-theLArBadEventCatcher.CheckBSErrors=True
-theLArBadEventCatcher.KeyList=[Gain]
-theLArBadEventCatcher.StopOnError=False
-topSequence+=theLArBadEventCatcher    
+if not SuperCells:
+   from LArByteStream.LArByteStreamConf import LArRodDecoder
+   svcMgr.ToolSvc += LArRodDecoder()
+
+   theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArDigitContainer/HIGH"  ]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArDigitContainer/MEDIUM"]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArDigitContainer/LOW"   ]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArDigitContainer/FREE"   ]
+
+   include ("LArROD/LArFebErrorSummaryMaker_jobOptions.py")       
+   topSequence.LArFebErrorSummaryMaker.CheckAllFEB=False
+
+   from LArCalibDataQuality.LArCalibDataQualityConf import LArBadEventCatcher
+   theLArBadEventCatcher=LArBadEventCatcher()
+   theLArBadEventCatcher.CheckAccCalibDigitCont=False
+   theLArBadEventCatcher.CheckBSErrors=True
+   theLArBadEventCatcher.KeyList=[Gain]
+   theLArBadEventCatcher.StopOnError=False
+   topSequence+=theLArBadEventCatcher    
+else:
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArDigitContainer/SC"  ]
 
 from LArCalibTools.LArCalibToolsConf import *
 
@@ -105,6 +173,13 @@ LArDigits2Ntuple.ContainerKey = Gain
 LArDigits2Ntuple.AddFEBTempInfo=False
 if 'FTlist' in dir():
    LArDigits2Ntuple.FTlist=FTlist
+if SuperCells:
+   #from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg
+   #topSequence+=xAODMaker__EventInfoCnvAlg()
+   LArDigits2Ntuple.isSC = True
+   LArDigits2Ntuple.RealGeometry = True
+   LArDigits2Ntuple.OffId = True
+   LArDigits2Ntuple.FillBCID = True
 
 topSequence+= LArDigits2Ntuple
 
@@ -112,7 +187,7 @@ topSequence+= LArDigits2Ntuple
 theApp.HistogramPersistency = "ROOT"
 from GaudiSvc.GaudiSvcConf import NTupleSvc
 svcMgr += NTupleSvc()
-svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputRootFileName+"' OPT='NEW'" ]
+svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputDir + "/" +OutputRootFileName+"' OPT='NEW'" ]
 
 AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
 AthenaEventLoopMgr.OutputLevel=ERROR
diff --git a/LArCalorimeter/LArCalibTools/src/LArCond2NtupleBase.cxx b/LArCalorimeter/LArCalibTools/src/LArCond2NtupleBase.cxx
index 4be41544d68d..01ec90992ecc 100644
--- a/LArCalorimeter/LArCalibTools/src/LArCond2NtupleBase.cxx
+++ b/LArCalorimeter/LArCalibTools/src/LArCond2NtupleBase.cxx
@@ -9,6 +9,8 @@
 #include "CaloIdentifier/CaloCell_ID.h"
 #include "CaloIdentifier/CaloCell_SuperCell_ID.h"
 #include "CaloIdentifier/CaloIdManager.h"
+#include "CaloDetDescr/CaloDetDescrManager.h"
+#include "CaloDetDescr/CaloDetDescrElement.h"
 
 LArCond2NtupleBase::LArCond2NtupleBase(const std::string& name, ISvcLocator* pSvcLocator): 
   AthAlgorithm(name, pSvcLocator), m_initialized(false), m_nt(NULL),  
@@ -21,6 +23,7 @@ LArCond2NtupleBase::LArCond2NtupleBase(const std::string& name, ISvcLocator* pSv
   declareProperty("isFlat", m_isFlat=false);
   declareProperty("OffId", m_OffId=false);
   declareProperty("AddHash",m_addHash=true);
+  declareProperty("RealGeometry",m_realgeom=false);
 }
 
 LArCond2NtupleBase::~LArCond2NtupleBase() {
@@ -79,6 +82,17 @@ StatusCode LArCond2NtupleBase::initialize() {
       ATH_MSG_DEBUG("Found the LArOnlineID helper");
     }
     m_caloId = calo_id_manager->getCaloCell_SuperCell_ID();
+    if(m_realgeom) {
+      const CaloSuperCellDetDescrManager* cddm=nullptr;
+      sc = detStore()->retrieve(cddm);
+      if ((!cddm) || sc.isFailure()) {
+         ATH_MSG_ERROR( "Could not get CaloSuperCellDetDescrManager !" );
+         return StatusCode::FAILURE;
+      } else {
+         m_dd_man = (const CaloDetDescrManager_Base*) cddm;
+         ATH_MSG_DEBUG("Found the CaloSuperCellDetDescrManager !" << m_dd_man);
+      }
+    }
   } else { // m_isSC
     const LArOnlineID* ll;
     sc = detStore()->retrieve(ll, "LArOnlineID");
@@ -90,6 +104,17 @@ StatusCode LArCond2NtupleBase::initialize() {
       ATH_MSG_DEBUG(" Found the LArOnlineID helper. ");
     }
     m_caloId = calo_id_manager->getCaloCell_ID();
+    if(m_realgeom) {
+      const CaloDetDescrManager* cddm=nullptr;
+      sc = detStore()->retrieve(cddm);
+      if ((!cddm) || sc.isFailure()) {
+         ATH_MSG_ERROR( "Could not get CaloDetDescrManager !" );
+         return StatusCode::FAILURE;
+      } else {
+         m_dd_man = (const CaloDetDescrManager_Base*) cddm;
+         ATH_MSG_DEBUG("Found the CaloDetDescrManager !" << m_dd_man );
+      }
+    }
   } // end of m_isSC if
 
   m_emId=m_caloId->em_idHelper();
@@ -130,15 +155,6 @@ StatusCode LArCond2NtupleBase::initialize() {
     return StatusCode::FAILURE;
   }
 
-  //Offline-identifier variables
-  if ( m_OffId ) {
-    sc=nt->addItem("offlineId",m_oflChanId,0x20000000,0x40000000);
-    if (sc!=StatusCode::SUCCESS) {
-      ATH_MSG_ERROR( "addItem 'channelId' failed" );
-      return StatusCode::FAILURE;
-    }
-  }
-
   sc=nt->addItem("barrel_ec",m_barrel_ec,0,1);
   if (sc!=StatusCode::SUCCESS) {
     ATH_MSG_ERROR( "addItem 'barrel_ec' failed" );
@@ -206,32 +222,59 @@ StatusCode LArCond2NtupleBase::initialize() {
   }//end-if addHash
 
 
-  //Offline-ID related variables
-  sc=nt->addItem("layer",m_layer,0,4);
-  if (sc!=StatusCode::SUCCESS) {
-    ATH_MSG_ERROR( "addItem 'layer' failed" );
-    return StatusCode::FAILURE;
-   }
-  sc=nt->addItem("ieta",m_eta,0,510);
-  if (sc!=StatusCode::SUCCESS) {
-   ATH_MSG_ERROR( "addItem 'ieta' failed" );
-   return StatusCode::FAILURE;
-  }
-  sc=nt->addItem("iphi",m_phi,0,1023);
-  if (sc!=StatusCode::SUCCESS) {
-    ATH_MSG_ERROR( "addItem 'iphi' failed" );
-    return StatusCode::FAILURE;
-  }
-  sc=nt->addItem("region",m_region,0,5);
-  if (sc!=StatusCode::SUCCESS) {
-    ATH_MSG_ERROR( "addItem 'region' failed" );
-    return StatusCode::FAILURE;
-  }
-  sc=nt->addItem("detector",m_detector,0,2);
-  if (sc!=StatusCode::SUCCESS) {
-    ATH_MSG_ERROR( "addItem 'detector' failed" );
-    return StatusCode::FAILURE;
-  }
+  //Offline-identifier variables
+  if ( m_OffId ) {
+    sc=nt->addItem("offlineId",m_oflChanId,0x20000000,0x40000000);
+    if (sc!=StatusCode::SUCCESS) {
+      ATH_MSG_ERROR( "addItem 'channelId' failed" );
+      return StatusCode::FAILURE;
+    }
+
+    sc=nt->addItem("layer",m_layer,0,4);
+    if (sc!=StatusCode::SUCCESS) {
+      ATH_MSG_ERROR( "addItem 'layer' failed" );
+      return StatusCode::FAILURE;
+     }
+
+    if(m_realgeom) {
+      sc=nt->addItem("eta",m_reta);
+      if (sc!=StatusCode::SUCCESS) {
+       ATH_MSG_ERROR( "addItem 'eta' failed" );
+       return StatusCode::FAILURE;
+      }
+      sc=nt->addItem("phi",m_rphi);
+      if (sc!=StatusCode::SUCCESS) {
+        ATH_MSG_ERROR( "addItem 'phi' failed" );
+        return StatusCode::FAILURE;
+      }
+    } else {  
+      sc=nt->addItem("ieta",m_eta,0,510);
+      if (sc!=StatusCode::SUCCESS) {
+       ATH_MSG_ERROR( "addItem 'ieta' failed" );
+       return StatusCode::FAILURE;
+      }
+      sc=nt->addItem("iphi",m_phi,0,1023);
+      if (sc!=StatusCode::SUCCESS) {
+        ATH_MSG_ERROR( "addItem 'iphi' failed" );
+        return StatusCode::FAILURE;
+      }
+      sc=nt->addItem("layer",m_layer,0,4);
+      if (sc!=StatusCode::SUCCESS) {
+        ATH_MSG_ERROR( "addItem 'layer' failed" );
+        return StatusCode::FAILURE;
+      }
+      sc=nt->addItem("region",m_region,0,5);
+      if (sc!=StatusCode::SUCCESS) {
+        ATH_MSG_ERROR( "addItem 'region' failed" );
+        return StatusCode::FAILURE;
+      }
+      sc=nt->addItem("detector",m_detector,0,2);
+      if (sc!=StatusCode::SUCCESS) {
+        ATH_MSG_ERROR( "addItem 'detector' failed" );
+        return StatusCode::FAILURE;
+      }
+    }
+  } // m_OffId
 
   if (m_addBC) {
     sc=nt->addItem("badChan",m_badChanWord);
@@ -260,6 +303,7 @@ StatusCode LArCond2NtupleBase::initialize() {
 
 bool LArCond2NtupleBase::fillFromIdentifier(const HWIdentifier& hwid) {
 
+ ATH_MSG_DEBUG("Starting.....");
  SG::ReadCondHandle<LArBadChannelCont> readHandle{m_BCKey};
  const LArBadChannelCont *bcCont {*readHandle};
  if(m_addBC && !bcCont) {
@@ -279,6 +323,7 @@ bool LArCond2NtupleBase::fillFromIdentifier(const HWIdentifier& hwid) {
      return false;
  }
 
+ ATH_MSG_DEBUG("Starting 1.....");
  m_onlChanId = hwid.get_identifier32().get_compact();
  
  m_barrel_ec = m_onlineId->barrel_ec(hwid);
@@ -297,13 +342,21 @@ bool LArCond2NtupleBase::fillFromIdentifier(const HWIdentifier& hwid) {
  if(calibLineV.size()) m_calibLine = m_onlineId->channel(calibLineV[0]);
  
 
- m_detector=NOT_VALID; 
- m_region=NOT_VALID;
- m_layer=NOT_VALID;
- m_eta=NOT_VALID;
- m_phi=NOT_VALID;
- //m_oflChanId=NOT_VALID;
- //m_oflHash=NOT_VALID;
+ if ( m_OffId ) {
+  if(!m_realgeom) {
+   m_detector=NOT_VALID; 
+   m_region=NOT_VALID;
+   m_eta=NOT_VALID;
+   m_phi=NOT_VALID;
+  } else {
+   ATH_MSG_DEBUG(&m_reta << " " << &m_rphi << " " << &m_layer);
+   m_reta=NOT_VALID;
+   m_rphi=NOT_VALID;
+  } 
+  m_layer=NOT_VALID;
+  m_oflChanId=NOT_VALID;
+  if (m_addHash) m_oflHash=NOT_VALID;
+ }
  if (m_addBC) m_badChanWord=0;
  bool connected=false;
 
@@ -312,32 +365,51 @@ bool LArCond2NtupleBase::fillFromIdentifier(const HWIdentifier& hwid) {
      Identifier id=cabling->cnvToIdentifier(hwid);
      if ( m_OffId ) {
        m_oflChanId = id.get_identifier32().get_compact();
-       if (m_addHash) 
-	 m_oflHash=m_caloId->calo_cell_hash(id);
-     }
-   
-     if (m_emId->is_lar_em(id)) {
-       m_eta       = m_emId->eta(id);
-       m_phi       = m_emId->phi(id);
-       m_layer     = m_emId->sampling(id);
-       m_region    = m_emId->region(id);
-       m_detector  = std::abs(m_emId->barrel_ec(id)) - 1; //0-barrel, 1-EMEC-OW, 2-EMEC-IW
-     }
-     else if (m_hecId->is_lar_hec(id)) {
-       m_eta       = m_hecId->eta(id);
-       m_phi       = m_hecId->phi(id);
-       m_layer     = m_hecId->sampling(id);
-       m_region    = m_hecId->region(id);
-       m_detector  = 3;
-     }
-     else if (m_fcalId->is_lar_fcal(id)) {
-       m_eta       = m_fcalId->eta(id);
-       m_phi       = m_fcalId->phi(id);
-       m_layer     = m_fcalId->module(id);
-       m_region    = 0;
-       m_detector  = 4;
-     }
-     connected=true;
+       if (m_addHash) m_oflHash=m_caloId->calo_cell_hash(id);
+
+       if (m_realgeom) {
+          const CaloDetDescrElement *elem = m_dd_man->get_element(id);
+          if(!elem) {
+             ATH_MSG_WARNING("Do not have CDDE for "<<id.getString());
+          } else {
+            m_reta = elem->eta_raw();
+            m_rphi = elem->phi_raw();
+          }  
+          if (m_emId->is_lar_em(id)) {
+            m_layer     = m_emId->sampling(id);
+          }
+          else if (m_hecId->is_lar_hec(id)) {
+            m_layer     = m_hecId->sampling(id);
+          }
+          else if (m_fcalId->is_lar_fcal(id)) {
+            m_layer     = m_fcalId->module(id);
+          }
+       } else {
+      
+          if (m_emId->is_lar_em(id)) {
+            m_eta       = m_emId->eta(id);
+            m_phi       = m_emId->phi(id);
+            m_layer     = m_emId->sampling(id);
+            m_region    = m_emId->region(id);
+            m_detector  = std::abs(m_emId->barrel_ec(id)) - 1; //0-barrel, 1-EMEC-OW, 2-EMEC-IW
+          }
+          else if (m_hecId->is_lar_hec(id)) {
+            m_eta       = m_hecId->eta(id);
+            m_phi       = m_hecId->phi(id);
+            m_layer     = m_hecId->sampling(id);
+            m_region    = m_hecId->region(id);
+            m_detector  = 3;
+          }
+          else if (m_fcalId->is_lar_fcal(id)) {
+            m_eta       = m_fcalId->eta(id);
+            m_phi       = m_fcalId->phi(id);
+            m_layer     = m_fcalId->module(id);
+            m_region    = 0;
+            m_detector  = 4;
+          }
+          connected=true;
+       }
+     } // m_OffId
    }//end if is connected
  }catch (LArID_Exception & except) {}
 
diff --git a/LArCalorimeter/LArCalibTools/src/LArDigits2Ntuple.cxx b/LArCalorimeter/LArCalibTools/src/LArDigits2Ntuple.cxx
index 515277ade2ad..b2570ab5940a 100644
--- a/LArCalorimeter/LArCalibTools/src/LArDigits2Ntuple.cxx
+++ b/LArCalorimeter/LArCalibTools/src/LArDigits2Ntuple.cxx
@@ -12,11 +12,12 @@
 LArDigits2Ntuple::LArDigits2Ntuple(const std::string& name, ISvcLocator* pSvcLocator):
   LArCond2NtupleBase(name, pSvcLocator),
   m_ipass(0),
-  m_event(0), m_FTlist(0)
+  m_event(0), m_FTlist(0), m_fillBCID(false)
 {
   declareProperty("ContainerKey",m_contKey);
   declareProperty("NSamples",m_Nsamples=32);
   declareProperty("FTlist",m_FTlist);
+  declareProperty("FillBCID",m_fillBCID);
   m_ntTitle="LArDigits";
   m_ntpath="/NTUPLES/FILE1/LARDIGITS"+m_contKey;
 
@@ -60,6 +61,15 @@ StatusCode LArDigits2Ntuple::initialize()
       return sc;
     }
   
+  if(m_fillBCID){
+    sc=m_nt->addItem("BCID",m_bcid);
+    if (sc!=StatusCode::SUCCESS) {
+      ATH_MSG_ERROR( "addItem 'BCID' failed" );
+      return sc;
+    }
+  }
+  
+  ATH_CHECK(m_evtInfoKey.initialize() );
 
   m_ipass = 0;
 
@@ -77,15 +87,12 @@ StatusCode LArDigits2Ntuple::execute()
   ATH_MSG_DEBUG( "in execute" ); 
 
   m_event++;
-  unsigned long thisevent;
-  const EventInfo* eventInfo;
-  if (evtStore()->retrieve(eventInfo,"ByteStreamEventInfo").isFailure()) {
-      ATH_MSG_WARNING( " Cannot access to event info " );
-      thisevent=m_event;
-  } else {
-      thisevent = eventInfo->event_ID()->event_number();
-  }
-  
+  unsigned long long thisevent;
+  unsigned long thisbcid=0;
+  SG::ReadHandle<xAOD::EventInfo> evt (m_evtInfoKey);
+  thisevent = evt->eventNumber();
+  if(m_fillBCID) thisbcid = evt->bcid();
+
   const LArDigitContainer* DigitContainer = NULL;
   sc=evtStore()->retrieve(DigitContainer,m_contKey);  
   if (sc!=StatusCode::SUCCESS) {
@@ -127,6 +134,8 @@ StatusCode LArDigits2Ntuple::execute()
      }
 
      m_IEvent=thisevent;
+     if(m_fillBCID) m_bcid = thisbcid;
+
      fillFromIdentifier((*it)->hardwareID());      
      if(m_FTlist.size() > 0) { // should do a selection
         if(std::find(std::begin(m_FTlist), std::end(m_FTlist), m_FT) == std::end(m_FTlist)) { // is our FT in list ?
diff --git a/LArCalorimeter/LArCalibTools/src/LArPulseShape.cxx b/LArCalorimeter/LArCalibTools/src/LArPulseShape.cxx
index 3ff82ab05f1c..11a3631a0738 100644
--- a/LArCalorimeter/LArCalibTools/src/LArPulseShape.cxx
+++ b/LArCalorimeter/LArCalibTools/src/LArPulseShape.cxx
@@ -11,6 +11,7 @@
 #include "LArRawEvent/LArDigitContainer.h"
 #include "LArCOOLConditions/LArDSPConfig.h"
 #include "CaloIdentifier/CaloGain.h"
+#include "TrigDecisionTool/TrigDecisionTool.h"
 #include "TFile.h"
 #include "TKey.h"
 #include "TTree.h"
diff --git a/LArCalorimeter/LArCalibUtils/src/LArCaliWaveBuilder.cxx b/LArCalorimeter/LArCalibUtils/src/LArCaliWaveBuilder.cxx
index f1b05356f630..bd4d15d06b7d 100644
--- a/LArCalorimeter/LArCalibUtils/src/LArCaliWaveBuilder.cxx
+++ b/LArCalorimeter/LArCalibUtils/src/LArCaliWaveBuilder.cxx
@@ -189,7 +189,7 @@ StatusCode LArCaliWaveBuilder::executeWithAccumulatedDigits()
    
    const float delayScale = larAccumulatedCalibDigitContainer->getDelayScale();
    const float deltaDelay = 25*ns/(delayScale*m_NStep);
-   
+
    for (;it!=it_end; ++it) { // Loop over all cells
 
      if ( (!m_recAll) && (!(*it)->isPulsed()) ) {
@@ -197,6 +197,7 @@ StatusCode LArCaliWaveBuilder::executeWithAccumulatedDigits()
         continue; // Check if cell is pulsed
      }
      ATH_MSG_DEBUG( "Pulsed cell " << m_onlineID->channel_name((*it)->hardwareID()) ); 
+     ATH_MSG_DEBUG( "with " << (*it)->sampleSum().size() << " samples " << (*it)->DAC() << " DAC " << (*it)->delay() << " delay " << (*it)->isPulsed(1) << " line 1 pulsed " ); 
      HWIdentifier chid=(*it)->hardwareID();
      HWIdentifier febid=m_onlineID->feb_Id(chid);
      if (febErrSum) {
@@ -256,6 +257,7 @@ StatusCode LArCaliWaveBuilder::executeWithAccumulatedDigits()
        LArCaliWave wave(samplesum.size()*m_NStep, m_dt, dacPulsed);
        wave.setFlag( LArWave::meas );
        itm = (waveMap.insert(WaveMap::value_type(index,wave))).first;
+       ATH_MSG_DEBUG("index: "<<index<<" new wave inserted");
      }
      (*itm).second.addAccumulatedEvent((int)roundf((*it)->delay()/deltaDelay), m_NStep, 
 	                                samplesum, sample2sum, (*it)->nTriggers());
@@ -468,7 +470,6 @@ StatusCode LArCaliWaveBuilder::stop()
 
     } //end loop over m_keyList
 
-    //ATH_MSG_INFO( " Summary : Number of cells with a CaliWave  reconstructed : " << caliWaveContainer->totalNumberOfConditions()  );
     ATH_MSG_INFO( " Summary : Number of cells with a CaliWave  reconstructed : " << NCaliWave  );    
     ATH_MSG_INFO( " Summary : Number of Barrel PS cells side A or C (connected+unconnected):   3904+ 192 =  4096 " );
     ATH_MSG_INFO( " Summary : Number of Barrel    cells side A or C (connected+unconnected):  50944+2304 = 53248 " );
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py
index 2cdfac3fa703..001f622a700b 100644
--- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py
@@ -228,9 +228,10 @@ if not 'InputAutoCorrPoolDir' in dir():
    InputAutoCorrPoolDir = commands.getoutput("pwd")
 
 ## Output
-
-   
-rs=FolderTagResover()
+if 'dbname' in dir():
+   rs=FolderTagResover(dbname=dbname)
+else:
+   rs=FolderTagResover()
 if not 'PedLArCalibFolderTag' in dir():
    PedLArCalibFolderTag=rs.getFolderTagSuffix(LArCalib_Flags.LArPedestalFolder)
 
@@ -342,7 +343,8 @@ if ( ReadBadChannelFromCOOL ):
       InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
    else:
       #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=CONDBR2;"
-      InputDBConnectionBadChannel = "COOLOFL_LAR/CONDBR2"      
+      if 'InputDBConnectionBadChannel' not in dir():
+         InputDBConnectionBadChannel = "COOLOFL_LAR/CONDBR2"      
       
 ###########################################################################
 #                             OFC properties
@@ -426,8 +428,8 @@ if SuperCells:
   from LArCabling.LArCablingAccess import LArOnOffIdMappingSC,LArCalibIdMappingSC
   LArOnOffIdMappingSC()
   LArCalibIdMappingSC()
-from LArBadChannelTool.LArBadChannelAccess import LArBadChannelAccess
-LArBadChannelAccess()
+#from LArBadChannelTool.LArBadChannelAccess import LArBadChannelAccess
+#LArBadChannelAccess()
 
 #
 # Provides ByteStreamInputSvc name of the data file to process in the offline context
@@ -436,6 +438,8 @@ LArBadChannelAccess()
 ## get a handle to the default top-level algorithm sequence
 from AthenaCommon.AlgSequence import AlgSequence 
 topSequence = AlgSequence()
+from AthenaCommon.AlgSequence import AthSequencer
+condSeq = AthSequencer("AthCondSeq")
 
 ## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
 from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
@@ -496,8 +500,10 @@ if ( runAccumulator ) :
    # this is a OLD jobOptions which can maybe work but only for the barrel                        #
    # can be used as a skeleton if needed but                                                      #
    # need to be updated for the barrel and the patterns for EMEC, HEC and FCAL need to be added   #
-   if SuperCells:
-      ByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
+   ByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
+   #if SuperCells is False:
+   #   theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
+   
    include("./LArCalib_CalibrationPatterns.py")
 
 else:
@@ -538,7 +544,10 @@ from IOVDbSvc.CondDB import conddb
 PoolFileList     = []
 
 #include ("LArCalibProcessing/LArCalib_BadChanTool.py")
-
+if 'BadChannelsFolder' not in dir():
+   BadChannelsFolder="/LAR/BadChannels/BadChannels"
+if 'MissingFEBsFolder' not in dir():
+   MissingFEBsFolder="/LAR/BadChannels/MissingFEBs"
 
 if not 'InputBadChannelSQLiteFile' in dir():
    DelayOFCLog.info( "Read Bad Channels from Oracle DB")
@@ -548,17 +557,25 @@ else :
 if 'BadChannelsFolder' in dir():
  if 'BadChannelsLArCalibFolderTag' in dir() :
    BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
-   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>",className="CondAttrListCollection")
  else :
-   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>",className="CondAttrListCollection")
 
 if 'MissingFEBsFolder' in dir():
  if 'MissingFEBsLArCalibFolderTag' in dir() :
    MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
-   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>",className='AthenaAttributeList')
  else :
-   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>",className='AthenaAttributeList')
    
+from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelCondAlg, LArBadFebCondAlg
+theLArBadChannelCondAlg=LArBadChannelCondAlg(ReadKey=BadChannelsFolder)
+condSeq+=theLArBadChannelCondAlg
+
+theLArBadFebCondAlg=LArBadFebCondAlg(ReadKey=MissingFEBsFolder)
+condSeq+=theLArBadFebCondAlg
+
+
 ## define the DB Gobal Tag :
 svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB   
 try:
@@ -760,9 +777,9 @@ if doOFC:
 #                                                                        #
 ##########################################################################
 
-if not SuperCells:
-   from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg
-   topSequence+=xAODMaker__EventInfoCnvAlg()
+#if not SuperCells:
+#   from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg
+#   topSequence+=xAODMaker__EventInfoCnvAlg()
 
 if ( doLArCalibDataQuality  ) :
    from LArCalibDataQuality.LArCalibDataQualityConf import LArCaliWaveValidationAlg
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py
index cd1b27da29fe..95ebf4ee9dea 100644
--- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py
@@ -322,9 +322,9 @@ if not SuperCells:
 #ToolSvc.LArRodDecoder.FTNumPreselection  = [6]                                                   ## : [FCAL feedthrough number]
 
 theByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
-theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
 
 if not SuperCells:
+   theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
    theByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/HIGH"]
    theByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/MEDIUM"]
    theByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/LOW"]
@@ -339,15 +339,19 @@ if SuperCells:
 
 from IOVDbSvc.CondDB import conddb
 
-BadChannelsFolder="/LAR/BadChannelsOfl/BadChannels"
-MissingFEBsFolder="/LAR/BadChannelsOfl/MissingFEBs"
+if 'BadChannelsFolder' not in dir():
+   BadChannelsFolder="/LAR/BadChannelsOfl/BadChannels"
+if 'MissingFEBsFolder' not in dir():
+   MissingFEBsFolder="/LAR/BadChannelsOfl/MissingFEBs"
+
 
 if ( ReadBadChannelFromCOOL ):      
    if 'InputBadChannelSQLiteFile' in dir():
       InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
    else:
       #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=CONDBR2;"
-      InputDBConnectionBadChannel = "COOLOFL_LAR/" + conddb.dbname
+      if 'InputDBConnectionBadChannel' not in dir():
+         InputDBConnectionBadChannel = "COOLOFL_LAR/" + conddb.dbname
 
 if 'BadChannelsLArCalibFolderTag' in dir() :
    BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
@@ -371,16 +375,18 @@ condSeq+=theLArBadFebCondAlg
 
 ## This algorithm verifies that no FEBs are dropping out of the run
 ## If it finds corrupt events, it breaks the event loop and terminates the job rapidly
-include ("LArROD/LArFebErrorSummaryMaker_jobOptions.py")
-topSequence.LArFebErrorSummaryMaker.CheckAllFEB=False
-if doBadCatcher:
-   from LArCalibDataQuality.LArCalibDataQualityConf import LArBadEventCatcher
-   theLArBadEventCatcher=LArBadEventCatcher()
-   theLArBadEventCatcher.CheckAccCalibDigitCont=True
-   theLArBadEventCatcher.CheckBSErrors=True
-   theLArBadEventCatcher.KeyList=GainList
-   theLArBadEventCatcher.StopOnError=False
-   topSequence+=theLArBadEventCatcher 
+if not SuperCells:
+   include ("LArROD/LArFebErrorSummaryMaker_jobOptions.py")
+   topSequence.LArFebErrorSummaryMaker.CheckAllFEB=False
+
+   if doBadCatcher:
+      from LArCalibDataQuality.LArCalibDataQualityConf import LArBadEventCatcher
+      theLArBadEventCatcher=LArBadEventCatcher()
+      theLArBadEventCatcher.CheckAccCalibDigitCont=True
+      theLArBadEventCatcher.CheckBSErrors=True
+      theLArBadEventCatcher.KeyList=GainList
+      theLArBadEventCatcher.StopOnError=False
+      topSequence+=theLArBadEventCatcher 
 
 #######################################################
 #                                                     #
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_jobOptions.py
index 855a17320017..24ddb22d0700 100644
--- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_jobOptions.py
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_jobOptions.py
@@ -209,8 +209,10 @@ if not 'CaliOFCFolder' in dir():
    else:
       CaliOFCFolder  = LArCalib_Flags.LArOFCCaliFolderXtlk
 
-
-rs=FolderTagResover(DBConnectionCOOL)
+if 'dbname' in dir():
+   rs=FolderTagResover(dbname=dbname)
+else:
+   rs=FolderTagResover()
 if not 'LArRampFolderOutputTag' in dir():
    LArRampFolderOutputTag = rs.getFolderTagSuffix(LArCalib_Flags.LArRampFolder)
 if not 'PedLArCalibFolderTag' in dir(): 
@@ -314,6 +316,12 @@ RampLog.info( " ======================================================== " )
 #######################################################################################
 
 include ("LArConditionsCommon/LArMinimalSetup.py")
+from LArCabling.LArCablingAccess import LArOnOffIdMapping
+LArOnOffIdMapping()
+if SuperCells:
+  from LArCabling.LArCablingAccess import LArOnOffIdMappingSC,LArCalibIdMappingSC
+  LArOnOffIdMappingSC()
+  LArCalibIdMappingSC()
 
 #
 # Provides ByteStreamInputSvc name of the data file to process in the offline context
@@ -386,8 +394,10 @@ if ( runAccumulator ) :
    # can be used as a skeleton if needed but                                                     #
    # need to be updated for the barrel and the patterns for EMEC, HEC and FCAL need to be added   #
    #include("LArCalibProcessing/LArCalib_CalibrationPatterns.py")
-   if SuperCells:
-      ByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
+   ByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
+   #if SuperCells is False:
+   #   theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
+
    include("./LArCalib_CalibrationPatterns.py")
 
 else :
@@ -411,8 +421,10 @@ include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
 from IOVDbSvc.CondDB import conddb
 PoolFileList     = []
 
-BadChannelsFolder="/LAR/BadChannelsOfl/BadChannels"
-MissingFEBsFolder="/LAR/BadChannelsOfl/MissingFEBs"
+if 'BadChannelsFolder' not in dir():
+   BadChannelsFolder="/LAR/BadChannels/BadChannels"
+if 'MissingFEBsFolder' not in dir():
+   MissingFEBsFolder="/LAR/BadChannels/MissingFEBs"
 
 if not 'InputBadChannelSQLiteFile' in dir():
    RampLog.info( "Read Bad Channels from Oracle DB")
@@ -424,7 +436,8 @@ if ( ReadBadChannelFromCOOL ):
       InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
    else:
       #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=CONDBR2;"
-      InputDBConnectionBadChannel = "COOLOFL_LAR/" + conddb.dbname
+      if 'InputDBConnectionBadChannel' not in dir():
+         InputDBConnectionBadChannel = "COOLONL_LAR/" + conddb.dbname
       
 if 'BadChannelsLArCalibFolderTag' in dir() :
    BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
@@ -449,8 +462,9 @@ condSeq+=theLArBadFebCondAlg
 
 ## This algorithm verifies that no FEBs are dropping out of the run
 ## If it finds corrupt events, it breaks the event loop and terminates the job rapidly
-include ("LArROD/LArFebErrorSummaryMaker_jobOptions.py")       
-topSequence.LArFebErrorSummaryMaker.CheckAllFEB=False
+if not SuperCells:
+   include ("LArROD/LArFebErrorSummaryMaker_jobOptions.py")       
+   topSequence.LArFebErrorSummaryMaker.CheckAllFEB=False
 if CheckBadEvents:
    from LArCalibDataQuality.LArCalibDataQualityConf import LArBadEventCatcher
    theLArBadEventCatcher=LArBadEventCatcher()
@@ -537,7 +551,7 @@ if (CorrectBias or PeakOF or StripsXtalkCorr):
          RampLog.info( "Read OFC Cali from Oracle DB" )
       else :
          RampLog.info( "Read OFC Cali from SQLite file" )
-         
+
 if ( ReadPedFromCOOL ):
    if (CorrectBias or StripsXtalkCorr or PeakOF):
       PedestalFolder  = LArCalib_Flags.LArPedestalFolder
@@ -552,7 +566,6 @@ else:
       RampLog.info( "No PoolFileList found! Please list the POOL files containing Pedestal or read from COOL." )
       theApp.exit(-1)
 
-   
 if ( ReadOFCFromCOOL ):
    if PeakOF:
       if not 'CaliOFCTagSpec' in dir():
@@ -570,7 +583,6 @@ else:
          theApp.exit(-1)
 
 if ( len(PoolFileList)>0 ):
-      
    from AthenaCommon.ConfigurableDb import getConfigurable
    svcMgr += getConfigurable( "ProxyProviderSvc" )()
    svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
@@ -702,8 +714,8 @@ if ( ApplyAdHocCorrection ):
 #                                                                    #
 ######################################################################
 
-from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg
-topSequence+=xAODMaker__EventInfoCnvAlg()
+#from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg
+#topSequence+=xAODMaker__EventInfoCnvAlg()
 
 if ( doLArCalibDataQuality  ) :
    from LArCalibDataQuality.Thresholds import rampThr, rampThrFEB
-- 
GitLab