From b98fcf4020e8336965b7fe30a7a978bb46f447d6 Mon Sep 17 00:00:00 2001
From: Pavol Strizenec <Pavol.Strizenec@cern.ch>
Date: Fri, 16 May 2014 17:58:55 +0200
Subject: [PATCH] LAr elec calib. ATN fixes (LArCalibProcessing-00-04-53)

---
 .../LArCalibProcessing/cmt/requirements       |  18 +
 .../LArCalibProcessing/doc/mainpage.h         |  13 +
 .../python/LArCalibCatalogs.py                |  23 +
 .../python/TimeStampToRunLumi.py              |  28 +
 .../LArCalibProcessing/python/__init__.py     |   2 +
 .../python/extractFolderInfo.py               | 116 +++
 ...LArCalib_ApplyShapeResiduals_jobOptions.py | 139 +++
 .../share/LArCalib_AutoCorrPhys_jobOptions.py | 227 +++++
 .../share/LArCalib_BadChanTool.py             |  11 +
 .../LArCalib_CTB04_AutoCorr_jobOptions.py     |  47 +
 .../share/LArCalib_CTB04_Delay_jobOptions.py  | 291 ++++++
 .../LArCalib_CTB04_MasterWaves_jobOptions.py  | 144 +++
 .../LArCalib_CTB04_OFC_Phys_jobOptions.py     | 414 ++++++++
 .../LArCalib_CTB04_Pedestals_jobOptions.py    |  51 +
 ...rCalib_CTB04_PhysWaveShifter_jobOptions.py | 346 +++++++
 .../LArCalib_CTB04_RTMParams_jobOptions.py    | 196 ++++
 .../LArCalib_CTB04_RTMPhysWaves_jobOptions.py | 266 ++++++
 .../share/LArCalib_CTB04_Ramp_jobOptions.py   | 108 +++
 .../LArCalib_CTB04_TCMPhysWaves_jobOptions.py | 190 ++++
 .../LArCalib_CTB04_TimeTuning_jobOptions.py   | 165 ++++
 ...Calib_CTB04_WriteWFParams2DB_jobOptions.py | 121 +++
 .../LArCalib_CaliWaveMerger_jobOptions.py     | 133 +++
 .../share/LArCalib_CalibrationPatterns.py     |  62 ++
 .../share/LArCalib_DelayXtalk_jobOptions.py   | 502 ++++++++++
 .../LArCalib_Delay_OFC_Cali_jobOptions.py     | 869 +++++++++++++++++
 .../share/LArCalib_Delay_jobOptions.py        | 641 +++++++++++++
 .../LArCalib_Delay_splitter_jobOptions.py     | 714 ++++++++++++++
 .../LArCalib_DigitAccumulator_jobOptions.py   | 376 ++++++++
 ...Calib_Example_CaliWaveMerger_jobOptions.py | 112 +++
 .../share/LArCalib_Example_ConditionsMerge.py | 204 ++++
 .../LArCalib_Example_ConditionsMerge_SV.py    | 103 ++
 .../LArCalib_Example_DeltaResp_jobOptions.py  |  98 ++
 .../share/LArCalib_Example_FillOFCPhase.py    | 116 +++
 .../share/LArCalib_Example_HVCorr.py          | 194 ++++
 ...alib_Example_PhysWaveBuilder_jobOptions.py | 152 +++
 .../share/LArCalib_Example_PickOFCOnePhase.py |  68 ++
 ...ArCalib_Example_ReadLocalConditionsPool.py |  34 +
 .../share/LArCalib_Example_WavePatcher.py     | 104 +++
 .../share/LArCalib_Flags.py                   |  84 ++
 .../LArCalib_MCPileupAutoCorr_jobOptions.py   | 338 +++++++
 .../share/LArCalib_Merge.py                   | 119 +++
 .../share/LArCalib_MinimalSetup.py            |  38 +
 .../share/LArCalib_OFC_Cali_jobOptions.py     | 495 ++++++++++
 .../LArCalib_OFC_Cali_splitter_jobOptions.py  | 580 ++++++++++++
 ...LArCalib_OFC_Phys_TwoFolders_jobOptions.py | 797 ++++++++++++++++
 ...C_Phys_WithPileup_TwoFolders_jobOptions.py | 880 ++++++++++++++++++
 .../share/LArCalib_OFC_Phys_jobOptions.py     | 615 ++++++++++++
 .../share/LArCalib_Patching_jobOptions.py     | 228 +++++
 .../LArCalib_PedestalAutoCorr_jobOptions.py   | 635 +++++++++++++
 .../LArCalib_PedestalAutoCorr_testing.py      |  26 +
 ..._PhysWavePredictorAndShifter_jobOptions.py | 747 +++++++++++++++
 .../LArCalib_PhysWavePredictor_jobOptions.py  | 410 ++++++++
 .../LArCalib_PhysWaveShifter_jobOptions.py    | 315 +++++++
 .../share/LArCalib_PickOFCOnePhase.py         | 423 +++++++++
 .../LArCalib_PickOFCOnePhase_WithPileup.py    | 455 +++++++++
 .../share/LArCalib_RTMParams_jobOptions.py    | 728 +++++++++++++++
 .../share/LArCalib_Ramp_jobOptions.py         | 802 ++++++++++++++++
 .../LArCalib_Ramp_splitter_jobOptions.py      | 855 +++++++++++++++++
 .../share/LArCalib_Ramp_testing.py            |  27 +
 .../share/LArCalib_RecomputeOFCs.py           |  89 ++
 .../share/LArHVCool2Ntuple_jobOptions.py      |  80 ++
 .../share/LArTimePhysPrediction_jobOptions.py | 206 ++++
 .../share/LAr_updateHVcalib_online.sh         | 292 ++++++
 .../LArCalibProcessing/share/README           |  26 +
 .../TopOptsExample_AutoCorrPhys_jobOptions.py |  31 +
 .../share/TopOptsExample_CaliWaveMerger.py    |  11 +
 .../share/TopOptsExample_Delay.py             | 122 +++
 .../share/TopOptsExample_OFC_Cali.py          | 101 ++
 .../TopOptsExample_OFC_One_Phase_Phys.py      |  82 ++
 .../share/TopOptsExample_OFC_Phys.py          | 102 ++
 .../share/TopOptsExample_Pedestal_AutoCorr.py | 108 +++
 .../share/TopOptsExample_PhysWavePredicted.py |  80 ++
 ...OptsExample_PhysWavePredictedAndShifted.py | 130 +++
 .../share/TopOptsExample_PhysWaveShifted.py   |  77 ++
 .../TopOptsExample_RTMParamsExtraction.py     | 128 +++
 .../share/TopOptsExample_Ramp.py              | 131 +++
 .../share/UseLArExtendedSubDetGrouping.py     |  80 ++
 .../LArCalibProcessing_TestConfiguration.xml  |  25 +
 78 files changed, 18896 insertions(+)
 create mode 100755 LArCalorimeter/LArExample/LArCalibProcessing/cmt/requirements
 create mode 100755 LArCalorimeter/LArExample/LArCalibProcessing/doc/mainpage.h
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/python/LArCalibCatalogs.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/python/TimeStampToRunLumi.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/python/__init__.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/python/extractFolderInfo.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_ApplyShapeResiduals_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_AutoCorrPhys_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_BadChanTool.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_AutoCorr_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_Delay_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_MasterWaves_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_OFC_Phys_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_Pedestals_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_PhysWaveShifter_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_RTMParams_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_RTMPhysWaves_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_Ramp_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_TCMPhysWaves_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_TimeTuning_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_WriteWFParams2DB_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CaliWaveMerger_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CalibrationPatterns.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DelayXtalk_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_splitter_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DigitAccumulator_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_CaliWaveMerger_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge_SV.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_DeltaResp_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_FillOFCPhase.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_HVCorr.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_PhysWaveBuilder_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_PickOFCOnePhase.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ReadLocalConditionsPool.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_WavePatcher.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Flags.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_MCPileupAutoCorr_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Merge.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_MinimalSetup.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_splitter_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_TwoFolders_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_WithPileup_TwoFolders_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Patching_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_testing.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictorAndShifter_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictor_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWaveShifter_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase_WithPileup.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RTMParams_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_splitter_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_testing.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RecomputeOFCs.py
 create mode 100755 LArCalorimeter/LArExample/LArCalibProcessing/share/LArHVCool2Ntuple_jobOptions.py
 create mode 100755 LArCalorimeter/LArExample/LArCalibProcessing/share/LArTimePhysPrediction_jobOptions.py
 create mode 100755 LArCalorimeter/LArExample/LArCalibProcessing/share/LAr_updateHVcalib_online.sh
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/README
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_AutoCorrPhys_jobOptions.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_CaliWaveMerger.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_Delay.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_OFC_Cali.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_OFC_One_Phase_Phys.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_OFC_Phys.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_Pedestal_AutoCorr.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_PhysWavePredicted.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_PhysWavePredictedAndShifted.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_PhysWaveShifted.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_RTMParamsExtraction.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_Ramp.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/share/UseLArExtendedSubDetGrouping.py
 create mode 100644 LArCalorimeter/LArExample/LArCalibProcessing/test/LArCalibProcessing_TestConfiguration.xml

diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/cmt/requirements b/LArCalorimeter/LArExample/LArCalibProcessing/cmt/requirements
new file mode 100755
index 00000000000..77fa943cd83
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/cmt/requirements
@@ -0,0 +1,18 @@
+package LArCalibProcessing
+
+author Marco Delmastro <Marco.Delmastro@cern.ch>
+
+use AtlasPolicy         AtlasPolicy-* 
+
+private 
+use TestPolicy TestPolicy-*  
+apply_pattern validate_xml 
+public 
+
+apply_pattern declare_joboptions files=" *.py"
+apply_pattern declare_python_modules files=" *.py "
+apply_pattern declare_scripts files="LAr_updateHVcalib_online.sh"
+
+macro LArCalibProcessing_TestConfiguration "../test/LArCalibProcessing_TestConfiguration.xml"
+
+apply_pattern declare_runtime extras="../test/LArCalibProcessing_TestConfiguration.xml"
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/doc/mainpage.h b/LArCalorimeter/LArExample/LArCalibProcessing/doc/mainpage.h
new file mode 100755
index 00000000000..2ec1086b538
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/doc/mainpage.h
@@ -0,0 +1,13 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+
+@mainpage LArCalibProcessing Package
+
+This package provides jobOptions for processing LAr electronic calibration data
+
+@author Marco Delmastro <Marco.Delmastro@cern.ch>
+
+*/
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/python/LArCalibCatalogs.py b/LArCalorimeter/LArExample/LArCalibProcessing/python/LArCalibCatalogs.py
new file mode 100644
index 00000000000..b20b33ff118
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/python/LArCalibCatalogs.py
@@ -0,0 +1,23 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+#POOL file catalogs needed for LAr Electronic Calibration tasks
+
+larCalibCatalogs=[
+    "xmlcatalog_file:/afs/cern.ch/user/l/larcalib/w0/stableConds/PoolCat_stable.xml",
+    "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/poolcond/PoolCat_comcond_castor.xml",
+    ]
+
+## Fragment-Catalogs that we don't need:
+##                   "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_diskbuffer_afs.xml",
+##                   "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_cond09_data.000001.lar.COND_castor.xml",
+##                   "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_cond08_data.000001.lar.COND_castor.xml",
+##                   "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_comcond.000003.lar_conditions.recon.pool.v0000_castor.xml",
+##                   "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_comcond.000004.lar_conditions.recon.pool.v0000_castor.xml",
+##                   "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_comcond.000005.lar_conditions.recon.pool.v0000_castor.xml",
+##                   "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_comcond.000006.lar_conditions.recon.pool.v0000_castor.xml"
+##                   ]
+
+## Catalogs that are set up anyway:
+## "prfile:poolcond/PoolCat_oflcond.xml",
+## "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/poolcond/PoolCat_comcond.xml",
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/python/TimeStampToRunLumi.py b/LArCalorimeter/LArExample/LArCalibProcessing/python/TimeStampToRunLumi.py
new file mode 100644
index 00000000000..e2ab3db9218
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/python/TimeStampToRunLumi.py
@@ -0,0 +1,28 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+def TimeStampToRunLumi(tmstmp,guard=1):
+    from PyCool import cool
+    from time import asctime,localtime
+    dbSvc = cool.DatabaseSvcFactory.databaseService()
+    db=dbSvc.openDatabase("COOLONL_TRIGGER/COMP200")
+    folder=db.getFolder("/TRIGGER/LUMI/LBTIME")
+    range=guard*24*60*60*1e9 # 2 days in ns
+    t1=long(tmstmp-range)
+    t2=long(tmstmp+range)
+    itr=folder.browseObjects(t1,t2,cool.ChannelSelection.all())
+    while itr.goToNext():
+        obj=itr.currentRef()
+        #print "Working on obj.until() =",asctime(localtime(obj.until()/1e9)) 
+        if obj.until()>tmstmp:
+            pl=obj.payload()
+            run=pl["Run"]
+            lb=pl["LumiBlock"]
+            print "Found Run/Lumi [%i/%i] lasting from %s to %s" %\
+                  (run,lb,asctime(localtime(obj.since()/1e9)),asctime(localtime(obj.until()/1e9)))
+            itr.close()
+            db.closeDatabase()
+            return (run,lb)
+    print "WARNING: No run/lumi block found for time",asctime(localtime(tmstmp/1e9)),"in folder /TRIGGER/LUMI/LBTIME of DB COOLONL_TRIGGER/COMP200"
+    itr.close()
+    db.closeDatabase()
+    return None
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/python/__init__.py b/LArCalorimeter/LArExample/LArCalibProcessing/python/__init__.py
new file mode 100644
index 00000000000..74583d364ec
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/python/__init__.py
@@ -0,0 +1,2 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/python/extractFolderInfo.py b/LArCalorimeter/LArExample/LArCalibProcessing/python/extractFolderInfo.py
new file mode 100644
index 00000000000..82de52092e6
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/python/extractFolderInfo.py
@@ -0,0 +1,116 @@
+#!/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+from PyCool import cool
+
+
+def extractFolderInfo(dbname,globaltag="",checkFolders=[],runnumber=cool.ValidityKeyMax>>32,selection=""):
+    dbSvc = cool.DatabaseSvcFactory.databaseService()
+    try:
+        db= dbSvc.openDatabase(dbname)
+    except Exception,e:
+        print "Problems connecting to database:",e
+        return None
+
+    #Set up Channel Selection:
+    sel=None
+    print selection
+    ss=selection.split(",")
+    for s in ss:
+        if len(s)==0:continue
+        idx=s.find(":");
+        if idx==-1:
+            c1=cool.ChannelId(int(s))
+            c2=c1
+        else:
+            c1=cool.ChannelId(int(s[:idx]))
+            c2=cool.ChannelId(int(s[1+idx:]))
+        print "ExtractFolderInfo: Add channel range",c1,"to",c2
+        if sel is None:
+            if sel is None:
+                sel=cool.ChannelSelection(c1,c2,cool.ChannelSelection.sinceBeforeChannel);
+            else:
+                sel.addRange(c1,c2);
+                               
+    if sel is None:
+        print "ExtractFolderInfo: No COOL channel selection given, work on all channels"
+        sel=cool.ChannelSelection.all()
+        
+        
+    folderInfoList=list()
+
+    nodelist=db.listAllNodes()
+    for fn in nodelist:
+        if not db.existsFolder(fn): continue
+        if len(checkFolders):
+            takeFolder=False
+            for cf in checkFolders:
+                if cf[-1] is "/": cf=cf[0:-1]
+                idx=len(cf)
+                if fn.startswith(cf) and (idx>=len(fn) or fn[idx]=="/"):
+                    takeFolder=True
+                    break                 
+            if not takeFolder: continue
+            
+        f=db.getFolder(fn)
+        print "Analyzing",fn
+        #Parse Folder description:
+        #Model:
+        #<timeStamp>run-lumi</timeStamp><symlinks>ILArAutoCorr</symlinks><key>LArAutoCorr</key><addrHeader><address_header service_type="71" clid="255786016" /></addrHeader><typeName>LArAutoCorrComplete</typeName>  -
+        # Get Type
+        descr=f.description()
+        i1=descr.find("<typeName>")+len("<typeName>")
+        i2=descr.find("</typeName>",i1)
+        if (i1==-1 or i2==-1):
+            print "ERROR could not get typename of object stored in folder",fn
+            continue
+        typename=descr[i1:i2]
+
+        
+        i1=descr.find("<key>")+len("<key>")
+        i2=descr.find("</key>",i1)
+        if (i1==-1 or i2==-1):
+            print "ERROR could not get SG key of object stored in folder",fn
+            continue
+        key=descr[i1:i2]
+
+
+        #Loop over all tags
+        
+        tagList=f.listTags()
+        if len(tagList)==0:
+            tagList=[""]
+        elif len(tagList)>1 and globaltag!="":
+            try:
+                tagList=[f.resolveTag(globaltag)]
+            except Exception:
+                print "Hierachical tag", globaltag,"not defined in folder",fn
+                return None
+
+        for t in tagList:
+            itr=f.findObjects(runnumber<<32,sel,t)
+            minIOV=cool.ValidityKeyMax>>32
+            maxIOV=cool.ValidityKeyMin>>32
+            #Loop over all objects to get IOV
+            while itr.goToNext():
+                obj=itr.currentRef()
+                #payload=obj.payload()
+                since=obj.since()>>32
+                until=obj.until()>>32
+                if minIOV>since: minIOV=since
+                if maxIOV<until: maxIOV=until
+            itr.close()
+
+            #Form tuple:
+            folderinfo=(fn,typename,key,t,minIOV,maxIOV)
+            folderInfoList+=[folderinfo]
+
+    db.closeDatabase()
+    return folderInfoList
+
+
+
+#x=extractFolderInfo("sqlite://;schema=/scratch/wlampl/DBwrites/Sep13AllCalo_v2/freshConstants.db;dbname=COMP200")
+
+#for i in x:
+#    print i
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_ApplyShapeResiduals_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_ApplyShapeResiduals_jobOptions.py
new file mode 100644
index 00000000000..3e09674f22b
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_ApplyShapeResiduals_jobOptions.py
@@ -0,0 +1,139 @@
+###########################################################################
+#
+# TopOptions to copy a complete set of conditions for a given run to 
+# one POOL file and one sqlite file
+#
+# Walter.Lampl@cern.ch
+#
+###########################################################################
+
+
+import os,sys
+from LArCalibProcessing.extractFolderInfo import *
+
+if 'dbname' not in dir():
+  dbname="COMP200"
+
+if 'sqliteIn' not in dir():
+  sqliteIn="freshConstants.db"
+
+if 'sqliteOut' not in dir():
+  sqliteOut=sqliteIn+".out"
+
+inputDB="sqlite://;schema="+sqliteIn+";dbname="+dbname
+outputDB="sqlite://;schema="+sqliteOut+";dbname="+dbname
+
+
+if os.environ.has_key("CALIBMERGE_PEEKRUN"):
+  peekrun=int(os.environ["CALIBMERGE_PEEKRUN"])
+else:
+  peekrun=2147483647
+
+print "Peeking input database at run",peekrun
+
+if not "ShapeFolder" in dir():
+  ShapeFolder="/LAR/ElecCalibOfl/Shape/RTM/5samples1phase"
+
+if not 'ShapeResidualsFolder' in dir() :
+  ShapeResidualsFolder  =  "/LAR/ElecCalibOfl/Shape/Residuals/5samples"
+
+
+if 'ShapeResidualsTag' in dir() :
+  shapeResidualTag="<tag>"+ShapeResidualsTag+"</tag>"
+else:
+  shapeResidualTag=""
+
+folderInfo=extractFolderInfo(inputDB,checkFolders=[ShapeFolder,],runnumber=peekrun)
+print folderInfo
+
+import AthenaCommon.AtlasUnixGeneratorJob #use MC event selector
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+
+theApp.EvtMax = 1
+conddb.setGlobalTag("LARCALIB-000-02") #For id mapping and wave residuals
+
+svcMgr.PoolSvc.CheckDictionary=True
+svcMgr.PoolSvc.SortReplicas=False
+svcMgr.PoolSvc.FileOpen="update"
+
+runNoForFileName=2147483647
+
+if len(folderInfo)==0:
+  print "ERROR, No input shape found in input db",inputDB,"folder",ShapeFolder
+  sys.exit(-1)
+  pass
+
+if len(folderInfo)>1:
+  print "WARNING, More than one input shape object found in input db",inputDB,"folder",ShapeFolder
+  pass
+
+f=folderInfo[0]
+fn=f[0]
+type=f[1]
+key=f[2]
+tag=f[3]
+since=f[4]
+until=f[5]
+print "Working on folder",fn,"IOV:",since,"-",until
+
+tagTokens=tag.split('-')
+tagTokens[0]+="corr"
+outTag="-".join(tagTokens)
+
+if since>0 and since<runNoForFileName:
+  runNoForFileName=since
+  pass
+
+IOVBegin=since
+
+outObjects=["#".join((type,key,fn)),]
+outTags=[outTag,]
+conddb.addFolder("",fn+"<tag>"+tag+"</tag><db>"+inputDB+"</db><key>"+key+"In</key>")
+
+svcMgr.EventSelector.RunNumber = peekrun
+
+if "OutputFile" not in dir():
+  OutputFile="LArConditionsRec_"+str(runNoForFileName)+".pool.root"
+
+print outObjects
+print outTags
+
+from LArCalibTools.LArCalibToolsConf import LArBlockCorrections
+topSequence+=LArBlockCorrections()
+
+from LArCalibUtils.LArCalibUtilsConf import LArShapeCorrector
+theLArShapeCorrector=LArShapeCorrector(KeyShape=key+"In",KeyShape_newcorr=key,OutputLevel=DEBUG)
+topSequence+=theLArShapeCorrector
+
+conddb.addFolder("LAR_OFL",ShapeResidualsFolder+shapeResidualTag)
+
+
+from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+
+theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlgCorr",OutputFile,
+                                           outObjects,outTags,True)
+
+theOutputConditionsAlg.Run1 = IOVBegin
+
+svcMgr.IOVDbSvc.dbConnection  = outputDB
+from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+svcMgr += IOVRegistrationSvc()
+svcMgr.IOVRegistrationSvc.RecreateFolders = False
+svcMgr.IOVRegistrationSvc.OutputLevel=DEBUG
+svcMgr.DetectorStore.Dump=True
+
+
+if 'poolcat' in dir():
+  svcMgr.PoolSvc.WriteCatalog="xmlcatalog_file:"+poolcat
+
+
+svcMgr.IOVDbSvc.DBInstance=""
+#svcMgr.IOVDbSvc.OutputLevel=DEBUG
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_AutoCorrPhys_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_AutoCorrPhys_jobOptions.py
new file mode 100644
index 00000000000..114912a0de2
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_AutoCorrPhys_jobOptions.py
@@ -0,0 +1,227 @@
+#Job Opts to compute AutoCorrelation based on a zero-bias physics run. 
+
+from AthenaCommon.AthenaCommonFlags  import athenaCommonFlags
+athenaCommonFlags.FilesInput=["data11_7TeV.00190256.physics_ZeroBias.merge.RAW._lb0340._SFO-ALL._0001.1","data11_7TeV.00190256.physics_ZeroBias.merge.RAW._lb0341._SFO-ALL._0001.1",]
+
+
+if not 'RunNumberList' in dir():
+   from RecExConfig.InputFilePeeker import inputFileSummary
+   RunNumberList=inputFileSummary['run_number']
+
+#LArCalibFolderOutputTag="-UPD3-00"
+
+if not 'EventsRef' in dir():
+   EventsRef     = 10    
+   
+if not 'NSigma' in dir():
+   NSigma = 5
+
+if not 'NSamples' in dir():
+   NSamples = 7   
+   
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = min(RunNumberList)
+   
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd
+
+if not 'LArCalibFolderOutputTag' in dir():
+   LArCalibFolderOutputTag = "-UPD3-00"
+
+if not 'LArAutoCorrPhysFolder' in dir():
+   LArAutoCorrPhysFolder = "/LAR/ElecCalibOfl/AutoCorrPhys"
+
+if not 'LArAutoCorrPhysKey' in dir():
+   LArAutoCorrPhysKey = "LArAutoCorr"
+
+if not 'OutputAutoCorrRootFileDir' in dir():
+   OutputAutoCorrRootFileDir  = "."
+   
+if not 'OutputAutoCorrPoolFileDir' in dir():
+   OutputAutoCorrPoolFileDir  = "."
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)   
+
+if not 'KeyOutputAC' in dir():  
+   KeyOutputAC      = "LArAutoCorr" 
+
+if not 'BaseFileNameAutoCorr' in dir():
+   BaseFileNameAutoCorr = "LArAutoCorr"
+
+for RunNumber in RunNumberList:
+   BaseFileNameAutoCorr = BaseFileNameAutoCorr + "_" + str(RunNumber)
+
+if not 'OutputAutoCorrPoolFileName' in dir():
+   OutputAutoCorrPoolFileName  = BaseFileNameAutoCorr + ".pool.root"
+
+if not 'OutputAutoCorrRootFileName' in dir():
+   OutputAutoCorrRootFileName  = BaseFileNameAutoCorr + ".root"
+
+
+if not 'OutputSQLiteFile' in dir():
+   OutputSQLiteFile = BaseFileNameAutoCorr +".db"
+   
+OutputDB="sqlite://;schema="+OutputSQLiteFile+";dbname=COMP200"
+
+# FIXME : fix name and folder and tag
+if not 'OutputObjectSpecAutoCorr' in dir():
+   OutputObjectSpecAutoCorr = "LArAutoCorrComplete#"+LArAutoCorrPhysKey+"#"+LArAutoCorrPhysFolder
+   OutputTagSpecAutoCorr=LArCalibFolderTag(LArAutoCorrPhysFolder,LArCalibFolderOutputTag)
+
+
+#######################################################################################
+# print summary
+#######################################################################################
+
+PedestalAutoCorrLog = logging.getLogger( "PedestalAutoCorrLog" )
+PedestalAutoCorrLog.info( " ======================================================== " )
+PedestalAutoCorrLog.info( " ***           LAr Pedestal/AutoCorr summary          *** " )
+PedestalAutoCorrLog.info( " ======================================================== " )
+PedestalAutoCorrLog.info( " RunNumber                         = "+str(RunNumberList) )
+#PedestalAutoCorrLog.info( " LArGain                           = "+str(GainList) )
+PedestalAutoCorrLog.info( " OutputAutoCorrPoolFullFileName    = "+OutputAutoCorrPoolFileDir + "/" + OutputAutoCorrPoolFileName )
+PedestalAutoCorrLog.info( " OutputObjectSpecAutoCorr          = "+OutputObjectSpecAutoCorr )
+PedestalAutoCorrLog.info( " OutputTagSpecAutoCorr             = "+OutputTagSpecAutoCorr )
+PedestalAutoCorrLog.info( " IOVBegin                          = "+str(IOVBegin) )
+PedestalAutoCorrLog.info( " IOVEnd                            = "+str(IOVEnd) )
+PedestalAutoCorrLog.info( " LArCalibOutputDB                  = "+OutputDB )
+PedestalAutoCorrLog.info( " ======================================================== " )
+
+#######################################################################################
+include ("LArConditionsCommon/LArMinimalSetup.py")
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = "COMCOND-ES1PST-005-04"
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+theByteStreamInputSvc=svcMgr.ByteStreamInputSvc
+theByteStreamInputSvc.FullFileName=athenaCommonFlags.FilesInput()
+
+theByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
+theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
+theByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/FREE"]
+
+
+# Get Electronics noise values for Pedestal(RMS), AutoCorr and ramps
+
+## The reference is the Oracle DB
+include("LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py")
+selection=""
+conddb.addFolder("LAR_ONL","/LAR/ElecCalibOnl/Pedestal<key>PedestalElec</key>"+selection)
+conddb.addFolder("LAR_OFL","/LAR/ElecCalibOfl/AutoCorrs/AutoCorr<key>LArAutoCorrElec</key><tag>LARElecCalibOflAutoCorrsAutoCorr-UPD3-00</tag>"+selection)
+
+from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
+cfg = TriggerConfigGetter()
+
+from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool
+
+bct=BunchCrossingTool()
+
+from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrMaker
+LArAutoCorrMaker=LArAutoCorrMaker("LArAutoCorrMaker")
+LArAutoCorrMaker.KeyList = ["FREE"]
+LArAutoCorrMaker.events_ref = EventsRef
+LArAutoCorrMaker.nsigma     = NSigma
+LArAutoCorrMaker.KeyOutput  = KeyOutputAC
+LArAutoCorrMaker.GroupingType = GroupingType
+LArAutoCorrMaker.physics      = 1
+LArAutoCorrMaker.MinBCFromFront=10
+#LArAutoCorrMaker.OutputLevel = DEBUG
+LArAutoCorrMaker.BunchCrossingTool=bct
+topSequence += LArAutoCorrMaker
+      
+# extrapolation to other gains
+from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrExtrapolate
+LArAutoCorrExtrapolate=LArAutoCorrExtrapolate("LArAutoCorrExtrapolate")
+LArAutoCorrExtrapolate.KeyOutput = LArAutoCorrPhysKey
+
+topSequence += LArAutoCorrExtrapolate
+      
+
+
+if ( WriteNtuple ) :
+   
+   Nvector = (NSamples+1)*NSamples/2 + 1
+   from LArCalibTools.LArCalibToolsConf import LArAutoCorr2Ntuple
+   LArAutoCorr2Ntuple = LArAutoCorr2Ntuple( "LArAutoCorr2Ntuple" )
+   LArAutoCorr2Ntuple.Nsamples     = Nvector
+   LArAutoCorr2Ntuple.ContainerKey = KeyOutputAC
+   LArAutoCorr2Ntuple.AddFEBTempInfo=False
+   topSequence += LArAutoCorr2Ntuple
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputAutoCorrRootFileDir + "/" + OutputAutoCorrRootFileName): 
+      os.remove(OutputAutoCorrRootFileDir + "/" + OutputAutoCorrRootFileName)
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputAutoCorrRootFileDir + "/" + OutputAutoCorrRootFileName+"' OPT='NEW'" ]
+
+
+if ( WritePoolFile ) :
+
+        from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+        
+        if os.path.exists(OutputAutoCorrPoolFileDir + "/" + OutputAutoCorrPoolFileName): 
+           os.remove(OutputAutoCorrPoolFileDir + "/" + OutputAutoCorrPoolFileName)
+        OutputConditionsAlgAC=OutputConditionsAlg("OutputConditionsAlgAC",OutputAutoCorrPoolFileDir + "/" + OutputAutoCorrPoolFileName,
+                                                      [OutputObjectSpecAutoCorr],[OutputTagSpecAutoCorr],WriteIOV)
+        OutputConditionsAlgAC.Run1     = IOVBegin                                       
+        if IOVEnd>0:
+           OutputConditionsAlgAC.Run2=IOVEnd
+           
+        svcMgr.IOVDbSvc.dbConnection  = OutputDB
+        
+        from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+        svcMgr += IOVRegistrationSvc()
+        svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+        svcMgr.IOVRegistrationSvc.RecreateFolders = False
+        
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = INFO
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = INFO)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = WARNING)
+theApp.AuditAlgorithms=True
+theAuditorSvc += getConfigurable("ChronoAuditor")(OutputLevel = WARNING)
+theAuditorSvc += getConfigurable("NameAuditor")(OutputLevel = WARNING)
+svcMgr.ChronoStatSvc.OutputLevel  = INFO
+
+if ( WriteNtuple ) :
+    LArAutoCorr2Ntuple.OutputLevel = DEBUG
+
+svcMgr.PoolSvc.ReadCatalog+=['xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/poolcond/PoolCat_comcond_castor.xml']
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_BadChanTool.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_BadChanTool.py
new file mode 100644
index 00000000000..db0c5692fb0
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_BadChanTool.py
@@ -0,0 +1,11 @@
+BadChannelsFolder="/LAR/BadChannelsOfl/BadChannels"
+MissingFEBsFolder="/LAR/BadChannelsOfl/MissingFEBs"
+
+from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
+    
+theLArBadChanTool= LArBadChanTool(CoolFolder=BadChannelsFolder,
+                                  CoolMissingFEBsFolder=MissingFEBsFolder,
+                                  )
+
+ToolSvc+=theLArBadChanTool
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_AutoCorr_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_AutoCorr_jobOptions.py
new file mode 100644
index 00000000000..e1c31851b6c
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_AutoCorr_jobOptions.py
@@ -0,0 +1,47 @@
+theApp.setup( NO_EVSEL )
+
+include( "LArDetMgrDetDescrCnv/LArDetMgrDetDescrCnv_joboptions.py" )
+
+#--------------------------------------------------------------
+# Application manager options
+#--------------------------------------------------------------
+theApp.Dlls += ["LArCalibUtils","LArBookkeeping","LArTBCnv","HbookCnv" ]
+theApp.TopAlg += ["LArAutoCorrMaker/AutoCorr","LArAutoCorr2Ntuple"]
+Applicationmgr = Service( "Applicationmgr" )
+Applicationmgr.ExtSvc += [ "LArTBCnvSvc","LArTBEventSelector/EventSelector" ]
+theApp.EvtSel = "EventSelector"
+# Number of events to be processed  : default is 10 
+theApp.EvtMax = 100
+#--------------------------------------------------------------
+# Persistency services
+#--------------------------------------------------------------0
+EventPersistencySvc.CnvServices     += [ "LArTBCnvSvc" ]; 
+StoreGateSvc = Service( "StoreGateSvc" )
+StoreGateSvc.dump=TRUE
+#--------------------------------------------------------------
+# Message services options
+#--------------------------------------------------------------
+# Output levelt threshold : default is INFO
+# 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL
+MessageSvc.OutputLevel      = 3
+#--------------------------------------------------------------
+# Event Selector options
+#--------------------------------------------------------------
+EventSelector.InputFiles=["/afs/cern.ch/user/m/maharrou/public/emtb/data/RUN217744.dat" ]
+#--------------------------------------------------------------
+# Properties for LArAutoCorr*
+#--------------------------------------------------------------
+AutoCorr = Algorithm( "AutoCorr" )
+AutoCorr.events_ref = 50
+AutoCorr.nsigma =5
+LArAutoCorr2Ntuple = Algorithm( "LArAutoCorr2Ntuple" )
+LArAutoCorr2Ntuple.Nsamples= 7
+LArAutoCorr2Ntuple.ObjectKey= "AutoCorr"
+theApp.HistogramPersistency="HBOOK"
+NTupleSvc = Service( "NTupleSvc" )
+NTupleSvc.Output  = [ "FILE1 DATAFILE='autocorr.ntp' OPT='NEW'"]
+# To output ROOT file
+#ApplicationMgr.DLLs += { "RootHistCnv" };
+#HistogramPersistencySvc.OutputFile  = "";
+#ApplicationMgr.HistogramPersistency="ROOT";
+#NTupleSvc.Output  = { "FILE1 DATAFILE='autocorr.root' OPT='NEW'"};
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_Delay_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_Delay_jobOptions.py
new file mode 100644
index 00000000000..fc58c32d8a5
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_Delay_jobOptions.py
@@ -0,0 +1,291 @@
+###########################################################################
+#
+# Example jobOptions to reconstruction a CTB2004 delay run
+#
+# Last update: 23/11/2006 (Marco.Delmastro@cern.ch)
+#
+###########################################################################
+
+RunNumber = 3144 # HIGH (small run, 1 pattern, Strips)
+
+#RunNumber = 3317 # HIGH
+#RunNumber = 3375 # MEDIUM
+#RunNumber = 3533 # LOW
+
+###########################################################################
+
+#theApp.EvtMax = 100
+
+###########################################################################
+
+#Tag = "ExternalAveraging"
+#RunAccumulator       = True
+#UseAccumulatedDigits = True
+
+Tag = "InternalAveraging"
+RunAccumulator       = False
+UseAccumulatedDigits = False
+
+###########################################################################
+
+StripsXtalkCorr = False
+
+###########################################################################
+
+SubtractPed     = True
+
+WriteNtuple     = True
+WritePOOLFile   = False
+
+###########################################################################
+
+WriteNovaDB     = False
+PreviousRunToDB = 1 # 0 = overwrite ; 1 = append
+FullFolderName  = "/lar/LArElecCalibTB04/LArCaliWaves/LArCaliWaveMedium"
+
+###########################################################################
+
+# if False read pedestal from new COOL database
+ReadNovaDB = False
+
+LArCondCnvDbServer = 'atlobk02.cern.ch'
+#LArCondCnvDbServer = 'atlmysql01.cern.ch'
+
+###########################################################################
+
+# Each POOL file should have a container with unique key (to use LArCaliWaveMerger)
+KeyOut = str(RunNumber) 
+KeyOut = "LArCaliWave"
+
+Outdir          = "./"
+
+BaseName        = "LArDelay"
+BaseName        = Outdir+BaseName+"_"+str(RunNumber)
+if (StripsXtalkCorr) :
+	BaseName += "_XtalkCorr"
+else:
+	BaseName += "_Standard"
+
+if 'Tag' in dir():
+	BaseName += "_"+Tag
+
+RootFileName    = BaseName+".root"
+POOLFileName    = BaseName+".pool.root"
+
+###########################################################################
+
+RunDir         = "/castor/cern.ch/atlas/testbeam/lar/2004"
+RunPrefix      = "daq_ROS-41_LargCalib"
+
+###########################################################################
+
+IOVBeginRun    = 0
+IOVEndRun      = 2147483647 # 0x7FFFFFFF
+IOVBeginEvent  = 0
+IOVEndEvent    = 4294967295 #0xFFFFFFFF
+
+###########################################################################
+
+include("LArCondCnv/LArCondCnv_IdMapAtlas_jobOptions.py" )
+include("LArIdCnv/LArIdCnv_joboptions.py" )
+include("CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py" )
+
+from AthenaCommon.GlobalFlags import GlobalFlags
+GlobalFlags.DetGeo.set_atlas()
+GlobalFlags.Luminosity.set_zero()
+GlobalFlags.DataSource.set_data()
+GlobalFlags.InputFormat.set_bytestream()
+
+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()
+
+#
+# Bytestream converter
+#
+include( "ByteStreamCnvSvc/TBEventSelector_jobOptions.py" )
+
+theApp.Dlls += [ "LArByteStream"]
+
+ByteStreamInputSvc = Service( "ByteStreamInputSvc" )
+ByteStreamInputSvc.InputDirectory += [RunDir]
+ByteStreamInputSvc.FilePrefix     += [RunPrefix]
+ByteStreamInputSvc.RunNumber       = [RunNumber]
+
+ByteStreamAddressProviderSvc = Service( "ByteStreamAddressProviderSvc" )
+ByteStreamAddressProviderSvc.TypeNames += [ "LArCalibDigitContainer/HIGH",
+                                            "LArCalibDigitContainer/MEDIUM",
+                                            "LArCalibDigitContainer/LOW" ]
+
+#
+# Detector description (LAr only)
+#
+
+#include( "LArDetDescr/LArDetDescr_H8_joboptions.py" )
+
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DoIdChecks
+DetDescrCnvSvc.LArIDFileName = "IdDictParser/IdDictLArCalorimeter_H8_2004.xml"
+
+ToolSvc = Service( "ToolSvc" )
+ToolSvc.LArRoI_Map.Print=False
+
+#
+# Conditions DB
+#
+
+if ( ReadNovaDB ) : 
+	#
+	# Read from Nova DB
+	#
+	include( "LArCondCnv/LArCondCnv_Config_jobOptions.py" )
+	include( "LArCondCnv/LArCondCnv_IOVDbSvc_jobOptions.py" )
+
+	LArCondCnvSvc = Service( "LArCondCnvSvc" )
+
+	theApp.Dlls += [ "IOVDbSvc" ]
+	ProxyProviderSvc = Service( "ProxyProviderSvc" )
+	ProxyProviderSvc.ProviderNames += [ "IOVDbSvc" ]
+
+	IOVDbSvc.serverName = LArCondCnvDbServer
+	IOVDbSvc.DBname     = "conditions_ctb_2004";
+
+	if ( not WriteNovaDB ) :
+		IOVDbSvc.userName   = "conditions"; 
+		IOVDbSvc.userPwd    = "conditions"; 
+	else:
+		IOVDbSvc.userName   = "condwriter"; 
+		IOVDbSvc.userPwd    = "pwd4writer";
+
+	IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArCalibParams"]
+	IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArPedestal"]
+
+	#
+	# IOV (all CTB period)
+	#
+	ToolSvc = Service( "ToolSvc" )
+	ToolSvc.FillNovaIOVTool.BeginRun   = IOVBeginRun
+	ToolSvc.FillNovaIOVTool.EndRun     = IOVEndRun
+	ToolSvc.FillNovaIOVTool.BeginEvent = IOVBeginEvent
+	ToolSvc.FillNovaIOVTool.EndEvent   = IOVEndEvent
+
+else:
+	#
+	# Read from COOL DB
+	#
+	doSim = False
+	include("IOVDbSvc/IOVRecExTB.py")
+
+	# Set up db connection 
+	LArH8DBServer     = "ATLAS_COOLPROD"
+	LArH8DataBase     = "TBP130"
+	LArH8DBConnection = " <dbConnection>impl=cool;techno=oracle;schema=ATLAS_COOL_LAR;"+LArH8DBServer+":"+LArH8DataBase+":ATLAS_COOL_READER:</dbConnection> "
+	
+	include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+	LArTB04FolderTag_Calib    = "TB04-Default"
+	LArTB04FolderTag_Pedestal = "TB04-Default"
+	
+	LArH8FolderList = ["/LAR/LArElecCalibH8/LArCalibParams<tag>LArCalibParams-"+LArTB04FolderTag_Calib+"</tag>",
+	                   "/LAR/LArElecCalibH8/LArPedestal<tag>LArPedestal-"+LArTB04FolderTag_Pedestal+"</tag>"]
+	
+	for i in range(len(LArH8FolderList)):
+		LArH8FolderList[i] += LArH8DBConnection
+	
+	IOVDbSvc = Service( "IOVDbSvc" )
+	IOVDbSvc.Folders += LArH8FolderList
+
+#
+# Delay run reconstruction
+#
+if not 'RunAccumulator' in dir():
+	RunAccumulator = True
+if not 'UseAccumulatedDigits' in dir():
+	UseAccumulatedDigits = True
+if not 'StripsXtalkCorr' in dir():
+	StripsXtalkCorr = False
+
+	
+
+theApp.Dlls += ["LArRawUtils"]
+theApp.Dlls += ["LArTools"]
+theApp.Dlls += ["LArCalibUtils"]
+theApp.Dlls += ["LArRecUtils"]
+theApp.Dlls += ["LArROD"]
+
+if ( RunAccumulator ) :
+	theApp.topAlg += ["LArCalibDigitsAccumulator"]
+	LArCalibDigitsAccumulator = Algorithm("LArCalibDigitsAccumulator")
+	LArCalibDigitsAccumulator.KeyList   += [ "HIGH" , "MEDIUM" , "LOW" ]
+	### DelayScale example: in CTB 2004 240 TTCrx steps in a sampling period
+	LArCalibDigitsAccumulator.DelayScale = (25./240.)*ns
+	
+if ( StripsXtalkCorr ) :
+	theApp.topAlg += ["LArStripsCrossTalkCorrector"]
+	LArStripsCrossTalkCorrector = Algorithm("LArStripsCrossTalkCorrector")
+	LArStripsCrossTalkCorrector.KeyList += [ "HIGH" , "MEDIUM" , "LOW" ]
+	LArStripsCrossTalkCorrector.ADCsaturation = 4095
+	LArStripsCrossTalkCorrector.UseAccumulatedDigits = UseAccumulatedDigits
+	LArStripsCrossTalkCorrector.OutputLevel = VERBOSE
+
+theApp.Dlls   += ["LArCalibUtils"]
+theApp.TopAlg += ["LArCaliWaveBuilder"]
+LArCaliWaveBuilder=Algorithm("LArCaliWaveBuilder")
+
+LArCaliWaveBuilder.UseAccumulatedDigits = UseAccumulatedDigits
+LArCaliWaveBuilder.KeyList         = [ "HIGH" , "MEDIUM" , "LOW" ]
+LArCaliWaveBuilder.KeyOutput       = KeyOut
+
+if ( StripsXtalkCorr ) :
+	LArCaliWaveBuilder.ADCsaturation = 0
+else :
+	LArCaliWaveBuilder.ADCsaturation = 4095
+LArCaliWaveBuilder.SubtractPed     = SubtractPed
+LArCaliWaveBuilder.RecAllCells     = False
+
+LArCaliWaveBuilder.WriteDB         = WriteNovaDB
+LArCaliWaveBuilder.PreviousRunToDB = PreviousRunToDB
+#LArCaliWaveBuilder.FolderName      = "LArElecCalibTB04"
+LArCaliWaveBuilder.FullFolderName  = FullFolderName 
+
+if ( WriteNtuple ) :
+	theApp.Dlls += ["LArCalibTools"]
+	theApp.TopAlg += [ "LArWaves2Ntuple/LArCaliWaves2Ntuple"]
+	LArCaliWaves2Ntuple = Algorithm( "LArCaliWaves2Ntuple" )
+	LArCaliWaves2Ntuple.NtupleName  = "CALIWAVE"
+	LArCaliWaves2Ntuple.KeyList     = [ KeyOut ]
+	
+	theApp.Dlls += [ "RootHistCnv" ]
+	theApp.HistogramPersistency = "ROOT"
+	NTupleSvc = Service( "NTupleSvc" )
+	NTupleSvc.Output = [ "FILE1 DATAFILE='"+RootFileName+"' OPT='NEW'" ]
+
+if ( WritePOOLFile ) :
+        include( "AthenaSealSvc/AthenaSealSvc_joboptions.py" )
+        AthenaSealSvc.CheckDictionary = True 
+
+        include( "AthenaPoolCnvSvc/AthenaPool_jobOptions.py" )
+        theApp.Dlls   += [ "LArAthenaPoolPoolCnv" ]
+        theApp.Dlls   += [ "LArCondAthenaPoolPoolCnv" ]
+
+        include("RegistrationServices/OutputConditionsAlg_jobOptions.py")
+        ToolSvc.ConditionsAlgStream.OutputFile = POOLFileName
+        
+        OutputConditionsAlg.ObjectList = [ "LArCaliWaveContainer#"+KeyOut]
+
+###########################################################################
+
+#EventSelector.SkipEvents = 38400
+
+#RDBAccessSvc.UseDBConnSvc = False 
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel  = INFO
+MessageSvc.defaultLimit = 1000;
+
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_MasterWaves_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_MasterWaves_jobOptions.py
new file mode 100644
index 00000000000..51c72e87da1
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_MasterWaves_jobOptions.py
@@ -0,0 +1,144 @@
+###########################################################################
+#
+#  Read calibration waves from POOL file, evaluate master waveforms, save 
+#  them to database/ntuple/POOL file
+#
+###########################################################################
+
+Gain = "HG"        # HG, MG, LG
+Tag  = "XtalkCorr" # Standard, XtalkCorr
+
+WriteRootFile = True
+WritePoolFile = True
+
+#Datadir       = "./"
+Datadir       = "/shift/mdelmast/ctb2004/delay/postprod/"
+
+PoolFileList  = [ Datadir+"LArCaliWaveMerger-"+Gain+"-"+Tag+".pool.root" ]
+KeyInput      = "LArCaliWave-"+Gain
+RootFileName  = Datadir+"LArMasterWaves-"+Gain+"-"+Tag+".root"
+PoolFileName  = Datadir+"LArMasterWaves-"+Gain+"-"+Tag+".pool.root"
+KeyOutput     = "LArMasterWave-"+Gain
+
+###########################################################################
+
+#LArCondCnvDbServer = "atlobk02.cern.ch"
+LArCondCnvDbServer = "atlmysql01.cern.ch"
+
+###########################################################################
+
+#
+# Detector description (LAr only, H8 CTB 2004)
+#
+include( "LArDetDescr/LArDetDescr_H8_joboptions.py" )
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DoIdChecks
+DetDescrCnvSvc.LArIDFileName = "IdDictParser/IdDictLArCalorimeter_H8_2004.xml"
+
+ToolSvc = Service( "ToolSvc" )
+ToolSvc.LArRoI_Map.Print = False
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.all_setOff()
+DetFlags.em_setOn() 
+
+#
+# Read POOL file
+#
+include( "AthenaSealSvc/AthenaSealSvc_joboptions.py" )
+AthenaSealSvc.CheckDictionary = True 
+
+include( "AthenaPoolCnvSvc/AthenaPool_jobOptions.py" )
+theApp.Dlls += ["EventSelectorAthenaPool"] 
+theApp.Dlls += ["LArAthenaPoolPoolCnv"]
+theApp.Dlls += ["LArCondAthenaPoolPoolCnv"]
+
+CondProxyProvider = Service( "CondProxyProvider" )
+ProxyProviderSvc  = Service( "ProxyProviderSvc" )
+ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+CondProxyProvider.InputCollections = PoolFileList
+
+EventPersistencySvc = Service( "EventPersistencySvc" )
+EventPersistencySvc.CnvServices += [ "AthenaPoolCnvSvc" ]
+
+include("AthenaSealSvc/AthenaSealSvc_joboptions.py")
+
+#
+# build master waveforms from single-DAC calibration waves
+#
+theApp.Dlls += ["LArRawUtils"]
+theApp.Dlls += ["LArTools"]
+theApp.Dlls += ["LArCalibUtils"]
+
+theApp.TopAlg += [ "LArMasterWaveBuilder" ]
+LArMasterWaveBuilder = Algorithm("LArMasterWaveBuilder")
+
+LArMasterWaveBuilder.KeyInput  = KeyInput
+LArMasterWaveBuilder.KeyOutput = KeyOutput
+
+LArMasterWaveBuilder.Normalize = False
+LArMasterWaveBuilder.TimeShift = False
+
+LArMasterWaveBuilder.DiffWaveNormPeak        = False # normally don't use this! for Sandrine's selection
+LArMasterWaveBuilder.ListAllAnalysedChannels = False # complete output of all channels
+
+LArMasterWaveBuilder.BuildMWwithOneDAC  = True  # useful for Low Gain
+
+LArMasterWaveBuilder.LinearityTolerance = 0.035
+
+LArMasterWaveBuilder.DACMinPS     = [  2000 , 20000 ,    100 ]
+LArMasterWaveBuilder.DACMinStrips = [   100 ,  1000 ,    100 ]
+LArMasterWaveBuilder.DACMinMiddle = [   100 ,  1000 ,    100 ]
+LArMasterWaveBuilder.DACMinBack   = [   100 ,  1000 ,    100 ]
+LArMasterWaveBuilder.DACMaxPS     = [ 15000 , 50000 ,  65000 ]
+LArMasterWaveBuilder.DACMaxStrips = [   800 ,  8000 ,  65000 ]
+LArMasterWaveBuilder.DACMaxMiddle = [   800 ,  8000 ,  65000 ]
+LArMasterWaveBuilder.DACMaxBack   = [   800 ,  8000 ,  65000 ]
+
+LArMasterWaveBuilder.WriteDB      = False
+LArMasterWaveBuilder.OutputLevel  = INFO
+
+#
+# write master waveforms to ntuple/POOL
+# 
+if ( WriteRootFile ) :
+	theApp.Dlls += ["LArCalibTools"]
+	theApp.TopAlg += [ "LArWaves2Ntuple/LArCaliWaves2Ntuple"]
+	LArCaliWaves2Ntuple = Algorithm( "LArCaliWaves2Ntuple" )
+	LArCaliWaves2Ntuple.NtupleName   = "CALIWAVE"
+	LArCaliWaves2Ntuple.DACSaturSkip = False
+	#LArCaliWaves2Ntuple.KeyList     += [ KeyInput  ]
+	LArCaliWaves2Ntuple.KeyList     += [ KeyOutput ]
+	LArCaliWaves2Ntuple.OutputLevel  = INFO
+	
+	theApp.Dlls += [ "RootHistCnv" ]
+	theApp.HistogramPersistency = "ROOT"
+	NTupleSvc = Service( "NTupleSvc" )
+	NTupleSvc.Output = [ "FILE1 DATAFILE='"+RootFileName+"' OPT='NEW'" ]
+	
+if ( WritePoolFile ) :
+        include( "AthenaSealSvc/AthenaSealSvc_joboptions.py" )
+        AthenaSealSvc.CheckDictionary = True 
+
+        include( "AthenaPoolCnvSvc/AthenaPool_jobOptions.py" )
+        theApp.Dlls   += [ "LArAthenaPoolPoolCnv" ]
+        theApp.Dlls   += [ "LArCondAthenaPoolPoolCnv" ]
+
+        include("RegistrationServices/OutputConditionsAlg_jobOptions.py")
+        ToolSvc.ConditionsAlgStream.OutputFile = PoolFileName
+        
+        OutputConditionsAlg.ObjectList = [ "LArCaliWaveContainer#"+KeyOutput]
+
+###########################################################################
+
+AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
+AthenaEventLoopMgr.OutputLevel = INFO
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel = WARNING
+
+###########################################################################
+
+theApp.EvtMax = 1
+
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_OFC_Phys_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_OFC_Phys_jobOptions.py
new file mode 100644
index 00000000000..51e4cf2f2cf
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_OFC_Phys_jobOptions.py
@@ -0,0 +1,414 @@
+###########################################################################
+#
+#  jobOptions to produce LAr OFCs:
+#    * read calibration and/or physics waveforms from DB
+#    * read autocorrelation matrixes from DB
+#    * compute OFCs accordingly
+#    * write OFCs to DB (and/or ascii file, Root ntuple) 
+#
+###########################################################################
+
+doCalibOFC = False
+doPhysOFC  = True
+
+readNovaDB         = True
+
+CaliWaveFolderName = ["/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveHigh","/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveMedium","/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveLow"]
+CaliWaveFolderTag  = "TB04-Default"
+
+PhysWaveFolderName = [ "/lar/LArElecCalibTB04/LArPhysWaveContainer/RTM" ]
+PhysWaveFolderTag  = "" # HEAD
+
+POOLFileDir          = "./"
+#POOLFileDir          = "/data/mdelmast/ctb2004/ofc/"
+#POOLFileDir          = "/shift/mdelmast/ctb2004/ofc/"
+
+readPOOLFile       = False
+CaliWavePOOLFile   = ""
+PhysWavePOOLFile   = "LArRTMPhysWaves-NoTimeShift.pool.root"
+
+writePOOLFile      = False
+OFCCaliPOOLFile    = ""
+OFCPhysPOOLFile    = "LArRTMOFC-NoTimeShift.pool.root"
+
+writeNovaDB        = False
+CaliOFCDBFolder    = "LArOFCCalib/MWF"
+PhysOFCDBFolder    = "LArOFCPhys/RTM"
+
+IOVBeginRun        = 0
+IOVEndRun          = 2147483647 # 0x7FFFFFFF
+RunNumber          = 2102103    # RecExTB default run
+
+IncludeACFolder    = True
+UseDefaultAutoCorr = True
+AutoCorrFolderTag  = "TB04-Default"
+
+WriteNT            = False
+DumpOFC            = False
+DumpCaliOFCfile    = "caliOFC.dat"
+DumpPhysOFCfile    = "physOFC.dat"
+
+###########################################################################
+
+#Period = "Empty"
+
+Period = "3" 
+#Period = "4" 
+#Period = "5" 
+#Period = "6a"
+#Period = "6b-1"
+#Period = "6b-2"
+#Period = "6b-3"
+#Period = "6b-4"
+#Period = "7"
+#Period = "8-1" 
+#Period = "8-3" 
+
+#include("thisjob.py")
+
+###########################################################################
+
+if ( Period == "3" ) :
+	IOVBeginRun = 1000709
+	IOVEndRun   = 1000797
+	RunNumber   = 1000709
+	PhysWavePOOLFile = "LArRTMPhysWaves-Shifted-Periods:3,4,5,6a.pool.root"
+	OFCPhysPOOLFile  = "LArRTMOFC-Periods:3.pool.root"
+
+if ( Period == "4" ) :
+	IOVBeginRun = 1000813
+	IOVEndRun   = 1000918
+	RunNumber   = 1000813
+	PhysWavePOOLFile = "LArRTMPhysWaves-Shifted-Periods:3,4,5,6a.pool.root"
+	OFCPhysPOOLFile  = "LArRTMOFC-Periods:4.pool.root"
+
+if ( Period == "5" ) :
+	IOVBeginRun = 1000919
+	IOVEndRun   = 1001056
+	RunNumber   = 1000919
+	PhysWavePOOLFile = "LArRTMPhysWaves-Shifted-Periods:3,4,5,6a.pool.root"
+	OFCPhysPOOLFile  = "LArRTMOFC-Periods:5.pool.root"
+
+if ( Period == "6a" ) :
+	IOVBeginRun = 1002007
+	IOVEndRun   = 1004234
+	RunNumber   = 1002007
+	PhysWavePOOLFile = "LArRTMPhysWaves-Shifted-Periods:3,4,5,6a.pool.root"
+	OFCPhysPOOLFile  = "LArRTMOFC-Periods:6a.pool.root"
+
+if ( Period == "6b-1" ) :
+	IOVBeginRun = 2100024	
+	IOVEndRun   = 2100110
+	RunNumber   = 2100024
+	PhysWavePOOLFile = "LArRTMPhysWaves-Shifted-Periods:6b-1.pool.root"
+	OFCPhysPOOLFile  = "LArRTMOFC-Periods:6b-1.pool.root"
+
+if ( Period == "6b-2" ) :
+	IOVBeginRun = 2100132	
+	IOVEndRun   = 2100253
+	RunNumber   = 2100132
+	PhysWavePOOLFile = "LArRTMPhysWaves-Shifted-Periods:6b-2.pool.root"
+	OFCPhysPOOLFile  = "LArRTMOFC-Periods:6b-2.pool.root"
+
+if ( Period == "6b-3" ) :
+	IOVBeginRun = 2100254	
+	IOVEndRun   = 2100510
+	RunNumber   = 2100254
+	PhysWavePOOLFile = "LArRTMPhysWaves-Shifted-Periods:6b-3.pool.root"
+	OFCPhysPOOLFile  = "LArRTMOFC-Periods:6b-3.pool.root"
+
+if ( Period == "6b-4" ) :
+	IOVBeginRun = 2100513	
+	IOVEndRun   = 2100540
+	RunNumber   = 2100513
+	PhysWavePOOLFile = "LArRTMPhysWaves-Shifted-Periods:6b-4.pool.root"
+	OFCPhysPOOLFile  = "LArRTMOFC-Periods:6b-4.pool.root"
+
+if ( Period == "7" ) :
+	IOVBeginRun = 2100558
+	IOVEndRun   = 2100975
+	RunNumber   = 2100558
+	PhysWavePOOLFile = "LArRTMPhysWaves-Shifted-Periods:7.pool.root"
+	OFCPhysPOOLFile  = "LArRTMOFC-Periods:7.pool.root"
+
+if ( Period == "7-1" ) :
+	IOVBeginRun = 2100558
+	IOVEndRun   = 2100676 # ???
+	RunNumber   = 2100558
+	PhysWavePOOLFile = "LArRTMPhysWaves-Shifted-Periods:7-1.pool.root"
+	OFCPhysPOOLFile  = "LArRTMOFC-Periods:7-1.pool.root"
+
+if ( Period == "7-2" ) :
+	IOVBeginRun = 2100683 # ???
+	IOVEndRun   = 2100750
+	RunNumber   = 2100683
+	PhysWavePOOLFile = "LArRTMPhysWaves-Shifted-Periods:7-2.pool.root"
+	OFCPhysPOOLFile  = "LArRTMOFC-Periods:7-2.pool.root"
+
+if ( Period == "7-3" ) :
+	IOVBeginRun = 2100751
+	IOVEndRun   = 2100766
+	RunNumber   = 2100751
+	PhysWavePOOLFile = "LArRTMPhysWaves-Shifted-Periods:7-3.pool.root"
+	OFCPhysPOOLFile  = "LArRTMOFC-Periods:7-3.pool.root"
+	
+if ( Period == "7-4" ) :
+	IOVBeginRun = 2100767
+	IOVEndRun   = 2100975 # ???
+	RunNumber   = 2100767
+	PhysWavePOOLFile = "LArRTMPhysWaves-Shifted-Periods:7-4.pool.root"
+	OFCPhysPOOLFile  = "LArRTMOFC-Periods:7-4.pool.root"
+
+
+if ( Period == "8-1" ) :
+	IOVBeginRun = 2101022
+	IOVEndRun   = 2101475
+	RunNumber   = 2101022
+	PhysWavePOOLFile  = "LArRTMPhysWaves-Shifted-Periods:8-1.pool.root"
+	OFCPhysPOOLFile   = "LArRTMOFC-Periods:8-1.pool.root"
+
+#if ( Period == "8-2" ) :
+#	IOVBeginRun = 2101571
+#	IOVEndRun   = 2101737
+#	RunNumber   = 2101571
+#	PhysWavePOOLFile  = "LArRTMPhysWaves-Shifted-Periods:8-2.pool.root"
+#	OFCPhysPOOLFile   = "LArRTMOFC-Periods:8-2.pool.root"
+
+if ( Period == "8-3" ) :
+	IOVBeginRun = 2102095
+	IOVEndRun   = 2102992
+	RunNumber   = 2102095
+	PhysWavePOOLFile  = "LArRTMPhysWaves-Shifted-Periods:8-3.pool.root"
+	OFCPhysPOOLFile   = "LArRTMOFC-Periods:8-3.pool.root"
+
+###########################################################################
+
+IOVBeginEvent = 0
+IOVEndEvent   = 4294967295 #0xFFFFFFFF
+#IOVEndEvent   = 4294967294 #0xFFFFFFFF -1
+
+###########################################################################
+
+#LArCondCnvDbServer = "atlobk01.cern.ch"
+#LArCondCnvDbServer = "atlobk02.cern.ch"
+LArCondCnvDbServer = "atlmysql01.cern.ch"
+
+###########################################################################
+
+include( "ByteStreamCnvSvc/TBEventSelector_jobOptions.py" )
+
+#
+# Fake the reconstruciton of one event from one run to trigger retrieval 
+# of condition object
+#
+theApp.Dlls += [ "LArByteStream"]
+ByteStreamInputSvc = Service( "ByteStreamInputSvc" )
+
+include("RecExTB_SetFlags_jobOptions.py")
+
+ByteStreamInputSvc.InputDirectory += ["/castor/cern.ch/atlas/testbeam/combined/2004"]
+ByteStreamInputSvc.FilePrefix     += [FilePrefix]
+ByteStreamInputSvc.RunNumber       = [RunNumber]
+
+theApp.EvtMax = 1
+
+ByteStreamAddressProviderSvc = Service( "ByteStreamAddressProviderSvc" )
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/FREE"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/LOW"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/MEDIUM"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/HIGH"]
+
+#
+# Detector description (LAr only)
+#
+include( "LArDetDescr/LArDetDescr_H8_joboptions.py" )
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DoIdChecks
+DetDescrCnvSvc.LArIDFileName = "IdDictParser/IdDictLArCalorimeter_H8_2004.xml"
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.all_setOff()
+DetFlags.em_setOn() 
+
+ToolSvc = Service( "ToolSvc" )
+ToolSvc.LArRoI_Map.Print = False
+
+#
+# POOL
+#
+if ( readPOOLFile) :
+	include( "AthenaSealSvc/AthenaSealSvc_joboptions.py" )
+	AthenaSealSvc.CheckDictionary = True 
+
+	include( "AthenaPoolCnvSvc/AthenaPool_jobOptions.py" )
+	theApp.Dlls += ["EventSelectorAthenaPool"] 
+	theApp.Dlls += [ "LArAthenaPoolPoolCnv" ]
+	theApp.Dlls += [ "LArCondAthenaPoolPoolCnv" ]
+	
+	ProxyProviderSvc = Service( "ProxyProviderSvc" )
+	ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+	
+	CondProxyProvider = Service( "CondProxyProvider" )
+	
+	EventPersistencySvc = Service( "EventPersistencySvc" )
+	EventPersistencySvc.CnvServices += [ "AthenaPoolCnvSvc" ]
+
+#
+# Condition DB
+#
+include( "LArCondCnv/LArCondCnv_Config_jobOptions.py" )
+include( "LArCondCnv/LArCondCnv_IOVDbSvc_jobOptions.py" )
+
+IOVDbSvc = Service( "IOVDbSvc" )
+IOVDbSvc.serverName = LArCondCnvDbServer
+IOVDbSvc.DBname = "conditions_ctb_2004";
+
+IOVDbSvc.OutputLevel = DEBUG
+#IOVDbMgr.OutputLevel = DEBUG
+
+if ( not writeNovaDB ) :
+	IOVDbSvc.userName   = "conditions" 
+	IOVDbSvc.userPwd    = "conditions"
+
+if ( writeNovaDB ) :
+	IOVDbSvc.userName   = "condwriter" 
+	IOVDbSvc.userPwd    = "pwd4writer"
+
+AutoCorrFolderName = ["/lar/LArElecCalibTB04/LArAutoCorr"]
+if 'AutoCorrFolderTag' in dir() :
+	for i in range(len(AutoCorrFolderName)) :
+		AutoCorrFolderName[i] += '<tag>'+ AutoCorrFolderTag + '</tag>'
+
+if ( IncludeACFolder ) :
+	IOVDbSvc.Folders += AutoCorrFolderName
+
+if ( doCalibOFC ) :
+	if ( readNovaDB ) :
+        	if 'CaliWaveFolderTag' in dir():
+			for i in range(len(CaliWaveFolderName)) :
+				CaliWaveFolderName[i] += '<tag>'+ CaliWaveFolderTag + '</tag>'
+		IOVDbSvc.Folders += CaliWaveFolderName
+	if ( readPOOLFile ) :
+		CondProxyProvider.InputCollections = [ POOLFileDir+CaliWavePOOLFile ]
+	
+if ( doPhysOFC ): 
+	if ( readNovaDB ) :
+		if 'PhysWaveFolderTag' in dir():
+			for i in range(len(PhysWaveFolderName)) :
+				PhysWaveFolderName[i] += '<tag>'+ PhysWaveFolderTag + '</tag>'
+		IOVDbSvc.Folders += PhysWaveFolderName
+	if ( readPOOLFile ) :
+		CondProxyProvider.InputCollections = [ POOLFileDir+PhysWavePOOLFile ]
+
+#
+# IOV
+#
+ToolSvc.FillNovaIOVTool.BeginRun   = IOVBeginRun
+ToolSvc.FillNovaIOVTool.EndRun     = IOVEndRun
+ToolSvc.FillNovaIOVTool.BeginEvent = IOVBeginEvent
+ToolSvc.FillNovaIOVTool.EndEvent   = IOVEndEvent
+
+#
+# OFC computation
+#
+
+theApp.Dlls += ["LArRawUtils"]
+theApp.Dlls += ["LArTools"]
+theApp.Dlls += ["LArCalibUtils"]
+
+#
+# evaluate OFCs for master waveforms ...
+#
+
+if ( doCalibOFC ) :
+	theApp.TopAlg += [ "LArOFCAlg<LArCaliWaveContainer>/LArCaliOFCAlg"]
+	LArCaliOFCAlg = Algorithm( "LArCaliOFCAlg" )
+	LArCaliOFCAlg.KeyList     = [ "LArMasterWaveHigh" , "LArMasterWaveMedium" , "LArMasterWaveLow" ]
+	LArCaliOFCAlg.Nphase      = 50
+	LArCaliOFCAlg.Ndelay      = 24
+	LArCaliOFCAlg.TimeShift   = False 
+	LArCaliOFCAlg.Verify      = True
+	LArCaliOFCAlg.Normalize   = True
+	LArCaliOFCAlg.OutputLevel = INFO
+	if ( DumpOFC ) :
+		LArCaliOFCAlg.DumpOFCfile = DumpCaliOFCfile
+	if ( writeNovaDB ) :
+		LArCaliOFCAlg.WriteDB   = True
+		LArCaliOFCAlg.FolderOFC = CaliOFCDBFolder
+
+#
+# ... and for physics waveforms
+#
+
+if ( doPhysOFC ) :
+	theApp.TopAlg += [ "LArOFCAlg<LArPhysWaveContainer>/LArPhysOFCAlg"]
+	LArPhysOFCAlg = Algorithm( "LArPhysOFCAlg" )
+	LArPhysOFCAlg.KeyList     = [ "LArMasterWaveHigh" , "LArMasterWaveMedium" , "LArMasterWaveLow" ]
+	LArPhysOFCAlg.KeyList    += [ "LArPhysWave" ]
+	LArPhysOFCAlg.KeyList    += [ "LArPhysWave_new" ]
+	LArPhysOFCAlg.Nphase      = 50
+	LArPhysOFCAlg.Ndelay      = 24
+	LArPhysOFCAlg.TimeShift   = False
+	LArPhysOFCAlg.Verify      = True
+	LArPhysOFCAlg.Normalize   = False
+	LArPhysOFCAlg.UseDefaultAutoCorr = UseDefaultAutoCorr
+	LArPhysOFCAlg.OutputLevel = INFO
+	if ( DumpOFC ) :
+		LArPhysOFCAlg.DumpOFCfile = DumpPhysOFCfile
+	if ( writeNovaDB ) :
+		LArPhysOFCAlg.WriteDB         = True
+		#LArPhysOFCAlg.PreviousRunToDB = 0
+		LArPhysOFCAlg.FolderOFC       = PhysOFCDBFolder
+		if ( Period == "Empty" ) :
+			LArPhysOFCAlg.StoreEmpty = True # clean up DB folder
+	
+if ( writePOOLFile ) :
+	include( "AthenaSealSvc/AthenaSealSvc_joboptions.py" )
+	AthenaSealSvc.CheckDictionary = True 
+	AthenaSealSvc.OutputLevel = INFO
+	
+	include( "AthenaPoolCnvSvc/AthenaPool_jobOptions.py" )
+	theApp.Dlls   += [ "LArAthenaPoolPoolCnv" ]
+	theApp.Dlls   += [ "LArCondAthenaPoolPoolCnv" ]	
+	
+	include("RegistrationServices/OutputConditionsAlg_jobOptions.py")
+	
+	OutputConditionsAlg.ObjectList = [ "LArOFCComplete#LArOFC" ]
+	
+	if ( doCalibOFC ) :
+		ToolSvc.ConditionsAlgStream.OutputFile = POOLFileDir+OFCCaliPOOLFile	
+	if ( doPhysOFC ) :		
+		ToolSvc.ConditionsAlgStream.OutputFile = POOLFileDir+OFCPhysPOOLFile
+	
+	OutputConditionsAlg.OutputLevel         = DEBUG
+	ToolSvc.ConditionsAlgStream.OutputLevel = DEBUG
+
+	
+if ( WriteNT ) :
+	theApp.Dlls += ["LArCalibTools"]
+	theApp.TopAlg += [ "LArOFC2Ntuple"]
+	LArOFC2Ntuple = Algorithm( "LArOFC2Ntuple" )	
+	LArOFC2Ntuple.OutputLevel = INFO
+	
+	theApp.Dlls += [ "RootHistCnv" ]
+	theApp.HistogramPersistency = "ROOT"
+	NTupleSvc = Service( "NTupleSvc" )
+	NTupleSvc.Output = [ "FILE1 DATAFILE='LArOFC.root' OPT='NEW'" ]
+	
+AthenaEventLoopMgr = Service("AthenaEventLoopMgr")
+AthenaEventLoopMgr.OutputLevel = VERBOSE
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel = INFO
+
+###########################################################################
+
+# write out a list of all Storegate collection with their keys and
+# lock/unlock state. Very useful for debugging purpose
+
+#StoreGateSvc = Service( "StoreGateSvc" )
+#StoreGateSvc.Dump = TRUE
+#DetectorStore = Service( "DetectorStore" )
+#DetectorStore.Dump = TRUE
+#ConditionsStore = Service( "ConditionsStore" )
+#ConditionsStore.Dump = TRUE
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_Pedestals_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_Pedestals_jobOptions.py
new file mode 100644
index 00000000000..ce739a119a8
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_Pedestals_jobOptions.py
@@ -0,0 +1,51 @@
+#Include all the basic stuff and the Event Selector to read TB files 
+include( "ByteStreamCnvSvc/TBEventSelector_jobOptions.py" )
+
+#Register Containers/Keys to be converted from ByteStream
+ByteStreamAddressProviderSvc = Service( "ByteStreamAddressProviderSvc" )
+ByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/HIGH"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/MEDIUM"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/LOW"]
+#Get DetectorDescription
+include( "LArDetMgrDetDescrCnv/LArDetMgrDetDescrCnv_H8_joboptions.py" )
+
+#Raw Data Location:
+ByteStreamInputSvc = Service( "ByteStreamInputSvc" )
+ByteStreamInputSvc.InputDirectory += ["/castor/cern.ch/atlas/testbeam/combined/2004/"]
+ByteStreamInputSvc.FilePrefix += ["daq_SFI-51_calo"]
+ByteStreamInputSvc.RunNumber = [1000919]
+#DetDescrCnvSvc.DoIdChecks;
+# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel =DEBUG
+#--------------------------------------------------------------
+# Event related parameters
+#--------------------------------------------------------------
+# Number of events to be processed (default is 10)
+theApp.EvtMax = 100
+#Get necessary DLLs
+theApp.Dlls += [ "LArRawUtils","LArCalibUtils", "LArTools"]
+theApp.Dlls += [ "LArByteStream"]
+ToolSvc = Service( "ToolSvc" )
+ToolSvc.LArRoI_Map.Print=FALSE
+#Define Top Algoithm to analyze Pedestals and make a ntuple
+theApp.TopAlg = ["LArPedestalMaker/Pedestal","LArPedestals2Ntuple"]
+
+Pedestal = Algorithm( "Pedestal" )
+Pedestal.events_ref =50
+Pedestal.nsigma =5
+
+LArPedestals2Ntuple=Algorithm("LArPedestals2Ntuple")
+LArPedestals2Ntuple.ContainerKey = "Pedestal"
+#StoreGateSvc = Service( "StoreGateSvc" )
+#StoreGateSvc.dump=TRUE
+
+#----- JobOptions for Ntuple-output
+theApp.Dlls += [ "RootHistCnv" ]; 
+theApp.HistogramPersistency = "ROOT" 
+#HistogramPersistencySvc = Service( "HistogramPersistencySvc" )
+#HistogramPersistencySvc.OutputFile="histo.root"
+
+NtupleSvc = Service( "NtupleSvc" )
+NtupleSvc.Output=["FILE1 DATAFILE='ped_1000919.root' TYP='ROOT' OPT='NEW'"]
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_PhysWaveShifter_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_PhysWaveShifter_jobOptions.py
new file mode 100644
index 00000000000..f0a5c99716c
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_PhysWaveShifter_jobOptions.py
@@ -0,0 +1,346 @@
+###########################################################################
+
+readNovaDB          = True
+PhysWaveFolderName  = ["/lar/LArElecCalibTB04/LArPhysWaveContainer/RTM"]
+PhysWaveFolderTag   = "TB04-NoTimeShift-1"
+
+POOLFileDir          = "./"
+#POOLFileDir          = "/data/mdelmast/ctb2004/ofc/"
+#POOLFileDir          = "/shift/mdelmast/ctb2004/ofc/"
+
+readPOOLfile        = False
+PhysWavePOOLFileIN  = "LArRTMPhysWaves-NoTimeShift.pool.root"
+
+writePOOLfile       = False
+#PhysWavePOOLFileOUT = "LArRTMPhysWaves-Shifted.pool.root"
+
+writeNovaDB         = False
+PhysWaveFolderNew   = "RTM"
+#PhysWaveFolderNew   = "RTM_test"
+
+writeNT             = False
+RootFile            = "LArPhysWaveShifter.root"
+
+###########################################################################
+
+Period = "3,4,5,6a"
+#Period = "6b-1"
+#Period = "6b-2"
+#Period = "6b-3"
+#Period = "6b-4"
+#Period = "7"
+#Period = "8-1"
+#Period = "8-3"
+
+#include( "thisjob.py" )
+
+###########################################################################
+
+TimeShiftByHelper  = False
+TimeShiftByFEB     = True
+
+theApp.Dlls   += ["LArEventTest"]
+theApp.TopAlg += ["FakeLArTimeOffset"]
+FakeLArTimeOffset=Algorithm("FakeLArTimeOffset")
+FakeLArTimeOffset.OutputLevel = INFO
+
+FakeLArTimeOffset.FEBids = [ 0x39000000, 0x39008000, 0x39010000, 0x39018000, 0x39020000, 
+                             0x39028000, 0x39030000, 0x39038000, 0x39040000, 0x39048000, 
+			     0x39050000, 0x39058000, 0x39060000, 0x39068000, 0x39080000, 
+			     0x39088000, 0x39090000, 0x39098000, 0x390a0000, 0x390a8000, 
+			     0x390b0000, 0x390b8000, 0x390c0000, 0x390c8000, 0x390d0000, 
+			     0x390d8000, 0x390e0000, 0x390e8000 ]
+
+#
+# All periods...
+#
+#IOVBeginRun          = 0
+#IOVEndRun            = 2147483647 # 0x7FFFFFFF
+#RunNumber            = 2102103    # RecExTB default run
+#TimeShiftGuardRegion = 0
+FakeLArTimeOffset.FEbTimeOffsets = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+                                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
+
+#
+# minimum tstart per FEB computed on calibration (master) waveforms
+#
+#FakeLArTimeOffset.FEbTimeOffsets  = [  2, 30, 27, 26, 23, 19, 18, 18, 10,  3, 
+#                                      17, 11,  4,  8,  5, 34, 32, 32, 31, 25, 
+#				      24, 24, 17,  9, 21, 21, 10,  6 ]
+
+#
+# minimum tstart per FEB computed on predicted physiucs waveforms
+#
+#FakeLArTimeOffset.FEbTimeOffsets  = [  2, 33, 30, 30, 26, 22, 20, 21, 10,  3, 
+#				       20, 15,  8,  5,  5, 37, 35, 34, 34, 28, 
+#				       27, 28, 17,  9, 25, 25, 15, 10 ]
+
+
+if ( Period == "3,4,5,6a" ) :
+	IOVBeginRun          = 1000709
+	IOVEndRun            = 1004234
+	RunNumber            = 1000709
+	TimeShiftGuardRegion = 10
+	FakeLArTimeOffset.FEbTimeOffsets  = [ 22, 30, 27, 26, 23, 19, 18, 18, 10,  3, 
+                                              17, 11,  4,  8, 25, 34, 32, 32, 31, 25, 
+				              24, 24, 17,  9, 21, 21, 10,  6 ]
+	PhysWavePOOLFileOUT = "LArRTMPhysWaves-Shifted-Periods:3,4,5,6a.pool.root"
+
+if ( Period == "6b-1" ) :
+	IOVBeginRun          = 2100024
+	IOVEndRun            = 2100110
+	RunNumber            = 2100024
+	TimeShiftGuardRegion = 15
+	FakeLArTimeOffset.FEbTimeOffsets  = [ 22, 30-10, 27, 26, 23, 19, 18, 18, 10,  3, 
+                                              17, 11,  4,  8, 25, 34-15, 32, 32-10, 31, 25, 
+				              24, 24, 17,  9, 21-15, 21-5, 10,  6 ]
+	PhysWavePOOLFileOUT = "LArRTMPhysWaves-Shifted-Periods:6b-1.pool.root"
+
+if ( Period == "6b-2" ) :
+	IOVBeginRun          = 2100132
+	IOVEndRun            = 2100253
+	RunNumber            = 2100253
+	TimeShiftGuardRegion = 10
+	FakeLArTimeOffset.FEbTimeOffsets  = [ 22, 30-10, 27, 26, 23, 19, 18, 18, 10,  3, 
+                                              17, 11,  4,  8, 25, 34-15, 32, 32, 31, 25, 
+				              24, 24, 17,  9, 21-5, 21, 10,  6 ]
+	PhysWavePOOLFileOUT = "LArRTMPhysWaves-Shifted-Periods:6b-2.pool.root"
+
+if ( Period == "6b-3" ) :
+	IOVBeginRun          = 2100254	
+	IOVEndRun            = 2100510
+	RunNumber            = 2100254
+	TimeShiftGuardRegion = 15
+	FakeLArTimeOffset.FEbTimeOffsets  = [ 22, 30-10, 27, 26, 23, 19, 18, 18, 10,  3, 
+                                              17, 11,  4,  8, 25, 34, 32, 32, 31, 25, 
+				              24, 24, 17,  9, 21-5, 21-10, 10,  6 ]
+	PhysWavePOOLFileOUT = "LArRTMPhysWaves-Shifted-Periods:6b-3.pool.root"
+
+if ( Period == "6b-4" ) :
+	IOVBeginRun          = 2100513	
+	IOVEndRun            = 2100540
+	RunNumber            = 2100513
+	TimeShiftGuardRegion = 15
+	FakeLArTimeOffset.FEbTimeOffsets  = [ 22, 30-10, 27, 26, 23, 19, 18, 18, 10,  3, 
+                                              17, 11,  4,  8, 25, 34, 32, 32, 31, 25, 
+				              24, 24, 17,  9, 21-5, 21-10, 10,  6 ]
+	PhysWavePOOLFileOUT = "LArRTMPhysWaves-Shifted-Periods:6b-4.pool.root"
+
+if ( Period == "7" ) :
+	IOVBeginRun          = 2100558
+	IOVEndRun            = 2100975
+	RunNumber            = 2100558	
+	TimeShiftGuardRegion = 10
+	FakeLArTimeOffset.FEbTimeOffsets  = [ 22-10, 30-10, 27, 26, 23, 19, 18, 18, 10,  3, 
+                                              17, 11,  4-5,  8, 25-10, 34, 32, 32, 31, 25, 
+				              24, 24, 17,  9, 21-5, 21-10, 10,  6 ]
+	PhysWavePOOLFileOUT = "LArRTMPhysWaves-Shifted-Periods:7.pool.root"
+
+
+if ( Period == "8-1" ) :
+	IOVBeginRun          = 2101022
+	IOVEndRun            = 2101475
+	RunNumber            = 2101022
+	TimeShiftGuardRegion = 20
+	FakeLArTimeOffset.FEbTimeOffsets  = [ 22, 30, 27, 26, 23, 19, 18, 18, 10,  3, 
+                                              17, 11,  4,  8, 25, 25, 25, 25, 25, 25, 
+				              24, 24, 17,  9, 21, 21, 10,  6 ]
+	PhysWavePOOLFileOUT = "LArRTMPhysWaves-Shifted-Periods:8-1.pool.root"
+
+if ( Period == "8-3" ) :
+	IOVBeginRun          = 2102095
+	IOVEndRun            = 2102992
+	RunNumber            = 2102095
+	TimeShiftGuardRegion = 5
+	FakeLArTimeOffset.FEbTimeOffsets  = [ 22, 30, 27, 26, 23, 19, 18, 18, 10,  3, 
+                                              17, 11,  4,  8, 25, 34, 32, 32, 31, 25, 
+				              24, 24, 17,  9, 21, 21, 10,  6 ]
+	PhysWavePOOLFileOUT = "LArRTMPhysWaves-Shifted-Periods:8-3.pool.root"
+	
+###########################################################################
+
+# *** General IOV settings
+IOVBeginEvent = 0
+#IOVEndEvent   = 999999
+IOVEndEvent   = 4294967295 #0xFFFFFFFF
+#IOVEndEvent   = 4294967294 #0xFFFFFFFF - 1
+
+###########################################################################
+
+#LArCondCnvDbServer = "atlobk01.cern.ch"
+#LArCondCnvDbServer = "atlobk02.cern.ch"
+LArCondCnvDbServer = "atlmysql01.cern.ch"
+
+###########################################################################
+
+#
+# Fake the reconstruction of one event from one run to trigger the OFC retrieval
+#
+include( "ByteStreamCnvSvc/TBEventSelector_jobOptions.py" )
+theApp.Dlls += [ "LArByteStream"]
+ByteStreamInputSvc = Service( "ByteStreamInputSvc" )
+
+include("RecExTB_SetFlags_jobOptions.py")
+
+ByteStreamInputSvc.InputDirectory += ["/castor/cern.ch/atlas/testbeam/combined/2004"]
+ByteStreamInputSvc.FilePrefix     += [FilePrefix]
+ByteStreamInputSvc.RunNumber       = [RunNumber]
+
+theApp.EvtMax = 1
+
+ByteStreamAddressProviderSvc = Service( "ByteStreamAddressProviderSvc" )
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/LOW"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/MEDIUM"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/HIGH"]
+
+#
+# Detector description (LAr only)
+#
+include( "LArDetDescr/LArDetDescr_H8_joboptions.py" )
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DoIdChecks
+DetDescrCnvSvc.LArIDFileName ="IdDictParser/IdDictLArCalorimeter_H8_2004.xml"
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.all_setOff()
+DetFlags.em_setOn() 
+
+ToolSvc = Service( "ToolSvc" )
+ToolSvc.LArRoI_Map.Print = False
+
+#
+# Conditions DB
+#
+include( "LArCondCnv/LArCondCnv_Config_jobOptions.py" )
+include( "LArCondCnv/LArCondCnv_IOVDbSvc_jobOptions.py" )
+
+IOVDbSvc = Service( "IOVDbSvc" )
+IOVDbSvc.serverName = LArCondCnvDbServer
+IOVDbSvc.DBname     = "conditions_ctb_2004"
+
+IOVDbSvc.OutputLevel = DEBUG
+
+if ( not writeNovaDB ) :
+	IOVDbSvc.userName   = "conditions"; 
+	IOVDbSvc.userPwd    = "conditions";
+else :
+	IOVDbSvc.userName   = "condwriter"; 
+	IOVDbSvc.userPwd    = "pwd4writer";
+		
+if ( readNovaDB	) :
+	if 'PhysWaveFolderTag' in dir():
+		for i in range(len(PhysWaveFolderName)) :
+			PhysWaveFolderName[i] += '<tag>'+ PhysWaveFolderTag + '</tag>'
+		IOVDbSvc.Folders += PhysWaveFolderName ;
+
+#
+# POOL
+#
+if ( readPOOLfile) :
+	include( "AthenaSealSvc/AthenaSealSvc_joboptions.py" )
+	AthenaSealSvc.CheckDictionary = True 
+
+	include( "AthenaPoolCnvSvc/AthenaPool_jobOptions.py" )
+	theApp.Dlls += ["EventSelectorAthenaPool"] 
+	theApp.Dlls += [ "LArAthenaPoolPoolCnv" ]
+	theApp.Dlls += [ "LArCondAthenaPoolPoolCnv" ]
+	
+	ProxyProviderSvc = Service( "ProxyProviderSvc" )
+	ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+	
+	CondProxyProvider = Service( "CondProxyProvider" )
+	CondProxyProvider.InputCollection = [ POOLFileDir+PhysWavePOOLFileIN ]
+	
+	EventPersistencySvc = Service( "EventPersistencySvc" )
+	EventPersistencySvc.CnvServices += [ "AthenaPoolCnvSvc" ]
+
+#
+# IOV
+#
+ToolSvc.FillNovaIOVTool.BeginRun   = IOVBeginRun
+ToolSvc.FillNovaIOVTool.EndRun     = IOVEndRun
+ToolSvc.FillNovaIOVTool.BeginEvent = IOVBeginEvent
+ToolSvc.FillNovaIOVTool.EndEvent   = IOVEndEvent
+
+#
+# shift physics waveforms
+#
+theApp.Dlls += ["LArRawUtils"]
+theApp.Dlls += ["LArTools"]
+theApp.Dlls += ["LArCalibUtils"]
+theApp.Dlls += ["LArCalibTools"]
+
+theApp.TopAlg += [ "LArPhysWaveShifter" ]
+LArPhysWaveShifter = Algorithm( "LArPhysWaveShifter" )
+LArPhysWaveShifter.KeyList               =  [ "LArPhysWave" ]
+#LArPhysWaveShifter.KeyList              +=  [ "LArMasterWaveHigh" , "LArMasterWaveMedium" , "LArMasterWaveLow" ]
+
+#
+# Possible time shifts:
+#
+LArPhysWaveShifter.TimeShiftByHelper     = TimeShiftByHelper
+LArPhysWaveShifter.TimeShiftByIndex      = -1
+LArPhysWaveShifter.TimeShiftByLayer      = False
+LArPhysWaveShifter.TshiftLayer           = [ 13 , 23 , 4 , 8 ] # time shifts for PS and EMC samplings
+LArPhysWaveShifter.TimeShiftByFEB        = TimeShiftByFEB
+LArPhysWaveShifter.TimeShiftGuardRegion  = TimeShiftGuardRegion ;
+
+#
+# Minimum Tstart per FEB computation (use helper, produce TimeShiftFEB.py)
+#
+LArPhysWaveShifter.ComputeTimeShiftByFEB = False
+
+LArPhysWaveShifter.OutputLevel           = VERBOSE
+
+if ( writeNovaDB ) :
+	LArPhysWaveShifter.WriteDB        = True
+	LArPhysWaveShifter.PhysFolderName = PhysWaveFolderNew
+	IOVDbSvc.OutputLevel              = INFO
+
+if ( writePOOLfile ) :
+	include( "AthenaSealSvc/AthenaSealSvc_joboptions.py" )
+	AthenaSealSvc.CheckDictionary = True 
+
+	include( "AthenaPoolCnvSvc/AthenaPool_jobOptions.py" )
+	theApp.Dlls   += [ "LArAthenaPoolPoolCnv" ]
+	theApp.Dlls   += [ "LArCondAthenaPoolPoolCnv" ]
+	
+	include("RegistrationServices/OutputConditionsAlg_jobOptions.py")
+	ToolSvc.ConditionsAlgStream.OutputFile = POOLFileDir+PhysWavePOOLFileOUT
+	
+	OutputConditionsAlg.ObjectList  = [ "LArPhysWaveContainer#LArPhysWave_new" ]
+	#OutputConditionsAlg.ObjectList += [ "LArPhysWaveContainer#LArMasterWaveHigh_new" ]
+	#OutputConditionsAlg.ObjectList += [ "LArPhysWaveContainer#LArMasterWaveMedium_new" ]
+	#OutputConditionsAlg.ObjectList += [ "LArPhysWaveContainer#LArMasterWaveLOw_new" ]
+			
+	OutputConditionsAlg.OutputLevel = DEBUG
+	
+	ToolSvc.ConditionsAlgStream.OutputLevel = DEBUG
+
+if ( writeNT ) :
+	theApp.TopAlg += [ "LArWaves2Ntuple<LArPhysWaveContainer>/LArOldPhysWaves2Ntuple"]
+	LArOldPhysWaves2Ntuple = Algorithm( "LArOldPhysWaves2Ntuple" )
+	LArOldPhysWaves2Ntuple.NtupleName   = "PHYSWAVEOLD" 
+	LArOldPhysWaves2Ntuple.KeyList      = [ "LArPhysWave" ]
+	LArOldPhysWaves2Ntuple.KeyList     += [ "LArMasterWaveHigh" , "LArMasterWaveMedium" , "LArMasterWaveLow" ]
+
+	theApp.TopAlg += [ "LArWaves2Ntuple<LArPhysWaveContainer>/LArNewPhysWaves2Ntuple"]
+	LArNewPhysWaves2Ntuple = Algorithm( "LArNewPhysWaves2Ntuple" )
+	LArNewPhysWaves2Ntuple.NtupleName   = "PHYSWAVENEW" 
+	LArNewPhysWaves2Ntuple.KeyList      = [ "LArPhysWave_new" ]
+	LArNewPhysWaves2Ntuple.KeyList     += [ "LArMasterWaveHigh" , "LArMasterWaveMedium" , "LArMasterWaveLow" ]
+
+	theApp.Dlls += [ "RootHistCnv" ]
+	theApp.HistogramPersistency = "ROOT"
+	NTupleSvc = Service( "NTupleSvc" )
+	NTupleSvc.Output = [ "FILE1 DATAFILE='"+RootFile+"' OPT='NEW'" ]
+
+
+AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
+AthenaEventLoopMgr.OutputLevel = INFO
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel  = INFO
+MessageSvc.defaultLimit = 10000;
+MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_RTMParams_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_RTMParams_jobOptions.py
new file mode 100644
index 00000000000..25c25d28715
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_RTMParams_jobOptions.py
@@ -0,0 +1,196 @@
+###########################################################################
+#
+#  * read master waves from DB
+#  * extract paramters according to RTM algorithms
+#  * save parameters to Ntuple/NovaDB/local POOL file 
+#
+###########################################################################
+
+MasterWaveFolderTag  = "TB04-5"
+
+doTest          = False
+
+WriteNT         = True
+NtupleFileName  = "LArRTMParams.root"
+WriteCaliWaveNT = False
+
+WritePOOLFile   = True
+POOLFileDir     = "./"
+POOLFileName    = "LArRTMParams.pool.root"
+
+WriteNovaDB     = False
+NovaDBFolder    = "test"
+
+###########################################################################
+#
+# Use RunNumber to select then MasterWaves IOV
+# Change the Params IOV accordingly
+#
+
+DataDir      = "/castor/cern.ch/atlas/testbeam/combined/2004"
+RunNumber    = 2102103 # RecExTB default run
+FilePrefix   = "daq_SFI-51_combined"
+
+# IOV extrema example (-inf, +inf)
+IOVBeginRun  = 0
+IOVEndRun    = 2147483647 # 0x7FFFFFFF
+
+# General IOV settings
+IOVBeginEvent = 0
+IOVEndEvent   = 4294967295 # 0xFFFFFFFF
+
+###########################################################################
+
+LArCondCnvDbServer = "atlmysql01.cern.ch"
+#LArCondCnvDbServer = "atlobk02.cern.ch"
+
+###########################################################################
+
+include( "ByteStreamCnvSvc/TBEventSelector_jobOptions.py" )
+
+#
+# Fake the reconstruction of one event from one run to trigger the IOV server
+#
+theApp.Dlls += [ "LArByteStream"]
+ByteStreamInputSvc = Service( "ByteStreamInputSvc" )
+
+ByteStreamInputSvc.InputDirectory += [DataDir]
+ByteStreamInputSvc.FilePrefix     += [FilePrefix]
+ByteStreamInputSvc.RunNumber       = [RunNumber]
+
+theApp.EvtMax = 1
+
+ByteStreamAddressProviderSvc = Service( "ByteStreamAddressProviderSvc" )
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/LOW"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/MEDIUM"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/HIGH"]
+
+#
+# Detector description (LAr only)
+#
+include( "LArDetDescr/LArDetDescr_H8_joboptions.py" )
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DoIdChecks
+DetDescrCnvSvc.LArIDFileName ="IdDictParser/IdDictLArCalorimeter_H8_2004.xml"
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.all_setOff()
+DetFlags.em_setOn() 
+
+ToolSvc = Service( "ToolSvc" )
+ToolSvc.LArRoI_Map.Print = False
+
+#
+# Conditions DB
+#
+include( "LArCondCnv/LArCondCnv_Config_jobOptions.py" )
+include( "LArCondCnv/LArCondCnv_IOVDbSvc_jobOptions.py" )
+
+IOVDbSvc = Service( "IOVDbSvc" )
+IOVDbSvc.serverName = LArCondCnvDbServer
+IOVDbSvc.DBname     = "conditions_ctb_2004"
+
+#IOVDbSvc.OutputLevel = DEBUG
+
+if ( not WriteNovaDB ) :
+	IOVDbSvc.userName   = "conditions"; 
+	IOVDbSvc.userPwd    = "conditions";
+else :
+	IOVDbSvc.userName   = "you_should_know_it"; 
+	IOVDbSvc.userPwd    = "otherwise_dont_try_to_write";
+	
+MasterWaveFolderName = ["/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveHigh" ,
+                        "/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveMedium" ,
+                        "/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveLow"]
+		
+if 'MasterWaveFolderTag' in dir():
+	for i in range(len(MasterWaveFolderName)) :
+		MasterWaveFolderName[i] += '<tag>'+ MasterWaveFolderTag + '</tag>'
+	IOVDbSvc.Folders += MasterWaveFolderName ;
+
+#
+# IOV
+#
+ToolSvc.FillNovaIOVTool.BeginRun   = IOVBeginRun
+ToolSvc.FillNovaIOVTool.EndRun     = IOVEndRun
+ToolSvc.FillNovaIOVTool.BeginEvent = IOVBeginEvent
+ToolSvc.FillNovaIOVTool.EndEvent   = IOVEndEvent
+
+#
+# predict physics waveforms from master waveforms
+#
+theApp.Dlls += ["LArRawUtils"]
+theApp.Dlls += ["LArTools"]
+theApp.Dlls += ["LArCalibUtils"]
+theApp.Dlls += ["LArCalibTools"]
+
+theApp.TopAlg += [ "LArRTMParamExtractor" ]
+LArRTMParamExtractor = Algorithm( "LArRTMParamExtractor" )
+LArRTMParamExtractor.KeyList     = [ "LArMasterWaveHigh" , "LArMasterWaveMedium" , "LArMasterWaveLow" ]
+LArRTMParamExtractor.TestMode    = doTest # if True processes only one wave per container
+LArRTMParamExtractor.OutputLevel = INFO
+
+ToolSvc.LArWFParamTool.OutputLevel  = VERBOSE
+
+#
+# write calibration waves and extracted parameters to ntuple
+# 
+if ( WriteNT ) :
+	theApp.TopAlg += [ "LArWFParams2Ntuple" ]
+	LArWFParams2Ntuple = Algorithm( "LArWFParams2Ntuple" )
+        LArWFParams2Ntuple.DumpCaliPulseParams = True
+        LArWFParams2Ntuple.DumpDetCellParams   = True
+	LArWFParams2Ntuple.DetStoreSuffix      = "_RTM"
+
+	if ( WriteCaliWaveNT ) :
+		theApp.TopAlg += [ "LArWaves2Ntuple<LArCaliWaveContainer>/LArCaliWaves2Ntuple"]
+		LArCaliWaves2Ntuple = Algorithm( "LArCaliWaves2Ntuple" )
+		LArCaliWaves2Ntuple.NtupleName   = "CALIWAVE"
+		LArCaliWaves2Ntuple.DACSaturSkip = False
+		LArCaliWaves2Ntuple.KeyList = [ "LArMasterWaveHigh" , "LArMasterWaveMedium" , "LArMasterWaveLow" ]
+
+	theApp.Dlls += [ "RootHistCnv" ]
+	theApp.HistogramPersistency = "ROOT"
+	NTupleSvc = Service( "NTupleSvc" )
+	NTupleSvc.Output = [ "FILE1 DATAFILE='"+NtupleFileName+"' OPT='NEW'" ]
+#
+# write extracted parameters to local POOL file
+#
+if ( WritePOOLFile ) :
+	include( "AthenaSealSvc/AthenaSealSvc_joboptions.py" )
+	AthenaSealSvc.CheckDictionary = True
+
+	include( "AthenaPoolCnvSvc/AthenaPool_jobOptions.py" )
+	theApp.Dlls += [ "LArAthenaPoolPoolCnv" ]
+	theApp.Dlls += [ "LArCondAthenaPoolPoolCnv" ]
+
+	include("RegistrationServices/OutputConditionsAlg_jobOptions.py")
+	ToolSvc.ConditionsAlgStream.OutputFile = POOLFileDir+POOLFileName
+
+	OutputConditionsAlg.ObjectList = [ "LArCaliPulseParamsComplete#LArCaliPulseParams_RTM" ,
+	                                   "LArDetCellParamsComplete#LArDetCellParams_RTM" ]
+
+	#OutputConditionsAlg.OutputLevel = DEBUG
+	#ToolSvc.ConditionsAlgStream.OutputLevel = DEBUG
+
+#
+# write extracted parameters to Nova DB
+#
+if ( WriteNovaDB ) :
+	theApp.TopAlg += [ "LArWFParams2DB" ]
+	LArWFParams2DB = Algorithm( "LArWFParams2DB" )
+	LArWFParams2DB.ParamsFolderName     = NovaDBFolder
+	LArWFParams2DB.WriteCaliPulseParams = True
+	LArWFParams2DB.WriteDetCellParams   = True
+	LArWFParams2DB.DetStoreSuffix       = "_RTM"
+	LArWFParams2DB.OutputLevel          = DEBUG
+	
+###########################################################################
+
+#AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
+#AthenaEventLoopMgr.OutputLevel = INFO
+
+#MessageSvc = Service( "MessageSvc" )
+#MessageSvc.OutputLevel = INFO
+
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_RTMPhysWaves_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_RTMPhysWaves_jobOptions.py
new file mode 100644
index 00000000000..259d88be25f
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_RTMPhysWaves_jobOptions.py
@@ -0,0 +1,266 @@
+###########################################################################
+#
+#  * read master waves from DB
+#  * predict physics waves
+#  * save waves to database/ntuples
+#
+###########################################################################
+
+MasterWaveFolderTag  = "TB04-5"
+
+doTest               = False
+storeEmpty           = False
+
+WriteNT              = True
+NtupleFileName       = "LArRTMPhysWaves-NoTimeShift.root"
+
+WritePOOLFile        = False
+POOLFileDir          = "./"
+#POOLFileDir          = "/shift/mdelmast/ctb2004/ofc/"
+#POOLFileDir          = "/data/mdelmast/ctb2004/ofc/"
+POOLFileName         = "LArRTMPhysWaves-NoTimeShift.pool.root"
+
+WriteDB              = False
+PhysWaveFolder       = "RTM"
+
+TDriftVector         = [ 420 ,  475 ,  475 ,  475 ]
+
+#
+# Use RunNumber to select MasterWaves, and change the PhysWave IOV accordingly
+#
+
+# *** All periods! (no time shift applied)
+IOVBeginRun          = 0
+IOVEndRun            = 2147483647 #0x7FFFFFFF
+RunNumber            = 2102103 # RecExTB default run
+TimeShiftGuardRegion = 0
+
+#
+# FEB-dependent time shifts
+#
+theApp.Dlls += ["LArEventTest"]
+theApp.TopAlg += ["FakeLArTimeOffset"]
+FakeLArTimeOffset=Algorithm("FakeLArTimeOffset")
+FakeLArTimeOffset.OutputLevel = INFO
+
+FakeLArTimeOffset.FEBids = [ 0x39000000, 0x39008000, 0x39010000, 0x39018000, 0x39020000, 0x39028000, 0x39030000, 
+                             0x39038000, 0x39040000, 0x39048000, 0x39050000, 0x39058000, 0x39060000, 0x39068000, 
+			     0x39080000, 0x39088000, 0x39090000, 0x39098000, 0x390a0000, 0x390a8000, 0x390b0000, 
+			     0x390b8000, 0x390c0000, 0x390c8000, 0x390d0000, 0x390d8000, 0x390e0000, 0x390e8000 ]
+
+FakeLArTimeOffset.FEbTimeOffsets  = [ 0, 0, 0, 0, 0, 0, 0, 
+                                      0, 0, 0, 0, 0, 0, 0, 
+                                      0, 0, 0, 0, 0, 0, 0, 
+				      0, 0, 0, 0, 0, 0, 0 ]
+
+#include("TimeShiftFEB.py")
+
+###########################################################################
+
+# *** General IOV settings
+IOVBeginEvent = 0
+#IOVEndEvent   = 999999
+IOVEndEvent   = 4294967295 #0xFFFFFFFF
+#IOVEndEvent   = 4294967294 #0xFFFFFFFF -1
+
+###########################################################################
+
+#LArCondCnvDbServer = "atlobk01.cern.ch"
+#LArCondCnvDbServer = "atlobk02.cern.ch"
+LArCondCnvDbServer = "atlmysql01.cern.ch"
+
+###########################################################################
+
+include( "ByteStreamCnvSvc/TBEventSelector_jobOptions.py" )
+
+#
+# Fake the reconstruciton of one event from one run to trigger the OFC retrieval
+#
+theApp.Dlls += [ "LArByteStream"]
+ByteStreamInputSvc = Service( "ByteStreamInputSvc" )
+
+include("RecExTB_SetFlags_jobOptions.py")
+
+ByteStreamInputSvc.InputDirectory += ["/castor/cern.ch/atlas/testbeam/combined/2004"]
+ByteStreamInputSvc.FilePrefix     += [FilePrefix]
+ByteStreamInputSvc.RunNumber       = [RunNumber]
+
+theApp.EvtMax = 1
+
+ByteStreamAddressProviderSvc = Service( "ByteStreamAddressProviderSvc" )
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/LOW"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/MEDIUM"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/HIGH"]
+
+#
+# Detector description (LAr only)
+#
+include( "LArDetDescr/LArDetDescr_H8_joboptions.py" )
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DoIdChecks
+DetDescrCnvSvc.LArIDFileName ="IdDictParser/IdDictLArCalorimeter_H8_2004.xml"
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.all_setOff()
+DetFlags.em_setOn() 
+
+ToolSvc = Service( "ToolSvc" )
+ToolSvc.LArRoI_Map.Print = False
+
+#
+# Conditions DB
+#
+include( "LArCondCnv/LArCondCnv_Config_jobOptions.py" )
+include( "LArCondCnv/LArCondCnv_IOVDbSvc_jobOptions.py" )
+
+IOVDbSvc = Service( "IOVDbSvc" )
+IOVDbSvc.serverName = LArCondCnvDbServer
+IOVDbSvc.DBname     = "conditions_ctb_2004"
+
+#IOVDbSvc.OutputLevel = DEBUG
+
+if ( not WriteDB ) :
+	IOVDbSvc.userName   = "conditions"; 
+	IOVDbSvc.userPwd    = "conditions";
+else :
+	IOVDbSvc.userName   = "condwriter"; 
+	IOVDbSvc.userPwd    = "pwd4writer";
+	
+MasterWaveFolderName = ["/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveHigh" ,
+                        "/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveMedium" ,
+                        "/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveLow"]
+		
+if 'MasterWaveFolderTag' in dir():
+	for i in range(len(MasterWaveFolderName)) :
+		MasterWaveFolderName[i] += '<tag>'+ MasterWaveFolderTag + '</tag>'
+	IOVDbSvc.Folders += MasterWaveFolderName ;
+
+PhysWaveFolderName = "/lar/LArElecCalibTB04/LArPhysWaveContainer/"+PhysWaveFolder
+IOVDbSvc.Folders  += [PhysWaveFolderName]
+ShapeFolderName    = "/lar/LArElecCalibTB04/LArShapeComplete/"+PhysWaveFolder
+IOVDbSvc.Folders  += [ShapeFolderName]
+IOVDbSvc.Folders  += ["/lar/LArElecCalibTB04/LArWFParams/RTMLArWFParams"]
+
+#
+# IOV
+#
+ToolSvc.FillNovaIOVTool.BeginRun   = IOVBeginRun
+ToolSvc.FillNovaIOVTool.EndRun     = IOVEndRun
+ToolSvc.FillNovaIOVTool.BeginEvent = IOVBeginEvent
+ToolSvc.FillNovaIOVTool.EndEvent   = IOVEndEvent
+
+#
+# predict physics waveforms from master waveforms
+#
+theApp.Dlls += ["LArRawUtils"]
+theApp.Dlls += ["LArTools"]
+theApp.Dlls += ["LArCalibUtils"]
+theApp.Dlls += ["LArCalibTools"]
+
+theApp.TopAlg += [ "LArRTMPhysWavePredictor" ]
+LArRTMPhysWavePredictor = Algorithm( "LArRTMPhysWavePredictor" )
+LArRTMPhysWavePredictor.KeyList             = [ "LArMasterWaveHigh" , "LArMasterWaveMedium" , "LArMasterWaveLow" ]
+LArRTMPhysWavePredictor.WFParams2Container  = True  # necessary for LArWFParams2Ntuple...
+LArRTMPhysWavePredictor.TestMode            = doTest # if True processes only one wave per container
+LArRTMPhysWavePredictor.StoreEmpty          = storeEmpty
+
+#LArRTMPhysWavePredictor.Tdrift              = [  420 ,  475 ,  475 ,  475 ] # drift times for PS and EMC samplings
+#LArRTMPhysWavePredictor.Tdrift              = [  400 ,  400 ,  400 ,  400 ] # drift times for PS and EMC samplings
+LArRTMPhysWavePredictor.Tdrift              = TDriftVector
+
+LArRTMPhysWavePredictor.UseDoubleTriangle   = False
+LArRTMPhysWavePredictor.Tdrift2             = [ 1200 , 1200 , 1200 , 1200 ]
+LArRTMPhysWavePredictor.WeightTriangle2     = [ 0.01 , 0.01 , 0.01 , 0.01 ] 
+
+LArRTMPhysWavePredictor.TimeShiftByHelper     = False
+LArRTMPhysWavePredictor.TimeShiftByIndex      = -1
+LArRTMPhysWavePredictor.TimeShiftByLayer      = False
+LArRTMPhysWavePredictor.Tshift                = [ 13 , 23 , 4 , 8 ] # time shifts for PS and EMC samplings
+LArRTMPhysWavePredictor.TimeShiftByFEB        = False
+LArRTMPhysWavePredictor.TimeShiftGuardRegion  = TimeShiftGuardRegion ;
+
+LArRTMPhysWavePredictor.ComputeTimeShiftByFEB = True
+
+ToolSvc.LArPhysWaveTool.NormalizeCali    = True
+#ToolSvc.LArPhysWaveTool.InjPointCorr     = True # use defaults for barrel layers, otherwise don't apply!
+ToolSvc.LArPhysWaveTool.TimeOriginShift  = False
+ToolSvc.LArPhysWaveTool.SubtractBaseline = False
+
+#
+# write master and phys waves and parameters to database
+# 
+if ( WriteDB ) :
+	LArRTMPhysWavePredictor.WriteDB            = True
+	LArRTMPhysWavePredictor.PhysWaveFolderName = PhysWaveFolder
+
+#
+# write master and phys waves and parameters to ntuples
+# 
+if ( WriteNT ) :
+	theApp.TopAlg += [ "LArWaves2Ntuple<LArCaliWaveContainer>/LArCaliWaves2Ntuple"]
+	LArCaliWaves2Ntuple = Algorithm( "LArCaliWaves2Ntuple" )
+	LArCaliWaves2Ntuple.NtupleName   = "CALIWAVE"
+	LArCaliWaves2Ntuple.DACSaturSkip = False
+	LArCaliWaves2Ntuple.KeyList = [ "LArMasterWaveHigh" , "LArMasterWaveMedium" , "LArMasterWaveLow" ]
+#
+# Note: the phys wave container has the same name as the used cali wave container:
+#
+	theApp.TopAlg += [ "LArWaves2Ntuple<LArPhysWaveContainer>/LArPhysWaves2Ntuple"]
+	LArPhysWaves2Ntuple = Algorithm( "LArPhysWaves2Ntuple" )
+	LArPhysWaves2Ntuple.NtupleName   = "PHYSWAVE" 
+	LArPhysWaves2Ntuple.DACSaturSkip = False
+	LArPhysWaves2Ntuple.KeyList = [ "LArMasterWaveHigh" , "LArMasterWaveMedium" , "LArMasterWaveLow" ]
+#
+# Note the params container has the same name as the used cali wave container:
+#
+	theApp.TopAlg += [ "LArWFParams2Ntuple" ]
+	LArWFParams2Ntuple = Algorithm( "LArWFParams2Ntuple" )
+	LArWFParams2Ntuple.KeyList = [ "LArMasterWaveHigh" , "LArMasterWaveMedium" , "LArMasterWaveLow" ]
+        LArWFParams2Ntuple.DumpCaliPulseParams = True
+        LArWFParams2Ntuple.DumpDetCellParams   = True
+        LArWFParams2Ntuple.DumpPhysCaliTdiff   = True
+        LArWFParams2Ntuple.DumpTdrift          = True
+	LArWFParams2Ntuple.DetStoreSuffix      = "_RTM"
+
+if ( WritePOOLFile ) :
+	include( "AthenaSealSvc/AthenaSealSvc_joboptions.py" )
+	AthenaSealSvc.CheckDictionary = True 
+
+	include( "AthenaPoolCnvSvc/AthenaPool_jobOptions.py" )
+	theApp.Dlls   += [ "LArAthenaPoolPoolCnv" ]
+	theApp.Dlls   += [ "LArCondAthenaPoolPoolCnv" ]
+
+	include("RegistrationServices/OutputConditionsAlg_jobOptions.py")
+	ToolSvc.ConditionsAlgStream.OutputFile = POOLFileDir+POOLFileName
+	OutputConditionsAlg.ObjectList = [ "LArPhysWave" ]
+	OutputConditionsAlg.ObjectList = [ "LArPhysWaveContainer#LArMasterWaveHigh" ,
+	                                   "LArPhysWaveContainer#LArMasterWaveMedium" ,
+					   "LArPhysWaveContainer#LArMasterWaveLow" ]
+	
+	OutputConditionsAlg.OutputLevel = DEBUG
+	ToolSvc.ConditionsAlgStream.OutputLevel = DEBUG
+
+#
+# output levels
+#
+LArRTMPhysWavePredictor.OutputLevel = INFO
+ToolSvc.LArWFParamTool.OutputLevel  = INFO
+ToolSvc.LArPhysWaveTool.OutputLevel = INFO
+if ( WriteNT ) :
+	LArCaliWaves2Ntuple.OutputLevel = INFO
+	LArPhysWaves2Ntuple.OutputLevel = INFO
+	LArWFParams2Ntuple.OutputLevel  = INFO
+if ( WriteDB ) :
+	IOVDbSvc.OutputLevel = INFO
+
+theApp.Dlls += [ "RootHistCnv" ]
+theApp.HistogramPersistency = "ROOT"
+NTupleSvc = Service( "NTupleSvc" )
+NTupleSvc.Output = [ "FILE1 DATAFILE='"+NtupleFileName+"' OPT='NEW'" ]
+
+AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
+AthenaEventLoopMgr.OutputLevel = INFO
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel = INFO
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_Ramp_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_Ramp_jobOptions.py
new file mode 100644
index 00000000000..1968221f8a9
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_Ramp_jobOptions.py
@@ -0,0 +1,108 @@
+# *******************************************************************
+# JobOptions file to produce ramps
+#
+# 15/08/2005 S. Laplace (laplace@lapp.in2p3.fr)
+# *******************************************************************
+
+include( "ByteStreamCnvSvc/TBEventSelector_jobOptions.py" )
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.Calo_setOn()
+DetFlags.ID_setOff()
+DetFlags.Muon_setOff()
+DetFlags.Truth_setOff()
+DetFlags.LVL1_setOff()
+DetFlags.digitize.all_setOff()
+
+theApp.Dlls += [ "LArByteStream"]
+
+ByteStreamInputSvc = Service( "ByteStreamInputSvc" )
+
+ByteStreamAddressProviderSvc = Service( "ByteStreamAddressProviderSvc" )
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/MEDIUM"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/HIGH"]
+
+# Three input files (for H8): accordion HG, accordion MG, PS (HG only)
+ByteStreamInputSvc.FullFileName += ["/castor/cern.ch/atlas/testbeam/lar/2004/daq_ROS-41_LargCalib_0005134_file01.data"]
+ByteStreamInputSvc.FullFileName += ["/castor/cern.ch/atlas/testbeam/lar/2004/daq_ROS-41_LargCalib_0005135_file01.data"]
+ByteStreamInputSvc.FullFileName += ["/castor/cern.ch/atlas/testbeam/lar/2004/daq_ROS-41_LargCalib_0005136_file01.data"]
+
+
+include( "LArDetMgrDetDescrCnv/LArDetMgrDetDescrCnv_H8_joboptions.py" )
+
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DoIdChecks
+
+ToolSvc = Service( "ToolSvc" )
+ToolSvc.LArRoI_Map.Print=FALSE
+
+include("LArCondCnv/LArCondCnv_TB04_jobOptions.py")
+IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArCalibParams"]
+IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArPedestal"]
+IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArCaliWaves/LArCaliWaveHigh"]
+IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArCaliWaves/LArCaliWaveMedium"]
+
+
+theApp.Dlls += ["LArRawUtils"]
+theApp.Dlls += ["LArTools"]
+theApp.Dlls += ["LArCalibUtils"]
+theApp.Dlls += ["LArCalibTools"]
+theApp.Dlls += ["LArRecUtils"]
+theApp.Dlls += ["LArROD"]
+
+theApp.topAlg+=["LArCalibDigitsAccumulator"]
+LArCalibDigitsAccumulator=Algorithm("LArCalibDigitsAccumulator")
+LArCalibDigitsAccumulator.KeyList+=["HIGH"]
+LArCalibDigitsAccumulator.KeyList+=["MEDIUM"]
+
+theApp.topAlg+=["LArRampBuilder"]
+LArRampBuilder=Algorithm("LArRampBuilder")
+LArRampBuilder.KeyList+=["HIGH"]
+LArRampBuilder.KeyList+=["MEDIUM"]
+LArRampBuilder.SubtractDac0=TRUE
+LArRampBuilder.DAC0=0
+LArRampBuilder.StoreRawRamp=TRUE
+LArRampBuilder.StoreRecRamp=TRUE
+LArRampBuilder.Polynom=2
+# Set to true if want to write Ramps into DB (use with great care !)
+LArRampBuilder.WriteDB=FALSE
+LArRampBuilder.RampRange = 3000;
+# Reco can by Parabola or Shape. If Parabola, use correctBias=True (H8 only)
+#LArRampBuilder.RecoType="Shape"
+LArRampBuilder.RecoType="Parabola"
+LArRampBuilder.correctBias=True
+
+# output ntuples
+theApp.topAlg+=["LArAverages2Ntuple/averageshigh"]
+averageshigh=Algorithm("averageshigh")
+averageshigh.containerKey="HIGH"
+
+theApp.topAlg+=["LArAverages2Ntuple/averagesmedium"]
+averagesmedium=Algorithm("averagesmedium")
+averagesmedium.containerKey="MEDIUM"
+
+theApp.topAlg+=["LArRamps2Ntuple/rampshigh"]
+rampshigh=Algorithm("rampshigh")
+rampshigh.containerKey="HIGH"
+
+theApp.topAlg+=["LArRamps2Ntuple/rampsmedium"]
+rampsmedium=Algorithm("rampsmedium")
+rampsmedium.containerKey="MEDIUM"
+
+
+theApp.Dlls += [ "RootHistCnv" ]
+theApp.HistogramPersistency = "ROOT"
+NTupleSvc = Service( "NTupleSvc" )
+
+NTupleSvc.Output    = [ "FILE1 DATAFILE='LArAverages.root' OPT='NEW'" ]
+
+
+AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
+AthenaEventLoopMgr.OutputLevel=ERROR
+
+MessageSvc.OutputLevel=INFO
+#MessageSvc.OutputLevel=DEBUG
+MessageSvc.defaultLimit=1000000;
+
+#StoreGateSvc=Service("StoreGateSvc");
+#StoreGateSvc.dump=TRUE
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_TCMPhysWaves_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_TCMPhysWaves_jobOptions.py
new file mode 100644
index 00000000000..9870c7d3667
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_TCMPhysWaves_jobOptions.py
@@ -0,0 +1,190 @@
+###########################################################################
+#
+# Example jobOptions to run TCM fit (LArTCmPhysWavePredictor)
+#
+###########################################################################
+#
+# Main steering options
+#
+###########################################################################
+
+PhysWaveFolder = ["/lar/LArElecCalibTB04/LArPhysWaveContainer/LArPhysWave"]
+PhysWaveTag    = ""
+
+CaliWaveFolder = ["/lar/LArElecCalibTB04/LArCaliWaves/LArCaliWaveHigh"]
+CaliWaveTag    = ""
+
+LArCondCnvDbServer = "atlmysql01.cern.ch"
+
+#
+# Select run number to trigger IOV
+#
+
+RunDir    = "/castor/cern.ch/atlas/testbeam/combined/2004"
+RunPrefix = "daq_SFI-51_calo"
+RunNumber = 1004019
+
+#
+# IOV (if DB writing of predicted LArPhysWave and LArShape is enabled)
+#
+WriteNovaDB   = False
+IOVBeginRun   = 0
+IOVEndRun     = 2147483647 # 0x7FFFFFFF
+IOVBeginEvent = 0
+IOVEndEvent   = 4294967295 #0xFFFFFFFF
+
+#
+# ROOT file(s) with predicted physics wave and parameters
+# Note: LArTCMPhysWavePredictor also outputs  custom ROOT file called "LArTCMPred.root"
+#
+WriteNtuple    = True 
+NtupleFileName = "LArTCMOutput.root" #  (uses LArCalibTools)
+
+###########################################################################
+#
+# Fake the reconstruction of one event from one run to trigger IOV
+#
+include( "ByteStreamCnvSvc/TBEventSelector_jobOptions.py" )
+
+theApp.Dlls += [ "LArByteStream"]
+ByteStreamInputSvc = Service( "ByteStreamInputSvc" )
+
+ByteStreamInputSvc.InputDirectory += [RunDir]
+ByteStreamInputSvc.FilePrefix     += [RunPrefix]
+ByteStreamInputSvc.RunNumber       = [RunNumber]
+
+theApp.EvtMax = 1
+
+ByteStreamAddressProviderSvc = Service( "ByteStreamAddressProviderSvc" )
+ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/FREE"]
+
+#
+# Detector description (LAr only)
+#
+include( "LArDetMgrDetDescrCnv/LArDetMgrDetDescrCnv_H8_joboptions.py" )
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DoIdChecks
+DetDescrCnvSvc.LArIDFileName = "IdDictParser/IdDictLArCalorimeter_H8_2004.xml"
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.all_setOff()
+DetFlags.em_setOn() 
+
+ToolSvc = Service( "ToolSvc" )
+ToolSvc.LArRoI_Map.Print = False
+                                       
+#
+# Condition Database (read cumulated Physics waves and Calibration Waves)
+#
+include( "LArCondCnv/LArCondCnv_Config_jobOptions.py" )
+include( "LArCondCnv/LArCondCnv_IOVDbSvc_jobOptions.py" )
+
+IOVDbSvc = Service( "IOVDbSvc" )
+
+IOVDbSvc.serverName = LArCondCnvDbServer
+IOVDbSvc.DBname     = "conditions_ctb_2004"
+if ( not WriteNovaDB ) :
+        IOVDbSvc.userName   = "conditions" 
+        IOVDbSvc.userPwd    = "conditions"
+if ( WriteNovaDB ) :
+        IOVDbSvc.userName   = "you_should_know_it" 
+        IOVDbSvc.userPwd    = "othewise_do_not_attempt_to_write"
+
+if 'PhysWaveTag' in dir():
+	for i in range(len(PhysWaveFolder)) :
+		PhysWaveFolder[i] += '<tag>'+ PhysWaveTag + '</tag>'
+
+if 'CaliWaveTag' in dir():
+	for i in range(len(CaliWaveFolder)) :
+		CaliWaveFolder[i] += '<tag>'+ CaliWaveTag + '</tag>'
+
+IOVDbSvc.Folders += PhysWaveFolder
+IOVDbSvc.Folders += CaliWaveFolder
+
+#
+# IOV
+#
+ToolSvc.FillNovaIOVTool.BeginRun   = IOVBeginRun
+ToolSvc.FillNovaIOVTool.EndRun     = IOVEndRun
+ToolSvc.FillNovaIOVTool.BeginEvent = IOVBeginEvent
+ToolSvc.FillNovaIOVTool.EndEvent   = IOVEndEvent
+
+###########################################################################
+#
+# LArTCMPhysWavePredictor settings
+#
+###########################################################################
+
+#theApp.Dlls += ["LArRawUtils"]
+#theApp.Dlls += ["LArTools"]
+theApp.Dlls += ["LArCalibUtils"]
+
+theApp.TopAlg += ["LArTCMPhysWavePredictor"]
+LArTCMPhysWavePredictor = Algorithm( "LArTCMPhysWavePredictor" )
+
+LArTCMPhysWavePredictor.TestMode          = True
+LArTCMPhysWavePredictor.OutputLevel       = DEBUG
+
+LArTCMPhysWavePredictor.DataFromFile      = False # for debug, to use self file from emtb
+LArTCMPhysWavePredictor.KeyList           = ["LArCaliWaveHigh","LArCaliWaveMedium","LArCaliWaveLow"] ;
+LArTCMPhysWavePredictor.MinuitOutputLevel = 1    # -1 no output, 1 std output
+LArTCMPhysWavePredictor.RootRawDump       = True # dump all data to root file
+LArTCMPhysWavePredictor.RootOutputFile    = "LArTCMPred.root"
+
+LArTCMPhysWavePredictor.FilterCells = True # global switch of filter cells
+
+# this option is not yet implemented, should be merged from branch LArCalibUtils-00-02-03-TCMfit-01
+#LArTCMPhysWavePredictor.FilterCells_Region_Barrel_End = True; # switch for barrel end region
+
+LArTCMPhysWavePredictor.FilterCells_Layer = 2
+
+LArTCMPhysWavePredictor.FilterCells_Phi = True
+LArTCMPhysWavePredictor.FilterCells_Phi_Min = 7
+LArTCMPhysWavePredictor.FilterCells_Phi_Max = 9
+
+LArTCMPhysWavePredictor.FilterCells_Eta = True 
+LArTCMPhysWavePredictor.FilterCells_Eta_Min = 0
+LArTCMPhysWavePredictor.FilterCells_Eta_Max = 31
+
+LArTCMPhysWavePredictor.WriteDB    = WriteNovaDB
+LArTCMPhysWavePredictor.FolderName = "LArElecCalibTB04" 
+LArTCMPhysWavePredictor.FolderName_LArPhysWave      = "/lar/LArElecCalibTB04/LArPhysWaveContainer/TCM"   #  folder for writing predicted LArPhysWave
+# this option is not yet implemented, should be merged from branch LArCalibUtils-00-02-03-TCMfit-01
+#LArTCMPhysWavePredictor.FolderName_LArShapeComplete = "/lar/LArElecCalibTB04/LArShapeComplete/TCM"       # folder for writing LArWFParams
+LArTCMPhysWavePredictor.FolderName_WFParams         = "/lar/LArElecCalibTB04/LArWFParams/TCMLArWFParams" # folder for writing LArWFParams
+
+###########################################################################
+#
+# write predicted  phys waves and parameters to ntuples
+# 
+if ( WriteNtuple ) :
+	theApp.Dlls += ["LArCalibTools"]
+#
+# Note: the predicted phys wave container has "LArPhysWavesTCM"
+#
+        theApp.TopAlg += [ "LArWaves2Ntuple/LArPhysWaves2Ntuple"]
+        LArPhysWaves2Ntuple = Algorithm( "LArPhysWaves2Ntuple" )
+        LArPhysWaves2Ntuple.NtupleName   = "PHYSWAVE" 
+        LArPhysWaves2Ntuple.ReadCaliWave = False
+        LArPhysWaves2Ntuple.KeyList = [ "LArPhysWavesTCM" ]
+#
+# Note the params container has key "LArWFParamsTCM"
+#
+        theApp.TopAlg += [ "LArWFParams2Ntuple" ]
+        LArWFParams2Ntuple = Algorithm( "LArWFParams2Ntuple" )
+        LArWFParams2Ntuple.KeyList = [ "LArWFParamsTCM" ]
+
+	theApp.Dlls += [ "RootHistCnv" ]
+	theApp.HistogramPersistency = "ROOT"
+	NTupleSvc = Service( "NTupleSvc" )
+	NTupleSvc.Output = [ "FILE1 DATAFILE='"+NtupleFileName+"' OPT='NEW'" ]
+
+###########################################################################
+
+AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
+AthenaEventLoopMgr.OutputLevel = INFO
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel = INFO
+
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_TimeTuning_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_TimeTuning_jobOptions.py
new file mode 100644
index 00000000000..b9f57d08b53
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_TimeTuning_jobOptions.py
@@ -0,0 +1,165 @@
+###############################################################################
+#
+# jobOptions to compute OFC Timing Offsets using the Time Tuning algorithm
+#
+###############################################################################
+
+# Data file to be used
+#
+InputDirectory = "/castor/cern.ch/atlas/testbeam/combined/2004" 
+FilePrefix     = "daq_SFI-51_calo"
+RunNumber      = 1004054
+
+# OFC to be used
+#
+useTCMOFC      = False
+useRTMOFC      = True
+LArTB04FolderTag_OFC_RTM = "TB04-Default"
+#LArTB04FolderTag_OFC_RTM = "TB04-2"
+#LArTB04FolderTag_OFC_RTM = "OFC-test-3"
+#LArTB04FolderTag_OFC_RTM = "OFC-test-4"
+#LArTB04FolderTag_OFC_RTM = "OFC-test-5"
+#LArTB04FolderTag_OFC_RTM = "OFC-test-6"
+
+# Preset timing offsets...
+#
+useTimeOffsets = False # use LArTBRec/LArTimeOffsets_OFC_XXX.py (XXX = RTM, TCM)
+
+# ... or directly set the timing offsets by hand:
+#
+#theApp.TopAlg +=["FakeLArTimeOffset"]
+#FakeLArTimeOffset=Algorithm("FakeLArTimeOffset")
+#FakeLArTimeOffset.OutputLevel = INFO
+#FakeLArTimeOffset.GlobalTimeOffset = 0.
+#FakeLArTimeOffset.FEBids          += [ 0x39000000, 0x39008000, 0x39010000, 0x39018000, 0x39020000, 0x39028000, 0x39030000, 0x39038000, 0x39040000, 0x39048000, 0x39050000, 0x39058000, 0x39060000, 0x39068000, 0x39080000, 0x39088000, 0x39090000, 0x39098000, 0x390a0000, 0x390a8000, 0x390b0000, 0x390b8000, 0x390c0000, 0x390c8000, 0x390d0000, 0x390d8000, 0x390e0000, 0x390e8000 ]
+#FakeLArTimeOffset.FEbTimeOffsets  += [ 6.13258, 0, 0, 15.3924, 0, 0, 0, 0, 0, 0, 0, 17.7146, 0, 0, 0.949009, 0, 0, 11.9441, 0, 0, 0, 0, 9.79891, 0, 0, 7.14886, 0, 0 ]
+
+#
+# Time Tuning main steering options
+#
+doTest         = True	# use only the first 1000 events
+doGlobal       = False	# compute Global Timing Offsets
+doFEB          = True	# compute FEB Timing Offsets
+doCell         = False	# compute Cell Timing Offsets
+
+###############################################################################
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.all_setOff()
+DetFlags.em_setOn() 
+
+# Read Beam Instruments
+include( "TBCnv/TBReadH8BS_jobOptions.py")
+
+# File location
+include( "ByteStreamCnvSvc/TBEventSelector_jobOptions.py" )
+ByteStreamInputSvc=Service("ByteStreamInputSvc")
+ByteStreamInputSvc.InputDirectory += [ InputDirectory ]
+ByteStreamInputSvc.FilePrefix     += [ FilePrefix ]
+ByteStreamInputSvc.RunNumber       = [ RunNumber ]
+
+# Read LArDigit
+theApp.Dlls += [ "LArByteStream" ]
+ByteStreamAddressProviderSvc = Service( "ByteStreamAddressProviderSvc" )
+ByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/FREE"]
+
+include( "LArDetDescr/LArDetDescr_H8_joboptions.py" )
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DoIdChecks
+DetDescrCnvSvc.LArIDFileName ="IdDictParser/IdDictLArCalorimeter_H8_2004.xml"
+
+ToolSvc = Service( "ToolSvc" )
+ToolSvc.LArRoI_Map.Print = False
+ToolSvc.LArRodDecoder.FirstSample = 2
+
+#
+# Time tuning
+#
+
+theApp.Dlls += ["LArRawUtils", "LArROD", "LArTools", "LArEventTest", "LArCalibUtils" ]
+
+#
+# Fix for swapped LArFEBs
+#
+ToolSvc = Service( "ToolSvc" )
+if ( RunNumber >= 1000931 ):
+	if (RunNumber<=1000969):
+		ToolSvc.LArRodDecoder.FebExchange = True
+		ToolSvc.LArRodDecoder.FebId1 = 0x39020000
+		ToolSvc.LArRodDecoder.FebId2 = 0x39040000
+
+# OFC database
+#include("LArCondCnv/LArCondCnv_TB04_jobOptions.py")
+include("LArCondCnv_TB04_jobOptions.py")
+
+# TBPhase reconstruction
+theApp.Dlls+=["TBRec"]
+theApp.TopAlg+=["TBPhaseRec"]
+TBPhaseRec=Algorithm("TBPhaseRec")
+include("TBRec/H8PhaseRec_jobOptions.py")
+
+# Time offsets
+if useTimeOffsets:
+	if useRTMOFC :
+		include("LArTBRec/LArTimeOffsets_OFC_RTM.py")
+	if useTCMOFC :
+		include("LArTBRec/LArTimeOffsets_OFC_TCM.py")
+
+# Time tuning iterations, monitoring and output
+theApp.Dlls += [ "RootHistCnv" ]
+theApp.HistogramPersistency = "ROOT"
+NTupleSvc = Service( "NTupleSvc" )
+
+theApp.TopAlg+=["LArTimeTuning","LArTimeTuningNtuple",]
+LArTimeTuning = Algorithm("LArTimeTuning")
+LArTimeTuningNtuple= Algorithm("LArTimeTuningNtuple");
+
+LArTimeTuning.NOFCPhases          = 50
+LArTimeTuning.NOFCTimeBins        = 24
+LArTimeTuning.UseOFCPhase         = False
+LArTimeTuning.BinHalfOffset       = False
+LArTimeTuning.AllowTimeSampleJump = True
+
+LArTimeTuning.OFCTimePrecision    = 0.5*ns
+LArTimeTuning.SaveRemainingError  = True
+LArTimeTuning.MaxIterations       = 10
+LArTimeTuning.ADCCut              = 1400
+
+LArTimeTuning.PhaseInversion      = True
+LArTimeTuning.CorrectionSign      = +1
+
+#LArTimeTuning.LayerSelection      = 2
+#LArTimeTuning.GainSelection       = "HIGH"
+
+LArTimeTuning.OutputLevel          = INFO
+
+if doGlobal:
+	LArTimeTuning.Scope                     = "GLOBAL"
+	LArTimeTuning.GlobalTimeOffsetOutKey    = "TimeOffset"
+	LArTimeTuningNtuple.GlobalTimeOffsetKey = "TimeOffset"
+	NTupleSvc.Output = [ "FILE1 DATAFILE='LArTimeTuning_GLOBAL.root' OPT='NEW'" ]
+
+if doFEB:
+	LArTimeTuning.Scope                     = "FEB"
+	LArTimeTuning.FebTimeOffsetOutKey       = "LArFebTimeOffset"
+	LArTimeTuningNtuple.FebTimeOffsetKey    = "LArFebTimeOffset"
+	NTupleSvc.Output = [ "FILE1 DATAFILE='LArTimeTuning_FEB.root' OPT='NEW'" ]
+
+if doCell:
+	LArTimeTuning.Scope                     = "CELL"
+	LArTimeTuning.CellTimeOffsetOutKey      = "LArCellTimeOffset"
+	LArTimeTuningNtuple.CellTimeOffsetKey   = "LArCellTimeOffset"
+	NTupleSvc.Output = [ "FILE1 DATAFILE='LArTimeTuning_CELL.root' OPT='NEW'" ]
+
+if doTest :
+	theApp.EvtMax = 1000
+	
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel  = INFO
+MessageSvc.defaultLimit = 1000000;
+MessageSvc.Format       = "% F%40W%S%7W%R%T %0W%M"
+
+
+AthenaEventLoopMgr = Service( "AthenaEventLoopMgr" )
+AthenaEventLoopMgr.FailureMode = 2
+AthenaEventLoopMgr.OutputLevel = INFO
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_WriteWFParams2DB_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_WriteWFParams2DB_jobOptions.py
new file mode 100644
index 00000000000..00f72373b4b
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CTB04_WriteWFParams2DB_jobOptions.py
@@ -0,0 +1,121 @@
+###########################################################################
+#
+#  * this jobOption is written to test functionality of calibration data classes
+#    LArCaliPulseParamsComplete, LArDetCellParamsComplete, LArPhysCaliTdiffComplete,
+#    LArTdriftComplete
+#
+#  * performed operations are:
+#
+#    - read master waves from DB
+#    - extract wfparams and predict physics waves (LArPhysWavePredictor)
+#    - save wfparams to DB folders LArCaliPulseParams, LArDetCellParams,
+#      LArPhysCaliTdiff, LArTdrift
+#    - save waves to ntuples (if requested)
+#
+###########################################################################
+
+# include ("RecExCommon/RecExCommon_flags.py")
+# DetFlags.ID_setOff()
+# DetFlags.Muon_setOff()
+# include ("RecExCommon/RecExCommon_topOptions.py")
+
+include( "ByteStreamCnvSvc/TBEventSelector_jobOptions.py" )
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DetectorManagers += ["CaloTTDescrManager"]
+DetDescrCnvSvc.DetectorManagers += ["CaloMgr"]
+
+LArCondCnvDbServer = 'atlmysql01.cern.ch'
+
+theApp.Dlls += [ "LArByteStream"]
+
+ByteStreamInputSvc = Service( "ByteStreamInputSvc" )
+ByteStreamInputSvc.InputDirectory += ["/castor/cern.ch/atlas/testbeam/lar/2004"]
+ByteStreamInputSvc.FilePrefix += ["daq_ROS-41_LargCalib"]
+ByteStreamInputSvc.RunNumber = [3144]
+theApp.EvtMax = 1
+
+ByteStreamAddressProviderSvc = Service( "ByteStreamAddressProviderSvc" )
+
+ByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/LOW"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/MEDIUM"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/HIGH"]
+#ByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/FREE"]
+
+# include( "LArDetMgrDetDescrCnv/LArDetMgrDetDescrCnv_H8_joboptions.py" )
+include( "LArDetDescr/LArDetDescr_H8_joboptions.py" )
+
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DoIdChecks
+
+ToolSvc = Service( "ToolSvc" )
+ToolSvc.LArRoI_Map.Print=FALSE
+
+#obsolete!
+# include("LArCondCnv_CalibTB04_jobOptions.py")
+# include("my_LArCondCnv_TB04_jobOptions.py")
+include( "LArCondCnv/LArCondCnv_Config_jobOptions.py" )
+include( "LArCondCnv/LArCondCnv_IOVDbSvc_jobOptions.py" )
+
+LArCondCnvSvc = Service( "LArCondCnvSvc" )
+
+theApp.Dlls += [ "IOVDbSvc" ]
+ProxyProviderSvc = Service( "ProxyProviderSvc" )
+ProxyProviderSvc.ProviderNames += [ "IOVDbSvc" ]
+
+IOVDbSvc.serverName = LArCondCnvDbServer
+IOVDbSvc.DBname     = "conditions_ctb_2004"; 
+IOVDbSvc.userName   = "condwriter"; 
+IOVDbSvc.userPwd    = "pwd4writer"; 
+
+IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArCalibParams"]
+IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArPedestal"]
+
+IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveHigh"]
+IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveMedium"]
+IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveLow"]
+
+ToolSvc.FillNovaIOVTool.BeginRun   = 0
+ToolSvc.FillNovaIOVTool.EndRun     = 9000000
+ToolSvc.FillNovaIOVTool.BeginEvent = 0
+ToolSvc.FillNovaIOVTool.EndEvent   = 999999
+
+theApp.Dlls += ["LArRawUtils"]
+theApp.Dlls += ["LArTools"]
+theApp.Dlls += ["LArCalibUtils"]
+theApp.Dlls += ["LArCalibTools"]
+
+#
+# extract parameters and predict physics waveforms from master waveforms
+#
+theApp.TopAlg += [ "LArPhysWavePredictor" ]
+LArPhysWavePredictor=Algorithm( "LArPhysWavePredictor" )
+LArPhysWavePredictor.OutputLevel = INFO
+LArPhysWavePredictor.TestMode = TRUE # only one wave per container, to speed up test
+LArPhysWavePredictor.KeyList=[ "LArMasterWaveHigh" , "LArMasterWaveMedium" , "LArMasterWaveLow" ]
+# LArPhysWavePredictor.Tdrift       = [ 420 , 475 , 475 , 475 ]   # drift time for the four layers
+# LArPhysWavePredictor.TimeShift = TRUE
+ToolSvc.LArPhysWaveTool.NormalizeCali    = TRUE
+LArPhysWavePredictor.WriteDB = FALSE
+
+theApp.TopAlg += [ "LArWFParams2DB" ]
+LArWFParams2DB=Algorithm( "LArWFParams2DB" )
+LArWFParams2DB.OutputLevel = DEBUG
+# LArWFParams2DB.ParamsFolderName = "test"
+# LArWFParams2DB.WriteCaliPulseParams = False
+# LArWFParams2DB.WriteDetCellParams = False
+# LArWFParams2DB.WriteTdiff = False
+# LArWFParams2DB.WriteTdrift = False
+
+IOVDbSvc.OutputLevel = INFO
+
+theApp.Dlls += [ "RootHistCnv" ]
+theApp.HistogramPersistency = "ROOT"
+NTupleSvc = Service( "NTupleSvc" )
+NTupleSvc.Output = [ "FILE1 DATAFILE='LArWaves.root' OPT='NEW'" ]
+
+AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
+AthenaEventLoopMgr.OutputLevel=ERROR
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel = WARNING
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CaliWaveMerger_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CaliWaveMerger_jobOptions.py
new file mode 100644
index 00000000000..7ca3639c899
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CaliWaveMerger_jobOptions.py
@@ -0,0 +1,133 @@
+###########################################################################
+#
+# Example jobOptions to merge several LArCaliWaveContainers into one
+#
+# Last update: 30/11/2007 <Marco.Delmastro@cern.ch>
+#
+# Note: Works with release 13.0.x, need  migration to 13.x.0
+#
+###########################################################################
+
+if not 'PoolFileList' in dir():
+	print "Please provide a PoolFileList!"
+	theApp.exit()
+	
+if not 'ContainerKeyList' in dir():
+	print "Please provide a ContainerKeyList!"
+	theApp.exit()
+
+if not 'PoolFileDir' in dir():
+	PoolFileDir = "." 
+
+if not 'KeyOutput' in dir():
+	KeyOutput = "LArCaliWave"
+
+if not 'BaseName' in dir():
+	BaseName  = "LArCaliWaveMerger"
+
+if not 'WritePoolFile' in dir():
+	WritePoolFile = True
+
+if not 'WriteRootFile' in dir():
+	WriteRootFile = False
+
+if not 'GroupingType' in dir():
+	GroupingType = "ExtendedSubDetector"
+
+if not 'OutDir' in dir():
+	OutDir = "."
+PoolFileName = OutDir+"/"+BaseName+".pool.root"
+RootFileName = OutDir+"/"+BaseName+".root"
+
+###########################################################################
+#
+# Global settings
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+ToolSvc = Service("ToolSvc")
+ToolSvc.LArRoI_Map.Print = False
+
+###############################################################################
+#
+# Read POOL file(s)
+#
+###############################################################################
+
+include("AthenaSealSvc/AthenaSealSvc_joboptions.py")
+AthenaSealSvc.CheckDictionary = True 
+
+include( "AthenaPoolCnvSvc/AthenaPool_jobOptions.py" )
+
+CondProxyProvider = Service( "CondProxyProvider" )
+ProxyProviderSvc  = Service( "ProxyProviderSvc" )
+ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+CondProxyProvider.InputCollections += PoolFileList
+
+EventPersistencySvc = Service( "EventPersistencySvc" )
+EventPersistencySvc.CnvServices += [ "AthenaPoolCnvSvc" ]
+
+###############################################################################
+#
+# Merge LArCaliWaveContainers
+#
+###############################################################################
+
+from LArCalibUtils.LArCalibUtilsConf import LArCaliWaveMerger
+LArCaliWaveMerger = Algorithm("LArCaliWaveMerger")
+LArCaliWaveMerger.KeyList      = ContainerKeyList
+LArCaliWaveMerger.KeyOutput    = KeyOutput
+LArCaliWaveMerger.GroupingType = GroupingType
+LArCaliWaveMerger.OutputLevel  = DEBUG
+topSequence += LArCaliWaveMerger
+
+if ( WriteRootFile ) :
+	
+	from LArCalibTools.LArCalibToolsConf import LArWave2Ntuple as LArCaliWaves2Ntuple
+	LArCaliWaves2Ntuple = LArCaliWaves2Ntuple("LArCaliWaves2Ntuple")
+	LArCaliWaves2Ntuple.NtupleName = "CALIWAVE"
+	LArCaliWaves2Ntuple.KeyList    = [ KeyOutput ]
+	topSequence += LArCaliWaves2Ntuple
+	
+	theApp.HistogramPersistency = "ROOT"
+	NTupleSvc = Service( "NTupleSvc" )
+	NTupleSvc.Output = [ "FILE1 DATAFILE='"+RootFileName+"' OPT='NEW'" ]
+
+if ( WritePoolFile ) :
+
+        include( "AthenaSealSvc/AthenaSealSvc_joboptions.py" )
+        AthenaSealSvc.CheckDictionary = True 
+
+        include( "AthenaPoolCnvSvc/AthenaPool_jobOptions.py" )
+
+        include("RegistrationServices/OutputConditionsAlg_jobOptions.py")
+        ToolSvc.ConditionsAlgStream.OutputFile = PoolFileName
+        OutputConditionsAlg.ObjectList = [ "LArCaliWaveContainer#"+KeyOutput]
+
+###########################################################################
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel  = INFO
+MessageSvc.defaultLimit = 1000;
+
+if not 'VerboseOutput' in dir():
+	VerboseOutput = False
+	
+if ( VerboseOutput):
+	StoreGateSvc = Service( "StoreGateSvc" )
+	StoreGateSvc.Dump = True
+	DetectorStore = Service( "DetectorStore" )
+	DetectorStore.Dump = True
+	ConditionsStore = Service( "ConditionsStore" )
+	ConditionsStore.Dump = True
+
+###########################################################################
+
+theApp.EvtMax = 1 # Leave this unchanged!
+
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CalibrationPatterns.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CalibrationPatterns.py
new file mode 100644
index 00000000000..89264eb892c
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CalibrationPatterns.py
@@ -0,0 +1,62 @@
+#############################################################################################
+# Fabien.Tarrade@cern.ch                                                                    #
+#                                                                                           #
+# 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 add   #
+#                                                                                           #
+#############################################################################################
+
+from LArCalibUtils.LArCalibUtilsConf import LArCalibDigitMaker
+LArCalibDigitMaker = LArCalibDigitMaker("LArCalibDigitMaker")
+LArCalibDigitMaker.KeyList += GainList
+LArCalibDigitMaker.DontRun  = True
+
+from LArROD.LArRODConf import LArCalibDigitsAccumulator
+LArCalibDigitsAccumulator = LArCalibDigitsAccumulator("LArCalibDigitsAccumulator")
+LArCalibDigitsAccumulator.KeyList += GainList
+
+# DelayScale example: in CTB 2004 240 TTCrx steps in a sampling period
+LArCalibDigitsAccumulator.DelayScale = (25./240.)*ns
+
+LArCalibDigitMaker.BoardIDs += [ 1007091712, 1007616000, 1008140288, 1008664576, 1009188864, 1009713152, 1010237440, 1010761728, 1011286016, 1011810304, 1012334592, 1012858880, 1013383168, 1013907456,
+                                 1014431744, 1014956032, 1015480320, 1016004608, 1016528896, 1017053184, 1017577472, 1018101760, 1018626048, 1019150336, 1019674624, 1020198912, 1020723200, 1021247488,
+                                  021771776, 1022296064, 1022820352, 1023344640, 1023868928, 1024393216, 1024917504, 1025441792, 1025966080, 1026490368, 1027014656, 1027538944, 1028063232, 1028587520,
+                                 1029111808, 1029636096, 1030160384, 1030684672, 1031208960, 1031733248, 1032257536, 1032781824, 1033306112, 1033830400, 1034354688, 1034878976, 1035403264, 1035927552,
+                                 1036451840, 1036976128, 1037500416, 1038024704, 1038548992, 1039073280, 1039597568, 1040121856, 1040646144, 1041170432, 1041825792, 1041858560, 1042120704, 1042743296,
+                                 1043267584, 1043824640, 1044316160, 1044840448, 1045495808, 1045528576, 1045790720, 1046413312, 1046937600, 1047461888, 1047986176, 1048641536, 1048674304, 1048936448,
+                                 1049559040, 1050083328, 1050607616, 1051131904, 1051787264, 1051820032, 1052082176, 1052704768, 1053229056, 1057423360, 1057947648, 1058603008, 1058635776, 1058897920,
+                                 1059520512, 1060044800, 1060601856, 1061093376, 1061617664, 1062273024, 1062305792, 1062567936, 1063190528, 1063714816, 1064239104, 1064763392, 1065418752, 1065451520,
+                                 1065713664, 1066336256, 1066860544, 1067384832, 1067909120, 1068564480, 1068597248, 1068859392, 1069481984, 1070006272 ]
+   
+#
+# Calibration patterns
+#
+
+LArCalibDigitMaker.nTrigger = 100
+LArCalibDigitMaker.DAC     += DACs
+LArCalibDigitMaker.Delay   += [0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230]
+LArCalibDigitMaker.Pattern += [0x10001,0x10001,0x10001,0x0000001]
+LArCalibDigitMaker.Pattern += [0x20002,0x20002,0x20002,0x0000002]
+LArCalibDigitMaker.Pattern += [0x40004,0x40004,0x40004,0x0000004]
+LArCalibDigitMaker.Pattern += [0x80008,0x80008,0x80008,0x0000008]
+LArCalibDigitMaker.Pattern += [0x100010,0x100010,0x100010,0x10010]
+LArCalibDigitMaker.Pattern += [0x200020,0x200020,0x200020,0x20020]
+LArCalibDigitMaker.Pattern += [0x400040,0x400040,0x400040,0x40040]
+LArCalibDigitMaker.Pattern += [0x800080,0x800080,0x800080,0x80080]
+LArCalibDigitMaker.Pattern += [0x1000100,0x1000100,0x1000100,0x100100]
+LArCalibDigitMaker.Pattern += [0x2000200,0x2000200,0x2000200,0x200200]
+LArCalibDigitMaker.Pattern += [0x4000400,0x4000400,0x4000400,0x400400]
+LArCalibDigitMaker.Pattern += [0x8000800,0x8000800,0x8000800,0x800800]
+LArCalibDigitMaker.Pattern += [0x10001000,0x10001000,0x10001000,0x0001000]
+LArCalibDigitMaker.Pattern += [0x20002000,0x20002000,0x20002000,0x0002000]
+LArCalibDigitMaker.Pattern += [0x40004000,0x40004000,0x40004000,0x0004000]
+LArCalibDigitMaker.Pattern += [0x80008000,0x80008000,0x80008000,0x0008000]
+   
+topSequence += LArCalibDigitMaker
+topSequence += LArCalibDigitsAccumulator
+
+ByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/HIGH"  ]
+ByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/MEDIUM"]
+ByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/LOW"   ]
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DelayXtalk_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DelayXtalk_jobOptions.py
new file mode 100644
index 00000000000..c5cb7edc6d0
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DelayXtalk_jobOptions.py
@@ -0,0 +1,502 @@
+import commands
+
+###########################################################################
+#
+# Crosstalk jobOptions
+# Reconstruct waveshapes for non pulsed channels (LArCaliWaveBuilderXtalk)
+# and compute various types of crosstalk (LArWaveXtalk)
+#
+# Should be run for each subdetector : BarrelA, BarrelC, EndcapA, EndcapC
+# and for each calibration patterns :
+#  - EM Barrel : StripSingle[1-4] / MiddleSingle[1-8] / BackSingle[1-4]
+#  - EM Endcap : StripSingle[1-4] / MiddleSingle[1-4] / BackSingle[1-4]
+#                and MiddleSingle[1-4] / BackSingle[1-4] for inner wheel
+# For EM endcap special crates, set SpecialCrate to True. You can then
+# choose the region with SpecialRegion = OuterWheel / InnerWheel.
+#
+# FeedthroughPul is used to find the relevant calibration pattern. Empty
+# ntuples/histograms may be produced with badly set FeedthroughPul, or if
+# there are bad channels or disconnected FEBs in FeedthroughPul.
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+include("RecExCommission/GetInputFiles.py")
+
+#######################################################
+#       Crosstalk parameters
+#######################################################
+
+if not 'Type' in dir():
+   Type = "DelayXtalk"
+
+## Calibration pattern
+## StripSingle[1-4] / MiddleSingle[1-8] / BackSingle[1-4]
+if not 'CalibPattern' in dir():
+   CalibPattern = "MiddleSingle1"
+
+## EMEC Special Crates
+## if SpecialCrate=True, specify SpecialRegion
+if not 'SpecialCrate' in dir():
+   SpecialCrate = False         	
+
+if not 'SpecialRegion' in dir():
+   SpecialRegion = "OuterWheel" # OuterWheel / InnerWheel
+
+## FT used to check calibration pattern
+## ensure there are no bad channels / disconnected FEBs
+if not 'FeedthroughPul' in dir():
+   FeedthroughPul = 1
+
+
+#######################################################
+#       Run properties
+#######################################################
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"            # Barrel / Endcap
+
+if not 'Side' in dir() :
+   Side = "A"                   # A / C
+
+if not 'RunNumberList' in dir():
+   RunNumberList = [ '00157333' ]
+   
+if not 'FilePrefix' in dir():
+   if (int(RunNumberList[0]))<99800 :
+      FilePrefix = "daq.Delay"
+   else :
+      FilePrefix = "data*"
+     
+if not 'InputDir' in dir():
+   InputDir = "/castor/cern.ch/grid/atlas/DAQ/lar/ElecCalib/2010/"+RunNumberList[0]
+   
+if not 'Partition' in dir():
+   if (SubDet=='Endcap'):
+      Partition = "EB-EMEC"
+   else:
+      Partition = "EB-EMB"
+
+if not 'doCaliWaveSelector' in dir():
+   doCaliWaveSelector = False      
+
+if not 'FullFileName' in dir():
+   if (int(RunNumberList[0]))<99800 :
+      Trigger = "*"+Partition
+   else :
+      Trigger = "calibration_LArElec-Delay"+".*"+Partition+Side
+   
+   FullFileName = []
+   for RunNumber in RunNumberList :
+       FullFileName+=GetInputFilesFromTokens(InputDir,int(RunNumber),FilePrefix,Trigger)
+
+if not 'GainList' in dir():
+   GainList = [ "HIGH", "MEDIUM", "LOW" ]
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+
+if not 'ChannelSelection' in dir():
+   # read all
+   ChannelSelection = " "
+   ## example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,3:34</channelSelection>"
+
+if not 'runAccumulator' in dir(): 
+   runAccumulator = False # averaged mode
+
+from string import *
+def DBConnectionFile(sqlitefile):  
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+#######################################################
+#      Monitoring properties
+#######################################################
+
+if not 'doMonitoring' in dir():
+   doMonitoring = True
+
+if not 'doLArCalibDataQuality' in dir():
+   doLArCalibDataQuality = False  
+
+if not 'online' in dir():
+   online = False
+   
+#######################################################
+#      Delay properties
+#######################################################
+
+if not "ADCSaturation" in dir():
+   ADCsaturation  = 4095 # Set to 0 if you want to keep saturating pulses otherwise 4095
+   
+if not 'SaveDerivedInfo' in dir():
+   SaveDerivedInfo = True
+
+if not 'SaveJitter' in dir():
+   SaveJitter = True
+    
+# CutOnSample: consider only the N=CutOnSample first samples to reduce needed memory (0 = no cut)
+if not 'CutOnSample' in dir():
+   CutOnSample = 0
+   
+#######################################################
+#      Delay output name
+#######################################################
+
+if SpecialCrate:
+   XtalkTag = CalibPattern +"_FT"+str(FeedthroughPul) + "_SpecialCrates" + "_" + SpecialRegion
+else:
+   XtalkTag = CalibPattern +"_FT"+str(FeedthroughPul)
+
+if not 'OutputTag' in dir():
+   OutputTag = XtalkTag
+else:
+   OutputTag = XtalkTag + "_" + OutputTag
+
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumberList[0])
+   
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd
+
+if not 'DBConnectionCOOL' in dir():  
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"
+
+## Pedestal
+   
+if not 'ReadPedFromCOOL' in dir():
+   ReadPedFromCOOL = True
+   
+if not 'PedRunNumber' in dir():
+   PedRunNumber = "1005020_1005021_1005022"
+   
+if not 'InputPedPoolFileDir' in dir():
+   InputPedPoolFileDir  = commands.getoutput("pwd")
+   
+if not 'InputPedPoolFileName' in dir():
+   InputPedPoolFileName = "LArPedestal_" + str(PedRunNumber)+"_"+Partition.replace("*","") + ".pool.root"
+
+## Output
+
+if not 'LArCalibFolderOutputTag' in dir():
+   LArCalibFolderOutputTag = LArCalib_Flags.tagSuffix    
+   
+if not 'OutputCaliWaveRootFileDir' in dir():
+   OutputCaliWaveRootFileDir  = commands.getoutput("pwd")
+   
+if not 'OutputCaliWavePoolFileDir' in dir():
+   OutputCaliWavePoolFileDir  = commands.getoutput("pwd")
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)      
+
+if not 'KeyOutput' in dir():  
+   KeyOutput = "LArCaliWave" # Key of LArCaliWaveContainer saved in Pool file
+   
+if not 'BaseFileName' in dir():
+   BaseFileName = Type
+
+for RunNumber in RunNumberList :
+   BaseFileName = BaseFileName+"_"+str(RunNumber)+"_"+Partition.replace("*","")+Side
+
+BaseFileName = BaseFileName + "_" + OutputTag
+
+if not 'OutputCaliWaveRootFileName' in dir():
+   OutputCaliWaveRootFileName = BaseFileName+".root"
+   
+if not 'OutputCaliWavePoolFileName' in dir():
+   OutputCaliWavePoolFileName = BaseFileName+".pool.root"
+
+if not 'OutputObjectSpecCaliWave' in dir():
+   OutputObjectSpecCaliWave = "LArCaliWaveContainer#"+KeyOutput+"#"+LArCalib_Flags.LArCaliWaveFolder
+   OutputTagSpecCaliWave = LArCalibFolderTag(LArCalib_Flags.LArCaliWaveFolder,LArCalibFolderOutputTag)
+   
+if ( ReadPedFromCOOL ):      
+   if 'InputPedSQLiteFile' in dir():
+      InputDBConnectionPed = DBConnectionFile(InputPedSQLiteFile)
+   else:
+      InputDBConnectionPed = DBConnectionCOOL
+
+## Bad Channel   
+   
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      InputDBConnectionBadChannel = "COOLOFL_LAR/COMP200"    
+
+DelayLog = logging.getLogger( "DelayLog" )
+
+include ("LArConditionsCommon/LArMinimalSetup.py")
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+theByteStreamInputSvc=svcMgr.ByteStreamInputSvc
+if not 'FullFileName' in dir():
+   DelayLog.info( "No FullFileName! Please give a FullFileName list.")
+   theApp.exit(-1)
+else :   
+   theByteStreamInputSvc.FullFileName=FullFileName
+   
+theByteStreamInputSvc.MaxBadEvents=0
+
+theByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
+theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
+theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/HIGH"  ]
+theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/MEDIUM"]
+theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/LOW"   ]
+
+###############################################################
+#                                                             #
+#                To read BS for one or more FT                #
+#                                                             #
+###############################################################
+
+## For splitting the delay runs, there are three new jobOptions.
+## All three are vectors of integers
+#################################################################
+
+from LArByteStream.LArByteStreamConf import LArRodDecoder
+svcMgr.ToolSvc += LArRodDecoder()
+
+#ToolSvc.LArRodDecoder.BEPreselection     = [1]                                                   ## : [Barrel=0,Endcap=1]
+#ToolSvc.LArRodDecoder.PosNegPreselection = [1]                                                   ## : [C-side (negative eta)=0, A-side (positive eta)=1]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]               ## : first half of [EM barrel feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]     ## : second half of [EM barrel feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [0,1,4,7,8,11,12,13,14,17,18,19,20,23,24]             ## : [EMEC Standard feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [2,9,15,21]                                           ## : [EMEC Special feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [3,10,16,22]                                          ## : [HEC feedthrough numbers]  (note: slots 1&2 are EMEC slots)
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [6]                                                   ## : [FCAL feedthrough number]
+      
+##########################################################################
+#                                                                        #
+#                      Delay run reconstruction                          #
+#                                                                        #
+##########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+include ("LArCalibProcessing/LArCalib_BadChanTool.py")
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB   
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+if ( ReadPedFromCOOL ):
+   PedestalFolder = LArCalib_Flags.LArPedestalFolder
+   if 'PedLArCalibFolderTag' in dir() :
+      PedestalTagSpec = LArCalibFolderTag (PedestalFolder,PedLArCalibFolderTag)
+      conddb.addFolder("",PedestalFolder+"<tag>"+PedestalTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPed+"</dbConnection>"+ChannelSelection)
+   else:   
+      conddb.addFolder("",PedestalFolder+"<dbConnection>"+InputDBConnectionPed+"</dbConnection>"+ChannelSelection)    
+else:
+   if 'InputPedPoolFileName' in dir():
+      PoolFileList += [ InputPedPoolFileDir+"/"+InputPedPoolFileName ]
+   
+if ( len(PoolFileList)>0 ):
+   
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+   
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+
+#--------------------------------------------------
+# LArCaliWaveBuilderXtalk
+#--------------------------------------------------
+
+PartitionPulsed = SubDet + Side    # Partition should be BarrelA or BarrelC or EndcapA or EndcapC
+if not (PartitionPulsed=="BarrelA" or PartitionPulsed=="BarrelC" or PartitionPulsed=="EndcapA" or PartitionPulsed=="EndcapC"):
+   print "[Xtalk JobOptions] Error: PartitionPulsed="+PartitionPulsed+". It should be BarrelA or BarrelC or EndcapA or EndcapC"
+   theApp.exit(-1)
+
+from LArCalibUtils.LArCalibUtilsConf import LArCaliWaveBuilderXtalk
+LArCaliWaveBuilderXtalk = LArCaliWaveBuilderXtalk("LArCaliWaveBuilderXtalk")
+
+LArCaliWaveBuilderXtalk.KeyList         = GainList
+if (doCaliWaveSelector) :
+   LArCaliWaveBuilderXtalk.KeyOutput    = KeyOutput+"multi"
+else :   
+   LArCaliWaveBuilderXtalk.KeyOutput    = KeyOutput
+LArCaliWaveBuilderXtalk.ADCsaturation   = ADCsaturation
+LArCaliWaveBuilderXtalk.CalibPattern    = CalibPattern          # StripSingle[1-4] / MiddleSingle[1-8] / BackSingle[1-4]
+LArCaliWaveBuilderXtalk.PartitionPulsed = PartitionPulsed       # Partition should be BarrelA or BarrelC or EndcapA or EndcapC
+LArCaliWaveBuilderXtalk.SpecialCrate    = SpecialCrate          # EMEC special crates
+LArCaliWaveBuilderXtalk.SpecialRegion   = SpecialRegion 	# EMEC special region
+LArCaliWaveBuilderXtalk.FeedthroughPul  = FeedthroughPul	# Used to check calibration pattern, ensure there are no bad channels / disconnected FEBs
+LArCaliWaveBuilderXtalk.CutOnSample     = CutOnSample   	# Cut on the number of read samples (usualy 32) to save memory
+
+if 'Ramp' in FullFileName:                                      # for ramp runs : only one step (ie. no delay)
+   print "[Xtalk JobOptions] Ramp run detected: set LArCaliWaveBuilderXtalk.NSteps to 1"
+   LArCaliWaveBuilderXtalk.NSteps       = 1
+
+topSequence+=LArCaliWaveBuilderXtalk
+
+##########################################################################
+#                                                                        #
+#                                 Output                                 #
+#                                                                        #
+##########################################################################
+
+if ( doMonitoring ) :
+   
+   from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+   topSequence += AthenaMonManager( "LArMon" )
+   LArMon = topSequence.LArMon
+
+   LArMon.FileKey = "GLOBAL"
+   LArMon.ManualDataTypeSetup = True
+   LArMon.Environment         = "tier0"
+   LArMon.ManualRunLBSetup    = True
+   LArMon.Run                 = int(RunNumberList[0])
+   LArMon.LumiBlock           = 1
+   LArMon.CheckEveryNoEvents  = 999999 #to do the check only at the end of the run
+   
+#   include("LArMonTools/LArFEBMon_jobOptions.py")
+   include("LArMonTools/LArXtalk_jobOptions.py")
+   
+   RootHistOutputFileName='RootHistos_'+BaseFileName+".root"
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import THistSvc
+   if os.path.exists(OutputCaliWaveRootFileDir+ "/" +RootHistOutputFileName): 
+      os.remove(OutputCaliWaveRootFileDir + "/" +RootHistOutputFileName)
+   svcMgr += THistSvc()
+   #svcMgr.THistSvc.Output = ["AllMon DATAFILE='"+OutputCaliWaveRootFileDir+ "/" +RootHistOutputFileName+"' OPT='New'"] 
+
+   svcMgr.THistSvc.Output =  ["GLOBAL DATAFILE='"+OutputCaliWaveRootFileDir+ "/" +RootHistOutputFileName+"' OPT='New'"]
+
+if ( WriteNtuple ):
+   
+   from LArCalibTools.LArCalibToolsConf import LArCaliWaves2Ntuple
+   LArCaliWaves2Ntuple = LArCaliWaves2Ntuple( "LArCaliWaves2Ntuple" )
+   LArCaliWaves2Ntuple.NtupleName  = "CALIWAVE"
+   LArCaliWaves2Ntuple.SaveDerivedInfo = SaveDerivedInfo
+   LArCaliWaves2Ntuple.SaveJitter = SaveJitter
+   LArCaliWaves2Ntuple.KeyList     = [ KeyOutput ]
+   
+   topSequence+=LArCaliWaves2Ntuple
+   
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputCaliWaveRootFileDir+"/"+OutputCaliWaveRootFileName): 
+      os.remove(OutputCaliWaveRootFileDir+"/"+OutputCaliWaveRootFileName)  
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputCaliWaveRootFileDir+"/"+OutputCaliWaveRootFileName+"' OPT='NEW'" ]
+
+if ( WritePoolFile ) :
+   
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   if os.path.exists(OutputCaliWavePoolFileDir+"/"+OutputCaliWavePoolFileName): 
+      os.remove(OutputCaliWavePoolFileDir+"/"+OutputCaliWavePoolFileName)
+   OutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg",OutputCaliWavePoolFileDir+"/"+OutputCaliWavePoolFileName,
+                                           [OutputObjectSpecCaliWave],[OutputTagSpecCaliWave],WriteIOV)
+   OutputConditionsAlg.Run1 = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlg.Run2 = IOVEnd
+   
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+   
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = WARNING)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = WARNING)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+##########################################################################
+#                                                                        #
+#                         Print summary                                  #
+#                                                                        #
+##########################################################################
+
+DelayLog.info( " ======================================================== " )
+DelayLog.info( " ***            LAr Delay Xtalk summary               *** " )
+DelayLog.info( " ======================================================== " )
+DelayLog.info( " RunNumber                          = "+str(RunNumberList) )
+DelayLog.info( " SubDetector                        = "+SubDet )
+DelayLog.info( " PartitionPulsed                    = "+PartitionPulsed )
+DelayLog.info( " CalibPattern                       = "+CalibPattern )
+DelayLog.info( " CutOnSample                        = "+str(CutOnSample) )
+DelayLog.info( " FeedthroughPul                     = "+str(FeedthroughPul) )
+DelayLog.info( " SpecialCrate                       = "+str(SpecialCrate) )
+DelayLog.info( " SpecialRegion                      = "+SpecialRegion )
+DelayLog.info( " Type                               = "+Type  )
+DelayLog.info( " LArGain                            = "+str(GainList) )
+for i in range(len(FullFileName)):
+   DelayLog.info( " FullFileName                       = "+FullFileName[i] )
+if ( ReadPedFromCOOL ):
+   DelayLog.info( " InputDBConnectionPed               = "+InputDBConnectionPed)
+else :
+   DelayLog.info( " InputPedPoolFileName               = "+InputPedPoolFileName)
+if 'PedLArCalibFolderTag' in dir() :   
+   DelayLog.info( " PedLArCalibFolderTag               = "+PedLArCalibFolderTag )
+DelayLog.info( " OutputCaliWaveRootFullFileName     = "+OutputCaliWaveRootFileDir+"/"+OutputCaliWaveRootFileName )
+DelayLog.info( " OutputCaliWavePoolFullFileName     = "+OutputCaliWavePoolFileDir+"/"+OutputCaliWavePoolFileName )
+DelayLog.info( " OutputObjectSpecCaliWave           = "+OutputObjectSpecCaliWave )
+DelayLog.info( " OutputTagSpecCaliWave              = "+OutputTagSpecCaliWave )
+DelayLog.info( " IOVBegin                           = "+str(IOVBegin) )
+DelayLog.info( " IOVEnd                             = "+str(IOVEnd) )
+DelayLog.info( " LArCalibOutputDB                   = "+OutputDB )
+DelayLog.info( " ======================================================== " )
+
+#######################################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py
new file mode 100644
index 00000000000..6d0fc49673e
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py
@@ -0,0 +1,869 @@
+import commands
+
+###########################################################################
+#
+# <Marco.Delmastro@cern.ch>
+#
+# Example jobOptions to reconstruction a DELAY runs in all 3 gains
+#
+# Last update: 09/12/2008 <Fabien.Tarrade@cern.ch>
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+include("RecExCommission/GetInputFiles.py")
+
+#######################################################
+#       Run properties
+#######################################################
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"
+
+if not 'RunNumberList' in dir():
+   RunNumberList = [ '0029143' ]
+   
+if not 'FilePrefix' in dir():
+   if (int(RunNumberList[0]))<99800 :
+      FilePrefix = "daq.Delay"
+   else :
+      FilePrefix = "data*"
+     
+if not 'InputDir' in dir():
+   InputDir = "/castor/cern.ch/grid/atlas/DAQ/lar/ElecCalib/2008/"+RunNumberList[0]
+   
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition = "EB-EC*"
+   else:
+      Partition = "EB-EMB*"
+
+if not 'doCaliWaveSelector' in dir():
+   doCaliWaveSelector = False      
+
+if not 'FullFileName' in dir():
+   if (int(RunNumberList[0]))<99800 :
+      Trigger = "*"+Partition
+   else :
+      Trigger = "calibration_LArElec-Delay"+".*"+Partition
+   
+   FullFileName = []
+   for RunNumber in RunNumberList :
+       FullFileName+=GetInputFilesFromTokens(InputDir,int(RunNumber),FilePrefix,Trigger)
+
+if not 'GainList' in dir():
+   GainList = [ "HIGH", "MEDIUM", "LOW" ]
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+
+if not 'ChannelSelection' in dir():
+   # read all
+   ChannelSelection = " "
+   ## example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,3:34</channelSelection>"
+
+if not 'runAccumulator' in dir(): 
+   runAccumulator = False # averaged mode
+
+from string import *
+def DBConnectionFile(sqlitefile):  
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+#######################################################
+#                Monitoring properties
+#######################################################
+
+if not 'doMonitoring' in dir():
+   doMonitoring = True
+
+if not 'doLArCalibDataQuality' in dir():
+   doLArCalibDataQuality = True
+
+#######################################################
+#       Delay properties
+#######################################################
+
+if not 'StripsXtalkCorr' in dir():
+   StripsXtalkCorr = True # Xtalk correction for strips
+
+if not 'ShortCorrector' in dir():
+   ShortCorrector = True # correctio for short
+
+if not "ADCSaturation" in dir():
+   ADCsaturation  = 4095 # Set to 0 if you want to keep saturating pulses otherwise 4095
+   
+if not 'SubtractPed' in dir(): # Set whether to substract pedestals. Pedestals come from COOL, or local Pool file if 'PedPoolFileName' is defined, or fake pedestal subraction as 'extrema ratio'
+   SubtractPed = True
+
+if not 'CheckEmptyPhases' in dir():
+   CheckEmptyPhases = True
+
+if not 'SaveDerivedInfo' in dir():
+   SaveDerivedInfo = True
+
+if not 'SaveJitter' in dir():
+   SaveJitter = True
+
+if not 'CorrectBadChannels' in dir():
+   CorrectBadChannels=True
+  
+
+###########################################################################
+#                             OFC properties
+###########################################################################
+
+if not 'Nsamples' in dir():
+   Nsamples = 5
+
+if not 'Nphases' in dir():
+   Nphases = 50
+
+if not 'Dphases' in dir():
+   Dphases = 1
+   
+if not 'Ndelays' in dir():
+   Ndelays = 24
+	
+if not 'ContainerKey' in dir():
+   ContainerKey = "LArCaliWave"
+   
+if not 'OFCKey' in dir():
+   OFCKey = "LArOFC"
+
+if not 'Normalize' in dir():
+   Normalize = True
+
+if not 'TimeShift' in dir() :
+   TimeShift = False
+
+if not 'TimeShiftByIndex' in dir() :
+   TimeShiftByIndex = -1
+
+if not 'DumpOFC' in dir():
+   DumpOFC = False
+
+   
+#######################################################
+#      Delay output name
+#######################################################
+
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumberList[0])
+   
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd
+
+if not 'DBConnectionCOOL' in dir():  
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"
+
+## Pedestal
+if not 'ReadPedFromCOOL' in dir():
+   ReadPedFromCOOL = True
+   
+if not 'InputPedPoolFileDir' in dir():
+   InputPedPoolFileDir  = commands.getoutput("pwd")
+   
+## AutoCorr
+if not 'ReadAutoCorrFromCOOL' in dir():
+   ReadAutoCorrFromCOOL = True 
+
+if not 'InputAutoCorrPoolDir' in dir():
+   InputAutoCorrPoolDir = commands.getoutput("pwd")
+
+## Output
+
+   
+rs=FolderTagResover()
+if not 'PedLArCalibFolderTag' in dir():
+   PedLArCalibFolderTag=rs.getFolderTagSuffix(LArCalib_Flags.LArPedestalFolder)
+
+if not 'AutoCorrLArCalibFolderTag' in dir():
+   AutoCorrLArCalibFolderTag=rs.getFolderTagSuffix(LArCalib_Flags.LArAutoCorrFolder)
+   
+if not 'LArCalibWaveFolderXtlkOutputTag' in dir():
+   LArCalibWaveFolderXtlkOutputTag=rs.getFolderTagSuffix(LArCalib_Flags.LArCaliWaveFolderXtlk)
+if not 'LArCalibWaveFolderOutputTag' in dir():
+   LArCalibWaveFolderOutputTag=rs.getFolderTagSuffix(LArCalib_Flags.LArCaliWaveFolder)
+if not 'LArCalibOFCXtlkFolderOutputTag' in dir():
+   LArCalibOFCXtlkFolderOutputTag=rs.getFolderTagSuffix(LArCalib_Flags.LArOFCCaliFolderXtlk)
+if not 'LArCalibOFCFolderOutputTag' in dir():
+   LArCalibOFCFolderOutputTag=rs.getFolderTagSuffix(LArCalib_Flags.LArOFCCaliFolder)
+del rs #Close database
+   
+if not 'OutputRootFileDir' in dir():
+   OutputRootFileDir  = commands.getoutput("pwd")
+   
+if not 'OutputPoolFileDir' in dir():
+   OutputPoolFileDir  = commands.getoutput("pwd")
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)      
+
+if not 'KeyOutput' in dir():  
+   KeyOutput = "LArCaliWave" # Key of LArCaliWaveContainer saved in Pool file
+   
+if not 'BaseFileName' in dir():
+   BaseFileName = "LArCaliWave_OFC_Cali"
+   BaseFileNameCaliWave = "LArCaliWave"
+   
+if StripsXtalkCorr :
+   for RunNumber in RunNumberList :
+      BaseFileName = BaseFileName+"_"+str(RunNumber)+"_"+Partition.replace("*","") +"_StripsXtalkCorr"
+      BaseFileNameCaliWave = BaseFileNameCaliWave+"_"+str(RunNumber)+"_"+Partition.replace("*","") +"_StripsXtalkCorr"
+else :
+   for RunNumber in RunNumberList :
+      BaseFileName = BaseFileName+"_"+str(RunNumber)+"_"+Partition.replace("*","")
+      BaseFileNameCaliWave = BaseFileNameCaliWave+"_"+str(RunNumber)+"_"+Partition.replace("*","")
+
+if not 'OutputCaliWaveRootFileName' in dir():
+   OutputCaliWaveRootFileName = BaseFileNameCaliWave+".root"
+   
+if not 'OutputPoolFileName' in dir():
+   OutputPoolFileName = BaseFileName+".pool.root"
+
+if not 'OutputObjectSpecCaliWave' in dir():
+   if StripsXtalkCorr:
+      OutputObjectSpecCaliWave = "LArCaliWaveContainer#"+KeyOutput+"#"+LArCalib_Flags.LArCaliWaveFolderXtlk
+      OutputTagSpecCaliWave = LArCalibFolderTag(LArCalib_Flags.LArCaliWaveFolderXtlk,LArCalibWaveFolderXtlkOutputTag)
+   else:
+      OutputObjectSpecCaliWave = "LArCaliWaveContainer#"+KeyOutput+"#"+LArCalib_Flags.LArCaliWaveFolder
+      OutputTagSpecCaliWave = LArCalibFolderTag(LArCalib_Flags.LArCaliWaveFolder,LArCalibWaveFolderOutputTag)
+   
+if ( ReadPedFromCOOL ):      
+   if 'InputPedSQLiteFile' in dir():
+      InputDBConnectionPed = DBConnectionFile(InputPedSQLiteFile)
+   else:
+      InputDBConnectionPed = DBConnectionCOOL
+
+if ( ReadAutoCorrFromCOOL ):      
+   if 'InputAutoCorrSQLiteFile' in dir():
+      InputDBConnectionAutoCorr = DBConnectionFile(InputAutoCorrSQLiteFile)
+   else:
+      InputDBConnectionAutoCorr = DBConnectionCOOL
+
+if not 'OutputObjectSpecOFC' in dir():
+   if   ( ContainerKey == "LArCaliWave" ):
+      if ( not StripsXtalkCorr ):
+         OutputObjectSpecOFC   = "LArOFCComplete#"  +OFCKey  +"#"+ LArCalib_Flags.LArOFCCaliFolder	
+         OutputObjectSpecTagOFC    = LArCalibFolderTag(LArCalib_Flags.LArOFCCaliFolder,LArCalibOFCFolderOutputTag)
+      else:
+         OutputObjectSpecOFC   = "LArOFCComplete#"  +OFCKey  +"#"+ LArCalib_Flags.LArOFCCaliFolderXtlk
+         OutputObjectSpecTagOFC    = LArCalibFolderTag(LArCalib_Flags.LArOFCCaliFolderXtlk,LArCalibWaveFolderXtlkOutputTag)
+			
+   elif ( ContainerKey == "LArMasterWave" ):
+      if ( not StripsXtalkCorr ):
+         OutputObjectSpecOFC   = "LArOFCComplete#"+OFCKey+"#"+ LArCalib_Flags.LArOFCMasterWaveFolder
+         OutputObjectSpecTagOFC    = LArCalibFolderTag(LArCalib_Flags.LArOFCMasterWaveFolder,LArCalibOFCFolderOutputTag)
+      else:
+         OutputObjectSpecOFC   = "LArOFCComplete#"+OFCKey+"#"+ LArCalib_Flags.LArOFCMasterWaveFolderXtlk
+         OutputObjectSpecTagOFC    = LArCalibFolderTag(LArCalib_Flags.LArOFCMasterWaveFolderXtlk,LArCalibOFCXtlkFolderOutputTag)
+			
+OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","")
+
+if (StripsXtalkCorr):
+   OFCFileTag += "_StripsXtalkCorr"
+
+OFCFileTag += "_"+str(Nsamples)+"samples"
+
+if (Dphases>1):
+   OFCFileTag += "_"+str(Dphases)+"Dphase"
+
+if not 'OutputOFCRootFileName' in dir():
+   OutputOFCRootFileName = "LArOFCCali_"+OFCFileTag + ".root"
+   
+## Bad Channel   
+   
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;"
+      InputDBConnectionBadChannel = "COOLOFL_LAR/COMP200"      
+      
+###########################################################################
+#                             OFC properties
+###########################################################################
+
+if not 'Nsamples' in dir():
+   Nsamples = 5
+
+if not 'Nphases' in dir():
+   Nphases = 50
+
+if not 'Dphases' in dir():
+   Dphases = 1
+   
+if not 'Ndelays' in dir():
+   Ndelays = 24
+	
+if not 'ContainerKey' in dir():
+   ContainerKey = "LArCaliWave"
+   
+if not 'OFCKey' in dir():
+   OFCKey = "LArOFC"
+
+if not 'Normalize' in dir():
+   Normalize = True
+
+if not 'TimeShift' in dir() :
+   TimeShift = False
+
+if not 'TimeShiftByIndex' in dir() :
+   TimeShiftByIndex = -1
+
+if not 'DumpOFC' in dir():
+   DumpOFC = False
+#######################################################################################
+# print summary
+#######################################################################################
+
+DelayOFCLog = logging.getLogger( "DelayOFCLog" )
+DelayOFCLog.info( " ======================================================== " )
+DelayOFCLog.info( " ***                 LAr Delay&&OFC summary           *** " )
+DelayOFCLog.info( " ======================================================== " )
+DelayOFCLog.info( " RunNumber                          = "+str(RunNumberList) )
+DelayOFCLog.info( " SubDetector                        = "+SubDet )
+DelayOFCLog.info( " Partition                          = "+Partition )
+DelayOFCLog.info( " Type                               = Delay "  )
+DelayOFCLog.info( " LArGain                            = "+str(GainList) )
+for i in range(len(FullFileName)):
+   DelayOFCLog.info( " FullFileName                       = "+FullFileName[i] )
+if ( ReadPedFromCOOL ):
+   DelayOFCLog.info( " InputDBConnectionPed               = "+InputDBConnectionPed)
+else :
+   DelayOFCLog.info( " InputPedPoolFileName               = "+InputPedPoolFileName)
+if ( ReadAutoCorrFromCOOL ):
+   DelayOFCLog.info( " InputDBConnectionAutoCorr          = "+InputDBConnectionAutoCorr )
+else:   
+   DelayOFCLog.info( " InputAutoCorrPoolFileName          = "+InputAutoCorrPoolFileName )
+DelayOFCLog.info( " PedLArCalibFolderTag               = "+PedLArCalibFolderTag )
+DelayOFCLog.info( " OutputCaliWaveRootFullFileName     = "+OutputRootFileDir+"/"+OutputCaliWaveRootFileName )
+DelayOFCLog.info( " OutputOFCRootFullFileName          = "+OutputRootFileDir+"/"+OutputOFCRootFileName )
+DelayOFCLog.info( " OutputPoolFullFileName             = "+OutputPoolFileDir+"/"+OutputPoolFileName )
+DelayOFCLog.info( " OutputObjectSpecCaliWave           = "+OutputObjectSpecCaliWave )
+DelayOFCLog.info( " OutputTagSpecCaliWave              = "+OutputTagSpecCaliWave )
+DelayOFCLog.info( " OutputObjectSpecOFC                = "+str(OutputObjectSpecOFC) )
+DelayOFCLog.info( " OutputObjectSpecTagOFC             = "+str(OutputObjectSpecTagOFC) )
+DelayOFCLog.info( " IOVBegin                           = "+str(IOVBegin) )
+DelayOFCLog.info( " IOVEnd                             = "+str(IOVEnd) )
+DelayOFCLog.info( " LArCalibOutputDB                   = "+OutputDB )
+DelayOFCLog.info( " ======================================================== " )
+#######################################################################################
+
+
+include ("LArConditionsCommon/LArMinimalSetup.py")
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+theByteStreamInputSvc=svcMgr.ByteStreamInputSvc
+if not 'FullFileName' in dir():
+   DelayOFCLog.info( "No FullFileName! Please give a FullFileName list.")
+   theApp.exit(-1)
+else :   
+   theByteStreamInputSvc.FullFileName=FullFileName
+   
+theByteStreamInputSvc.MaxBadEvents=0
+
+##############################################################################################
+#                                                                                            #
+# FullFileName is already the list of files compute by the fonction GetInputFilesFromTokens  #
+#                                                                                            #
+# maybe useful one day                                                                       #
+#                                                                                            #
+# else                                                                                        #
+#   theByteStreamInputSvc.FullFileName=OneFileName                                           #
+#   for i in range(len(theByteStreamInputSvc.FullFileName)):                                 #
+#      theByteStreamInputSvc.NumFile+=[10000]                                                #
+##############################################################################################
+   
+
+###############################################################
+#                                                             #
+#                To read BS for one or more FT                #
+#                                                             #
+###############################################################
+
+## For splitting the delay runs, there are three new jobOptions.
+## All three are vectors of integers
+#################################################################
+
+from LArByteStream.LArByteStreamConf import LArRodDecoder
+svcMgr.ToolSvc += LArRodDecoder()
+
+#ToolSvc.LArRodDecoder.BEPreselection     = [0]                                                   ## : [Barrel=0,Endcap=1]
+#ToolSvc.LArRodDecoder.PosNegPreselection = [1]                                                   ## : [C-side (negative eta)=0, A-side (positive eta)=1]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]               ## : first half of [EM barrel feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]     ## : second half of [EM barrel feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [0,1,4,7,8,11,12,13,14,17,18,19,20,23,24]             ## : [EMEC Standard feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [2,9,15,21]                                           ## : [EMEC Special feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [3,10,16,22]                                          ## : [HEC feedthrough numbers]  (note: slots 1&2 are EMEC slots)
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [6]                                                   ## : [FCAL feedthrough number]
+   
+
+###########################################################################
+#                                                                         #
+#                          Accumulator                                    #
+#                                                                         #
+###########################################################################
+
+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   #
+   include("LArCalibProcessing/LArCalib_CalibrationPatterns.py")
+
+else:
+   theByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
+   theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
+#   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/FREE"  ]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/HIGH"  ]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/MEDIUM"]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/LOW"   ]
+
+## 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
+from LArCalibDataQuality.LArCalibDataQualityConf import LArBadEventCatcher
+theLArBadEventCatcher=LArBadEventCatcher()
+theLArBadEventCatcher.CheckAccCalibDigitCont=True
+theLArBadEventCatcher.CheckBSErrors=True
+theLArBadEventCatcher.KeyList=GainList
+theLArBadEventCatcher.StopOnError=False
+topSequence+=theLArBadEventCatcher      
+      
+##########################################################################
+#                                                                        #
+#                      Delay run reconstruction                          #
+#                                                                        #
+##########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+include ("LArCalibProcessing/LArCalib_BadChanTool.py")
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   DelayOFCLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   DelayOFCLog. info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB   
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+# Temperature folder
+conddb.addFolder("DCS_OFL","/LAR/DCS/FEBTEMP")
+svcMgr.EventSelector.InitialTimeStamp = 1284030331
+import cx_Oracle
+import time
+import datetime
+connection=cx_Oracle.connect("ATLAS_SFO_T0_R/readmesfotz2008@atlr")
+cursor=connection.cursor()
+sRequest=("SELECT RUNNR,CREATION_TIME FROM SFO_TZ_RUN WHERE RUNNR='%s'")%(RunNumberList[0])
+cursor.execute(sRequest)
+times= cursor.fetchall()
+d=times[0][1]
+iovtemp=int(time.mktime(d.timetuple()))
+#print "Setting timestamp for run ",RunNumberList[0]," to ",iovtemp
+#svcMgr.IOVDbSvc.forceTimestamp = 1283145454
+svcMgr.IOVDbSvc.forceTimestamp = iovtemp
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+if ( doLArCalibDataQuality  ) :
+   ## The reference is the Oracle DB
+   if StripsXtalkCorr:
+      conddb.addFolder("",LArCalib_Flags.LArCaliWaveFolderXtlk+"<key>LArCaliWaveRef</key><dbConnection>"+DBConnectionCOOL+"</dbConnection>"+ChannelSelection)
+   else:
+      conddb.addFolder("",LArCalib_Flags.LArCaliWaveFolder+"<key>LArCaliWaveRef</key><dbConnection>"+DBConnectionCOOL+"</dbConnection>"+ChannelSelection)
+
+if (SubtractPed):
+   if ( ReadPedFromCOOL ):
+      if not 'InputPedSQLiteFile' in dir():
+         DelayOFCLog.info( "Read Pedestal from Oracle DB")
+      else :   
+         DelayOFCLog.info( "Read Pedestal from SQLite file")
+
+      PedestalFolder = LArCalib_Flags.LArPedestalFolder
+      PedestalTagSpec = LArCalibFolderTag (PedestalFolder,PedLArCalibFolderTag)
+      conddb.addFolder("",PedestalFolder+"<tag>"+PedestalTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPed+"</dbConnection>"+ChannelSelection)
+   else:
+      if 'InputPedPoolFileName' in dir():
+         DelayOFCLog.info( "Read Pedestal from POOL file") 
+         PoolFileList += [ InputPedPoolFileDir+"/"+InputPedPoolFileName ]
+
+      else:
+         DelayOFCLog.info( "LArCaliWaveBuilder WARNING : Using fake pedestals subtraction for all channels.")
+   
+if ( len(PoolFileList)>0 ):
+   
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+   
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+
+if ( ShortCorrector ):
+   
+   from LArCalibUtils.LArCalibUtilsConf import LArCalibShortCorrector
+   theLArCalibShortCorrector = LArCalibShortCorrector()
+   theLArCalibShortCorrector.KeyList = GainList
+   theLArCalibShortCorrector.OutputLevel=INFO
+   topSequence +=theLArCalibShortCorrector
+   
+if ( StripsXtalkCorr ) :
+
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   from LArCalibUtils.LArCalibUtilsConf import LArStripsCrossTalkCorrector
+   theLArStripsCrossTalkCorrector = LArStripsCrossTalkCorrector()
+   theLArStripsCrossTalkCorrector.KeyList = GainList
+   theLArStripsCrossTalkCorrector.ADCsaturation = ADCsaturation
+   theLArStripsCrossTalkCorrector.NoXtalkCorr=LArBadChannelMasker("NoXtalkCorr",
+                                                               DoMasking=True,
+                                                               ProblemsToMask=["deadReadout","deadPhys","deadCalib","almostDead"]
+                                                               )
+   theLArStripsCrossTalkCorrector.DontUseForXtalkCorr=LArBadChannelMasker("DontUseForXtalkCorr",
+                                                                       DoMasking=True,
+                                                                       ProblemsToMask=["short","peculiarCalibrationLine", "deadReadout", "deadPhys"]
+                                                                       )                           
+   theLArStripsCrossTalkCorrector.AcceptableDifference=25.0 #in per-cent                                                                       
+   topSequence +=theLArStripsCrossTalkCorrector
+ 
+from LArCalibUtils.LArCalibUtilsConf import LArCaliWaveBuilder
+LArCaliWaveBuilder = LArCaliWaveBuilder()
+LArCaliWaveBuilder.KeyList          = GainList
+if (doCaliWaveSelector) :
+   LArCaliWaveBuilder.KeyOutput        = KeyOutput+"multi"
+else :   
+   LArCaliWaveBuilder.KeyOutput        = KeyOutput
+LArCaliWaveBuilder.GroupingType     = GroupingType
+LArCaliWaveBuilder.SubtractPed      = SubtractPed
+LArCaliWaveBuilder.CheckEmptyPhases = CheckEmptyPhases
+LArCaliWaveBuilder.NBaseline        = 0 # to avoid the use of the baseline when Pedestal are missing
+LArCaliWaveBuilder.UseDacAndIsPulsedIndex = False # should have an impact only for HEC
+
+if StripsXtalkCorr:
+   LArCaliWaveBuilder.ADCsaturation = 0
+else:
+   LArCaliWaveBuilder.ADCsaturation = ADCsaturation
+   
+topSequence+=LArCaliWaveBuilder
+
+if (doCaliWaveSelector) :
+   from LArCalibUtils.LArCalibUtilsConf import LArCaliWaveSelector
+   LArCaliWaveSelector = LArCaliWaveSelector("LArCaliWaveSelector")
+   LArCaliWaveSelector.KeyList         = [ KeyOutput+"multi" ]
+   LArCaliWaveSelector.KeyOutput       = KeyOutput
+   LArCaliWaveSelector.GroupingType     = GroupingType
+   if (GainList[0]=="HIGH") :
+      LArCaliWaveSelector.SelectionList = [ "HEC/0/0/460","HEC/1/0/460","HEC/2/0/230","HEC/3/0/230" ] 
+
+   if (GainList[0]=="MEDIUM") :
+      LArCaliWaveSelector.SelectionList = [ "HEC/0/1/3600","HEC/1/1/3600","HEC/2/1/1800","HEC/3/1/1800"]
+   
+   if (GainList[0]=="LOW") :   
+      LArCaliWaveSelector.SelectionList = [ "HEC/0/2/24000","HEC/1/2/24000","HEC/2/2/18000","HEC/3/2/18000" ]
+      
+   topSequence+=LArCaliWaveSelector
+
+######################################################################
+#                                                                    #
+#                          Correction                                #
+#                                                                    #
+######################################################################
+
+if CorrectBadChannels:
+
+   from LArCalibUtils.LArCalibUtilsConf import LArCalibPatchingAlg_LArCaliWaveContainer_
+   theLArCaliWavePatcher=LArCalibPatchingAlg_LArCaliWaveContainer_("LArCaliWavePatcher")
+   theLArCaliWavePatcher.ContainerKey=KeyOutput
+   #theLArCaliWavePatcher.PatchMethod="PhiNeighbor" ##take the first neigbour
+   theLArCaliWavePatcher.PatchMethod="PhiAverage" ##do an aveage in phi after removing bad and empty event
+   theLArCaliWavePatcher.OutputLevel=INFO
+   
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
+   theLArBadChannelTool=LArBadChanTool()
+   ToolSvc+=theLArBadChannelTool
+   
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   theLArRCBMasker=LArBadChannelMasker("LArRCBMasker")
+   theLArRCBMasker.DoMasking=True
+   theLArRCBMasker.ProblemsToMask=[
+      "deadCalib","deadReadout","deadPhys","almostDead","short",
+      ]
+   theLArCaliWavePatcher.UseCorrChannels=False  
+   ToolSvc+=theLArRCBMasker
+   theLArCaliWavePatcher.MaskingTool=theLArRCBMasker
+   topSequence+=theLArCaliWavePatcher
+ 
+
+##########################################################################
+#                                                                        #
+#                                 Cali OFC                               #
+#                                                                        #
+##########################################################################
+
+if ( ReadAutoCorrFromCOOL ):
+   if not 'InputAutoCorrSQLiteFile' in dir():
+      DelayOFCLog.info( "Read AutoCorr from  Oracle DB" )
+   else :
+      DelayOFCLog.info( "Read AutoCorr from SQLite file" )
+      
+if ( ReadAutoCorrFromCOOL ):
+   AutoCorrFolder  = LArCalib_Flags.LArAutoCorrFolder
+   AutoCorrTagSpec = LArCalibFolderTag(AutoCorrFolder,AutoCorrLArCalibFolderTag)
+   conddb.addFolder("",AutoCorrFolder+"<tag>"+AutoCorrTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionAutoCorr+"</dbConnection>"+ ChannelSelection)
+else:
+   if 'InputAutoCorrPoolFileName' in dir():
+      DelayOFCLog.info( "Read AutoCorr from POOL file" )
+      PoolFileList += [ InputAutoCorrPoolDir+"/"+InputAutoCorrPoolFileName ]
+   else:
+      DelayOFCLog.info( "No PoolFileList found! Please list the POOL files containing AutoCorrelation Matrix or read from COOL." )
+      theApp.exit(-1)      
+
+
+##########################################################################
+#                                                                        #
+#                                 Output                                 #
+#                                                                        #
+##########################################################################
+
+if ( doLArCalibDataQuality  ) :
+   from LArCalibDataQuality.LArCalibDataQualityConf import LArCaliWaveValidationAlg
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   theLArDelayValBCMask=LArBadChannelMasker("DelayValBCMask",
+                                            DoMasking=True,
+                                            ProblemsToMask=["deadReadout","deadCalib","deadPhys","almostDead",
+                                                            "highNoiseHG","highNoiseMG","highNoiseLG"]
+                                            )
+   svcMgr.ToolSvc+=theLArDelayValBCMask
+   from LArCalibDataQuality.Thresholds import cwFWHMThr, cwAmpThr,cwAmpThrFEB, cwFWHMThrFEB  
+   theCaliWaveValidationAlg=LArCaliWaveValidationAlg("CaliWaveVal")
+   theCaliWaveValidationAlg.BadChannelMaskingTool=theLArDelayValBCMask
+   theCaliWaveValidationAlg.ValidationKey=KeyOutput
+   theCaliWaveValidationAlg.ReferenceKey="LArCaliWaveRef"
+   theCaliWaveValidationAlg.MsgLevelForDeviations=WARNING
+   theCaliWaveValidationAlg.ListOfDevFEBs="caliWaveFebs.txt"
+   theCaliWaveValidationAlg.AmplitudeTolerance=cwAmpThr
+   theCaliWaveValidationAlg.CaliWaveFWHMTolerance=cwFWHMThr
+   theCaliWaveValidationAlg.AmplitudeToleranceFEB=cwAmpThrFEB
+   theCaliWaveValidationAlg.CaliWaveFWHMToleranceFEB=cwFWHMThrFEB
+   theCaliWaveValidationAlg.TimeShiftDetection=True
+   theCaliWaveValidationAlg.PatchMissingFEBs=True
+   theCaliWaveValidationAlg.UseCorrChannels=False  
+   topSequence+=theCaliWaveValidationAlg
+   
+   ## second instance of the validation tool to detect "bad" channel 
+   theBadCaliWave=LArCaliWaveValidationAlg("CaliWaveFail")
+   theBadCaliWave.BadChannelMaskingTool=theLArDelayValBCMask
+   theBadCaliWave.ValidationKey=KeyOutput
+   theBadCaliWave.ReferenceKey="LArCaliWaveRef"
+   theBadCaliWave.MsgLevelForDeviations=WARNING
+   theBadCaliWave.ListOfDevFEBs="Bad_caliWaveFebs.txt"
+   theBadCaliWave.AmplitudeTolerance=["20,20,20"]
+   theBadCaliWave.CaliWaveFWHMTolerance=["50,50,50"]
+   theBadCaliWave.AmplitudeToleranceFEB=["10,10,10"]
+   theBadCaliWave.CaliWaveFWHMToleranceFEB=["80,80,80"]
+   theBadCaliWave.TimeShiftDetection=True
+   theBadCaliWave.UseCorrChannels=False
+   topSequence+=theBadCaliWave
+   
+
+
+if ( doMonitoring ) :
+   
+   from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+   topSequence += AthenaMonManager( "LArMon" )
+   LArMon = topSequence.LArMon
+
+   ## old style
+   #LArMon.FileKey = "AllMon"
+   #LArMon.ManualDataTypeSetup = True
+   #LArMon.Environment         = "user"
+   #LArMon.ManualRunLBSetup    = True
+   #LArMon.Run                 = 1
+   #LArMon.LumiBlock           = 1
+   #LArMon.CheckEveryNoEvents  = 999999 #to do the check only at the end of the run
+
+   ## tier0 style
+   LArMon.FileKey = "GLOBAL"
+   LArMon.ManualDataTypeSetup = True
+   LArMon.Environment         = "tier0"
+   LArMon.ManualRunLBSetup    = True
+   LArMon.Run                 = int(RunNumberList[0])
+   LArMon.LumiBlock           = 1
+   LArMon.CheckEveryNoEvents  = 999999 #to do the check only at the end of the run
+   
+   include("LArMonTools/LArFEBMon_jobOptions.py")
+   
+   RootHistOutputFileName='RootHistos_'+BaseFileName+".root"
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import THistSvc
+   if os.path.exists(OutputRootFileDir+ "/" +RootHistOutputFileName): 
+      os.remove(OutputRootFileDir + "/" +RootHistOutputFileName)
+   svcMgr += THistSvc()
+
+   svcMgr.THistSvc.Output =  ["GLOBAL DATAFILE='"+OutputRootFileDir+ "/" +RootHistOutputFileName+"' OPT='New'"]
+
+
+if (WriteNtuple):
+   from LArCalibTools.LArCalibToolsConf import LArCaliWaves2Ntuple
+   LArCaliWaves2Ntuple = LArCaliWaves2Ntuple( "LArCaliWaves2Ntuple" )
+   LArCaliWaves2Ntuple.NtupleName  = "CALIWAVE"
+   LArCaliWaves2Ntuple.SaveDerivedInfo = SaveDerivedInfo
+   LArCaliWaves2Ntuple.SaveJitter = SaveJitter
+   LArCaliWaves2Ntuple.KeyList     = [ KeyOutput ]
+   
+   topSequence+=LArCaliWaves2Ntuple
+   
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputRootFileDir+"/"+OutputCaliWaveRootFileName): 
+      os.remove(OutputRootFileDir+"/"+OutputCaliWaveRootFileName)  
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputRootFileDir+"/"+OutputCaliWaveRootFileName+"' OPT='NEW'" ]
+
+
+if ( WritePoolFile ) :
+   
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+
+   if os.path.exists(OutputPoolFileDir+"/"+OutputPoolFileName): 
+      os.remove(OutputPoolFileDir+"/"+OutputPoolFileName)
+   OutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg",OutputPoolFileDir+"/"+OutputPoolFileName,
+                                           [OutputObjectSpecCaliWave],[OutputTagSpecCaliWave],WriteIOV)
+   OutputConditionsAlg.Run1 = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlg.Run2 = IOVEnd
+   
+   #OutputConditionsAlg.ObjectList += [OutputObjectSpecOFC]
+   #OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagOFC]
+
+
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+   
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+
+
+
+
+###########################################################################
+#                            OFC computation
+###########################################################################
+
+from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrDecoderTool
+theLArAutoCorrDecoderTool = LArAutoCorrDecoderTool()
+ToolSvc += theLArAutoCorrDecoderTool
+
+from LArCalibUtils.LArCalibUtilsConf import LArOFCAlg
+LArCaliOFCAlg = LArOFCAlg("LArCaliOFCAlg")
+LArCaliOFCAlg.ReadCaliWave = True
+LArCaliOFCAlg.KeyList   = [ ContainerKey ]
+LArCaliOFCAlg.Nphase    = Nphases
+LArCaliOFCAlg.Dphase    = Dphases
+LArCaliOFCAlg.Ndelay    = Ndelays
+LArCaliOFCAlg.Nsample   = Nsamples
+LArCaliOFCAlg.Normalize = Normalize
+LArCaliOFCAlg.TimeShift = TimeShift
+LArCaliOFCAlg.TimeShiftByIndex = TimeShiftByIndex
+LArCaliOFCAlg.Verify    = True
+LArCaliOFCAlg.FillShape = False
+if ( DumpOFC ) :
+	LArCaliOFCAlg.DumpOFCfile = "LArOFCCali.dat"
+LArCaliOFCAlg.GroupingType = GroupingType
+LArCaliOFCAlg.DecoderTool=theLArAutoCorrDecoderTool
+topSequence+=LArCaliOFCAlg
+
+
+
+if ( WritePoolFile ) :
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   OutputConditionsAlg2=OutputConditionsAlg("OutputConditionsAlg2",OutputPoolFileDir+"/"+OutputPoolFileName,
+                                           [OutputObjectSpecOFC],[OutputObjectSpecTagOFC],WriteIOV)
+   OutputConditionsAlg2.Run1 = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlg2.Run2 = IOVEnd
+   
+
+if (WriteNtuple):
+   from LArCalibTools.LArCalibToolsConf import LArOFC2Ntuple
+   LArOFC2Ntuple = LArOFC2Ntuple("LArOFC2Ntuple")
+   LArOFC2Ntuple.ContainerKey = OFCKey 	   
+   LArOFC2Ntuple.NtupleFile = "FILE2" 	   
+   topSequence+=LArOFC2Ntuple
+
+   if os.path.exists(OutputRootFileDir+"/"+OutputOFCRootFileName): 
+      os.remove(OutputRootFileDir+"/"+OutputOFCRootFileName)  
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output += [ "FILE2 DATAFILE='"+OutputRootFileDir+"/"+OutputOFCRootFileName+"' OPT='NEW'" ]
+   
+
+
+
+
+   
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = INFO
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = WARNING)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = WARNING)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_jobOptions.py
new file mode 100644
index 00000000000..6b9e6f75ab1
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_jobOptions.py
@@ -0,0 +1,641 @@
+import commands
+
+###########################################################################
+#
+# <Marco.Delmastro@cern.ch>
+#
+# Example jobOptions to reconstruction a DELAY runs in all 3 gains
+#
+# Last update: 09/12/2008 <Fabien.Tarrade@cern.ch>
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+include("RecExCommission/GetInputFiles.py")
+
+#######################################################
+#       Run properties
+#######################################################
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"
+
+if not 'RunNumberList' in dir():
+   RunNumberList = [ '0029143' ]
+   
+if not 'FilePrefix' in dir():
+   if (int(RunNumberList[0]))<99800 :
+      FilePrefix = "daq.Delay"
+   else :
+      FilePrefix = "data*"
+     
+if not 'InputDir' in dir():
+   InputDir = "/castor/cern.ch/grid/atlas/DAQ/lar/ElecCalib/2008/"+RunNumberList[0]
+   
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition = "EB-EC*"
+   else:
+      Partition = "EB-EMB*"
+
+if not 'doCaliWaveSelector' in dir():
+   doCaliWaveSelector = False      
+
+if not 'FullFileName' in dir():
+   if (int(RunNumberList[0]))<99800 :
+      Trigger = "*"+Partition
+   else :
+      Trigger = "calibration_LArElec-Delay"+".*"+Partition
+   
+   FullFileName = []
+   for RunNumber in RunNumberList :
+       FullFileName+=GetInputFilesFromTokens(InputDir,int(RunNumber),FilePrefix,Trigger)
+
+if not 'GainList' in dir():
+   GainList = [ "HIGH", "MEDIUM", "LOW" ]
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+
+if not 'ChannelSelection' in dir():
+   # read all
+   ChannelSelection = " "
+   ## example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,3:34</channelSelection>"
+
+if not 'runAccumulator' in dir(): 
+   runAccumulator = False # averaged mode
+
+from string import *
+def DBConnectionFile(sqlitefile):  
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+#######################################################
+#                Monitoring properties
+#######################################################
+
+if not 'doMonitoring' in dir():
+   doMonitoring = False
+
+if not 'doLArCalibDataQuality' in dir():
+   doLArCalibDataQuality = False  
+
+if not 'online' in dir():
+   online = False
+   
+#######################################################
+#       Delay properties
+#######################################################
+
+if not 'DACs' in dir():
+   DACs = [500] # Needed if runAccumulator = True
+
+if not 'StripsXtalkCorr' in dir():
+   StripsXtalkCorr = True # Xtalk correction for strips
+
+if not 'ShortCorrector' in dir():
+   ShortCorrector = True # correctio for short
+
+if not "ADCSaturation" in dir():
+   ADCsaturation  = 4095 # Set to 0 if you want to keep saturating pulses otherwise 4095
+   
+if not 'SubtractPed' in dir(): # Set whether to substract pedestals. Pedestals come from COOL, or local Pool file if 'PedPoolFileName' is defined, or fake pedestal subraction as 'extrema ratio'
+   SubtractPed = True
+
+if not 'CheckEmptyPhases' in dir():
+   CheckEmptyPhases = True
+
+if not 'SaveDerivedInfo' in dir():
+   SaveDerivedInfo = True
+
+if not 'SaveJitter' in dir():
+   SaveJitter = True
+
+if not 'CorrectBadChannels' in dir():
+   CorrectBadChannels=True
+  
+   
+#######################################################
+#      Delay output name
+#######################################################
+
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumberList[0])
+   
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd
+
+if not 'DBConnectionCOOL' in dir():  
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"
+
+## Pedestall   
+   
+if not 'ReadPedFromCOOL' in dir():
+   ReadPedFromCOOL = True
+   
+if not 'PedRunNumber' in dir():
+   PedRunNumber = "1005020_1005021_1005022"
+   
+if not 'InputPedPoolFileDir' in dir():
+   InputPedPoolFileDir  = commands.getoutput("pwd")
+   
+if not 'InputPedPoolFileName' in dir():
+   InputPedPoolFileName = "LArPedestal_" + str(PedRunNumber)+"_"+Partition.replace("*","") + ".pool.root"
+
+## Output
+
+if not 'LArCalibFolderOutputTag' in dir():
+   rs=FolderTagResover()
+   LArCalibFolderOutputTag = rs.getFolderTagSuffix(LArCalib_Flags.LArShapeCaliWaveFolder)
+   del rs
+
+   
+if not 'OutputCaliWaveRootFileDir' in dir():
+   OutputCaliWaveRootFileDir  = commands.getoutput("pwd")
+   
+if not 'OutputCaliWavePoolFileDir' in dir():
+   OutputCaliWavePoolFileDir  = commands.getoutput("pwd")
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)      
+
+if not 'KeyOutput' in dir():  
+   KeyOutput = "LArCaliWave" # Key of LArCaliWaveContainer saved in Pool file
+   
+if not 'BaseFileName' in dir():
+   BaseFileName = "LArCaliWave"
+   
+if StripsXtalkCorr :
+   for RunNumber in RunNumberList :
+      BaseFileName = BaseFileName+"_"+str(RunNumber)+"_"+Partition.replace("*","") +"_StripsXtalkCorr"
+else :
+   for RunNumber in RunNumberList :
+      BaseFileName = BaseFileName+"_"+str(RunNumber)+"_"+Partition.replace("*","")
+
+if not 'OutputCaliWaveRootFileName' in dir():
+   OutputCaliWaveRootFileName = BaseFileName+".root"
+   
+if not 'OutputCaliWavePoolFileName' in dir():
+   OutputCaliWavePoolFileName = BaseFileName+".pool.root"
+
+if not 'OutputObjectSpecCaliWave' in dir():
+   if StripsXtalkCorr:
+      OutputObjectSpecCaliWave = "LArCaliWaveContainer#"+KeyOutput+"#"+LArCalib_Flags.LArCaliWaveFolderXtlk
+      OutputTagSpecCaliWave = LArCalibFolderTag(LArCalib_Flags.LArCaliWaveFolderXtlk,LArCalibFolderOutputTag)
+   else:
+      OutputObjectSpecCaliWave = "LArCaliWaveContainer#"+KeyOutput+"#"+LArCalib_Flags.LArCaliWaveFolder
+      OutputTagSpecCaliWave = LArCalibFolderTag(LArCalib_Flags.LArCaliWaveFolder,LArCalibFolderOutputTag)
+   
+if ( ReadPedFromCOOL ):      
+   if 'InputPedSQLiteFile' in dir():
+      InputDBConnectionPed = DBConnectionFile(InputPedSQLiteFile)
+   else:
+      InputDBConnectionPed = DBConnectionCOOL
+
+## Bad Channel   
+   
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;"
+      InputDBConnectionBadChannel = "COOLOFL_LAR/COMP200"      
+      
+#######################################################################################
+# print summary
+#######################################################################################
+
+DelayLog = logging.getLogger( "DelayLog" )
+DelayLog.info( " ======================================================== " )
+DelayLog.info( " ***                 LAr Delay summary                *** " )
+DelayLog.info( " ======================================================== " )
+DelayLog.info( " RunNumber                          = "+str(RunNumberList) )
+DelayLog.info( " SubDetector                        = "+SubDet )
+DelayLog.info( " Partition                          = "+Partition )
+DelayLog.info( " Type                               = Delay "  )
+DelayLog.info( " LArGain                            = "+str(GainList) )
+for i in range(len(FullFileName)):
+   DelayLog.info( " FullFileName                       = "+FullFileName[i] )
+if ( ReadPedFromCOOL ):
+   DelayLog.info( " InputDBConnectionPed               = "+InputDBConnectionPed)
+else :
+   DelayLog.info( " InputPedPoolFileName               = "+InputPedPoolFileName)
+if 'PedLArCalibFolderTag' in dir() :   
+   DelayLog.info( " PedLArCalibFolderTag               = "+PedLArCalibFolderTag )
+DelayLog.info( " OutputCaliWaveRootFullFileName     = "+OutputCaliWaveRootFileDir+"/"+OutputCaliWaveRootFileName )
+DelayLog.info( " OutputCaliWavePoolFullFileName     = "+OutputCaliWavePoolFileDir+"/"+OutputCaliWavePoolFileName )
+DelayLog.info( " OutputObjectSpecCaliWave           = "+OutputObjectSpecCaliWave )
+DelayLog.info( " OutputTagSpecCaliWave              = "+OutputTagSpecCaliWave )
+DelayLog.info( " IOVBegin                           = "+str(IOVBegin) )
+DelayLog.info( " IOVEnd                             = "+str(IOVEnd) )
+DelayLog.info( " LArCalibOutputDB                   = "+OutputDB )
+DelayLog.info( " ======================================================== " )
+#######################################################################################
+
+
+include ("LArConditionsCommon/LArMinimalSetup.py")
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+theByteStreamInputSvc=svcMgr.ByteStreamInputSvc
+if not 'FullFileName' in dir():
+   DelayLog.info( "No FullFileName! Please give a FullFileName list.")
+   theApp.exit(-1)
+else :   
+   theByteStreamInputSvc.FullFileName=FullFileName
+   
+theByteStreamInputSvc.MaxBadEvents=0
+
+##############################################################################################
+#                                                                                            #
+# FullFileName is already the list of files compute by the fonction GetInputFilesFromTokens  #
+#                                                                                            #
+# maybe useful one day                                                                       #
+#                                                                                            #
+# else                                                                                        #
+#   theByteStreamInputSvc.FullFileName=OneFileName                                           #
+#   for i in range(len(theByteStreamInputSvc.FullFileName)):                                 #
+#      theByteStreamInputSvc.NumFile+=[10000]                                                #
+##############################################################################################
+   
+
+###############################################################
+#                                                             #
+#                To read BS for one or more FT                #
+#                                                             #
+###############################################################
+
+## For splitting the delay runs, there are three new jobOptions.
+## All three are vectors of integers
+#################################################################
+
+from LArByteStream.LArByteStreamConf import LArRodDecoder
+svcMgr.ToolSvc += LArRodDecoder()
+
+#ToolSvc.LArRodDecoder.BEPreselection     = [0]                                                   ## : [Barrel=0,Endcap=1]
+#ToolSvc.LArRodDecoder.PosNegPreselection = [1]                                                   ## : [C-side (negative eta)=0, A-side (positive eta)=1]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]               ## : first half of [EM barrel feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]     ## : second half of [EM barrel feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [0,1,4,7,8,11,12,13,14,17,18,19,20,23,24]             ## : [EMEC Standard feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [2,9,15,21]                                           ## : [EMEC Special feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [3,10,16,22]                                          ## : [HEC feedthrough numbers]  (note: slots 1&2 are EMEC slots)
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [6]                                                   ## : [FCAL feedthrough number]
+   
+
+###########################################################################
+#                                                                         #
+#                          Accumulator                                    #
+#                                                                         #
+###########################################################################
+
+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   #
+   include("LArCalibProcessing/LArCalib_CalibrationPatterns.py")
+
+else:
+   theByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
+   theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/HIGH"  ]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/MEDIUM"]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/LOW"   ]
+
+## 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
+from LArCalibDataQuality.LArCalibDataQualityConf import LArBadEventCatcher
+theLArBadEventCatcher=LArBadEventCatcher()
+theLArBadEventCatcher.CheckAccCalibDigitCont=True
+theLArBadEventCatcher.CheckBSErrors=True
+theLArBadEventCatcher.KeyList=GainList
+theLArBadEventCatcher.StopOnError=False
+topSequence+=theLArBadEventCatcher      
+      
+##########################################################################
+#                                                                        #
+#                      Delay run reconstruction                          #
+#                                                                        #
+##########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+include ("LArCalibProcessing/LArCalib_BadChanTool.py")
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   DelayLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   DelayLog. info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB   
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+if ( doLArCalibDataQuality  ) :
+   ## The reference is the Oracle DB
+   if StripsXtalkCorr:
+      conddb.addFolder("",LArCalib_Flags.LArCaliWaveFolderXtlk+"<key>LArCaliWaveRef</key><dbConnection>"+DBConnectionCOOL+"</dbConnection>"+ChannelSelection)
+   else:
+      conddb.addFolder("",LArCalib_Flags.LArCaliWaveFolder+"<key>LArCaliWaveRef</key><dbConnection>"+DBConnectionCOOL+"</dbConnection>"+ChannelSelection)
+
+if (SubtractPed):
+   if ( ReadPedFromCOOL ):
+      if not 'InputPedSQLiteFile' in dir():
+         DelayLog.info( "Read Pedestal from Oracle DB")
+      else :   
+         DelayLog.info( "Read Pedestal from SQLite file") 
+
+      PedestalFolder = LArCalib_Flags.LArPedestalFolder
+      if 'PedLArCalibFolderTag' in dir() :
+         PedestalTagSpec = LArCalibFolderTag (PedestalFolder,PedLArCalibFolderTag)
+         conddb.addFolder("",PedestalFolder+"<tag>"+PedestalTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPed+"</dbConnection>"+ChannelSelection)
+      else :   
+         conddb.addFolder("",PedestalFolder+"<dbConnection>"+InputDBConnectionPed+"</dbConnection>"+ChannelSelection)    
+   else:
+      if 'InputPedPoolFileName' in dir():
+         DelayLog.info( "Read Pedestal from POOL file") 
+         PoolFileList += [ InputPedPoolFileDir+"/"+InputPedPoolFileName ]
+
+      else:
+         DelayLog.info( "LArCaliWaveBuilder WARNING : Using fake pedestals subtraction for all channels.")
+   
+if ( len(PoolFileList)>0 ):
+   
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+   
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+
+if ( ShortCorrector ):
+   
+   from LArCalibUtils.LArCalibUtilsConf import LArCalibShortCorrector
+   theLArCalibShortCorrector = LArCalibShortCorrector()
+   theLArCalibShortCorrector.KeyList = GainList
+   theLArCalibShortCorrector.OutputLevel=INFO
+   topSequence +=theLArCalibShortCorrector
+   
+if ( StripsXtalkCorr ) :
+
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   from LArCalibUtils.LArCalibUtilsConf import LArStripsCrossTalkCorrector
+   theLArStripsCrossTalkCorrector = LArStripsCrossTalkCorrector()
+   theLArStripsCrossTalkCorrector.KeyList = GainList
+   theLArStripsCrossTalkCorrector.ADCsaturation = ADCsaturation
+   theLArStripsCrossTalkCorrector.NoXtalkCorr=LArBadChannelMasker("NoXtalkCorr",
+                                                               DoMasking=True,
+                                                               ProblemsToMask=["deadReadout","deadPhys","deadCalib","almostDead"]
+                                                               )
+   theLArStripsCrossTalkCorrector.DontUseForXtalkCorr=LArBadChannelMasker("DontUseForXtalkCorr",
+                                                                       DoMasking=True,
+                                                                       ProblemsToMask=["short","peculiarCalibrationLine"]
+                                                                       )                           
+   theLArStripsCrossTalkCorrector.AcceptableDifference=25.0 #in per-cent                                                                       
+   topSequence +=theLArStripsCrossTalkCorrector
+ 
+from LArCalibUtils.LArCalibUtilsConf import LArCaliWaveBuilder
+LArCaliWaveBuilder = LArCaliWaveBuilder()
+LArCaliWaveBuilder.KeyList          = GainList
+if (doCaliWaveSelector) :
+   LArCaliWaveBuilder.KeyOutput        = KeyOutput+"multi"
+else :   
+   LArCaliWaveBuilder.KeyOutput        = KeyOutput
+LArCaliWaveBuilder.GroupingType     = GroupingType
+LArCaliWaveBuilder.SubtractPed      = SubtractPed
+LArCaliWaveBuilder.CheckEmptyPhases = CheckEmptyPhases
+LArCaliWaveBuilder.NBaseline        = 0 # to avoid the use of the baseline when Pedestal are missing
+LArCaliWaveBuilder.UseDacAndIsPulsedIndex = False # should have an impact only for HEC
+
+if StripsXtalkCorr:
+   LArCaliWaveBuilder.ADCsaturation = 0
+else:
+   LArCaliWaveBuilder.ADCsaturation = ADCsaturation
+   
+topSequence+=LArCaliWaveBuilder
+
+if (doCaliWaveSelector) :
+   from LArCalibUtils.LArCalibUtilsConf import LArCaliWaveSelector
+   LArCaliWaveSelector = LArCaliWaveSelector("LArCaliWaveSelector")
+   LArCaliWaveSelector.KeyList         = [ KeyOutput+"multi" ]
+   LArCaliWaveSelector.KeyOutput       = KeyOutput
+   if (GainList[0]=="HIGH") :
+      LArCaliWaveSelector.SelectionList = [ "HEC/0/0/460","HEC/1/0/460","HEC/2/0/230","HEC/3/0/230" ] 
+
+   if (GainList[0]=="MEDIUM") :
+      LArCaliWaveSelector.SelectionList = [ "HEC/0/1/3600","HEC/1/1/3600","HEC/2/1/1800","HEC/3/1/1800"]
+   
+   if (GainList[0]=="LOW") :   
+      LArCaliWaveSelector.SelectionList = [ "HEC/0/2/24000","HEC/1/2/24000","HEC/2/2/18000","HEC/3/2/18000" ]
+      
+   topSequence+=LArCaliWaveSelector
+
+######################################################################
+#                                                                    #
+#                          Correction                                #
+#                                                                    #
+######################################################################
+
+if CorrectBadChannels:
+
+   from LArCalibUtils.LArCalibUtilsConf import LArCalibPatchingAlg_LArCaliWaveContainer_
+   theLArCaliWavePatcher=LArCalibPatchingAlg_LArCaliWaveContainer_("LArCaliWavePatcher")
+   theLArCaliWavePatcher.ContainerKey=KeyOutput
+   #theLArCaliWavePatcher.PatchMethod="PhiNeighbor" ##take the first neigbour
+   theLArCaliWavePatcher.PatchMethod="PhiAverage" ##do an aveage in phi after removing bad and empty event
+   theLArCaliWavePatcher.OutputLevel=INFO
+   
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
+   theLArBadChannelTool=LArBadChanTool()
+   ToolSvc+=theLArBadChannelTool
+   
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   theLArRCBMasker=LArBadChannelMasker("LArRCBMasker")
+   theLArRCBMasker.DoMasking=True
+   theLArRCBMasker.ProblemsToMask=[
+      "deadCalib","deadReadout","deadPhys","almostDead","short",
+      ]
+   ToolSvc+=theLArRCBMasker
+   theLArCaliWavePatcher.MaskingTool=theLArRCBMasker
+   topSequence+=theLArCaliWavePatcher
+ 
+##########################################################################
+#                                                                        #
+#                                 Output                                 #
+#                                                                        #
+##########################################################################
+
+if ( doLArCalibDataQuality  ) :
+   
+   from LArCalibDataQuality.LArCalibDataQualityConf import LArCaliWaveValidationAlg
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   theLArDelayValBCMask=LArBadChannelMasker("DelayValBCMask",
+                                            DoMasking=True,
+                                            ProblemsToMask=["deadReadout","deadCalib","deadPhys","almostDead",
+                                                            "highNoiseHG","highNoiseMG","highNoiseLG"]
+                                            )
+   svcMgr.ToolSvc+=theLArDelayValBCMask
+   from LArCalibDataQuality.Thresholds import cwFWHMThr, cwAmpThr,cwAmpThrFEB, cwFWHMThrFEB  
+   theCaliWaveValidationAlg=LArCaliWaveValidationAlg("CaliWaveVal")
+   theCaliWaveValidationAlg.BadChannelMaskingTool=theLArDelayValBCMask
+   theCaliWaveValidationAlg.ValidationKey=KeyOutput
+   theCaliWaveValidationAlg.ReferenceKey="LArCaliWaveRef"
+   theCaliWaveValidationAlg.MsgLevelForDeviations=WARNING
+   theCaliWaveValidationAlg.ListOfDevFEBs="caliWaveFebs.txt"
+   theCaliWaveValidationAlg.AmplitudeTolerance=cwAmpThr
+   theCaliWaveValidationAlg.CaliWaveFWHMTolerance=cwFWHMThr
+   theCaliWaveValidationAlg.AmplitudeToleranceFEB=cwAmpThrFEB
+   theCaliWaveValidationAlg.CaliWaveFWHMToleranceFEB=cwFWHMThrFEB
+   topSequence+=theCaliWaveValidationAlg
+   
+   ## second instance of the validation tool to detect "bad" channel 
+   theBadCaliWave=LArCaliWaveValidationAlg("theBadCaliWave")
+   theBadCaliWave.BadChannelMaskingTool=theLArDelayValBCMask
+   theBadCaliWave.ValidationKey=KeyOutput
+   theBadCaliWave.ReferenceKey="LArCaliWaveRef"
+   theBadCaliWave.MsgLevelForDeviations=ERROR
+   theBadCaliWave.ListOfDevFEBs="Bad_caliWaveFebs.txt"
+   theBadCaliWave.AmplitudeTolerance=["20,20,20"]
+   theBadCaliWave.CaliWaveFWHMTolerance=["50,50,50"]
+   theBadCaliWave.AmplitudeToleranceFEB=["10,10,10"]
+   theBadCaliWave.CaliWaveFWHMToleranceFEB=["80,80,80"]
+   theBadCaliWave.OutputLevel=DEBUG
+   topSequence+=theBadCaliWave
+   
+
+if ( doMonitoring ) :
+   
+   from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+   topSequence += AthenaMonManager( "LArMon" )
+   LArMon = topSequence.LArMon
+
+   ## old style
+   #LArMon.FileKey = "AllMon"
+   #LArMon.ManualDataTypeSetup = True
+   #LArMon.Environment         = "user"
+   #LArMon.ManualRunLBSetup    = True
+   #LArMon.Run                 = 1
+   #LArMon.LumiBlock           = 1
+   #LArMon.CheckEveryNoEvents  = 999999 #to do the check only at the end of the run
+
+   ## tier0 style
+   LArMon.FileKey = "GLOBAL"
+   LArMon.ManualDataTypeSetup = True
+   LArMon.Environment         = "tier0"
+   LArMon.ManualRunLBSetup    = True
+   LArMon.Run                 = int(RunNumberList[0])
+   LArMon.LumiBlock           = 1
+   LArMon.CheckEveryNoEvents  = 999999 #to do the check only at the end of the run
+   
+   include("LArMonTools/LArFEBMon_jobOptions.py")
+   
+   RootHistOutputFileName='RootHistos_'+BaseFileName+".root"
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import THistSvc
+   if os.path.exists(OutputCaliWaveRootFileDir+ "/" +RootHistOutputFileName): 
+      os.remove(OutputCaliWaveRootFileDir + "/" +RootHistOutputFileName)
+   svcMgr += THistSvc()
+   #svcMgr.THistSvc.Output = ["AllMon DATAFILE='"+OutputCaliWaveRootFileDir+ "/" +RootHistOutputFileName+"' OPT='New'"] 
+
+   svcMgr.THistSvc.Output =  ["GLOBAL DATAFILE='"+OutputCaliWaveRootFileDir+ "/" +RootHistOutputFileName+"' OPT='New'"]
+
+
+if (WriteNtuple):
+   from LArCalibTools.LArCalibToolsConf import LArCaliWaves2Ntuple
+   LArCaliWaves2Ntuple = LArCaliWaves2Ntuple( "LArCaliWaves2Ntuple" )
+   LArCaliWaves2Ntuple.NtupleName  = "CALIWAVE"
+   LArCaliWaves2Ntuple.SaveDerivedInfo = SaveDerivedInfo
+   LArCaliWaves2Ntuple.SaveJitter = SaveJitter
+   LArCaliWaves2Ntuple.KeyList     = [ KeyOutput ]
+   
+   topSequence+=LArCaliWaves2Ntuple
+   
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputCaliWaveRootFileDir+"/"+OutputCaliWaveRootFileName): 
+      os.remove(OutputCaliWaveRootFileDir+"/"+OutputCaliWaveRootFileName)  
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputCaliWaveRootFileDir+"/"+OutputCaliWaveRootFileName+"' OPT='NEW'" ]
+
+if ( WritePoolFile ) :
+   
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   if os.path.exists(OutputCaliWavePoolFileDir+"/"+OutputCaliWavePoolFileName): 
+      os.remove(OutputCaliWavePoolFileDir+"/"+OutputCaliWavePoolFileName)
+   OutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg",OutputCaliWavePoolFileDir+"/"+OutputCaliWavePoolFileName,
+                                           [OutputObjectSpecCaliWave],[OutputTagSpecCaliWave],WriteIOV)
+   OutputConditionsAlg.Run1 = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlg.Run2 = IOVEnd
+   
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+   
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+   
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = WARNING)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = WARNING)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_splitter_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_splitter_jobOptions.py
new file mode 100644
index 00000000000..2902bacefac
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_splitter_jobOptions.py
@@ -0,0 +1,714 @@
+import commands
+
+###########################################################################
+#
+# <pavol@mail.cern.ch>
+#
+# jO to reconstruct a DELAY per calibration line 
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+include("RecExCommission/GetInputFiles.py")
+
+#######################################################
+#       Run properties
+#######################################################
+
+if not 'SubDet' in dir():
+   SubDet = "EndCap"
+
+if not 'RunNumberList' in dir():
+   RunNumberList = [ '00121536','00121539','00121542' ]
+   
+if not 'AllWavesPerCh' in dir():
+      AllWavesPerCh      =  True
+
+if not 'MaxCalLinePerCh' in dir():
+      MaxCalLinePerCh = 4
+
+if not 'FilePrefix' in dir():
+   if (int(RunNumberList[0]))<99800 :
+      FilePrefix = "daq.Delay"
+   else :
+      FilePrefix = "data*"
+     
+if not 'InputDir' in dir():
+   InputDir = "/castor/cern.ch/grid/atlas/DAQ/lar/ElecCalib/2008/"+RunNumberList[0]
+   
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition = "EB-EC*"
+   else:
+      Partition = "EB-EMB*"
+
+if not 'doCaliWaveSelector' in dir():
+   doCaliWaveSelector = False      
+
+#if not 'RecAll' in dir():
+#   RecAll = False
+
+if not 'Trigger' in dir():
+   if (int(RunNumberList[0]))<99800 :
+      Trigger = "*"+Partition
+   else :
+      Trigger = "calibration_LArElec-Delay"+".*"+Partition
+   
+if not 'FullFileName' in dir():
+   FullFileName = []
+   for RunNumber in RunNumberList :
+       FullFileName+=GetInputFilesFromTokens(InputDir,int(RunNumber),FilePrefix,Trigger)
+
+if not 'GainList' in dir():
+   GainList = [ "HIGH", "MEDIUM", "LOW" ]
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+
+if not 'ChannelSelection' in dir():
+   # read all
+   ChannelSelection = " "
+   ## example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,3:34</channelSelection>"
+
+if not 'runAccumulator' in dir(): 
+   runAccumulator = False # averaged mode
+
+from string import *
+def DBConnectionFile(sqlitefile):  
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+#######################################################
+#                Monitoring properties
+#######################################################
+
+if not 'doMonitoring' in dir():
+   doMonitoring = False
+
+if not 'doLArCalibDataQuality' in dir():
+   doLArCalibDataQuality = False  
+
+if not 'online' in dir():
+   online = False
+   
+#######################################################
+#       Delay properties
+#######################################################
+
+if not 'DACs' in dir():
+   DACs = [500] # Needed if runAccumulator = True
+
+if not 'StripsXtalkCorr' in dir():
+   StripsXtalkCorr = True # Xtalk correction for strips
+
+if not 'ShortCorrector' in dir():
+   ShortCorrector = True # correctio for short
+
+if not "ADCSaturation" in dir():
+   ADCsaturation  = 4095 # Set to 0 if you want to keep saturating pulses otherwise 4095
+   
+if not 'SubtractPed' in dir(): # Set whether to substract pedestals. Pedestals come from COOL, or local Pool file if 'PedPoolFileName' is defined, or fake pedestal subraction as 'extrema ratio'
+   SubtractPed = True
+
+if not 'CheckEmptyPhases' in dir():
+   CheckEmptyPhases = True
+
+if not 'SaveDerivedInfo' in dir():
+   SaveDerivedInfo = True
+
+if not 'SaveJitter' in dir():
+   SaveJitter = True
+
+if not 'CorrectBadChannels' in dir():
+   CorrectBadChannels=True
+  
+   
+#######################################################
+#      Delay output name
+#######################################################
+
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumberList[0])
+   
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd
+
+if not 'DBConnectionCOOL' in dir():  
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;user=ATLAS_COOL_READER"
+
+## Pedestall   
+   
+if not 'ReadPedFromCOOL' in dir():
+   ReadPedFromCOOL = True
+   
+if not 'PedRunNumber' in dir():
+   PedRunNumber = "1005020_1005021_1005022"
+   
+if not 'InputPedPoolFileDir' in dir():
+   InputPedPoolFileDir  = commands.getoutput("pwd")
+   
+if not 'InputPedPoolFileName' in dir():
+   InputPedPoolFileName = "LArPedestal_" + str(PedRunNumber)+"_"+Partition.replace("*","") + ".pool.root"
+
+## Output
+
+if not 'LArCalibFolderOutputTag' in dir():
+   LArCalibFolderOutputTag = '-UPD3-00'    
+   
+if not 'OutputCaliWaveRootFileDir' in dir():
+   OutputCaliWaveRootFileDir  = commands.getoutput("pwd")
+   
+if not 'OutputCaliWavePoolFileDir' in dir():
+   OutputCaliWavePoolFileDir  = commands.getoutput("pwd")
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)      
+
+if not 'KeyOutput' in dir():  
+   KeyOutput = "LArCaliWave" # Key of LArCaliWaveContainer saved in Pool file
+   
+if AllWavesPerCh:
+   KeyOutputSplitted = []
+   for i in range(0, MaxCalLinePerCh):
+            KeyOutputSplitted.append(KeyOutput+str(i))
+
+if not 'BaseFileName' in dir():
+   BaseFileName = "LArCaliWave"
+   
+for RunNumber in RunNumberList :
+   BaseFileName = BaseFileName+"_"+str(RunNumber)
+
+if StripsXtalkCorr :
+   BaseFileName = BaseFileName+"_StripsXtalkCorr"
+
+if AllWavesPerCh:
+   BaseFileName = BaseFileName+"_single"
+else:
+   BaseFileName = BaseFileName+"_averaged"
+     
+if not 'OutputCaliWaveRootFileName' in dir():
+   OutputCaliWaveRootFileName = BaseFileName+".root"
+   
+if not 'OutputCaliWavePoolFileName' in dir():
+   OutputCaliWavePoolFileName = BaseFileName+".pool.root"
+
+if not 'OutputObjectSpecCaliWave' in dir():
+   if StripsXtalkCorr:
+      OutputObjectSpecCaliWave = ["LArCaliWaveContainer#"+KeyOutput+"#"+LArCalib_Flags.LArCaliWaveFolderXtlk]
+      OutputTagSpecCaliWave = LArCalibFolderTag(LArCalib_Flags.LArCaliWaveFolderXtlk,LArCalibFolderOutputTag)
+   else:
+      if ( AllWavesPerCh ) :
+         OutputObjectSpecCaliWave = []
+         for i in range(0, MaxCalLinePerCh):
+            if doCaliWaveSelector:
+               OutputObjectSpecCaliWave.append("LArCaliWaveContainer#"+KeyOutputSplitted[i]+"Sel"+"#"+LArCalib_Flags.LArCaliWaveFolder+str(i))
+            else:   
+               OutputObjectSpecCaliWave.append("LArCaliWaveContainer#"+KeyOutputSplitted[i]+"#"+LArCalib_Flags.LArCaliWaveFolder+str(i))
+      else:         
+         if doCaliWaveSelector:
+            OutputObjectSpecCaliWave = ["LArCaliWaveContainer#"+KeyOutput+"Sel"+"#"+LArCalib_Flags.LArCaliWaveFolder]
+         else:   
+            OutputObjectSpecCaliWave = ["LArCaliWaveContainer#"+KeyOutput+"#"+LArCalib_Flags.LArCaliWaveFolder]
+      OutputTagSpecCaliWave = LArCalibFolderTag(LArCalib_Flags.LArCaliWaveFolder,LArCalibFolderOutputTag)
+   
+if ( ReadPedFromCOOL ):      
+   if 'InputPedSQLiteFile' in dir():
+      InputDBConnectionPed = DBConnectionFile(InputPedSQLiteFile)
+   else:
+      InputDBConnectionPed = DBConnectionCOOL
+
+## Bad Channel   
+   
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;user=ATLAS_COOL_READER"
+      InputDBConnectionBadChannel = "COOLONL_LAR/COMP200"      
+      
+#######################################################################################
+# print summary
+#######################################################################################
+
+DelayLog = logging.getLogger( "DelayLog" )
+DelayLog.info( " ======================================================== " )
+DelayLog.info( " ***                 LAr Delay summary                *** " )
+DelayLog.info( " ======================================================== " )
+DelayLog.info( " RunNumber                          = "+str(RunNumberList) )
+DelayLog.info( " SubDetector                        = "+SubDet )
+DelayLog.info( " Partition                          = "+Partition )
+DelayLog.info( " Type                               = Delay "  )
+DelayLog.info( " LArGain                            = "+str(GainList) )
+for i in range(len(FullFileName)):
+   DelayLog.info( " FullFileName                       = "+FullFileName[i] )
+if ( ReadPedFromCOOL ):
+   DelayLog.info( " InputDBConnectionPed               = "+InputDBConnectionPed)
+else :
+   DelayLog.info( " InputPedPoolFileName               = "+InputPedPoolFileName)
+if 'PedLArCalibFolderTag' in dir() :   
+   DelayLog.info( " PedLArCalibFolderTag               = "+PedLArCalibFolderTag )
+DelayLog.info( " OutputCaliWaveRootFullFileName     = "+OutputCaliWaveRootFileDir+"/"+OutputCaliWaveRootFileName )
+DelayLog.info( " OutputCaliWavePoolFullFileName     = "+OutputCaliWavePoolFileDir+"/"+OutputCaliWavePoolFileName )
+#DelayLog.info( " OutputObjectSpecCaliWave           = "+OutputObjectSpecCaliWave )
+DelayLog.info( " OutputTagSpecCaliWave              = "+OutputTagSpecCaliWave )
+DelayLog.info( " IOVBegin                           = "+str(IOVBegin) )
+DelayLog.info( " IOVEnd                             = "+str(IOVEnd) )
+DelayLog.info( " LArCalibOutputDB                   = "+OutputDB )
+DelayLog.info( " ======================================================== " )
+#######################################################################################
+
+
+include ("LArConditionsCommon/LArMinimalSetup.py")
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+theByteStreamInputSvc=svcMgr.ByteStreamInputSvc
+if not 'FullFileName' in dir():
+   DelayLog.info( "No FullFileName! Please give a FullFileName list.")
+   theApp.exit(-1)
+else :   
+   theByteStreamInputSvc.FullFileName=FullFileName
+   
+theByteStreamInputSvc.MaxBadEvents=0
+
+##############################################################################################
+#                                                                                            #
+# FullFileName is already the list of files compute by the fonction GetInputFilesFromTokens  #
+#                                                                                            #
+# maybe useful one day                                                                       #
+#                                                                                            #
+# else                                                                                        #
+#   theByteStreamInputSvc.FullFileName=OneFileName                                           #
+#   for i in range(len(theByteStreamInputSvc.FullFileName)):                                 #
+#      theByteStreamInputSvc.NumFile+=[10000]                                                #
+##############################################################################################
+   
+
+###############################################################
+#                                                             #
+#                To read BS for one or more FT                #
+#                                                             #
+###############################################################
+
+## For splitting the delay runs, there are three new jobOptions.
+## All three are vectors of integers
+#################################################################
+
+from LArByteStream.LArByteStreamConf import LArRodDecoder
+svcMgr.ToolSvc += LArRodDecoder()
+
+#ToolSvc.LArRodDecoder.BEPreselection     = [0]                                                   ## : [Barrel=0,Endcap=1]
+#ToolSvc.LArRodDecoder.PosNegPreselection = [1]                                                   ## : [C-side (negative eta)=0, A-side (positive eta)=1]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]               ## : first half of [EM barrel feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]     ## : second half of [EM barrel feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [0,1,4,7,8,11,12,13,14,17,18,19,20,23,24]             ## : [EMEC Standard feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [2,9,15,21]                                           ## : [EMEC Special feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [3,10,16,22]                                          ## : [HEC feedthrough numbers]  (note: slots 1&2 are EMEC slots)
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [6]                                                   ## : [FCAL feedthrough number]
+   
+
+###########################################################################
+#                                                                         #
+#                          Accumulator                                    #
+#                                                                         #
+###########################################################################
+
+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   #
+   include("LArCalibProcessing/LArCalib_CalibrationPatterns.py")
+
+else:
+   theByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
+   theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/HIGH"  ]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/MEDIUM"]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/LOW"   ]
+
+## 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")   
+#from LArCalibDataQuality.LArCalibDataQualityConf import LArBadEventCatcher
+#theLArBadEventCatcher=LArBadEventCatcher()
+#theLArBadEventCatcher.CheckAccCalibDigitCont=True
+#theLArBadEventCatcher.CheckBSErrors=True
+#theLArBadEventCatcher.KeyList=GainList
+#theLArBadEventCatcher.StopOnError=False
+#topSequence+=theLArBadEventCatcher      
+      
+##########################################################################
+#                                                                        #
+#                      Delay run reconstruction                          #
+#                                                                        #
+##########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+BadChannelsFolder="/LAR/BadChannels/BadChannels"
+MissingFEBsFolder="/LAR/BadChannels/MissingFEBs"
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   DelayLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   DelayLog. info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB   
+
+svcMgr.PoolSvc.ReadCatalog += ["xmlcatalog_file:/afs/cern.ch/user/l/larcalib/w0/stableConds/PoolCat_stable.xml",
+                               "prfile:poolcond/PoolCat_oflcond.xml",
+                               "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_diskbuffer_afs.xml",
+                               "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_cond09_data.000001.lar.COND_castor.xml",
+                               "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_cond08_data.000001.lar.COND_castor.xml",
+                               "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_comcond.000005.lar_conditions.recon.pool.v0000_castor.xml",
+                               "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_comcond.000006.lar_conditions.recon.pool.v0000_castor.xml"]
+
+
+if ( doLArCalibDataQuality  ) :
+   ## The reference is the Oracle DB
+   if StripsXtalkCorr:
+      conddb.addFolder("",LArCalib_Flags.LArCaliWaveFolderXtlk+"<key>LArCaliWaveRef</key><dbConnection>"+DBConnectionCOOL+"</dbConnection>"+ChannelSelection)
+   else:
+      conddb.addFolder("",LArCalib_Flags.LArCaliWaveFolder+"<key>LArCaliWaveRef</key><dbConnection>"+DBConnectionCOOL+"</dbConnection>"+ChannelSelection)
+
+if (SubtractPed):
+   if ( ReadPedFromCOOL ):
+      if not 'InputPedSQLiteFile' in dir():
+         DelayLog.info( "Read Pedestal from Oracle DB")
+      else :   
+         DelayLog.info( "Read Pedestal from SQLite file") 
+
+      PedestalFolder = LArCalib_Flags.LArPedestalFolder
+      if 'PedLArCalibFolderTag' in dir() :
+         PedestalTagSpec = LArCalibFolderTag (PedestalFolder,PedLArCalibFolderTag)
+         conddb.addFolder("",PedestalFolder+"<tag>"+PedestalTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPed+"</dbConnection>"+ChannelSelection)
+      else :   
+         conddb.addFolder("",PedestalFolder+"<dbConnection>"+InputDBConnectionPed+"</dbConnection>"+ChannelSelection)    
+   else:
+      if 'InputPedPoolFileName' in dir():
+         DelayLog.info( "Read Pedestal from POOL file") 
+         PoolFileList += [ InputPedPoolFileDir+"/"+InputPedPoolFileName ]
+
+      else:
+         DelayLog.info( "LArCaliWaveBuilder WARNING : Using fake pedestals subtraction for all channels.")
+   
+if ( len(PoolFileList)>0 ):
+   
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+   
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+
+if ( ShortCorrector ):
+   
+   from LArCalibUtils.LArCalibUtilsConf import LArCalibShortCorrector
+   theLArCalibShortCorrector = LArCalibShortCorrector()
+   theLArCalibShortCorrector.KeyList = GainList
+   theLArCalibShortCorrector.OutputLevel=INFO
+   topSequence +=theLArCalibShortCorrector
+   
+if ( StripsXtalkCorr ) :
+
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   from LArCalibUtils.LArCalibUtilsConf import LArStripsCrossTalkCorrector
+   theLArStripsCrossTalkCorrector = LArStripsCrossTalkCorrector()
+   theLArStripsCrossTalkCorrector.KeyList = GainList
+   theLArStripsCrossTalkCorrector.ADCsaturation = ADCsaturation
+   theLArStripsCrossTalkCorrector.NoXtalkCorr=LArBadChannelMasker("NoXtalkCorr",
+                                                               DoMasking=True,
+                                                               ProblemsToMask=["deadReadout","deadPhys","deadCalib","almostDead"]
+                                                               )
+   theLArStripsCrossTalkCorrector.DontUseForXtalkCorr=LArBadChannelMasker("DontUseForXtalkCorr",
+                                                                       DoMasking=True,
+                                                                       ProblemsToMask=["short","peculiarCalibrationLine"]
+                                                                       )                           
+   theLArStripsCrossTalkCorrector.AcceptableDifference=25.0 #in per-cent                                                                       
+   topSequence +=theLArStripsCrossTalkCorrector
+ 
+# Now the complicated part, splitter or not
+from LArCalibUtils.LArCalibUtilsConf import LArCaliWaveBuilder
+if ( AllWavesPerCh ) :
+   ContNameSplitted = []
+   for i in range(0, MaxCalLinePerCh):
+          ContNameSplitted.append("CalLine"+str(i))
+
+   from LArCalibUtils.LArCalibUtilsConf import LArAccumulatedCalibDigitContSplitter
+   LArAccumulatedCalibDigitContSplitter = LArAccumulatedCalibDigitContSplitter("LArAccumulatedCalibDigitContSplitter")
+   LArAccumulatedCalibDigitContSplitter.KeyList         = GainList
+   LArAccumulatedCalibDigitContSplitter.KeyOutputList = ContNameSplitted
+   LArAccumulatedCalibDigitContSplitter.NumberSplitted  = MaxCalLinePerCh
+   LArAccumulatedCalibDigitContSplitter.UseDacAndIsPulsedIndex = True
+   LArAccumulatedCalibDigitContSplitter.OutputLevel = ERROR
+   topSequence += LArAccumulatedCalibDigitContSplitter
+
+   LArCaliWaveBuilderVec = []
+   if(doCaliWaveSelector):
+           from LArCalibUtils.LArCalibUtilsConf import LArCaliWaveSelector
+           LArCaliWaveSelVec = []
+
+   for i in range(0, MaxCalLinePerCh):
+            topSequence += LArCaliWaveBuilder("LArCaliWaveBuilder"+str(i+1))
+            exec 'LArCaliWaveBuilderVec.append( topSequence.LArCaliWaveBuilder%(fn)s )' % {'fn' :i+1}
+            LArCaliWaveBuilderVec[i].KeyList         = [ ContNameSplitted[i] ]
+            LArCaliWaveBuilderVec[i].KeyOutput       = KeyOutputSplitted[i]
+            LArCaliWaveBuilderVec[i].ADCsaturation   = ADCsaturation
+            LArCaliWaveBuilderVec[i].GroupingType    = GroupingType
+            LArCaliWaveBuilderVec[i].SubtractPed     = SubtractPed
+            LArCaliWaveBuilderVec[i].CheckEmptyPhases= CheckEmptyPhases
+            LArCaliWaveBuilderVec[i].NBaseline       = 0
+#            LArCaliWaveBuilderVec[i].RecAllCells     = RecAll
+            LArCaliWaveBuilderVec[i].UseDacAndIsPulsedIndex = True
+            LArCaliWaveBuilderVec[i].OutputLevel     = ERROR
+            if(doCaliWaveSelector):
+                 topSequence += LArCaliWaveSelector("LArCaliWaveSelector"+str(i+1))
+                 exec 'LArCaliWaveSelVec.append( topSequence.LArCaliWaveSelector%(fn)s )' % {'fn' :i+1}
+                 LArCaliWaveSelVec[i].KeyList         = [ KeyOutputSplitted[i] ]
+                 LArCaliWaveSelVec[i].KeyOutput       = KeyOutputSplitted[i]+"Sel"       
+                 LArCaliWaveSelVec[i].SelectionList   = [ "HEC/0/1/3600","HEC/1/1/3600","HEC/2/1/1800","HEC/3/1/1800"]
+                 LArCaliWaveSelVec[i].SelectionList   += [ "HEC/0/0/460","HEC/1/0/460","HEC/2/0/230","HEC/3/0/230"]
+                 LArCaliWaveSelVec[i].SelectionList   += [ "HEC/0/2/24000","HEC/1/2/24000","HEC/2/2/18000","HEC/3/2/18000"]
+                 LArCaliWaveSelVec[i].OutputLevel     = ERROR
+
+else :
+   LArCaliWaveBuilder = LArCaliWaveBuilder()
+   LArCaliWaveBuilder.KeyList          = GainList
+   LArCaliWaveBuilder.KeyOutput        = KeyOutput
+   LArCaliWaveBuilder.GroupingType     = GroupingType
+   LArCaliWaveBuilder.SubtractPed      = SubtractPed
+   LArCaliWaveBuilder.CheckEmptyPhases = CheckEmptyPhases
+   LArCaliWaveBuilder.NBaseline        = 0 # to avoid the use of the baseline when Pedestal are missing
+   LArCaliWaveBuilder.UseDacAndIsPulsedIndex = False # should have an impact only for HEC
+
+   if StripsXtalkCorr:
+      LArCaliWaveBuilder.ADCsaturation = 0
+   else:
+      LArCaliWaveBuilder.ADCsaturation = ADCsaturation
+   
+   topSequence+=LArCaliWaveBuilder
+
+   if (doCaliWaveSelector) :
+      from LArCalibUtils.LArCalibUtilsConf import LArCaliWaveSelector
+      LArCaliWaveSelector = LArCaliWaveSelector("LArCaliWaveSelector")
+      LArCaliWaveSelector.KeyList         = [ KeyOutput ]
+      LArCaliWaveSelector.KeyOutput       = KeyOutput+"Sel"
+      LArCaliWaveSelector.SelectionList = [ "HEC/0/0/460","HEC/1/0/460","HEC/2/0/230","HEC/3/0/230" ] 
+      LArCaliWaveSelector.SelectionList += [ "HEC/0/1/3600","HEC/1/1/3600","HEC/2/1/1800","HEC/3/1/1800"]
+      LArCaliWaveSelector.SelectionList += [ "HEC/0/2/24000","HEC/1/2/24000","HEC/2/2/18000","HEC/3/2/18000" ]
+      
+      topSequence+=LArCaliWaveSelector
+
+######################################################################
+#                                                                    #
+#                          Correction                                #
+#                                                                    #
+######################################################################
+# Not done on splitted caliwaves yet
+if CorrectBadChannels:
+
+   from LArCalibUtils.LArCalibUtilsConf import LArCalibPatchingAlg_LArCaliWaveContainer_
+   theLArCaliWavePatcher=LArCalibPatchingAlg_LArCaliWaveContainer_("LArCaliWavePatcher")
+   theLArCaliWavePatcher.ContainerKey=KeyOutput
+   #theLArCaliWavePatcher.PatchMethod="PhiNeighbor" ##take the first neigbour
+   theLArCaliWavePatcher.PatchMethod="PhiAverage" ##do an aveage in phi after removing bad and empty event
+   theLArCaliWavePatcher.OutputLevel=INFO
+   
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
+   theLArBadChannelTool=LArBadChanTool()
+   theLArBadChannelTool.OutputLevel=DEBUG
+   ToolSvc+=theLArBadChannelTool
+   
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   theLArRCBMasker=LArBadChannelMasker("LArRCBMasker")
+   theLArRCBMasker.DoMasking=True
+   theLArRCBMasker.ProblemsToMask=[
+      "deadCalib","deadReadout","deadPhys","almostDead","short",
+      ]
+   ToolSvc+=theLArRCBMasker
+   theLArCaliWavePatcher.MaskingTool=theLArRCBMasker
+   topSequence+=theLArCaliWavePatcher
+ 
+##########################################################################
+#                                                                        #
+#                                 Output                                 #
+#                                                                        #
+##########################################################################
+
+if ( doLArCalibDataQuality  ) :
+
+   from LArCalibDataQuality.LArCalibDataQualityConf import LArCaliWaveValidationAlg
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   theLArDelayValBCMask=LArBadChannelMasker("DelayValBCMask",
+                                            DoMasking=True,
+                                            ProblemsToMask=["deadReadout","deadCalib","deadPhys","almostDead",
+                                                            "highNoiseHG","highNoiseMG","highNoiseLG"]
+                                            )
+   svcMgr.ToolSvc+=theLArDelayValBCMask
+                    
+   theCaliWaveValidationAlg=LArCaliWaveValidationAlg()
+   theCaliWaveValidationAlg.BadChannelMaskingTool=theLArDelayValBCMask
+   theCaliWaveValidationAlg.ValidationKey=KeyOutput
+   theCaliWaveValidationAlg.ReferenceKey="LArCaliWaveRef"
+   theCaliWaveValidationAlg.MsgLevelForDeviations=INFO
+   theCaliWaveValidationAlg.ListOfDevFEBs="caliWaveFebs.txt"
+   topSequence+=theCaliWaveValidationAlg
+   
+   ## second instance of the validation tool to detect "bad" channel 
+   theBadCaliWave=LArCaliWaveValidationAlg("theBadCaliWave")
+   theBadCaliWave.BadChannelMaskingTool=theLArDelayValBCMask
+   theBadCaliWave.ValidationKey=KeyOutput
+   theBadCaliWave.ReferenceKey="LArCaliWaveRef"
+   theBadCaliWave.MsgLevelForDeviations=INFO
+   theBadCaliWave.ListOfDevFEBs="Bad_caliWaveFebs.txt"
+   topSequence+=theBadCaliWave
+   
+
+if ( doMonitoring ) :
+   
+   from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+   topSequence += AthenaMonManager( "LArMon" )
+   LArMon = topSequence.LArMon
+
+   ## old style
+   #LArMon.FileKey = "AllMon"
+   #LArMon.ManualDataTypeSetup = True
+   #LArMon.Environment         = "user"
+   #LArMon.ManualRunLBSetup    = True
+   #LArMon.Run                 = 1
+   #LArMon.LumiBlock           = 1
+   #LArMon.CheckEveryNoEvents  = 999999 #to do the check only at the end of the run
+
+   ## tier0 style
+   LArMon.FileKey = "GLOBAL"
+   LArMon.ManualDataTypeSetup = True
+   LArMon.Environment         = "tier0"
+   LArMon.ManualRunLBSetup    = True
+   LArMon.Run                 = int(RunNumberList[0])
+   LArMon.LumiBlock           = 1
+   LArMon.CheckEveryNoEvents  = 999999 #to do the check only at the end of the run
+   
+   include("LArMonTools/LArFEBMon_jobOptions.py")
+   
+   RootHistOutputFileName='RootHistos_'+BaseFileName+".root"
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import THistSvc
+   if os.path.exists(OutputCaliWaveRootFileDir+ "/" +RootHistOutputFileName): 
+      os.remove(OutputCaliWaveRootFileDir + "/" +RootHistOutputFileName)
+   svcMgr += THistSvc()
+   #svcMgr.THistSvc.Output = ["AllMon DATAFILE='"+OutputCaliWaveRootFileDir+ "/" +RootHistOutputFileName+"' OPT='New'"] 
+
+   svcMgr.THistSvc.Output =  ["GLOBAL DATAFILE='"+OutputCaliWaveRootFileDir+ "/" +RootHistOutputFileName+"' OPT='New'"]
+
+
+if (WriteNtuple):
+   from LArCalibTools.LArCalibToolsConf import LArCaliWaves2Ntuple
+   if ( AllWavesPerCh ) :
+        LArCaliWaves2NtupleVec = []
+        for i in range(0, MaxCalLinePerCh):
+              thisAlgo =  "LArCaliWaves2Ntuple"+str(i+1)
+              topSequence += LArCaliWaves2Ntuple(thisAlgo)
+              exec 'LArCaliWaves2NtupleVec.append( topSequence.LArCaliWaves2Ntuple%(fn)s )' % {'fn': i+1}
+              LArCaliWaves2NtupleVec[i].NtupleName = "CALIWAVE"+str(i+1)
+              if (doCaliWaveSelector):
+                  LArCaliWaves2NtupleVec[i].KeyList    = [ KeyOutputSplitted[i]+"Sel" ]
+              else:    
+                  LArCaliWaves2NtupleVec[i].KeyList    = [ KeyOutputSplitted[i] ]
+              LArCaliWaves2NtupleVec[i].SaveJitter = SaveJitter    
+              LArCaliWaves2NtupleVec[i].SaveDerivedInfo = SaveDerivedInfo
+
+   else :
+        LArCaliWaves2Ntuple = LArCaliWaves2Ntuple( "LArCaliWaves2Ntuple" )
+        LArCaliWaves2Ntuple.NtupleName  = "CALIWAVE"
+        LArCaliWaves2Ntuple.SaveDerivedInfo = SaveDerivedInfo
+        LArCaliWaves2Ntuple.SaveJitter = SaveJitter
+        if (doCaliWaveSelector):
+           LArCaliWaves2Ntuple.KeyList     = [ KeyOutput+"Sel" ]
+        else:   
+           LArCaliWaves2Ntuple.KeyList     = [ KeyOutput ]
+        topSequence+=LArCaliWaves2Ntuple
+   
+   theApp.HistogramPersistency = "ROOT"
+   if not hasattr(svcMgr, 'NTupleSvc'):
+      from GaudiSvc.GaudiSvcConf import NTupleSvc
+      svcMgr += NTupleSvc()   
+   if os.path.exists(OutputCaliWaveRootFileDir+"/"+OutputCaliWaveRootFileName):
+      os.remove(OutputCaliWaveRootFileDir+"/"+OutputCaliWaveRootFileName)
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputCaliWaveRootFileDir+"/"+OutputCaliWaveRootFileName+"' OPT='NEW'" ]
+
+if ( WritePoolFile ) :
+   
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   if os.path.exists(OutputCaliWavePoolFileDir+"/"+OutputCaliWavePoolFileName): 
+      os.remove(OutputCaliWavePoolFileDir+"/"+OutputCaliWavePoolFileName)
+   OutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg",OutputCaliWavePoolFileDir+"/"+OutputCaliWavePoolFileName,
+                                           OutputObjectSpecCaliWave,[OutputTagSpecCaliWave],WriteIOV)
+   OutputConditionsAlg.Run1 = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlg.Run2 = IOVEnd
+   
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+   
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+   
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = WARNING)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = WARNING)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DigitAccumulator_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DigitAccumulator_jobOptions.py
new file mode 100644
index 00000000000..bb812a7ba85
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DigitAccumulator_jobOptions.py
@@ -0,0 +1,376 @@
+import commands
+
+###############################################################################
+#
+# <Sandrine.Laplace@lapp.in2p3.fr>
+#
+# Example jobOptions to reconstruction one or more pedestal runs from  data
+#         using accumulated pedestals
+# Flags:
+#  - Pedestal: run LArPedestalBuilder that reads the DSP LArAccumulatedDigits
+#              dump corresponding Pedestals and LArAccumulatedDigits (key: gain) into ntuple
+#  - AutoCorr: run LArAutorCorrBuilder that reads the DSP LArAccumulatedDigits
+#              dump corresponding AutoCorr and (same than above) LArAccumulatedDigits into ntuple
+#  - Accumulator: run LArDigitsAccumulator to crosscheck DSP computation
+#              dump corresponding LArAccumulatedDigits (key: gain+AccuDigOff)
+#                                                                             
+###############################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+include("RecExCommission/GetInputFiles.py")
+
+#######################################################
+#                Run properties
+#######################################################
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"
+   
+if not 'RunNumberList' in dir():
+   RunNumberList = [ 26924 ]
+
+if not 'FilePrefix' in dir():
+     FilePrefix = "daq.Pedestal"   
+   
+if not 'InputDir' in dir():
+   InputDir = "/castor/cern.ch/grid/atlas/DAQ/lar/ElecCalib/2008"
+   
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"     
+
+if not 'FullFileName' in dir():
+   Trigger = "*"+Partition
+   FullFileName =[]
+   for RunNumber in RunNumberList :
+       FullFileName+=GetInputFilesFromTokens(InputDir,RunNumber,FilePrefix,Trigger)
+
+if not 'GainList' in dir():
+   GainList = [ "HIGH" ]
+
+if not 'KeyOutputAccum' in dir():  
+   KeyOutputAccum    = "AccuDigOff"
+
+if not 'GainListAccum' in dir():
+   GainListAccum =[]
+   for i in GainList:
+      newKey=i+KeyOutputAccum
+      GainListAccum.append(newKey)
+      print "GainListAccum = ",GainListAccum
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+
+if not 'ChannelSelection' in dir():
+   # read all
+   ChannelSelection = " "
+   ## example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,3:34</channelSelection>"   
+
+from string import *
+def DBConnectionFile(sqlitefile):
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+
+#######################################################
+#                Monitoring properties
+#######################################################
+
+if not 'doMonitoring' in dir():
+   doMonitoring = False
+
+if not 'doLArCalibDataQuality' in dir():
+   doLArCalibDataQuality = False
+
+if not 'online' in dir():
+   online = False
+   
+#######################################################
+#       Pedestal and AutoCorrelation  properties
+#######################################################
+
+if not 'Pedestal' in dir():
+   Pedestal = True
+   
+if not 'AutoCorr' in dir():
+   AutoCorr = True
+
+if not 'Accumulator' in dir():
+   Accumulator = True
+
+if not 'EventsRef' in dir():
+   EventsRef     = 10
+   
+if not 'NSigma' in dir():
+   NSigma = 5
+
+if not 'NSamples' in dir():
+   NSamples = 7   
+   
+if not 'WhichSample' in dir():
+   WhichSample = 0
+
+#######################################################
+#      Pedestal and AutoCorrelation  output name
+#######################################################
+
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = RunNumberList[0]
+   
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd
+
+if not 'DBConnectionCOOL' in dir():  
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"   
+
+if not 'OutputPedAutoCorrRootFileDir' in dir():
+   OutputPedAutoCorrRootFileDir  = commands.getoutput("pwd")
+   
+if not 'OutputPedPoolFileDir' in dir():
+   OutputPedPoolFileDir  = commands.getoutput("pwd")
+
+if not 'PedLArCalibFolderTag' in dir():
+   PedLArCalibFolderTag = LArCalib_Flags.tagSuffix 
+   
+if not 'OutputAutoCorrPoolFileDir' in dir():
+   OutputAutoCorrPoolFileDir  = commands.getoutput("pwd")
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)   
+
+if not 'KeyOutputAC' in dir():  
+   KeyOutputAC      = "LArAutoCorr" 
+
+if not 'KeyOutputPed' in dir():  
+   KeyOutputPed      = "Pedestal" # need Pedestal to merge with oracle, LArPedestal doesn't work
+
+if not 'BaseFileNamePed' in dir():
+   BaseFileNamePed = "LArPedestal"
+
+if not 'BaseFileNameAutoCorr' in dir():
+   BaseFileNameAutoCorr = "LArAutoCorr"
+
+if not 'BaseFileNameAccum' in dir():
+   BaseFileNameAccum = "LArAccumulatedDigits"
+
+for RunNumber in RunNumberList :
+   if Pedestal :
+      BaseFileNamePedAutoCorr  = BaseFileNamePed + "_"
+      
+   if AutoCorr :
+      if Pedestal :
+         BaseFileNamePedAutoCorr = BaseFileNamePedAutoCorr + BaseFileNameAutoCorr + "_"
+      else :   
+         BaseFileNamePedAutoCorr = BaseFileNameAutoCorr + "_"
+
+   if Accumulator :
+      BaseFileNamePedAutoCorr = BaseFileNameAccum + "_"
+
+   BaseFileNamePedAutoCorr = BaseFileNamePedAutoCorr + str(RunNumber)+"_"+Partition.replace("*","") 
+   BaseFileNamePed = BaseFileNamePed + "_" + str(RunNumber)+"_"+Partition.replace("*","") 
+   BaseFileNameAutoCorr = BaseFileNameAutoCorr + "_" + str(RunNumber)+"_"+Partition.replace("*","")
+   
+if not 'OutputPedAutoCorrRootFileName' in dir():
+   OutputPedAutoCorrRootFileName  = BaseFileNamePedAutoCorr+ ".root"
+    
+if not 'OutputAutoCorrPoolFileName' in dir():
+   OutputAutoCorrPoolFileName  = BaseFileNameAutoCorr + ".pool.root"
+
+if not 'OutputPedPoolFileName' in dir():
+   OutputPedPoolFileName  = BaseFileNamePed + ".pool.root"
+
+if not 'OutputObjectSpecPed' in dir():
+   OutputObjectSpecPed = "LArPedestalComplete#"+KeyOutputPed+"#"+LArCalib_Flags.LArPedestalFolder
+   OutputTagSpecPed=LArCalibFolderTag(LArCalib_Flags.LArPedestalFolder,PedLArCalibFolderTag)
+
+if not 'OutputObjectSpecAutoCorr' in dir():
+   OutputObjectSpecAutoCorr = "LArAutoCorrComplete#"+KeyOutputAC+"#"+LArCalib_Flags.LArAutoCorrFolder
+   OutputTagSpecAutoCorr=LArCalibFolderTag(LArCalib_Flags.LArAutoCorrFolder,PedLArCalibFolderTag)   
+
+#######################################################################################
+# print summary
+#######################################################################################
+
+PedestalAutoCorrLog = logging.getLogger( "PedestalAutoCorrLog" )
+PedestalAutoCorrLog.info( " ======================================================== " )
+PedestalAutoCorrLog.info( " ***           LAr Pedestal/AutoCorr summary          *** " )
+PedestalAutoCorrLog.info( " ======================================================== " )
+PedestalAutoCorrLog.info( " RunNumber                         = "+str(RunNumberList) )
+PedestalAutoCorrLog.info( " SubDetector                       = "+SubDet )
+PedestalAutoCorrLog.info( " Partition                         = "+Partition )
+PedestalAutoCorrLog.info( " Type                              = "+str(FilePrefix.strip().split('.',9)[1]) )
+PedestalAutoCorrLog.info( " LArGain                           = "+str(GainList) )
+for i in range(len(FullFileName)):
+   PedestalAutoCorrLog.info( " FullFileName                      = "+FullFileName[i] )
+PedestalAutoCorrLog.info( " PedLArCalibFolderTag              = "+PedLArCalibFolderTag )
+PedestalAutoCorrLog.info( " OutputPedAutoCorrRootFullFileName = "+OutputPedAutoCorrRootFileDir + "/" + OutputPedAutoCorrRootFileName )
+PedestalAutoCorrLog.info( " OutputPedPoolFullFileName         = "+OutputPedPoolFileDir + "/" + OutputPedPoolFileName )
+PedestalAutoCorrLog.info( " OutputAutoCorrPoolFullFileName    = "+OutputAutoCorrPoolFileDir + "/" + OutputAutoCorrPoolFileName )
+PedestalAutoCorrLog.info( " OutputObjectSpecPed               = "+OutputObjectSpecPed )
+PedestalAutoCorrLog.info( " OutputTagSpecPed                  = "+OutputTagSpecPed )
+PedestalAutoCorrLog.info( " OutputObjectSpecAutoCorr          = "+OutputObjectSpecAutoCorr )
+PedestalAutoCorrLog.info( " OutputTagSpecAutoCorr             = "+OutputTagSpecAutoCorr )
+PedestalAutoCorrLog.info( " IOVBegin                          = "+str(IOVBegin) )
+PedestalAutoCorrLog.info( " IOVEnd                            = "+str(IOVEnd) )
+PedestalAutoCorrLog.info( " LArCalibOutputDB                  = "+OutputDB )
+PedestalAutoCorrLog.info( " ======================================================== " )
+
+#######################################################################################
+include ("LArConditionsCommon/LArMinimalSetup.py")
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+theByteStreamInputSvc=svcMgr.ByteStreamInputSvc
+if not 'FullFileName' in dir():
+   PedestalAutoCorrLog.info( "No FullFileName! Please give a FullFileName list")
+   theApp.exit(-1)
+else :   
+   theByteStreamInputSvc.FullFileName=FullFileName
+
+from LArByteStream.LArByteStreamConf import LArRodDecoder
+svcMgr.ToolSvc += LArRodDecoder()
+theByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
+theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
+theByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/HIGH"]
+
+theByteStreamAddressProviderSvc.TypeNames += ["LArAccumulatedDigitContainer/HIGH"]
+
+#######################################################
+#                                                     #
+#      Pedestal run reconstruction                    #
+#                                                     #
+#######################################################
+
+
+if Pedestal :
+
+   from LArCalibUtils.LArCalibUtilsConf import LArPedestalBuilder
+   LArPedestalBuilder=LArPedestalBuilder("LArPedestalBuilder")
+   LArPedestalBuilder.KeyList      = GainList
+   LArPedestalBuilder.KeyOutput    = KeyOutputPed
+   LArPedestalBuilder.GroupingType = GroupingType
+
+   topSequence += LArPedestalBuilder
+
+if AutoCorr :
+   from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrBuilder
+   LArAutoCorrBuilder=LArAutoCorrBuilder("LArAutoCorrBuilder")
+   LArAutoCorrBuilder.KeyList      = GainList
+   LArAutoCorrBuilder.KeyOutput    = KeyOutputAC
+   LArAutoCorrBuilder.GroupingType = GroupingType
+   
+   topSequence += LArAutoCorrBuilder
+
+if Accumulator :
+   from LArROD.LArRODConf import LArDigitsAccumulator
+   LArDigitsAccumulator=LArDigitsAccumulator("LArDigitsAccumulator")
+   LArDigitsAccumulator.KeyList = GainList
+   LArDigitsAccumulator.LArAccuDigitContainerName=KeyOutputAccum
+
+   topSequence += LArDigitsAccumulator
+   
+######################################################################
+#                                                                    #
+#                          Output                                    #
+#                                                                    #
+######################################################################
+
+
+if ( WriteNtuple ) :
+   
+   if Pedestal :
+      from LArCalibTools.LArCalibToolsConf import LArPedestals2Ntuple
+      LArPedestals2Ntuple = LArPedestals2Ntuple("LArPedestals2Ntuple")
+      LArPedestals2Ntuple.ContainerKey = KeyOutputPed
+      
+      topSequence += LArPedestals2Ntuple
+
+   if AutoCorr :
+      from LArCalibTools.LArCalibToolsConf import LArAutoCorr2Ntuple
+      LArAutoCorr2Ntuple = LArAutoCorr2Ntuple( "LArAutoCorr2Ntuple" )
+      LArAutoCorr2Ntuple.Nsamples     = NSamples
+      LArAutoCorr2Ntuple.ContainerKey = KeyOutputAC
+      
+      topSequence += LArAutoCorr2Ntuple
+
+   if Pedestal or AutoCorr:
+      from LArCalibTools.LArCalibToolsConf import LArAccumulatedDigits2Ntuple
+      for i in GainList:
+         NtupleName="NtupleDSP"+i
+         NtupleDSP = LArAccumulatedDigits2Ntuple( NtupleName )
+         NtupleDSP.NSamples     = NSamples
+         NtupleDSP.ContainerKey = i
+
+         topSequence += NtupleDSP
+
+         print NtupleDSP
+
+   if Accumulator :
+      from LArCalibTools.LArCalibToolsConf import LArAccumulatedDigits2Ntuple
+      for i in GainListAccum:
+         NtupleName="NtupleOff"+i
+         NtupleOff = LArAccumulatedDigits2Ntuple( NtupleName )
+         NtupleOff.NSamples     = NSamples
+         NtupleOff.ContainerKey = i
+
+         topSequence += NtupleOff
+
+         print NtupleOff
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputPedAutoCorrRootFileDir + "/" + OutputPedAutoCorrRootFileName): 
+      os.remove(OutputPedAutoCorrRootFileDir + "/" + OutputPedAutoCorrRootFileName)
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputPedAutoCorrRootFileDir + "/" + OutputPedAutoCorrRootFileName+"' OPT='NEW'" ]
+
+
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = INFO)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = WARNING)
+theApp.AuditAlgorithms=True
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+svcMgr.ChronoStatSvc.OutputLevel  = INFO
+
+###########################################################################
+ 
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_CaliWaveMerger_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_CaliWaveMerger_jobOptions.py
new file mode 100644
index 00000000000..e09815c1bdc
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_CaliWaveMerger_jobOptions.py
@@ -0,0 +1,112 @@
+###########################################################################
+#
+# Example jobOptions to merge several LArCaliWaveContainers into one
+#
+# Last update: 28/4/2006 (Marco.Delmastro@cern.ch)
+#
+###########################################################################
+
+PoolFileList = [ "LArDelay_3144.pool.root" ,
+                 "LArDelay_3462.pool.root" ]
+
+ContainerKeyList = [ "3144" , "3462" ]
+
+Outdir         = "./"
+
+WriteNtuple    = True
+RootFileName   = Outdir+"LArCaliWaveMerger.root"
+
+WritePOOLFile  = True
+POOLFileName   = Outdir+"LArCaliWaveMerger.pool.root"
+KeyOut         = "LArCaliWave"
+
+###########################################################################
+
+#
+# Detector description (LAr only, H8 CTB 2004)
+#
+include( "LArDetDescr/LArDetDescr_H8_joboptions.py" )
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DoIdChecks
+DetDescrCnvSvc.LArIDFileName = "IdDictParser/IdDictLArCalorimeter_H8_2004.xml"
+
+ToolSvc = Service( "ToolSvc" )
+ToolSvc.LArRoI_Map.Print = False
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.all_setOff()
+DetFlags.em_setOn() 
+
+#
+# Read POOL file(s)
+#
+include( "AthenaSealSvc/AthenaSealSvc_joboptions.py" )
+AthenaSealSvc.CheckDictionary = True 
+
+include( "AthenaPoolCnvSvc/AthenaPool_jobOptions.py" )
+theApp.Dlls += ["EventSelectorAthenaPool"] 
+theApp.Dlls += ["LArAthenaPoolPoolCnv"]
+theApp.Dlls += ["LArCondAthenaPoolPoolCnv"]
+
+CondProxyProvider = Service( "CondProxyProvider" )
+ProxyProviderSvc  = Service( "ProxyProviderSvc" )
+ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+CondProxyProvider.InputCollections = PoolFileList
+
+EventPersistencySvc = Service( "EventPersistencySvc" )
+EventPersistencySvc.CnvServices += [ "AthenaPoolCnvSvc" ]
+
+include("AthenaSealSvc/AthenaSealSvc_joboptions.py")
+
+#
+# Merge LArCaliWaveContainers
+#
+theApp.Dlls += ["LArCalibUtils"]
+theApp.TopAlg += ["LArCaliWaveMerger"]
+LArCaliWaveMerger=Algorithm("LArCaliWaveMerger")
+LArCaliWaveMerger.KeyList   = ContainerKeyList
+LArCaliWaveMerger.KeyOutput = KeyOut
+LArCaliWaveMerger.OutputLevel = DEBUG
+
+if ( WriteNtuple ) :
+	theApp.Dlls += ["LArCalibTools"]
+	theApp.TopAlg += [ "LArWaves2Ntuple/LArCaliWaves2Ntuple"]
+	LArCaliWaves2Ntuple = Algorithm( "LArCaliWaves2Ntuple" )
+	LArCaliWaves2Ntuple.NtupleName  = "CALIWAVE"
+	LArCaliWaves2Ntuple.KeyList     = [ KeyOut ]
+	
+	theApp.Dlls += [ "RootHistCnv" ]
+	theApp.HistogramPersistency = "ROOT"
+	NTupleSvc = Service( "NTupleSvc" )
+	NTupleSvc.Output = [ "FILE1 DATAFILE='"+RootFileName+"' OPT='NEW'" ]
+
+if ( WritePOOLFile ) :
+        include( "AthenaSealSvc/AthenaSealSvc_joboptions.py" )
+        AthenaSealSvc.CheckDictionary = True 
+
+        include( "AthenaPoolCnvSvc/AthenaPool_jobOptions.py" )
+        theApp.Dlls   += [ "LArAthenaPoolPoolCnv" ]
+        theApp.Dlls   += [ "LArCondAthenaPoolPoolCnv" ]
+
+        include("RegistrationServices/OutputConditionsAlg_jobOptions.py")
+        ToolSvc.ConditionsAlgStream.OutputFile = POOLFileName
+        
+        OutputConditionsAlg.ObjectList = [ "LArCaliWaveContainer#"+KeyOut]
+
+###########################################################################
+
+#AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
+#AthenaEventLoopMgr.OutputLevel = WARNING
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel  = INFO
+MessageSvc.defaultLimit = 1000;
+
+#StoreGateSvc = Service("StoreGateSvc");
+#StoreGateSvc.dump = False
+
+###########################################################################
+
+theApp.EvtMax = 1 # Leave unchanged!
+
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge.py
new file mode 100644
index 00000000000..d9ce923b942
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge.py
@@ -0,0 +1,204 @@
+###########################################################################
+#
+# TopOptions to copy a complete set of conditions for a given run to 
+# one POOL file and one sqlite file
+#
+# Walter.Lampl@cern.ch
+#
+###########################################################################
+
+
+import shutil, os,sys
+from LArCalibProcessing.extractFolderInfo import *
+
+if 'dbname' not in dir():
+  dbname="COMP200"
+
+if 'sqliteIn' not in dir():
+  sqliteIn="freshConstants.db"
+
+if 'sqliteOut' not in dir():
+  sqliteOut=sqliteIn+".out"
+
+inputDB="sqlite://;schema="+sqliteIn+";dbname="+dbname
+outputDB="sqlite://;schema="+sqliteOut+";dbname="+dbname
+
+
+if os.environ.has_key("CALIBMERGE_PEEKRUN"):
+  peekrun=int(os.environ["CALIBMERGE_PEEKRUN"])
+else:
+  peekrun=2147483647
+
+print "Peeking input database at run",peekrun
+
+folderInfo=extractFolderInfo(inputDB,runnumber=peekrun)
+
+mergeFoldersRec=["/LAR/ElecCalibOfl/Pedestals/Pedestal",
+                 "/LAR/ElecCalibOfl/Ramps/RampLinea",
+                 "/LAR/ElecCalibOfl/MphysOverMcal/RTM",
+                 "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples1phase",
+                 "/LAR/ElecCalibOfl/Shape/RTM/5samples1phase"
+                 ]
+
+mergeFoldersCalib=["/LAR/ElecCalibOfl/AutoCorrs/AutoCorr",
+                   "/LAR/ElecCalibOfl/AutoCorrs/PhysicsAutoCorr",
+                   "/LAR/ElecCalibOfl/CaliPulseParams/RTM",
+                   "/LAR/ElecCalibOfl/DetCellParams/RTM",
+                   "/LAR/ElecCalibOfl/OFCBin/PhysWaveShifts",
+                   #"/LAR/ElecCalibOfl/OFC/CaliWave",
+                   #"/LAR/ElecCalibOfl/OFC/CaliWaveXtalkCorr"
+                   ]
+
+
+shutil.copyfile(sqliteIn,sqliteOut)
+
+
+DuplicateKeyInputPedestal = "" 
+DuplicateKeyInputRamp = "" 
+DuplicateKeyInputMphysMcali = "" 
+DuplicateKeyInputOFC = []
+DuplicateKeyInputShape = ""
+
+if not "DuplicateConstants" in dir():
+  DuplicateConstants = True
+
+import AthenaCommon.AtlasUnixGeneratorJob #use MC event selector
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+theApp.EvtMax = 1
+conddb.setGlobalTag("COMCOND-BLKPA-006-01") #For id mapping
+
+svcMgr.PoolSvc.CheckDictionary=False
+svcMgr.PoolSvc.SortReplicas=False
+
+runNoForFileName=2147483647
+
+outObjectsRec=[]
+outTagsRec=[]
+
+outObjectsCalib=[]
+outTagsCalib=[]
+
+sgKeys=dict()
+for f in folderInfo:
+  fn=f[0]
+  type=f[1]
+  key=f[2]
+  tag=f[3]
+  since=f[4]
+  until=f[5]
+  print "Working on folder",fn,"Tag",tag,"Type",type,"Key",key#,"IOV:",since,"-",until
+
+  if sgKeys.has_key(type):
+    if key in sgKeys[type]:
+      print "StoreGate key",key,"appeared multiple times for type",type,
+      key=key+str(len(sgKeys[type]))
+      print "Changed to",key
+      pass
+    sgKeys[type].append(key)
+    pass
+  else:
+    sgKeys[type]=[key,]
+  
+  if fn in mergeFoldersRec:
+    if since>0 and since<runNoForFileName:
+      runNoForFileName=since
+    outObjectsRec+=["#".join((type,key,fn))]
+    outTagsRec+=[tag]
+    conddb.addFolder("",fn+"<tag>"+tag+"</tag><key>"+key+"</key><db>"+inputDB+"</db>")
+  elif fn in mergeFoldersCalib:
+    if since>0 and since<runNoForFileName:
+      runNoForFileName=since
+    outObjectsCalib+=["#".join((type,key,fn))]
+    outTagsCalib+=[tag]
+    conddb.addFolder("",fn+"<tag>"+tag+"</tag><key>"+key+"</key><db>"+inputDB+"</db>")
+
+  #set keys for DuplicateConstatns
+  if fn in mergeFoldersRec:
+    if fn.find("Pedestal")>0: DuplicateKeyInputPedestal = key
+    elif fn.find("Ramp")>0:  DuplicateKeyInputRamp = key
+    elif fn.find("MphysOverMcal")>0:  DuplicateKeyInputMphysMcali = key
+    elif fn.find("Shape")>0: DuplicateKeyInputShape = key
+    elif fn.find("OFC")>0: DuplicateKeyInputOFC.append(key) #Can have more than one OFC folder
+    pass
+
+if len(DuplicateKeyInputOFC)==0: DuplicateKeyInputOFC.append("")
+  
+svcMgr.EventSelector.RunNumber = peekrun
+
+OutputFileRec="LArConditionsRec_"+str(runNoForFileName)+".pool.root"
+if os.access(OutputFileRec,os.F_OK):
+  print "File",OutputFileRec,"exists already, removing ...."
+  os.remove(OutputFileRec)
+
+OutputFileCalib="LArConditionsCalib_"+str(runNoForFileName)+".pool.root"
+if os.access(OutputFileCalib,os.F_OK):
+  print "File",OutputFileCalib,"exists already, removing ...."
+  os.remove(OutputFileCalib)
+
+
+print svcMgr.IOVDbSvc.Folders
+
+print "============ Reco ============="
+print outObjectsRec
+print outTagsRec
+print "============ Calib ============="
+print outObjectsCalib
+print outTagsCalib
+
+if len(outObjectsRec)==0 and len(outObjectsCalib)==0:
+  print "Nothing to do, exiting"
+  sys.exit(0)
+
+from LArCalibTools.LArCalibToolsConf import LArBlockCorrections
+topSequence+=LArBlockCorrections()
+
+from LArCalibTools.LArCalibToolsConf import ForceLoadCondObj
+topSequence+=ForceLoadCondObj(ObjectList=outObjectsRec+outObjectsCalib)
+
+
+if DuplicateConstants:
+  from LArCalibUtils.LArCalibUtilsConf import LArDuplicateConstants
+  lArDuplicateConstants=LArDuplicateConstants()
+  lArDuplicateConstants.KeyPedestal   = DuplicateKeyInputPedestal
+  lArDuplicateConstants.KeyRamp       = DuplicateKeyInputRamp
+  lArDuplicateConstants.KeyMphysMcali = DuplicateKeyInputMphysMcali
+  lArDuplicateConstants.KeyOFC        = DuplicateKeyInputOFC[0]
+  lArDuplicateConstants.KeyShape      = DuplicateKeyInputShape
+  topSequence+=lArDuplicateConstants
+
+  for i in range(1,len(DuplicateKeyInputOFC)):
+    algname="LArDuplicateConstant%i"%i
+    nextDuplicateConstants=LArDuplicateConstants(algname,
+                                                 KeyOFC=DuplicateKeyInputOFC[i])
+    topSequence+=nextDuplicateConstants
+
+
+
+from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+
+if len(outObjectsRec):
+  theOutputConditionsAlgRec=OutputConditionsAlg("OutputConditionsAlgRec",OutputFileRec,
+                                                outObjectsRec,outTagsRec,True)
+  theOutputConditionsAlgRec.Run1=runNoForFileName
+
+if len(outObjectsCalib):
+  theOutputConditionsAlgCalib=OutputConditionsAlg("OutputConditionsAlgCalib",OutputFileCalib,
+                                                  outObjectsCalib,outTagsCalib,True)
+
+
+svcMgr.IOVDbSvc.dbConnection  = outputDB
+from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+svcMgr += IOVRegistrationSvc()
+svcMgr.IOVRegistrationSvc.RecreateFolders = False
+
+svcMgr.DetectorStore.Dump=True
+
+
+if 'poolcat' in dir():
+  svcMgr.PoolSvc.WriteCatalog="xmlcatalog_file:"+poolcat
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge_SV.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge_SV.py
new file mode 100644
index 00000000000..e993e1c2f2a
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge_SV.py
@@ -0,0 +1,103 @@
+###########################################################################
+#
+# TopOptions to copy a complete set of conditions for a given run to 
+# one POOL file and one sqlite file
+#
+# Walter.Lampl@cern.ch
+#
+###########################################################################
+
+
+import shutil, os
+from LArCalibProcessing.extractFolderInfo import *
+
+if 'dbname' not in dir():
+  dbname="COMP200"
+
+if 'sqliteIn' not in dir():
+  sqliteIn="freshConstants_SV.db"
+
+if 'sqliteOut' not in dir():
+  sqliteOut=sqliteIn+".out"
+
+inputDB="sqlite://;schema="+sqliteIn+";dbname="+dbname
+outputDB="sqlite://;schema="+sqliteOut+";dbname="+dbname
+
+folderInfo=extractFolderInfo(inputDB)
+
+
+shutil.copyfile(sqliteIn,sqliteOut)
+
+
+mergeFoldersOFC=["/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples3bins17phases",
+                 "/LAR/ElecCalibOfl/Shape/RTM/5samples3bins17phases"
+                 ]
+
+
+import AthenaCommon.AtlasUnixGeneratorJob #use MC event selector
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()  
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+theApp.EvtMax = 1
+conddb.setGlobalTag("COMCOND-ES1PST-004-01") #For id mapping
+
+svcMgr.PoolSvc.CheckDictionary=False
+svcMgr.PoolSvc.SortReplicas=False
+
+
+outObjectsOFC=[]
+outTagsOFC=[]
+
+runNoForFileName=0xFFFFFFFF
+
+for f in folderInfo:
+  fn=f[0]
+  type=f[1]
+  key=f[2]
+  tag=f[3]
+  since=f[4]
+  until=f[5]
+  if since>0 and since<runNoForFileName:
+    runNoForFileName=since
+  if fn in mergeFoldersOFC and 'mu_20' in tag:
+    outObjectsOFC+=["#".join((type,key,fn))]
+    outTagsOFC+=[tag]
+    conddb.addFolder("",fn+"<tag>"+tag+"</tag><db>"+inputDB+"</db>")
+
+svcMgr.EventSelector.RunNumber = 2147483647
+
+OutputFileOFC="LArConditionsOFC_"+str(runNoForFileName)+".pool.root"
+if os.access(OutputFileOFC,os.F_OK):
+  print "File",OutputFileOFC,"exists already, removing ...."
+  os.remove(OutputFileOFC)
+
+
+print svcMgr.IOVDbSvc.Folders
+
+print "============ Single bin OFC ============="
+print outObjectsOFC
+print outTagsOFC
+
+from LArCalibTools.LArCalibToolsConf import LArBlockCorrections
+topSequence+=LArBlockCorrections()
+
+from LArCalibTools.LArCalibToolsConf import ForceLoadCondObj
+topSequence+=ForceLoadCondObj(ObjectList=outObjectsOFC)
+
+from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+theOutputConditionsAlgOFC=OutputConditionsAlg("OutputConditionsAlgOFC",OutputFileOFC,
+                                                outObjectsOFC,outTagsOFC,True)
+
+svcMgr.IOVDbSvc.dbConnection  = outputDB
+from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+svcMgr += IOVRegistrationSvc()
+svcMgr.IOVRegistrationSvc.RecreateFolders = True
+svcMgr.DetectorStore.Dump=True
+
+
+if 'poolcat' in dir():
+  svcMgr.PoolSvc.WriteCatalog="xmlcatalog_file:"+poolcat
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_DeltaResp_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_DeltaResp_jobOptions.py
new file mode 100644
index 00000000000..37ad6bed5c6
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_DeltaResp_jobOptions.py
@@ -0,0 +1,98 @@
+###########################################################################
+#
+#  * read master waves from DB
+#  * compute delta responses
+#  * save delta response waves to ntuple
+#
+###########################################################################
+
+include( "ByteStreamCnvSvc/TBEventSelector_jobOptions.py" )
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DetectorManagers += ["CaloTTDescrManager"]
+DetDescrCnvSvc.DetectorManagers += ["CaloMgr"]
+
+#LArCondCnvDbServer = 'atlobk01.cern.ch'
+LArCondCnvDbServer = 'atlobk02.cern.ch'
+
+theApp.Dlls += [ "LArByteStream"]
+
+ByteStreamInputSvc = Service( "ByteStreamInputSvc" )
+ByteStreamInputSvc.InputDirectory += ["/castor/cern.ch/atlas/testbeam/lar/2004"]
+ByteStreamInputSvc.FilePrefix += ["daq_ROS-41_LargCalib"]
+ByteStreamInputSvc.RunNumber = [3144]
+theApp.EvtMax = 1
+
+ByteStreamAddressProviderSvc = Service( "ByteStreamAddressProviderSvc" )
+
+ByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/LOW"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/MEDIUM"]
+ByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/HIGH"]
+
+include( "LArDetMgrDetDescrCnv/LArDetMgrDetDescrCnv_H8_joboptions.py" )
+
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DoIdChecks
+
+ToolSvc = Service( "ToolSvc" )
+ToolSvc.LArRoI_Map.Print=FALSE
+
+include("LArCondCnv_CalibTB04_jobOptions.py")
+IOVDbSvc = Service( "IOVDbSvc" )
+IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArPedestal"]
+IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveHigh"]
+IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveMedium"]
+IOVDbSvc.Folders += ["/lar/LArElecCalibTB04/LArCaliWaves/LArMasterWaveLow"]
+IOVDbSvc.serverName="atlobk01.cern.ch"
+IOVDbSvc.DBname = "conditions_ctb_2004"
+#IOVDbSvc.userName = "conditions"
+#IOVDbSvc.userPwd  = "conditions"
+IOVDbSvc.userName = "lar"
+IOVDbSvc.userPwd  = "liquid_CondDB"
+
+ToolSvc.FillNovaIOVTool.BeginRun   = 0
+ToolSvc.FillNovaIOVTool.EndRun     = 9000000
+ToolSvc.FillNovaIOVTool.BeginEvent = 0
+ToolSvc.FillNovaIOVTool.EndEvent   = 999999
+
+theApp.Dlls += ["LArRawUtils"]
+theApp.Dlls += ["LArTools"]
+theApp.Dlls += ["LArCalibUtils"]
+
+#
+# predict delta responses from master waveforms
+#
+theApp.TopAlg += [ "LArDeltaRespPredictor" ]
+LArDeltaRespPredictor=Algorithm( "LArDeltaRespPredictor" )
+LArDeltaRespPredictor.KeyList = [ "LArMasterWaveHigh" , "LArMasterWaveMedium" , "LArMasterWaveLow" ]
+#LArDeltaRespPredictor.KeyList = [ "LArMasterWaveLow" ]
+ToolSvc.LArDeltaRespTool.NormalizeCali    = TRUE
+ToolSvc.LArDeltaRespTool.InjPointCorr     = TRUE
+ToolSvc.LArDeltaRespTool.TimeOriginShift  = FALSE
+ToolSvc.LArDeltaRespTool.SubtractBaseline = FALSE
+LArDeltaRespPredictor.WriteDB  = FALSE
+
+#
+# write master delta responses to ntuple
+# 
+theApp.TopAlg += [ "LArWaves2Ntuple<LArCaliWaveContainer>/LArCaliWaves2Ntuple"]
+LArCaliWaves2Ntuple = Algorithm( "LArCaliWaves2Ntuple" )
+LArCaliWaves2Ntuple.NtupleName  = "DELTARESP"
+LArCaliWaves2Ntuple.KeyList = [ "LArMasterWaveHigh_delta" , "LArMasterWaveMedium_delta" , "LArMasterWaveLow_delta" ]
+#LArCaliWaves2Ntuple.KeyList = [ "LArMasterWaveLow_delta" ]
+
+#
+# output levels:
+#
+LArDeltaRespPredictor.OutputLevel    = INFO
+ToolSvc.LArWFParamTool.OutputLevel   = INFO
+ToolSvc.LArDeltaRespTool.OutputLevel = INFO	
+LArCaliWaves2Ntuple.OutputLevel      = INFO
+	
+theApp.Dlls += [ "RootHistCnv" ]
+theApp.HistogramPersistency = "ROOT"
+NTupleSvc = Service( "NTupleSvc" )
+NTupleSvc.Output = [ "FILE1 DATAFILE='LArDeltaResp.root' OPT='NEW'" ]
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel = WARNING
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_FillOFCPhase.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_FillOFCPhase.py
new file mode 100644
index 00000000000..ab7b12cd581
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_FillOFCPhase.py
@@ -0,0 +1,116 @@
+###############################################################
+#
+# Python script for accessing LAr Conditions data in DetectorStore
+#
+#    0. Select run number, and load Conditions jobOpt
+#    1. Access Conditions Data using Identifier 
+#         Retrieve container from DetectorStore
+#         make identifier using onlineID or larCablingSvc
+#         use Container's get method to access data object.
+#         use LArCondDataDumper.printLarCondObject(obj) to print object
+#    2. Print all channel
+#         Define Type,Key to retrieve (ListofType, ListofKey)
+#         print_all_lar_cond_data (ListofType,ListofKey) 
+#         (set MessageSvc.OutputLevel = DEBUG for printing all channels)
+#==============================================================
+
+include( "AthenaCommon/Atlas_Gen.UnixStandardJob.py" )
+#include ("LArConditionsCommon/LArMinimalSetup.py")
+
+#theByteStreamInputSvc=svcMgr.ByteStreamInputSvc
+#theByteStreamInputSvc.FullFileName=["/data/pavol/athena_calib/daq.Ramp.0031077.No.Streaming.LB0000.EB-ECC._0001.data"]
+#--------------------------------------------------------------
+# pick a proper run number for conditions
+#--------------------------------------------------------------
+#from AthenaCommon.AppMgr import ServiceMgr
+EventSelector = ServiceMgr.EventSelector
+EventSelector.RunNumber=31077
+EventSelector.EventsPerRun=100000;
+#EventSelector.FirstEvent=1
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel      = WARNING
+theApp.EvtMax = 1
+
+#--------------------------------------------------------------
+# pick a DetDescrVersion
+#--------------------------------------------------------------
+# DetDescrVersion = "DC2" 
+# DetDescrVersion = "Rome-Initial" 
+#DetDescrVersion = "ATLAS-DC3-05"
+DetDescrTag = "ATLAS-CommNF-03-00-00"
+IOVDbSvcGlobalTagData = 'COMCOND-002-00'
+
+from AthenaCommon.GlobalFlags import GlobalFlags
+GlobalFlags.DataSource.set_data()
+GlobalFlags.InputFormat.set_bytestream()
+GlobalFlags.DetGeo.set_commis()
+
+#from AthenaCommon.JobProperties import jobproperties
+#jobproperties.Global.DetDescrVersion = "ATLAS-CommNF-00-03-00"
+
+#--------------------------------------------------------------
+# load shared libs, converter, etc
+#--------------------------------------------------------------
+include ("LArConditionsCommon/DumpLArCondData_Config.py")
+
+#--------------------------------------------------------------
+# 0. load conditions data 
+#--------------------------------------------------------------
+IOVDbSvc = Service("IOVDbSvc")
+IOVDbSvc.OutputLevel = DEBUG
+IOVDbSvc.GlobalTag = 'COMCOND-002-00'
+include( "LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py" )
+include( "LArConditionsCommon/LArIdMap_comm_jobOptions.py" )
+
+#PoolFileList = ["LArMphysOverMcal_RTM_31046_31047_31048_GAIN_0.pool.root"]
+#PoolFileList = ["/afs/cern.ch/atlas/conditions/poolcond/vol3/comcond.000002.lar_conditions.recon.pool.v0000/comcond.000002.lar_conditions.recon.pool.v0000._0094.pool.root"]
+#include("LArCalibProcessing/ReadLocalConditionsPool.py")
+IOVSvc = Service( "IOVSvc" )
+IOVSvc.updateInterval = "JOB"
+IOVSvc.preLoadData=True
+IOVSvc.OutputLevel = DEBUG
+#
+KeyOutput = "LArOFCPhase"
+from AthenaCommon.AlgSequence import AlgSequence
+topSequence = AlgSequence()
+from LArCalibUtils.LArCalibUtilsConf import LArOFPhaseFill
+LArOFPhaseFill = LArOFPhaseFill("LArOFPhaseFill")
+#LArOFPhaseFill.InputFile = ""
+LArOFPhaseFill.keyOFCbin = KeyOutput
+LArOFPhaseFill.GroupingType = "ExtendedSubDetector"
+LArOFPhaseFill.OutputLevel = ERROR
+topSequence += LArOFPhaseFill
+#
+# Make an output
+from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+Folder = "/LAR/OFC/OFCPhase"
+ObjectSpec = [ "LArOFCBinComplete#"+KeyOutput+"#"+Folder ]
+TagSpec = [ "LArOFCPhase-01" ]
+OutputDB = "sqlite://X;schema=OFCPhase.db;dbname=COMP200"
+OutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg","./ofc_phase.pool.root", 
+                    ObjectSpec,TagSpec,True)
+#OutputConditionsAlg.Run1 = 0
+#OutputConditionsAlg.Run2 = 0
+
+topSequence += OutputConditionsAlg
+
+
+from AthenaCommon.AppMgr import ServiceMgr
+from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+svcMgr += IOVRegistrationSvc()
+svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+svcMgr.IOVRegistrationSvc.RecreateFolders = True
+svcMgr.IOVDbSvc.dbConnection  = OutputDB
+
+#--------------------------------------------------------------
+# initialize Athena, then go to first event 
+#--------------------------------------------------------------
+#theApp.initialize() 
+#theApp.nextEvent()
+svcMgr.MessageSvc.OutputLevel  = DEBUG
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+   
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = ERROR)
+
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_HVCorr.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_HVCorr.py
new file mode 100644
index 00000000000..5935d6784ba
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_HVCorr.py
@@ -0,0 +1,194 @@
+#################################################################
+# 
+# example jobOptions to read HV from Cool/DCS in athena
+#  and compute cell level correction factors to store in conditions 
+#  database
+#
+##################################################################
+
+from time import strptime,time
+from calendar import timegm
+
+#set date to compute the correction
+
+if "date" not in dir():
+    date="2011-01-31:00:00:00"
+
+
+if "TimeStamp" not in dir():
+   try:
+      ts=strptime(date+'/UTC','%Y-%m-%d:%H:%M:%S/%Z')
+      TimeStamp=int(timegm(ts))*1000000000L
+   except ValueError:
+      print "ERROR in time specification, use e.g. 2007-05-25:14:01:00"
+      
+
+from LArCalibProcessing.TimeStampToRunLumi import TimeStampToRunLumi
+
+rlb=TimeStampToRunLumi(TimeStamp)
+if rlb is None:
+   print "WARNING: Failed to convert time",TimeStamp,"into a run/lumi number"
+   RunNumber=999999
+   LumiBlock=0
+else:
+   RunNumber=rlb[0]
+   LumiBlock=rlb[1]
+
+
+print "Working on run",RunNumber,"LB",LumiBlock,"Timestamp:",TimeStamp
+
+# name of output local sql file
+OutputSQLiteFile = 'myDB200_hvDummy.db'
+
+# name of output Pool file
+PoolFileName = "LArHVScaleCorr_dummy.pool.root"
+
+# database folder
+LArHVScaleCorrFolder = "/LAR/ElecCalibOfl/HVScaleCorr"
+
+# output key
+keyOutput = "LArHVScaleCorr"
+
+# tag suffix
+#LArCalibFolderOutputTag = "-UPD3-00"
+
+# write IOV
+WriteIOV      = True
+
+# global tag to read other conditions if needed
+if "GlobalTag" not in dir():
+    GlobalTag     = 'COMCOND-BLKPST-004-05'
+
+# begin run IOV
+IOVBegin = 0
+
+###################################################################
+
+from RecExConfig.RecFlags import rec
+rec.RunNumber.set_Value_and_Lock(int(RunNumber))
+
+from PerfMonComps.PerfMonFlags import jobproperties
+jobproperties.PerfMonFlags.doMonitoring = True
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.all_setOff()
+DetFlags.LAr_setOn()
+DetFlags.Tile_setOn()
+
+from AthenaCommon.GlobalFlags import globalflags
+globalflags.DetGeo.set_Value_and_Lock('atlas')
+globalflags.DataSource.set_Value_and_Lock('data')
+
+# Get a handle to the default top-level algorithm sequence
+from AthenaCommon.AppMgr import ToolSvc
+from AthenaCommon.AlgSequence import AlgSequence
+topSequence = AlgSequence()
+
+# Get a handle to the ServiceManager
+from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+
+# Get a handle to the ApplicationManager
+from AthenaCommon.AppMgr import theApp
+
+# Setup Db stuff
+import AthenaPoolCnvSvc.AthenaPool
+
+from AthenaCommon.GlobalFlags import jobproperties
+jobproperties.Global.DetDescrVersion='ATLAS-GEO-08-00-00'
+
+from AtlasGeoModel import SetGeometryVersion
+from AtlasGeoModel import GeoModelInit
+from AtlasGeoModel import SetupRecoGeometry
+
+svcMgr.IOVDbSvc.GlobalTag = GlobalTag
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+include( "AthenaCommon/Atlas_Gen.UnixStandardJob.py" )
+
+include( "CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py")
+include( "CaloIdCnv/CaloIdCnv_joboptions.py" )
+include( "TileIdCnv/TileIdCnv_jobOptions.py" )
+include( "LArDetDescr/LArDetDescr_joboptions.py" )
+include("TileConditions/TileConditions_jobOptions.py" )
+include("LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py")
+
+include( "LArCondAthenaPool/LArCondAthenaPool_joboptions.py" )
+
+from LArConditionsCommon import LArHVDB #Sets HV Calbling and DCS Database folders
+#conddb.addOverride("/LAR/IdentifierOfl/HVLineToElectrodeMap","LARIdentifierOflHVLineToElectrodeMap-UPD3-00")
+from LArCondUtils.LArCondUtilsConf import LArHVToolDB
+theLArHVToolDB = LArHVToolDB("LArHVToolDB")
+ToolSvc += theLArHVToolDB
+
+from LArRecUtils.LArRecUtilsConf import LArHVCorrTool
+theLArHVCorrTool = LArHVCorrTool("LArHVCorrTool")
+theLArHVCorrTool.keyOutput = keyOutput
+theLArHVCorrTool.HVTool = theLArHVToolDB
+ToolSvc += theLArHVCorrTool
+
+from LArCalibUtils.LArCalibUtilsConf import LArHVCorrMaker
+theLArHVCorrMaker = LArHVCorrMaker("LArHVCorrMaker")
+topSequence += theLArHVCorrMaker
+
+from LArCalibTools.LArCalibToolsConf import LArHVScaleCorr2Ntuple
+theLArHVScaleCorr2Ntuple = LArHVScaleCorr2Ntuple("LArHVScaleCorr2Ntuple")
+theLArHVScaleCorr2Ntuple.AddFEBTempInfo = False
+topSequence += theLArHVScaleCorr2Ntuple
+
+#from LArCalibTools.LArCalibToolsConf import LArWFParams2Ntuple
+#LArWFParams2Ntuple = LArWFParams2Ntuple("LArWFParams2Ntuple")
+#LArWFParams2Ntuple.DumpTdrift = True
+#topSequence += LArWFParams2Ntuple
+
+theApp.HistogramPersistency = "ROOT"
+from GaudiSvc.GaudiSvcConf import NTupleSvc
+svcMgr += NTupleSvc()
+svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='hvcorr_ntuple.root' OPT='NEW'" ]
+
+# deal with DB output
+OutputObjectSpec = "LArHVScaleCorrComplete#"+keyOutput+"#"+LArHVScaleCorrFolder
+from string import *
+#OutputObjectSpecTag = join(split(LArHVScaleCorrFolder, '/'),'') + LArCalibFolderOutputTag
+OutputObjectSpecTag = ''
+OutputDB = "sqlite://;schema="+OutputSQLiteFile+";dbname=COMP200"
+
+from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg",PoolFileName,
+                          [OutputObjectSpec],[OutputObjectSpecTag],WriteIOV)
+theOutputConditionsAlg.Run1 = IOVBegin
+
+svcMgr.IOVDbSvc.dbConnection  = OutputDB
+
+from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+svcMgr += IOVRegistrationSvc()
+svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG 
+svcMgr.IOVRegistrationSvc.RecreateFolders = False 
+
+
+
+#--------------------------------------------------------------
+#--- Dummy event loop parameters
+#--------------------------------------------------------------
+svcMgr.EventSelector.RunNumber         = RunNumber
+svcMgr.EventSelector.EventsPerRun      = 1
+svcMgr.EventSelector.FirstEvent        = 0
+svcMgr.EventSelector.EventsPerLB       = 1
+svcMgr.EventSelector.FirstLB           = LumiBlock
+svcMgr.EventSelector.InitialTimeStamp  = int(TimeStamp/1e9)
+svcMgr.EventSelector.TimeStampInterval = 5
+svcMgr.EventSelector.OverrideRunNumber=True
+theApp.EvtMax                          = 1
+
+#--------------------------------------------------------------
+# Set output level threshold (1=VERBOSE, 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
+#--------------------------------------------------------------
+svcMgr.MessageSvc.OutputLevel      = INFO
+svcMgr.MessageSvc.debugLimit       = 100000
+svcMgr.MessageSvc.infoLimit        = 100000
+svcMgr.MessageSvc.Format           = "% F%30W%S%7W%R%T %0W%M"
+svcMgr.IOVDbSvc.OutputLevel        = INFO
+
+theLArHVCorrMaker.OutputLevel = INFO
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_PhysWaveBuilder_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_PhysWaveBuilder_jobOptions.py
new file mode 100644
index 00000000000..e3326be0708
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_PhysWaveBuilder_jobOptions.py
@@ -0,0 +1,152 @@
+#################################################################
+#
+# LArPhysWaveBuilder example jobOptions 
+#
+# Last update: 17/1/2006 (Marco.Delmastro@cern.ch)
+#
+#################################################################
+
+#
+# Change these values according to your need...
+#
+
+RawDataDirectory  = "/castor/cern.ch/atlas/testbeam/combined/2004"
+
+RawDataFilePrefix = "daq_SFO-51_combined"
+RunNumber         = 2100750
+RootProfileName   = "PhysWave2100750.root"
+
+#RawDataFilePrefix = "daq_SFI-51_combined"
+#RunNumber         = 2101322
+#RootProfileName   = "PhysWave2101322.root"
+
+#################################################################
+
+#LArCondCnvDbServer = "atlobk01.cern.ch"
+LArCondCnvDbServer = "atlobk02.cern.ch"
+#LArCondCnvDbServer = "atlmysql01.cern.ch"
+
+#################################################################
+
+#
+# Raw data file decoding
+#
+include( "ByteStreamCnvSvc/TBEventSelector_jobOptions.py" )
+theApp.Dlls += [ "LArByteStream"]
+ByteStreamInputSvc = Service( "ByteStreamInputSvc" )
+ByteStreamInputSvc.InputDirectory += [RawDataDirectory]
+ByteStreamInputSvc.FilePrefix     += [RawDataFilePrefix]
+ByteStreamInputSvc.RunNumber       = [RunNumber]
+
+ByteStreamAddressProviderSvc = Service( "ByteStreamAddressProviderSvc" )
+ByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/FREE"]
+#
+# these are most probably not needed since we are lloking to physics data...
+#
+#ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/LOW"]
+#ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/MEDIUM"]
+#ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/HIGH"]
+
+#
+# Detector description (LAr only)
+#
+include( "LArDetDescr/LArDetDescr_H8_joboptions.py" )
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+DetDescrCnvSvc.DoIdChecks
+DetDescrCnvSvc.LArIDFileName = "IdDictParser/IdDictLArCalorimeter_H8_2004.xml"
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.all_setOff()
+DetFlags.em_setOn() 
+
+ToolSvc = Service( "ToolSvc" )
+ToolSvc.LArRoI_Map.Print = False
+ToolSvc.LArRodDecoder.FirstSample = 2
+
+#
+# CondDB settings
+#
+include("LArTBRec/LArTBFlags_jobOptions.py" )
+include("LArCondCnv/LArCondCnv_TB04_jobOptions.py")
+
+theApp.Dlls += [ "IOVDbSvc" ]
+ProxyProviderSvc = Service( "ProxyProviderSvc" )
+ProxyProviderSvc.ProviderNames += [ "IOVDbSvc" ]
+
+IOVDbSvc = Service( "IOVDbSvc" )
+IOVDbSvc.serverName  = LArCondCnvDbServer
+IOVDbSvc.DBname      = "conditions_ctb_2004"
+IOVDbSvc.userName    = "conditions"
+IOVDbSvc.userPwd     = "conditions"
+
+#
+# IOV for DB writing
+#
+ToolSvc.FillNovaIOVTool.BeginRun   = 1000000
+ToolSvc.FillNovaIOVTool.EndRun     = 9000000
+ToolSvc.FillNovaIOVTool.BeginEvent = 0
+ToolSvc.FillNovaIOVTool.EndEvent   = 9999999
+
+#
+# Beam Instruments decoding and TBPhase Reconstruction
+#
+include( "TBCnv/TBReadH8BS_jobOptions.py" )
+theApp.Dlls   += [ "TBRec" ]
+theApp.TopAlg += ["TBPhaseRec"]
+TBPhaseRec     =  Algorithm("TBPhaseRec")
+include( "TBRec/H8PhaseRec_jobOptions.py" )
+TBPhaseRec.TimeBins    = 24 # 24 bin as in CTB 2004 delay profiles
+TBPhaseRec.OutputLevel = INFO
+
+#
+# LAr packages
+#
+theApp.Dlls += ["LArRawUtils"]
+theApp.Dlls += ["LArTools"] 
+theApp.Dlls += ["LArEventTest"]
+theApp.Dlls += ["LArCalibUtils"]     
+theApp.Dlls += ["LArRecUtils"]
+
+#
+# LArPhysWaveBuilder settings
+#
+theApp.TopAlg += ["LArPhysWaveBuilder/LArPhysWaveBuilder"]
+LArPhysWaveBuilder = Algorithm("LArPhysWaveBuilder")
+LArPhysWaveBuilder.GainCont = "FREE"
+LArPhysWaveBuilder.Gain = 1
+LArPhysWaveBuilder.OutputLevel = INFO
+
+LArPhysWaveBuilder.NEntriesCut = 10
+
+LArPhysWaveBuilder.PSCut     = 1000.*MeV
+LArPhysWaveBuilder.StripsCut = 1000.*MeV
+LArPhysWaveBuilder.MiddleCut = 7000.*MeV
+LArPhysWaveBuilder.BackCut   = 1000.*MeV
+
+LArPhysWaveBuilder.Normalize = True
+
+LArPhysWaveBuilder.RootRawDump    = True
+LArPhysWaveBuilder.RootOutputFile = RootProfileName
+
+#
+# DO NOT WRITE TO DB!
+#
+LArPhysWaveBuilder.WriteDB  = False
+LArPhysWaveBuilder.UpdateDB = False
+LArPhysWaveBuilder.FolderName_LArPhysWave = "/lar/LArElecCalibTB04/LArPhysWaveContainer/LArPhysWave"
+
+ToolSvc.LArParabolaPeakrecoTool.correctBias = True # to use with parabola
+
+#############################################################################
+
+theApp.EvtMax = 100
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel = WARNING
+MessageSvc.infoLimit   = 100000
+
+AthenaEventLoopMgr = Service( "AthenaEventLoopMgr" )
+AthenaEventLoopMgr.FailureMode = 2
+AthenaEventLoopMgr.OutputLevel = INFO
+
+#############################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_PickOFCOnePhase.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_PickOFCOnePhase.py
new file mode 100644
index 00000000000..ef4159e2662
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_PickOFCOnePhase.py
@@ -0,0 +1,68 @@
+include("AthenaCommon/Atlas_Gen.UnixStandardJob.py")
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+
+from McEventSelector.McEventSelectorConf import McEventSelector
+svcMgr += McEventSelector("EventSelector")
+svcMgr.EventSelector.RunNumber	= 10000000
+svcMgr.EventSelector.EventsPerRun      = 1
+svcMgr.EventSelector.FirstEvent	= 1
+svcMgr.EventSelector.InitialTimeStamp  = 0
+svcMgr.EventSelector.TimeStampInterval = 1
+theApp.EvtMax = 1
+
+include( "LArConditionsCommon/LArIdMap_comm_jobOptions.py" )
+svcMgr.IOVDbSvc.GlobalTag="COMCOND-005-02"
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+conddb.addFolder("LAR","/LAR/ElecCalibOfl/OFCBin/Dummy")
+conddb.addFolder("LAR","/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples3bins17phases<key>LArOFCIn</key>")
+
+from LArCalibUtils.LArCalibUtilsConf import LArOFPhasePicker
+LArOFPhasePicker = LArOFPhasePicker("LArOFPhasePicker")
+LArOFPhasePicker.KeyPhase = "LArOFCPhase"
+LArOFPhasePicker.KeyOFC_new = "LArOFC"
+LArOFPhasePicker.KeyOFC = "LArOFCIn"
+LArOFPhasePicker.GroupingType = "ExtendedSubDetector"
+LArOFPhasePicker.OutputLevel = DEBUG
+LArOFPhasePicker.DefaultPhase=1
+topSequence += LArOFPhasePicker
+#
+# Make an output
+from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+Folder = "/LAR/ElecCalibOnl/OFC"
+ObjectSpec = [ "LArOFCComplete#LArOFC#"+Folder ]
+TagSpec = []
+OutputDB = "sqlite://X;schema=OFCnew.db;dbname=COMP200"
+theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg","./ofc_picked.pool.root", 
+                                           ObjectSpec,TagSpec,True)
+theOutputConditionsAlg.Run1 = 0
+theOutputConditionsAlg.Run2 = 0
+
+topSequence += theOutputConditionsAlg
+
+svcMgr.IOVDbSvc.OutputLevel = VERBOSE
+
+from AthenaCommon.AppMgr import ServiceMgr
+from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+svcMgr += IOVRegistrationSvc()
+svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+svcMgr.IOVRegistrationSvc.RecreateFolders = True
+svcMgr.IOVRegistrationSvc.SVFolder=True
+
+svcMgr.IOVDbSvc.dbConnection  = OutputDB
+
+svcMgr.MessageSvc.OutputLevel  = INFO
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+   
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ReadLocalConditionsPool.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ReadLocalConditionsPool.py
new file mode 100644
index 00000000000..98204e52228
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ReadLocalConditionsPool.py
@@ -0,0 +1,34 @@
+###################################################################
+#
+# jobOptions to read condition data from a local POOL file(s)
+#
+###################################################################
+
+include("AthenaSealSvc/AthenaSealSvc_joboptions.py")
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArAthenaPool/LArAthenaPool_joboptions.py" )
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py") 
+
+#AthenaSealSvc.CheckDictionary = True 
+
+CondProxyProvider = Service("CondProxyProvider")
+ProxyProviderSvc  = Service("ProxyProviderSvc")
+ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+
+EventPersistencySvc = Service( "EventPersistencySvc" )
+EventPersistencySvc.CnvServices += [ "AthenaPoolCnvSvc" ]
+
+#
+# sigle POOL file should be defined as:
+# PoolFileName = "filename.pool.root"
+#
+if 'PoolFileName' in dir() :
+	CondProxyProvider.InputCollections = [ PoolFileName ]
+
+#
+# multiple POOL files should be defined as:
+# PoolFileList = [ "file1.pool.root", "file2.pool.root", ... ] 
+#
+if 'PoolFileList' in dir() :
+	if ( len(PoolFileList)>0 ) :
+		CondProxyProvider.InputCollections += PoolFileList
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_WavePatcher.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_WavePatcher.py
new file mode 100644
index 00000000000..c53e2bfb32e
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_WavePatcher.py
@@ -0,0 +1,104 @@
+#InputDB="oracle://ATONR_COOL;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;;password=COOLRED4PRO"
+InputDB="COOLOFL_LAR/COMP200"
+#Folder="/LAR/ElecCalibOfl/CaliWaves/CaliWave"
+FolderTag="LARElecCalibCaliWavesCaliWave-comm-08"
+Folder="/LAR/ElecCalibOfl/CaliWaves/CaliWaveXtalkCorr"
+FolderTag="LARElecCalibCaliWavesCaliWaveXtalkCorr-comm-08"
+
+RunNumber=52000
+
+import AthenaCommon.AtlasUnixGeneratorJob #use MC event selector
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()  
+
+
+
+from AthenaCommon.GlobalFlags import GlobalFlags
+GlobalFlags.DetGeo.set_commis()
+GlobalFlags.Luminosity.set_zero()
+GlobalFlags.DataSource.set_data()
+GlobalFlags.InputFormat.set_bytestream()
+
+from AthenaCommon.JobProperties import jobproperties
+jobproperties.Global.DetDescrVersion = "ATLAS-Comm-00-00-00"
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.Calo_setOff()
+DetFlags.ID_setOff()
+DetFlags.Muon_setOff()
+DetFlags.Truth_setOff()
+DetFlags.LVL1_setOff()
+DetFlags.digitize.all_setOff()
+
+#Set up GeoModel (not really needed but crashes without)
+from AtlasGeoModel import SetGeometryVersion
+from AtlasGeoModel import GeoModelInit 
+
+#Get identifier mapping (needed by LArConditionsContainer)
+include( "LArConditionsCommon/LArIdMap_comm_jobOptions.py" )
+
+#input-data:
+#conddb.addFolder("",Folder+"<key>LArCaliWaveInput</key><tag>"+FolderTag+"</tag>"+InputDB)
+conddb.addFolder("",Folder+"<tag>"+FolderTag+"</tag><db>"+InputDB+"</db>")
+#conddb.addFolder("",Folder+"<tag>"+FolderTag+"</tag>"+InputDB)
+conddb.addFolder("LAR","/LAR/BadChannelsOfl/BadChannels")
+svcMgr.IOVDbSvc.GlobalTag="COMCOND-004-00"
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+PoolSvc.ReadCatalog+=["prfile:poolcond/PoolCat_comcond_castor.xml"]
+
+theApp.EvtMax = 1
+svcMgr.EventSelector.RunNumber = RunNumber 
+
+
+
+
+from LArCalibUtils.LArCalibUtilsConf import LArCalibPatchingAlg_LArCaliWaveContainer_
+theLArCaliWavePatcher=LArCalibPatchingAlg_LArCaliWaveContainer_("LArCaliWavePatcher")
+theLArCaliWavePatcher.ContainerKey="LArCaliWave"
+theLArCaliWavePatcher.NewContainerKey="LArCaliWaveOut"
+theLArCaliWavePatcher.PatchMethod="PhiNeighbor"
+theLArCaliWavePatcher.OutputLevel=DEBUG
+topSequence+=theLArCaliWavePatcher
+
+from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
+theLArBadChannelTool=LArBadChanTool()
+theLArBadChannelTool.OutputLevel=DEBUG
+ToolSvc+=theLArBadChannelTool
+
+from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+theLArRCBMasker=LArBadChannelMasker("LArRCBMasker")
+theLArRCBMasker.DoMasking=True
+theLArRCBMasker.ProblemsToMask=[
+    "deadCalib","deadReadout","deadPhys","almostDead","short",
+    ]
+ToolSvc+=theLArRCBMasker
+theLArCaliWavePatcher.MaskingTool=theLArRCBMasker
+
+
+
+OutputObjectSpecCaliWave = "LArCaliWaveContainere#LArCaliWaveOut#"+Folder
+
+from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg","LArCaliWaveCorrections_"+str(RunNumber)+".pool.root",
+                                           [OutputObjectSpecCaliWave],[FolderTag],True)
+theOutputConditionsAlg.Run1 = RunNumber
+svcMgr.IOVDbSvc.dbConnection  = "sqlite://;schema=LArCaliWaveCorrections_"+str(RunNumber)+".db;dbname=COMP200"
+
+from AthenaCommon.AppMgr import ServiceMgr
+from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+svcMgr += IOVRegistrationSvc()
+svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+svcMgr.IOVRegistrationSvc.RecreateFolders = True
+
+
+svcMgr.DetectorStore.Dump=True
+
+
+ToolSvc.LArBadChanTool.OutputLevel=DEBUG
+svcMgr.IOVDbSvc.OutputLevel=DEBUG
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Flags.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Flags.py
new file mode 100644
index 00000000000..92fd06704c8
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Flags.py
@@ -0,0 +1,84 @@
+include.block("LArCalibProcessing/LArCalib_Flags.py")
+
+from string import *
+
+class LArCalib_Flags:
+    
+    #globalFlagDB = "COMCOND-ES1S-000-00"
+    globalFlagDB = "LARCALIB-000-02"
+    OutputDB     = "sqlite://;schema=myDB200.db;dbname=COMP200"
+    InputDB      = OutputDB
+
+    WritePoolFile = True
+    WriteNtuple   = True
+    WriteIOV      = True
+
+    LArPedestalFolder            = "/LAR/ElecCalibOfl/Pedestals/Pedestal"
+    LArAutoCorrFolder            = "/LAR/ElecCalibOfl/AutoCorrs/AutoCorr"
+    LArPhysAutoCorrFolder        = "/LAR/ElecCalibOfl/AutoCorrs/PhysicsAutoCorr"
+
+    LArCaliWaveFolder            = "/LAR/ElecCalibOfl/CaliWaves/CaliWave"
+    LArCaliWaveFolderXtlk        = "/LAR/ElecCalibOfl/CaliWaves/CaliWaveXtalkCorr"
+
+    LArPhysWaveFolder            = "/LAR/ElecCalibOfl/PhysWaves/RTM"
+    LArMPhysOverMCalFolder       = "/LAR/ElecCalibOfl/MphysOverMcal/RTM"
+
+    LArPhysCaliTdiffFolder       = "/LAR/ElecCalibOfl/PhysCaliTdiff"
+
+    LArOFCPhysFolder             = "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/"
+    LArOFCCaliFolder             = "/LAR/ElecCalibOfl/OFC/CaliWave"
+    LArOFCCaliFolderXtlk         = "/LAR/ElecCalibOfl/OFC/CaliWaveXtalkCorr"
+    LArOFCMasterWaveFolder       = "/LAR/ElecCalibOfl/OFC/MasterWave"
+    LArOFCMasterWaveFolderXtlk   = "/LAR/ElecCalibOfl/OFC/MasterWaveXtalkCorr"
+                               
+    LArShapeFolder               = "/LAR/ElecCalibOfl/Shape/RTM/"
+    LArShapeCaliWaveFolder       = "/LAR/ElecCalibOfl/Shape/CaliWave"
+    LArShapeCaliWaveFolderXtlk   = "/LAR/ElecCalibOfl/Shape/CaliWaveXtalkCorr"
+    LArShapeMasterWaveFolder     = "/LAR/ElecCalibOfl/Shape/MasterWave"
+    LArShapeMasterWaveFolderXtlk = "/LAR/ElecCalibOfl/Shape/MasterWaveXtalkCorr"   
+                              
+    #LArRampFolder               = "/LAR/ElecCalibOfl/Ramps/Ramp"
+    LArRampFolder                = "/LAR/ElecCalibOfl/Ramps/RampLinea"
+
+    ## Parameters
+    ## these parameters are not ready for all layer :
+    LArCaliPulseParamsFolder     = "/LAR/ElecCalibOfl/CaliPulseParams/Measured"
+    LArDetCellParamsFolder       = "/LAR/ElecCalibOfl/DetCellParams/Measured"
+
+    ## extracted using RTM methode :
+    #LArCaliPulseParamsFolder     = "/LAR/ElecCalibOfl/CaliPulseParams/RTM"
+    #LArDetCellParamsFolder       = "/LAR/ElecCalibOfl/DetCellParams/RTM"  
+
+    LArDTimeFolder               = "/LAR/ElecCalibOfl/Tdrift/Computed"
+ 
+    IOVBegin=0
+    IOVEnd=0
+        
+
+def LArCalibFolderTag(folder,tag):
+    return join(split(folder, '/'),'') + tag
+    
+
+class FolderTagResover:
+    def __init__(self,dbname="COOLOFL_LAR/COMP200"):
+        from PyCool import cool
+        dbSvc = cool.DatabaseSvcFactory.databaseService()
+        self._db = dbSvc.openDatabase("COOLOFL_LAR/COMP200")
+        return
+
+    def __del__(self):
+        self._db.closeDatabase()
+        return
+
+    def getFolderTag(self,foldername,globalTag=LArCalib_Flags.globalFlagDB):
+        folder=self._db.getFolder(foldername);
+        return folder.resolveTag(globalTag)
+            
+    def getFolderTagSuffix(self,foldername,globalTag=LArCalib_Flags.globalFlagDB):
+        ft=self.getFolderTag(foldername,globalTag)
+        p=ft.find("-")
+        if p==-1:
+            return "-Default"
+        else: 
+            return ft[p:]
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_MCPileupAutoCorr_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_MCPileupAutoCorr_jobOptions.py
new file mode 100644
index 00000000000..13f3518ccb9
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_MCPileupAutoCorr_jobOptions.py
@@ -0,0 +1,338 @@
+import commands
+include("LArCalibProcessing/LArCalib_Flags.py")
+
+#######################################################
+#                Run properties
+#######################################################
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"
+   
+if not 'RunNumberList' in dir():
+   RunNumberList = [ '0026924' ]
+
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"     
+
+if not 'GainList' in dir():
+   GainList = [ "HIGH", "MEDIUM", "LOW" ]
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+
+if not 'ChannelSelection' in dir():
+   # read all
+   ChannelSelection = " "
+   ## example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,3:34</channelSelection>"   
+
+from string import *
+def DBConnectionFile(sqlitefile):
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+
+#######################################################
+#                Monitoring properties
+#######################################################
+
+if not 'doLArCalibDataQuality' in dir():
+   doLArCalibDataQuality = True
+
+if not 'online' in dir():
+   online = False
+   
+#######################################################
+#       AutoCorrelation  properties
+#######################################################
+
+if 'NColl' not in dir():
+   NColl=0
+
+if not 'NSamples' in dir():
+   NSamples = 32   
+   
+if not 'WhichSample' in dir():
+   WhichSample = -1
+
+if not 'InputDB' in dir():
+   InputDB = LArCalib_Flags.OutputDB
+
+if 'InputSQLiteFile' in dir():
+   InputDB = DBConnectionFile(OutputSQLiteFile)   
+
+
+#######################################################
+#      AutoCorrelation  output name
+#######################################################
+
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumberList[0])
+   
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd
+
+if not 'DBConnectionCOOL' in dir():  
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"   
+
+if not 'OutputPedAutoCorrRootFileDir' in dir():
+   OutputPedAutoCorrRootFileDir  = commands.getoutput("pwd")
+   
+if not 'OutputPedAutoCorrPoolFileDir' in dir():
+   OutputPedAutoCorrPoolFileDir  = commands.getoutput("pwd")
+
+if not 'ACLArCalibFolderTag' in dir():
+   rs=FolderTagResover()
+   ACLArCalibFolderTag = rs.getFolderTagSuffix(LArCalib_Flags.LArPhysAutoCorrFolder)
+   del rs #Close DB connection
+   
+   
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)   
+
+if not 'KeyOutputAC' in dir():  
+   KeyOutputAC      = "LArPhysAutoCorr" 
+
+if not 'BaseFileNamePedAutoCorr' in dir():
+   BaseFileNameAutoCorr = "LArPhysAutoCorr"
+    
+for RunNumber in RunNumberList :
+   BaseFileNameAutoCorr = BaseFileNameAutoCorr + "_"
+   BaseFileNameAutoCorr = BaseFileNameAutoCorr + str(RunNumber)+"_"+Partition.replace("*","") 
+   
+if not 'OutputAutoCorrRootFileName' in dir():
+   OutputAutoCorrRootFileName  = BaseFileNameAutoCorr+ ".root"
+    
+if not 'OutputAutoCorrPoolFileName' in dir():
+   OutputAutoCorrPoolFileName  = BaseFileNameAutoCorr + ".pool.root"
+
+if not 'OutputObjectSpecAutoCorr' in dir():
+   OutputObjectSpecAutoCorr = "LArAutoCorrComplete#"+KeyOutputAC+"#"+LArCalib_Flags.LArPhysAutoCorrFolder
+   OutputTagSpecAutoCorr=LArCalibFolderTag(LArCalib_Flags.LArPhysAutoCorrFolder,"_mu_"+str(NColl)+ACLArCalibFolderTag)
+
+#######################################################################################
+# print summary
+#######################################################################################
+
+PedestalAutoCorrLog = logging.getLogger( "PedestalAutoCorrLog" )
+PedestalAutoCorrLog.info( " ======================================================== " )
+PedestalAutoCorrLog.info( " ***           LAr PhysAutoCorr summary               *** " )
+PedestalAutoCorrLog.info( " ======================================================== " )
+PedestalAutoCorrLog.info( " RunNumber                         = "+str(RunNumberList) )
+PedestalAutoCorrLog.info( " SubDetector                       = "+SubDet )
+PedestalAutoCorrLog.info( " Partition                         = "+Partition )
+PedestalAutoCorrLog.info( " Type                              = Pedestal " )
+PedestalAutoCorrLog.info( " LArGain                           = "+str(GainList) )
+PedestalAutoCorrLog.info( " LArCalibFolderTag              = "+"_mu_"+str(NColl)+ACLArCalibFolderTag )
+PedestalAutoCorrLog.info( " OutputAutoCorrRootFullFileName = "+OutputAutoCorrRootFileDir + "/" + OutputAutoCorrRootFileName )
+PedestalAutoCorrLog.info( " OutputAutoCorrPoolFullFileName    = "+OutputAutoCorrPoolFileDir + "/" + OutputAutoCorrPoolFileName )
+PedestalAutoCorrLog.info( " OutputObjectSpecAutoCorr          = "+OutputObjectSpecAutoCorr )
+PedestalAutoCorrLog.info( " OutputTagSpecAutoCorr             = "+OutputTagSpecAutoCorr )
+PedestalAutoCorrLog.info( " IOVBegin                          = "+str(IOVBegin) )
+PedestalAutoCorrLog.info( " IOVEnd                            = "+str(IOVEnd) )
+PedestalAutoCorrLog.info( " LArCalibOutputDB                  = "+OutputDB )
+PedestalAutoCorrLog.info( " ======================================================== " )
+
+#######################################################################################
+#include ("LArConditionsCommon/LArMinimalSetup.py")
+Geometry = 'ATLAS-GEO-18-01-01'
+
+GlobalTag = 'COMCOND-BLKPST-005-06'
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.all_setOff()
+DetFlags.LAr_setOn()
+DetFlags.Tile_setOn()
+DetFlags.digitize.all_setOff()
+
+from AthenaCommon.GlobalFlags import globalflags
+globalflags.DetGeo.set_Value_and_Lock('atlas')
+globalflags.DataSource.set_Value_and_Lock('data')
+
+from AthenaCommon.BeamFlags import jobproperties
+jobproperties.Beam.bunchSpacing = 50
+jobproperties.Beam.numberOfCollisions = float(NColl)
+
+# dont load Shape from COMP200 
+from LArConditionsCommon.LArCondFlags import larCondFlags
+larCondFlags.useShape.set_Value_and_Lock(False)
+
+import AthenaCommon.AtlasUnixGeneratorJob
+
+# Setup Db stuff
+import AthenaPoolCnvSvc.AthenaPool
+
+from AthenaCommon.GlobalFlags import jobproperties
+jobproperties.Global.DetDescrVersion=Geometry
+
+from AtlasGeoModel import SetGeometryVersion
+from AtlasGeoModel import GeoModelInit
+
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += [ "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/poolcond/PoolCat_oflcond.xml" ]
+
+from LArROD.LArRODFlags import larRODFlags
+larRODFlags.doOFCPileupOptimization = True
+
+include( "CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py")
+include( "CaloIdCnv/CaloIdCnv_joboptions.py" )
+include( "TileIdCnv/TileIdCnv_jobOptions.py" )
+include( "LArDetDescr/LArDetDescr_joboptions.py" )
+include("TileConditions/TileConditions_jobOptions.py" )
+include("LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py")
+
+# Temperature folder
+conddb.addFolder("DCS_OFL","/LAR/DCS/FEBTEMP")
+svcMgr.EventSelector.InitialTimeStamp = 1284030331
+import cx_Oracle
+import time
+import datetime
+connection=cx_Oracle.connect("ATLAS_SFO_T0_R/readmesfotz2008@atlr")
+cursor=connection.cursor()
+sRequest=("SELECT RUNNR,CREATION_TIME FROM SFO_TZ_RUN WHERE RUNNR='%s'")%(RunNumberList[0])
+cursor.execute(sRequest)
+times= cursor.fetchall()
+d=times[0][1]
+iovtemp=int(time.mktime(d.timetuple()))
+#print "Setting timestamp for run ",RunNumberList[0]," to ",iovtemp
+#svcMgr.IOVDbSvc.forceTimestamp = 1283145454
+svcMgr.IOVDbSvc.forceTimestamp = iovtemp
+
+#if ( doLArCalibDataQuality  ) :
+
+#   ## The reference is the Oracle DB
+#   conddb.addFolder("",LArCalib_Flags.LArAutoCorrFolder+"<key>LArAutoCorrRef</key><dbConnection>"+DBConnectionCOOL+"</dbConnection>"+ChannelSelection)
+
+#AutoCorrelation from data electronics noise
+conddb.addFolder("","<dbConnection>"+InputDB+"</dbConnection>/LAR/ElecCalibOfl/AutoCorrs/AutoCorr<key>LArAutoCorrRef</key>")
+conddb.addOverride("/LAR/ElecCalibOfl/AutoCorrs/AutoCorr","LARElecCalibOflAutoCorrsAutoCorr-UPD3-01")
+
+#load fsampl, MinBias Average and PulseShape 32 samples from OFLP200
+from IOVDbSvc.CondDB import conddb
+conddb.addFolder("LAR_OFL","/LAR/ElecCalibMC/Shape",forceMC=True)
+conddb.addFolder("LAR_OFL","/LAR/ElecCalibMC/MinBias",forceMC=True)
+conddb.addFolder("LAR_OFL","/LAR/ElecCalibMC/fSampl",forceMC=True)
+conddb.addOverride("/LAR/ElecCalibMC/fSampl","LARElecCalibMCfSampl-CSC02-F-QGSP_BERT_BIRK")
+conddb.addOverride("/LAR/ElecCalibMC/Shape","LARElecCalibMCShape-Apr2010")
+conddb.addOverride("/LAR/ElecCalibMC/MinBias","LARElecCalibMCMinBias-MinBias-7TeV")
+
+
+svcMgr.IOVDbSvc.GlobalTag = GlobalTag
+
+from LArRecUtils.LArAutoCorrTotalToolDefault import LArAutoCorrTotalToolDefault
+theLArAutoCorrTool = LArAutoCorrTotalToolDefault()
+theLArAutoCorrTool.NSamples = 5
+theLArAutoCorrTool.keyAutoCorr = "LArAutoCorrRef"
+ToolSvc += theLArAutoCorrTool
+
+
+from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrToolToDB
+theLArAutoCorrToolToDB = LArAutoCorrToolToDB("LArAutoCorrToolToDB")
+theLArAutoCorrToolToDB.AutoCorrTool = theLArAutoCorrTool
+theLArAutoCorrToolToDB.GroupingType = "ExtendedSubDetector"
+theLArAutoCorrToolToDB.AutoCorrKey = KeyOutputAC
+topSequence += theLArAutoCorrToolToDB
+
+# 
+ToolSvc.LArADC2MeVToolDefault.UseFEBGainTresholds=False
+#
+######################################################################
+#                                                                    #
+#                          Output                                    #
+#                                                                    #
+######################################################################
+
+
+
+if ( WriteNtuple ) :
+   
+   from LArCalibTools.LArCalibToolsConf import LArAutoCorr2Ntuple
+   LArAutoCorr2Ntuple = LArAutoCorr2Ntuple( "LArAutoCorr2Ntuple" )
+   LArAutoCorr2Ntuple.Nsamples     = NSamples
+   LArAutoCorr2Ntuple.ContainerKey = KeyOutputAC
+   
+   topSequence += LArAutoCorr2Ntuple
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputAutoCorrRootFileDir + "/" + OutputAutoCorrRootFileName): 
+      os.remove(OutputAutoCorrRootFileDir + "/" + OutputAutoCorrRootFileName)
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputAutoCorrRootFileDir + "/" + OutputAutoCorrRootFileName+"' OPT='NEW'" ]
+
+
+if ( WritePoolFile ) :
+
+        from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+        
+        if os.path.exists(OutputAutoCorrPoolFileDir + "/" + OutputAutoCorrPoolFileName): 
+           os.remove(OutputAutoCorrPoolFileDir + "/" + OutputAutoCorrPoolFileName)
+        OutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg",OutputAutoCorrPoolFileDir + "/" + OutputAutoCorrPoolFileName,
+                                                [OutputObjectSpecAutoCorr],[OutputTagSpecAutoCorr],WriteIOV)
+        OutputConditionsAlg.Run1 = IOVBegin
+        if IOVEnd>0:
+              OutputConditionsAlg.Run2=IOVEnd
+        svcMgr.IOVDbSvc.dbConnection  = OutputDB
+        
+        from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+        svcMgr += IOVRegistrationSvc()
+        svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+        svcMgr.IOVRegistrationSvc.RecreateFolders = False
+       
+        
+
+#--------------------------------------------------------------
+#--- Dummy event loop parameters
+#--------------------------------------------------------------
+svcMgr.EventSelector.RunNumber         = int(RunNumberList[0])
+svcMgr.EventSelector.EventsPerRun      = 1
+svcMgr.EventSelector.FirstEvent        = 0
+svcMgr.EventSelector.EventsPerLB       = 1
+svcMgr.EventSelector.FirstLB           = 1
+svcMgr.EventSelector.InitialTimeStamp  = 0
+svcMgr.EventSelector.TimeStampInterval = 5
+svcMgr.EventSelector.OverrideRunNumber=True
+theApp.EvtMax                          = 1
+
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = INFO
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = INFO)
+
+###########################################################################
+#svcMgr.IOVDbSvc.OutputLevel = DEBUG 
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Merge.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Merge.py
new file mode 100644
index 00000000000..d75a5f4a747
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Merge.py
@@ -0,0 +1,119 @@
+###########################################################################
+#
+# TopOptions to copy a complete set of conditions for a given run to 
+# one POOL file and one sqlite file
+#
+# Walter.Lampl@cern.ch
+#
+###########################################################################
+
+
+import shutil, os
+from LArCalibProcessing.extractFolderInfo import *
+
+if 'dbname' not in dir():
+  dbname="COMP200"
+
+if 'sqliteIn' not in dir():
+  sqliteIn="freshConstants.db"
+
+if 'sqliteOut' not in dir():
+  sqliteOut=sqliteIn+".out"
+
+inputDB="sqlite://;schema="+sqliteIn+";dbname="+dbname
+outputDB="sqlite://;schema="+sqliteOut+";dbname="+dbname
+
+folderInfo=extractFolderInfo(inputDB)
+
+#ccs="<channelSelection>3:238</channelSelection>"
+
+if 'mergeFolders' not in dir():
+  mergeFolders=["/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples",
+                "/LAR/ElecCalibOfl/Shape/RTM/5samples"
+                ]
+
+if 'fileName' not in dir():
+  fileName="LArConditions"
+
+shutil.copyfile(sqliteIn,sqliteOut)
+
+
+
+import AthenaCommon.AtlasUnixGeneratorJob #use MC event selector
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()  
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+theApp.EvtMax = 1
+conddb.setGlobalTag("COMCOND-ES1PST-004-01") #For id mapping
+
+svcMgr.PoolSvc.CheckDictionary=False
+svcMgr.PoolSvc.SortReplicas=False
+
+runNoForFileName=2147483647
+
+outObjects=[]
+outTags=[]
+
+if 'keySuffix' not in dir():
+  keySuffix="_1ns"
+
+for f in folderInfo:
+  fn=f[0]
+  type=f[1]
+  key=f[2]
+  tag=f[3]
+  since=f[4]
+  until=f[5]
+  print "Working on folder",fn,"IOV:",since,"-",until
+  #if since == 0:
+  #  print "ERROR: Found IOV begin = 0"
+    #sys.exit(-1)
+  if 'OFC' in fn and not 'mu_20' in tag:
+     continue
+  if fn in mergeFolders:
+    if since>0 and since<runNoForFileName:
+      runNoForFileName=since
+    if len(keySuffix)>0 and key.endswith(keySuffix):
+      key=key[:-len(keySuffix)]
+    outObjects+=["#".join((type,key,fn))]
+    outTags+=[tag]
+    conddb.addFolder("",fn+"<tag>"+tag+"</tag><db>"+inputDB+"</db><key>"+key+"</key>")
+
+svcMgr.EventSelector.RunNumber = 2147483647
+
+OutputFileRec=fileName+"_"+str(runNoForFileName)+".pool.root"
+if os.access(OutputFileRec,os.F_OK):
+  print "File",OutputFileRec,"exists already, removing ...."
+  os.remove(OutputFileRec)
+
+print svcMgr.IOVDbSvc.Folders
+
+print "============ Reco ============="
+print outObjects
+print outTags
+
+from LArCalibTools.LArCalibToolsConf import LArBlockCorrections
+topSequence+=LArBlockCorrections()
+
+from LArCalibTools.LArCalibToolsConf import ForceLoadCondObj
+topSequence+=ForceLoadCondObj(ObjectList=outObjects)
+
+from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+theOutputConditionsAlgRec=OutputConditionsAlg("OutputConditionsAlgRec",OutputFileRec,
+                                              outObjects,outTags,True)
+
+
+svcMgr.IOVDbSvc.dbConnection  = outputDB
+from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+svcMgr += IOVRegistrationSvc()
+svcMgr.IOVRegistrationSvc.RecreateFolders = True
+
+svcMgr.DetectorStore.Dump=True
+
+
+if 'poolcat' in dir():
+  svcMgr.PoolSvc.WriteCatalog="xmlcatalog_file:"+poolcat
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_MinimalSetup.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_MinimalSetup.py
new file mode 100644
index 00000000000..311039902da
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_MinimalSetup.py
@@ -0,0 +1,38 @@
+##############################################################################
+#
+# LArCalib_MinimalSetup.py
+#
+# Minimal setup for electronic calibration jobs that do not need to read event
+# data but only conditions data (e.g. OFC computation). It is equivalent to
+# LArConditionsCommons/LArMinimalSetup.py, but skip the ByteStream part.
+#
+# Last update: 06/03/2008 <Fabien.Tarrade@cern.ch>
+#
+##############################################################################
+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('COMP200')
+
+from AthenaCommon.JobProperties import jobproperties
+jobproperties.Global.DetDescrVersion = "ATLAS-GEO-21-00-00"
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.Calo_setOff()  #Switched off to avoid geometry
+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" )
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_jobOptions.py
new file mode 100644
index 00000000000..9b945a4ec5a
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_jobOptions.py
@@ -0,0 +1,495 @@
+
+import commands
+
+###########################################################################
+#
+# <Marco.Delmastro@cern.ch>
+#
+# Example jobOptions to compute OFC cali in all 3 gains
+#
+# Last update: 09/12/2008 <Fabien.Tarrade@cern.ch>
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+
+###########################################################################
+#                 Input selection (Autocorr, CaliWave)
+###########################################################################
+
+# RunNumber trigger IOV if reading from COOL is eneabled
+if not 'RunNumber' in dir():
+   RunNumber = '0000000'
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"  
+
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"
+      
+## AutoCorr
+
+if not 'ReadAutoCorrFromCOOL' in dir():
+   ReadAutoCorrFromCOOL = True 
+
+if not 'InputAutoCorrPoolDir' in dir():
+   InputAutoCorrPoolDir = commands.getoutput("pwd")
+
+if not 'InputAutoCorrPoolFileName' in dir():
+   InputAutoCorrPoolFileName = "LArAutoCorr.pool.root"
+
+## CaliWave
+
+if not 'ReadCaliWaveFromCOOL' in dir():
+   ReadCaliWaveFromCOOL = True
+
+if not 'InputCaliWavePoolDir' in dir():
+   InputCaliWavePoolDir = commands.getoutput("pwd")
+
+if not 'InputCaliWavePoolFileName' in dir():
+   InputCaliWavePoolFileName = "LArCaliWave.pool.root"
+
+
+## Options   
+
+if not 'StripsXtalkCorr' in dir():
+   StripsXtalkCorr = True
+
+if not 'ChannelSelection' in dir():
+   # Read all
+   ChannelSelection = " "
+   ## Example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,35:66</channelSelection>"
+
+from string import *
+def DBConnectionFile(sqlitefile):
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+###########################################################################
+#                             OFC properties
+###########################################################################
+
+if not 'Nsamples' in dir():
+   Nsamples = 5
+
+if not 'Nphases' in dir():
+   Nphases = 50
+
+if not 'Dphases' in dir():
+   Dphases = 1
+   
+if not 'Ndelays' in dir():
+   Ndelays = 24
+	
+if not 'ContainerKey' in dir():
+   ContainerKey = "LArCaliWave"
+   
+if not 'OFCKey' in dir():
+   OFCKey = "LArOFC"
+
+if not 'ShapeKey' in dir():
+   ShapeKey = "LArShape"
+	
+if not 'Normalize' in dir():
+   Normalize = True
+
+if not 'TimeShift' in dir() :
+   TimeShift = False
+
+if not 'TimeShiftByIndex' in dir() :
+   TimeShiftByIndex = -1
+
+if not 'FillShape' in dir():
+   FillShape = False # Do not fill a LArShapeComplete object for calibration OFC!
+
+if not 'DumpOFC' in dir():
+   DumpOFC = False
+
+###########################################################################
+#                              OFC output
+###########################################################################
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+   
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumber)
+
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd
+
+if not 'DBConnectionCOOL' in dir():   
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"
+   
+if not 'OutputOFCRootFileDir' in dir():
+   OutputOFCRootFileDir = commands.getoutput("pwd")
+   
+if not 'OutputOFCPoolFileDir' in dir():
+   OutputOFCPoolFileDir = commands.getoutput("pwd")
+
+if not 'OutputShapePoolFileDir' in dir():
+   OutputShapePoolFileDir = commands.getoutput("pwd")
+
+OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","")
+
+if (StripsXtalkCorr):
+   OFCFileTag += "_StripsXtalkCorr"
+
+OFCFileTag += "_"+str(Nsamples)+"samples"
+
+if (Dphases>1):
+   OFCFileTag += "_"+str(Dphases)+"Dphase"
+
+if not 'OutputOFCRootFileName' in dir():
+   OutputOFCRootFileName = "LArOFCCali_"+OFCFileTag + ".root"
+   
+if not 'OutputOFCPoolFileName' in dir():
+   OutputOFCPoolFileName = "LArOFCCali_"+OFCFileTag + ".pool.root"
+
+if not 'OutputShapePoolFileName' in dir():
+   OutputShapePoolFileName = "LArShapeCali_"+OFCFileTag + ".pool.root"
+
+if not 'LArCalibFolderOutputTag' in dir():
+   LArCalibFolderOutputTag = LArCalib_Flags.tagSuffix  
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)
+
+if not 'OutputObjectSpecOFC' in dir():
+   if   ( ContainerKey == "LArCaliWave" ):
+      if ( not StripsXtalkCorr ):
+         OutputObjectSpecOFC   = "LArOFCComplete#"  +OFCKey  +"#"+ LArCalib_Flags.LArOFCCaliFolder	
+         OutputObjectSpecTagOFC    = LArCalibFolderTag(LArCalib_Flags.LArOFCCaliFolder,LArCalibFolderOutputTag)
+      else:
+         OutputObjectSpecOFC   = "LArOFCComplete#"  +OFCKey  +"#"+ LArCalib_Flags.LArOFCCaliFolderXtlk
+         OutputObjectSpecTagOFC    = LArCalibFolderTag(LArCalib_Flags.LArOFCCaliFolderXtlk,LArCalibFolderOutputTag)
+			
+   elif ( ContainerKey == "LArMasterWave" ):
+      if ( not StripsXtalkCorr ):
+         OutputObjectSpecOFC   = "LArOFCComplete#"+OFCKey+"#"+ LArCalib_Flags.LArOFCMasterWaveFolder
+         OutputObjectSpecTagOFC    = LArCalibFolderTag(LArCalib_Flags.LArOFCMasterWaveFolder,LArCalibFolderOutputTag)
+      else:
+         OutputObjectSpecOFC   = "LArOFCComplete#"+OFCKey+"#"+ LArCalib_Flags.LArOFCMasterWaveFolderXtlk
+         OutputObjectSpecTagOFC    = LArCalibFolderTag(LArCalib_Flags.LArOFCMasterWaveFolderXtlk,LArCalibFolderOutputTag)
+			
+if not 'OutputObjectSpecShape' in dir():
+   if   ( ContainerKey == "LArCaliWave" ):
+      if ( not StripsXtalkCorr ):
+         OutputObjectSpecShape = "LArShapeComplete#"+ShapeKey+"#"+ LArCalib_Flags.LArShapeCaliWaveFolder		
+         OutputObjectSpecTagShape  = LArCalibFolderTag(LArCalib_Flags.LArShapeCaliWaveFolder,LArCalibFolderOutputTag)
+      else:
+         OutputObjectSpecShape = "LArShapeComplete#"+ShapeKey+"#"+ LArCalib_Flags.LArShapeCaliWaveFolderXtlk
+         OutputObjectSpecTagShape  = LArCalibFolderTag(LArCalib_Flags.LArShapeCaliWaveFolderXtlk,LArCalibFolderOutputTag)
+
+   elif ( ContainerKey == "LArMasterWave" ):
+         if ( not StripsXtalkCorr ):
+            OutputObjectSpecShape = "LArShapeComplete#"+ShapeKey+"#"+LArCalib_Flags.LArShapeMasterWaveFolder
+            OutputObjectSpecTagShape  = LArCalibFolderTag(LArCalib_Flags.LArShapeMasterWaveFolder,LArCalibFolderOutputTag)		
+         else:
+            OutputObjectSpecShape = "LArShapeComplete#"+ShapeKey+"#"+ LArCalib_Flags.LArShapeMasterWaveFolderXtlk
+            OutputObjectSpecTagShape  = LArCalibFolderTag(LArCalib_Flags.LArShapeMasterWaveFolderXtlk,LArCalibFolderOutputTag)
+   
+if ( ReadAutoCorrFromCOOL ):      
+   if 'InputAutoCorrSQLiteFile' in dir():
+      InputDBConnectionAutoCorr = DBConnectionFile(InputAutoCorrSQLiteFile)
+   else:
+      InputDBConnectionAutoCorr = DBConnectionCOOL
+
+if ( ReadCaliWaveFromCOOL ):      
+   if 'InputCaliWaveSQLiteFile' in dir():
+      InputDBConnectionCaliWave = DBConnectionFile(InputCaliWaveSQLiteFile)
+   else:
+      InputDBConnectionCaliWave = DBConnectionCOOL
+
+## Bad Channel   
+   
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;"
+      InputDBConnectionBadChannel = "COOLOFL_LAR/COMP200"            
+
+###########################################################################
+# Print summary
+###########################################################################
+
+OFCLog = logging.getLogger( "OFCLog" )
+OFCLog.info( " ======================================================== " )
+OFCLog.info( " ***                 LAr OFC summary                  *** " )
+OFCLog.info( " ======================================================== " )
+OFCLog.info( " RunNumber                          = "+str(RunNumber) )
+if ( ReadAutoCorrFromCOOL ):
+   OFCLog.info( " InputDBConnectionAutoCorr          = "+InputDBConnectionAutoCorr )
+else :
+   OFCLog.info( " InputAutoCorrPoolFileName          = "+InputAutoCorrPoolFileName )
+if 'AutoCorrLArCalibFolderTag' in dir() :   
+   OFCLog.info( " AutoCorrLArCalibFolderTag          = "+AutoCorrLArCalibFolderTag )
+if ( ReadCaliWaveFromCOOL ):
+   OFCLog.info( " InputDBConnectionCaliWave          = "+InputDBConnectionCaliWave )
+else :
+   OFCLog.info( " InputCaliWavePoolFileName          = "+InputCaliWavePoolFileName )
+if ( (ReadAutoCorrFromCOOL or ReadCaliWaveFromCOOL) and ChannelSelection != " " ):
+   OFCLog.info( " ChannelSelection                   = "+ChannelSelection )
+if 'CaliWaveLArCalibFolderTag' in dir() :   
+   OFCLog.info( " CaliWaveLArCalibFolderTag          = "+CaliWaveLArCalibFolderTag )
+OFCLog.info( " OutputOFCRootFullFileName          = "+OutputOFCRootFileDir+"/"+OutputOFCRootFileName )
+OFCLog.info( " OutputOFCPoolFullFileName          = "+OutputOFCPoolFileDir+"/"+OutputOFCPoolFileName )
+OFCLog.info( " OutputShapePoolFileName            = "+OutputShapePoolFileDir+"/"+OutputShapePoolFileName )
+OFCLog.info( " OutputObjectSpecOFC                = "+str(OutputObjectSpecOFC) )
+OFCLog.info( " OutputObjectSpecTagOFC             = "+str(OutputObjectSpecTagOFC) )
+OFCLog.info( " OutputObjectSpecShape              = "+str(OutputObjectSpecShape) )
+OFCLog.info( " OutputObjectSpecTagShape           = "+str(OutputObjectSpecTagShape) )
+OFCLog.info( " IOVBegin                           = "+str(IOVBegin) )
+OFCLog.info( " IOVEnd                             = "+str(IOVEnd) )
+OFCLog.info( " LArCalibOutputDB                   = "+OutputDB )
+OFCLog.info( " ======================================================== " )
+###########################################################################
+
+###########################################################################
+#                                                                         #
+#                       Global settings                                   #
+#                                                                         #
+###########################################################################
+
+include( "AthenaCommon/Atlas_Gen.UnixStandardJob.py" )
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+###########################################################################
+#                                                                         #
+#    Input conditions data (AutoCorr, CaliWave) for COOL and/or POOL      #
+#                                                                         #
+###########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+include ("LArCalibProcessing/LArCalib_BadChanTool.py")
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   OFCLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   OFCLog.info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+
+if ( ReadAutoCorrFromCOOL or ReadCaliWaveFromCOOL ):
+   if not 'InputAutoCorrSQLiteFile' in dir():
+      OFCLog.info( "Read AutoCorr from  Oracle DB" )
+   else :
+      OFCLog.info( "Read AutoCorr from SQLite file" )
+      
+   if not 'InputCaliWaveSQLiteFile'  in dir():
+      OFCLog.info( "Read CaliWave from Oracle DB" )
+   else :
+      OFCLog.info( "Read CaliWave from SQLite file" )
+
+if ( ReadAutoCorrFromCOOL ):
+   AutoCorrFolder  = LArCalib_Flags.LArAutoCorrFolder
+   if 'AutoCorrLArCalibFolderTag' in dir() :
+      AutoCorrTagSpec = LArCalibFolderTag(AutoCorrFolder,AutoCorrLArCalibFolderTag)
+      conddb.addFolder("",AutoCorrFolder+"<tag>"+AutoCorrTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionAutoCorr+"</dbConnection>"+ ChannelSelection)
+   else :
+      conddb.addFolder("",AutoCorrFolder+"<dbConnection>"+InputDBConnectionAutoCorr+"</dbConnection>"+ ChannelSelection)
+else:
+   if 'InputAutoCorrPoolFileName' in dir():
+      OFCLog.info( "Read AutoCorr from POOL file" )
+      PoolFileList += [ InputAutoCorrPoolDir+"/"+InputAutoCorrPoolFileName ]
+   else:
+      OFCLog.info( "No PoolFileList found! Please list the POOL files containing AutoCorrelation Matrix or read from COOL." )
+      theApp.exit(-1)      
+      
+if ( ReadCaliWaveFromCOOL ):
+   if ( not StripsXtalkCorr ):
+      CaliWaveFolder = LArCalib_Flags.LArCaliWaveFolder
+   else:
+      CaliWaveFolder = LArCalib_Flags.LArCaliWaveFolderXtlk
+   if 'CaliWaveLArCalibFolderTag' in dir() :  
+      CaliWaveTagSpec = LArCalibFolderTag(CaliWaveFolder,CaliWaveLArCalibFolderTag)
+      conddb.addFolder("",CaliWaveFolder+"<tag>"+CaliWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionCaliWave+"</dbConnection>" + ChannelSelection)
+   else :
+      conddb.addFolder("",CaliWaveFolder+"<dbConnection>"+InputDBConnectionCaliWave+"</dbConnection>" + ChannelSelection)
+   
+else:
+   if 'InputCaliWavePoolFileName' in dir():
+      OFCLog.info( "Read CaliWave from POOL file" )
+      PoolFileList += [ InputCaliWavePoolDir+"/"+InputCaliWavePoolFileName ]
+   else:
+      OFCLog.info( "No PoolFileList found! Please list the POOL files containing CaliWave or read from COOL." )
+      theApp.exit(-1)
+
+if ( len(PoolFileList)>0 ):   
+
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+   
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+   
+###########################################################################
+#                            OFC computation
+###########################################################################
+
+from LArCalibUtils.LArCalibUtilsConf import LArOFCAlg
+LArCaliOFCAlg = LArOFCAlg("LArCaliOFCAlg")
+LArCaliOFCAlg.ReadCaliWave = True
+LArCaliOFCAlg.KeyList   = [ ContainerKey ]
+LArCaliOFCAlg.Nphase    = Nphases
+LArCaliOFCAlg.Dphase    = Dphases
+LArCaliOFCAlg.Ndelay    = Ndelays
+LArCaliOFCAlg.Nsample   = Nsamples
+LArCaliOFCAlg.Normalize = Normalize
+LArCaliOFCAlg.TimeShift = TimeShift
+LArCaliOFCAlg.TimeShiftByIndex = TimeShiftByIndex
+LArCaliOFCAlg.Verify    = True
+LArCaliOFCAlg.FillShape = FillShape
+if ( DumpOFC ) :
+	LArCaliOFCAlg.DumpOFCfile = "LArOFCCali.dat"
+LArCaliOFCAlg.GroupingType = GroupingType
+topSequence+=LArCaliOFCAlg
+
+from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrDecoderTool
+theLArAutoCorrDecoderTool = LArAutoCorrDecoderTool()
+ToolSvc += theLArAutoCorrDecoderTool
+
+###########################################################################
+
+if ( WriteNtuple ) :
+
+   from LArCalibTools.LArCalibToolsConf import LArOFC2Ntuple
+   LArOFC2Ntuple = LArOFC2Ntuple("LArOFC2Ntuple")
+   LArOFC2Ntuple.ContainerKey = OFCKey 	   
+   topSequence+=LArOFC2Ntuple
+
+   if ( FillShape ):
+      from LArCalibTools.LArCalibToolsConf import LArShape2Ntuple
+      LArShape2Ntuple = LArShape2Ntuple("LArShape2Ntuple")
+      LArShape2Ntuple.ContainerKey = ShapeKey 	   
+      topSequence+=LArShape2Ntuple
+   
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputOFCRootFileDir+"/"+OutputOFCRootFileName): 
+      os.remove(OutputOFCRootFileDir+"/"+OutputOFCRootFileName)  
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputOFCRootFileDir+"/"+OutputOFCRootFileName+"' OPT='NEW'" ]
+   
+if (  WritePoolFile ) :
+    
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+
+   if os.path.exists(OutputOFCPoolFileDir+"/"+OutputOFCPoolFileName): 
+      os.remove(OutputOFCPoolFileDir+"/"+OutputOFCPoolFileName)  
+   OutputConditionsAlgOFC = OutputConditionsAlg("OutputConditionsAlgOFC",OutputOFCPoolFileDir+"/"+OutputOFCPoolFileName,
+                                                [OutputObjectSpecOFC],[OutputObjectSpecTagOFC],WriteIOV)
+   OutputConditionsAlgOFC.Run1     = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlgOFC.Run2  = IOVEnd
+   
+   if ( FillShape ):
+      
+      if os.path.exists(OutputShapePoolFileDir+"/"+OutputShapePoolFileName): 
+         os.remove(OutputShapePoolFileDir+"/"+OutputShapePoolFileName) 
+      OutputConditionsAlgShape = OutputConditionsAlg("OutputConditionsAlgShape",OutputShapePoolFileDir+"/"+OutputShapePoolFileName,
+                                                     [OutputObjectSpecShape],[OutputObjectSpecTagShape],WriteIOV)
+      OutputConditionsAlgShape.Run1     = IOVBegin
+      if IOVEnd>0:
+         OutputConditionsAlgShape.Run2  = IOVEnd
+
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+   
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+   
+###########################################################################
+#               Use EventSelector to select IOV                           #
+###########################################################################	
+
+from McEventSelector.McEventSelectorConf import McEventSelector
+svcMgr += McEventSelector("EventSelector")
+svcMgr.EventSelector.RunNumber	= int(RunNumber)
+svcMgr.EventSelector.EventsPerRun      = 1
+svcMgr.EventSelector.FirstEvent	= 1
+svcMgr.EventSelector.InitialTimeStamp  = 0
+svcMgr.EventSelector.TimeStampInterval = 1
+
+##########################################################################
+#          don't remove otherwise infinite loop                          #
+##########################################################################
+
+theApp.EvtMax = 1
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = VERBOSE)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = DEBUG)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
+
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_splitter_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_splitter_jobOptions.py
new file mode 100644
index 00000000000..aff3a2b94ed
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_splitter_jobOptions.py
@@ -0,0 +1,580 @@
+import commands
+
+###########################################################################
+#
+# <pavol@mail.cern.ch>
+#
+# Example jobOptions to compute OFC cali in all 3 gains with splitted caliwaves
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+
+###########################################################################
+#                 Input selection (Autocorr, CaliWave)
+###########################################################################
+
+# RunNumber trigger IOV if reading from COOL is eneabled
+if not 'RunNumber' in dir():
+   RunNumber = '0000000'
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'AllWavesPerCh' in dir():
+        AllWavesPerCh      =  True
+
+if not 'MaxCalLinePerCh' in dir():
+        MaxCalLinePerCh = 4
+
+if not 'doCaliWaveSelector' in dir():
+        doCaliWaveSelector = True
+
+if not 'SubDet' in dir():
+   SubDet = "EndCap"  
+
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"
+      
+## AutoCorr
+
+if not 'ReadAutoCorrFromCOOL' in dir():
+   ReadAutoCorrFromCOOL = True 
+
+if not 'InputAutoCorrPoolDir' in dir():
+   InputAutoCorrPoolDir = commands.getoutput("pwd")
+
+if not 'InputAutoCorrPoolFileName' in dir():
+   InputAutoCorrPoolFileName = "LArAutoCorr.pool.root"
+
+## CaliWave
+
+if not 'ReadCaliWaveFromCOOL' in dir():
+   ReadCaliWaveFromCOOL = True
+
+if not 'InputCaliWavePoolDir' in dir():
+   InputCaliWavePoolDir = commands.getoutput("pwd")
+
+if not 'InputCaliWavePoolFileName' in dir():
+   InputCaliWavePoolFileName = "LArCaliWave.pool.root"
+
+
+## Options   
+
+if not 'StripsXtalkCorr' in dir():
+   StripsXtalkCorr = True
+
+if not 'ChannelSelection' in dir():
+   # Read all
+   ChannelSelection = " "
+   ## Example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,35:66</channelSelection>"
+
+from string import *
+def DBConnectionFile(sqlitefile):
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+###########################################################################
+#                             OFC properties
+###########################################################################
+
+if not 'Nsamples' in dir():
+   Nsamples = 5
+
+if not 'Nphases' in dir():
+   Nphases = 50
+
+if not 'Dphases' in dir():
+   Dphases = 1
+   
+if not 'Ndelays' in dir():
+   Ndelays = 24
+	
+if not 'ContainerKey' in dir():
+   ContainerKey = "LArCaliWave"
+   
+if AllWavesPerCh and (not 'ContainerKeySplitted' in dir()):
+        ContainerKeySplitted = []
+        for i in range(0, MaxCalLinePerCh):
+                if (doCaliWaveSelector):
+                    ContainerKeySplitted.append(ContainerKey+str(i)+"Sel")
+                else:
+                    ContainerKeySplitted.append(ContainerKey+str(i))
+
+if (doCaliWaveSelector) and (not AllWavesPerCh):
+        ContainerKey += "Sel"
+
+if not 'OFCKey' in dir():
+   OFCKey = "LArOFC"
+
+if AllWavesPerCh and (not 'OFCKeySplitted' in dir()):
+        OFCKeySplitted = []
+        for i in range(0, MaxCalLinePerCh):
+             OFCKeySplitted.append(OFCKey+str(i+1))
+
+if not 'ShapeKey' in dir():
+   ShapeKey = "LArShape"
+
+if AllWavesPerCh and (not 'ShapeKeySplitted' in dir()):
+        ShapeKeySplitted = []
+        for i in range(0, MaxCalLinePerCh):
+             ShapeKeySplitted.append(ShapeKey+str(i+1))
+
+if not 'Normalize' in dir():
+   Normalize = True
+
+if not 'TimeShift' in dir() :
+   TimeShift = False
+
+if not 'TimeShiftByIndex' in dir() :
+   TimeShiftByIndex = -1
+
+if not 'FillShape' in dir():
+   FillShape = False # Do not fill a LArShapeComplete object for calibration OFC!
+
+if not 'DumpOFC' in dir():
+   DumpOFC = False
+
+###########################################################################
+#                              OFC output
+###########################################################################
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+   
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumber)
+
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd
+
+if not 'DBConnectionCOOL' in dir():   
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;user=ATLAS_COOL_READER"
+   
+if not 'OutputOFCRootFileDir' in dir():
+   OutputOFCRootFileDir = commands.getoutput("pwd")
+   
+if not 'OutputOFCPoolFileDir' in dir():
+   OutputOFCPoolFileDir = commands.getoutput("pwd")
+
+if not 'OutputShapePoolFileDir' in dir():
+   OutputShapePoolFileDir = commands.getoutput("pwd")
+
+OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","")
+
+if (StripsXtalkCorr):
+   OFCFileTag += "_StripsXtalkCorr"
+
+OFCFileTag += "_"+str(Nsamples)+"samples"
+
+if (Dphases>1):
+   OFCFileTag += "_"+str(Dphases)+"Dphase"
+
+if not 'OutputOFCRootFileName' in dir():
+   OutputOFCRootFileName = "LArOFCCali_"+OFCFileTag + ".root"
+   
+if not 'OutputOFCPoolFileName' in dir():
+   OutputOFCPoolFileName = "LArOFCCali_"+OFCFileTag + ".pool.root"
+
+if not 'OutputShapePoolFileName' in dir():
+   OutputShapePoolFileName = "LArShapeCali_"+OFCFileTag + ".pool.root"
+
+if not 'LArCalibFolderOutputTag' in dir():
+   LArCalibFolderOutputTag = "-UPD3-00"  
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)
+
+if not 'OutputObjectSpecOFC' in dir():
+   if ( AllWavesPerCh ) :
+        OutputObjectSpecOFC = []
+        for i in range(0, MaxCalLinePerCh):
+             OutputObjectSpecOFC.append("LArOFCComplete#"+OFCKeySplitted[i]+"#"+ LArCalib_Flags.LArOFCCaliFolder )
+        OutputObjectSpecTagOFC    = LArCalibFolderTag(LArCalib_Flags.LArOFCCaliFolder,LArCalibFolderOutputTag)
+   else:
+        if   ( ContainerKey == "LArCaliWave" ) or (ContainerKey == "LArCaliWaveSel") or (ContainerKey == "LArCaliWaveSelPatch"):
+         if ( not StripsXtalkCorr ):
+            OutputObjectSpecOFC   = ["LArOFCComplete#"  +OFCKey  +"#"+ LArCalib_Flags.LArOFCCaliFolder]	
+            OutputObjectSpecTagOFC    = LArCalibFolderTag(LArCalib_Flags.LArOFCCaliFolder,LArCalibFolderOutputTag)
+         else:
+            OutputObjectSpecOFC   = ["LArOFCComplete#"  +OFCKey  +"#"+ LArCalib_Flags.LArOFCCaliFolderXtlk]
+            OutputObjectSpecTagOFC    = LArCalibFolderTag(LArCalib_Flags.LArOFCCaliFolderXtlk,LArCalibFolderOutputTag)
+			
+        elif ( ContainerKey == "LArMasterWave" ):
+         if ( not StripsXtalkCorr ):
+            OutputObjectSpecOFC   = ["LArOFCComplete#"+OFCKey+"#"+ LArCalib_Flags.LArOFCMasterWaveFolder]
+            OutputObjectSpecTagOFC    = LArCalibFolderTag(LArCalib_Flags.LArOFCMasterWaveFolder,LArCalibFolderOutputTag)
+         else:
+            OutputObjectSpecOFC   = ["LArOFCComplete#"+OFCKey+"#"+ LArCalib_Flags.LArOFCMasterWaveFolderXtlk]
+            OutputObjectSpecTagOFC    = LArCalibFolderTag(LArCalib_Flags.LArOFCMasterWaveFolderXtlk,LArCalibFolderOutputTag)
+			
+if not 'OutputObjectSpecShape' in dir():
+   if ( AllWavesPerCh ) :
+        OutputObjectSpecShape = []
+        for i in range(0, MaxCalLinePerCh):
+             OutputObjectSpecShape.append("LArShapeComplete#"+ShapeKeySplitted[i]+"#"+ LArCalib_Flags.LArShapeCaliWaveFolder ) 
+        OutputObjectSpecTagShape  = LArCalibFolderTag(LArCalib_Flags.LArShapeCaliWaveFolder,LArCalibFolderOutputTag)
+   else:
+        if   ( ContainerKey == "LArCaliWave" ) or (ContainerKey == "LArCaliWaveSel") or (ContainerKey == "LArCaliWaveSelPatch"):
+         if ( not StripsXtalkCorr ):
+            OutputObjectSpecShape = ["LArShapeComplete#"+ShapeKey+"#"+ LArCalib_Flags.LArShapeCaliWaveFolder]		
+            OutputObjectSpecTagShape  = LArCalibFolderTag(LArCalib_Flags.LArShapeCaliWaveFolder,LArCalibFolderOutputTag)
+         else:
+            OutputObjectSpecShape = ["LArShapeComplete#"+ShapeKey+"#"+ LArCalib_Flags.LArShapeCaliWaveFolderXtlk]
+            OutputObjectSpecTagShape  = LArCalibFolderTag(LArCalib_Flags.LArShapeCaliWaveFolderXtlk,LArCalibFolderOutputTag)
+
+        elif ( ContainerKey == "LArMasterWave" ):
+         if ( not StripsXtalkCorr ):
+            OutputObjectSpecShape = ["LArShapeComplete#"+ShapeKey+"#"+LArCalib_Flags.LArShapeMasterWaveFolder]
+            OutputObjectSpecTagShape  = LArCalibFolderTag(LArCalib_Flags.LArShapeMasterWaveFolder,LArCalibFolderOutputTag)		
+         else:
+            OutputObjectSpecShape = ["LArShapeComplete#"+ShapeKey+"#"+ LArCalib_Flags.LArShapeMasterWaveFolderXtlk]
+            OutputObjectSpecTagShape  = LArCalibFolderTag(LArCalib_Flags.LArShapeMasterWaveFolderXtlk,LArCalibFolderOutputTag)
+   
+if ( ReadAutoCorrFromCOOL ):      
+   if 'InputAutoCorrSQLiteFile' in dir():
+      InputDBConnectionAutoCorr = DBConnectionFile(InputAutoCorrSQLiteFile)
+   else:
+      InputDBConnectionAutoCorr = DBConnectionCOOL
+
+if ( ReadCaliWaveFromCOOL ):      
+   if 'InputCaliWaveSQLiteFile' in dir():
+      InputDBConnectionCaliWave = DBConnectionFile(InputCaliWaveSQLiteFile)
+   else:
+      InputDBConnectionCaliWave = DBConnectionCOOL
+
+## Bad Channel   
+   
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;user=ATLAS_COOL_READER"
+      InputDBConnectionBadChannel = "COOLONL_LAR/COMP200"            
+
+###########################################################################
+# Print summary
+###########################################################################
+
+OFCLog = logging.getLogger( "OFCLog" )
+OFCLog.info( " ======================================================== " )
+OFCLog.info( " ***                 LAr OFC summary                  *** " )
+OFCLog.info( " ======================================================== " )
+OFCLog.info( " RunNumber                          = "+str(RunNumber) )
+if ( ReadAutoCorrFromCOOL ):
+   OFCLog.info( " InputDBConnectionAutoCorr          = "+InputDBConnectionAutoCorr )
+else :
+   OFCLog.info( " InputAutoCorrPoolFileName          = "+InputAutoCorrPoolFileName )
+if 'AutoCorrLArCalibFolderTag' in dir() :   
+   OFCLog.info( " AutoCorrLArCalibFolderTag          = "+AutoCorrLArCalibFolderTag )
+if ( ReadCaliWaveFromCOOL ):
+   OFCLog.info( " InputDBConnectionCaliWave          = "+InputDBConnectionCaliWave )
+else :
+   OFCLog.info( " InputCaliWavePoolFileName          = "+InputCaliWavePoolFileName )
+if ( (ReadAutoCorrFromCOOL or ReadCaliWaveFromCOOL) and ChannelSelection != " " ):
+   OFCLog.info( " ChannelSelection                   = "+ChannelSelection )
+if 'CaliWaveLArCalibFolderTag' in dir() :   
+   OFCLog.info( " CaliWaveLArCalibFolderTag          = "+CaliWaveLArCalibFolderTag )
+OFCLog.info( " OutputOFCRootFullFileName          = "+OutputOFCRootFileDir+"/"+OutputOFCRootFileName )
+OFCLog.info( " OutputOFCPoolFullFileName          = "+OutputOFCPoolFileDir+"/"+OutputOFCPoolFileName )
+OFCLog.info( " OutputShapePoolFileName            = "+OutputShapePoolFileDir+"/"+OutputShapePoolFileName )
+#OFCLog.info( " OutputObjectSpecOFC                = "+str(OutputObjectSpecOFC) )
+OFCLog.info( " OutputObjectSpecTagOFC             = "+str(OutputObjectSpecTagOFC) )
+#OFCLog.info( " OutputObjectSpecShape              = "+str(OutputObjectSpecShape) )
+OFCLog.info( " OutputObjectSpecTagShape           = "+str(OutputObjectSpecTagShape) )
+OFCLog.info( " IOVBegin                           = "+str(IOVBegin) )
+OFCLog.info( " IOVEnd                             = "+str(IOVEnd) )
+OFCLog.info( " LArCalibOutputDB                   = "+OutputDB )
+OFCLog.info( " ======================================================== " )
+###########################################################################
+
+###########################################################################
+#                                                                         #
+#                       Global settings                                   #
+#                                                                         #
+###########################################################################
+
+include( "AthenaCommon/Atlas_Gen.UnixStandardJob.py" )
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+###########################################################################
+#                                                                         #
+#    Input conditions data (AutoCorr, CaliWave) for COOL and/or POOL      #
+#                                                                         #
+###########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+BadChannelsFolder="/LAR/BadChannels/BadChannels"
+MissingFEBsFolder="/LAR/BadChannels/MissingFEBs"
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   OFCLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   OFCLog.info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB
+
+svcMgr.PoolSvc.ReadCatalog += ["xmlcatalog_file:/afs/cern.ch/user/l/larcalib/w0/stableConds/PoolCat_stable.xml",
+                               "prfile:poolcond/PoolCat_oflcond.xml",
+                               "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_diskbuffer_afs.xml",
+                               "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_cond09_data.000001.lar.COND_castor.xml", 
+                               "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_cond08_data.000001.lar.COND_castor.xml"]
+
+
+if ( ReadAutoCorrFromCOOL or ReadCaliWaveFromCOOL ):
+   if not 'InputAutoCorrSQLiteFile' in dir():
+      OFCLog.info( "Read AutoCorr from  Oracle DB" )
+   else :
+      OFCLog.info( "Read AutoCorr from SQLite file" )
+      
+   if not 'InputCaliWaveSQLiteFile'  in dir():
+      OFCLog.info( "Read CaliWave from Oracle DB" )
+   else :
+      OFCLog.info( "Read CaliWave from SQLite file" )
+
+if ( ReadAutoCorrFromCOOL ):
+   AutoCorrFolder  = LArCalib_Flags.LArAutoCorrFolder
+   if 'AutoCorrLArCalibFolderTag' in dir() :
+      AutoCorrTagSpec = LArCalibFolderTag(AutoCorrFolder,AutoCorrLArCalibFolderTag)
+      conddb.addFolder("",AutoCorrFolder+"<tag>"+AutoCorrTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionAutoCorr+"</dbConnection>"+ ChannelSelection)
+   else :
+      conddb.addFolder("",AutoCorrFolder+"<dbConnection>"+InputDBConnectionAutoCorr+"</dbConnection>"+ ChannelSelection)
+else:
+   if 'InputAutoCorrPoolFileName' in dir():
+      OFCLog.info( "Read AutoCorr from POOL file" )
+      PoolFileList += [ InputAutoCorrPoolDir+"/"+InputAutoCorrPoolFileName ]
+   else:
+      OFCLog.info( "No PoolFileList found! Please list the POOL files containing AutoCorrelation Matrix or read from COOL." )
+      theApp.exit(-1)      
+      
+if ( ReadCaliWaveFromCOOL ):
+   if ( not StripsXtalkCorr ):
+      CaliWaveFolder = LArCalib_Flags.LArCaliWaveFolder
+   else:
+      CaliWaveFolder = LArCalib_Flags.LArCaliWaveFolderXtlk
+   if 'CaliWaveLArCalibFolderTag' in dir() :  
+      CaliWaveTagSpec = LArCalibFolderTag(CaliWaveFolder,CaliWaveLArCalibFolderTag)
+      conddb.addFolder("",CaliWaveFolder+"<tag>"+CaliWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionCaliWave+"</dbConnection>" + ChannelSelection)
+   else :
+      conddb.addFolder("",CaliWaveFolder+"<dbConnection>"+InputDBConnectionCaliWave+"</dbConnection>" + ChannelSelection)
+   
+else:
+   if 'InputCaliWavePoolFileName' in dir():
+      OFCLog.info( "Read CaliWave from POOL file" )
+      PoolFileList += [ InputCaliWavePoolDir+"/"+InputCaliWavePoolFileName ]
+   else:
+      OFCLog.info( "No PoolFileList found! Please list the POOL files containing CaliWave or read from COOL." )
+      theApp.exit(-1)
+
+if ( len(PoolFileList)>0 ):   
+
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+   
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+   
+###########################################################################
+#                            OFC computation
+###########################################################################
+
+from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrDecoderTool
+theLArAutoCorrDecoderTool = LArAutoCorrDecoderTool()
+ToolSvc += theLArAutoCorrDecoderTool
+
+from LArCalibUtils.LArCalibUtilsConf import LArOFCAlg
+if ( AllWavesPerCh ) :
+   LArCaliOFCAlgVec = []
+   for i in range(0, MaxCalLinePerCh):
+       topSequence+=LArOFCAlg("LArCaliOFCAlg"+str(i+1))
+       exec 'LArCaliOFCAlgVec.append( topSequence.LArCaliOFCAlg%(fn)s )' % {'fn' :i+1}
+
+       LArCaliOFCAlgVec[i].ReadCaliWave = True
+       LArCaliOFCAlgVec[i].KeyList   = [ ContainerKeySplitted[i] ]
+       LArCaliOFCAlgVec[i].Nphase    = Nphases
+       LArCaliOFCAlgVec[i].Dphase    = Dphases
+       LArCaliOFCAlgVec[i].Ndelay    = Ndelays
+       LArCaliOFCAlgVec[i].Nsample   = Nsamples
+       LArCaliOFCAlgVec[i].Normalize = Normalize
+       LArCaliOFCAlgVec[i].TimeShift = TimeShift
+       LArCaliOFCAlgVec[i].TimeShiftByIndex = TimeShiftByIndex
+       LArCaliOFCAlgVec[i].Verify    = True
+       LArCaliOFCAlgVec[i].KeyOFC = OFCKeySplitted[i]   # this is also the key for the output LArOFCComplete
+       LArCaliOFCAlgVec[i].FillShape = FillShape
+       LArCaliOFCAlgVec[i].KeyShape  = ShapeKeySplitted[i] # this is the key for the output LArShapeComplete
+       if ( DumpOFC ) :
+            LArCaliOFCAlgVec[i].DumpOFCfile = "LArOFCCali"+str(i+1)+".dat"
+       LArCaliOFCAlgVec[i].GroupingType = GroupingType
+       LArCaliOFCAlgVec[i].DecoderTool=theLArAutoCorrDecoderTool     
+
+else:
+   LArCaliOFCAlg = LArOFCAlg("LArCaliOFCAlg")
+   LArCaliOFCAlg.ReadCaliWave = True
+   LArCaliOFCAlg.KeyList   = [ ContainerKey ]
+   LArCaliOFCAlg.Nphase    = Nphases
+   LArCaliOFCAlg.Dphase    = Dphases
+   LArCaliOFCAlg.Ndelay    = Ndelays
+   LArCaliOFCAlg.Nsample   = Nsamples
+   LArCaliOFCAlg.Normalize = Normalize
+   LArCaliOFCAlg.TimeShift = TimeShift
+   LArCaliOFCAlg.TimeShiftByIndex = TimeShiftByIndex
+   LArCaliOFCAlg.Verify    = True
+   LArCaliOFCAlg.FillShape = FillShape
+   if ( DumpOFC ) :
+      LArCaliOFCAlg.DumpOFCfile = "LArOFCCali.dat"
+   LArCaliOFCAlg.GroupingType = GroupingType
+   LArCaliOFCAlg.DecoderTool=theLArAutoCorrDecoderTool   
+   topSequence+=LArCaliOFCAlg
+
+
+###########################################################################
+
+if ( WriteNtuple ) :
+
+   from LArCalibTools.LArCalibToolsConf import LArOFC2Ntuple
+   if ( AllWavesPerCh ) :
+        LArOFC2NtupleVec = []
+        for i in range(0, MaxCalLinePerCh):
+           topSequence += LArOFC2Ntuple("LArOFC2Ntuple"+str(i+1))
+           exec 'LArOFC2NtupleVec.append( topSequence.LArOFC2Ntuple%(fn)s )' % {'fn': i+1}
+           LArOFC2NtupleVec[i].ContainerKey = OFCKeySplitted[i]
+           LArOFC2NtupleVec[i].NtupleName   = "OFC"+str(i+1)
+   else:   
+        LArOFC2Ntuple = LArOFC2Ntuple("LArOFC2Ntuple")
+        LArOFC2Ntuple.ContainerKey = OFCKey 	   
+        topSequence+=LArOFC2Ntuple
+
+   if ( FillShape ):
+      from LArCalibTools.LArCalibToolsConf import LArShape2Ntuple
+      if ( AllWavesPerCh ) :
+           LArOFC2NtupleVec = []
+           for i in range(0, MaxCalLinePerCh):
+              topSequence += LArShape2Ntuple("LArOFC2Ntuple"+str(i+1))
+              exec 'LArShape2NtupleVec.append( topSequence.LArShape2Ntuple%(fn)s )' % {'fn': i+1}
+              LArShape2NtupleVec[i].ContainerKey = ShapeKeySplitted[i]
+              LArShape2NtupleVec[i].NtupleName   = "SHAPE"+str(i+1)
+      else:   
+           LArShape2Ntuple = LArShape2Ntuple("LArShape2Ntuple")
+           LArShape2Ntuple.ContainerKey = ShapeKey 	   
+           topSequence+=LArShape2Ntuple
+   
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputOFCRootFileDir+"/"+OutputOFCRootFileName): 
+      os.remove(OutputOFCRootFileDir+"/"+OutputOFCRootFileName)  
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputOFCRootFileDir+"/"+OutputOFCRootFileName+"' OPT='NEW'" ]
+   
+if (  WritePoolFile ) :
+    
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+
+   if os.path.exists(OutputOFCPoolFileDir+"/"+OutputOFCPoolFileName): 
+      os.remove(OutputOFCPoolFileDir+"/"+OutputOFCPoolFileName)  
+   OutputConditionsAlgOFC = OutputConditionsAlg("OutputConditionsAlgOFC",OutputOFCPoolFileDir+"/"+OutputOFCPoolFileName,
+                                                OutputObjectSpecOFC,[OutputObjectSpecTagOFC],WriteIOV)
+   OutputConditionsAlgOFC.Run1     = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlgOFC.Run2  = IOVEnd
+   
+   if ( FillShape ):
+      
+      if os.path.exists(OutputShapePoolFileDir+"/"+OutputShapePoolFileName): 
+         os.remove(OutputShapePoolFileDir+"/"+OutputShapePoolFileName) 
+      OutputConditionsAlgShape = OutputConditionsAlg("OutputConditionsAlgShape",OutputShapePoolFileDir+"/"+OutputShapePoolFileName,
+                                                     OutputObjectSpecShape,[OutputObjectSpecTagShape],WriteIOV)
+      OutputConditionsAlgShape.Run1     = IOVBegin
+      if IOVEnd>0:
+         OutputConditionsAlgShape.Run2  = IOVEnd
+
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+   
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+   
+###########################################################################
+#               Use EventSelector to select IOV                           #
+###########################################################################	
+
+from McEventSelector.McEventSelectorConf import McEventSelector
+svcMgr += McEventSelector("EventSelector")
+svcMgr.EventSelector.RunNumber	= int(RunNumber)
+svcMgr.EventSelector.EventsPerRun      = 1
+svcMgr.EventSelector.FirstEvent	= 1
+svcMgr.EventSelector.InitialTimeStamp  = 0
+svcMgr.EventSelector.TimeStampInterval = 1
+
+##########################################################################
+#          don't remove otherwise infinite loop                          #
+##########################################################################
+
+theApp.EvtMax = 1
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = VERBOSE)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = DEBUG)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
+
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_TwoFolders_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_TwoFolders_jobOptions.py
new file mode 100644
index 00000000000..1413bff03b0
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_TwoFolders_jobOptions.py
@@ -0,0 +1,797 @@
+import commands
+
+###########################################################################
+#
+# <Marco.Delmastro@cern.ch>
+#
+# jobOptions to compute OFC phys in all gains for two different DeltaPhase
+# settings, ad store the objects in parallel folders.
+#
+# Last update: 04/12/2009 <Marco.Delmastro@cern.ch>
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+
+###########################################################################
+#             PhysWaveShifter properties                                  #
+###########################################################################
+
+if not "UseDelta" in dir():
+   UseDelta=0
+
+if not "NColl" in dir():
+   NColl=0
+
+if not 'doPhysWaveShifter' in dir():
+   doPhysWaveShifter = True 
+
+if not 'InputKey' in dir():   
+   if (doPhysWaveShifter) :
+      InputKey = "LArPhysWaveUnShifted"
+   else :
+      InputKey = "LArPhysWave"  # no shift applied to the PhysWave   
+
+if not 'isFCAL' in dir() :
+   isFCAL = False
+
+if not 'InputKey' in dir():
+   InputKey = "LArPhysWaveUnShifted"
+
+if not 'ShiftMode' in dir():
+   ShiftMode = 3  # 1 = minimum Tstart from helper in FEB
+                  # 2 = minumum Tpeak-NindexFromPeak in FEB
+                  # 3 = average Tpeak-NindexFromPeak in FEB
+                  
+if not 'Nsamplings' in dir():
+   Nsamplings = 2
+
+if not 'TimeShiftGuardRegion' in dir():
+   TimeShiftGuardRegion = 12
+
+if not 'UsePhysCaliTdiff' in dir():
+   UsePhysCaliTdiff = True
+
+if not 'PhysCaliTdiffKey' in dir():
+   PhysCaliTdiffKey = "LArPhysCaliTdiff"
+
+###########################################################################
+#               Input selection (Autocorr, PhysWave)
+###########################################################################
+
+# RunNumber trigger IOV if reading from COOL is eneabled
+if not 'RunNumber' in dir():
+   RunNumber = '0000000'
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"  
+
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"
+
+## AutoCorr      
+
+if not 'ReadAutoCorrFromCOOL' in dir():
+   ReadAutoCorrFromCOOL = True
+
+if not 'InputAutoCorrPoolDir' in dir():
+   InputAutoCorrPoolDir = commands.getoutput("pwd")
+
+if not 'InputAutoCorrPoolFileName' in dir():
+   InputAutoCorrPoolFileName = "LArAutoCorr.pool.root"
+
+## PhysWave
+
+if not 'ReadPhysWaveFromCOOL' in dir():
+   ReadPhysWaveFromCOOL = True
+
+if not 'InputPhysWavePoolDir' in dir():
+   InputPhysWavePoolDir = commands.getoutput("pwd")
+
+if not 'InputPhysWavePoolFileName' in dir():
+   InputPhysWavePoolFileName = "LArPhysWave.pool.root"  
+
+## PhysCaliTdiff
+
+if not 'ReadPhysCaliTdiffFromCOOL' in dir():
+   ReadPhysCaliTdiffFromCOOL = True
+
+if not 'InputPhysCaliTdiffPoolDir' in dir():
+   InputPhysCaliTdiffPoolDir = commands.getoutput("pwd")
+
+if not 'InputPhysCaliTdiffPoolFileName' in dir():
+   InputPhysCaliTdiffPoolFileName = "LArPhysCaliTdiff.pool.root"
+
+if not 'ChannelSelection' in dir():
+   # Read all
+   ChannelSelection = " "
+   ## Example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,35:66</channelSelection>" 
+
+from string import *
+def DBConnectionFile(sqlitefile):
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+###########################################################################
+# OFC properties (2 instances)
+###########################################################################
+
+if not 'ContainerKey' in dir():
+   ContainerKey = "LArPhysWave"
+
+if not 'Normalize' in dir():
+   Normalize = True
+
+#
+# First instance
+#
+
+if not 'TimeShift' in dir() :
+   TimeShift = False
+
+if not 'TimeShiftByIndex' in dir() :
+   TimeShiftByIndex = -1
+
+if not 'Nsamples' in dir():
+   Nsamples = 5
+
+if not 'Nphases' in dir():
+   Nphases = 8
+
+if not 'Dphases' in dir():
+   Dphases = 3
+   
+if not 'Ndelays' in dir():
+   Ndelays = 24
+   
+if not 'OFCKey' in dir():
+   OFCKey = "LArOFC"
+
+if not 'ShapeKey' in dir():
+   ShapeKey = "LArShape"
+
+
+if not 'ShiftKey' in dir():
+   ShiftKey="LArPhysWaveShift"
+
+if not 'FillShape' in dir():
+   FillShape = True
+
+if not 'OFCTreename' in dir():
+   OFCTreename = "OFC"
+
+if not 'ShapeTreename' in dir():
+   ShapeTreename = "Shape"
+
+#
+# Second instance
+#
+
+if not 'TimeShift2' in dir() :
+   TimeShift2 = False
+
+if not 'TimeShiftByIndex2' in dir() :
+   TimeShiftByIndex2 = -1
+
+if not 'Nsamples2' in dir():
+   Nsamples2 = 5
+
+if not 'Nphases2' in dir():
+   Nphases2 = 24
+
+if not 'Dphases2' in dir():
+   Dphases2 = 1
+   
+if not 'Ndelays2' in dir():
+   Ndelays2 = 24
+   
+if not 'OFCKey2' in dir():
+   OFCKey2 = "LArOFC_2"
+
+if not 'ShapeKey2' in dir():
+   ShapeKey2 = "LArShape_2"
+
+if not 'FillShape2' in dir():
+   FillShape2 = True
+
+if not 'OFCTreename2' in dir():
+   OFCTreename2 = "OFC2"
+
+if not 'ShapeTreename2' in dir():
+   ShapeTreename2 = "Shape2"
+
+###########################################################################
+# OFC output
+###########################################################################
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+   
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumber)
+
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd   
+
+if not 'OutputOFCRootFileDir' in dir():
+   OutputOFCRootFileDir = commands.getoutput("pwd")
+   
+if not 'OutputPoolFileDir' in dir():
+   OutputPoolFileDir = commands.getoutput("pwd")
+
+OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","")
+OFCFileTag += "_"+str(Nsamples)+"samples"
+
+#if (Dphases>1):
+#   OFCFileTag += "_"+str(Dphases)+"Dphase"
+
+if not 'OutputOFCRootFileName' in dir():
+   OutputOFCRootFileName = "LArOFCPhys_"+OFCFileTag + ".root"
+   
+if not 'OutputPoolFileName' in dir():
+   OutputPoolFileName = "LArOFCShapePhys_"+OFCFileTag + ".pool.root"
+
+
+#input folders:
+if "AutoCorrFolder" not in dir():
+   AutoCorrFolder  = LArCalib_Flags.LArAutoCorrFolder
+if "PhysCaliTdiffFolder" not in dir():
+   PhysCaliTdiffFolder  = LArCalib_Flags.LArPhysCaliTdiffFolder
+
+if isFCAL:
+   PhysWaveFolderFCAL="/LAR/ElecCalibOfl/PhysWaves/FCALFromTB"
+else:
+   PhysWaveFolder  = LArCalib_Flags.LArPhysWaveFolder
+
+
+#Shift (can be output or input)
+if "OFCBinFolder" not in dir():
+   OFCBinFolder="/LAR/ElecCalibOfl/OFCBin/PhysWaveShifts"
+
+
+#output Folders:
+if "FolderOFC" not in dir():
+   FolderOFC   = "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples3bins17phases"
+
+if "FolderShape" not in dir():
+   FolderShape = "/LAR/ElecCalibOfl/Shape/RTM/5samples3bins17phases"
+
+if "FolderOFC2" not in dir():
+   FolderOFC2   = "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples"
+
+if "FolderShape2" not in dir():
+   FolderShape2 = "/LAR/ElecCalibOfl/Shape/RTM/5samples"
+
+
+rs=FolderTagResover()
+if not 'AutoCorrLArCalibFolderTag' in dir():
+   AutoCorrLArCalibFolderTag=rs.getFolderTagSuffix(AutoCorrFolder)
+
+if not 'PhysWaveLArCalibFolderTag' in dir():
+   if isFCAL:
+      PhysWaveLArCalibFolderTag=rs.getFolderTagSuffix(PhysWaveFolderFCAL)
+   else:
+      PhysWaveLArCalibFolderTag=rs.getFolderTagSuffix(PhysWaveFolder)
+
+if not 'PhysCaliTdiffLArCalibFolderTag' in dir():
+   PhysCaliTdiffLArCalibFolderTag=rs.getFolderTagSuffix(PhysCaliTdiffFolder)
+
+if not 'OFCBinFolderTag' in dir():
+   OFCBinFolderTag=rs.getFolderTagSuffix(OFCBinFolder)
+
+
+#output Folders:
+if "FolderTagOFC" not in dir():
+   if "PhysicsAutoCorr" in AutoCorrFolder:
+      FolderTagOFC   = "-mu-"+str(NColl)+rs.getFolderTagSuffix(FolderOFC)
+   else:
+      FolderTagOFC   = rs.getFolderTagSuffix(FolderOFC)
+
+if "FolderTagShape" not in dir():
+   FolderTagShape = rs.getFolderTagSuffix(FolderShape)
+
+if "FolderTagOFC2" not in dir():
+   if "PhysicsAutoCorr" in AutoCorrFolder:
+      FolderTagOFC2   = "-mu-"+str(NColl)+rs.getFolderTagSuffix(FolderOFC)
+   else:
+      FolderTagOFC2   = rs.getFolderTagSuffix(FolderOFC2)
+
+if "FolderTagShape2" not in dir():
+   FolderTagShape2 = rs.getFolderTagSuffix(FolderShape2)
+
+
+del rs #close Database
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)
+
+
+OutputObjectSpecOFC    = "LArOFCComplete#"+OFCKey+"#"+ FolderOFC
+OutputObjectSpecTagOFC = LArCalibFolderTag(FolderOFC,FolderTagOFC)
+						
+OutputObjectSpecShape = "LArShapeComplete#"+ShapeKey+"#"+ FolderShape
+OutputObjectSpecTagShape  = LArCalibFolderTag(FolderShape,FolderTagShape)
+
+OutputObjectSpecOFC2    = "LArOFCComplete#"+OFCKey2+"#"+ FolderOFC2
+OutputObjectSpecTagOFC2 = LArCalibFolderTag(FolderOFC2,FolderTagOFC2)
+						
+OutputObjectSpecShape2 = "LArShapeComplete#"+ShapeKey2+"#"+ FolderShape2
+OutputObjectSpecTagShape2  = LArCalibFolderTag(FolderShape2,FolderTagShape2)
+
+OutputObjectSpecOFCBin="LArOFCBinComplete#"+ShiftKey+"#"+OFCBinFolder
+OutputObjectSpecTagOFCBin = LArCalibFolderTag(OFCBinFolder,OFCBinFolderTag)
+
+
+if not 'DBConnectionCOOL' in dir():
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"
+
+if ( ReadAutoCorrFromCOOL ):      
+   if 'InputAutoCorrSQLiteFile' in dir():
+      InputDBConnectionAutoCorr = DBConnectionFile(InputAutoCorrSQLiteFile)
+   else:
+      InputDBConnectionAutoCorr = DBConnectionCOOL
+
+if ( ReadPhysWaveFromCOOL ):      
+   if 'InputPhysWaveSQLiteFile' in dir():
+      InputDBConnectionPhysWave = DBConnectionFile(InputPhysWaveSQLiteFile)
+   else:
+      InputDBConnectionPhysWave = DBConnectionCOOL
+
+if ( ReadPhysCaliTdiffFromCOOL ):
+   if 'InputPhysCaliTdiffSQLiteFile' in dir():
+      InputDBConnectionPhysCaliTdiff = DBConnectionFile(InputPhysCaliTdiffSQLiteFile)
+   else:
+      InputDBConnectionPhysCaliTdiff = DBConnectionCOOL
+
+## Bad Channel   
+   
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;"
+      InputDBConnectionBadChannel = "COOLOFL_LAR/COMP200"        
+      
+###########################################################################
+# Print summary
+###########################################################################
+
+OFCLog = logging.getLogger( "OFCLog" )
+OFCLog.info( " ======================================================== " )
+OFCLog.info( " ***                 LAr OFC summary                  *** " )
+OFCLog.info( " ======================================================== " )
+OFCLog.info( " RunNumber                          = "+str(RunNumber) )
+if ( ReadAutoCorrFromCOOL ):
+   OFCLog.info( " InputDBConnectionAutoCorr          = "+InputDBConnectionAutoCorr )
+   OFCLog.info( " AutoCorrLArCalibFolderTag             = "+AutoCorrLArCalibFolderTag)
+else :
+   OFCLog.info( " InputAutoCorrPoolFileName          = "+InputAutoCorrPoolDir+"/"+InputAutoCorrPoolFileName )
+   
+
+if ( ReadPhysWaveFromCOOL ):
+   OFCLog.info( " InputDBConnectionPhysWave          = "+InputDBConnectionPhysWave )
+   OFCLog.info( " PhysWaveLArCalibFolderTag          =" +PhysWaveLArCalibFolderTag )
+else :
+   OFCLog.info( " InputPhysWavePoolFileName          = "+InputPhysWavePoolDir+"/"+InputPhysWavePoolFileName )
+   
+if ( (ReadAutoCorrFromCOOL or ReadPhysWaveFromCOOL) and ChannelSelection != " " ):
+   OFCLog.info( " ChannelSelection                   = "+ChannelSelection )
+   
+if ( ReadPhysCaliTdiffFromCOOL ):
+   OFCLog.info( " InputDBConnectionPhysCaliTdiff     = "+InputDBConnectionPhysCaliTdiff )
+   OFCLog.info( " PhysCaliTdiffLArCalibFolderTag     = "+PhysCaliTdiffLArCalibFolderTag )
+else :
+   OFCLog.info( " InputPhysCaliTdiffPoolFileName     = "+InputPhysCaliTdiffPoolDir+"/"+InputPhysCaliTdiffPoolFileName )                                                      
+OFCLog.info( " OutputOFCRootFullFileName          = "+OutputOFCRootFileDir+"/"+OutputOFCRootFileName )
+OFCLog.info( " OutputPoolFullFileName             = "+OutputPoolFileDir+"/"+OutputPoolFileName )
+OFCLog.info( " OutputObjectSpecOFC                = "+str(OutputObjectSpecOFC) )
+OFCLog.info( " OutputObjectSpecTagOFC             = "+str(OutputObjectSpecTagOFC) )
+OFCLog.info( " OutputObjectSpecShape              = "+str(OutputObjectSpecShape) )
+OFCLog.info( " OutputObjectSpecTagShape           = "+str(OutputObjectSpecTagShape) )
+OFCLog.info( " OutputObjectSpecOFC2               = "+str(OutputObjectSpecOFC2) )
+OFCLog.info( " OutputObjectSpecTagOFC2            = "+str(OutputObjectSpecTagOFC2) )
+OFCLog.info( " OutputObjectSpecShape2             = "+str(OutputObjectSpecShape2) )
+OFCLog.info( " OutputObjectSpecTagShape2          = "+str(OutputObjectSpecTagShape2) )
+OFCLog.info( " OutputObjectSpecOFCBin             = "+str(OutputObjectSpecOFCBin) )
+OFCLog.info( " OutputObjectSpecTagOFCBin          = "+str(OutputObjectSpecTagOFCBin) )
+OFCLog.info( " IOVBegin                           = "+str(IOVBegin) )
+OFCLog.info( " IOVEnd                             = "+str(IOVEnd) )
+OFCLog.info( " LArCalibOutputDB                   = "+OutputDB )
+OFCLog.info( " ======================================================== " )
+
+###########################################################################
+#
+# Global settings
+#
+###########################################################################
+
+include("AthenaCommon/Atlas_Gen.UnixStandardJob.py")
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+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')
+
+from AthenaCommon.JobProperties import jobproperties
+jobproperties.Global.DetDescrVersion = "ATLAS-GEO-16-00-00"
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.Calo_setOn()  #Switched off to avoid geometry
+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" )
+
+###########################################################################
+#                                                                         #
+#    Input conditions data (AutoCorr, CaliWave) for COOL and/or POOL      #
+#                                                                         #
+###########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+include ("LArCalibProcessing/LArCalib_BadChanTool.py")
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   OFCLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   OFCLog.info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB   
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+if ( ReadAutoCorrFromCOOL or ReadPhysWaveFromCOOL ):
+   if not ('InputAutoCorrSQLiteFile')  in dir():
+      OFCLog.info( "Read AutoCorr from Oracle" )
+   else :
+      OFCLog.info( "Read AutoCorr from SQLite file" )
+      
+   if not ('InputPhysWaveSQLiteFile')  in dir():
+      OFCLog.info( "Read PhysWave from Oracle DB" )
+   else :
+      OFCLog.info( "Read PhysWave from SQLite file" )
+      
+if ( ReadAutoCorrFromCOOL ):
+   if "PhysicsAutoCorr" in AutoCorrFolder:
+      AutoCorrTagSpec= LArCalibFolderTag(AutoCorrFolder,"-mu-"+str(NColl)+AutoCorrLArCalibFolderTag)
+   else: 
+      AutoCorrTagSpec= LArCalibFolderTag(AutoCorrFolder,AutoCorrLArCalibFolderTag)
+   conddb.addFolder("",AutoCorrFolder+"<tag>"+AutoCorrTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionAutoCorr+"</dbConnection>"+ ChannelSelection)
+else:
+   if 'InputAutoCorrPoolFileName' in dir():
+      OFCLog.info( "Read AutoCorr from POOL file")
+      PoolFileList += [ InputAutoCorrPoolDir+"/"+InputAutoCorrPoolFileName ]
+   else:
+      OFCLog.info( "No PoolFileList found! Please list the POOL files containing AutoCorrelation Matrix or read from COOL." )
+      theApp.exit(-1)      
+      
+if ( ReadPhysWaveFromCOOL ):
+   if (doPhysWaveShifter or isFCAL) :
+      if isFCAL:
+         PhysWaveTagSpec = LArCalibFolderTag(PhysWaveFolderFCAL,PhysWaveLArCalibFolderTag)
+      else:
+         PhysWaveTagSpec = LArCalibFolderTag(PhysWaveFolder,PhysWaveLArCalibFolderTag)
+      if isFCAL:   
+         conddb.addFolder("",PhysWaveFolderFCAL+"<key>"+InputKey+"</key><tag>"+PhysWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPhysWave+"</dbConnection>" + ChannelSelection)
+      else:   
+         conddb.addFolder("",PhysWaveFolder+"<key>"+InputKey+"</key><tag>"+PhysWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPhysWave+"</dbConnection>" + ChannelSelection)
+   else :
+      PhysWaveTagSpec = LArCalibFolderTag(PhysWaveFolder,PhysWaveLArCalibFolderTag)
+      conddb.addFolder("",PhysWaveFolder+"<tag>"+PhysWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPhysWave+"</dbConnection>" + ChannelSelection) 
+else:
+   if 'InputPhysWavePoolFileName' in dir():
+      OFCLog.info( "Read PhysWave from POOL file" )
+      PoolFileList += [ InputPhysWavePoolDir+"/"+InputPhysWavePoolFileName ]
+   else:
+      OFCLog.info( "No PoolFileList found! Please list the POOL files containing PhysWave or read from COOL." )
+      theApp.exit(-1)
+
+if (UsePhysCaliTdiff):
+   if ( ReadPhysCaliTdiffFromCOOL ):
+         PhysCaliTdiffTagSpec = LArCalibFolderTag(PhysCaliTdiffFolder,PhysCaliTdiffLArCalibFolderTag)
+         conddb.addFolder("",PhysCaliTdiffFolder+"<key>"+PhysCaliTdiffKey+"</key><tag>"+PhysCaliTdiffTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPhysCaliTdiff+"</dbConnection>" + ChannelSelection)
+   else: 
+      if 'InputPhysCaliTdiffPoolFileName' in dir():
+         OFCLog.info( "Read PhysCaliTdiff from POOL file" )
+         PoolFileList += [ InputPhysCaliTdiffPoolDir+"/"+InputPhysCaliTdiffPoolFileName ]
+      else:
+         OFCLog.info( "No PoolFileList found! Please list the POOL files containing PhysCaliTdiff or read from COOL." )
+         theApp.exit(-1)
+
+if ( len(PoolFileList)>0 ):
+
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+
+if (doPhysWaveShifter) :
+
+   ###########################################################################
+   #                                                                         #
+   #                 Shift physics waveforms only for FCAL                   #
+   #                                                                         # 
+   ###########################################################################
+   from LArCalibUtils.LArCalibUtilsConf import LArPhysWaveShifter
+   LArPhysWaveShifter                        = LArPhysWaveShifter("LArPhysWaveShifter")
+   
+   LArPhysWaveShifter.KeyList                = [ InputKey ]
+   LArPhysWaveShifter.KeyOutput              = ContainerKey
+   LArPhysWaveShifter.GroupingType           = GroupingType
+   
+   #
+   # Minimum Tstart per FEB computation
+   #
+   LArPhysWaveShifter.ComputeTimeShiftByFEB  = True
+   LArPhysWaveShifter.TimeShiftByFEBMode     = ShiftMode
+   LArPhysWaveShifter.TimeShiftByFEBDump     = True
+   LArPhysWaveShifter.TimeShiftByFEBDumpFile = "TimeShiftFEB.py"
+
+   #
+   # Possible time shifts
+   #
+   LArPhysWaveShifter.TimeShiftByHelper      = False
+   LArPhysWaveShifter.TimeShiftByIndex       = 0
+   LArPhysWaveShifter.TimeShiftFromPeak      = False
+   LArPhysWaveShifter.NindexFromPeak         = 0 # if 0 will use Ndelays*Nsampling
+   LArPhysWaveShifter.Ndelays                = 24
+   LArPhysWaveShifter.Nsamplings             = Nsamplings 
+   LArPhysWaveShifter.TimeShiftByFEB         = True
+   LArPhysWaveShifter.TimeShiftGuardRegion   = TimeShiftGuardRegion
+   LArPhysWaveShifter.UsePhysCaliTdiff       = UsePhysCaliTdiff
+   LArPhysWaveShifter.CellByCellShiftsKey    = "LArPhysCaliTdiff"
+   LArPhysWaveShifter.OutputShiftsKey        = ShiftKey
+   topSequence += LArPhysWaveShifter   
+
+else:
+   #Load Shifts from DB:
+   conddb.addFolder("LAR_OFL",OFCBinFolder+"<tag>"+OutputObjectSpecTagOFCBin+"</tag><key>"+ShiftKey+"</key>");
+
+
+###########################################################################
+#                      OFC computation
+###########################################################################
+
+from LArCalibUtils.LArCalibUtilsConf import LArOFCAlg
+
+LArPhysOFCAlg = LArOFCAlg("LArPhysOFCAlg")
+
+LArPhysOFCAlg.ReadCaliWave = False
+LArPhysOFCAlg.KeyList      = [ InputKey ]
+LArPhysOFCAlg.Normalize    = Normalize
+LArPhysOFCAlg.Verify       = True
+LArPhysOFCAlg.GroupingType = GroupingType
+
+LArPhysOFCAlg.Nphase    = Nphases
+LArPhysOFCAlg.Dphase    = Dphases
+LArPhysOFCAlg.Ndelay    = Ndelays
+LArPhysOFCAlg.Nsample   = Nsamples
+LArPhysOFCAlg.FillShape = FillShape
+LArPhysOFCAlg.TimeShift = TimeShift
+LArPhysOFCAlg.TimeShiftByIndex = TimeShiftByIndex
+LArPhysOFCAlg.AddTimeOffset = -1.0*TimeShiftGuardRegion
+LArPhysOFCAlg.LArPhysWaveBinKey = ShiftKey
+
+LArPhysOFCAlg.UseDelta = UseDelta
+LArPhysOFCAlg.KeyOFC   = OFCKey
+LArPhysOFCAlg.KeyShape = ShapeKey
+
+
+topSequence+=LArPhysOFCAlg
+
+LArPhysOFCAlg2 = LArOFCAlg("LArPhysOFCAlg2")
+
+LArPhysOFCAlg2.ReadCaliWave = False
+LArPhysOFCAlg2.KeyList      = [ InputKey ]
+LArPhysOFCAlg2.Normalize    = Normalize
+LArPhysOFCAlg2.Verify       = True
+LArPhysOFCAlg2.GroupingType = GroupingType
+
+LArPhysOFCAlg2.Nphase    = Nphases2
+LArPhysOFCAlg2.Dphase    = Dphases2
+LArPhysOFCAlg2.Ndelay    = Ndelays2
+LArPhysOFCAlg2.Nsample   = Nsamples2
+LArPhysOFCAlg2.FillShape = FillShape2
+LArPhysOFCAlg2.TimeShift = TimeShift2
+LArPhysOFCAlg2.TimeShiftByIndex = TimeShiftByIndex2
+LArPhysOFCAlg2.AddTimeOffset = -1.0*TimeShiftGuardRegion
+LArPhysOFCAlg2.LArPhysWaveBinKey = ShiftKey
+LArPhysOFCAlg2.UseDelta = UseDelta
+
+LArPhysOFCAlg2.KeyOFC   = OFCKey2
+LArPhysOFCAlg2.KeyShape = ShapeKey2
+
+topSequence+=LArPhysOFCAlg2
+
+from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrDecoderTool
+theLArAutoCorrDecoderTool = LArAutoCorrDecoderTool()
+if NColl > 0:
+   theLArAutoCorrDecoderTool.DecodeMode=1
+ToolSvc += theLArAutoCorrDecoderTool
+
+###########################################################################
+
+if ( WriteNtuple ) :
+
+   from LArCalibTools.LArCalibToolsConf import LArOFC2Ntuple 
+   
+   LArOFC2Ntuple1 = LArOFC2Ntuple("LArOFC2Ntuple1")
+   LArOFC2Ntuple1.ContainerKey = OFCKey
+   LArOFC2Ntuple1.NtupleName   = OFCTreeName	   
+   LArOFC2Ntuple1.AddFEBTempInfo   = False   
+   topSequence+=LArOFC2Ntuple1
+
+   LArOFC2Ntuple2 = LArOFC2Ntuple("LArOFC2Ntuple2")
+   LArOFC2Ntuple2.ContainerKey = OFCKey2
+   LArOFC2Ntuple2.NtupleName   = OFCTreeName2 	   
+   LArOFC2Ntuple2.AddFEBTempInfo   = False 	   
+   topSequence+=LArOFC2Ntuple2
+
+   if ( FillShape ):
+
+      from LArCalibTools.LArCalibToolsConf import LArShape2Ntuple
+
+      LArShape2Ntuple1 = LArShape2Ntuple("LArShape2Ntuple1")
+      LArShape2Ntuple1.ContainerKey = ShapeKey
+      LArShape2Ntuple1.NtupleName   = ShapeTreeName
+      LArShape2Ntuple1.AddFEBTempInfo   = False
+      topSequence+=LArShape2Ntuple1
+
+      LArShape2Ntuple2 = LArShape2Ntuple("LArShape2Ntuple2")
+      LArShape2Ntuple2.ContainerKey = ShapeKey2 	   
+      LArShape2Ntuple2.NtupleName   = ShapeTreeName2
+      LArShape2Ntuple2.AddFEBTempInfo   = False
+      topSequence+=LArShape2Ntuple2
+
+
+   if ( doPhysWaveShifter ):
+      from LArCalibTools.LArCalibToolsConf import LArFebTimeOffset2Ntuple
+      LArFebTimeOffset2Ntuple                = LArFebTimeOffset2Ntuple( "LArFebTimeOffset2Ntuple" )
+      LArFebTimeOffset2Ntuple.ContainerKey   = "FebTimeOffset"
+      LArFebTimeOffset2Ntuple.AddFEBTempInfo   = False
+
+      topSequence+=LArFebTimeOffset2Ntuple
+
+      from LArCalibTools.LArCalibToolsConf import LArWFParams2Ntuple
+      LArWFParams2Ntuple=LArWFParams2Ntuple("LArWFParams2Ntuple")
+      LArWFParams2Ntuple.DumpOFCBin=True
+      LArWFParams2Ntuple.AddFEBTempInfo   = False
+      LArWFParams2Ntuple.OFCBinKey  =ShiftKey
+      topSequence+=LArWFParams2Ntuple
+      
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputOFCRootFileDir+"/"+OutputOFCRootFileName): 
+      os.remove(OutputOFCRootFileDir+"/"+OutputOFCRootFileName)
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputOFCRootFileDir+"/"+OutputOFCRootFileName+"' OPT='NEW'" ]
+   
+if (  WritePoolFile ) :
+   
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   if os.path.exists(OutputPoolFileDir+"/"+OutputPoolFileName): 
+      os.remove(OutputPoolFileDir+"/"+OutputPoolFileName)
+      
+   OutputConditionsAlg = OutputConditionsAlg("OutputConditionsAlg",OutputPoolFileDir+"/"+OutputPoolFileName,
+                                             [OutputObjectSpecOFC],[OutputObjectSpecTagOFC],WriteIOV)
+   OutputConditionsAlg.Run1     = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlg.Run2  = IOVEnd
+      
+   OutputConditionsAlg.ObjectList += [OutputObjectSpecOFC2]
+   OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagOFC2]
+	
+   if ( FillShape ):
+      OutputConditionsAlg.ObjectList += [OutputObjectSpecShape]
+      OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagShape]
+      OutputConditionsAlg.ObjectList += [OutputObjectSpecShape2]
+      OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagShape2]
+
+   if ( doPhysWaveShifter):
+      OutputConditionsAlg.ObjectList += [OutputObjectSpecOFCBin]
+      OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagOFCBin]
+
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+   
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+  		
+###########################################################################
+#               Use EventSelector to select IOV                           #
+###########################################################################	
+
+from McEventSelector.McEventSelectorConf import McEventSelector
+svcMgr += McEventSelector("EventSelector")
+svcMgr.EventSelector.RunNumber	= int(RunNumber)
+svcMgr.EventSelector.EventsPerRun      = 1
+svcMgr.EventSelector.FirstEvent	= 1
+svcMgr.EventSelector.InitialTimeStamp  = 0
+svcMgr.EventSelector.TimeStampInterval = 1
+
+##########################################################################
+#          don't remove otherwise infinite loop                          #
+##########################################################################
+
+theApp.EvtMax = 1
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = VERBOSE)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = DEBUG)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_WithPileup_TwoFolders_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_WithPileup_TwoFolders_jobOptions.py
new file mode 100644
index 00000000000..17564c71fe6
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_WithPileup_TwoFolders_jobOptions.py
@@ -0,0 +1,880 @@
+import commands
+
+###########################################################################
+#
+# <Marco.Delmastro@cern.ch>
+#
+# jobOptions to compute OFC phys in all gains for two different DeltaPhase
+# settings, ad store the objects in parallel folders.
+#
+# Last update: 04/12/2009 <Marco.Delmastro@cern.ch>
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+
+###########################################################################
+#             PhysWaveShifter properties                                  #
+###########################################################################
+
+if not "UseDelta" in dir():
+   UseDelta=0
+
+if not "NColl" in dir():
+   NColl=0
+
+if not 'doPhysWaveShifter' in dir():
+   doPhysWaveShifter = True 
+
+if not 'InputKey' in dir():   
+   if (doPhysWaveShifter) :
+      InputKey = "LArPhysWaveUnShifted"
+   else :
+      InputKey = "LArPhysWave"  # no shift applied to the PhysWave   
+
+if not 'isFCAL' in dir() :
+   isFCAL = False
+
+if not 'InputKey' in dir():
+   InputKey = "LArPhysWaveUnShifted"
+
+if not 'ShiftMode' in dir():
+   ShiftMode = 3  # 1 = minimum Tstart from helper in FEB
+                  # 2 = minumum Tpeak-NindexFromPeak in FEB
+                  # 3 = average Tpeak-NindexFromPeak in FEB
+                  
+if not 'Nsamplings' in dir():
+   Nsamplings = 2
+
+if not 'TimeShiftGuardRegion' in dir():
+   TimeShiftGuardRegion = 12
+
+if not 'UsePhysCaliTdiff' in dir():
+   UsePhysCaliTdiff = True
+
+if not 'PhysCaliTdiffKey' in dir():
+   PhysCaliTdiffKey = "LArPhysCaliTdiff"
+
+###########################################################################
+#               Input selection (Autocorr, PhysWave)
+###########################################################################
+
+# RunNumber trigger IOV if reading from COOL is eneabled
+if not 'RunNumber' in dir():
+   RunNumber = '0000000'
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"  
+
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"
+
+## AutoCorr      
+
+if not 'ReadAutoCorrFromCOOL' in dir():
+   ReadAutoCorrFromCOOL = True
+
+if not 'InputAutoCorrPoolDir' in dir():
+   InputAutoCorrPoolDir = commands.getoutput("pwd")
+
+if not 'InputAutoCorrPoolFileName' in dir():
+   InputAutoCorrPoolFileName = "LArAutoCorr.pool.root"
+
+## PhysWave
+
+if not 'ReadPhysWaveFromCOOL' in dir():
+   ReadPhysWaveFromCOOL = True
+
+if not 'InputPhysWavePoolDir' in dir():
+   InputPhysWavePoolDir = commands.getoutput("pwd")
+
+if not 'InputPhysWavePoolFileName' in dir():
+   InputPhysWavePoolFileName = "LArPhysWave.pool.root"  
+
+## PhysCaliTdiff
+
+if not 'ReadPhysCaliTdiffFromCOOL' in dir():
+   ReadPhysCaliTdiffFromCOOL = True
+
+if not 'InputPhysCaliTdiffPoolDir' in dir():
+   InputPhysCaliTdiffPoolDir = commands.getoutput("pwd")
+
+if not 'InputPhysCaliTdiffPoolFileName' in dir():
+   InputPhysCaliTdiffPoolFileName = "LArPhysCaliTdiff.pool.root"
+
+if not 'ChannelSelection' in dir():
+   # Read all
+   ChannelSelection = " "
+   ## Example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,35:66</channelSelection>" 
+
+from string import *
+def DBConnectionFile(sqlitefile):
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+###########################################################################
+# OFC properties (2 instances)
+###########################################################################
+
+if not 'ContainerKey' in dir():
+   ContainerKey = "LArPhysWave"
+
+if not 'Normalize' in dir():
+   Normalize = True
+
+#
+# First instance
+#
+
+if not 'TimeShift' in dir() :
+   TimeShift = False
+
+if not 'TimeShiftByIndex' in dir() :
+   TimeShiftByIndex = -1
+
+if not 'Nsamples' in dir():
+   Nsamples = 5
+
+if not 'Nphases' in dir():
+   Nphases = 8
+
+if not 'Dphases' in dir():
+   Dphases = 3
+   
+if not 'Ndelays' in dir():
+   Ndelays = 24
+   
+if not 'OFCKey' in dir():
+   OFCKey = "LArOFC"
+
+if not 'ShapeKey' in dir():
+   ShapeKey = "LArShape"
+
+
+if not 'ShiftKey' in dir():
+   ShiftKey="LArPhysWaveShift"
+
+if not 'FillShape' in dir():
+   FillShape = True
+
+if not 'OFCTreename' in dir():
+   OFCTreename = "OFC"
+
+if not 'ShapeTreename' in dir():
+   ShapeTreename = "Shape"
+
+#
+# Second instance
+#
+
+if not 'TimeShift2' in dir() :
+   TimeShift2 = False
+
+if not 'TimeShiftByIndex2' in dir() :
+   TimeShiftByIndex2 = -1
+
+if not 'Nsamples2' in dir():
+   Nsamples2 = 5
+
+if not 'Nphases2' in dir():
+   Nphases2 = 24
+
+if not 'Dphases2' in dir():
+   Dphases2 = 1
+   
+if not 'Ndelays2' in dir():
+   Ndelays2 = 24
+   
+if not 'OFCKey2' in dir():
+   OFCKey2 = "LArOFC_2"
+
+if not 'ShapeKey2' in dir():
+   ShapeKey2 = "LArShape_2"
+
+if not 'FillShape2' in dir():
+   FillShape2 = True
+
+if not 'OFCTreename2' in dir():
+   OFCTreename2 = "OFC2"
+
+if not 'ShapeTreename2' in dir():
+   ShapeTreename2 = "Shape2"
+
+###########################################################################
+# OFC output
+###########################################################################
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+   
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumber)
+
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd   
+
+if not 'OutputOFCRootFileDir' in dir():
+   OutputOFCRootFileDir = commands.getoutput("pwd")
+   
+if not 'OutputPoolFileDir' in dir():
+   OutputPoolFileDir = commands.getoutput("pwd")
+
+OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","")
+OFCFileTag += "_"+str(Nsamples)+"samples"
+
+#if (Dphases>1):
+#   OFCFileTag += "_"+str(Dphases)+"Dphase"
+
+if not 'OutputOFCRootFileName' in dir():
+   OutputOFCRootFileName = "LArOFCPhys_"+OFCFileTag + ".root"
+   
+if not 'OutputPoolFileName' in dir():
+   OutputPoolFileName = "LArOFCShapePhys_"+OFCFileTag + ".pool.root"
+
+
+#input folders:
+if "AutoCorrFolder" not in dir():
+   AutoCorrFolder  = LArCalib_Flags.LArAutoCorrFolder
+if "PhysAutoCorrFolder" not in dir():
+   PhysAutoCorrFolder  = LArCalib_Flags.LArPhysAutoCorrFolder
+if "PhysCaliTdiffFolder" not in dir():
+   PhysCaliTdiffFolder  = LArCalib_Flags.LArPhysCaliTdiffFolder
+
+if isFCAL:
+   PhysWaveFolderFCAL="/LAR/ElecCalibOfl/PhysWaves/FCALFromTB"
+else:
+   PhysWaveFolder  = LArCalib_Flags.LArPhysWaveFolder
+
+
+#Shift (can be output or input)
+if "OFCBinFolder" not in dir():
+   OFCBinFolder="/LAR/ElecCalibOfl/OFCBin/PhysWaveShifts"
+
+
+#output Folders:
+if "FolderOFC" not in dir():
+   FolderOFC   = "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples3bins17phases"
+
+if "FolderShape" not in dir():
+   FolderShape = "/LAR/ElecCalibOfl/Shape/RTM/5samples3bins17phases"
+
+if "FolderOFC2" not in dir():
+   FolderOFC2   = "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples"
+
+if "FolderShape2" not in dir():
+   FolderShape2 = "/LAR/ElecCalibOfl/Shape/RTM/5samples"
+
+
+rs=FolderTagResover()
+if not 'AutoCorrLArCalibFolderTag' in dir():
+   AutoCorrLArCalibFolderTag=rs.getFolderTagSuffix(AutoCorrFolder)
+if not 'PhysAutoCorrLArCalibFolderTag' in dir():
+   PhysAutoCorrLArCalibFolderTag="_mu_"+str(NColl)+rs.getFolderTagSuffix(PhysAutoCorrFolder)
+
+if not 'PhysWaveLArCalibFolderTag' in dir():
+   if isFCAL:
+      PhysWaveLArCalibFolderTag=rs.getFolderTagSuffix(PhysWaveFolderFCAL)
+   else:
+      PhysWaveLArCalibFolderTag=rs.getFolderTagSuffix(PhysWaveFolder)
+
+if not 'PhysCaliTdiffLArCalibFolderTag' in dir():
+   PhysCaliTdiffLArCalibFolderTag=rs.getFolderTagSuffix(PhysCaliTdiffFolder)
+
+if not 'OFCBinFolderTag' in dir():
+   OFCBinFolderTag=rs.getFolderTagSuffix(OFCBinFolder)
+
+
+#output Folders:
+if "FolderTagOFC" not in dir():
+   FolderTagOFC   = rs.getFolderTagSuffix(FolderOFC)
+if "FolderTagOFCmu" not in dir():
+   FolderTagOFCmu   = "-mu-"+str(NColl)+rs.getFolderTagSuffix(FolderOFC)
+if "FolderTagShape" not in dir():
+   FolderTagShape = rs.getFolderTagSuffix(FolderShape)
+
+if "FolderTagOFC2" not in dir():
+      FolderTagOFC2   = rs.getFolderTagSuffix(FolderOFC2)
+if "FolderTagOFC2mu" not in dir():
+      FolderTagOFC2mu  = "-mu-"+str(NColl)+rs.getFolderTagSuffix(FolderOFC)
+
+if "FolderTagShape2" not in dir():
+   FolderTagShape2 = rs.getFolderTagSuffix(FolderShape2)
+
+
+del rs #close Database
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)
+
+
+OutputObjectSpecOFC    = "LArOFCComplete#"+OFCKey+"#"+ FolderOFC
+OutputObjectSpecTagOFC = LArCalibFolderTag(FolderOFC,FolderTagOFC)
+						
+OutputObjectSpecOFCmu    = "LArOFCComplete#"+OFCKey+"_mu"+"#"+ FolderOFC
+OutputObjectSpecTagOFCmu = LArCalibFolderTag(FolderOFC,FolderTagOFCmu)
+						
+OutputObjectSpecShape = "LArShapeComplete#"+ShapeKey+"#"+ FolderShape
+OutputObjectSpecTagShape  = LArCalibFolderTag(FolderShape,FolderTagShape)
+
+OutputObjectSpecOFC2    = "LArOFCComplete#"+OFCKey2+"#"+ FolderOFC2
+OutputObjectSpecTagOFC2 = LArCalibFolderTag(FolderOFC2,FolderTagOFC2)
+						
+OutputObjectSpecOFC2mu   = "LArOFCComplete#"+OFCKey2+"_mu"+"#"+ FolderOFC2
+OutputObjectSpecTagOFC2mu = LArCalibFolderTag(FolderOFC2,FolderTagOFC2mu)
+						
+OutputObjectSpecShape2 = "LArShapeComplete#"+ShapeKey2+"#"+ FolderShape2
+OutputObjectSpecTagShape2  = LArCalibFolderTag(FolderShape2,FolderTagShape2)
+
+OutputObjectSpecOFCBin="LArOFCBinComplete#"+ShiftKey+"#"+OFCBinFolder
+OutputObjectSpecTagOFCBin = LArCalibFolderTag(OFCBinFolder,OFCBinFolderTag)
+
+
+if not 'DBConnectionCOOL' in dir():
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"
+
+if ( ReadAutoCorrFromCOOL ):      
+   if 'InputAutoCorrSQLiteFile' in dir():
+      InputDBConnectionAutoCorr = DBConnectionFile(InputAutoCorrSQLiteFile)
+   else:
+      InputDBConnectionAutoCorr = DBConnectionCOOL
+
+if ( ReadPhysWaveFromCOOL ):      
+   if 'InputPhysWaveSQLiteFile' in dir():
+      InputDBConnectionPhysWave = DBConnectionFile(InputPhysWaveSQLiteFile)
+   else:
+      InputDBConnectionPhysWave = DBConnectionCOOL
+
+if ( ReadPhysCaliTdiffFromCOOL ):
+   if 'InputPhysCaliTdiffSQLiteFile' in dir():
+      InputDBConnectionPhysCaliTdiff = DBConnectionFile(InputPhysCaliTdiffSQLiteFile)
+   else:
+      InputDBConnectionPhysCaliTdiff = DBConnectionCOOL
+
+## Bad Channel   
+   
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;"
+      InputDBConnectionBadChannel = "COOLOFL_LAR/COMP200"        
+      
+###########################################################################
+# Print summary
+###########################################################################
+
+OFCLog = logging.getLogger( "OFCLog" )
+OFCLog.info( " ======================================================== " )
+OFCLog.info( " ***                 LAr OFC summary                  *** " )
+OFCLog.info( " ======================================================== " )
+OFCLog.info( " RunNumber                          = "+str(RunNumber) )
+if ( ReadAutoCorrFromCOOL ):
+   OFCLog.info( " InputDBConnectionAutoCorr          = "+InputDBConnectionAutoCorr )
+   OFCLog.info( " AutoCorrLArCalibFolderTag             = "+AutoCorrLArCalibFolderTag)
+else :
+   OFCLog.info( " InputAutoCorrPoolFileName          = "+InputAutoCorrPoolDir+"/"+InputAutoCorrPoolFileName )
+   
+
+if ( ReadPhysWaveFromCOOL ):
+   OFCLog.info( " InputDBConnectionPhysWave          = "+InputDBConnectionPhysWave )
+   OFCLog.info( " PhysWaveLArCalibFolderTag          =" +PhysWaveLArCalibFolderTag )
+else :
+   OFCLog.info( " InputPhysWavePoolFileName          = "+InputPhysWavePoolDir+"/"+InputPhysWavePoolFileName )
+   
+if ( (ReadAutoCorrFromCOOL or ReadPhysWaveFromCOOL) and ChannelSelection != " " ):
+   OFCLog.info( " ChannelSelection                   = "+ChannelSelection )
+   
+if ( ReadPhysCaliTdiffFromCOOL ):
+   OFCLog.info( " InputDBConnectionPhysCaliTdiff     = "+InputDBConnectionPhysCaliTdiff )
+   OFCLog.info( " PhysCaliTdiffLArCalibFolderTag     = "+PhysCaliTdiffLArCalibFolderTag )
+else :
+   OFCLog.info( " InputPhysCaliTdiffPoolFileName     = "+InputPhysCaliTdiffPoolDir+"/"+InputPhysCaliTdiffPoolFileName )                                                      
+OFCLog.info( " OutputOFCRootFullFileName          = "+OutputOFCRootFileDir+"/"+OutputOFCRootFileName )
+OFCLog.info( " OutputPoolFullFileName             = "+OutputPoolFileDir+"/"+OutputPoolFileName )
+OFCLog.info( " OutputObjectSpecOFC                = "+str(OutputObjectSpecOFC) )
+OFCLog.info( " OutputObjectSpecTagOFC             = "+str(OutputObjectSpecTagOFC) )
+OFCLog.info( " OutputObjectSpecOFCmu              = "+str(OutputObjectSpecOFCmu) )
+OFCLog.info( " OutputObjectSpecTagOFCmu           = "+str(OutputObjectSpecTagOFCmu) )
+OFCLog.info( " OutputObjectSpecShape              = "+str(OutputObjectSpecShape) )
+OFCLog.info( " OutputObjectSpecTagShape           = "+str(OutputObjectSpecTagShape) )
+OFCLog.info( " OutputObjectSpecOFC2               = "+str(OutputObjectSpecOFC2) )
+OFCLog.info( " OutputObjectSpecTagOFC2            = "+str(OutputObjectSpecTagOFC2) )
+OFCLog.info( " OutputObjectSpecOFC2mu             = "+str(OutputObjectSpecOFC2mu) )
+OFCLog.info( " OutputObjectSpecTagOFC2mu          = "+str(OutputObjectSpecTagOFC2mu) )
+OFCLog.info( " OutputObjectSpecShape2             = "+str(OutputObjectSpecShape2) )
+OFCLog.info( " OutputObjectSpecTagShape2          = "+str(OutputObjectSpecTagShape2) )
+OFCLog.info( " OutputObjectSpecOFCBin             = "+str(OutputObjectSpecOFCBin) )
+OFCLog.info( " OutputObjectSpecTagOFCBin          = "+str(OutputObjectSpecTagOFCBin) )
+OFCLog.info( " IOVBegin                           = "+str(IOVBegin) )
+OFCLog.info( " IOVEnd                             = "+str(IOVEnd) )
+OFCLog.info( " LArCalibOutputDB                   = "+OutputDB )
+OFCLog.info( " ======================================================== " )
+
+###########################################################################
+#
+# Global settings
+#
+###########################################################################
+
+include("AthenaCommon/Atlas_Gen.UnixStandardJob.py")
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+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')
+
+from AthenaCommon.JobProperties import jobproperties
+jobproperties.Global.DetDescrVersion = "ATLAS-GEO-16-00-00"
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.Calo_setOn()  #Switched off to avoid geometry
+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" )
+
+###########################################################################
+#                                                                         #
+#    Input conditions data (AutoCorr, CaliWave) for COOL and/or POOL      #
+#                                                                         #
+###########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+include ("LArCalibProcessing/LArCalib_BadChanTool.py")
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   OFCLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   OFCLog.info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB   
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+if ( ReadAutoCorrFromCOOL or ReadPhysWaveFromCOOL ):
+   if not ('InputAutoCorrSQLiteFile')  in dir():
+      OFCLog.info( "Read AutoCorr from Oracle" )
+   else :
+      OFCLog.info( "Read AutoCorr from SQLite file" )
+      
+   if not ('InputPhysWaveSQLiteFile')  in dir():
+      OFCLog.info( "Read PhysWave from Oracle DB" )
+   else :
+      OFCLog.info( "Read PhysWave from SQLite file" )
+      
+if ( ReadAutoCorrFromCOOL ):
+   PhysAutoCorrTagSpec= LArCalibFolderTag(PhysAutoCorrFolder,PhysAutoCorrLArCalibFolderTag)
+   AutoCorrTagSpec= LArCalibFolderTag(AutoCorrFolder,AutoCorrLArCalibFolderTag)
+   conddb.addFolder("",AutoCorrFolder+"<tag>"+AutoCorrTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionAutoCorr+"</dbConnection>"+ ChannelSelection)
+   conddb.addFolder("",PhysAutoCorrFolder+"<tag>"+PhysAutoCorrTagSpec+"</tag><key>LArPhysAutoCorr</key>"+"<dbConnection>"+InputDBConnectionAutoCorr+"</dbConnection>"+ ChannelSelection)
+else:
+   if 'InputAutoCorrPoolFileName' in dir():
+      OFCLog.info( "Read AutoCorr from POOL file")
+      PoolFileList += [ InputAutoCorrPoolDir+"/"+InputAutoCorrPoolFileName ]
+   else:
+      OFCLog.info( "No PoolFileList found! Please list the POOL files containing AutoCorrelation Matrix or read from COOL." )
+      theApp.exit(-1)      
+      
+if ( ReadPhysWaveFromCOOL ):
+   if (doPhysWaveShifter or isFCAL) :
+      if isFCAL:
+         PhysWaveTagSpec = LArCalibFolderTag(PhysWaveFolderFCAL,PhysWaveLArCalibFolderTag)
+      else:
+         PhysWaveTagSpec = LArCalibFolderTag(PhysWaveFolder,PhysWaveLArCalibFolderTag)
+      if isFCAL:   
+         conddb.addFolder("",PhysWaveFolderFCAL+"<key>"+InputKey+"</key><tag>"+PhysWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPhysWave+"</dbConnection>" + ChannelSelection)
+      else:   
+         conddb.addFolder("",PhysWaveFolder+"<key>"+InputKey+"</key><tag>"+PhysWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPhysWave+"</dbConnection>" + ChannelSelection)
+   else :
+      PhysWaveTagSpec = LArCalibFolderTag(PhysWaveFolder,PhysWaveLArCalibFolderTag)
+      conddb.addFolder("",PhysWaveFolder+"<tag>"+PhysWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPhysWave+"</dbConnection>" + ChannelSelection) 
+else:
+   if 'InputPhysWavePoolFileName' in dir():
+      OFCLog.info( "Read PhysWave from POOL file" )
+      PoolFileList += [ InputPhysWavePoolDir+"/"+InputPhysWavePoolFileName ]
+   else:
+      OFCLog.info( "No PoolFileList found! Please list the POOL files containing PhysWave or read from COOL." )
+      theApp.exit(-1)
+
+if (UsePhysCaliTdiff):
+   if ( ReadPhysCaliTdiffFromCOOL ):
+         PhysCaliTdiffTagSpec = LArCalibFolderTag(PhysCaliTdiffFolder,PhysCaliTdiffLArCalibFolderTag)
+         conddb.addFolder("",PhysCaliTdiffFolder+"<key>"+PhysCaliTdiffKey+"</key><tag>"+PhysCaliTdiffTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPhysCaliTdiff+"</dbConnection>" + ChannelSelection)
+   else: 
+      if 'InputPhysCaliTdiffPoolFileName' in dir():
+         OFCLog.info( "Read PhysCaliTdiff from POOL file" )
+         PoolFileList += [ InputPhysCaliTdiffPoolDir+"/"+InputPhysCaliTdiffPoolFileName ]
+      else:
+         OFCLog.info( "No PoolFileList found! Please list the POOL files containing PhysCaliTdiff or read from COOL." )
+         theApp.exit(-1)
+
+if ( len(PoolFileList)>0 ):
+
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+
+if (doPhysWaveShifter) :
+
+   ###########################################################################
+   #                                                                         #
+   #                 Shift physics waveforms only for FCAL                   #
+   #                                                                         # 
+   ###########################################################################
+   from LArCalibUtils.LArCalibUtilsConf import LArPhysWaveShifter
+   LArPhysWaveShifter                        = LArPhysWaveShifter("LArPhysWaveShifter")
+   
+   LArPhysWaveShifter.KeyList                = [ InputKey ]
+   LArPhysWaveShifter.KeyOutput              = ContainerKey
+   LArPhysWaveShifter.GroupingType           = GroupingType
+   
+   #
+   # Minimum Tstart per FEB computation
+   #
+   LArPhysWaveShifter.ComputeTimeShiftByFEB  = True
+   LArPhysWaveShifter.TimeShiftByFEBMode     = ShiftMode
+   LArPhysWaveShifter.TimeShiftByFEBDump     = True
+   LArPhysWaveShifter.TimeShiftByFEBDumpFile = "TimeShiftFEB.py"
+
+   #
+   # Possible time shifts
+   #
+   LArPhysWaveShifter.TimeShiftByHelper      = False
+   LArPhysWaveShifter.TimeShiftByIndex       = 0
+   LArPhysWaveShifter.TimeShiftFromPeak      = False
+   LArPhysWaveShifter.NindexFromPeak         = 0 # if 0 will use Ndelays*Nsampling
+   LArPhysWaveShifter.Ndelays                = 24
+   LArPhysWaveShifter.Nsamplings             = Nsamplings 
+   LArPhysWaveShifter.TimeShiftByFEB         = True
+   LArPhysWaveShifter.TimeShiftGuardRegion   = TimeShiftGuardRegion
+   LArPhysWaveShifter.UsePhysCaliTdiff       = UsePhysCaliTdiff
+   LArPhysWaveShifter.CellByCellShiftsKey    = "LArPhysCaliTdiff"
+   LArPhysWaveShifter.OutputShiftsKey        = ShiftKey
+   topSequence += LArPhysWaveShifter   
+
+else:
+   #Load Shifts from DB:
+   conddb.addFolder("LAR_OFL",OFCBinFolder+"<tag>"+OutputObjectSpecTagOFCBin+"</tag><key>"+ShiftKey+"</key>");
+
+
+###########################################################################
+#                      OFC computation
+###########################################################################
+
+from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrDecoderTool
+theLArAutoCorrDecoderTool = LArAutoCorrDecoderTool()
+ToolSvc += theLArAutoCorrDecoderTool
+if NColl > 0:
+   theLArPhysAutoCorrDecoderTool = LArAutoCorrDecoderTool("LArPhysAutoCorrDecoderTool")
+   theLArPhysAutoCorrDecoderTool.DecodeMode=1
+   theLArPhysAutoCorrDecoderTool.KeyAutoCorr="LArPhysAutoCorr"
+   ToolSvc += theLArPhysAutoCorrDecoderTool
+
+from LArCalibUtils.LArCalibUtilsConf import LArOFCAlg
+
+LArPhysOFCAlg = LArOFCAlg("LArPhysOFCAlg")
+
+LArPhysOFCAlg.ReadCaliWave = False
+LArPhysOFCAlg.KeyList      = [ InputKey ]
+LArPhysOFCAlg.Normalize    = Normalize
+LArPhysOFCAlg.Verify       = True
+LArPhysOFCAlg.GroupingType = GroupingType
+
+LArPhysOFCAlg.Nphase    = Nphases
+LArPhysOFCAlg.Dphase    = Dphases
+LArPhysOFCAlg.Ndelay    = Ndelays
+LArPhysOFCAlg.Nsample   = Nsamples
+LArPhysOFCAlg.FillShape = FillShape
+LArPhysOFCAlg.TimeShift = TimeShift
+LArPhysOFCAlg.TimeShiftByIndex = TimeShiftByIndex
+LArPhysOFCAlg.AddTimeOffset = -1.0*TimeShiftGuardRegion
+LArPhysOFCAlg.LArPhysWaveBinKey = ShiftKey
+
+LArPhysOFCAlg.UseDelta = 0 #Only for high-mu OFCs
+LArPhysOFCAlg.KeyOFC   = OFCKey
+LArPhysOFCAlg.KeyShape = ShapeKey
+LArPhysOFCAlg.DecoderTool = theLArAutoCorrDecoderTool
+
+
+topSequence+=LArPhysOFCAlg
+
+LArPhysOFCAlg2 = LArOFCAlg("LArPhysOFCAlg2")
+
+LArPhysOFCAlg2.ReadCaliWave = False
+LArPhysOFCAlg2.KeyList      = [ InputKey ]
+LArPhysOFCAlg2.Normalize    = Normalize
+LArPhysOFCAlg2.Verify       = True
+LArPhysOFCAlg2.GroupingType = GroupingType
+
+LArPhysOFCAlg2.Nphase    = Nphases2
+LArPhysOFCAlg2.Dphase    = Dphases2
+LArPhysOFCAlg2.Ndelay    = Ndelays2
+LArPhysOFCAlg2.Nsample   = Nsamples2
+LArPhysOFCAlg2.FillShape = FillShape2
+LArPhysOFCAlg2.TimeShift = TimeShift2
+LArPhysOFCAlg2.TimeShiftByIndex = TimeShiftByIndex2
+LArPhysOFCAlg2.AddTimeOffset = -1.0*TimeShiftGuardRegion
+LArPhysOFCAlg2.LArPhysWaveBinKey = ShiftKey
+LArPhysOFCAlg2.UseDelta = 0 #Only for high-mu OFCs
+
+LArPhysOFCAlg2.KeyOFC   = OFCKey2
+LArPhysOFCAlg2.KeyShape = ShapeKey2
+LArPhysOFCAlg2.DecoderTool = theLArAutoCorrDecoderTool
+
+topSequence+=LArPhysOFCAlg2
+
+if NColl > 0:
+   LArPhysOFCAlgmu = LArOFCAlg("LArPhysOFCAlgmu")
+   
+   LArPhysOFCAlgmu.ReadCaliWave = False
+   LArPhysOFCAlgmu.KeyList      = [ InputKey ]
+   LArPhysOFCAlgmu.Normalize    = Normalize
+   LArPhysOFCAlgmu.Verify       = True
+   LArPhysOFCAlgmu.GroupingType = GroupingType
+   
+   LArPhysOFCAlgmu.Nphase    = Nphases
+   LArPhysOFCAlgmu.Dphase    = Dphases
+   LArPhysOFCAlgmu.Ndelay    = Ndelays
+   LArPhysOFCAlgmu.Nsample   = Nsamples
+   LArPhysOFCAlgmu.FillShape = False
+   LArPhysOFCAlgmu.TimeShift = TimeShift
+   LArPhysOFCAlgmu.TimeShiftByIndex = TimeShiftByIndex
+   LArPhysOFCAlgmu.AddTimeOffset = -1.0*TimeShiftGuardRegion
+   LArPhysOFCAlgmu.LArPhysWaveBinKey = ShiftKey
+      
+   LArPhysOFCAlgmu.UseDelta = UseDelta
+   LArPhysOFCAlgmu.KeyOFC   = OFCKey+"_mu"
+   LArPhysOFCAlgmu.DecoderTool = theLArPhysAutoCorrDecoderTool
+   
+   
+   topSequence+=LArPhysOFCAlgmu
+   
+   LArPhysOFCAlgmu2 = LArOFCAlg("LArPhysOFCAlgmu2")
+   
+   LArPhysOFCAlgmu2.ReadCaliWave = False
+   LArPhysOFCAlgmu2.KeyList      = [ InputKey ]
+   LArPhysOFCAlgmu2.Normalize    = Normalize
+   LArPhysOFCAlgmu2.Verify       = True
+   LArPhysOFCAlgmu2.GroupingType = GroupingType
+   
+   LArPhysOFCAlgmu2.Nphase    = Nphases2
+   LArPhysOFCAlgmu2.Dphase    = Dphases2
+   LArPhysOFCAlgmu2.Ndelay    = Ndelays2
+   LArPhysOFCAlgmu2.Nsample   = Nsamples2
+   LArPhysOFCAlgmu2.FillShape = False
+   LArPhysOFCAlgmu2.TimeShift = TimeShift2
+   LArPhysOFCAlgmu2.TimeShiftByIndex = TimeShiftByIndex2
+   LArPhysOFCAlgmu2.AddTimeOffset = -1.0*TimeShiftGuardRegion
+   LArPhysOFCAlgmu2.LArPhysWaveBinKey = ShiftKey
+   LArPhysOFCAlgmu2.UseDelta = UseDelta
+   
+   LArPhysOFCAlgmu2.KeyOFC   = OFCKey2+"_mu"
+   LArPhysOFCAlgmu2.DecoderTool = theLArPhysAutoCorrDecoderTool
+   
+   topSequence+=LArPhysOFCAlgmu2
+###########################################################################
+
+if ( WriteNtuple ) :
+
+   from LArCalibTools.LArCalibToolsConf import LArOFC2Ntuple 
+   
+   LArOFC2Ntuple1 = LArOFC2Ntuple("LArOFC2Ntuple1")
+   LArOFC2Ntuple1.ContainerKey = OFCKey
+   LArOFC2Ntuple1.NtupleName   = OFCTreeName	   
+   LArOFC2Ntuple1.AddFEBTempInfo   = False   
+   topSequence+=LArOFC2Ntuple1
+
+   LArOFC2Ntuple2 = LArOFC2Ntuple("LArOFC2Ntuple2")
+   LArOFC2Ntuple2.ContainerKey = OFCKey2
+   LArOFC2Ntuple2.NtupleName   = OFCTreeName2 	   
+   LArOFC2Ntuple2.AddFEBTempInfo   = False 	   
+   topSequence+=LArOFC2Ntuple2
+
+   if NColl > 0:
+      LArOFC2Ntuple1mu = LArOFC2Ntuple("LArOFC2Ntuple1mu")
+      LArOFC2Ntuple1mu.ContainerKey = OFCKey+"_mu"
+      LArOFC2Ntuple1mu.NtupleName   = OFCTreeName+"_mu"
+      LArOFC2Ntuple1mu.AddFEBTempInfo   = False   
+      topSequence+=LArOFC2Ntuple1mu
+ 
+      LArOFC2Ntuple2mu = LArOFC2Ntuple("LArOFC2Ntuple2mu")
+      LArOFC2Ntuple2mu.ContainerKey = OFCKey2+"_mu"
+      LArOFC2Ntuple2mu.NtupleName   = OFCTreeName2+"_mu"
+      LArOFC2Ntuple2mu.AddFEBTempInfo   = False 	   
+      topSequence+=LArOFC2Ntuple2mu
+
+   if ( FillShape ):
+
+      from LArCalibTools.LArCalibToolsConf import LArShape2Ntuple
+
+      LArShape2Ntuple1 = LArShape2Ntuple("LArShape2Ntuple1")
+      LArShape2Ntuple1.ContainerKey = ShapeKey
+      LArShape2Ntuple1.NtupleName   = ShapeTreeName
+      LArShape2Ntuple1.AddFEBTempInfo   = False
+      topSequence+=LArShape2Ntuple1
+
+      LArShape2Ntuple2 = LArShape2Ntuple("LArShape2Ntuple2")
+      LArShape2Ntuple2.ContainerKey = ShapeKey2 	   
+      LArShape2Ntuple2.NtupleName   = ShapeTreeName2
+      LArShape2Ntuple2.AddFEBTempInfo   = False
+      topSequence+=LArShape2Ntuple2
+
+
+   if ( doPhysWaveShifter ):
+      from LArCalibTools.LArCalibToolsConf import LArFebTimeOffset2Ntuple
+      LArFebTimeOffset2Ntuple                = LArFebTimeOffset2Ntuple( "LArFebTimeOffset2Ntuple" )
+      LArFebTimeOffset2Ntuple.ContainerKey   = "FebTimeOffset"
+      LArFebTimeOffset2Ntuple.AddFEBTempInfo   = False
+
+      topSequence+=LArFebTimeOffset2Ntuple
+
+      from LArCalibTools.LArCalibToolsConf import LArWFParams2Ntuple
+      LArWFParams2Ntuple=LArWFParams2Ntuple("LArWFParams2Ntuple")
+      LArWFParams2Ntuple.DumpOFCBin=True
+      LArWFParams2Ntuple.AddFEBTempInfo   = False
+      LArWFParams2Ntuple.OFCBinKey  =ShiftKey
+      topSequence+=LArWFParams2Ntuple
+      
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputOFCRootFileDir+"/"+OutputOFCRootFileName): 
+      os.remove(OutputOFCRootFileDir+"/"+OutputOFCRootFileName)
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputOFCRootFileDir+"/"+OutputOFCRootFileName+"' OPT='NEW'" ]
+   
+if (  WritePoolFile ) :
+   
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   if os.path.exists(OutputPoolFileDir+"/"+OutputPoolFileName): 
+      os.remove(OutputPoolFileDir+"/"+OutputPoolFileName)
+      
+   OutputConditionsAlg = OutputConditionsAlg("OutputConditionsAlg",OutputPoolFileDir+"/"+OutputPoolFileName,
+                                             [OutputObjectSpecOFC],[OutputObjectSpecTagOFC],WriteIOV)
+   OutputConditionsAlg.Run1     = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlg.Run2  = IOVEnd
+      
+   OutputConditionsAlg.ObjectList += [OutputObjectSpecOFC2]
+   OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagOFC2]
+
+   if NColl > 0:
+      OutputConditionsAlg.ObjectList += [OutputObjectSpecOFCmu]
+      OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagOFCmu]
+      OutputConditionsAlg.ObjectList += [OutputObjectSpecOFC2mu]
+      OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagOFC2mu]
+
+   if ( FillShape ):
+      OutputConditionsAlg.ObjectList += [OutputObjectSpecShape]
+      OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagShape]
+      OutputConditionsAlg.ObjectList += [OutputObjectSpecShape2]
+      OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagShape2]
+
+   if ( doPhysWaveShifter):
+      OutputConditionsAlg.ObjectList += [OutputObjectSpecOFCBin]
+      OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagOFCBin]
+
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+   
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+  		
+###########################################################################
+#               Use EventSelector to select IOV                           #
+###########################################################################	
+
+from McEventSelector.McEventSelectorConf import McEventSelector
+svcMgr += McEventSelector("EventSelector")
+svcMgr.EventSelector.RunNumber	= int(RunNumber)
+svcMgr.EventSelector.EventsPerRun      = 1
+svcMgr.EventSelector.FirstEvent	= 1
+svcMgr.EventSelector.InitialTimeStamp  = 0
+svcMgr.EventSelector.TimeStampInterval = 1
+
+##########################################################################
+#          don't remove otherwise infinite loop                          #
+##########################################################################
+
+theApp.EvtMax = 1
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = VERBOSE)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = DEBUG)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_jobOptions.py
new file mode 100644
index 00000000000..ff8457446e5
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_jobOptions.py
@@ -0,0 +1,615 @@
+import commands
+
+###########################################################################
+#
+# <Marco.Delmastro@cern.ch>
+#
+# Example jobOptions to compute OFC phys in all 3 gains
+#
+# Last update: 09/12/2008 <Marco.Delmastro@cern.ch>
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+
+###########################################################################
+#             PhysWaveShifter properties                                  #
+###########################################################################
+
+if not 'doPhysWaveShifter' in dir():
+   doPhysWaveShifter = True 
+
+if not 'doOFCPicker' in dir():
+   doOFCPicker=False
+
+if not 'InputKey' in dir():   
+   if (doPhysWaveShifter) :
+      InputKey = "LArPhysWaveUnShifted"
+   else :
+      InputKey = "LArPhysWave"  # no shift applied to the PhysWave   
+
+if not 'isFCAL' in dir() :
+   isFCAL = False
+
+if not 'InputKey' in dir():
+   InputKey = "LArPhysWaveUnShifted"
+
+if not 'ShiftMode' in dir():
+   ShiftMode = 2  # 1 = minimum Tstart from helper in FEB
+                  # 2 = minumum Tpeak-NindexFromPeak in FEB
+                  # 3 = average Tpeak-NindexFromPeak in FEB
+                  
+if not 'Nsamplings' in dir():
+   Nsamplings = 2
+
+if not 'TimeShiftGuardRegion' in dir():
+   TimeShiftGuardRegion = 5
+
+if not 'UsePhysCaliTdiff' in dir():
+   UsePhysCaliTdiff = False
+
+if not 'PhysCaliTdiffKey' in dir():
+   PhysCaliTdiffKey = "LArPhysCaliTdiff"
+
+
+
+###########################################################################
+#               Input selection (Autocorr, PhysWave)
+###########################################################################
+
+# RunNumber trigger IOV if reading from COOL is eneabled
+if not 'RunNumber' in dir():
+   RunNumber = '0000000'
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"  
+
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"
+
+## AutoCorr      
+
+if not 'ReadAutoCorrFromCOOL' in dir():
+   ReadAutoCorrFromCOOL = True
+
+if not 'InputAutoCorrPoolDir' in dir():
+   InputAutoCorrPoolDir = commands.getoutput("pwd")
+
+if not 'InputAutoCorrPoolFileName' in dir():
+   InputAutoCorrPoolFileName = "LArAutoCorr.pool.root"
+
+## PhysWave
+
+if not 'ReadPhysWaveFromCOOL' in dir():
+   ReadPhysWaveFromCOOL = True
+
+if not 'InputPhysWavePoolDir' in dir():
+   InputPhysWavePoolDir = commands.getoutput("pwd")
+
+if not 'InputPhysWavePoolFileName' in dir():
+   InputPhysWavePoolFileName = "LArPhysWave.pool.root"  
+
+if not 'ChannelSelection' in dir():
+   # Read all
+   ChannelSelection = " "
+   ## Example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,35:66</channelSelection>" 
+
+from string import *
+def DBConnectionFile(sqlitefile):
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+###########################################################################
+# OFC properties
+###########################################################################
+
+if not 'Nsamples' in dir():
+   Nsamples = 5
+
+if not 'Nphases' in dir():
+   Nphases = 50
+
+if not 'Dphases' in dir(): # not yest implemeented!
+   Dphases = 1
+   
+if not 'Ndelays' in dir():
+   Ndelays = 24
+	
+if not 'ContainerKey' in dir():
+   ContainerKey = "LArPhysWave"
+   
+if not 'OFCKey' in dir():
+   OFCKey = "LArOFC"
+
+if not 'ShapeKey' in dir():
+   ShapeKey = "LArShape"
+	
+if not 'Normalize' in dir():
+   Normalize = True
+
+if not 'TimeShift' in dir() :
+   TimeShift = False
+
+if not 'TimeShiftByIndex' in dir() :
+   TimeShiftByIndex = -1
+
+if not 'FillShape' in dir():
+   FillShape = True # Do not fill a LArShapeComplete object for calibration OFC!
+
+if not 'DumpOFC' in dir():
+   DumpOFC = False
+
+###########################################################################
+# OFC output
+###########################################################################
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+   
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumber)
+
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd   
+
+if not 'OutputOFCRootFileDir' in dir():
+   OutputOFCRootFileDir = commands.getoutput("pwd")
+   
+if not 'OutputPoolFileDir' in dir():
+   OutputPoolFileDir = commands.getoutput("pwd")
+
+OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","")
+
+OFCFileTag += "_"+str(Nsamples)+"samples"
+
+if (Dphases>1): # not yet implemented!
+   OFCFileTag += "_"+str(Dphases)+"Dphase"
+
+if not 'OutputOFCRootFileName' in dir():
+   OutputOFCRootFileName = "LArOFCPhys_"+OFCFileTag + ".root"
+   
+if not 'OutputPoolFileName' in dir():
+   OutputPoolFileName = "LArOFCShapePhys_"+OFCFileTag + ".pool.root"
+
+if not 'LArPhysFolderOutputTag' in dir():
+   LArPhysFolderOutputTag = LArCalib_Flags.tagSuffix  
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)
+
+if not 'OutputObjectSpecOFC' in dir():
+   if doOFCPicker:
+       FolderOFC = "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples1phase"
+       OutputObjectSpecOFC       = "LArOFCComplete#LArOFC#"+FolderOFC 
+       OutputObjectSpecTagOFC    = LArCalibFolderTag(FolderOFC,LArPhysFolderOutputTag)
+   else:
+      OutputObjectSpecOFC   = "LArOFCComplete#"  +OFCKey  +"#"+ LArCalib_Flags.LArOFCPhysFolder+str(Nsamples)+"samples"	
+      OutputObjectSpecTagOFC    = LArCalibFolderTag(LArCalib_Flags.LArOFCPhysFolder+str(Nsamples)+"samples",LArPhysFolderOutputTag)
+      
+if not 'OutputObjectSpecShape' in dir():
+   if doOFCPicker:
+      FolderShape = "/LAR/ElecCalibOfl/Shape/RTM/5samples1phase"
+      OutputObjectSpecShape       = "LArShapeComplete#LArShape#"+FolderShape 
+      OutputObjectSpecTagShape    =  LArCalibFolderTag(FolderShape,LArPhysFolderOutputTag)
+   else:
+      OutputObjectSpecShape = "LArShapeComplete#"+ShapeKey+"#"+ LArCalib_Flags.LArShapeFolder+str(Nsamples)+"samples"		
+      OutputObjectSpecTagShape  = LArCalibFolderTag(LArCalib_Flags.LArShapeFolder+str(Nsamples)+"samples",LArPhysFolderOutputTag)
+     
+if not 'DBConnectionCOOL' in dir():
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"
+
+if ( ReadAutoCorrFromCOOL ):      
+   if 'InputAutoCorrSQLiteFile' in dir():
+      InputDBConnectionAutoCorr = DBConnectionFile(InputAutoCorrSQLiteFile)
+   else:
+      InputDBConnectionAutoCorr = DBConnectionCOOL
+
+if ( ReadPhysWaveFromCOOL ):      
+   if 'InputPhysWaveSQLiteFile' in dir():
+      InputDBConnectionPhysWave = DBConnectionFile(InputPhysWaveSQLiteFile)
+   else:
+      InputDBConnectionPhysWave = DBConnectionCOOL
+
+if ( ReadPhysCaliTdiffFromCOOL ):
+   if 'InputPhysCaliTdiffSQLiteFile' in dir():
+      InputDBConnectionPhysCaliTdiff = DBConnectionFile(InputPhysCaliTdiffSQLiteFile)
+   else:
+      InputDBConnectionPhysCaliTdiff = DBConnectionCOOL
+
+## Bad Channel   
+   
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;"
+      InputDBConnectionBadChannel = "COOLOFL_LAR/COMP200"        
+      
+###########################################################################
+# Print summary
+###########################################################################
+
+OFCLog = logging.getLogger( "OFCLog" )
+OFCLog.info( " ======================================================== " )
+OFCLog.info( " ***                 LAr OFC summary                  *** " )
+OFCLog.info( " ======================================================== " )
+OFCLog.info( " RunNumber                          = "+str(RunNumber) )
+if ( ReadAutoCorrFromCOOL ):
+   OFCLog.info( " InputDBConnectionAutoCorr          = "+InputDBConnectionAutoCorr )
+else :
+   OFCLog.info( " InputAutoCorrPoolFileName          = "+InputAutoCorrPoolFileName )
+if 'AutoCorrLArCalibFolderTag' in dir() :   
+   OFCLog.info( " AutoCorrLArCalibFolderTag          = "+AutoCorrLArCalibFolderTag )
+if ( ReadPhysWaveFromCOOL ):
+   OFCLog.info( " InputDBConnectionPhysWave          = "+InputDBConnectionPhysWave )
+else :
+   OFCLog.info( " InputPhysWavePoolFileName          = "+InputPhysWavePoolFileName )
+if ( (ReadAutoCorrFromCOOL or ReadPhysWaveFromCOOL) and ChannelSelection != " " ):
+   OFCLog.info( " ChannelSelection                   = "+ChannelSelection )
+if 'PhysWaveLArCalibFolderTag' in dir() :
+   OFCLog.info( " PhysWaveLArCalibFolderTag          = "+PhysWaveLArCalibFolderTag )
+OFCLog.info( " OutputOFCRootFullFileName          = "+OutputOFCRootFileDir+"/"+OutputOFCRootFileName )
+OFCLog.info( " OutputPoolFullFileName             = "+OutputPoolFileDir+"/"+OutputPoolFileName )
+OFCLog.info( " OutputObjectSpecOFC                = "+str(OutputObjectSpecOFC) )
+OFCLog.info( " OutputObjectSpecTagOFC             = "+str(OutputObjectSpecTagOFC) )
+OFCLog.info( " OutputObjectSpecShape              = "+str(OutputObjectSpecShape) )
+OFCLog.info( " OutputObjectSpecTagShape           = "+str(OutputObjectSpecTagShape) )
+OFCLog.info( " IOVBegin                           = "+str(IOVBegin) )
+OFCLog.info( " IOVEnd                             = "+str(IOVEnd) )
+OFCLog.info( " LArCalibOutputDB                   = "+OutputDB )
+OFCLog.info( " ======================================================== " )
+
+###########################################################################
+#
+# Global settings
+#
+###########################################################################
+
+include("AthenaCommon/Atlas_Gen.UnixStandardJob.py")
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+###########################################################################
+#                                                                         #
+#    Input conditions data (AutoCorr, CaliWave) for COOL and/or POOL      #
+#                                                                         #
+###########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+include ("LArCalibProcessing/LArCalib_BadChanTool.py")
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   OFCLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   OFCLog.info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB   
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+if ( ReadAutoCorrFromCOOL or ReadPhysWaveFromCOOL ):
+   if not ('InputAutoCorrSQLiteFile')  in dir():
+      OFCLog.info( "Read AutoCorr from Oracle" )
+   else :
+      OFCLog.info( "Read AutoCorr from SQLite file" )
+      
+   if not ('InputPhysWaveSQLiteFile')  in dir():
+      OFCLog.info( "Read PhysWave from Oracle DB" )
+   else :
+      OFCLog.info( "Read PhysWave from SQLite file" )
+      
+if ( ReadAutoCorrFromCOOL ):
+   AutoCorrFolder  = LArCalib_Flags.LArAutoCorrFolder
+   if 'AutoCorrLArCalibFolderTag' in dir():
+      
+      AutoCorrTagSpec = LArCalibFolderTag(AutoCorrFolder,AutoCorrLArCalibFolderTag)
+      conddb.addFolder("",AutoCorrFolder+"<tag>"+AutoCorrTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionAutoCorr+"</dbConnection>"+ ChannelSelection)
+   else :
+      conddb.addFolder("",AutoCorrFolder+"<dbConnection>"+InputDBConnectionAutoCorr+"</dbConnection>"+ ChannelSelection)
+else:
+   if 'InputAutoCorrPoolFileName' in dir():
+      OFCLog.info( "Read AutoCorr from POOL file")
+      PoolFileList += [ InputAutoCorrPoolDir+"/"+InputAutoCorrPoolFileName ]
+   else:
+      OFCLog.info( "No PoolFileList found! Please list the POOL files containing AutoCorrelation Matrix or read from COOL." )
+      theApp.exit(-1)      
+      
+if ( ReadPhysWaveFromCOOL ):
+   PhysWaveFolder  = LArCalib_Flags.LArPhysWaveFolder
+   if not (isFCAL) :
+      if (doPhysWaveShifter) :
+         if 'PhysWaveLArCalibFolderTag' in dir() :
+            PhysWaveTagSpec = LArCalibFolderTag(PhysWaveFolder,PhysWaveLArCalibFolderTag)
+            conddb.addFolder("",PhysWaveFolder+"<key>"+InputKey+"</key><tag>"+PhysWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPhysWave+"</dbConnection>" + ChannelSelection)
+         else :
+            conddb.addFolder("",PhysWaveFolder+"<key>"+InputKey+"</key><dbConnection>"+InputDBConnectionPhysWave+"</dbConnection>" + ChannelSelection)
+      else :
+         if 'PhysWaveLArCalibFolderTag' in dir() :
+            PhysWaveTagSpec = LArCalibFolderTag(PhysWaveFolder,PhysWaveLArCalibFolderTag)
+            conddb.addFolder("",PhysWaveFolder+"<tag>"+PhysWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPhysWave+"</dbConnection>" + ChannelSelection)
+         else :
+            conddb.addFolder("",PhysWaveFolder+"<dbConnection>"+InputDBConnectionPhysWave+"</dbConnection>" + ChannelSelection)
+   else :
+      if 'PhysWaveLArCalibFolderTag' in dir() :
+         PhysWaveTagSpec = LArCalibFolderTag(PhysWaveFolder,PhysWaveLArCalibFolderTag)
+         conddb.addFolder("",PhysWaveFolder+"<key>"+InputKey+"</key><tag>"+PhysWaveTagSpec+"</tag><dbConnection>"+InputDBConnectionPhysWave+"</dbConnection>" + ChannelSelection)
+      else :
+         PhysWaveFolderFCAL="/LAR/ElecCalibOfl/PhysWaves/FCALFromTB"
+         conddb.addFolder("",PhysWaveFolderFCAL+"<key>"+InputKey+"</key><dbConnection>"+InputDBConnectionPhysWave+"</dbConnection>" + ChannelSelection)
+         
+else:
+   if 'InputPhysWavePoolFileName' in dir():
+      OFCLog.info( "Read PhysWave from POOL file" )
+      PoolFileList += [ InputPhysWavePoolDir+"/"+InputPhysWavePoolFileName ]
+   else:
+      OFCLog.info( "No PoolFileList found! Please list the POOL files containing CaliWave or read from COOL." )
+      theApp.exit(-1)
+
+
+
+
+if (UsePhysCaliTdiff):
+   if ( ReadPhysCaliTdiffFromCOOL ):
+      PhysCaliTdiffFolder  = LArCalib_Flags.LArPhysCaliTdiffFolder
+      if 'PhysCaliTdiffLArCalibFolderTag' in dir() :
+         PhysCaliTdiffTagSpec = LArCalibFolderTag(PhysCaliTdiffFolder,PhysCaliTdiffLArCalibFolderTag)
+         conddb.addFolder("",PhysCaliTdiffFolder+"<key>"+PhysCaliTdiffKey+"</key><tag>"+PhysCaliTdiffTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPhysCaliTdiff+"</dbConnection>" + ChannelSelection)
+      else :
+         conddb.addFolder("",PhysCaliTdiffFolder+"<key>"+PhysCaliTdiffKey+"</key><dbConnection>"+InputDBConnectionPhysCaliTdiff+"</dbConnection>" + ChannelSelection)
+   else: 
+      if 'InputPhysCaliTdiffPoolFileName' in dir():
+         OFCLog.info( "Read PhysCaliTdiff from POOL file" )
+         PoolFileList += [ InputPhysCaliTdiffPoolDir+"/"+InputPhysCaliTdiffPoolFileName ]
+      else:
+         OFCLog.info( "No PoolFileList found! Please list the POOL files containing PhysCaliTdiff or read from COOL." )
+         theApp.exit(-1)
+
+
+if ( len(PoolFileList)>0 ):
+
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+
+if (doPhysWaveShifter) :
+
+   ###########################################################################
+   #                                                                         #
+   #                 Shift physics waveforms only for FCAL                   #
+   #                                                                         # 
+   ###########################################################################
+   from LArCalibUtils.LArCalibUtilsConf import LArPhysWaveShifter
+   LArPhysWaveShifter                        = LArPhysWaveShifter("LArPhysWaveShifter")
+   
+   LArPhysWaveShifter.KeyList                = [ InputKey ]
+   LArPhysWaveShifter.KeyOutput              = ContainerKey
+   LArPhysWaveShifter.GroupingType           = GroupingType
+   
+   #
+   # Minimum Tstart per FEB computation
+   #
+   LArPhysWaveShifter.ComputeTimeShiftByFEB  = True
+   LArPhysWaveShifter.TimeShiftByFEBMode     = ShiftMode
+   LArPhysWaveShifter.TimeShiftByFEBDump     = True
+   LArPhysWaveShifter.TimeShiftByFEBDumpFile = "TimeShiftFEB.py"
+   
+   #
+   # Possible time shifts
+   #
+   LArPhysWaveShifter.TimeShiftByHelper      = False
+   LArPhysWaveShifter.TimeShiftByIndex       = 0
+   LArPhysWaveShifter.TimeShiftByLayer       = False
+   LArPhysWaveShifter.TshiftLayer            = [ 0 , 0 , 0 , 0 ]
+   LArPhysWaveShifter.TimeShiftFromPeak      = False
+   LArPhysWaveShifter.NindexFromPeak         = 0 # if 0 will use Ndelays*Nsampling
+   LArPhysWaveShifter.Ndelays                = 24
+   LArPhysWaveShifter.Nsamplings             = Nsamplings 
+   LArPhysWaveShifter.TimeShiftByFEB         = True
+   LArPhysWaveShifter.TimeShiftGuardRegion   = TimeShiftGuardRegion
+   LArPhysWaveShifter.UsePhysCaliTdiff       = UsePhysCaliTdiff
+
+   topSequence += LArPhysWaveShifter   
+
+###########################################################################
+#                      OFC computation
+###########################################################################
+
+from LArCalibUtils.LArCalibUtilsConf import LArOFCAlg
+LArPhysOFCAlg = LArOFCAlg("LArPhysOFCAlg")
+LArPhysOFCAlg.ReadCaliWave = False
+LArPhysOFCAlg.KeyList   = [ ContainerKey ]
+LArPhysOFCAlg.Nphase    = Nphases
+LArPhysOFCAlg.Dphase    = Dphases
+LArPhysOFCAlg.Ndelay    = Ndelays
+LArPhysOFCAlg.Nsample   = Nsamples
+LArPhysOFCAlg.Normalize = Normalize
+LArPhysOFCAlg.TimeShift = TimeShift
+LArPhysOFCAlg.TimeShiftByIndex = TimeShiftByIndex
+LArPhysOFCAlg.Verify    = True
+LArPhysOFCAlg.FillShape = FillShape
+if ( doOFCPicker):
+   LArPhysOFCAlg.KeyOFC    = "tempOFC"
+   LArPhysOFCAlg.KeyShape  = "tempShape"
+else:
+    LArPhysOFCAlg.KeyOFC   = OFCKey
+    LArPhysOFCAlg.KeyShape = ShapeKey
+    
+if ( DumpOFC ) :
+	LArPhysOFCAlg.DumpOFCfile = "LArOFCPhys.dat"
+LArPhysOFCAlg.GroupingType = GroupingType
+topSequence+=LArPhysOFCAlg
+
+from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrDecoderTool
+theLArAutoCorrDecoderTool = LArAutoCorrDecoderTool()
+ToolSvc += theLArAutoCorrDecoderTool
+
+
+if ( doOFCPicker):
+   conddb.addFolder("","/LAR/ElecCalibOfl/OFCBin/Dummy<dbConnection>"+DBConnectionCOOL+"</dbConnection>"+ ChannelSelection)
+   from LArCalibUtils.LArCalibUtilsConf import LArOFPhasePicker
+   LArOFPhasePicker = LArOFPhasePicker("LArOFPhasePicker")
+   LArOFPhasePicker.KeyPhase = "LArOFCPhase"
+   LArOFPhasePicker.KeyOFC_new = OFCKey
+   LArOFPhasePicker.KeyOFC = "tempOFC"
+
+   LArOFPhasePicker.KeyShape_new = ShapeKey
+   LArOFPhasePicker.KeyShape_newcorr = ShapeKeyCorr
+   LArOFPhasePicker.KeyShape = "tempShape"
+   LArOFPhasePicker.KeyShapeResidual = "LArResiduals"
+   LArOFPhasePicker.doShapeCorrection = FillShapeCorr
+
+   LArOFPhasePicker.GroupingType = GroupingType
+   LArOFPhasePicker.DefaultPhase = DefaultPhase
+   LArOFPhasePicker.TimeOffsetCorrection = TimeOffsetCorrection
+   topSequence += LArOFPhasePicker
+
+
+
+
+###########################################################################
+
+if ( WriteNtuple ) :
+
+   from LArCalibTools.LArCalibToolsConf import LArOFC2Ntuple
+   LArOFC2Ntuple = LArOFC2Ntuple("LArOFC2Ntuple")
+   #LArOFC2Ntuple.ContainerKey = "tempOFC"
+   LArOFC2Ntuple.ContainerKey = OFCKey
+   LArOFC2Ntuple.AddFEBTempInfo   = False   
+   topSequence+=LArOFC2Ntuple
+
+
+   if ( doPhysWaveShifter ):
+      from LArCalibTools.LArCalibToolsConf import LArFebTimeOffset2Ntuple
+      LArFebTimeOffset2Ntuple                = LArFebTimeOffset2Ntuple( "LArFebTimeOffset2Ntuple" )
+      LArFebTimeOffset2Ntuple.ContainerKey   = "FebTimeOffset"
+      LArFebTimeOffset2Ntuple.AddFEBTempInfo   = False
+
+      topSequence+=LArFebTimeOffset2Ntuple
+   
+
+   if ( FillShape ):
+      from LArCalibTools.LArCalibToolsConf import LArShape2Ntuple
+      LArShape2Ntuple = LArShape2Ntuple("LArShape2Ntuple")
+      LArShape2Ntuple.ContainerKey = ShapeKey
+      #LArShape2Ntuple.ContainerKey =  "tempShape"
+      LArShape2Ntuple.AddFEBTempInfo   = False   
+      topSequence+=LArShape2Ntuple
+
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputOFCRootFileDir+"/"+OutputOFCRootFileName): 
+      os.remove(OutputOFCRootFileDir+"/"+OutputOFCRootFileName)
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputOFCRootFileDir+"/"+OutputOFCRootFileName+"' OPT='NEW'" ]
+   
+if (  WritePoolFile ) :
+   
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   if os.path.exists(OutputPoolFileDir+"/"+OutputPoolFileName): 
+      os.remove(OutputPoolFileDir+"/"+OutputPoolFileName)
+   OutputConditionsAlg = OutputConditionsAlg("OutputConditionsAlg",OutputPoolFileDir+"/"+OutputPoolFileName,
+                                                [OutputObjectSpecOFC],[OutputObjectSpecTagOFC],WriteIOV)
+   OutputConditionsAlg.Run1     = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlg.Run2  = IOVEnd
+	
+   if ( FillShape ):
+      OutputConditionsAlg.ObjectList += [OutputObjectSpecShape]
+      OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagShape]
+
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+   
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+  		
+###########################################################################
+#               Use EventSelector to select IOV                           #
+###########################################################################	
+
+from McEventSelector.McEventSelectorConf import McEventSelector
+svcMgr += McEventSelector("EventSelector")
+svcMgr.EventSelector.RunNumber	= int(RunNumber)
+svcMgr.EventSelector.EventsPerRun      = 1
+svcMgr.EventSelector.FirstEvent	= 1
+svcMgr.EventSelector.InitialTimeStamp  = 0
+svcMgr.EventSelector.TimeStampInterval = 1
+
+##########################################################################
+#          don't remove otherwise infinite loop                          #
+##########################################################################
+
+theApp.EvtMax = 1
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = VERBOSE)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = DEBUG)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Patching_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Patching_jobOptions.py
new file mode 100644
index 00000000000..a59b7e9d326
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Patching_jobOptions.py
@@ -0,0 +1,228 @@
+include("LArCalibProcessing/LArCalib_Flags.py")
+
+if 'Runnumber' not in dir():
+    Runnumber=2147483647
+
+globaltag="LARCALIB-000-02"
+
+if "Objects" not in dir():
+    Objects=["RAMP"]#,"CALIWAVE"]
+
+if "sqlite" in dir():
+    InputDB="sqlite://;schema="+sqlite+";dbname=COMP200"
+else:
+    InputDB="COOLOFL_LAR/COMP200"
+
+
+if "output" in dir():
+    OutputDB="sqlite://;schema="+output+";dbname=COMP200"
+else:
+    if "sqlite" in dir():
+        OutputDB=InputDB
+    else:
+        OutputDB="sqlite://;schema=AdditionalCorrections.db;dbname=COMP200"
+
+if 'poolcat' not in dir() and os.access("freshConstants.xml",os.R_OK):
+    poolcat="freshConstants.xml"
+
+if 'Partitions' not in dir():
+    Partitions=['EMB','EC'] #means all
+if 'Gains' not in dir():
+    Gains=[0,1,2]
+
+if not "WriteNtuple" in dir():
+    WriteNtuple=True
+
+
+doCW=False
+doCWxtalk=False
+doRamp=False
+
+for obj in Objects:
+  if upper(obj).startswith("RAMP"):
+    doRamp=True
+
+  elif upper(obj).startswith("CALIWAVE"):
+    for p in Partitions:
+        if p.startswith("E"): doCWxtalk=True
+        #if (p.startswith("EC") or p.startswith("HEC") or p.startswith("FCAL")): doCW=True
+        if (p.startswith("HEC") or p.startswith("FCAL")): doCW=True
+    if doCW and doCWxtalk:
+        print "ERROR: Can't do CaliWave patching for partitions",Partitions,"in one go."
+        sys.exit(-1)
+
+inputFolders=[]
+if doRamp:
+    inputFolders+=[LArCalib_Flags.LArRampFolder]
+
+if doCW:
+    inputFolders+=[ LArCalib_Flags.LArCaliWaveFolder]
+elif doCWxtalk:
+    inputFolders+=[ LArCalib_Flags.LArCaliWaveFolderXtlk]
+
+
+from LArConditionsCommon.LArExtendedSubDetGrouping import LArExtendedSubDetGrouping
+g=LArExtendedSubDetGrouping()
+g.setWithCorr(False) #ingore correction channels
+sel=g.getChannelSelection(Partitions,Gains)
+ccs="<channelSelection>"+sel+"</channelSelection>"
+
+from LArCalibProcessing.extractFolderInfo import *
+folderInfo=extractFolderInfo(InputDB,globaltag,inputFolders,Runnumber,sel)
+if folderInfo is None:
+    print "Failed to inspect database",InputDB
+    sys.exit(-1)
+
+print folderInfo
+import AthenaCommon.AtlasUnixGeneratorJob #use MC event selector
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()  
+
+
+from AthenaCommon.GlobalFlags import globalflags
+globalflags.DataSource="data"
+globalflags.InputFormat="bytestream"
+
+from AthenaCommon.JobProperties import jobproperties
+jobproperties.Global.DetDescrVersion = "ATLAS-GEO-18-00-00"
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.Calo_setOff()
+DetFlags.ID_setOff()
+DetFlags.Muon_setOff()
+DetFlags.Truth_setOff()
+DetFlags.LVL1_setOff()
+DetFlags.digitize.all_setOff()
+
+#Set up GeoModel (not really needed but crashes without)
+from AtlasGeoModel import SetGeometryVersion
+from AtlasGeoModel import GeoModelInit 
+from AtlasGeoModel import SetupRecoGeometry
+
+#Get identifier mapping (needed by LArConditionsContainer)
+include( "LArConditionsCommon/LArIdMap_comm_jobOptions.py" )
+
+conddb.addFolder("LAR_OFL","/LAR/BadChannelsOfl/BadChannels<key>/LAR/BadChannels/BadChannels</key>")
+conddb.addFolder("LAR_OFL","/LAR/BadChannelsOfl/MissingFEBs<key>/LAR/BadChannels/MissingFEBs</key>")
+svcMgr.IOVDbSvc.GlobalTag=globaltag
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+theApp.EvtMax = 1
+svcMgr.EventSelector.RunNumber = Runnumber
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+if 'poolcat' in dir():
+    svcMgr.PoolSvc.WriteCatalog="xmlcatalog_file:"+poolcat
+
+IOVstart=Runnumber
+IOVend=0
+OutputObjectSpec=[]
+OutputTagSpec=[]
+
+print folderInfo
+
+for f in folderInfo:
+  fn=f[0]
+  type=f[1]
+  key=f[2]
+  tag=f[3]
+  since=f[4]
+  until=f[5]
+  print "Working on folder",fn,"IOV:",since,"-",until
+  OutputObjectSpec+=["#".join((type,key,fn))]
+  OutputTagSpec+=[tag]
+  if since<IOVstart: IOVstart=since
+  if until>IOVend: IOVend=until
+  conddb.addFolder("",fn+"<key>"+key+"Input</key><tag>"+tag+"</tag><db>"+InputDB+"</db>"+ccs)
+
+
+print OutputObjectSpec
+
+
+i=0
+outputFileName="AdditionalCorrections_%i_%i.pool.root" % (IOVstart,i)
+while (os.access(outputFileName,os.F_OK)):
+    i=i+1     
+    outputFileName="AdditionalCorrections_%i_%i.pool.root" % (IOVstart,i)
+
+outputRootFileName="AdditionalCorrections_%i_%i.root" % (IOVstart,i)
+while (os.access(outputRootFileName,os.F_OK)):
+    i=i+1     
+    outputRootFileName="AdditionalCorrections_%i_%i.root" % (IOVstart,i)
+
+
+from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
+theLArBadChannelTool=LArBadChanTool()
+#theLArBadChannelTool.OutputLevel=DEBUG
+ToolSvc+=theLArBadChannelTool
+
+from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+theLArRCBMasker=LArBadChannelMasker("LArRCBMasker")
+theLArRCBMasker.DoMasking=True
+theLArRCBMasker.ProblemsToMask=[
+    "deadCalib","deadReadout","deadPhys","almostDead","short",
+    "highNoiseHG","highNoiseMG","highNoiseLG"
+    ]
+ToolSvc+=theLArRCBMasker
+
+
+if doRamp:
+  #Algo:
+  from LArCalibUtils.LArCalibUtilsConf import LArCalibPatchingAlg_LArRampComplete_
+  theLArRampPatcher=LArCalibPatchingAlg_LArRampComplete_("LArRampPatcher")
+  theLArRampPatcher.ContainerKey="LArRampInput"
+  theLArRampPatcher.NewContainerKey="LArRamp"
+  theLArRampPatcher.PatchMethod="PhiAverage"
+  #theLArRampPatcher.OutputLevel=DEBUG
+  theLArRampPatcher.MaskingTool=theLArRCBMasker
+  topSequence+=theLArRampPatcher
+
+  if doCW or doCWxtalk:
+    from LArCalibUtils.LArCalibUtilsConf import LArCalibPatchingAlg_LArCaliWaveContainer_
+    theLArCaliWavePatcher=LArCalibPatchingAlg_LArCaliWaveContainer_("LArCaliWavePatcher")
+    theLArCaliWavePatcher.ContainerKey="LArCaliWaveInput"
+    theLArCaliWavePatcher.NewContainerKey="LArCaliWave"
+    theLArCaliWavePatcher.PatchMethod="PhiAverage"
+    #theLArCaliWavePatcher.OutputLevel=DEBUG
+    theLArCaliWavePatcher.MaskingTool=theLArRCBMasker
+    topSequence+=theLArCaliWavePatcher
+  
+
+from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg", outputFileName,
+                                           OutputObjectSpec,OutputTagSpec,True)
+
+theOutputConditionsAlg.Run1 = IOVstart
+theOutputConditionsAlg.Run2 = IOVend
+svcMgr.IOVDbSvc.dbConnection  = OutputDB
+
+from AthenaCommon.AppMgr import ServiceMgr
+from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+svcMgr += IOVRegistrationSvc()
+svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+svcMgr.IOVRegistrationSvc.RecreateFolders = False
+
+
+if WriteNtuple:
+    from LArCalibTools.LArCalibToolsConf import LArRamps2Ntuple
+    LArRamps2Ntuple=LArRamps2Ntuple("LArRamps2Ntuple")
+    LArRamps2Ntuple.NtupleName = "RAMPS"
+    LArRamps2Ntuple.RawRamp = False
+    LArRamps2Ntuple.ApplyCorr = True
+    
+
+
+
+
+
+svcMgr.DetectorStore.Dump=True
+
+ToolSvc.LArBadChanTool.OutputLevel=DEBUG
+svcMgr.IOVDbSvc.OutputLevel=DEBUG
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py
new file mode 100644
index 00000000000..4968244c36c
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py
@@ -0,0 +1,635 @@
+import commands
+
+###############################################################################
+#
+# <Marco.Delmastro@cern.ch>
+#
+# Example jobOptions to reconstruction one or more pedestal runs from data
+#                                                                             
+# Last update: 09/12/2008 <Fabien.Tarrade@cern.ch>                
+#                                                                         
+###############################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+include("RecExCommission/GetInputFiles.py")
+
+#######################################################
+#                Run properties
+#######################################################
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"
+   
+if not 'RunNumberList' in dir():
+   RunNumberList = [ '0026924' ]
+
+if not 'FilePrefix' in dir():
+   if (int(RunNumberList[0]))<99800 :
+      FilePrefix = "daq.Pedestal"
+   else :
+      FilePrefix = "data*"
+   
+if not 'InputDir' in dir():
+   InputDir = "/castor/cern.ch/grid/atlas/DAQ/lar/ElecCalib/2011/"+RunNumberList[0]
+            
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"     
+
+if not 'FullFileName' in dir():
+   if 'Trigger' not in dir():
+      if (int(RunNumberList[0]))<99800 :
+         Trigger = "*"+Partition
+      else :
+         Trigger = "calibration_LArElec-Pedestal"+".*"+Partition
+         # Hack to allow ALL pedestals read properly
+         Trigger = "calibration_LArElec-Pedestal"+".*"
+
+      
+   FullFileName =[]
+   for RunNumber in RunNumberList :
+       FullFileName+=GetInputFilesFromTokens(InputDir,int(RunNumber),FilePrefix,Trigger)
+ 
+       
+if not 'GainList' in dir():
+   GainList = [ "HIGH", "MEDIUM", "LOW" ]
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+
+if not 'ChannelSelection' in dir():
+   # read all
+   ChannelSelection = " "
+   ## example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,3:34</channelSelection>"   
+
+if not 'runAccumulator' in dir(): 
+   runAccumulator = False # averaged mode
+
+from string import *
+def DBConnectionFile(sqlitefile):
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+
+#######################################################
+#                Monitoring properties
+#######################################################
+
+if not 'doMonitoring' in dir():
+   doMonitoring = True
+
+## LArFEBMon
+if not 'doLArFEBMon' in dir():
+   doLArFEBMon = True
+
+## LArOddCellMonTool
+if not 'doLArOddCellMonTool' in dir():
+   doLArOddCellMonTool= False
+
+## LArScaNoiseTool
+if not 'doLArScaNoiseTool' in dir():
+   doLArScaNoiseTool = False
+
+### LArDigitNoiseMonTool
+#if not 'doLArDigitNoiseMonTool' in dir():
+#   doLArDigitNoiseMonTool= False
+   
+if not 'doLArCalibDataQuality' in dir():
+   doLArCalibDataQuality = True
+
+if not 'online' in dir():
+   online = False
+   
+#######################################################
+#       Pedestal and AutoCorrelation  properties
+#######################################################
+
+if not 'Pedestal' in dir():
+   Pedestal = True
+   
+if not 'AutoCorr' in dir():
+   AutoCorr = True
+   
+if not 'EventsRef' in dir():
+   EventsRef     = 0
+   
+if not 'NSigma' in dir():
+   NSigma = 5
+
+if not 'NSamples' in dir():
+   NSamples = 32   
+   
+if not 'WhichSample' in dir():
+   WhichSample = -1
+
+#######################################################
+#      Pedestal and AutoCorrelation  output name
+#######################################################
+
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumberList[0])
+   
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd
+
+if not 'DBConnectionCOOL' in dir():  
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"   
+
+if not 'OutputPedAutoCorrRootFileDir' in dir():
+   OutputPedAutoCorrRootFileDir  = commands.getoutput("pwd")
+   
+if not 'OutputPedAutoCorrPoolFileDir' in dir():
+   OutputPedAutoCorrPoolFileDir  = commands.getoutput("pwd")
+
+if not 'PedLArCalibFolderTag' in dir():
+   rs=FolderTagResover()
+   PedLArCalibFolderTag = rs.getFolderTagSuffix(LArCalib_Flags.LArPedestalFolder)
+   ACLArCalibFolderTag = rs.getFolderTagSuffix(LArCalib_Flags.LArAutoCorrFolder)
+   del rs #Close DB connection
+   
+   
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)   
+
+if not 'KeyOutputAC' in dir():  
+   KeyOutputAC      = "LArAutoCorr" 
+
+if not 'KeyOutputPed' in dir():  
+   KeyOutputPed      = "Pedestal" # need Pedestal to merge with oracle, LArPedestal doesn't work
+
+if not 'BaseFileNamePedAutoCorr' in dir():
+   BaseFileNamePedAutoCorr = "LArPedAutoCorr"
+    
+for RunNumber in RunNumberList :
+   BaseFileNamePedAutoCorr = BaseFileNamePedAutoCorr + "_"
+   BaseFileNamePedAutoCorr = BaseFileNamePedAutoCorr + str(RunNumber)+"_"+Partition.replace("*","") 
+   
+if not 'OutputPedAutoCorrRootFileName' in dir():
+   OutputPedAutoCorrRootFileName  = BaseFileNamePedAutoCorr+ ".root"
+    
+if not 'OutputPedAutoCorrPoolFileName' in dir():
+   OutputPedAutoCorrPoolFileName  = BaseFileNamePedAutoCorr + ".pool.root"
+
+if not 'OutputObjectSpecPed' in dir():
+   OutputObjectSpecPed = "LArPedestalComplete#"+KeyOutputPed+"#"+LArCalib_Flags.LArPedestalFolder
+   OutputTagSpecPed=LArCalibFolderTag(LArCalib_Flags.LArPedestalFolder,PedLArCalibFolderTag)
+
+if not 'OutputObjectSpecAutoCorr' in dir():
+   OutputObjectSpecAutoCorr = "LArAutoCorrComplete#"+KeyOutputAC+"#"+LArCalib_Flags.LArAutoCorrFolder
+   OutputTagSpecAutoCorr=LArCalibFolderTag(LArCalib_Flags.LArAutoCorrFolder,ACLArCalibFolderTag)
+
+## Bad Channel   
+   
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;"
+      InputDBConnectionBadChannel = "COOLOFL_LAR/COMP200"
+
+#######################################################################################
+# print summary
+#######################################################################################
+
+PedestalAutoCorrLog = logging.getLogger( "PedestalAutoCorrLog" )
+PedestalAutoCorrLog.info( " ======================================================== " )
+PedestalAutoCorrLog.info( " ***           LAr Pedestal/AutoCorr summary          *** " )
+PedestalAutoCorrLog.info( " ======================================================== " )
+PedestalAutoCorrLog.info( " RunNumber                         = "+str(RunNumberList) )
+PedestalAutoCorrLog.info( " SubDetector                       = "+SubDet )
+PedestalAutoCorrLog.info( " Partition                         = "+Partition )
+PedestalAutoCorrLog.info( " Type                              = Pedestal " )
+PedestalAutoCorrLog.info( " LArGain                           = "+str(GainList) )
+for i in range(len(FullFileName)):
+   PedestalAutoCorrLog.info( " FullFileName                      = "+FullFileName[i] )
+PedestalAutoCorrLog.info( " PedLArCalibFolderTag              = "+PedLArCalibFolderTag )
+PedestalAutoCorrLog.info( " OutputPedAutoCorrRootFullFileName = "+OutputPedAutoCorrRootFileDir + "/" + OutputPedAutoCorrRootFileName )
+PedestalAutoCorrLog.info( " OutputPedAutoCorrPoolFullFileName    = "+OutputPedAutoCorrPoolFileDir + "/" + OutputPedAutoCorrPoolFileName )
+PedestalAutoCorrLog.info( " OutputObjectSpecPed               = "+OutputObjectSpecPed )
+PedestalAutoCorrLog.info( " OutputTagSpecPed                  = "+OutputTagSpecPed )
+PedestalAutoCorrLog.info( " OutputObjectSpecAutoCorr          = "+OutputObjectSpecAutoCorr )
+PedestalAutoCorrLog.info( " OutputTagSpecAutoCorr             = "+OutputTagSpecAutoCorr )
+PedestalAutoCorrLog.info( " IOVBegin                          = "+str(IOVBegin) )
+PedestalAutoCorrLog.info( " IOVEnd                            = "+str(IOVEnd) )
+PedestalAutoCorrLog.info( " LArCalibOutputDB                  = "+OutputDB )
+PedestalAutoCorrLog.info( " ======================================================== " )
+
+#######################################################################################
+include ("LArConditionsCommon/LArMinimalSetup.py")
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+theByteStreamInputSvc=svcMgr.ByteStreamInputSvc
+if not 'FullFileName' in dir():
+   PedestalAutoCorrLog.info( "No FullFileName! Please give a FullFileName list")
+   theApp.exit(-1)
+else :   
+   theByteStreamInputSvc.FullFileName=FullFileName
+   
+theByteStreamInputSvc.MaxBadEvents=0
+
+##############################################################################################
+#                                                                                            #
+# FullFileName is already the list of files compute by the fonction GetInputFilesFromTokens  #
+#                                                                                            #
+# maybe useful one day                                                                       #
+#                                                                                            #
+# else                                                                                        #
+#   theByteStreamInputSvc.FullFileName=OneFileName                                           #
+#   for i in range(len(theByteStreamInputSvc.FullFileName)):                                 #
+#      theByteStreamInputSvc.NumFile+=[10000]                                                #
+##############################################################################################
+
+
+###############################################################
+#                                                             #
+#                To read BS for one or more FT                #
+#                                                             #
+###############################################################
+
+## For splitting the delay runs, there are three new jobOptions.
+## All three are vectors of integers
+#################################################################
+
+from LArByteStream.LArByteStreamConf import LArRodDecoder
+svcMgr.ToolSvc += LArRodDecoder()
+
+#ToolSvc.LArRodDecoder.BEPreselection     = [0]                                                   ## : [Barrel=0,Endcap=1]
+#ToolSvc.LArRodDecoder.PosNegPreselection = [1]                                                   ## : [C-side (negative eta)=0, A-side (positive eta)=1]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]               ## : first half of [EM barrel feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]     ## : second half of [EM barrel feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [0,1,4,7,8,11,12,13,14,17,18,19,20,23,24]             ## : [EMEC Standard feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [2,9,15,21]                                           ## : [EMEC Special feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [3,10,16,22]                                          ## : [HEC feedthrough numbers]  (note: slots 1&2 are EMEC slots)
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [6]                                                   ## : [FCAL feedthrough number]
+
+theByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
+theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
+
+theByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/HIGH"]
+theByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/MEDIUM"]
+theByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/LOW"]
+
+theByteStreamAddressProviderSvc.TypeNames += ["LArAccumulatedDigitContainer/HIGH"]
+theByteStreamAddressProviderSvc.TypeNames += ["LArAccumulatedDigitContainer/MEDIUM"]
+theByteStreamAddressProviderSvc.TypeNames += ["LArAccumulatedDigitContainer/LOW"]
+
+
+## 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
+from LArCalibDataQuality.LArCalibDataQualityConf import LArBadEventCatcher
+theLArBadEventCatcher=LArBadEventCatcher()
+theLArBadEventCatcher.CheckAccCalibDigitCont=True
+theLArBadEventCatcher.CheckBSErrors=True
+theLArBadEventCatcher.KeyList=GainList
+theLArBadEventCatcher.StopOnError=False
+topSequence+=theLArBadEventCatcher 
+
+#######################################################
+#                                                     #
+#      Pedestal run reconstruction                    #
+#                                                     #
+#######################################################
+
+include ("LArCalibProcessing/LArCalib_BadChanTool.py")
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   PedestalAutoCorrLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   PedestalAutoCorrLog.info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+# Temperature folder
+conddb.addFolder("DCS_OFL","/LAR/DCS/FEBTEMP")
+svcMgr.EventSelector.InitialTimeStamp = 1284030331
+import cx_Oracle
+import time
+import datetime
+connection=cx_Oracle.connect("ATLAS_SFO_T0_R/readmesfotz2008@atlr")
+cursor=connection.cursor()
+sRequest=("SELECT RUNNR,CREATION_TIME FROM SFO_TZ_RUN WHERE RUNNR='%s'")%(RunNumberList[0])
+cursor.execute(sRequest)
+times= cursor.fetchall()
+d=times[0][1]
+iovtemp=int(time.mktime(d.timetuple()))
+#print "Setting timestamp for run ",RunNumberList[0]," to ",iovtemp
+#svcMgr.IOVDbSvc.forceTimestamp = 1283145454
+svcMgr.IOVDbSvc.forceTimestamp = iovtemp
+
+if ( doLArCalibDataQuality  ) :
+   if  Pedestal :
+      ## The reference is the Oracle DB
+      conddb.addFolder("LAR_ONL","/LAR/ElecCalibOnl/Pedestal<key>PedestalRef</key>"+ChannelSelection)
+
+   if AutoCorr :
+      ## The reference is the Oracle DB
+      conddb.addFolder("",LArCalib_Flags.LArAutoCorrFolder+"<key>LArAutoCorrRef</key><dbConnection>"+DBConnectionCOOL+"</dbConnection>"+ChannelSelection)
+
+
+if runAccumulator:
+   if Pedestal :
+      from LArCalibUtils.LArCalibUtilsConf import LArPedestalMaker
+      LArPedestalMaker=LArPedestalMaker("LArPedestalMaker")
+      LArPedestalMaker.events_ref   = EventsRef
+      LArPedestalMaker.nsigma       = NSigma
+      LArPedestalMaker.which_sample = WhichSample
+      LArPedestalMaker.KeyList      = GainList
+      LArPedestalMaker.KeyOutput    = KeyOutputPed
+      LArPedestalMaker.GroupingType = GroupingType
+
+      topSequence += LArPedestalMaker
+
+   if AutoCorr :
+      from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrMaker
+      LArAutoCorrMaker=LArAutoCorrMaker("LArAutoCorrMaker")
+      LArAutoCorrMaker.KeyList = GainList
+      LArAutoCorrMaker.events_ref = EventsRef
+      LArAutoCorrMaker.nsigma     = NSigma
+      LArAutoCorrMaker.Nsamples     = NSamples
+      LArAutoCorrMaker.KeyOutput  = KeyOutputAC
+      LArAutoCorrMaker.GroupingType = GroupingType
+   
+      topSequence += LArAutoCorrMaker
+
+else :
+      # pre computation in the DSP
+      from LArCalibUtils.LArCalibUtilsConf import LArPedestalAutoCorrBuilder
+      LArPedACBuilder=LArPedestalAutoCorrBuilder("LArPedestalAutoCorrBuilder")
+      LArPedACBuilder.KeyList         = GainList
+      LArPedACBuilder.PedestalKey     = KeyOutputPed
+      LArPedACBuilder.AutoCorrKey     = KeyOutputAC      
+      LArPedACBuilder.GroupingType    = GroupingType
+      
+      topSequence += LArPedACBuilder
+
+      
+######################################################################
+#                                                                    #
+#                          Output                                    #
+#                                                                    #
+######################################################################
+
+if ( doLArCalibDataQuality  ) :
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   theLArPedValBCMask=LArBadChannelMasker("PedValBCMask",
+                                          DoMasking=True,
+                                          ProblemsToMask=[]
+                                          )
+   svcMgr.ToolSvc+=theLArPedValBCMask
+   theLArACValBCMask=LArBadChannelMasker("ACValBCMask",
+                                          DoMasking=True,
+                                          ProblemsToMask=[]
+                                          )
+   svcMgr.ToolSvc+=theLArACValBCMask
+   
+   if  Pedestal :
+      from LArCalibDataQuality.Thresholds import pedThr,rmsThr, pedThrFEB,rmsThrFEB
+      from LArCalibDataQuality.LArCalibDataQualityConf import LArPedestalValidationAlg
+      thePedestalValidationAlg=LArPedestalValidationAlg("PedestalVal")
+      thePedestalValidationAlg.BadChannelMaskingTool=theLArPedValBCMask
+      thePedestalValidationAlg.ValidationKey="Pedestal"
+      thePedestalValidationAlg.ReferenceKey="PedestalRef"
+      thePedestalValidationAlg.PedestalTolerance=pedThr
+      thePedestalValidationAlg.PedestalRMSTolerance=rmsThr
+      thePedestalValidationAlg.PedestalToleranceFEB=pedThrFEB
+      thePedestalValidationAlg.PedestalRMSToleranceFEB=rmsThrFEB
+      thePedestalValidationAlg.MsgLevelForDeviations=WARNING
+      thePedestalValidationAlg.ListOfDevFEBs="pedFebs.txt"
+      thePedestalValidationAlg.CheckCompletness=True
+      thePedestalValidationAlg.PatchMissingFEBs=True
+      thePedestalValidationAlg.CheckNumberOfCoolChannels=True
+      thePedestalValidationAlg.UseCorrChannels=False #Corrections go into the regular data channels
+      topSequence+=thePedestalValidationAlg
+
+      ## second instance of the validation tool to detect "bad" channel
+      theBadPedestal=LArPedestalValidationAlg("PedestalFail")
+      theBadPedestal.BadChannelMaskingTool=theLArPedValBCMask
+      theBadPedestal.ValidationKey="Pedestal"
+      theBadPedestal.ReferenceKey="PedestalRef"
+      theBadPedestal.PedestalTolerance       = ["10,10,10"]
+      theBadPedestal.PedestalRMSTolerance    = ["0.5, 0.5, 0.5"]
+      theBadPedestal.PedestalToleranceFEB    = ["8, 8, 8"]
+      theBadPedestal.PedestalRMSToleranceFEB = ["1.2, 1.2, 1.2"]
+
+      theBadPedestal.MsgLevelForDeviations=ERROR      
+      theBadPedestal.CheckCompletness=False
+      theBadPedestal.CheckNumberOfCoolChannels=False
+      theBadPedestal.ListOfDevFEBs="Bad_pedFebs.txt"
+      topSequence+=theBadPedestal
+
+   if AutoCorr :
+      from LArCalibDataQuality.Thresholds import acThr, acThrFEB
+      from LArCalibDataQuality.LArCalibDataQualityConf import LArAutoCorrValidationAlg
+      theAutoCorrValidationAlg=LArAutoCorrValidationAlg("AutoCorrVal")
+      theAutoCorrValidationAlg.BadChannelMaskingTool=theLArACValBCMask
+      theAutoCorrValidationAlg.ValidationKey="LArAutoCorr"
+      theAutoCorrValidationAlg.ReferenceKey="LArAutoCorrRef"
+      theAutoCorrValidationAlg.AutoCorrTolerance=acThr
+      theAutoCorrValidationAlg.AutoCorrToleranceFEB=acThrFEB
+      theAutoCorrValidationAlg.MsgLevelForDeviations=WARNING
+      theAutoCorrValidationAlg.ListOfDevFEBs="ACFebs.txt"
+      theAutoCorrValidationAlg.CheckCompletness=True
+      theAutoCorrValidationAlg.PatchMissingFEBs=True
+      theAutoCorrValidationAlg.CheckNumberOfCoolChannels=True
+      theAutoCorrValidationAlg.UseCorrChannels=False #Corrections go into the regular data channels
+      topSequence+=theAutoCorrValidationAlg
+      
+      ## second instance of the validation tool to detect "bad" channel     
+      theBadAutoCorr=LArAutoCorrValidationAlg("AutoCorrFail")
+      theBadAutoCorr.BadChannelMaskingTool=theLArACValBCMask
+      theBadAutoCorr.ValidationKey="LArAutoCorr"
+      theBadAutoCorr.ReferenceKey="LArAutoCorrRef"
+      theBadAutoCorr.AutoCorrTolerance    = ["0.15, 0.15, 0.15"]
+      theBadAutoCorr.AutoCorrToleranceFEB = ["0.15, 0.15, 0.15"]
+      theBadAutoCorr.MsgLevelForDeviations=ERROR
+      theBadAutoCorr.CheckFifthSample=True
+      theBadAutoCorr.ListOfDevFEBs="Bad_ACFebs.txt"
+      theBadAutoCorr.CheckCompletness=False
+      theBadAutoCorr.CheckNumberOfCoolChannels=False
+      
+      topSequence+=theBadAutoCorr
+
+      
+      
+if ( doMonitoring ) :
+   
+   from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+   topSequence += AthenaMonManager( "LArMon" )
+   LArMon = topSequence.LArMon
+
+   ## old style
+   #LArMon.FileKey = "AllMon"
+   #LArMon.ManualDataTypeSetup = True
+   #LArMon.Environment         = "user"
+   #LArMon.ManualRunLBSetup    = True
+   #LArMon.Run                 = 1
+   #LArMon.LumiBlock           = 1
+   #LArMon.CheckEveryNoEvents  = 999999 #to do the check only at the end of the run
+
+   ## tier0 style
+   LArMon.FileKey = "GLOBAL"
+   LArMon.ManualDataTypeSetup = True
+   LArMon.Environment         = "tier0"
+   LArMon.ManualRunLBSetup    = True
+   LArMon.Run                 = int(RunNumberList[0])
+   LArMon.LumiBlock           = 1
+   LArMon.CheckEveryNoEvents  = 999999 #to do the check only at the end of the run
+  
+   LArDigitKey = GainList[0]
+
+   if ( doLArFEBMon ) :
+      ## LArFEBMon
+      include("LArMonTools/LArFEBMon_jobOptions.py")
+      
+   if ( doLArOddCellMonTool ) :
+      ## LArOddCellMonTool
+      ReadCOOL = True ## Read pedestal from the DB
+      include("LArMonTools/LArOddCellsMonTool_jobOptions.py")
+      theLArOddCellsMonTool.LArPedestalKey = "PedestalRef"
+
+   if ( doLArScaNoiseTool  ) :
+      ## LArScaNoiseTool
+      include("LArRawConditions/LArIdMap_ATLAS_jobOptions.py")
+      include("LArMonTools/LArScaNoiseMonTool_jobOptions.py")
+
+#   if ( doLArDigitNoiseMonTool ) :   
+#      ## LArDigitNoiseMonTool
+#      include("LArMonTools/LArDigitNoiseMonTool_jobOptions.py")
+#      theLArDigitNoiseMon.gainNames = GainList
+   
+   RootHistOutputFileName='RootHistos_'+BaseFileNamePedAutoCorr+".root"
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import THistSvc
+   if os.path.exists(OutputPedAutoCorrRootFileDir + "/" +RootHistOutputFileName): 
+      os.remove(OutputPedAutoCorrRootFileDir + "/" +RootHistOutputFileName)
+   svcMgr += THistSvc()
+   #svcMgr.THistSvc.Output = ["AllMon DATAFILE='"+OutputPedAutoCorrRootFileDir + "/" +RootHistOutputFileName+"' OPT='New'"]
+
+   svcMgr.THistSvc.Output = ["GLOBAL DATAFILE='"+OutputPedAutoCorrRootFileDir + "/" +RootHistOutputFileName+"' OPT='New'"]
+
+
+
+if ( WriteNtuple ) :
+   
+   if Pedestal :
+      from LArCalibTools.LArCalibToolsConf import LArPedestals2Ntuple
+      LArPedestals2Ntuple = LArPedestals2Ntuple("LArPedestals2Ntuple")
+      LArPedestals2Ntuple.ContainerKey = KeyOutputPed
+      
+      topSequence += LArPedestals2Ntuple
+
+   if AutoCorr :
+      from LArCalibTools.LArCalibToolsConf import LArAutoCorr2Ntuple
+      LArAutoCorr2Ntuple = LArAutoCorr2Ntuple( "LArAutoCorr2Ntuple" )
+      LArAutoCorr2Ntuple.Nsamples     = NSamples
+      LArAutoCorr2Ntuple.ContainerKey = KeyOutputAC
+      
+      topSequence += LArAutoCorr2Ntuple
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputPedAutoCorrRootFileDir + "/" + OutputPedAutoCorrRootFileName): 
+      os.remove(OutputPedAutoCorrRootFileDir + "/" + OutputPedAutoCorrRootFileName)
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputPedAutoCorrRootFileDir + "/" + OutputPedAutoCorrRootFileName+"' OPT='NEW'" ]
+
+
+if ( WritePoolFile ) :
+
+        from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+        
+        if os.path.exists(OutputPedAutoCorrPoolFileDir + "/" + OutputPedAutoCorrPoolFileName): 
+           os.remove(OutputPedAutoCorrPoolFileDir + "/" + OutputPedAutoCorrPoolFileName)
+        OutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg",OutputPedAutoCorrPoolFileDir + "/" + OutputPedAutoCorrPoolFileName,
+                                                [OutputObjectSpecPed],[OutputTagSpecPed],WriteIOV)
+        OutputConditionsAlg.ObjectList +=  [OutputObjectSpecAutoCorr]
+        OutputConditionsAlg.IOVTagList += [OutputTagSpecAutoCorr]
+
+        OutputConditionsAlg.Run1 = IOVBegin
+        if IOVEnd>0:
+              OutputConditionsAlg.Run2=IOVEnd
+        svcMgr.IOVDbSvc.dbConnection  = OutputDB
+        
+        from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+        svcMgr += IOVRegistrationSvc()
+        svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+        svcMgr.IOVRegistrationSvc.RecreateFolders = False
+       
+        
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = INFO
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = INFO)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = WARNING)
+theApp.AuditAlgorithms=True
+theAuditorSvc += getConfigurable("ChronoAuditor")(OutputLevel = WARNING)
+theAuditorSvc += getConfigurable("NameAuditor")(OutputLevel = WARNING)
+svcMgr.ChronoStatSvc.OutputLevel  = INFO
+
+###########################################################################
+#svcMgr.IOVDbSvc.OutputLevel = DEBUG 
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_testing.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_testing.py
new file mode 100644
index 00000000000..1b3d8a97443
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_testing.py
@@ -0,0 +1,26 @@
+## second instance of the validation tools to detect "bad" channels 
+theBadPedestal.OutputLevel = INFO
+theBadPedestal.ListOfDevFEBs='BadPedestaldFebs.txt'
+theBadPedestal.MsgLevelForDeviations=ERROR
+
+theBadAutoCorr.OutputLevel = INFO
+theBadAutoCorr.ListOfDevFEBs='BadAutoCorrFebs.txt'
+theBadAutoCorr.MsgLevelForDeviations=ERROR
+
+## first instance of the validation tools to detect "deviated" channels 
+thePedestalValidationAlg.OutputLevel = INFO
+thePedestalValidationAlg.PatchMissingFEBs=True
+thePedestalValidationAlg.UseCorrChannels=False
+thePedestalValidationAlg.ListOfDevFEBs='PedestaldFebs.txt'
+thePedestalValidationAlg.MsgLevelForDeviations=ERROR
+
+theAutoCorrValidationAlg.OutputLevel = INFO
+theAutoCorrValidationAlg.PatchMissingFEBs=True
+theAutoCorrValidationAlg.UseCorrChannels=False
+theAutoCorrValidationAlg.ListOfDevFEBs='AutoCorrFebs.txt'
+theAutoCorrValidationAlg.MsgLevelForDeviations=ERROR
+
+svcMgr.MessageSvc.OutputLevel = WARNING
+svcMgr.MessageSvc.defaultLimit = 9999999  # all messages
+
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictorAndShifter_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictorAndShifter_jobOptions.py
new file mode 100644
index 00000000000..78eba2a9dcc
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictorAndShifter_jobOptions.py
@@ -0,0 +1,747 @@
+import commands
+
+###########################################################################
+#
+# <Marco.Delmastro@cern.ch>
+#
+# Example jobOptions to compute PhysWavePredicted and Shifted
+#
+# Last update: 09/12/2008 <Fabien.Tarrade@cern.ch>
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+
+###########################################################################
+#                   Input selection (CaliWave)
+###########################################################################
+
+# RunNumber trigger IOV if reading from COOL is eneabled
+if not 'RunNumber' in dir():
+   RunNumber = '0000000'
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"  
+
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"
+
+if not 'isHEC' in dir():
+   isHEC= False
+
+## HEC PhysWave
+if not 'ReadHECPhysWaveFromCOOL' in dir():
+   ReadHECPhysWaveFromCOOL = True
+	
+if not 'InputHECPhysWavePoolFileDir' in dir():
+   InputHECMapPoolFileDir  = commands.getoutput("pwd")
+   
+if not 'InputHECPhysWavePoolFileName' in dir():
+   InputHECPhysWavePoolFileName = "LArHECPhysWave.pool.root"   
+
+## CaliWave      
+if not 'ReadCaliWaveFromCOOL' in dir():
+   ReadCaliWaveFromCOOL = True
+
+if not 'InputCaliWavePoolDir' in dir():
+   InputCaliWavePoolDir = commands.getoutput("pwd")
+
+if not 'InputCaliWavePoolFileName' in dir():
+   InputCaliWavePoolFileName = "LArCaliWave.pool.root"
+
+## PulseParams      
+if not 'ReadPulseParamsFromCOOL' in dir():
+   ReadPulseParamsFromCOOL = True
+
+if not 'InputPulseParamsPoolDir' in dir():
+   InputPulseParamsPoolDir = commands.getoutput("pwd")
+
+if not 'InputPulseParamsPoolFileName' in dir():
+   InputPulseParamsPoolFileName = "LArCaliPulseParamsVsCalib_AllBoards.pool.root"
+
+## DetCellParams    
+if not 'ReadDetCellParamsFromCOOL' in dir():
+   ReadDetCellParamsFromCOOL = True
+
+if not 'InputDetCellParamsPoolDir' in dir():
+   InputDetCellParamsPoolDir = commands.getoutput("pwd")
+
+if not 'InputDetCellParamsPoolFileName' in dir():
+   InputDetCellParamsPoolFileName = "detector_EMECA_C_v1.pool.root"
+
+## DTime      
+if not 'ReadDTimeFromCOOL' in dir():
+   ReadDTimeFromCOOL = True
+
+if not 'InputDTimePoolDir' in dir():
+   InputDTimePoolDir = commands.getoutput("pwd")
+
+if not 'InputDTimePoolFileName' in dir():
+   InputDTimePoolFileName = "tdrift_EMECA_C_v1.pool.root"
+
+## Options
+   
+if not 'StripsXtalkCorr' in dir():
+   StripsXtalkCorr = True
+   
+if (isHEC) :
+    StripsXtalkCorr=False
+
+if not 'ChannelSelection' in dir():
+   # Read all
+   ChannelSelection = " "
+   ## Example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,35:66</channelSelection>" 
+
+from string import *
+def DBConnectionFile(sqlitefile):  
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+if not 'DBConnectionCOOL' in dir():
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"
+
+if not 'InputCaliPulseParamsFolder' in dir():
+   InputCaliPulseParamsFolder = "/LAR/ElecCalibOfl/CaliPulseParams/RTM"
+   
+if not 'InputDetCellParamsFolder' in dir():
+   InputDetCellParamsFolder = "/LAR/ElecCalibOfl/DetCellParams/RTM"   
+
+## HEC PhysWave
+if ( ReadHECPhysWaveFromCOOL ):
+   if 'InputHECPhysWaveSQLiteFile' in dir():
+      InputDBConnectionHECPhysWave = DBConnectionFile(InputHECPhysWaveSQLiteFile)
+   else:
+      InputDBConnectionHECPhysWave = DBConnectionCOOL 
+
+## CaliWave
+if ( ReadCaliWaveFromCOOL ):      
+   if 'InputCaliWaveSQLiteFile' in dir():
+      InputDBConnectionCaliWave = DBConnectionFile(InputCaliWaveSQLiteFile)
+   else:
+      InputDBConnectionCaliWave = DBConnectionCOOL
+
+## PulseParams
+if ( ReadPulseParamsFromCOOL ):      
+   if 'InputPulseParamsSQLiteFile' in dir():
+      InputDBConnectionPulseParams = DBConnectionFile(InputPulseParamsSQLiteFile)
+   else:
+      InputDBConnectionPulseParams = DBConnectionCOOL
+
+## DetCellParams      
+if ( ReadDetCellParamsFromCOOL ):      
+   if 'InputDetCellParamsSQLiteFile' in dir():
+       InputDBConnectionDetCellParams= DBConnectionFile(InputDetCellParamsSQLiteFile)
+   else:
+       InputDBConnectionDetCellParams= DBConnectionCOOL
+
+## DTime
+if ( ReadDTimeFromCOOL ):      
+   if 'InputDTimeSQLiteFile' in dir():
+      InputDBConnectionDTime = DBConnectionFile(InputDTimeSQLiteFile)
+   else:
+      InputDBConnectionDTime = DBConnectionCOOL
+      
+###########################################################################
+#                   PhysWavePredictor properties
+###########################################################################
+
+if not 'HECPhysWaveKey' in dir(): 
+   HECPhysWaveKey="LArPhysWaveHECIdeal"  
+
+if not 'KeyCaliList' in dir():
+   KeyCaliList   = [ "LArCaliWave" ]
+        
+if not 'LArMphysMcaliKey' in dir ():
+   LArMphysMcaliKey = "LArMphysOverMcal"
+
+if not 'doTest' in dir():
+   doTest = False
+
+   
+##############################################
+   
+# Tcali, Fstep
+if not 'UseCaliPulseParamsFromJO' in dir():
+   UseCaliPulseParamsFromJO = False # pb to read the poolfile
+
+# Omega0, Taur
+if not 'UseDetCellParamsFromJO' in dir():
+   UseDetCellParamsFromJO = False
+
+# Tdrift
+if not 'UseTdriftFromJO' in dir():
+   UseTdriftFromJO   = False 
+
+# Tdiff
+if not 'UseTimeShiftFromJO' in dir():
+   UseTimeShiftFromJO = True
+
+###############################################
+# part of software + DB missing so use   
+if not 'UseDoubleTriangle' in dir():
+   if (isHEC) :
+      UseDoubleTriangle = False
+   else :
+      UseDoubleTriangle = False ##normally True but software not ready   
+
+if not 'HV' in dir(): 
+   HV = 2000
+
+if ( HV == 2000 ):
+   TdriftVector  = [ 420  ,     469 ,     469 ,     469 ]
+   TdriftVector2 = [ 420  ,     921 ,     921 ,     921 ]
+   TdriftWeight2 = [   0. ,  0.0672 ,  0.0672 ,  0.0672 ]
+elif ( HV == 1600 ):
+   TdriftVector  = [ 451.92 , 504.644 , 504.644 , 504.644 ]
+   TdriftVector2 = [ 451.92 , 990.996 , 990.996 , 990.996 ]
+   TdriftWeight2 = [   0.   ,  0.0672 ,  0.0672 ,  0.0672 ]
+
+if not 'InjPointCorrLayer' in dir():
+   InjPointCorrLayer = [ 1, 1, 1, 1 ]
+
+if not 'InjPointUseTauR' in dir():
+   InjPointUseTauR   = [ 1, 1, 1, 1 ]
+
+if not 'WritePhysWave2NTuple' in dir():
+   WritePhysWave2NTuple = True  # write predicted LArPhysWave to ntuple
+
+if not 'WriteCaliWave2NTuple' in dir():
+   WriteCaliWave2NTuple = False # add LArCaliWave to predicted LArPhysWave ntuple
+
+if not 'WriteMphyMcal2NTuple' in dir():
+   WriteMphyMcal2NTuple = True  # add LArMphysOverMcalComplete to predicted LArPhysWave ntuple
+
+
+###########################################################################
+#                PhysWaveShifter properties                               #
+###########################################################################
+
+if not 'doPhysWaveShifter' in dir():
+   doPhysWaveShifter = False 
+
+if not 'ShiftMode' in dir():
+   ShiftMode = 2 # 1 = minimum Tstart from helper in FEB  # 2 = minumum Tpeak-NindexFromPeak in FEB
+
+if not 'InputKey' in dir():
+   if (doPhysWaveShifter) :
+      InputKey = "LArPhysWaveUnShifted"
+   else :
+      InputKey = "LArPhysWave"  # no shift applied to the PhysWave   
+
+if not 'OutputKey' in dir():
+   OutputKey = "LArPhysWave"
+      
+if not 'Nsamplings' in dir():
+   Nsamplings = 2
+
+if not 'TimeShiftGuardRegion' in dir():
+   TimeShiftGuardRegion = 5
+   
+#######################################################
+#                     PhysWavePredicted output
+###########################################################################
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+   
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumber)
+
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd
+
+if not 'OutputPhysWaveRootFileDir' in dir():
+    OutputPhysWaveRootFileDir= commands.getoutput("pwd")
+    
+if not 'OutputPhysWavePoolFileDir' in dir():
+    OutputPhysWavePoolFileDir= commands.getoutput("pwd")
+
+if not 'OutputMphysOverMcalPoolFileDir' in dir():
+    OutputMphysOverMcalPoolFileDir= commands.getoutput("pwd")    
+
+PhysWaveFileTag = str(RunNumber)+"_"+Partition.replace("*","")
+
+if not 'OutputPhysWaveRootFileName' in dir():
+   OutputPhysWaveRootFileName = "LArPhysWave_RTM_"+PhysWaveFileTag + ".root"
+   
+if not 'OutputPhysWavePoolFileName' in dir():
+   OutputPhysWavePoolFileName = "LArPhysWave_RTM_"+PhysWaveFileTag + ".pool.root"
+
+if not 'OutputMphysOverMcalPoolFileName' in dir():
+   OutputMphysOverMcalPoolFileName = "LArMphysOverMcal_RTM_"+ PhysWaveFileTag+ ".pool.root"
+
+
+if not StripsXtalkCorr:
+   CaliWaveFolder = LArCalib_Flags.LArCaliWaveFolder
+else:
+   CaliWaveFolder = LArCalib_Flags.LArCaliWaveFolderXtlk
+
+
+HECPhysWaveFolder  = "/LAR/ElecCalibOfl/PhysWaves/HECIdeal"
+
+
+rs=FolderTagResover()
+if not "LArDetCellParamsTag" in dir():
+   LArDetCellParamsTag=rs.getFolderTagSuffix(InputDetCellParamsFolder)
+
+if not "LArCaliPulseParamsTag" in dir():
+   LArCaliPulseParamsTag=rs.getFolderTagSuffix(InputCaliPulseParamsFolder)
+
+if not "CaliWaveLArCalibFolderTag" in dir ():
+   CaliWaveLArCalibFolderTag=rs.getFolderTagSuffix(CaliWaveFolder)
+
+if not 'LArPhysFolderOutputTag' in dir():
+   LArPhysFolderOutputTag=rs.getFolderTagSuffix(LArCalib_Flags.LArPhysWaveFolder)
+
+if not 'LArPhysFolderOutputTag' in dir():
+   LArPhysFolderOutputTag=rs.getFolderTagSuffix(LArCalib_Flags.LArMPhysOverMCalFolder)
+
+if not 'DTimeLArCalibFolderTag' in dir():
+   DTimeLArCalibFolderTag=rs.getFolderTagSuffix(LArCalib_Flags.LArDTimeFolder)
+
+if not 'HECPhysWaveTagSpec' in dir():
+   HECPhysWaveTagSpec=rs.getFolderTagSuffix(HECPhysWaveFolder)
+del rs #Close database
+
+
+
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)
+
+if not 'OutputObjectSpecPhysWave' in dir():
+   OutputObjectSpecPhysWave   = "LArPhysWaveContainer#"+"LArPhysWave"+"#"+ LArCalib_Flags.LArPhysWaveFolder
+   OutputObjectSpecTagPhysWave    = LArCalibFolderTag(LArCalib_Flags.LArPhysWaveFolder,LArPhysFolderOutputTag)
+						
+if not 'OutputObjectSpecMphysOverMcal' in dir():
+   OutputObjectSpecMphysOverMcal = "LArMphysOverMcalComplete#"+"LArMphysOverMcal"+"#"+ LArCalib_Flags.LArMPhysOverMCalFolder		
+   OutputObjectSpecTagMphysOverMcal  = LArCalibFolderTag(LArCalib_Flags.LArMPhysOverMCalFolder,LArPhysFolderOutputTag)
+
+## Bad Channel   
+   
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;"
+      InputDBConnectionBadChannel = "COOLOFL_LAR/COMP200"       
+
+###########################################################################
+#                            Print summary
+###########################################################################
+
+PhysWaveLog = logging.getLogger( "PhysWaveLog" )
+PhysWaveLog.info( " ======================================================== " )
+PhysWaveLog.info( " ***            LAr PredPhysWave summary              *** " )
+PhysWaveLog.info( " ======================================================== " )
+PhysWaveLog.info( " RunNumber                                  = "+str(RunNumber) )
+if ( ReadCaliWaveFromCOOL ):
+   PhysWaveLog.info( " InputDBConnectionCaliWave                  = "+InputDBConnectionCaliWave )
+else :
+   PhysWaveLog.info( " InputCaliWavePoolFileName                  = "+InputCaliWavePoolFileName )
+if ( (ReadCaliWaveFromCOOL) and ChannelSelection != " " ):
+   PhysWaveLog.info( " ChannelSelection                           = "+ChannelSelection )
+
+PhysWaveLog.info( " CaliWaveLArCalibFolderTag                  = "+CaliWaveLArCalibFolderTag )
+PhysWaveLog.info( " OutputPhysWaveRootFullFileName             = "+OutputPhysWaveRootFileDir+"/"+OutputPhysWaveRootFileName )
+PhysWaveLog.info( " OutputPhysWavePoolFullFileName             = "+OutputPhysWavePoolFileDir+"/"+OutputPhysWavePoolFileName )
+PhysWaveLog.info( " OutputMphysOverMcalPoolFullFileName        = "+OutputMphysOverMcalPoolFileDir+"/"+OutputMphysOverMcalPoolFileName )
+PhysWaveLog.info( " OutputObjectSpecPhysWave                   = "+str(OutputObjectSpecPhysWave) )
+PhysWaveLog.info( " OutputObjectSpecTagPhysWave                = "+str(OutputObjectSpecTagPhysWave) )
+PhysWaveLog.info( " OutputObjectSpecMphusOverMcal              = "+str(OutputObjectSpecMphysOverMcal) )
+PhysWaveLog.info( " OutputObjectSpecTagMphysOverMcal           = "+str(OutputObjectSpecTagMphysOverMcal) )
+PhysWaveLog.info( " IOVBegin                                   = "+str(IOVBegin) )
+PhysWaveLog.info( " IOVEnd                                     = "+str(IOVEnd) )
+PhysWaveLog.info( " LArCalibOutputDB                           = "+OutputDB )
+PhysWaveLog.info( " ======================================================== " )
+
+###########################################################################
+#
+#                           Global settings
+#
+###########################################################################
+
+include( "AthenaCommon/Atlas_Gen.UnixStandardJob.py" )
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+###########################################################################
+#                                                                         #
+#    Input conditions data (CaliWave) for COOL and/or POOL                #
+#                                                                         #
+###########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+include ("LArCalibProcessing/LArCalib_BadChanTool.py")
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   PhysWaveLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   PhysWaveLog.info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB   
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+
+if (  ReadCaliWaveFromCOOL ) :
+   if not 'InputCaliWaveSQLiteFile' in dir():
+      PhysWaveLog.info( "Read CaliWave from Oracle DB" )
+   else :
+      PhysWaveLog.info( "Read CaliWave from SQLite file" )
+
+if ( ReadPulseParamsFromCOOL ) :       
+   if not 'InputPulseParamsSQLiteFile' in dir():
+      PhysWaveLog.info( "Read PulseParams from Oracle DB" )
+   else :
+      PhysWaveLog.info( "Read PulseParams from SQLite file" )
+
+if ( ReadDetCellParamsFromCOOL  ) :      
+   if not 'InputDetCellParamsSQLiteFile' in dir():
+      PhysWaveLog.info( "Read DetCellParams from Oracle DB" )
+   else :
+      PhysWaveLog.info( "Read DetCellParams from SQLite file" )
+
+if ( ReadDTimeFromCOOL ) :      
+   if not 'InputDTimeSQLiteFile' in dir():
+      PhysWaveLog.info( "Read DTime from Oracle DB" )
+   else :
+      PhysWaveLog.info( "Read DTime from SQLite file" )
+      
+if (isHEC):
+   if (ReadHECPhysWaveFromCOOL ): 
+      if not 'InputHECPhysWaveSQLiteFile' in dir():
+         PhysWaveLog.info( "Read HEC PhysWave from Oracle DB" )
+      else :
+         PhysWaveLog.info( "Read HEC PhysWave form SQLite file" )
+         
+      
+   if ( ReadHECPhysWaveFromCOOL ):
+      conddb.addFolder("",HECPhysWaveFolder+"<tag>"+HECPhysWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionHECPhysWave+"</dbConnection>" + ChannelSelection)
+      conddb.addFolder("",HECPhysWaveFolder+"<dbConnection>"+InputDBConnectionHECPhysWave+"</dbConnection>")
+
+   else:
+      if 'InputHECPhysWavePoolFileName' in dir():
+         PhysWaveLog.info( "Read HECPhysWave form POOL file" )
+         PoolFileList += [ InputHECPhysWavePoolFileDir +"/"+ InputHECPhysWavePoolFileName ]   
+      else:
+         PhysWaveLog.info( "No PoolFileList found! Please list the POOL files containing HECPhysWave or read from COOL." )
+         theApp.exit(-1)      
+
+## CaliWave
+if ( ReadCaliWaveFromCOOL ):
+      CaliWaveTagSpec = LArCalibFolderTag(CaliWaveFolder,CaliWaveLArCalibFolderTag)
+      conddb.addFolder("",CaliWaveFolder+"<tag>"+CaliWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionCaliWave+"</dbConnection>" + ChannelSelection)
+else:
+   if 'InputCaliWavePoolFileName' in dir():
+      PhysWaveLog.info( "Read CaliWave from POOL file" )
+      PoolFileList += [ InputCaliWavePoolDir+"/"+InputCaliWavePoolFileName ]
+   else:
+      PhysWaveLog.info( "No PoolFileList found! Please list the POOL files containing CaliWave or read from COOL." )
+      theApp.exit(-1)     
+      
+
+## PulseParams      
+if ( ReadPulseParamsFromCOOL ):
+   PulseParamsFolder = InputCaliPulseParamsFolder
+   PulseParamsTagSpec = LArCalibFolderTag(PulseParamsFolder,LArCaliPulseParamsTag)
+   conddb.addFolder("",PulseParamsFolder+"<tag>"+PulseParamsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPulseParams+"</dbConnection>" + ChannelSelection)
+   
+else:
+   if 'InputPulseParamsPoolFileName' in dir():
+      PhysWaveLog.info( "Read PulseParams from POOL file" )
+      PoolFileList += [ InputPulseParamsPoolDir+"/"+InputPulseParamsPoolFileName ]
+   else:
+      PhysWaveLog.info( "No PoolFileList found! Please list the POOL files containing PulseParams or read from COOL." )
+      theApp.exit(-1)
+         
+if not (isHEC) :
+   ## DetCellParams
+   if (  ReadDetCellParamsFromCOOL ):
+      DetCellParamsFolder = InputDetCellParamsFolder
+      DetCellParamsTagSpec = LArCalibFolderTag(DetCellParamsFolder,LArCaliPulseParamsTag)
+      conddb.addFolder("",DetCellParamsFolder+"<tag>"+DetCellParamsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionDetCellParams+"</dbConnection>" + ChannelSelection)
+   else:
+      if 'InputDetCellParamsPoolFileName' in dir():
+         PhysWaveLog.info( "Read DetCellParams from POOL file" )
+         PoolFileList += [ InputDetCellParamsPoolDir+"/"+InputDetCellParamsPoolFileName ]
+      else:
+         PhysWaveLog.info( "No PoolFileList found! Please list the POOL files containing DetCellParams or read from COOL." )
+         theApp.exit(-1)
+
+## DTime
+if ( ReadDTimeFromCOOL ):
+   DTimeTagSpec = LArCalibFolderTag(LArCalib_Flags.LArDTimeFolder,DTimeLArCalibFolderTag)
+   conddb.addFolder("",LArCalib_Flags.LArDTimeFolder+"<tag>"+DTimeTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionDTime+"</dbConnection>")
+else:
+   if 'InputDTimePoolFileName' in dir():
+      PhysWaveLog.info( "Read DTime from POOL file" )
+      PoolFileList += [ InputDTimePoolDir+"/"+InputDTimePoolFileName ]
+   else:
+      PhysWaveLog.info( "No PoolFileList found! Please list the POOL files containing DTrif or read from COOL." )
+      theApp.exit(-1)     
+
+if ( len(PoolFileList)>0 ):
+
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+   
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+   
+
+###########################################################################
+#
+#       Predict physics waveforms from Cali/Master waveforms
+#
+###########################################################################
+
+from LArCalibUtils.LArCalibUtilsConf import LArPhysWavePredictor
+from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+theMask=LArBadChannelMasker("BadChannelMask",
+                            DoMasking=True,
+                            ProblemsToMask=["deadCalib","deadReadout","deadPhys","almostDead","short"]
+                            )
+ToolSvc+=theMask
+
+LArPhysWavePredictor = LArPhysWavePredictor( "LArPhysWavePredictor" )
+LArPhysWavePredictor.MaskingTool              = theMask
+LArPhysWavePredictor.TestMode	              = doTest
+LArPhysWavePredictor.KeyCaliList              = KeyCaliList
+LArPhysWavePredictor.UseCaliPulseParamsFromJO = UseCaliPulseParamsFromJO
+LArPhysWavePredictor.UseDetCellParamsFromJO   = UseDetCellParamsFromJO
+LArPhysWavePredictor.UseTdriftFromJO          = UseTdriftFromJO
+LArPhysWavePredictor.Tdrift	              = TdriftVector
+LArPhysWavePredictor.UseDoubleTriangle        = UseDoubleTriangle
+LArPhysWavePredictor.Tdrift2	              = TdriftVector2
+LArPhysWavePredictor.WeightTriangle2          = TdriftWeight2
+LArPhysWavePredictor.UseTimeShiftFromJO       = UseTimeShiftFromJO
+LArPhysWavePredictor.GroupingType             = GroupingType
+LArPhysWavePredictor.NormalizeCali	      = True
+if (isHEC) :
+   LArPhysWavePredictor.NormalizeCali	      = False
+LArPhysWavePredictor.KeyMphysMcali	      = LArMphysMcaliKey
+LArPhysWavePredictor.DumpMphysMcali           = False # set to True to dump on a ASCII file
+LArPhysWavePredictor.KeyPhys                  = InputKey
+LArPhysWavePredictor.isHEC                    = isHEC
+#
+# Avoid using these settings, use LArPhysWaveShifter in a separate job
+#
+LArPhysWavePredictor.TimeShiftByHelper        = False
+LArPhysWavePredictor.TimeShiftByIndex         = 0
+LArPhysWavePredictor.TimeShiftByLayer         = False
+LArPhysWavePredictor.Tshift	              = [ 0 , 0 , 0 , 0 ]
+LArPhysWavePredictor.TimeShiftByFEB           = False
+LArPhysWavePredictor.TimeShiftGuardRegion     = 0
+
+#################### PHYSWAVE Prediction FOR EM #################### 
+if not (isHEC) :
+   from LArCalibUtils.LArCalibUtilsConf import LArPhysWaveTool
+   LArPhysWaveTool=LArPhysWaveTool()
+   LArPhysWaveTool.NormalizeCali     = False # this is taken care by LArPhysWavePredictor
+   LArPhysWaveTool.TimeOriginShift   = False
+   LArPhysWaveTool.SubtractBaseline  = False
+   LArPhysWaveTool.InjPointCorrLayer = InjPointCorrLayer
+   LArPhysWaveTool.InjPointUseTauR   = InjPointUseTauR 
+   ToolSvc +=LArPhysWaveTool
+   
+#################### PHYSWAVE Prediction FOR HEC ####################
+else :
+   from LArCalibUtils.LArCalibUtilsConf import LArPhysWaveHECTool
+   LArPhysWaveHECTool=LArPhysWaveHECTool()
+   LArPhysWaveHECTool.NormalizeCali     = False  # this is taken care by LArPhysWavePredictor changed by FT to True was False
+   LArPhysWaveHECTool.TimeOriginShift   = False
+   LArPhysWaveHECTool.SubtractBaseline  = False
+   ToolSvc +=LArPhysWaveHECTool
+   
+topSequence += LArPhysWavePredictor
+
+###########################################################################
+#
+#       Shift physics waveforms will be done before OFC computation
+#
+###########################################################################
+if (doPhysWaveShifter) :
+   
+   from LArCalibUtils.LArCalibUtilsConf import LArPhysWaveShifter
+   LArPhysWaveShifter                        = LArPhysWaveShifter("LArPhysWaveShifter")
+
+   LArPhysWaveShifter.KeyList                = [ InputKey ]
+   LArPhysWaveShifter.KeyOutput              = OutputKey
+   LArPhysWaveShifter.GroupingType           = GroupingType
+
+   #
+   # Minimum Tstart per FEB computation
+   #
+   LArPhysWaveShifter.ComputeTimeShiftByFEB  = True
+   LArPhysWaveShifter.TimeShiftByFEBMode     = ShiftMode
+   LArPhysWaveShifter.TimeShiftByFEBDump     = True
+   LArPhysWaveShifter.TimeShiftByFEBDumpFile = "TimeShiftFEB.py"
+   
+   #
+   # Possible time shifts
+   #
+   LArPhysWaveShifter.TimeShiftByHelper      = False
+   LArPhysWaveShifter.TimeShiftByIndex       = 0
+   LArPhysWaveShifter.TimeShiftByLayer       = False
+   LArPhysWaveShifter.TshiftLayer            = [ 0 , 0 , 0 , 0 ]
+   LArPhysWaveShifter.TimeShiftFromPeak      = False
+   LArPhysWaveShifter.NindexFromPeak         = 0 # if 0 will use Ndelays*Nsampling
+   LArPhysWaveShifter.Ndelays                = 24
+   LArPhysWaveShifter.Nsamplings             = Nsamplings 
+   LArPhysWaveShifter.TimeShiftByFEB         = True
+   LArPhysWaveShifter.TimeShiftGuardRegion   = TimeShiftGuardRegion
+   
+   topSequence += LArPhysWaveShifter
+
+##########################################################################
+
+if ( WriteNtuple ) :
+
+   if ( WritePhysWave2NTuple ) :
+      from LArCalibTools.LArCalibToolsConf import LArPhysWaves2Ntuple
+      LArPhysWaves2Ntuple              = LArPhysWaves2Ntuple("LArPhysWaves2Ntuple")
+      LArPhysWaves2Ntuple.NtupleName   = "PHYSWAVE" 
+      LArPhysWaves2Ntuple.AddFEBTempInfo   = False  
+      LArPhysWaves2Ntuple.KeyList      = [ OutputKey  ]
+      
+      topSequence += LArPhysWaves2Ntuple
+      
+   if ( WriteCaliWave2NTuple ) :
+      from LArCalibTools.LArCalibToolsConf import LArCaliWaves2Ntuple
+      LArCaliWaves2Ntuple = LArCaliWaves2Ntuple( "LArCaliWaves2Ntuple" )	
+      LArCaliWaves2Ntuple.NtupleName   = "CALIWAVE"
+      LArCaliWaves2Ntuple.AddFEBTempInfo   = False
+      LArCaliWaves2Ntuple.KeyList      = KeyCaliList
+      
+      topSequence += LArCaliWaves2Ntuple
+      
+   if ( WriteMphyMcal2NTuple ) :
+      from LArCalibTools.LArCalibToolsConf import LArMphysOverMcal2Ntuple
+      LArMphysOverMcal2Ntuple                = LArMphysOverMcal2Ntuple( "LArMphysOverMcal2Ntuple" )
+      LArMphysOverMcal2Ntuple.ContainerKey   = "LArMphysOverMcal"
+      LArMphysOverMcal2Ntuple.AddFEBTempInfo   = False
+   
+      topSequence += LArMphysOverMcal2Ntuple
+   
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputPhysWaveRootFileDir+"/"+OutputPhysWaveRootFileName): 
+      os.remove(OutputPhysWaveRootFileDir+"/"+OutputPhysWaveRootFileName)  
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputPhysWaveRootFileDir+"/"+OutputPhysWaveRootFileName+"' OPT='NEW'" ]
+   
+if (  WritePoolFile ) :
+   
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   
+   # writre PredPhysWave
+   if os.path.exists(OutputPhysWavePoolFileDir+"/"+OutputPhysWavePoolFileName): 
+      os.remove(OutputPhysWavePoolFileDir+"/"+OutputPhysWavePoolFileName)
+   OutputConditionsAlgPhysWave = OutputConditionsAlg("OutputConditionsAlgPhysWave",OutputPhysWavePoolFileDir+"/"+OutputPhysWavePoolFileName,
+                                                     [OutputObjectSpecPhysWave],[OutputObjectSpecTagPhysWave],WriteIOV)
+   OutputConditionsAlgPhysWave.Run1     = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlgPhysWave.Run2  = IOVEnd
+		
+   # writre MphysOverMcal
+   if os.path.exists(OutputMphysOverMcalPoolFileDir+"/"+OutputMphysOverMcalPoolFileName): 
+      os.remove(OutputMphysOverMcalPoolFileDir+"/"+OutputMphysOverMcalPoolFileName)
+   OutputConditionsAlgMphysOverMcal = OutputConditionsAlg("OutputConditionsAlgMphysOverMcal",OutputMphysOverMcalPoolFileDir+"/"+OutputMphysOverMcalPoolFileName,
+                                                     [OutputObjectSpecMphysOverMcal],[OutputObjectSpecTagMphysOverMcal],WriteIOV)
+   OutputConditionsAlgMphysOverMcal.Run1     = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlgMphysOverMcal.Run2  = IOVEnd
+
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = VERBOSE
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+
+###########################################################################
+#                Use EventSelector to select IOV                          #
+###########################################################################
+from McEventSelector.McEventSelectorConf import McEventSelector
+svcMgr += McEventSelector("EventSelector")
+svcMgr.EventSelector.RunNumber	= int(RunNumber)
+svcMgr.EventSelector.EventsPerRun      = 1
+svcMgr.EventSelector.FirstEvent	       = 1
+svcMgr.EventSelector.InitialTimeStamp  = 0
+svcMgr.EventSelector.TimeStampInterval = 1
+
+##########################################################################
+#          don't remove otherwise infinite loop                          #
+##########################################################################
+
+theApp.EvtMax = 1
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = INFO)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = DEBUG)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictor_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictor_jobOptions.py
new file mode 100644
index 00000000000..d9d8d94189b
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictor_jobOptions.py
@@ -0,0 +1,410 @@
+import commands
+
+###########################################################################
+#
+# <Marco.Delmastro@cern.ch>
+#
+# Example jobOptions to compute PredictedPhysWave
+#
+# Last update: 25/01/2008 <Fabien.Tarrade@cern.ch>
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+
+###########################################################################
+#                   Input selection (CaliWave)
+###########################################################################
+
+# RunNumber trigger IOV if reading from COOL is eneabled
+if not 'RunNumber' in dir():
+   RunNumber = 0
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"  
+
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"
+      
+if not 'ReadCaliWaveFromCOOL' in dir():
+   ReadCaliWaveFromCOOL = True
+
+if not 'CaliWaveLArCalibFolderTag' in dir():
+   CaliWaveLArCalibFolderTag = LArCalib_Flags.tagSuffix   
+
+if not 'InputCaliWavePoolDir' in dir():
+   InputCaliWavePoolDir = commands.getoutput("pwd")
+
+if not 'InputCaliWavePoolFileName' in dir():
+   InputCaliWavePoolFileName = "LArCaliWave.pool.root"
+
+if not 'ChannelSelection' in dir():
+   # Read all
+   ChannelSelection = " "
+   ## Example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,35:66</channelSelection>" 
+
+from string import *
+def DBConnectionFile(sqlitefile):
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+###########################################################################
+#                   PhysWavePredictor properties
+###########################################################################
+
+if not 'StripsXtalkCorr' in dir():
+   StripsXtalkCorr = True # Xtalk correction for strips
+   
+if not 'KeyCaliList' in dir():
+   KeyCaliList   = [ "LArCaliWave" ]
+
+if not 'LArMphysMcaliKey' in dir ():
+   LArMphysMcaliKey = "LArMphysOverMcal"
+
+if not 'doTest' in dir():
+   doTest = False
+	
+# Tcali, Fstep
+if not 'UseCaliPulseParamsFromJO' in dir():
+   UseCaliPulseParamsFromJO = False
+
+# Omega0, Taur
+if not 'UseDetCellParamsFromJO' in dir():
+   UseDetCellParamsFromJO = False
+
+# Tdrift
+if not 'UseTdriftFromJO' in dir():
+   UseTdriftFromJO   = True
+
+if not 'UseDoubleTriangle' in dir():
+   UseDoubleTriangle = True
+
+if not 'HV' in dir(): 
+   HV = 2000
+
+if ( HV == 2000 ):
+   TdriftVector  = [ 420  ,     469 ,     469 ,     469 ]
+   TdriftVector2 = [ 420  ,     921 ,     921 ,     921 ]
+   TdriftWeight2 = [   0. ,  0.0672 ,  0.0672 ,  0.0672 ]
+elif ( HV == 1600 ):
+   TdriftVector  = [ 451.92 , 504.644 , 504.644 , 504.644 ]
+   TdriftVector2 = [ 451.92 , 990.996 , 990.996 , 990.996 ]
+   TdriftWeight2 = [   0.   ,  0.0672 ,  0.0672 ,  0.0672 ]
+
+# Tdiff
+if not 'UseTimeShiftFromJO' in dir():
+   UseTimeShiftFromJO = True
+
+if not 'InjPointCorrLayer' in dir():
+   InjPointCorrLayer = [ 0, 0, 1, 0 ]
+        
+if not 'InjPointUseTauR' in dir():
+   InjPointUseTauR   = [ 0, 0, 1, 0 ]
+
+if not 'WritePhysWave2NTuple' in dir():
+   WritePhysWave2NTuple = True  # write predicted LArPhysWave to ntuple
+
+if not 'WriteCaliWave2NTuple' in dir():
+   WriteCaliWave2NTuple = False # add LArCaliWave to predicted LArPhysWave ntuple
+
+if not 'WriteMphyMcal2NTuple' in dir():
+   WriteMphyMcal2NTuple = True  # add LArMphysOverMcalComplete to predicted LArPhysWave ntuple
+
+###########################################################################
+#                     PhysWavePredicted output
+###########################################################################
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+   
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = RunNumber
+
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd
+
+if not 'OutputPhysWaveRootFileDir' in dir():
+    OutputPhysWaveRootFileDir= commands.getoutput("pwd")
+    
+if not 'OutputPhysWavePoolFileDir' in dir():
+    OutputPhysWavePoolFileDir= commands.getoutput("pwd")
+
+if not 'OutputMphysOverMcalPoolFileDir' in dir():
+    OutputMphysOverMcalPoolFileDir= commands.getoutput("pwd")    
+
+PhysWaveFileTag = str(RunNumber)+"_"+Partition.replace("*","")
+
+if not 'OutputPhysWaveRootFileName' in dir():
+   OutputPhysWaveRootFileName = "LArPhysWave_RTM_"+PhysWaveFileTag + ".root"
+   
+if not 'OutputPhysWavePoolFileName' in dir():
+   OutputPhysWavePoolFileName = "LArPhysWave_RTM_"+PhysWaveFileTag + ".pool.root"
+
+if not 'OutputMphysOverMcalPoolFileName' in dir():
+   OutputMphysOverMcalPoolFileName = "LArMphysOverMcal_RTM_"+ PhysWaveFileTag+ ".pool.root"
+
+if not 'LArPhysFolderOutputTag' in dir():
+   LArPhysFolderOutputTag = LArCalib_Flags.tagSuffix  
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)
+
+if not 'OutputObjectSpecPhysWave' in dir():
+   OutputObjectSpecPhysWave   = "LArPhysWaveContainer#"+"LArPhysWave"+"#"+ "/LAR/ElecCalibOfl/PhysWaves/TempWillExistOnlyInTheSQLiteFile"
+   OutputObjectSpecTagPhysWave    = LArCalibFolderTag("/LAR/ElecCalibOfl/PhysWaves/TempWillExistOnlyInTheSQLiteFile",LArPhysFolderOutputTag)
+						
+if not 'OutputObjectSpecMphysOverMcal' in dir():
+   OutputObjectSpecMphysOverMcal = "LArMphysOverMcalComplete#"+"LArMphysOverMcal"+"#"+ LArCalib_Flags.LArMPhysOverMCalFolder		
+   OutputObjectSpecTagMphysOverMcal  = LArCalibFolderTag(LArCalib_Flags.LArMPhysOverMCalFolder,LArPhysFolderOutputTag)
+
+if not 'DBConnectionCOOL' in dir():
+   DBConnectionCOOL = "impl=cool;techno=oracle;schema=ATLAS_COOLOFL_LAR;ATLAS_COOLPROD:COMP200:ATLAS_COOL_READER:"
+
+if ( ReadCaliWaveFromCOOL ):      
+   if 'InputCaliWaveSQLiteFile' in dir():
+      InputDBConnectionCaliWave = DBConnectionFile(InputCaliWaveSQLiteFile)
+   else:
+      InputDBConnectionCaliWave = DBConnectionCOOL
+
+###########################################################################
+#                            Print summary
+###########################################################################
+
+PhysWaveLog = logging.getLogger( "PhysWaveLog" )
+PhysWaveLog.info( " ======================================================== " )
+PhysWaveLog.info( " ***            LAr PredPhysWave summary              *** " )
+PhysWaveLog.info( " ======================================================== " )
+PhysWaveLog.info( " RunNumber                                  = "+str(RunNumber) )
+if ( ReadCaliWaveFromCOOL ):
+   PhysWaveLog.info( " InputDBConnectionCaliWave                  = "+InputDBConnectionCaliWave )
+else :
+   PhysWaveLog.info( " InputCaliWavePoolFileName                  = "+InputCaliWavePoolFileName )
+if ( (ReadCaliWaveFromCOOL) and ChannelSelection != " " ):
+   PhysWaveLog.info( " ChannelSelection                           = "+ChannelSelection )
+PhysWaveLog.info( " CaliWaveLArCalibFolderTag                  = "+CaliWaveLArCalibFolderTag )
+PhysWaveLog.info( " OutputPhysWaveRootFullFileName             = "+OutputPhysWaveRootFileDir+"/"+OutputPhysWaveRootFileName )
+PhysWaveLog.info( " OutputPhysWavePoolFullFileName             = "+OutputPhysWavePoolFileDir+"/"+OutputPhysWavePoolFileName )
+PhysWaveLog.info( " OutputMphysOverMcalPoolFullFileName        = "+OutputMphysOverMcalPoolFileDir+"/"+OutputMphysOverMcalPoolFileName )
+PhysWaveLog.info( " OutputObjectSpecPhysWave                   = "+str(OutputObjectSpecPhysWave) )
+PhysWaveLog.info( " OutputObjectSpecTagPhysWave                = "+str(OutputObjectSpecTagPhysWave) )
+PhysWaveLog.info( " OutputObjectSpecMphysOverMcal              = "+str(OutputObjectSpecMphysOverMcal) )
+PhysWaveLog.info( " OutputObjectSpecTagMphysOverMcal           = "+str(OutputObjectSpecTagMphysOverMcal) )
+PhysWaveLog.info( " IOVBegin                                   = "+str(IOVBegin) )
+PhysWaveLog.info( " IOVEnd                                     = "+str(IOVEnd) )
+PhysWaveLog.info( " LArCalibOutputDB                           = "+OutputDB )
+PhysWaveLog.info( " ======================================================== " )
+
+###########################################################################
+#
+#                           Global settings
+#
+###########################################################################
+
+include( "AthenaCommon/Atlas_Gen.UnixStandardJob.py" )
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+###########################################################################
+#                                                                         #
+#        Input conditions data (CaliWave) for COOL and/or POOL            #
+#                                                                         #
+###########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+if ( ReadCaliWaveFromCOOL ):
+   if ( not StripsXtalkCorr ):
+      CaliWaveFolder = LArCalib_Flags.LArCaliWaveFolder
+   else:
+      CaliWaveFolder = LArCalib_Flags.LArCaliWaveFolderXtlk
+   CaliWaveTagSpec = LArCalibFolderTag(CaliWaveFolder,CaliWaveLArCalibFolderTag)
+   conddb.addFolder("",CaliWaveFolder+"<tag>"+CaliWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionCaliWave+"</dbConnection>" + ChannelSelection)
+else:
+   if 'InputCaliWavePoolFileName' in dir():
+      PoolFileList += [ InputCaliWavePoolDir+"/"+InputCaliWavePoolFileName ]
+   else:
+      print "No PoolFileList found! Please list the POOL files containing CaliWave or read from COOL."
+      theApp.exit(-1)
+
+if ( len(PoolFileList)>0 ):
+
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+   
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+
+   
+###########################################################################
+#
+#       Predict physics waveforms from Cali/Master waveforms
+#
+###########################################################################
+
+from LArCalibUtils.LArCalibUtilsConf import LArPhysWavePredictor
+
+LArPhysWavePredictor = LArPhysWavePredictor( "LArPhysWavePredictor" )
+
+LArPhysWavePredictor.TestMode	              = doTest
+LArPhysWavePredictor.KeyCaliList              = KeyCaliList
+LArPhysWavePredictor.UseCaliPulseParamsFromJO = UseCaliPulseParamsFromJO
+LArPhysWavePredictor.UseDetCellParamsFromJO   = UseDetCellParamsFromJO
+LArPhysWavePredictor.UseTdriftFromJO          = UseTdriftFromJO
+LArPhysWavePredictor.Tdrift	              = TdriftVector
+LArPhysWavePredictor.UseDoubleTriangle        = UseDoubleTriangle
+LArPhysWavePredictor.Tdrift2	              = TdriftVector2
+LArPhysWavePredictor.WeightTriangle2          = TdriftWeight2
+LArPhysWavePredictor.UseTimeShiftFromJO       = UseTimeShiftFromJO
+LArPhysWavePredictor.GroupingType             = GroupingType
+LArPhysWavePredictor.NormalizeCali	      = True
+LArPhysWavePredictor.KeyMphysMcali	      = LArMphysMcaliKey
+LArPhysWavePredictor.DumpMphysMcali           = False # set to True to dump on a ASCII file
+
+#
+# Avoid using these settings, use LArPhysWaveShifter in a separate job
+#
+
+LArPhysWavePredictor.TimeShiftByHelper    = False
+LArPhysWavePredictor.TimeShiftByIndex     = 0
+LArPhysWavePredictor.TimeShiftByLayer     = False
+LArPhysWavePredictor.Tshift	          = [ 0 , 0 , 0 , 0 ]
+LArPhysWavePredictor.TimeShiftByFEB       = False
+LArPhysWavePredictor.TimeShiftGuardRegion = 0
+
+from LArCalibUtils.LArCalibUtilsConf import LArPhysWaveTool
+LArPhysWaveTool.NormalizeCali     = False # this is taken care by LArPhysWavePredictor
+LArPhysWaveTool.TimeOriginShift   = False
+LArPhysWaveTool.SubtractBaseline  = False
+LArPhysWaveTool.InjPointCorrLayer = InjPointCorrLayer
+LArPhysWaveTool.InjPointUseTauR   = InjPointUseTauR  
+
+topSequence += LArPhysWavePredictor
+###########################################################################
+
+if ( WriteNtuple ) :
+
+   if ( WritePhysWave2NTuple ) :
+      from LArCalibTools.LArCalibToolsConf import LArWaves2Ntuple
+      LArPhysWaves2Ntuple = LArWaves2Ntuple("LArPhysWaves2Ntuple")
+      LArPhysWaves2Ntuple.NtupleName   = "PHYSWAVE" 
+      LArPhysWaves2Ntuple.KeyList = [ "LArPhysWave" ]
+      LArPhysWaves2Ntuple.ReadCaliWave = False
+      
+      topSequence += LArPhysWaves2Ntuple
+      
+   if ( WriteCaliWave2NTuple ) :
+      from LArCalibTools.LArCalibToolsConf import LArWaves2Ntuple
+      LArCaliWaves2Ntuple = LArWaves2Ntuple("LArCaliWaves2Ntuple")		
+      LArCaliWaves2Ntuple.NtupleName = "CALIWAVE"
+      LArCaliWaves2Ntuple.KeyList = KeyCaliList
+      
+      topSequence += LArCaliWaves2Ntuple
+      
+   if ( WriteMphyMcal2NTuple ) :
+      from LArCalibTools.LArCalibToolsConf import LArParams2Ntuple
+      LArParams2Ntuple = LArParams2Ntuple( "LArParams2Ntuple" )
+      LArParams2Ntuple.KeyList += [ "LArMphysOverMcalComplete" ]
+      LArParams2Ntuple.DetStoreSuffix = ""
+      
+      topSequence += LArParams2Ntuple	
+   
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputPhysWaveRootFileDir+"/"+OutputPhysWaveRootFileName+"' OPT='NEW'" ]
+   
+if (  WritePoolFile ) :
+
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   # writre PredPhysWave
+   OutputConditionsAlgPhysWave = OutputConditionsAlg("OutputConditionsAlgPhysWave",OutputPhysWavePoolFileDir+"/"+OutputPhysWavePoolFileName,
+                                                     [OutputObjectSpecPhysWave],[OutputObjectSpecTagPhysWave],WriteIOV)
+   #OutputConditionsAlgPhysWave.WriteIOV = WriteIOV
+   OutputConditionsAlgPhysWave.Run1     = IOVBegin
+
+   if IOVEnd>0:
+      OutputConditionsAlgPhysWave.Run2  = IOVEnd
+	
+   # writre MphysOverMcal
+   OutputConditionsAlgMphysOverMcal = OutputConditionsAlg("OutputConditionsAlgMphysOverMcal",OutputMphysOverMcalPoolFileDir+"/"+OutputMphysOverMcalPoolFileName,
+                                                     [OutputObjectSpecMphysOverMcal],[OutputObjectSpecTagMphysOverMcal],WriteIOV)
+   #OutputConditionsAlgMphysOverMcal.WriteIOV = WriteIOV
+   OutputConditionsAlgMphysOverMcal.Run1     = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlg.MphysOverMcal.Run2  = IOVEnd
+
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+
+   from AthenaCommon.AppMgr import ServiceMgr
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = VERBOSE
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+
+###########################################################################
+#                Use EventSelector to select IOV                          #
+###########################################################################
+from McEventSelector.McEventSelectorConf import McEventSelector
+svcMgr += McEventSelector("EventSelector")
+svcMgr.EventSelector.RunNumber	= RunNumber
+svcMgr.EventSelector.EventsPerRun      = 1
+svcMgr.EventSelector.FirstEvent	       = 1
+svcMgr.EventSelector.InitialTimeStamp  = 0
+svcMgr.EventSelector.TimeStampInterval = 1
+
+##########################################################################
+#          don't remove otherwise infinite loop                          #
+##########################################################################
+
+theApp.EvtMax = 1
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = INFO)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = DEBUG)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWaveShifter_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWaveShifter_jobOptions.py
new file mode 100644
index 00000000000..f6f72a3b581
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWaveShifter_jobOptions.py
@@ -0,0 +1,315 @@
+import commands
+
+###########################################################################
+#
+# LArCalib_PhysWaveShifter_jobOptions.py
+#
+# Example jobOption to shift LArPhysWave in time before OFC computation
+#
+# Last update: 25/09/2008 <Caroline.Collard@cern.ch>
+#
+###########################################################################
+
+include ("LArCalibProcessing/LArCalib_Flags.py")
+
+###########################################################################
+#               Input selection (PhysWave)
+###########################################################################
+
+# RunNumber trigger IOV if reading from COOL is eneabled
+if not 'RunNumber' in dir():
+   RunNumber = 0
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"  
+
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"    
+
+if not 'ReadPhysWaveFromCOOL' in dir():
+   ReadPhysWaveFromCOOL = True
+	
+if not 'PhysWaveLArCalibFolderTag' in dir():
+   PhysWaveLArCalibFolderTag = LArCalib_Flags.tagSuffix  
+
+if not 'InputPhysWavePoolDir' in dir():
+   InputPhysWavePoolDir = commands.getoutput("pwd")
+
+if not 'InputPhysWavePoolFileName' in dir():
+   InputPhysWavePoolFileName = "LArPhysWave.pool.root"  
+
+if not 'ChannelSelection' in dir():
+   # Read all
+   ChannelSelection = " "
+   ## Example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,35:66</channelSelection>" 
+
+from string import *
+def DBConnectionFile(sqlitefile):
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+###########################################################################
+#                PhysWaveShifter properties
+###########################################################################
+
+if not 'InputKey' in dir():
+	InputKey = "LArPhysWave"
+
+if not 'OutputKey' in dir():
+	OutputKey = "LArPhysWave"
+
+###########################################################################
+#                          PhysWaveShifter output
+###########################################################################
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+   
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = RunNumber
+
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd   
+   
+if not 'OutputPhysWaveRootFileDir' in dir():
+   OutputPhysWaveRootFileDir = commands.getoutput("pwd")
+
+PhysWaveFileTag = "Shifted_"+str(RunNumber)+"_"+Partition.replace("*","")
+
+if not 'OutputPhysWaveRootFileName' in dir():
+   OutputPhysWaveRootFileName = "LArPhysWave_"+ PhysWaveFileTag + ".root"
+   
+if not 'OutputPhysWavePoolFileName' in dir():
+   OutputPhysWavePoolFileName = "LArPhysWave_"+ PhysWaveFileTag + ".pool.root"
+
+if not 'LArPhysFolderOutputTag' in dir():
+   LArPhysFolderOutputTag = LArCalib_Flags.tagSuffix    
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)
+
+if not 'OutputObjectSpecPhysWave' in dir():
+   OutputObjectSpecPhysWave   = "LArPhysWaveContainer#"+"LArPhysWave"+"#"+ LArCalib_Flags.LArPhysWaveFolder
+   OutputObjectSpecTagPhysWave    = LArCalibFolderTag(LArCalib_Flags.LArPhysWaveFolder,LArPhysFolderOutputTag) 
+
+if not 'DBConnectionCOOL' in dir():
+   DBConnectionCOOL = "impl=cool;techno=oracle;schema=ATLAS_COOLOFL_LAR;ATLAS_COOLPROD:COMP200:ATLAS_COOL_READER:"
+
+if ( ReadPhysWaveFromCOOL ):      
+   if 'InputPhysWaveSQLiteFile' in dir():
+      InputDBConnectionPhysWave = DBConnectionFile(InputPhysWaveSQLiteFile)
+   else:
+      InputDBConnectionPhysWave = DBConnectionCOOL
+
+###########################################################################
+# Print summary
+###########################################################################
+
+PhysWaveLog = logging.getLogger( "PhysWaveLog" )
+PhysWaveLog.info( " ======================================================== " )
+PhysWaveLog.info( " ***           LAr PhysWave summary                  *** " )
+PhysWaveLog.info( " ======================================================== " )
+PhysWaveLog.info( " RunNumber                               = "+str(RunNumber) )
+if ( ReadPhysWaveFromCOOL ):
+   PhysWaveLog.info( " InputDBConnectionPhysWave               = "+InputDBConnectionPhysWave )
+else :
+   PhysWaveLog.info( " InputPhysWavePoolFileName               = "+InputPhysWavePoolFileName )
+if ( (ReadPhysWaveFromCOOL) and ChannelSelection != " " ):
+   PhysWaveLog.info( " ChannelSelection                        = "+ChannelSelection )
+PhysWaveLog.info( " PhysWaveLArCalibFolderTag               = "+PhysWaveLArCalibFolderTag )
+PhysWaveLog.info( " OutputPhysWaveRootFullFileName          = "+OutputPhysWaveRootFileDir+"/"+OutputPhysWaveRootFileName )
+PhysWaveLog.info( " OutputPhysWavePoolFullFileName          = "+OutputPhysWavePoolFileDir+"/"+OutputPhysWavePoolFileName )
+PhysWaveLog.info( " OutputObjectSpecPhysWave                = "+str(OutputObjectSpecPhysWave) )
+PhysWaveLog.info( " OutputObjectSpecTagPhysWave             = "+str(OutputObjectSpecTagPhysWave) )
+PhysWaveLog.info( " IOVBegin                                = "+str(IOVBegin) )
+PhysWaveLog.info( " IOVEnd                                  = "+str(IOVEnd) )
+PhysWaveLog.info( " LArCalibOutputDB                        = "+OutputDB )
+PhysWaveLog.info( " ======================================================== " )
+###########################################################################
+
+###########################################################################
+#
+#                           Global settings
+#
+###########################################################################
+
+include( "AthenaCommon/Atlas_Gen.UnixStandardJob.py" )
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB
+try:
+   svcMgr.IOVDbSvc. DBInstance=""
+except: 
+   pass
+
+###########################################################################
+#                                                                         #
+#    Input conditions data (CaliWave) for COOL and/or POOL                #
+#                                                                         #
+###########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+if ( ReadPhysWaveFromCOOL ):
+   PhysWaveFolder  = "/LAR/ElecCalibOfl/PhysWaves/TempWillExistOnlyInTheSQLiteFile"
+   PhysWaveTagSpec = LArCalibFolderTag("/LAR/ElecCalibOfl/PhysWaves/TempWillExistOnlyInTheSQLiteFile",PhysWaveLArCalibFolderTag)
+   conddb.addFolder("",PhysWaveFolder+"<tag>"+PhysWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPhysWave+"</dbConnection>" + ChannelSelection)
+   
+else:
+   if 'InputPhysWavePoolFileName' in dir():
+      PoolFileList += [ InputPhysWavePoolDir+"/"+InputPhysWavePoolFileName ]
+   else:
+      print "No PoolFileList found! Please list the POOL files containing CaliWave or read from COOL."
+      theApp.exit(-1)
+
+if ( len(PoolFileList)>0 ):
+
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+   
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+
+
+###########################################################################
+#
+# Shift physics waveforms
+#
+###########################################################################
+
+from LArCalibUtils.LArCalibUtilsConf import LArPhysWaveShifter
+LArPhysWaveShifter = LArPhysWaveShifter("LArPhysWaveShifter")
+
+LArPhysWaveShifter.KeyList      = [ InputKey ]
+LArPhysWaveShifter.KeyOutput    = OutputKey
+LArPhysWaveShifter.GroupingType = GroupingType
+
+#
+# Minimum Tstart per FEB computation
+#
+LArPhysWaveShifter.ComputeTimeShiftByFEB  = True
+LArPhysWaveShifter.TimeShiftByFEBMode     = 2 # 1 = minimum Tstart from helper in FEB
+                                              # 2 = minumum Tpeak-NindexFromPeak in FEB
+LArPhysWaveShifter.TimeShiftByFEBDump     = True
+LArPhysWaveShifter.TimeShiftByFEBDumpFile = "TimeShiftFEB.py"
+
+#
+# Possible time shifts
+#
+LArPhysWaveShifter.TimeShiftByHelper = False
+LArPhysWaveShifter.TimeShiftByIndex  = 0
+LArPhysWaveShifter.TimeShiftByLayer  = False
+LArPhysWaveShifter.TshiftLayer       = [ 0 , 0 , 0 , 0 ]
+LArPhysWaveShifter.TimeShiftFromPeak = False
+LArPhysWaveShifter.NindexFromPeak    = 0 # if 0 will use Ndelays*Nsampling
+LArPhysWaveShifter.Ndelays           = 24
+#LArPhysWaveShifter.Nsamplings        = 3 
+LArPhysWaveShifter.Nsamplings        = 2
+LArPhysWaveShifter.TimeShiftByFEB    = True
+#LArPhysWaveShifter.TimeShiftGuardRegion  = 0
+LArPhysWaveShifter.TimeShiftGuardRegion  = 5
+
+
+topSequence += LArPhysWaveShifter
+
+###########################################################################
+if ( WriteNtuple ) :
+
+   from LArCalibTools.LArCalibToolsConf import LArWaves2Ntuple
+   LArPhysWaves2Ntuple = LArWaves2Ntuple("LArPhysWaves2Ntuple")
+   LArPhysWaves2Ntuple.NtupleName = "PHYSWAVE" 
+   LArPhysWaves2Ntuple.KeyList = [ OutputKey ] 
+   LArPhysWaves2Ntuple.ReadCaliWave = False
+   
+   topSequence+=LArPhysWaves2Ntuple   
+   
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputPhysWaveRootFileDir+"/"+OutputPhysWaveRootFileName+"' OPT='NEW'" ]
+   
+if (  WritePoolFile ) :
+
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   
+   # writre PredPhysWave
+   OutputConditionsAlgPhysWave = OutputConditionsAlg("OutputConditionsAlgPhysWave",OutputPhysWavePoolFileDir+"/"+OutputPhysWavePoolFileName,
+                                                     [OutputObjectSpecPhysWave],[OutputObjectSpecTagPhysWave],WriteIOV)
+   #OutputConditionsAlgPhysWave.WriteIOV = WriteIOV
+   OutputConditionsAlgPhysWave.Run1     = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlgPhysWave.Run2  = IOVEnd
+		
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+
+   from AthenaCommon.AppMgr import ServiceMgr
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = VERBOSE
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+
+###########################################################################
+#                Use EventSelector to select IOV                          #
+###########################################################################
+from McEventSelector.McEventSelectorConf import McEventSelector
+svcMgr += McEventSelector("EventSelector")
+svcMgr.EventSelector.RunNumber	= RunNumber
+svcMgr.EventSelector.EventsPerRun      = 1
+svcMgr.EventSelector.FirstEvent	       = 1
+svcMgr.EventSelector.InitialTimeStamp  = 0
+svcMgr.EventSelector.TimeStampInterval = 1
+
+##########################################################################
+#          don't remove otherwise infinite loop                          #
+##########################################################################
+
+theApp.EvtMax = 1
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = INFO)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = DEBUG)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
+
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase.py
new file mode 100644
index 00000000000..4b50a933976
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase.py
@@ -0,0 +1,423 @@
+import commands
+
+###########################################################################
+#
+# <Fabien.Tarrade@cern.ch>
+#
+# Example jobOptions to pickup OFC phys one phase 
+#
+# Last update: 09/12/2008 <Fabien.Tarrade@cern.ch>
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+
+###########################################################################
+#               Input selection (OFC Phys)
+###########################################################################
+
+# RunNumber trigger IOV if reading from COOL is eneabled
+if not 'RunNumber' in dir():
+   RunNumber = '0000000'
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"  
+
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"
+
+## OFC Phys      
+
+if not 'ReadOFCFromCOOL' in dir():
+   ReadOFCFromCOOL = True
+
+if not 'InputPoolDir' in dir():
+   InputPoolDir = commands.getoutput("pwd")
+
+if not 'InputPoolFileName' in dir():
+   InputPoolFileName = "LArOFCShapePhys.pool.root"
+
+## Shape Phys      
+if not 'ReadShapeFromCOOL' in dir():
+   ReadShapeFromCOOL = True
+
+if not 'InputShapePoolDir' in dir():
+   InputShapePoolDir = commands.getoutput("pwd")
+
+
+## COOL Channel selection
+if not 'ChannelSelection' in dir():
+   # Read all
+   ChannelSelection = " "
+   ## Example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,35:66</channelSelection>" 
+
+from string import *
+def DBConnectionFile(sqlitefile):
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+###########################################################################
+#                     OFC properties                                      #
+###########################################################################
+
+if not 'TimeOffsetCorrection' in dir():   
+   TimeOffsetCorrection = 0
+
+if not 'DefaultPhase' in dir():
+   DefaultPhase = 1
+
+if not 'OFCFolder' in dir() :
+   OFCFolder  = "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples3bins17phases"
+   #OFCFolder  = "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples"
+   
+if not 'ShapeFolder' in dir() :
+   ShapeFolder  =  "/LAR/ElecCalibOfl/Shape/RTM/5samples3bins17phases"
+   #ShapeFolder  =  "/LAR/ElecCalibOfl/Shape/RTM/5samples"
+
+if not 'OFCKey' in dir() :
+   OFCKey = "LArOFC"
+
+if not 'ShapeKey' in dir():
+   ShapeKey = "LArShape"
+
+if not 'FillShape' in dir():
+   FillShape = True # Do not fill a LArShapeComplete object for calibration OFC!
+
+###########################################################################
+#                               OFC output                                #
+###########################################################################
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+   
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumber)
+
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd   
+
+if not 'OutputOFCRootFileDir' in dir():
+   OutputOFCRootFileDir = commands.getoutput("pwd")
+   
+if not 'OutputPoolFileDir' in dir():
+   OutputPoolFileDir = commands.getoutput("pwd")
+
+OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","")
+
+OFCFileTag += "_5samples_Picked"
+
+if not 'OutputOFCRootFileName' in dir():
+   OutputOFCRootFileName = "LArOFCPhys_"+OFCFileTag + ".root"
+   
+if not 'OutputPoolFileName' in dir():
+   OutputPoolFileName = "LArOFCShapePhys_"+OFCFileTag + ".pool.root"
+   
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)
+
+#inputs
+
+
+#outputs
+if not 'FolderShapeOutput' in dir():
+   FolderShapeOutput = "/LAR/ElecCalibOfl/Shape/RTM/5samples1phase"
+if not 'FolderOFCOutput' in dir():
+   FolderOFCOutput = "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples1phase"
+
+rs=FolderTagResover()
+
+#inputs
+if not 'OFCFolderTag' in dir():
+   OFCFolderTag=rs.getFolderTagSuffix(OFCFolder)
+   OFCFolderTagSpec= LArCalibFolderTag(OFCFolder,OFCFolderTag)
+
+if not 'ShapeFolderTag' in dir():
+   ShapeFolderTag=rs.getFolderTagSuffix(ShapeFolder)
+   ShapeFolderTagSpec= LArCalibFolderTag(ShapeFolder,ShapeFolderTag)
+   
+
+#outputs
+if not 'LArOFCFolderOutputTag' in dir():
+   LArOFCFolderOutputTag=rs.getFolderTagSuffix(FolderOFCOutput)
+
+if not 'LArShapeFolderOutputTag' in dir(): 
+   LArShapeFolderOutputTag=rs.getFolderTagSuffix(FolderShapeOutput)
+
+del rs #Close database connection
+
+
+if not 'OutputObjectSpecOFC' in dir():
+   OutputObjectSpecOFC       = "LArOFCComplete#"+OFCKey+"#"+FolderOFCOutput 
+   OutputObjectSpecTagOFC    = LArCalibFolderTag(FolderOFCOutput,LArOFCFolderOutputTag)
+
+if not 'OutputObjectSpecShape' in dir():
+   OutputObjectSpecShape       = "LArShapeComplete#"+ShapeKey+"#"+FolderShapeOutput 
+   OutputObjectSpecTagShape    =  LArCalibFolderTag(FolderShapeOutput,LArShapeFolderOutputTag)
+     
+
+if not 'DBConnectionCOOL' in dir():
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"
+
+if ( ReadOFCFromCOOL ):      
+   if 'InputOFCSQLiteFile' in dir():
+      InputDBConnectionOFC = DBConnectionFile(InputOFCSQLiteFile)
+   else:
+      InputDBConnectionOFC = DBConnectionCOOL
+      
+if ( ReadShapeFromCOOL ):      
+   if 'InputShapeSQLiteFile' in dir():
+      InputDBConnectionShape = DBConnectionFile(InputShapeSQLiteFile)
+   else:
+      InputDBConnectionShape = DBConnectionCOOL
+
+## Bad Channel
+      
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;"
+      InputDBConnectionBadChannel = "COOLOFL_LAR/COMP200"            
+
+###########################################################################
+# Print summary
+###########################################################################
+
+OFCLog = logging.getLogger( "OFCLog" )
+OFCLog.info( " ======================================================== " )
+OFCLog.info( " ***                 LAr OFC summary                  *** " )
+OFCLog.info( " ======================================================== " )
+OFCLog.info( " RunNumber                          = "+str(RunNumber) )
+if ( ReadOFCFromCOOL ):
+   OFCLog.info( " InputDBConnectionOFC          = "+InputDBConnectionOFC )
+else :
+   OFCLog.info( " InputPoolFileName             = "+InputFileName )
+if 'OFCLArCalibFolderTag' in dir() :   
+   OFCLog.info( " OFCLArCalibFolderTag          = "+OFCLArCalibFolderTag )
+if ( ReadOFCFromCOOL and ChannelSelection != " " ):
+   OFCLog.info( " ChannelSelection                   = "+ChannelSelection )
+OFCLog.info( " OutputOFCRootFullFileName          = "+OutputOFCRootFileDir+"/"+OutputOFCRootFileName )
+OFCLog.info( " OutputPoolFullFileName             = "+OutputPoolFileDir+"/"+OutputPoolFileName )
+OFCLog.info( " OutputObjectSpecOFC                = "+str(OutputObjectSpecOFC) )
+OFCLog.info( " OutputObjectSpecTagOFC             = "+str(OutputObjectSpecTagOFC) )
+OFCLog.info( " IOVBegin                           = "+str(IOVBegin) )
+OFCLog.info( " IOVEnd                             = "+str(IOVEnd) )
+OFCLog.info( " LArCalibOutputDB                   = "+OutputDB )
+OFCLog.info( " ======================================================== " )
+
+###########################################################################
+#
+# Global settings
+#
+###########################################################################
+
+include("AthenaCommon/Atlas_Gen.UnixStandardJob.py")
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+###########################################################################
+#                                                                         #
+#    Input conditions data (OFC) for COOL and/or POOL                     #
+#                                                                         #
+###########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+include ("LArCalibProcessing/LArCalib_BadChanTool.py")
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   OFCLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   OFCLog.info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+   
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+if ( ReadOFCFromCOOL ):
+   if not ('InputOFCSQLiteFile')  in dir():
+      OFCLog.info( "Read OFC from Oracle" )
+   else :
+      OFCLog.info( "Read OFC from SQLite file" )
+      
+if ( ReadOFCFromCOOL ):
+      conddb.addFolder("",OFCFolder+"<tag>"+OFCFolderTagSpec+"</tag><key>LArOFCIn</key><dbConnection>"+InputDBConnectionOFC+"</dbConnection>"+ ChannelSelection)
+
+else:
+   if 'InputPoolFileName' in dir():
+      OFCLog.info( "Read OFC and Shape from POOL file")
+      PoolFileList += [ InputPoolDir+"/"+InputPoolFileName ]
+   else:
+      OFCLog.info( "No PoolFileList found! Please list the POOL files containing OFC or read from COOL." )
+      theApp.exit(-1)
+
+
+
+if ( ReadShapeFromCOOL ):
+   if not ('InputShapeSQLiteFile')  in dir():
+      OFCLog.info( "Read Shape from Oracle" )
+   else :
+      OFCLog.info( "Read Shape from SQLite file" )
+      
+if ( ReadShapeFromCOOL ):
+      conddb.addFolder("",ShapeFolder+"<tag>"+ShapeFolderTagSpec+"</tag><key>LArShapeIn</key><dbConnection>"+InputDBConnectionShape+"</dbConnection>"+ ChannelSelection)
+
+
+conddb.addFolder("","/LAR/ElecCalibOfl/OFCBin/Dummy<dbConnection>"+DBConnectionCOOL+"</dbConnection>"+ ChannelSelection)     
+   
+      
+      
+if ( len(PoolFileList)>0 ):
+
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+
+###########################################################################
+#                      pickup one phase OFC                               #
+###########################################################################
+
+from LArCalibUtils.LArCalibUtilsConf import LArOFPhasePicker
+LArOFPhasePicker = LArOFPhasePicker("LArOFPhasePicker")
+LArOFPhasePicker.KeyPhase = "LArOFCPhase"
+LArOFPhasePicker.KeyOFC_new = OFCKey
+LArOFPhasePicker.KeyOFC = "LArOFCIn"
+LArOFPhasePicker.KeyShape_new = ShapeKey
+LArOFPhasePicker.KeyShape = "LArShapeIn"
+LArOFPhasePicker.GroupingType = GroupingType
+LArOFPhasePicker.DefaultPhase = DefaultPhase
+LArOFPhasePicker.TimeOffsetCorrection = TimeOffsetCorrection
+topSequence += LArOFPhasePicker
+
+###########################################################################
+
+if ( WriteNtuple ) :
+
+   from LArCalibTools.LArCalibToolsConf import LArOFC2Ntuple
+   LArOFC2Ntuple = LArOFC2Ntuple("LArOFC2Ntuple")
+   LArOFC2Ntuple.ContainerKey = OFCKey
+   LArOFC2Ntuple.AddFEBTempInfo = False
+   topSequence+=LArOFC2Ntuple
+   
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputOFCRootFileDir+"/"+OutputOFCRootFileName): 
+      os.remove(OutputOFCRootFileDir+"/"+OutputOFCRootFileName)
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputOFCRootFileDir+"/"+OutputOFCRootFileName+"' OPT='NEW'" ]
+
+   
+if (  WritePoolFile ) :
+
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   if os.path.exists(OutputPoolFileDir+"/"+OutputPoolFileName): 
+      os.remove(OutputPoolFileDir+"/"+OutputPoolFileName)
+   OutputConditionsAlg = OutputConditionsAlg("OutputConditionsAlg",OutputPoolFileDir+"/"+OutputPoolFileName,
+                                                     [OutputObjectSpecOFC],[OutputObjectSpecTagOFC],WriteIOV)
+   OutputConditionsAlg.Run1  = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlg.Run2  = IOVEnd
+
+   if ( FillShape ):
+      OutputConditionsAlg.ObjectList += [OutputObjectSpecShape]
+      OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagShape]
+
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+   
+   from AthenaCommon.AppMgr import ServiceMgr
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+   svcMgr.IOVRegistrationSvc.RecreateFolders = True
+#   svcMgr.IOVRegistrationSvc.SVFolder = True
+   		
+###########################################################################
+#               Use EventSelector to select IOV                           #
+###########################################################################	
+
+from McEventSelector.McEventSelectorConf import McEventSelector
+svcMgr += McEventSelector("EventSelector")
+svcMgr.EventSelector.RunNumber	= 10000000 # not runNumberRunNumber
+svcMgr.EventSelector.EventsPerRun      = 1
+svcMgr.EventSelector.FirstEvent	= 1
+svcMgr.EventSelector.InitialTimeStamp  = 0
+svcMgr.EventSelector.TimeStampInterval = 1
+
+##########################################################################
+#          don't remove otherwise infinite loop                          #
+##########################################################################
+
+theApp.EvtMax = 1
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = VERBOSE)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = DEBUG)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
+
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase_WithPileup.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase_WithPileup.py
new file mode 100644
index 00000000000..567dd0a7924
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase_WithPileup.py
@@ -0,0 +1,455 @@
+import commands
+
+###########################################################################
+#
+# <Fabien.Tarrade@cern.ch>
+#
+# Example jobOptions to pickup OFC phys one phase 
+#
+# Last update: 09/12/2008 <Fabien.Tarrade@cern.ch>
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+
+###########################################################################
+#               Input selection (OFC Phys)
+###########################################################################
+
+# RunNumber trigger IOV if reading from COOL is eneabled
+if not 'RunNumber' in dir():
+   RunNumber = '0000000'
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"  
+
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"
+
+## OFC Phys      
+
+if not 'ReadOFCFromCOOL' in dir():
+   ReadOFCFromCOOL = True
+
+if not 'InputPoolDir' in dir():
+   InputPoolDir = commands.getoutput("pwd")
+
+if not 'InputPoolFileName' in dir():
+   InputPoolFileName = "LArOFCShapePhys.pool.root"
+
+## Shape Phys      
+if not 'ReadShapeFromCOOL' in dir():
+   ReadShapeFromCOOL = True
+
+if not 'InputShapePoolDir' in dir():
+   InputShapePoolDir = commands.getoutput("pwd")
+
+
+## COOL Channel selection
+if not 'ChannelSelection' in dir():
+   # Read all
+   ChannelSelection = " "
+   ## Example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,35:66</channelSelection>" 
+
+from string import *
+def DBConnectionFile(sqlitefile):
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+###########################################################################
+#                     OFC properties                                      #
+###########################################################################
+
+if not 'TimeOffsetCorrection' in dir():   
+   TimeOffsetCorrection = 0
+
+if not 'DefaultPhase' in dir():
+   DefaultPhase = 1
+
+if not 'OFCFolder' in dir() :
+   OFCFolder  = "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples3bins17phases"
+   #OFCFolder  = "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples"
+   
+if not 'ShapeFolder' in dir() :
+   ShapeFolder  =  "/LAR/ElecCalibOfl/Shape/RTM/5samples3bins17phases"
+   #ShapeFolder  =  "/LAR/ElecCalibOfl/Shape/RTM/5samples"
+
+if not 'OFCKey' in dir() :
+   OFCKey = "LArOFC"
+
+if not 'ShapeKey' in dir():
+   ShapeKey = "LArShape"
+
+if not 'FillShape' in dir():
+   FillShape = True # Do not fill a LArShapeComplete object for calibration OFC!
+
+###########################################################################
+#                               OFC output                                #
+###########################################################################
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+   
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumber)
+
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd   
+
+if not 'OutputOFCRootFileDir' in dir():
+   OutputOFCRootFileDir = commands.getoutput("pwd")
+   
+if not 'OutputPoolFileDir' in dir():
+   OutputPoolFileDir = commands.getoutput("pwd")
+
+OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","")
+
+OFCFileTag += "_5samples_Picked"
+
+if not 'OutputOFCRootFileName' in dir():
+   OutputOFCRootFileName = "LArOFCPhys_"+OFCFileTag + ".root"
+   
+if not 'OutputPoolFileName' in dir():
+   OutputPoolFileName = "LArOFCShapePhys_"+OFCFileTag + ".pool.root"
+   
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)
+
+#outputs
+if not 'FolderShapeOutput' in dir():
+   FolderShapeOutput = "/LAR/ElecCalibOfl/Shape/RTM/5samples1phase"
+if not 'FolderOFCOutput' in dir():
+   FolderOFCOutput = "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples1phase"
+
+rs=FolderTagResover()
+
+#inputs
+if not 'OFCFolderTag' in dir():
+   OFCFolderTag=rs.getFolderTagSuffix(OFCFolder)
+
+OFCFolderTagSpec= LArCalibFolderTag(OFCFolder,OFCFolderTag)
+
+if NColl > 0 and not 'OFCFolderTagmu' in dir():
+   OFCFolderTagmu=rs.getFolderTagSuffix(OFCFolder)
+
+if NColl > 0:
+   OFCFolderTagSpecmu=LArCalibFolderTag(OFCFolder,"-mu-"+str(NColl)+OFCFolderTag)
+
+if not 'ShapeFolderTag' in dir():
+   ShapeFolderTag=rs.getFolderTagSuffix(ShapeFolder)
+   ShapeFolderTagSpec= LArCalibFolderTag(ShapeFolder,ShapeFolderTag)
+   
+
+#outputs
+if not 'LArOFCFolderOutputTag' in dir():
+   LArOFCFolderOutputTag=rs.getFolderTagSuffix(FolderOFCOutput)
+
+if not 'LArShapeFolderOutputTag' in dir(): 
+   LArShapeFolderOutputTag=rs.getFolderTagSuffix(FolderShapeOutput)
+
+del rs #Close database connection
+
+
+if not 'OutputObjectSpecOFC' in dir():
+   OutputObjectSpecOFC       = "LArOFCComplete#"+OFCKey+"#"+FolderOFCOutput 
+   OutputObjectSpecTagOFC    = LArCalibFolderTag(FolderOFCOutput,LArOFCFolderOutputTag)
+   
+if NColl > 0 and not 'OutputObjectSpecOFCmu' in dir():
+   OutputObjectSpecOFCmu       = "LArOFCComplete#"+OFCKey+"_mu"+"#"+FolderOFCOutput 
+   OutputObjectSpecTagOFCmu    = LArCalibFolderTag(FolderOFCOutput,"-mu-"+str(NColl)+LArOFCFolderOutputTag)
+
+if not 'OutputObjectSpecShape' in dir():
+   OutputObjectSpecShape       = "LArShapeComplete#"+ShapeKey+"#"+FolderShapeOutput 
+   OutputObjectSpecTagShape    =  LArCalibFolderTag(FolderShapeOutput,LArShapeFolderOutputTag)
+     
+
+if not 'DBConnectionCOOL' in dir():
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"
+
+if ( ReadOFCFromCOOL ):      
+   if 'InputOFCSQLiteFile' in dir():
+      InputDBConnectionOFC = DBConnectionFile(InputOFCSQLiteFile)
+   else:
+      InputDBConnectionOFC = DBConnectionCOOL
+      
+if ( ReadShapeFromCOOL ):      
+   if 'InputShapeSQLiteFile' in dir():
+      InputDBConnectionShape = DBConnectionFile(InputShapeSQLiteFile)
+   else:
+      InputDBConnectionShape = DBConnectionCOOL
+
+## Bad Channel
+      
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;"
+      InputDBConnectionBadChannel = "COOLOFL_LAR/COMP200"            
+
+###########################################################################
+# Print summary
+###########################################################################
+
+OFCLog = logging.getLogger( "OFCLog" )
+OFCLog.info( " ======================================================== " )
+OFCLog.info( " ***                 LAr OFC summary                  *** " )
+OFCLog.info( " ======================================================== " )
+OFCLog.info( " RunNumber                          = "+str(RunNumber) )
+if ( ReadOFCFromCOOL ):
+   OFCLog.info( " InputDBConnectionOFC          = "+InputDBConnectionOFC )
+else :
+   OFCLog.info( " InputPoolFileName             = "+InputFileName )
+if 'OFCLArCalibFolderTag' in dir() :   
+   OFCLog.info( " OFCLArCalibFolderTag          = "+OFCLArCalibFolderTag )
+if ( ReadOFCFromCOOL and ChannelSelection != " " ):
+   OFCLog.info( " ChannelSelection                   = "+ChannelSelection )
+OFCLog.info( " OutputOFCRootFullFileName          = "+OutputOFCRootFileDir+"/"+OutputOFCRootFileName )
+OFCLog.info( " OutputPoolFullFileName             = "+OutputPoolFileDir+"/"+OutputPoolFileName )
+OFCLog.info( " OutputObjectSpecOFC                = "+str(OutputObjectSpecOFC) )
+OFCLog.info( " OutputObjectSpecTagOFC             = "+str(OutputObjectSpecTagOFC) )
+OFCLog.info( " IOVBegin                           = "+str(IOVBegin) )
+OFCLog.info( " IOVEnd                             = "+str(IOVEnd) )
+OFCLog.info( " LArCalibOutputDB                   = "+OutputDB )
+OFCLog.info( " ======================================================== " )
+
+###########################################################################
+#
+# Global settings
+#
+###########################################################################
+
+include("AthenaCommon/Atlas_Gen.UnixStandardJob.py")
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+###########################################################################
+#                                                                         #
+#    Input conditions data (OFC) for COOL and/or POOL                     #
+#                                                                         #
+###########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+include ("LArCalibProcessing/LArCalib_BadChanTool.py")
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   OFCLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   OFCLog.info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+   
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+if ( ReadOFCFromCOOL ):
+   if not ('InputOFCSQLiteFile')  in dir():
+      OFCLog.info( "Read OFC from Oracle" )
+   else :
+      OFCLog.info( "Read OFC from SQLite file" )
+      
+if ( ReadOFCFromCOOL ):
+      conddb.addFolder("",OFCFolder+"<tag>"+OFCFolderTagSpec+"</tag><key>LArOFCIn</key><dbConnection>"+InputDBConnectionOFC+"</dbConnection>"+ ChannelSelection)
+      if NColl > 0:
+         conddb.addFolder("",OFCFolder+"<tag>"+OFCFolderTagSpecmu+"</tag><key>LArOFCInmu</key><dbConnection>"+InputDBConnectionOFC+"</dbConnection>"+ ChannelSelection)
+
+else:
+   if 'InputPoolFileName' in dir():
+      OFCLog.info( "Read OFC and Shape from POOL file")
+      PoolFileList += [ InputPoolDir+"/"+InputPoolFileName ]
+   else:
+      OFCLog.info( "No PoolFileList found! Please list the POOL files containing OFC or read from COOL." )
+      theApp.exit(-1)
+
+
+
+if ( ReadShapeFromCOOL ):
+   if not ('InputShapeSQLiteFile')  in dir():
+      OFCLog.info( "Read Shape from Oracle" )
+   else :
+      OFCLog.info( "Read Shape from SQLite file" )
+      
+if ( ReadShapeFromCOOL ):
+      conddb.addFolder("",ShapeFolder+"<tag>"+ShapeFolderTagSpec+"</tag><key>LArShapeIn</key><dbConnection>"+InputDBConnectionShape+"</dbConnection>"+ ChannelSelection)
+
+
+conddb.addFolder("","/LAR/ElecCalibOfl/OFCBin/Dummy<dbConnection>"+DBConnectionCOOL+"</dbConnection>"+ ChannelSelection)     
+   
+      
+      
+if ( len(PoolFileList)>0 ):
+
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+
+###########################################################################
+#                      pickup one phase OFC                               #
+###########################################################################
+
+from LArCalibUtils.LArCalibUtilsConf import LArOFPhasePicker
+LArOFPhasePick = LArOFPhasePicker("LArOFPhasePicker")
+LArOFPhasePick.KeyPhase = "LArOFCPhase"
+LArOFPhasePick.KeyOFC_new = OFCKey
+LArOFPhasePick.KeyOFC = "LArOFCIn"
+LArOFPhasePick.KeyShape_new = ShapeKey
+LArOFPhasePick.KeyShape = "LArShapeIn"
+LArOFPhasePick.GroupingType = GroupingType
+LArOFPhasePick.DefaultPhase = DefaultPhase
+LArOFPhasePick.TimeOffsetCorrection = TimeOffsetCorrection
+topSequence += LArOFPhasePick
+
+if NColl > 0:
+   LArOFPhasePickermu = LArOFPhasePicker("LArOFPhasePickermu")
+   LArOFPhasePickermu.KeyPhase = "LArOFCPhase"
+   LArOFPhasePickermu.KeyOFC_new = OFCKey+"_mu"
+   LArOFPhasePickermu.KeyOFC = "LArOFCInmu"
+   LArOFPhasePickermu.doShape = False
+   LArOFPhasePickermu.GroupingType = GroupingType
+   LArOFPhasePickermu.DefaultPhase = DefaultPhase
+   LArOFPhasePickermu.TimeOffsetCorrection = TimeOffsetCorrection
+   topSequence += LArOFPhasePickermu
+
+###########################################################################
+
+if ( WriteNtuple ) :
+
+   from LArCalibTools.LArCalibToolsConf import LArOFC2Ntuple
+   LArOFC2Ntup = LArOFC2Ntuple("LArOFC2Ntuple")
+   LArOFC2Ntup.ContainerKey = OFCKey
+   LArOFC2Ntup.AddFEBTempInfo = False
+   topSequence+=LArOFC2Ntup
+   
+   if NColl > 0:
+      LArOFC2Ntuplemu = LArOFC2Ntuple("LArOFC2Ntuplemu")
+      LArOFC2Ntuplemu.ContainerKey = OFCKey+"_mu"
+      LArOFC2Ntuplemu.NtupleName="OFC_mu"
+      LArOFC2Ntuplemu.AddFEBTempInfo = False
+      topSequence+=LArOFC2Ntuplemu
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputOFCRootFileDir+"/"+OutputOFCRootFileName): 
+      os.remove(OutputOFCRootFileDir+"/"+OutputOFCRootFileName)
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputOFCRootFileDir+"/"+OutputOFCRootFileName+"' OPT='NEW'" ]
+
+   
+if (  WritePoolFile ) :
+
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   if os.path.exists(OutputPoolFileDir+"/"+OutputPoolFileName): 
+      os.remove(OutputPoolFileDir+"/"+OutputPoolFileName)
+   OutputConditionsAlg = OutputConditionsAlg("OutputConditionsAlg",OutputPoolFileDir+"/"+OutputPoolFileName,
+                                                     [OutputObjectSpecOFC],[OutputObjectSpecTagOFC],WriteIOV)
+   OutputConditionsAlg.Run1  = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlg.Run2  = IOVEnd
+
+   if ( FillShape ):
+      OutputConditionsAlg.ObjectList += [OutputObjectSpecShape]
+      OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagShape]
+
+   if NColl > 0:
+      OutputConditionsAlg.ObjectList += [OutputObjectSpecOFCmu]
+      OutputConditionsAlg.IOVTagList += [OutputObjectSpecTagOFCmu]
+
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+   
+   from AthenaCommon.AppMgr import ServiceMgr
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+#   svcMgr.IOVRegistrationSvc.SVFolder = True
+   		
+###########################################################################
+#               Use EventSelector to select IOV                           #
+###########################################################################	
+
+from McEventSelector.McEventSelectorConf import McEventSelector
+svcMgr += McEventSelector("EventSelector")
+svcMgr.EventSelector.RunNumber	= 10000000 # not runNumberRunNumber
+svcMgr.EventSelector.EventsPerRun      = 1
+svcMgr.EventSelector.FirstEvent	= 1
+svcMgr.EventSelector.InitialTimeStamp  = 0
+svcMgr.EventSelector.TimeStampInterval = 1
+
+##########################################################################
+#          don't remove otherwise infinite loop                          #
+##########################################################################
+
+theApp.EvtMax = 1
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = VERBOSE)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = DEBUG)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
+
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RTMParams_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RTMParams_jobOptions.py
new file mode 100644
index 00000000000..87025b4b4d2
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RTMParams_jobOptions.py
@@ -0,0 +1,728 @@
+import commands
+
+###########################################################################
+#
+# <Marco.Delmastro@cern.ch>
+#
+# Example jobOptions to extract RTM parameters from Cali/Master waveforms
+#
+# Last update: 09/12/2008 <Fabien.Tarrade@cern.ch>
+#
+###########################################################################
+
+include ("LArCalibProcessing/LArCalib_Flags.py")
+
+###########################################################################
+# Input selection
+###########################################################################
+
+## RunNumber trigger IOV if reading from COOL is eneabled
+
+if not 'RunNumber' in dir():
+   RunNumber = '0000000'
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"  
+
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition = "EB-EC*"
+   else:
+      Partition = "EB-EMB*"
+
+from string import *
+def DBConnectionFile(sqlitefile):  
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+if not 'DBConnectionCOOL' in dir():
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"
+
+
+if not 'StripsXtalkCorr' in dir():
+   StripsXtalkCorr = True 
+
+if not 'ChannelSelection' in dir():
+   ChannelSelection = " "  # Read all
+   ## Example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,35:66</channelSelection>" 
+   
+
+## CaliWave
+      
+if not 'ReadCaliWaveFromCOOL' in dir():
+   ReadCaliWaveFromCOOL = True
+
+if not 'InputCaliWavePoolDir' in dir():
+   InputCaliWavePoolDir = commands.getoutput("pwd")
+
+if not 'InputCaliWavePoolFileName' in dir():
+   InputCaliWavePoolFileName = "LArCaliWave.pool.root"
+
+## CaliPulseParams
+   
+if not 'ReadCaliPulseParamsFromCOOL' in dir():
+   ReadCaliPulseParamsFromCOOL = False
+
+if not 'InputCaliPulseParamsFolder' in dir():
+   InputCaliPulseParamsFolder     = "/LAR/ElecCalibOfl/CaliPulseParams/RTM" 
+
+
+if not 'InputCaliPulseParamsPoolDir' in dir():
+   InputCaliPulseParamsPoolDir = commands.getoutput("pwd")
+
+if not 'InputCaliPulseParamsPoolFileName' in dir():
+   InputPulseParamsPoolFileName = "LArCaliPulseParamsVsCalib_AllBoards.pool.root"
+
+## DetCellParams
+   
+if not 'ReadDetCellParamsFromCOOL' in dir():
+   ReadDetCellParamsFromCOOL = False
+
+if not 'InputDetCellParamsFolder' in dir():
+   InputDetCellParamsFolder       = "/LAR/ElecCalibOfl/DetCellParams/RTM"  
+
+if not 'InputDetCellParamsPoolDir' in dir():
+   InputDetCellParamsPoolDir = commands.getoutput("pwd")
+
+if not 'InputDetCellParamsPoolFileName' in dir():
+   InputDetCellParamsPoolFileName = "LArDetCellParams.pool.root"
+   
+###########################################################################
+#  RTM algorithms steering option defaults
+###########################################################################
+
+###################################
+#  Basic extraction defaults      #
+###################################
+
+if not 'ExtractTcal'  in dir():
+   ExtractTcal  = True
+
+if not 'ExtractFstep' in dir():
+   ExtractFstep = True
+
+if not 'ExtractOmega0' in dir():
+   ExtractOmega0  = True
+
+if not 'ExtractTaur'  in dir():
+   ExtractTaur  = True
+
+###################################
+#     Extract All Parameters      #
+###################################
+
+if ( 'ExtractAllParameters' in dir() and ExtractAllParameters ) :
+
+   ReadCaliPulseParamsFromCOOL = False
+   ExtractTcal   = True
+   ExtractFstep  = True
+
+   ReadDetCellParamsFromCOOL   = False
+   ExtractOmega0 = True
+   ExtractTaur   = True
+   
+###################################
+#      Extract only tauR          #
+###################################
+
+if ( 'ExtractTauROnly' in dir() and ExtractTauROnly ) :
+
+   ReadCaliPulseParamsFromCOOL = True
+   ExtractTcal   = False
+   ExtractFstep  = False
+   
+   ReadDetCellParamsFromCOOL   = True
+   ExtractOmega0 = False
+   ExtractTaur   = True
+
+## If needed, reads the LArCalibPulseParams from COOL (Oracle/SQLite)
+
+if ( ReadCaliPulseParamsFromCOOL ):
+   if 'InputCaliPulseParamsSQLiteFile' in dir():
+      InputDBConnectionCaliPulseParams = DBConnectionFile(InputCaliPulseParamsSQLiteFile)
+   else:
+      InputDBConnectionCaliPulseParams = DBConnectionCOOL
+
+## If needed, reads the LArDetCellParams (for Omega0 values) from COOL (Oracle/SQLite)
+
+if ( ReadDetCellParamsFromCOOL ):
+   if 'InputDetCellParamsSQLiteFile' in dir():
+      InputDBConnectionDetCellParams = DBConnectionFile(InputDetCellParamsSQLiteFile)
+   else:
+      InputDBConnectionDetCellParams = DBConnectionCOOL
+
+if ( ReadCaliWaveFromCOOL ):      
+   if 'InputCaliWaveSQLiteFile' in dir():
+      InputDBConnectionCaliWave = DBConnectionFile(InputCaliWaveSQLiteFile)
+   else:
+      InputDBConnectionCaliWave = DBConnectionCOOL
+
+###########################################################################
+
+if not 'doTest' in dir():
+   doTest = False        
+
+if not 'SuffixRetrievedCaliPulse' in dir():
+   SuffixRetrievedCaliPulse = ""
+        
+if not 'SuffixRetrievedDetCell' in dir():
+   SuffixRetrievedDetCell = ""
+
+if not 'SuffixExtractedCaliPulse' in dir():
+   SuffixExtractedCaliPulse = "_RTM"
+
+if not 'SuffixExtractedDetCell' in dir():
+   SuffixExtractedDetCell = "_RTM"
+
+if not 'RecoverEmptyDB' in dir():
+   RecoverEmptyDB = True
+
+#
+# Cosine response scan
+#
+
+if not 'UseOmegaScanHelper' in dir():
+   UseOmegaScanHelper = True
+
+if not 'CosRespScan' in dir():
+   CosRespScan  = [ False ,  True , False , False ] # Strips only
+
+if not 'Omega0Min' in dir():
+   Omega0Min    = [ 0.100 , 0.220 ,  0.060 ,  0.100 ]
+
+if not 'Omega0Max' in dir(): 
+   Omega0Max    = [ 0.600 , 0.310 ,  0.215 ,  0.700 ]
+
+if not 'NpointScan' in dir():
+   NpointScan   = [   800 ,   900 ,    310 ,    120 ]
+
+if not 'TShaper' in dir():
+   TShaper = 15
+
+if not 'CosRespTtailMin' in dir():
+   CosRespTtailMin = 0 
+
+if not 'CosRespTtailMax' in dir():
+   CosRespTtailMax = 0
+
+#
+# Residual oscillation minimisation
+#
+
+if not 'DeltaTtailTaur' in dir():
+   DeltaTtailTaur  = 100
+
+#
+# Special output
+#
+
+if not 'DumpOmegaScan' in dir():
+   DumpOmegaScan = False
+
+if not 'OmegaScanKey' in dir():
+   OmegaScanKey = "OmegaScan"
+	
+if not 'DumpResOscill' in dir():
+   DumpResOscill = False
+
+if not 'ResOscillKeyBefore' in dir():
+   ResOscillKeyBefore = "ResOscillBefore"
+
+if not 'ResOscillKeyAfter' in dir():
+   ResOscillKeyAfter  = "ResOscillAfter"
+
+if not 'StoreResOscill' in dir():
+   StoreResOscill = [ False , False , False , False ]
+
+#
+# FT/Slot selection
+#
+
+if not 'FTSelection' in dir():
+   FTSelection   = False
+
+if not 'PosNeg' in dir():
+   PosNeg        = 0
+	
+if not 'FT' in dir():
+   FT            = [ 0 ]
+
+if not 'SlotSelection' in dir():
+   SlotSelection = False
+
+if not 'Slot' in dir():
+   Slot          = [ 0 ]
+
+#
+# Input wave type
+#
+
+if not 'ContainerKey' in dir():
+   ContainerKey = "LArCaliWave"
+
+if not 'IgnoreDACSelection' in dir():
+   IgnoreDACSelection = True
+
+if not 'DAC' in dir():
+   DAC = [ 500 , 4000, 40000 ] # High, Medium, Low
+
+###########################################################################
+#                     RTMParams output                                    #
+###########################################################################
+
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+   
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+   
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumber)
+
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd
+
+if not 'OutputParamsRootFileDir' in dir():
+   OutputParamsRootFileDir= commands.getoutput("pwd")
+    
+if not 'OutputParamsPoolFileDir' in dir():
+   OutputParamsPoolFileDir= commands.getoutput("pwd")
+
+if not 'RTMFileTag' in dir():
+   RTMFileTag = "DefaultExtraction_"+str(RunNumber)+"_"+Partition.replace("*","")
+
+if not 'OutputParamsRootFileName' in dir():
+   OutputParamsRootFileName = "LArParams_"+RTMFileTag + ".root"
+   
+if not 'OutputParamsPoolFileName' in dir():
+   OutputParamsPoolFileName = "LArRTMParams_"+RTMFileTag + ".pool.root"
+   
+if not 'OutputCaliPulseParamsFolder' in dir():
+   OutputCaliPulseParamsFolder = "/LAR/ElecCalibOfl/CaliPulseParams/RTM"
+   
+if not 'OutputDetCellParamsFolder' in dir():
+   OutputDetCellParamsFolder = "/LAR/ElecCalibOfl/DetCellParams/RTM"
+
+if not StripsXtalkCorr:
+   CaliWaveFolder = LArCalib_Flags.LArCaliWaveFolder
+else:
+   CaliWaveFolder = LArCalib_Flags.LArCaliWaveFolderXtlk
+
+rs=FolderTagResover()
+if not "LArDetCellParamsTag" in dir():
+   LArDetCellParamsTag=rs.getFolderTagSuffix(OutputDetCellParamsFolder)
+
+if not "LArCaliPulseParamsTag" in dir():
+   LArCaliPulseParamsTag=rs.getFolderTagSuffix(OutputCaliPulseParamsFolder)
+
+if not "CaliWaveLArCalibFolderTag" in dir ():
+   CaliWaveLArCalibFolderTag=rs.getFolderTagSuffix(CaliWaveFolder)
+
+del rs #Close database
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)
+
+if not 'OutputObjectSpecCaliPulseParams' in dir():
+   OutputObjectSpecCaliPulseParams    = "LArCaliPulseParamsComplete#"+"LArCaliPulseParams_RTM#"+ OutputCaliPulseParamsFolder
+   OutputObjectSpecTagCaliPulseParams = LArCalibFolderTag(OutputCaliPulseParamsFolder,LArCaliPulseParamsTag,)
+						
+if not 'OutputObjectSpecDetCellParams' in dir():
+   OutputObjectSpecDetCellParams      = "LArDetCellParamsComplete#"+"LArDetCellParams_RTM#"+ OutputDetCellParamsFolder		
+   OutputObjectSpecTagDetCellParams   = LArCalibFolderTag(OutputDetCellParamsFolder,LArDetCellParamsTag)
+
+## Bad Channel   
+   
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;"
+      InputDBConnectionBadChannel = "COOLOFL_LAR/COMP200"         
+
+###########################################################################
+#                            Print summary
+###########################################################################
+
+RTMParamsLog = logging.getLogger( "RTMParamsLog" )
+RTMParamsLog.info( " ========================================================= " )
+RTMParamsLog.info( " ***               LAr RTMParams summary               *** " )
+RTMParamsLog.info( " ========================================================= " )
+RTMParamsLog.info( " RunNumber                                  = "+str(RunNumber) )
+
+if ( ReadCaliWaveFromCOOL ):
+   RTMParamsLog.info( " InputDBConnectionCaliWave                  = "+InputDBConnectionCaliWave )
+   RTMParamsLog.info( " CaliWaveLArCalibFolderTag                  = "+CaliWaveLArCalibFolderTag )   
+else :
+   RTMParamsLog.info( " InputCaliWavePoolFileName                  = "+InputCaliWavePoolFileName )
+
+if ( ReadCaliWaveFromCOOL and ChannelSelection != " " ):
+   RTMParamsLog.info( " ChannelSelection                           = "+ChannelSelection )
+
+if ( ReadCaliPulseParamsFromCOOL ):
+   RTMParamsLog.info( " InputDBConnectionCaliPulseParams           = "+InputDBConnectionCaliPulseParams )
+   RTMParamsLog.info( " InputCaliPulseParamsFolder                 = "+InputCaliPulseParamsFolder )
+   if  "CaliPulseParamsLArCalibFolderTag" in dir() :    
+      RTMParamsLog.info( " CaliPulseParamsLArCalibFolderTag           = "+CaliPulseParamsLArCalibFolderTag )
+
+if ( ReadDetCellParamsFromCOOL ):
+   RTMParamsLog.info( " InputDBConnectionDetCellParams             = "+InputDBConnectionDetCellParams )
+   RTMParamsLog.info( " InputDetCellParamsFolder                   = "+InputDetCellParamsFolder )
+   if "DetCellParamsLArCalibFolderTag" in dir() :
+      RTMParamsLog.info( " DetCellParamsLArCalibFolderTag             = "+DetCellParamsLArCalibFolderTag )
+   
+if ( not ExtractTcal or not ExtractFstep and not ReadCaliPulseParamsFromCOOL ):
+   RTMParamsLog.info( " InputCaliPulseParamsPoolFileName           = "+InputPulseParamsPoolFileName )
+
+if ( not ExtractOmega0 or not ExtractTaur and not ReadDetCellParamsFromCOOL ):
+   RTMParamsLog.info( " InputDetCellParamsPoolFileName             = "+InputDetCellParamsPoolFileName )
+
+if ( WriteNtuple ):
+   RTMParamsLog.info( " OutputParamsRootFullFileName               = "+OutputParamsRootFileDir+"/"+OutputParamsRootFileName )
+
+if (WritePoolFile):
+   RTMParamsLog.info( " OutputParamsPoolFullFileName          = "+OutputParamsPoolFileDir+"/"+OutputParamsPoolFileName )
+   RTMParamsLog.info( " OutputObjectSpecCaliPulseParams            = "+str(OutputObjectSpecCaliPulseParams) )
+   RTMParamsLog.info( " OutputObjectSpecTagCaliPulseParams         = "+str(OutputObjectSpecTagCaliPulseParams) )
+   RTMParamsLog.info( " OutputObjectSpecDetCellParams              = "+str(OutputObjectSpecDetCellParams) )
+   RTMParamsLog.info( " OutputObjectSpecTagDetCellParams           = "+str(OutputObjectSpecTagDetCellParams) )
+
+if (WriteIOV):
+   RTMParamsLog.info( " IOVBegin                                   = "+str(IOVBegin) )
+   RTMParamsLog.info( " IOVEnd                                     = "+str(IOVEnd) )
+   RTMParamsLog.info( " LArCalibOutputDB                           = "+OutputDB )
+   RTMParamsLog.info( " OutputDetCellParamsFolder                  = "+OutputDetCellParamsFolder )
+   RTMParamsLog.info( " OutputDetCellParamsFolder                  = "+OutputDetCellParamsFolder )
+   
+RTMParamsLog.info( " ======================================================== " )
+
+###########################################################################
+#
+#                           Global settings
+#
+###########################################################################
+
+include( "AthenaCommon/Atlas_Gen.UnixStandardJob.py" )
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+include("LArCalibProcessing/LArCalib_MinimalSetup.py")
+
+###########################################################################
+#                                                                         #
+#    Input conditions data (CaliWave) for COOL and/or POOL                #
+#                                                                         #
+###########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList = []
+
+include ("LArCalibProcessing/LArCalib_BadChanTool.py")
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   RTMParamsLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   RTMParamsLog.info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+if (  ReadCaliWaveFromCOOL ) :
+   if not 'InputCaliWaveSQLiteFile' in dir():
+      RTMParamsLog.info( "Read CaliWave from Oracle DB" )
+   else :
+      RTMParamsLog.info( "Read CaliWave from SQLite file" )
+
+if ( not ExtractTcal or not ExtractFstep ):
+   if ( ReadCaliPulseParamsFromCOOL  ) :
+      if not 'InputCaliPulseParamsSQLiteFile' in dir():
+         RTMParamsLog.info( "Read CaliPulseParams from Oracle DB" )
+      else :
+         RTMParamsLog.info( "Read CaliPulseParams from SQLite file" )
+
+if ( not ExtractOmega0 or not ExtractTaur):
+    if ( ReadDetCellParamsFromCOOL  ) :
+      if not 'InputDetCellParamsSQLiteFile' in dir():
+         RTMParamsLog.info( "Read DetCellParams from Oracle DB" )
+      else :
+         RTMParamsLog.info( "Read DetCellParams from SQLite file" )     
+
+## CaliWave
+if ( ReadCaliWaveFromCOOL ):
+   CaliWaveTagSpec = LArCalibFolderTag(CaliWaveFolder,CaliWaveLArCalibFolderTag)
+   conddb.addFolder("",CaliWaveFolder+"<tag>"+CaliWaveTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionCaliWave+"</dbConnection>" + ChannelSelection)
+else:
+   if 'InputCaliWavePoolFileName' in dir():
+      RTMParamsLog.info("Read CaliWave from POOL file")
+      PoolFileList += [ InputCaliWavePoolDir+"/"+InputCaliWavePoolFileName ]
+   else:
+      RTMParamsLog.error("No PoolFileList found! Please list the POOL files containing CaliWave or read from COOL.")
+      theApp.exit(-1)
+
+## CaliPulseParams
+if ( not ExtractTcal or not ExtractFstep ): # Load CaliPulseParams from COOL or POOL only if extraction is not selected
+   if ( ReadCaliPulseParamsFromCOOL ):
+      if 'CaliPulseParamsLArCalibFolderTag' in dir():
+         CaliPulseParamsTagSpec = LArCalibFolderTag(InputCaliPulseParamsFolder,CaliPulseParamsLArCalibFolderTag)
+         conddb.addFolder("",InputCaliPulseParamsFolder+"<tag>"+CaliPulseParamsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionCaliPulseParams+"</dbConnection>" + ChannelSelection)
+      else :
+         conddb.addFolder("",InputCaliPulseParamsFolder+"<key>LArCaliPulseParams</key><dbConnection>"+InputDBConnectionCaliPulseParams+"</dbConnection>" + ChannelSelection)
+   else:
+      if 'InputCaliPulseParamsPoolFileName' in dir():
+         RTMParamsLog.info("Read CaliPulseParams from POOL file")
+         PoolFileList += [ InputCaliPulseParamsPoolDir+"/"+InputCaliPulseParamsPoolFileName ]
+      else:
+         RTMParamsLog.error("No PoolFileList found! Please list the POOL files containing CaliPulseParams or read from COOL.")
+         theApp.exit(-1)
+
+## DetCellParams
+if ( not ExtractOmega0 or not ExtractTaur): # Load DetCellParams from COOL or POOL only if extraction is not selected
+   if ( ReadDetCellParamsFromCOOL ):
+      if 'DetCellParamsLArCalibFolderTag' in dir():
+         DetCellParamsTagSpec = LArCalibFolderTag(InputDetCellParamsFolder,DetCellParamsLArCalibFolderTag)
+         conddb.addFolder("",InputDetCellParamsFolder+"<tag>"+DetCellParamsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionDetCellParams+"</dbConnection>" + ChannelSelection)
+      else :
+         conddb.addFolder("",InputDetCellParamsFolder+"<key>LArDetCellParams</key><dbConnection>"+InputDBConnectionDetCellParams+"</dbConnection>" + ChannelSelection)
+   else:  
+      if 'InputDetCellParamsPoolFileName' in dir():
+         RTMParamsLog.info("Read DetCellParams from POOL file")
+         PoolFileList += [ InputDetCellParamsPoolDir+"/"+InputDetCellParamsPoolFileName ]
+      else:
+         RTMParamsLog.error("No PoolFileList found! Please list the POOL files containing DetCellParams or read from COOL.")
+         theApp.exit(-1)
+
+if ( len(PoolFileList)>0 ):
+
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+   
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+   
+###########################################################################
+#                                                                         #
+#              Extract RTM parameters Cali/Master waveforms               #
+#                                                                         #
+###########################################################################
+
+if not 'doTest' in dir():
+   doTest = False
+
+from LArCalibUtils.LArCalibUtilsConf import LArRTMParamExtractor
+LArRTMParamExtractor = LArRTMParamExtractor("LArRTMParamExtractor")
+
+LArRTMParamExtractor.KeyList        = [ ContainerKey ]
+LArRTMParamExtractor.TestMode       = doTest
+LArRTMParamExtractor.GroupingType   = GroupingType
+LArRTMParamExtractor.DAC            = DAC
+LArRTMParamExtractor.IgnoreDACSelection = IgnoreDACSelection
+
+LArRTMParamExtractor.ExtractTcal    = ExtractTcal
+LArRTMParamExtractor.ExtractFstep   = ExtractFstep
+LArRTMParamExtractor.ExtractOmega0  = ExtractOmega0
+LArRTMParamExtractor.ExtractTaur    = ExtractTaur
+
+LArRTMParamExtractor.RecoverEmptyDB = RecoverEmptyDB
+
+LArRTMParamExtractor.SuffixRetrievedCaliPulse = SuffixRetrievedCaliPulse
+LArRTMParamExtractor.SuffixRetrievedDetCell   = SuffixRetrievedDetCell
+LArRTMParamExtractor.SuffixExtractedCaliPulse = SuffixExtractedCaliPulse
+LArRTMParamExtractor.SuffixExtractedDetCell   = SuffixExtractedDetCell
+
+LArRTMParamExtractor.FTSelection   = FTSelection
+LArRTMParamExtractor.FT            = FT
+LArRTMParamExtractor.PosNeg        = PosNeg
+
+LArRTMParamExtractor.SlotSelection = SlotSelection
+LArRTMParamExtractor.Slot          = Slot
+	
+LArRTMParamExtractor.DumpOmegaScan = DumpOmegaScan
+LArRTMParamExtractor.OmegaScanKey  = OmegaScanKey 
+
+LArRTMParamExtractor.DumpResOscill      = DumpResOscill
+LArRTMParamExtractor.ResOscillKeyBefore = ResOscillKeyBefore
+LArRTMParamExtractor.ResOscillKeyAfter  = ResOscillKeyAfter
+
+from LArCalibUtils.LArCalibUtilsConf import LArWFParamTool
+theLArWFParamTool = LArWFParamTool()
+    
+if 'NBaseline' in dir():
+   theLArWFParamTool.NBaseline = NBaseline
+
+if 'SubtractBaseline' in dir():
+   theLArWFParamTool.SubtractBaseline = SubtractBaseline
+
+if 'ShiftToStart' in dir():
+   theLArWFParamTool.ShiftToStart = ShiftToStart
+
+if 'TShaper' in dir():
+   theLArWFParamTool.TShaper = TShaper
+
+## if 'DeltaTtailTaur' in dir():
+##	theLArWFParamTool.DeltaTtail  = [ 100, 50, DeltaTtailTaur ]
+
+theLArWFParamTool.TtailMin = [ 0, 0, CosRespTtailMin, 0 ]
+theLArWFParamTool.TtailMax = [ 0, 0, CosRespTtailMax, 0 ]
+
+if 'UseOmegaScanHelper' in dir():
+   theLArWFParamTool.UseOmegaScanHelper = UseOmegaScanHelper
+if 'CosRespScan'in dir():
+   theLArWFParamTool.CosRespScan = CosRespScan
+
+if 'Omega0Min' in dir(): 
+   theLArWFParamTool.Omega0Min   = Omega0Min  
+
+if 'Omega0Max' in dir():
+   theLArWFParamTool.Omega0Max   = Omega0Max
+
+if 'NpointScan' in dir():
+   theLArWFParamTool.NpointScan  = NpointScan 
+
+if 'StoreResOscill' in dir():
+   theLArWFParamTool.StoreResOscill = StoreResOscill
+
+ToolSvc += theLArWFParamTool
+
+topSequence += LArRTMParamExtractor
+
+###########################################################################
+
+if ( WriteNtuple ):
+
+   from LArCalibTools.LArCalibToolsConf import LArWFParams2Ntuple
+   LArWFParams2Ntuple = LArWFParams2Ntuple("LArWFParams2Ntuple")
+   LArWFParams2Ntuple.DumpCaliPulseParams = True
+   LArWFParams2Ntuple.DumpDetCellParams   = True
+   #LArWFParams2Ntuple.DetStoreSuffix      = "_RTM"
+   LArWFParams2Ntuple.CaliPulseParamsKey="LArCaliPulseParams_RTM"
+   LArWFParams2Ntuple.DetCellParamsKey="LArDetCellParams_RTM"
+   topSequence += LArWFParams2Ntuple
+   
+   if ( DumpOmegaScan ):
+      
+      from LArCalibTools.LArCalibToolsConf import LArCaliWaves2Ntuple as LArOmegaScans2Ntuple
+      LArOmegaScans2Ntuple = LArOmegaScans2Ntuple( "LArOmegaScans2Ntuple" )
+      LArOmegaScans2Ntuple.NtupleName = "OMEGASCAN"
+      LArOmegaScans2Ntuple.KeyList = [ OmegaScanKey ]
+      
+      topSequence += LArOmegaScans2Ntuple
+		
+   if ( DumpResOscill ):
+
+      from LArCalibTools.LArCalibToolsConf import LArCaliWaves2Ntuple as LArResOscillsBefore2Ntuple
+      LArResOscillsBefore2Ntuple = LArResOscillsBefore2Ntuple( "LArResOscillsBefore2Ntuple" )
+      LArResOscillsBefore2Ntuple.NtupleName = "RESOSCILLBEFORE"
+      LArResOscillsBefore2Ntuple.KeyList = [ ResOscillKeyBefore ]
+
+      topSequence += LArResOscillsBefore2Ntuple
+		
+      from LArCalibTools.LArCalibToolsConf import LArCaliWaves2Ntuple as LArResOscillsAfter2Ntuple
+      LArResOscillsAfter2Ntuple = LArResOscillsAfter2Ntuple( "LArResOscillsAfter2Ntuple" )
+      LArResOscillsAfter2Ntuple.NtupleName = "RESOSCILLAFTER"
+      LArResOscillsAfter2Ntuple.KeyList = [ ResOscillKeyAfter ]
+
+      topSequence += LArResOscillsAfter2Ntuple
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputParamsRootFileDir+"/"+OutputParamsRootFileName): 
+      os.remove(OutputParamsRootFileDir+"/"+OutputParamsRootFileName)  
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputParamsRootFileDir+"/"+OutputParamsRootFileName+"' OPT='NEW'" ]
+
+if (  WritePoolFile ) :
+   
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   
+   # write CaliPulseParams and DetCellParams
+   if os.path.exists(OutputParamsPoolFileDir+"/"+OutputParamsPoolFileName): 
+      os.remove(OutputParamsPoolFileDir+"/"+OutputParamsPoolFileName)  
+   OutputConditionsAlgParams = OutputConditionsAlg("OutputConditionsAlgParams",OutputParamsPoolFileDir+"/"+OutputParamsPoolFileName,
+                                                        [OutputObjectSpecCaliPulseParams],[OutputObjectSpecTagCaliPulseParams],WriteIOV)
+   OutputConditionsAlgParams.ObjectList += [OutputObjectSpecDetCellParams]
+   OutputConditionsAlgParams.IOVTagList += [OutputObjectSpecTagDetCellParams]
+
+   OutputConditionsAlgParams.Run1     = IOVBegin
+   if IOVEnd>0:
+      OutputConditionsAlgParams.Run2  = IOVEnd
+		
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = VERBOSE
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False	
+
+###########################################################################
+#                Use EventSelector to select IOV                          #
+###########################################################################
+
+from McEventSelector.McEventSelectorConf import McEventSelector
+svcMgr += McEventSelector("EventSelector")
+svcMgr.EventSelector.RunNumber = int(RunNumber)
+svcMgr.EventSelector.EventsPerRun      = 1
+svcMgr.EventSelector.FirstEvent	       = 0
+svcMgr.EventSelector.InitialTimeStamp  = 0
+svcMgr.EventSelector.TimeStampInterval = 1
+
+##########################################################################
+#          don't remove otherwise infinite loop                          #
+##########################################################################
+
+theApp.EvtMax = 1
+
+###########################################################################
+
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = INFO)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = DEBUG)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_jobOptions.py
new file mode 100644
index 00000000000..91c2b5550e8
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_jobOptions.py
@@ -0,0 +1,802 @@
+import commands
+
+###########################################################################
+#
+# <Marco.Delmastro@cern.ch>
+#
+# Example jobOptions to reconstruction one or more ramp run from data
+#
+# Last update: 09/12/2008 <Fabien.Tarrade@cern.ch>
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+include("RecExCommission/GetInputFiles.py")
+
+#######################################################
+#       Run properties
+#######################################################
+
+if not 'SubDet' in dir():
+   SubDet = "Barrel"
+
+if not 'RunNumberList' in dir():
+   RunNumberList = [ '0018660' ]
+   
+if not 'FilePrefix' in dir():
+   if (int(RunNumberList[0]))<99800 :
+      FilePrefix = "daq.Ramp"
+   else :
+      FilePrefix = "data*"
+     
+if not 'InputDir' in dir():
+   InputDir = "/castor/cern.ch/grid/atlas/DAQ/lar/ElecCalib/2008/"+RunNumberList[0]
+   
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"     
+
+if not 'FullFileName' in dir():
+   if not 'Trigger' in dir():
+      if (int(RunNumberList[0]))<99800 :
+         Trigger = "*"+Partition
+      else :
+         Trigger = "calibration_LArElec-Ramp"+".*"+Partition   
+   
+   FullFileName = []
+   for RunNumber in RunNumberList :
+       FullFileName+=GetInputFilesFromTokens(InputDir,int(RunNumber),FilePrefix,Trigger)
+
+if not 'GainList' in dir():
+   GainList = [ "HIGH", "MEDIUM", "LOW" ]
+   
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+        
+if not 'ChannelSelection' in dir():
+   ## to read all
+   ChannelSelection = " "
+   ## example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,3:34</channelSelection>" 
+   #ChannelSelection = "<channelSelection>0,0:1000</channelSelection>"
+   
+if not 'runAccumulator' in dir(): 
+   runAccumulator = False # averaged mode
+
+from string import *
+def DBConnectionFile(sqlitefile):
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+#######################################################
+#                Monitoring properties
+#######################################################
+
+if not 'doMonitoring' in dir():
+   doMonitoring = False
+
+if not 'doLArCalibDataQuality' in dir():
+   doLArCalibDataQuality = False     
+
+if not 'online' in dir():
+   online = False
+
+#######################################################
+#                Ramp properties                      #
+#######################################################
+
+if not 'isHEC' in dir():
+   isHEC= False
+
+if not 'HECKey' in dir():
+   HECKey="LArHEC_PAmap"
+
+if not 'PeakOF' in dir():
+   PeakOF = True   # OF reconstruction
+   
+if not 'CorrectBias' in dir():
+   CorrectBias = False   # Set whether to correct for bias - if True, will look for peds from COOL
+	
+if not 'StripsXtalkCorr' in dir():
+   StripsXtalkCorr = True # Xtalk correction for strips
+
+if not "ADCSaturation" in dir():
+   ADCsaturation = 4090 # Set to 0 if you want to keep saturating pulses
+   
+if not 'KeyOutput' in dir():  
+   KeyOutput = "LArRamp" # Key of LArRampComplete object in DetStore
+
+if not 'SaveRawRamp' in dir():
+   SaveRawRamp = True
+  
+if not 'SaveAverages' in dir():
+   SaveAverages = False # Add averages to ROOT file
+
+if not 'ApplyCorr' in dir():
+   ApplyCorr = False # Apply corr. before dumping to ROOT file
+
+if not 'SaveAllSamples' in dir():
+   SaveAllSamples = False # Add Samples and RMS to RAMPS TTree
+
+if not 'CorrectBadChannels' in dir():
+   CorrectBadChannels=False
+
+if not 'ApplyAdHocCorrection' in dir():
+   ApplyAdHocCorrection=False
+   
+#######################################################
+#       Ramp output name
+#######################################################
+
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumberList[0])
+   
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd   
+
+if not 'DBConnectionCOOL' in dir():
+   DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;"
+
+## HEC map
+if not 'ReadHECMapFromCOOL' in dir():
+   ReadHECMapFromCOOL = True
+	
+if not 'InputHECMapPoolFileDir' in dir():
+   InputHECMapPoolFileDir  = commands.getoutput("pwd")
+   
+if not 'InputHECMapPoolFileName' in dir():
+   InputHECMapPoolFileName = "LArHECMap.pool.root"   
+   
+## Pedestal
+if not 'ReadPedFromCOOL' in dir():
+   ReadPedFromCOOL = True
+	
+#if not 'PedLArCalibFolderTag' in dir():
+#   PedLArCalibFolderTag = LArCalib_Flags.tagSuffix      
+
+if not 'PedRunNumber' in dir():
+   PedRunNumber = "1005020_1005021_1005022"
+
+if not 'InputPedPoolFileDir' in dir():
+   InputPedPoolFileDir  = commands.getoutput("pwd")
+   
+if not 'InputPedPoolFileName' in dir():
+   InputPedPoolFileName = "LArPedestal_" + str(PedRunNumber) +"_"+Partition.replace("*","")+ ".pool.root"
+
+## OFC Cali
+if not 'ReadOFCFromCOOL' in dir():
+   ReadOFCFromCOOL = True
+	
+#if not 'OFCLArCalibFolderTag' in dir():
+#   OFCLArCalibFolderTag = LArCalib_Flags.tagSuffix
+
+if not 'OFCRunNumber' in dir():
+   OFCRunNumber = "30950"
+
+if not 'InputOFCPoolFileDir' in dir():
+   InputOFCPoolFileDir  = commands.getoutput("pwd")
+
+if not 'InputOFCPoolFileName' in dir():
+   if PeakOF :
+      InputOFCPoolFileName = "LArOFCCali_" + str(PedRunNumber) +"_"+Partition.replace("*","")+ ".pool.root"
+   if ( PeakOF and StripsXtalkCorr ) :
+      InputOFCPoolFileName = "LArOFCCali_StripsXtalkCorr_" + str(OFCRunNumber) +"_"+Partition.replace("*","")+ ".pool.root"
+
+if  not StripsXtalkCorr:
+   CaliOFCFolder  = LArCalib_Flags.LArOFCCaliFolder
+else:
+   CaliOFCFolder  = LArCalib_Flags.LArOFCCaliFolderXtlk
+
+
+rs=FolderTagResover()
+if not 'LArRampFolderOutputTag' in dir():
+   LArRampFolderOutputTag = rs.getFolderTagSuffix(LArCalib_Flags.LArRampFolder)
+if not 'PedLArCalibFolderTag' in dir(): 
+   PedLArCalibFolderTag = rs.getFolderTagSuffix(LArCalib_Flags.LArPedestalFolder)                                                
+if not 'LArCaliOFCFolderTag' in dir():
+   LArCaliOFCFolderTag = rs.getFolderTagSuffix(CaliOFCFolder)
+del rs
+   
+if not 'OutputRampRootFileDir' in dir():
+   OutputRampRootFileDir = commands.getoutput("pwd")
+   
+if not 'OutputRampPoolFileDir' in dir():
+   OutputRampPoolFileDir = commands.getoutput("pwd")
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)
+	
+if not 'BaseFileName' in dir():
+   BaseFileName = "LArRamp"
+   
+   for RunNumber in RunNumberList :
+      BaseFileName = BaseFileName+"_"+str(RunNumber)+"_"+Partition.replace("*","")
+   
+   if StripsXtalkCorr:
+      BaseFileName += "_StripsXtalkCorr"
+   if PeakOF:
+      BaseFileName += "_OFC"	   
+
+if not 'OutputRampRootFileName' in dir():
+   OutputRampRootFileName = BaseFileName+".root"
+   
+if not 'OutputRampPoolFileName' in dir():
+   OutputRampPoolFileName = BaseFileName+".pool.root"
+
+if not 'OutputObjectSpecRamp' in dir():
+   OutputObjectSpecRamp = "LArRampComplete#"+KeyOutput+"#"+LArCalib_Flags.LArRampFolder
+   OutputObjectSpecTagRamp = LArCalibFolderTag(LArCalib_Flags.LArRampFolder,LArRampFolderOutputTag)
+   
+if ( ReadPedFromCOOL ):
+   if 'InputPedSQLiteFile' in dir():
+      InputDBConnectionPed = DBConnectionFile(InputPedSQLiteFile)
+   else:
+      InputDBConnectionPed = DBConnectionCOOL
+
+if ( PeakOF and ReadOFCFromCOOL ):
+   if 'InputOFCSQLiteFile' in dir():
+      InputDBConnectionOFC = DBConnectionFile(InputOFCSQLiteFile)
+   else:
+      InputDBConnectionOFC = DBConnectionCOOL
+
+if ( ReadHECMapFromCOOL ):
+   if 'InputHECMapSQLiteFile' in dir():
+      InputDBConnectionHECMap = DBConnectionFile(InputHECMapSQLiteFile)
+   else:
+      InputDBConnectionHECMap = DBConnectionCOOL
+
+## Bad Channel   
+   
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;"
+      InputDBConnectionBadChannel = "COOLOFL_LAR/COMP200"
+      
+#######################################################################################
+#                                print summary                                        #
+#######################################################################################
+
+RampLog = logging.getLogger( "RampLog" )
+RampLog.info( " ======================================================== " )
+RampLog.info( " ***                 LAr Ramp summary                  *** " )
+RampLog.info( " ======================================================== " )
+RampLog.info( " RunNumber                          = "+str(RunNumberList) )
+RampLog.info( " SubDetector                        = "+SubDet )
+RampLog.info( " Partition                          = "+Partition )
+RampLog.info( " Type                               = Ramp " )
+for i in range(len(FullFileName)):
+   RampLog.info( " FullFileName                       = "+FullFileName[i] )
+if ( ReadPedFromCOOL ):
+   RampLog.info( " InputDBConnectionPed               = "+InputDBConnectionPed )
+else :
+   RampLog.info( " InputPedPoolFileName               = "+InputPedPoolFileName )
+RampLog.info( " PedLArCalibFolderTag               = "+PedLArCalibFolderTag )
+if ( PeakOF and ReadOFCFromCOOL ):
+   RampLog.info( " InputDBConnectionOFC               = "+InputDBConnectionOFC )
+elif ( PeakOF) :
+   RampLog.info( " InputOFCPoolFileName               = "+InputOFCPoolFileName )
+if 'OFCLArCalibFolderTag' in dir() :
+   RampLog.info( " OFCLArCalibFolderTag               = "+OFCLArCalibFolderTag )
+RampLog.info( " OutputRampRootFullFileName         = "+OutputRampRootFileDir+"/"+OutputRampRootFileName )
+RampLog.info( " OutputRampPoolFullFileName         = "+OutputRampPoolFileDir+"/"+OutputRampPoolFileName )
+RampLog.info( " OutputObjectSpecRamp               = "+OutputObjectSpecRamp )
+RampLog.info( " OutputObjectSpecTagRamp            = "+OutputObjectSpecTagRamp )
+RampLog.info( " IOVBegin                           = "+str(IOVBegin) )
+RampLog.info( " IOVEnd                             = "+str(IOVEnd) )
+RampLog.info( " LArCalibOutputDB                   = "+OutputDB )
+RampLog.info( " ======================================================== " )
+#######################################################################################
+
+include ("LArConditionsCommon/LArMinimalSetup.py")
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()  
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+theByteStreamInputSvc=svcMgr.ByteStreamInputSvc
+if not 'FullFileName' in dir():
+   RampLog.info( "No FullFileName! Please give a FullFileName list." )
+   theApp.exit(-1)
+
+else :   
+   theByteStreamInputSvc.FullFileName=FullFileName
+   
+theByteStreamInputSvc.MaxBadEvents=0
+
+##############################################################################################
+#                                                                                            #
+# FullFileName is already the list of files compute by the fonction GetInputFilesFromTokens  #
+#                                                                                            #
+# maybe useful one day                                                                       #
+#                                                                                            #
+#else                                                                                        #
+#   theByteStreamInputSvc.FullFileName=OneFileName                                           #
+#   for i in range(len(theByteStreamInputSvc.FullFileName)):                                 #
+#      theByteStreamInputSvc.NumFile+=[10000]                                                #
+##############################################################################################
+
+###############################################################
+#                                                             #
+#                To read BS for one or more FT                #
+#                                                             #
+###############################################################
+
+## For splitting the delay runs, there are three new jobOptions.
+## All three are vectors of integers
+#################################################################
+
+from LArByteStream.LArByteStreamConf import LArRodDecoder
+svcMgr.ToolSvc += LArRodDecoder()
+
+#ToolSvc.LArRodDecoder.BEPreselection     = [0]                                                   ## : [Barrel=0,Endcap=1]
+#ToolSvc.LArRodDecoder.PosNegPreselection = [1]                                                   ## : [C-side (negative eta)=0, A-side (positive eta)=1]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]               ## : first half of [EM barrel feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]     ## : second half of [EM barrel feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [0,1,4,7,8,11,12,13,14,17,18,19,20,23,24]             ## : [EMEC Standard feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [2,9,15,21]                                           ## : [EMEC Special feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [3,10,16,22]                                          ## : [HEC feedthrough numbers]  (note: slots 1&2 are EMEC slots)
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [6]                                                   ## : [FCAL feedthrough number]
+
+      
+ 
+###########################################################################
+#                                                                         #
+#                          Accumulator                                    #
+#                                                                         #
+###########################################################################
+
+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   #
+   include("LArCalibProcessing/LArCalib_CalibrationPatterns.py")
+
+else :
+   theByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
+   theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/HIGH"  ]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/MEDIUM"]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/LOW"   ]
+
+## 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
+from LArCalibDataQuality.LArCalibDataQualityConf import LArBadEventCatcher
+theLArBadEventCatcher=LArBadEventCatcher()
+theLArBadEventCatcher.CheckAccCalibDigitCont=True
+theLArBadEventCatcher.CheckBSErrors=True
+theLArBadEventCatcher.KeyList=GainList
+theLArBadEventCatcher.StopOnError=False
+topSequence+=theLArBadEventCatcher    
+
+##########################################################################
+#                                                                        #
+#                         Ramp run reconstruction                        #
+#                                                                        #
+##########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+include ("LArCalibProcessing/LArCalib_BadChanTool.py")
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   RampLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   RampLog.info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB   
+try:
+   svcMgr.IOVDbSvc.DBInstance=""
+except: 
+   pass
+
+# Temperature folder
+conddb.addFolder("DCS_OFL","/LAR/DCS/FEBTEMP")
+svcMgr.EventSelector.InitialTimeStamp = 1284030331
+import cx_Oracle
+import time
+import datetime
+connection=cx_Oracle.connect("ATLAS_SFO_T0_R/readmesfotz2008@atlr")
+cursor=connection.cursor()
+sRequest=("SELECT RUNNR,CREATION_TIME FROM SFO_TZ_RUN WHERE RUNNR='%s'")%(RunNumberList[0])
+cursor.execute(sRequest)
+times= cursor.fetchall()
+d=times[0][1]
+iovtemp=int(time.mktime(d.timetuple()))
+#print "Setting timestamp for run ",RunNumberList[0]," to ",iovtemp
+#svcMgr.IOVDbSvc.forceTimestamp = 1283145454
+svcMgr.IOVDbSvc.forceTimestamp = iovtemp
+
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
+if ( doLArCalibDataQuality  ) :
+   ## The reference is the Oracle DB
+   conddb.addFolder("LAR_ONL","/LAR/ElecCalibOnl/Ramp<key>LArRampRef</key>"+ChannelSelection)
+
+#if (CorrectBadChannels or StripsXtalkCorr):
+#   conddb.addFolder("LAR","/LAR/BadChannelsOfl/BadChannels")
+#   conddb.addFolder("LAR","/LAR/BadChannelsOfl/MissingFEBs")
+   
+if (isHEC):
+   if ( ReadHECMapFromCOOL ):
+      if not 'InputHECMapSQLiteFile' in dir():
+         RampLog.info( "Read HECMap from Oracle DB" )
+      else :
+         RampLog.info( "Read HEC map from SQLite file" )
+
+   if ( ReadHECMapFromCOOL ):
+      HECMapFolder  = "/LAR/ElecCalibOfl/HecPAMap"
+      if "HECMapTagSpec" in dir():
+         conddb.addFolder("",HECMapFolder+"<tag>"+HECMapTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionHECMap+"</dbConnection>")
+      else :
+         conddb.addFolder("",HECMapFolder+"<dbConnection>"+InputDBConnectionHECMap+"</dbConnection>")
+
+   else:
+      if 'InputHECMapPoolFileName' in dir():
+         RampLog.info( "Read HECMap form POOL file" )
+         PoolFileList += [ InputHECMapPoolFileDir +"/"+ InputHECMapPoolFileName ]   
+      else:
+         RampLog.info( "No PoolFileList found! Please list the POOL files containing HECMap or read from COOL." )
+         theApp.exit(-1)    
+
+if (CorrectBias or PeakOF or StripsXtalkCorr):
+   if ( ReadPedFromCOOL or ReadOFCFromCOOL ):
+      if not 'InputPedSQLiteFile' in dir():
+         RampLog.info( "Read Pedestal from Oracle DB" )
+      else :  
+         RampLog.info( "Read Pedestal from SQLite file" )
+          
+      if not 'InputOFCSQLiteFile' in dir():
+         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
+      PedestalTagSpec = LArCalibFolderTag(PedestalFolder,PedLArCalibFolderTag)
+      conddb.addFolder("",PedestalFolder+"<tag>"+PedestalTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPed+"</dbConnection>"+ChannelSelection)
+      
+else:
+   if 'InputPedPoolFileName' in dir():
+      RampLog.info( "Read Pedestal from POOL file" )
+      PoolFileList += [ InputPedPoolFileDir +"/"+ InputPedPoolFileName ]   
+   else:
+      RampLog.info( "No PoolFileList found! Please list the POOL files containing Pedestal or read from COOL." )
+      theApp.exit(-1)
+
+   
+if ( ReadOFCFromCOOL ):
+   if PeakOF:
+      CaliOFCTagSpec = LArCalibFolderTag(CaliOFCFolder,LArCaliOFCFolderTag)
+      conddb.addFolder("",CaliOFCFolder+"<tag>"+CaliOFCTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionOFC+"</dbConnection>"+ChannelSelection)
+
+else:
+   if 'InputOFCPoolFileName' in dir():
+         RampLog.info( "Read OFC Cali form POOL file" )
+         PoolFileList += [ InputOFCPoolFileDir +"/"+ InputOFCPoolFileName ]   
+   else:
+         RampLog.info( "No PoolFileList found! Please list the POOL files containing OFC or read from COOL." )
+         theApp.exit(-1)
+
+if ( len(PoolFileList)>0 ):
+      
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+   
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+
+if ( StripsXtalkCorr ) :
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   from LArCalibUtils.LArCalibUtilsConf import LArStripsCrossTalkCorrector
+   theLArStripsCrossTalkCorrector = LArStripsCrossTalkCorrector()
+   theLArStripsCrossTalkCorrector.KeyList = GainList
+   theLArStripsCrossTalkCorrector.ADCsaturation = ADCsaturation
+   theLArStripsCrossTalkCorrector.NoXtalkCorr=LArBadChannelMasker("NoXtalkCorr",
+                                                                  DoMasking=True,
+                                                                  ProblemsToMask=["deadReadout","deadPhys","deadCalib","almostDead"]
+                                                               )
+   theLArStripsCrossTalkCorrector.DontUseForXtalkCorr=LArBadChannelMasker("DontUseForXtalkCorr",
+                                                                          DoMasking=True,
+                                                                          ProblemsToMask=["short","peculiarCalibrationLine","deadReadout"]
+                                                                          )
+   theLArStripsCrossTalkCorrector.AcceptableDifference=25.0 #in per-cent
+   topSequence +=theLArStripsCrossTalkCorrector
+
+
+
+#Bad-channel mask used by the LArRampBuilder and the Ramp-patcher
+from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+theLArRCBMasker=LArBadChannelMasker("LArRCBMasker")
+theLArRCBMasker.DoMasking=True
+theLArRCBMasker.ProblemsToMask=[
+   "deadCalib","deadReadout","deadPhys","almostDead","short" 
+   ]
+ToolSvc+=theLArRCBMasker
+
+
+from LArCalibUtils.LArCalibUtilsConf import LArRampBuilder
+theLArRampBuilder = LArRampBuilder()
+theLArRampBuilder.KeyList      = GainList
+theLArRampBuilder.SubtractDac0 = False
+theLArRampBuilder.BadChannelMask=theLArRCBMasker
+
+if ( PeakOF ):
+    theLArRampBuilder.RecoType = "OF"
+    from LArRecUtils.LArRecUtilsConf import LArOFPeakRecoTool
+    theLArOFPeakRecoTool=LArOFPeakRecoTool()
+    theLArOFPeakRecoTool.UseShape = False
+    ToolSvc+=theLArOFPeakRecoTool
+else :
+    theLArRampBuilder.RecoType = "Parabola"
+    from LArRecUtils.LArRecUtilsConf import LArParabolaPeakRecoTool
+    theLArParabolaPeakRecoTool=LArParabolaPeakRecoTool()
+    theLArParabolaPeakRecoTool.correctBias = CorrectBias
+    ToolSvc+=theLArParabolaPeakRecoTool
+
+# As the first ramp point no longer is taken at DAC=0
+# this point should not have a special place.
+theLArRampBuilder.DAC0         = -1
+theLArRampBuilder.StoreRawRamp = SaveRawRamp
+theLArRampBuilder.StoreRecRamp = True
+theLArRampBuilder.Polynom      = 1    
+theLArRampBuilder.RampRange    = 3600 # Check on the raw data ADC sample before ped subtraction
+                                      # and pulse reconstruction to include point in fit
+theLArRampBuilder.correctBias  = CorrectBias
+theLArRampBuilder.ConsecutiveADCs = 0;
+theLArRampBuilder.minDAC = 10      # minimum DAC value to use in fit
+theLArRampBuilder.KeyOutput = KeyOutput
+theLArRampBuilder.DeadChannelCut = -9999
+theLArRampBuilder.GroupingType = GroupingType
+
+theLArRampBuilder.LongNtuple = SaveAllSamples
+
+if ( isHEC ) :
+   theLArRampBuilder.isHEC = isHEC
+   theLArRampBuilder.HECKey = HECKey
+   
+topSequence+=theLArRampBuilder
+
+
+######################################################################
+#                                                                    #
+#                          Correction                                #
+#                                                                    #
+######################################################################
+
+if CorrectBadChannels:
+   from LArCalibUtils.LArCalibUtilsConf import LArCalibPatchingAlg_LArRampComplete_
+   theLArRampPatcher=LArCalibPatchingAlg_LArRampComplete_("LArRampPatcher")
+   theLArRampPatcher.ContainerKey=KeyOutput
+   theLArRampPatcher.PatchMethod="PhiAverage"
+   
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
+   theLArBadChannelTool=LArBadChanTool()
+   ToolSvc+=theLArBadChannelTool
+   theLArRampPatcher.MaskingTool=theLArRCBMasker
+   theLArRampPatcher.UseCorrChannels=False      
+   topSequence+=theLArRampPatcher
+
+if ( ApplyAdHocCorrection ):
+   from LArCalibUtils.LArCalibUtilsConf import LArRampAdHocPatchingAlg
+   LArRampAdHocPatchingAlg = LArRampAdHocPatchingAlg("LArRampAdHocPatchingAlg")
+   LArRampAdHocPatchingAlg.ContainerKey = KeyOutput
+
+   if ( 'ChannelsToBePatchedHG' in dir() and 'PatchesToBeAppliedHG' in dir() ):
+      if ( len(ChannelsToBePatchedHG) and len(ChannelsToBePatchedHG)==len(PatchesToBeAppliedHG) ):
+         LArRampAdHocPatchingAlg.ChannelsToBePatchedHG = ChannelsToBePatchedHG
+         LArRampAdHocPatchingAlg.PatchesToBeAppliedHG  = PatchesToBeAppliedHG
+
+   if ( 'ChannelsToBePatchedMG' in dir() and 'PatchesToBeAppliedMG' in dir() ):
+      if ( len(ChannelsToBePatchedMG) and len(ChannelsToBePatchedMG)==len(PatchesToBeAppliedMG) ):
+         LArRampAdHocPatchingAlg.ChannelsToBePatchedMG = ChannelsToBePatchedMG
+         LArRampAdHocPatchingAlg.PatchesToBeAppliedMG  = PatchesToBeAppliedMG
+
+   if ( 'ChannelsToBePatchedLG' in dir() and 'PatchesToBeAppliedLG' in dir() ):
+      if ( len(ChannelsToBePatchedLG) and len(ChannelsToBePatchedLG)==len(PatchesToBeAppliedLG) ):
+         LArRampAdHocPatchingAlg.ChannelsToBePatchedLG = ChannelsToBePatchedLG
+         LArRampAdHocPatchingAlg.PatchesToBeAppliedLG  = PatchesToBeAppliedLG
+ 
+   topSequence+=LArRampAdHocPatchingAlg
+
+######################################################################
+#                                                                    #
+#                          Output                                    #
+#                                                                    #
+######################################################################
+
+if ( doLArCalibDataQuality  ) :
+   from LArCalibDataQuality.Thresholds import rampThr, rampThrFEB
+   from LArCalibDataQuality.LArCalibDataQualityConf import LArRampValidationAlg
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   theLArRampValBCMask=LArBadChannelMasker("RampValBCMask",
+                                           DoMasking=True,
+                                           ProblemsToMask=["deadReadout","deadCalib","deadPhys","almostDead",
+                                                           "highNoiseHG","highNoiseMG","highNoiseLG"]
+                                           )
+   svcMgr.ToolSvc+=theLArRampValBCMask
+   theRampValidationAlg=LArRampValidationAlg("RampVal")
+   theRampValidationAlg.RampTolerance=rampThr
+   theRampValidationAlg.RampToleranceFEB=rampThrFEB
+   theRampValidationAlg.BadChannelMaskingTool=theLArRampValBCMask
+   theRampValidationAlg.KeyList=GainList
+   theRampValidationAlg.PatchMissingFEBs=True
+   theRampValidationAlg.UseCorrChannels=False 
+   theRampValidationAlg.ValidationKey="LArRamp"
+   theRampValidationAlg.ReferenceKey="LArRampRef"
+   
+   theRampValidationAlg.MsgLevelForDeviations=WARNING
+   theRampValidationAlg.ListOfDevFEBs="rampFebs.txt"
+   theRampValidationAlg.ThinnedValContainer="ThinRampsVal"
+   theRampValidationAlg.ThinnedRefContainer="ThinRampsRef"
+   topSequence+=theRampValidationAlg
+
+   ## second instance of the validation tool to detect "bad" channel 
+   theBadRamp=LArRampValidationAlg("RampFail")
+   theBadRamp.BadChannelMaskingTool=theLArRampValBCMask
+   theBadRamp.RampTolerance=["0.05,0.05,0.05"]
+   theBadRamp.RampToleranceFEB=["0.05,0.05,0.05"]
+   theBadRamp.KeyList=GainList
+   theBadRamp.ValidationKey="LArRamp"
+   theBadRamp.ReferenceKey="LArRampRef"
+   theBadRamp.MsgLevelForDeviations=ERROR
+   theBadRamp.ListOfDevFEBs="Bad_rampFebs.txt"
+   theRampValidationAlg.PatchMissingFEBs=False
+   topSequence+=theBadRamp
+
+
+if ( doMonitoring ) :
+   
+   from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+   topSequence += AthenaMonManager( "LArMon" )
+   LArMon = topSequence.LArMon
+
+    ## old style
+   #LArMon.FileKey = "AllMon"
+   #LArMon.ManualDataTypeSetup = True
+   #LArMon.Environment         = "user"
+   #LArMon.ManualRunLBSetup    = True
+   #LArMon.Run                 = 1
+   #LArMon.LumiBlock           = 1
+   #LArMon.CheckEveryNoEvents  = 999999 #to do the check only at the end of the run
+
+   ## tier0 style
+   LArMon.FileKey = "GLOBAL"
+   LArMon.ManualDataTypeSetup = True
+   LArMon.Environment         = "tier0"
+   LArMon.ManualRunLBSetup    = True
+   LArMon.Run                 = int(RunNumberList[0])
+   LArMon.LumiBlock           = 1
+   LArMon.CheckEveryNoEvents  = 999999 #to do the check only at the end of the run
+   
+   include("LArMonTools/LArFEBMon_jobOptions.py")
+   
+   RootHistOutputFileName='RootHistos_'+BaseFileName+".root"
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import THistSvc
+   if os.path.exists(OutputRampRootFileDir+ "/" +RootHistOutputFileName): 
+      os.remove(OutputRampRootFileDir+ "/" +RootHistOutputFileName)
+   svcMgr += THistSvc()
+   #svcMgr.THistSvc.Output = ["AllMon DATAFILE='"+OutputRampRootFileDir+ "/" +RootHistOutputFileName+"' OPT='New'"] 
+
+   svcMgr.THistSvc.Output = ["GLOBAL DATAFILE='"+OutputRampRootFileDir+ "/" +RootHistOutputFileName+"' OPT='New'"]
+   
+if WriteNtuple or doMonitoring:
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputRampRootFileDir+"/"+OutputRampRootFileName): 
+      os.remove(OutputRampRootFileDir+"/"+OutputRampRootFileName)  
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputRampRootFileDir+"/"+OutputRampRootFileName+"' OPT='NEW'" ]
+
+if ( WritePoolFile ):
+
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   if os.path.exists(OutputRampPoolFileDir+"/"+OutputRampPoolFileName): 
+      os.remove(OutputRampPoolFileDir+"/"+OutputRampPoolFileName)  
+   theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg",OutputRampPoolFileDir+"/"+OutputRampPoolFileName,
+                             [OutputObjectSpecRamp],[OutputObjectSpecTagRamp],WriteIOV)
+   theOutputConditionsAlg.Run1 = IOVBegin
+   if IOVEnd>0:
+      theOutputConditionsAlg.Run2=IOVEnd
+
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = INFO
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+
+if (WriteNtuple):
+   
+   # Ramp fit ntuple
+   from LArCalibTools.LArCalibToolsConf import LArRamps2Ntuple
+   LArRamps2Ntuple=LArRamps2Ntuple("LArRamps2Ntuple")
+   LArRamps2Ntuple.ContainerKey = GainList #Only for raw ramp
+   LArRamps2Ntuple.NtupleName = "RAMPS"
+   LArRamps2Ntuple.RawRamp = SaveRawRamp
+   LArRamps2Ntuple.SaveAllSamples = SaveAllSamples
+   LArRamps2Ntuple.ApplyCorr = ApplyCorr
+   
+   topSequence+= LArRamps2Ntuple
+      
+   if ( SaveAverages ):
+      # Ramp points ntuple(s)
+      from LArCalibTools.LArCalibToolsConf import LArAverages2Ntuple
+      
+      LArAverages2NtupleHIGH=LArAverages2Ntuple("LArAverages2NtupleHIGH")
+      LArAverages2NtupleHIGH.ContainerKey = "HIGH"
+      topSequence+= LArAverages2NtupleHIGH
+      
+      LArAverages2NtupleMEDIUM=LArAverages2Ntuple("LArAverages2NtupleMEDIUM")
+      LArAverages2NtupleMEDIUM.ContainerKey = "MEDIUM"
+      topSequence+= LArAverages2NtupleMEDIUM
+
+      LArAverages2NtupleLOW=LArAverages2Ntuple("LArAverages2NtupleLOW")
+      LArAverages2NtupleLOW.ContainerKey = "LOW"
+      topSequence+= LArAverages2NtupleLOW
+  
+###########################################################################	
+	
+svcMgr.MessageSvc.OutputLevel  = DEBUG
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = WARNING)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = WARNING)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_splitter_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_splitter_jobOptions.py
new file mode 100644
index 00000000000..cfb35c4a959
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_splitter_jobOptions.py
@@ -0,0 +1,855 @@
+import commands
+
+###########################################################################
+#
+# <pavol@mail.cern.ch>
+#
+# jobOptions to reconstruction one or more ramp run from data per calibration line
+#
+###########################################################################
+
+include("LArCalibProcessing/LArCalib_Flags.py")
+include("RecExCommission/GetInputFiles.py")
+
+#######################################################
+#       Run properties
+#######################################################
+
+if not 'SubDet' in dir():
+   SubDet = "EndCap"
+
+if not 'RunNumberList' in dir():
+   RunNumberList = [ '0018660' ]
+   
+if not 'AllWavesPerCh' in dir():
+        AllWavesPerCh      =  True
+
+if not 'MaxCalLinePerCh' in dir():
+        MaxCalLinePerCh = 4
+
+if not 'FilePrefix' in dir():
+   if (int(RunNumberList[0]))<99800 :
+      FilePrefix = "daq.Ramp"
+   else :
+      FilePrefix = "data*"
+     
+if not 'InputDir' in dir():
+   InputDir = "/castor/cern.ch/grid/atlas/DAQ/lar/ElecCalib/2008/"+RunNumberList[0]
+   
+if not 'Partition' in dir():
+   if (SubDet=='EndCap'):
+      Partition      = "EB-EC*"
+   else:
+      Partition      = "EB-EMB*"     
+
+if not 'FullFileName' in dir():
+   if (int(RunNumberList[0]))<99800 :
+      Trigger = "*"+Partition
+   else :
+      Trigger = "calibration_LArElec-Ramp"+".*"+Partition   
+   
+   FullFileName = []
+   for RunNumber in RunNumberList :
+       FullFileName+=GetInputFilesFromTokens(InputDir,int(RunNumber),FilePrefix,Trigger)
+
+if not 'GainList' in dir():
+   GainList = [ "HIGH", "MEDIUM", "LOW" ]
+   
+if not 'GroupingType' in dir():
+   GroupingType = "ExtendedSubDetector"
+        
+if not 'ChannelSelection' in dir():
+   ## to read all
+   ChannelSelection = " "
+   ## example to read only cool for Barrel C : Strips->Back
+   #ChannelSelection = "<channelSelection>0,3:34</channelSelection>" 
+   #ChannelSelection = "<channelSelection>0,0:1000</channelSelection>"
+   
+if not 'runAccumulator' in dir(): 
+   runAccumulator = False # averaged mode
+
+from string import *
+def DBConnectionFile(sqlitefile):
+   return "sqlite://;schema="+sqlitefile+";dbname=COMP200"
+
+#######################################################
+#                Monitoring properties
+#######################################################
+
+if not 'doMonitoring' in dir():
+   doMonitoring = False
+
+if not 'doLArCalibDataQuality' in dir():
+   doLArCalibDataQuality = False     
+
+if not 'online' in dir():
+   online = False
+
+#######################################################
+#                Ramp properties                      #
+#######################################################
+
+if not 'isHEC' in dir():
+   isHEC= True
+
+if not 'HECKey' in dir():
+   HECKey="LArHEC_PAmap"
+
+if not 'PeakOF' in dir():
+   PeakOF = True   # OF reconstruction
+   
+if not 'CorrectBias' in dir():
+   CorrectBias = False   # Set whether to correct for bias - if True, will look for peds from COOL
+	
+if not 'StripsXtalkCorr' in dir():
+   StripsXtalkCorr = True # Xtalk correction for strips
+
+if not "ADCSaturation" in dir():
+   ADCsaturation = 4095 # Set to 0 if you want to keep saturating pulses
+   
+if not 'KeyOutput' in dir():  
+   KeyOutput = "LArRamp" # Key of LArRampComplete object in DetStore
+
+if AllWavesPerCh and (not 'KeyOutputSplitted' in dir() ):
+      KeyOutputSplitted = []
+      for i in range(0, MaxCalLinePerCh):
+         KeyOutputSplitted.append(KeyOutput+str(i+1)) 
+
+if not 'SaveRawRamp' in dir():
+   SaveRawRamp = True
+  
+if not 'SaveAverages' in dir():
+   SaveAverages = False # Add averages to ROOT file
+
+if not 'CorrectBadChannels' in dir():
+   CorrectBadChannels=False
+   
+#######################################################
+#       Ramp output name
+#######################################################
+
+if not 'WriteNtuple' in dir():
+   WriteNtuple = LArCalib_Flags.WriteNtuple
+
+if not 'WritePoolFile' in dir():
+   WritePoolFile = LArCalib_Flags.WritePoolFile
+
+if not 'WriteIOV' in dir():
+   WriteIOV = LArCalib_Flags.WriteIOV
+
+if not 'IOVBegin' in dir():
+   IOVBegin = int(RunNumberList[0])
+   
+if not 'IOVEnd' in dir():
+   IOVEnd = LArCalib_Flags.IOVEnd   
+
+if not 'DBConnectionCOOL' in dir():
+   #DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200;user=ATLAS_COOL_READER"
+   DBConnectionCOOL = "COOLOFL_LAR/COMP200"
+
+## HEC map
+if not 'ReadHECMapFromCOOL' in dir():
+   ReadHECMapFromCOOL = True
+	
+if not 'InputHECMapPoolFileDir' in dir():
+   InputHECMapPoolFileDir  = commands.getoutput("pwd")
+   
+if not 'InputHECMapPoolFileName' in dir():
+   InputHECMapPoolFileName = "LArHECMap.pool.root"   
+   
+## Pedestal
+if not 'ReadPedFromCOOL' in dir():
+   ReadPedFromCOOL = True
+	
+#if not 'PedLArCalibFolderTag' in dir():
+#   PedLArCalibFolderTag = LArCalib_Flags.tagSuffix      
+
+if not 'PedRunNumber' in dir():
+   PedRunNumber = "1005020_1005021_1005022"
+
+if not 'InputPedPoolFileDir' in dir():
+   InputPedPoolFileDir  = commands.getoutput("pwd")
+   
+if not 'InputPedPoolFileName' in dir():
+   InputPedPoolFileName = "LArPedestal_" + str(PedRunNumber) +"_"+Partition.replace("*","")+ ".pool.root"
+
+## OFC Cali
+if not 'ReadOFCFromCOOL' in dir():
+   ReadOFCFromCOOL = True
+	
+#if not 'OFCLArCalibFolderTag' in dir():
+#   OFCLArCalibFolderTag = LArCalib_Flags.tagSuffix
+
+if not 'OFCRunNumber' in dir():
+   OFCRunNumber = "30950"
+
+if not 'InputOFCPoolFileDir' in dir():
+   InputOFCPoolFileDir  = commands.getoutput("pwd")
+
+if not 'InputOFCPoolFileName' in dir():
+   if PeakOF :
+      InputOFCPoolFileName = "LArOFCCali_" + str(PedRunNumber) +"_"+Partition.replace("*","")+ ".pool.root"
+   if ( PeakOF and StripsXtalkCorr ) :
+      InputOFCPoolFileName = "LArOFCCali_StripsXtalkCorr_" + str(OFCRunNumber) +"_"+Partition.replace("*","")+ ".pool.root"
+
+## Output   
+if not 'LArCalibFolderOutputTag' in dir():
+   LArCalibFolderOutputTag = "-UPD3-00"        
+
+if not 'OutputRampRootFileDir' in dir():
+   OutputRampRootFileDir = commands.getoutput("pwd")
+   
+if not 'OutputRampPoolFileDir' in dir():
+   OutputRampPoolFileDir = commands.getoutput("pwd")
+
+if not 'OutputDB' in dir():
+   OutputDB = LArCalib_Flags.OutputDB
+
+if 'OutputSQLiteFile' in dir():
+   OutputDB = DBConnectionFile(OutputSQLiteFile)
+	
+if not 'BaseFileName' in dir():
+   BaseFileName = "LArRamp"
+   
+   for RunNumber in RunNumberList :
+      BaseFileName = BaseFileName+"_"+str(RunNumber)+"_"+Partition.replace("*","")
+   
+   if StripsXtalkCorr:
+      BaseFileName += "_StripsXtalkCorr"
+   if PeakOF:
+      BaseFileName += "_OFC"	   
+
+if not 'OutputRampRootFileName' in dir():
+   OutputRampRootFileName = BaseFileName+".root"
+   
+if not 'OutputRampPoolFileName' in dir():
+   OutputRampPoolFileName = BaseFileName+".pool.root"
+
+if not 'OutputObjectSpecRamp' in dir():
+   if ( AllWavesPerCh ) :
+      OutputObjectSpecRamp = []
+      OutputObjectSpecRamp.append("LArRampComplete#"+KeyOutputSplitted[i]+"#"+LArCalib_Flags.LArRampFolder)
+   else:   
+      OutputObjectSpecRamp = ["LArRampComplete#"+KeyOutput+"#"+LArCalib_Flags.LArRampFolder]
+   OutputObjectSpecTagRamp = LArCalibFolderTag(LArCalib_Flags.LArRampFolder,LArCalibFolderOutputTag)
+   
+if ( ReadPedFromCOOL ):
+   if 'InputPedSQLiteFile' in dir():
+      InputDBConnectionPed = DBConnectionFile(InputPedSQLiteFile)
+   else:
+      InputDBConnectionPed = DBConnectionCOOL
+
+if ( PeakOF and ReadOFCFromCOOL ):
+   if 'InputOFCSQLiteFile' in dir():
+      InputDBConnectionOFC = DBConnectionFile(InputOFCSQLiteFile)
+   else:
+      InputDBConnectionOFC = DBConnectionCOOL
+
+if ( ReadHECMapFromCOOL ):
+   if 'InputHECMapSQLiteFile' in dir():
+      InputDBConnectionHECMap = DBConnectionFile(InputHECMapSQLiteFile)
+   else:
+      InputDBConnectionHECMap = DBConnectionCOOL
+
+## Bad Channel   
+   
+if not 'ReadBadChannelFromCOOL' in dir():
+   ReadBadChannelFromCOOL = True   
+
+if ( ReadBadChannelFromCOOL ):      
+   if 'InputBadChannelSQLiteFile' in dir():
+      InputDBConnectionBadChannel = DBConnectionFile(InputBadChannelSQLiteFile)
+   else:
+      #InputDBConnectionBadChannel = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_LAR;dbname=COMP200;user=ATLAS_COOL_READER"
+      InputDBConnectionBadChannel = "COOLONL_LAR/COMP200"
+      
+#######################################################################################
+#                                print summary                                        #
+#######################################################################################
+
+RampLog = logging.getLogger( "RampLog" )
+RampLog.info( " ======================================================== " )
+RampLog.info( " ***                 LAr Ramp summary                  *** " )
+RampLog.info( " ======================================================== " )
+RampLog.info( " RunNumber                          = "+str(RunNumberList) )
+RampLog.info( " SubDetector                        = "+SubDet )
+RampLog.info( " Partition                          = "+Partition )
+RampLog.info( " Type                               = Ramp " )
+for i in range(len(FullFileName)):
+   RampLog.info( " FullFileName                       = "+FullFileName[i] )
+if ( ReadPedFromCOOL ):
+   RampLog.info( " InputDBConnectionPed               = "+InputDBConnectionPed )
+else :
+   RampLog.info( " InputPedPoolFileName               = "+InputPedPoolFileName )
+if 'PedLArCalibFolderTag' in dir() :   
+   RampLog.info( " PedLArCalibFolderTag               = "+PedLArCalibFolderTag )
+if ( PeakOF and ReadOFCFromCOOL ):
+   RampLog.info( " InputDBConnectionOFC               = "+InputDBConnectionOFC )
+elif ( PeakOF) :
+   RampLog.info( " InputOFCPoolFileName               = "+InputOFCPoolFileName )
+if 'OFCLArCalibFolderTag' in dir() :
+   RampLog.info( " OFCLArCalibFolderTag               = "+OFCLArCalibFolderTag )
+RampLog.info( " OutputRampRootFullFileName         = "+OutputRampRootFileDir+"/"+OutputRampRootFileName )
+RampLog.info( " OutputRampPoolFullFileName         = "+OutputRampPoolFileDir+"/"+OutputRampPoolFileName )
+#RampLog.info( " OutputObjectSpecRamp               = "+OutputObjectSpecRamp )
+RampLog.info( " OutputObjectSpecTagRamp            = "+OutputObjectSpecTagRamp )
+RampLog.info( " IOVBegin                           = "+str(IOVBegin) )
+RampLog.info( " IOVEnd                             = "+str(IOVEnd) )
+RampLog.info( " LArCalibOutputDB                   = "+OutputDB )
+RampLog.info( " ======================================================== " )
+#######################################################################################
+
+include ("LArConditionsCommon/LArMinimalSetup.py")
+
+#
+# Provides ByteStreamInputSvc name of the data file to process in the offline context
+#
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()  
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+theByteStreamInputSvc=svcMgr.ByteStreamInputSvc
+if not 'FullFileName' in dir():
+   RampLog.info( "No FullFileName! Please give a FullFileName list." )
+   theApp.exit(-1)
+
+else :   
+   theByteStreamInputSvc.FullFileName=FullFileName
+   
+theByteStreamInputSvc.MaxBadEvents=0
+
+##############################################################################################
+#                                                                                            #
+# FullFileName is already the list of files compute by the fonction GetInputFilesFromTokens  #
+#                                                                                            #
+# maybe useful one day                                                                       #
+#                                                                                            #
+#else                                                                                        #
+#   theByteStreamInputSvc.FullFileName=OneFileName                                           #
+#   for i in range(len(theByteStreamInputSvc.FullFileName)):                                 #
+#      theByteStreamInputSvc.NumFile+=[10000]                                                #
+##############################################################################################
+
+###############################################################
+#                                                             #
+#                To read BS for one or more FT                #
+#                                                             #
+###############################################################
+
+## For splitting the delay runs, there are three new jobOptions.
+## All three are vectors of integers
+#################################################################
+
+from LArByteStream.LArByteStreamConf import LArRodDecoder
+svcMgr.ToolSvc += LArRodDecoder()
+
+#ToolSvc.LArRodDecoder.BEPreselection     = [0]                                                   ## : [Barrel=0,Endcap=1]
+#ToolSvc.LArRodDecoder.PosNegPreselection = [1]                                                   ## : [C-side (negative eta)=0, A-side (positive eta)=1]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]               ## : first half of [EM barrel feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]     ## : second half of [EM barrel feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [0,1,4,7,8,11,12,13,14,17,18,19,20,23,24]             ## : [EMEC Standard feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [2,9,15,21]                                           ## : [EMEC Special feedthrough numbers]
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [3,10,16,22]                                          ## : [HEC feedthrough numbers]  (note: slots 1&2 are EMEC slots)
+#ToolSvc.LArRodDecoder.FTNumPreselection  = [6]                                                   ## : [FCAL feedthrough number]
+
+      
+ 
+###########################################################################
+#                                                                         #
+#                          Accumulator                                    #
+#                                                                         #
+###########################################################################
+
+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   #
+   include("LArCalibProcessing/LArCalib_CalibrationPatterns.py")
+
+else :
+   theByteStreamAddressProviderSvc =svcMgr.ByteStreamAddressProviderSvc
+   theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/HIGH"  ]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/MEDIUM"]
+   theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedCalibDigitContainer/LOW"   ]
+
+## 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")       
+#from LArCalibDataQuality.LArCalibDataQualityConf import LArBadEventCatcher
+#theLArBadEventCatcher=LArBadEventCatcher()
+#theLArBadEventCatcher.CheckAccCalibDigitCont=True
+#theLArBadEventCatcher.CheckBSErrors=True
+#theLArBadEventCatcher.KeyList=GainList
+#theLArBadEventCatcher.StopOnError=False
+#topSequence+=theLArBadEventCatcher    
+
+##########################################################################
+#                                                                        #
+#                         Ramp run reconstruction                        #
+#                                                                        #
+##########################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+PoolFileList     = []
+
+BadChannelsFolder="/LAR/BadChannels/BadChannels"
+MissingFEBsFolder="/LAR/BadChannels/MissingFEBs"
+
+if not 'InputBadChannelSQLiteFile' in dir():
+   RampLog.info( "Read Bad Channels from Oracle DB")
+else :   
+   RampLog.info( "Read Bad Channels from SQLite file") 
+
+if 'BadChannelsLArCalibFolderTag' in dir() :
+   BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) 
+   conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+if 'MissingFEBsLArCalibFolderTag' in dir() :
+   MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag)   
+   conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+else :
+   conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>")
+
+## define the DB Gobal Tag :
+svcMgr.IOVDbSvc.GlobalTag   = LArCalib_Flags.globalFlagDB   
+
+svcMgr.PoolSvc.ReadCatalog += ["xmlcatalog_file:/afs/cern.ch/user/l/larcalib/w0/stableConds/PoolCat_stable.xml",
+                               "prfile:poolcond/PoolCat_oflcond.xml",
+                               "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_diskbuffer_afs.xml",
+                               "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_cond09_data.000001.lar.COND_castor.xml",
+                               "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_cond08_data.000001.lar.COND_castor.xml",
+                               "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_comcond.000005.lar_conditions.recon.pool.v0000_castor.xml",
+                               "xmlcatalog_file:/afs/cern.ch/atlas/conditions/poolcond/catalogue/fragments/PoolCat_comcond.000006.lar_conditions.recon.pool.v0000_castor.xml"]
+
+if ( doLArCalibDataQuality  ) :
+   ## The reference is the Oracle DB
+   conddb.addFolder("",LArCalib_Flags.LArRampFolder+"<key>LArRampRef</key><dbConnection>"+DBConnectionCOOL+"</dbConnection>"+ChannelSelection)
+
+#if (CorrectBadChannels or StripsXtalkCorr):
+#   conddb.addFolder("LAR","/LAR/BadChannels/BadChannels")
+#   conddb.addFolder("LAR","/LAR/BadChannels/MissingFEBs")
+   
+if (isHEC):
+   if ( ReadHECMapFromCOOL ):
+      if not 'InputHECMapSQLiteFile' in dir():
+         svcMgr.PoolSvc.ReadCatalog += [ "prfile:poolcond/PoolCat_comcond_castor.xml", "prfile:poolcond/PoolCat_comcond.xml" ]
+         RampLog.info( "Read HECMap from Oracle DB" )
+      else :
+         RampLog.info( "Read HEC map from SQLite file" )
+
+   if ( ReadHECMapFromCOOL ):
+      HECMapFolder  = "/LAR/ElecCalibOfl/HecPAMap"
+      if "HECMapTagSpec" in dir():
+         conddb.addFolder("",HECMapFolder+"<tag>"+HECMapTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionHECMap+"</dbConnection>")
+      else :
+         conddb.addFolder("",HECMapFolder+"<dbConnection>"+InputDBConnectionHECMap+"</dbConnection>")
+
+   else:
+      if 'InputHECMapPoolFileName' in dir():
+         RampLog.info( "Read HECMap form POOL file" )
+         PoolFileList += [ InputHECMapPoolFileDir +"/"+ InputHECMapPoolFileName ]   
+      else:
+         RampLog.info( "No PoolFileList found! Please list the POOL files containing HECMap or read from COOL." )
+         theApp.exit(-1)    
+
+if (CorrectBias or PeakOF or StripsXtalkCorr):
+   if ( ReadPedFromCOOL or ReadOFCFromCOOL ):
+      if not 'InputPedSQLiteFile' in dir():
+         svcMgr.PoolSvc.ReadCatalog += [ "prfile:poolcond/PoolCat_comcond_castor.xml", "prfile:poolcond/PoolCat_comcond.xml" ]
+         RampLog.info( "Read Pedestal from Oracle DB" )
+      else :  
+         RampLog.info( "Read Pedestal from SQLite file" )
+          
+      if not 'InputOFCSQLiteFile' in dir():
+         svcMgr.PoolSvc.ReadCatalog += [ "prfile:poolcond/PoolCat_comcond_castor.xml", "prfile:poolcond/PoolCat_comcond.xml" ] 
+         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
+      if 'PedLArCalibFolderTag' in dir() :
+         PedestalTagSpec = LArCalibFolderTag(PedestalFolder,PedLArCalibFolderTag)
+         conddb.addFolder("",PedestalFolder+"<tag>"+PedestalTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPed+"</dbConnection>"+ChannelSelection)
+      else :
+         conddb.addFolder("",PedestalFolder+"<dbConnection>"+InputDBConnectionPed+"</dbConnection>"+ChannelSelection)
+
+else:
+   if 'InputPedPoolFileName' in dir():
+      RampLog.info( "Read Pedestal from POOL file" )
+      PoolFileList += [ InputPedPoolFileDir +"/"+ InputPedPoolFileName ]   
+   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 StripsXtalkCorr ):
+         CaliOFCFolder  = LArCalib_Flags.LArOFCCaliFolder
+      else:
+         CaliOFCFolder  = LArCalib_Flags.LArOFCCaliFolderXtlk
+      if 'OFCLArCalibFolderTag' in dir() :
+         CaliOFCTagSpec = LArCalibFolderTag(CaliOFCFolder,OFCLArCalibFolderTag)
+         conddb.addFolder("",CaliOFCFolder+"<tag>"+CaliOFCTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionOFC+"</dbConnection>"+ChannelSelection)
+      else :
+         conddb.addFolder("",CaliOFCFolder+"<dbConnection>"+InputDBConnectionOFC+"</dbConnection>"+ChannelSelection)
+
+else:
+   if 'InputOFCPoolFileName' in dir():
+         RampLog.info( "Read OFC Cali form POOL file" )
+         PoolFileList += [ InputOFCPoolFileDir +"/"+ InputOFCPoolFileName ]   
+   else:
+         RampLog.info( "No PoolFileList found! Please list the POOL files containing OFC or read from COOL." )
+         theApp.exit(-1)
+
+if ( len(PoolFileList)>0 ):
+      
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+   
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+
+if ( StripsXtalkCorr ) :
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   from LArCalibUtils.LArCalibUtilsConf import LArStripsCrossTalkCorrector
+   theLArStripsCrossTalkCorrector = LArStripsCrossTalkCorrector()
+   theLArStripsCrossTalkCorrector.KeyList = GainList
+   theLArStripsCrossTalkCorrector.ADCsaturation = ADCsaturation
+   theLArStripsCrossTalkCorrector.NoXtalkCorr=LArBadChannelMasker("NoXtalkCorr",
+                                                               DoMasking=True,
+                                                               ProblemsToMask=["deadReadout","deadPhys","deadCalib","almostDead"]
+                                                               )
+   theLArStripsCrossTalkCorrector.DontUseForXtalkCorr=LArBadChannelMasker("DontUseForXtalkCorr",
+                                                                       DoMasking=True,
+                                                                       ProblemsToMask=["short","peculiarCalibrationLine"]
+                                                                       )
+   theLArStripsCrossTalkCorrector.AcceptableDifference=25.0 #in per-cent
+   topSequence +=theLArStripsCrossTalkCorrector
+
+
+from LArCalibUtils.LArCalibUtilsConf import LArRampBuilder
+if not PeakOF:
+   from LArRecUtils.LArRecUtilsConf import LArParabolaPeakRecoTool
+   theLArParabolaPeakRecoTool=LArParabolaPeakRecoTool()
+   theLArParabolaPeakRecoTool.correctBias = CorrectBias
+   ToolSvc+=theLArParabolaPeakRecoTool
+
+if ( AllWavesPerCh ) :
+   ContNameSplitted = []
+   for i in range(0, MaxCalLinePerCh):
+          ContNameSplitted.append("CalLine"+str(i))
+   from LArCalibUtils.LArCalibUtilsConf import LArAccumulatedCalibDigitContSplitter
+   LArAccCaDigContSplitter = []
+   for j in range(0,len(GainList)):
+      ThisKeyOut = []
+      for i in range(0, MaxCalLinePerCh):
+         ThisKeyOut.append(ContNameSplitted[i]+GainList[j])
+      topSequence+=LArAccumulatedCalibDigitContSplitter("Splitter"+GainList[j]) 
+      exec 'LArAccCaDigContSplitter.append( topSequence.Splitter%(fn)s )' % {'fn' : GainList[j]}
+      LArAccCaDigContSplitter[j].KeyList         = [ GainList[j] ]
+      LArAccCaDigContSplitter[j].KeyOutputList = ThisKeyOut
+      LArAccCaDigContSplitter[j].NumberSplitted  = MaxCalLinePerCh
+      LArAccCaDigContSplitter[j].UseDacAndIsPulsedIndex = True
+      LArAccCaDigContSplitter[j].OutputLevel = ERROR
+
+   theLArRampBuilder = []
+   for i in range(0, MaxCalLinePerCh):
+      ThisKeyList = []
+      for j in range(0,len(GainList)):
+         ThisKeyList.append(ContNameSplitted[i]+GainList[j])
+
+      topSequence+=LArRampBuilder("LArRampBuilder"+str(i+1))
+      exec 'theLArRampBuilder.append( topSequence.LArRampBuilder%(fn)s )' % {'fn' :i+1}
+      theLArRampBuilder[i].KeyList      = ThisKeyList
+      theLArRampBuilder[i].SubtractDac0 = False
+      theLArRampBuilder[i].DAC0         = -1
+      theLArRampBuilder[i].StoreRawRamp = SaveRawRamp
+      theLArRampBuilder[i].StoreRecRamp = True
+      theLArRampBuilder[i].Polynom      = 1
+      theLArRampBuilder[i].isHEC        = isHEC
+      theLArRampBuilder[i].HECKey       = HECKey
+      if ( PeakOF) :
+            theLArRampBuilder[i].RecoType     = "OF"
+            from LArRecUtils.LArRecUtilsConf import LArOFPeakRecoTool
+            exec 'theLArOFPeakRecoTool%(fn)s=LArOFPeakRecoTool("LArOFPeakRecoTool%(fg)s")' % {'fn' :i+1, 'fg' : i+1}
+            exec 'svcMgr.ToolSvc+=theLArOFPeakRecoTool%(fn)s' % {'fn' :i+1}
+            theLArRampBuilder[i].PeakOFTool   = "LArOFPeakRecoTool/LArOFPeakRecoTool"+str(i+1)
+            exec 'svcMgr.ToolSvc.LArOFPeakRecoTool%(fn)s.KeyShape="" ' % {'fn' :i+1} # Don't use shape here
+            exec 'svcMgr.ToolSvc.LArOFPeakRecoTool%(fn)s.KeyOFC="LArOFC%(fn)s" ' % {'fn' :i+1} 
+#            exec 'svcMgr.ToolSvc.LArOFPeakRecoTool%(fn)s.Iterate=IterateOFC ' % {'fn' :i+1}
+            exec 'svcMgr.ToolSvc.LArOFPeakRecoTool%(fn)s.OutputLevel = WARNING ' % {'fn' :i+1}
+      else :
+            theLArRampBuilder[i].RecoType     = "Parabola"
+      
+      theLArRampBuilder[i].RampRange    = 3600  # Check on the raw data ADC sample before ped subtraction
+                                   # and pulse reconstruction to include point in fit
+      theLArRampBuilder[i].correctBias  = CorrectBias
+      theLArRampBuilder[i].ConsecutiveADCs = 0;
+#      theLArRampBuilder[i].Iterate=IterateOFC
+      theLArRampBuilder[i].minDAC       = 10      # minimum DAC value to use in fit
+      theLArRampBuilder[i].KeyOutput    = KeyOutputSplitted[i]
+      theLArRampBuilder[i].DeadChannelCut = -9999
+      theLArRampBuilder[i].GroupingType = "ExtendedSubDetector"
+      theLArRampBuilder[i].OutputLevel = ERROR
+      theLArRampBuilder[i].CorrectBadChannels = False
+
+else:
+
+   theLArRampBuilder = LArRampBuilder()
+   theLArRampBuilder.KeyList      = GainList
+   theLArRampBuilder.SubtractDac0 = False
+
+   if ( PeakOF ):
+     theLArRampBuilder.RecoType = "OF"
+     from LArRecUtils.LArRecUtilsConf import LArOFPeakRecoTool
+     theLArOFPeakRecoTool=LArOFPeakRecoTool()
+     theLArOFPeakRecoTool.UseShape = False
+     ToolSvc+=theLArOFPeakRecoTool
+   else :
+     theLArRampBuilder.RecoType = "Parabola"
+
+   # As the first ramp point no longer is taken at DAC=0
+   # this point should not have a special place.
+   theLArRampBuilder.DAC0         = -1
+   theLArRampBuilder.StoreRawRamp = SaveRawRamp
+   theLArRampBuilder.StoreRecRamp = True
+   theLArRampBuilder.Polynom      = 1    
+   theLArRampBuilder.RampRange    = 3600 # Check on the raw data ADC sample before ped subtraction
+                                      # and pulse reconstruction to include point in fit
+   theLArRampBuilder.correctBias  = CorrectBias
+   theLArRampBuilder.ConsecutiveADCs = 0;
+   theLArRampBuilder.minDAC = 10      # minimum DAC value to use in fit
+   theLArRampBuilder.KeyOutput = KeyOutput
+   theLArRampBuilder.DeadChannelCut = -9999
+   theLArRampBuilder.GroupingType = GroupingType
+   theLArRampBuilder.CorrectBadChannels = False
+
+   if ( isHEC ) :
+     theLArRampBuilder.isHEC = isHEC
+     theLArRampBuilder.HECKey = HECKey
+   
+   topSequence+=theLArRampBuilder
+
+
+######################################################################
+#                                                                    #
+#                          Correction                                #
+#                                                                    #
+######################################################################
+
+if CorrectBadChannels:
+   from LArCalibUtils.LArCalibUtilsConf import LArCalibPatchingAlg_LArRampComplete_
+   theLArRampPatcher=LArCalibPatchingAlg_LArRampComplete_("LArRampPatcher")
+   theLArRampPatcher.ContainerKey=KeyOutput
+   theLArRampPatcher.PatchMethod="PhiAverage"
+   
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
+   theLArBadChannelTool=LArBadChanTool()
+   ToolSvc+=theLArBadChannelTool
+
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   theLArRCBMasker=LArBadChannelMasker("LArRCBMasker")
+   theLArRCBMasker.DoMasking=True
+   theLArRCBMasker.ProblemsToMask=[
+      "deadCalib","deadReadout","deadPhys","almostDead","short" 
+      ]
+   ToolSvc+=theLArRCBMasker
+   theLArRampPatcher.MaskingTool=theLArRCBMasker
+   topSequence+=theLArRampPatcher
+
+
+
+######################################################################
+#                                                                    #
+#                          Output                                    #
+#                                                                    #
+######################################################################
+
+if ( doLArCalibDataQuality  ) :
+   
+   from LArCalibDataQuality.LArCalibDataQualityConf import LArRampValidationAlg
+   from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
+   theLArRampValBCMask=LArBadChannelMasker("RampValBCMask",
+                                           DoMasking=True,
+                                           ProblemsToMask=["deadReadout","deadCalib","deadPhys","almostDead",
+                                                           "highNoiseHG","highNoiseMG","highNoiseLG"]
+                                           )
+   svcMgr.ToolSvc+=theLArRampValBCMask
+   
+   theRampValidationAlg=LArRampValidationAlg()
+   theRampValidationAlg.BadChannelMaskingTool=theLArRampValBCMask
+   theRampValidationAlg.KeyList=GainList
+   theRampValidationAlg.ValidationKey="LArRamp"
+   theRampValidationAlg.ReferenceKey="LArRampRef"
+   theRampValidationAlg.MsgLevelForDeviations=INFO
+   theRampValidationAlg.ListOfDevFEBs="rampFebs.txt"
+   theRampValidationAlg.ThinnedValContainer="ThinRampsVal"
+   theRampValidationAlg.ThinnedRefContainer="ThinRampsRef"
+   topSequence+=theRampValidationAlg
+
+   ## second instance of the validation tool to detect "bad" channel 
+   theBadRamp=LArRampValidationAlg("theBadRamp")
+   theBadRamp.BadChannelMaskingTool=theLArRampValBCMask
+   theBadRamp.KeyList=GainList
+   theBadRamp.ValidationKey="LArRamp"
+   theBadRamp.ReferenceKey="LArRampRef"
+   theBadRamp.MsgLevelForDeviations=INFO
+   theBadRamp.ListOfDevFEBs="Bad_rampFebs.txt"
+   topSequence+=theBadRamp
+
+
+if ( doMonitoring ) :
+   
+   from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+   topSequence += AthenaMonManager( "LArMon" )
+   LArMon = topSequence.LArMon
+
+    ## old style
+   #LArMon.FileKey = "AllMon"
+   #LArMon.ManualDataTypeSetup = True
+   #LArMon.Environment         = "user"
+   #LArMon.ManualRunLBSetup    = True
+   #LArMon.Run                 = 1
+   #LArMon.LumiBlock           = 1
+   #LArMon.CheckEveryNoEvents  = 999999 #to do the check only at the end of the run
+
+   ## tier0 style
+   LArMon.FileKey = "GLOBAL"
+   LArMon.ManualDataTypeSetup = True
+   LArMon.Environment         = "tier0"
+   LArMon.ManualRunLBSetup    = True
+   LArMon.Run                 = int(RunNumberList[0])
+   LArMon.LumiBlock           = 1
+   LArMon.CheckEveryNoEvents  = 999999 #to do the check only at the end of the run
+   
+   include("LArMonTools/LArFEBMon_jobOptions.py")
+   
+   RootHistOutputFileName='RootHistos_'+BaseFileName+".root"
+
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import THistSvc
+   if os.path.exists(OutputRampRootFileDir+ "/" +RootHistOutputFileName): 
+      os.remove(OutputRampRootFileDir+ "/" +RootHistOutputFileName)
+   svcMgr += THistSvc()
+   #svcMgr.THistSvc.Output = ["AllMon DATAFILE='"+OutputRampRootFileDir+ "/" +RootHistOutputFileName+"' OPT='New'"] 
+
+   svcMgr.THistSvc.Output = ["GLOBAL DATAFILE='"+OutputRampRootFileDir+ "/" +RootHistOutputFileName+"' OPT='New'"]
+   
+if (WriteNtuple):
+   
+   # Ramp fit ntuple
+   from LArCalibTools.LArCalibToolsConf import LArRamps2Ntuple
+   AllGainList = ["HIGH","MEDIUM","LOW"]
+   if ( AllWavesPerCh ) :
+      LArRamps2NtupleVec = []
+      for i in range(0, MaxCalLinePerCh):
+        topSequence+=LArRamps2Ntuple("LArRamps2Ntuple"+str(i+1))
+        exec 'LArRamps2NtupleVec.append( topSequence.LArRamps2Ntuple%(fn)s)' % {'fn': i+1}
+        if SaveRawRamp:
+               rawkeys = []
+               for g in range(0, len(AllGainList)):
+                  rawkeys += [ KeyOutputSplitted[i]+AllGainList[g] ]
+               LArRamps2NtupleVec[i].ContainerKey = rawkeys
+        LArRamps2NtupleVec[i].RampKey =  KeyOutputSplitted[i] 
+        LArRamps2NtupleVec[i].NtupleName   = "RAMPS"+str(i)
+        LArRamps2NtupleVec[i].RawRamp      = SaveRawRamp
+        LArRamps2NtupleVec[i].OutputLevel  = ERROR
+   else:     
+      LArRamps2Ntuple=LArRamps2Ntuple("LArRamps2Ntuple")
+      if SaveRawRamp:
+         rawkeys = []
+         for g in range(0, len(GainList)):
+                  rawkeys += [ KeyOutput+AllGainList[g] ]
+      LArRamps2Ntuple.ContainerKey = rawkeys #Only for raw ramp
+      LArRamps2Ntuple.NtupleName = "RAMPS"
+      LArRamps2Ntuple.RawRamp = SaveRawRamp
+   
+      topSequence+= LArRamps2Ntuple
+      
+   if ( SaveAverages ):
+      # Ramp points ntuple(s)
+      from LArCalibTools.LArCalibToolsConf import LArAverages2Ntuple
+      index = 0
+      AveragesVec=[]
+      if ( AllWavesPerCh ) :
+         for i in range(0, MaxCalLinePerCh):
+            for j in range(0,len(AllGainList)):
+               if AllGainList[j] in GainList:
+                  topSequence+=LArAverages2Ntuple("Averages"+str(i+1)+AllGainList[j])
+                  exec 'AveragesVec.append( topSequence.Averages%(fn)s%(fg)s )' % {'fn': i+1, 'fg':AllGainList[j]}
+                  AveragesVec[index].ContainerKey = ContNameSplitted[i]+AllGainList[j]
+                  index += 1
+            if GainList.count("FREE"):
+               topSequence+=LArAverages2Ntuple("Averages"+str(i+1))
+               exec 'AveragesVec.append( topSequence.Averages%(fn)s)' % {'fn': i+1}
+               AveragesVec[index].ContainerKey = ContNameSplitted[i]
+               index += 1
+      else:
+
+         for j in range(0,len(AllGainList)):
+            if AllGainList[j] in GainList:
+               topSequence+=LArAverages2Ntuple("Averages"+AllGainList[j])
+               exec 'AveragesVec.append( topSequence.Averages%(fg)s )' % {'fg':AllGainList[j]}
+               AveragesVec[index].ContainerKey = AllGainList[j]
+               index += 1
+         if GainList.count("FREE"):
+            topSequence+=LArAverages2Ntuple("Averages")
+            exec 'AveragesVec.append( topSequence.Averages)'
+            AveragesVec[index].ContainerKey = KeyOutput
+            index += 1
+
+      
+   theApp.HistogramPersistency = "ROOT"
+   from GaudiSvc.GaudiSvcConf import NTupleSvc
+   if os.path.exists(OutputRampRootFileDir+"/"+OutputRampRootFileName): 
+      os.remove(OutputRampRootFileDir+"/"+OutputRampRootFileName)  
+   svcMgr += NTupleSvc()
+   svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='"+OutputRampRootFileDir+"/"+OutputRampRootFileName+"' OPT='NEW'" ]
+
+if ( WritePoolFile ):
+
+   from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+   if os.path.exists(OutputRampPoolFileDir+"/"+OutputRampPoolFileName): 
+      os.remove(OutputRampPoolFileDir+"/"+OutputRampPoolFileName)  
+   theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg",OutputRampPoolFileDir+"/"+OutputRampPoolFileName,
+                             [OutputObjectSpecRamp],[OutputObjectSpecTagRamp],WriteIOV)
+   theOutputConditionsAlg.Run1 = IOVBegin
+   if IOVEnd>0:
+      theOutputConditionsAlg.Run2=IOVEnd
+
+   svcMgr.IOVDbSvc.dbConnection  = OutputDB
+
+   from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
+   svcMgr += IOVRegistrationSvc()
+   svcMgr.IOVRegistrationSvc.OutputLevel = DEBUG
+   svcMgr.IOVRegistrationSvc.RecreateFolders = False
+
+###########################################################################	
+	
+svcMgr.MessageSvc.OutputLevel  = WARNING
+svcMgr.MessageSvc.defaultLimit = 10000
+svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"
+
+svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = WARNING)
+
+from AthenaCommon.AppMgr import theAuditorSvc
+from AthenaCommon.ConfigurableDb import getConfigurable
+theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = WARNING)
+theAuditorSvc += getConfigurable("ChronoAuditor")()
+theAuditorSvc += getConfigurable("NameAuditor")()
+
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_testing.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_testing.py
new file mode 100644
index 00000000000..143b41ed050
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_testing.py
@@ -0,0 +1,27 @@
+## second instance of the validation tools to detect "bad" channels
+theBadRamp.OutputLevel = INFO
+theBadRamp.ListOfDevFEBs='BadRampFebs.txt'
+theBadRamp.MsgLevelForDeviations=ERROR
+theBadRamp.RampTolerance=["0.1,0.1,0.1"]
+theBadRamp.RampToleranceFEB=["0.1,0.1,0.1"]
+theBadRamp.RawRampTimeTolerance=20.
+theBadRamp.UseCorrChannels=False
+
+    
+
+## first instance of the validation tools to detect "deviated" channels
+theRampValidationAlg.OutputLevel = INFO
+theRampValidationAlg.PatchMissingFEBs=True
+theRampValidationAlg.ListOfDevFEBs='RampFebs.txt'
+theRampValidationAlg.MsgLevelForDeviations=ERROR
+theRampValidationAlg.RampTolerance=["0.1,0.1,0.1"]
+theRampValidationAlg.RampToleranceFEB=["0.1,0.1,0.1"]
+theRampValidationAlg.RawRampTimeTolerance=20.
+theRampValidationAlg.UseCorrChannels=False
+
+theLArRampPatcher.OutputLevel = INFO
+theLArRCBMasker.OutputLevel = INFO
+theLArBadChannelTool.OutputLevel = INFO
+
+svcMgr.MessageSvc.OutputLevel = WARNING
+svcMgr.MessageSvc.defaultLimit = 9999999  # all messages
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RecomputeOFCs.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RecomputeOFCs.py
new file mode 100644
index 00000000000..9c39f805eb1
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RecomputeOFCs.py
@@ -0,0 +1,89 @@
+#Example topOptions to re-run OFC computation & picking from the database
+
+
+#INPUTS:
+#RunNumber=180383
+#IOVBegin=180383
+#IOVEnd=2147483647 
+#partition=["EMBA","EMBAPS"]#,"EMBC"]#,"EMBAPS","EMBCPS"]
+#gain=[0]#,1,2]
+
+#Technicalities:
+#OutputOFCRootFileDir = '.'
+#OutputPoolFileDir = '.'
+
+WriteNtuple = False
+
+include ("LArCalibProcessing/LArCalib_Flags.py")
+
+#
+# Common LArPhysWaveShifter settings
+#
+
+ShiftMode = 3
+Nsamplings = 2
+TimeShiftGuardRegion = 12
+
+#
+# Dphase = 3
+#
+
+OFCKey        = "LArOFC"
+ShapeKey      = "LArShape"
+OFCTreeName   = "OFC"
+ShapeTreeName = "SHAPE"
+
+Nsamples   = 5
+Dphases    = 3 # 3x1.04 ns binning
+Nphases    = 8
+
+
+#Nsamples   = 5
+#Dphases    = 1 # 1.04 ns binning
+#Nphases    = 24
+
+
+isFCAL=False
+
+for p in partition:
+    if p.startswith("FCAL"): isFCAL=True
+
+    
+#
+# PhysCaliTdiff
+#
+UsePhysCaliTdiff = True
+ReadPhysCaliTdiffFromCOOL = True
+PhysCaliTdiffLArCalibFolderTag="-gaincorr-01"
+
+
+#Picking:
+doOFCPicker=True
+DefaultPhase = 1
+FillShapeCorr=False
+#TimeOffsetCorrection = 0
+TimeOffsetCorrection = 12 
+ShapeKeyCorr = "LArShapeCorr"
+
+
+
+OutputOFCRootFileName="LArOFCPhys_"+str(RunNumber)+"_"+"_".join(partition)+"_Gain_"+str(gain[0])+".root"
+OutputPoolFileName="LArOFCPhys_"+str(RunNumber)+"_"+"_".join(partition)+"_Gain_"+str(gain[0])+".pool.root"
+OutputSQLiteFile=OutputPoolFileDir+"/myDB"+str(RunNumber)+"_"+"_".join(partition)+"_Gain_"+str(gain[0])+".db"
+
+#include ( "/afs/cern.ch/user/l/larcalib/w0/DEV/Reconstruction/toolbox/UseLArExtendedSubDetGrouping.py" )
+from LArConditionsCommon.LArExtendedSubDetGrouping import LArExtendedSubDetGrouping
+LArExtendedSubDetGrouping = LArExtendedSubDetGrouping()
+GroupingType="ExtendedSubDetector"
+selection = LArExtendedSubDetGrouping.getChannelSelection(partition,gain)
+ChannelSelection='<channelSelection>'+selection+'</channelSelection>'
+print ChannelSelection
+print "CoolChannel Selection for ", partition, " and ",gain, " gain. "
+
+#svcMgr.PoolSvc.ReadCatalog+=["prfile:poolcond/PoolCat_comcond_castor.xml" ]
+    
+#include ( "LArCalibProcessing/LArCalib_OFC_Phys_TwoFolders_jobOptions.py" )
+
+include ( "LArCalibProcessing/LArCalib_OFC_Phys_jobOptions.py")
+
+svcMgr.MessageSvc.OutputLevel  = INFO
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArHVCool2Ntuple_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArHVCool2Ntuple_jobOptions.py
new file mode 100755
index 00000000000..834df1046eb
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArHVCool2Ntuple_jobOptions.py
@@ -0,0 +1,80 @@
+##############################################################
+# Job options read a LArRampComplete object from a POOL file #
+# and dump it to an ROOT ntuple                              #
+##############################################################
+
+from time import strptime,time
+from calendar import timegm
+
+
+if "date" not in dir():
+    date="2010-07-29:13:00:00"
+
+if "TimeStamp" not in dir():
+   try:
+      ts=strptime(date+'/UTC','%Y-%m-%d:%H:%M:%S/%Z')
+      TimeStamp=int(timegm(ts))*1000000000L
+   except ValueError:
+      print "ERROR in time specification, use e.g. 2007-05-25:14:01:00"
+      
+
+from LArCalibProcessing.TimeStampToRunLumi import TimeStampToRunLumi
+
+rlb=TimeStampToRunLumi(TimeStamp)
+if rlb is None:
+   print "WARNING: Failed to convert time",TimeStamp,"into a run/lumi number"
+   myRunNumber=999999
+   myLumiBlock=0 
+else:
+   myRunNumber=rlb[0]
+   myLumiBlock=rlb[1]
+
+if "RunNumber" in dir():
+   myRunNumber=RunNumber
+   myLumiBlock=0
+
+print "Working on run",myRunNumber,"LB",myLumiBlock,"Timestamp:",TimeStamp
+
+if "GlobalTag" not in dir():
+    GlobalTag     = 'COMCOND-BLKPST-004-00'
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.all_setOff()
+DetFlags.em_setOn()
+
+include( "AthenaCommon/Atlas_Gen.UnixStandardJob.py" )
+
+# the Tile, LAr and Calo detector description package
+DetDescrVersion = "ATLAS-GEO-10-00-00"
+
+online = True
+include ("LArConditionsCommon/LArMinimalSetup.py")
+
+svcMgr.EventSelector.RunNumber=myRunNumber
+svcMgr.EventSelector.EventsPerRun=1
+svcMgr.EventSelector.FirstEvent=1
+
+svcMgr.IOVDbSvc.GlobalTag = GlobalTag
+
+#from LArConditionsCommon.LArCondFlags import larCondFlags
+#larCondFlags.SingleVersion = False
+include ("LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py")
+
+from AthenaCommon.AlgSequence import AlgSequence
+topSequence = AlgSequence()
+
+from LArCalibTools.LArCalibToolsConf import LArHVScaleCorr2Ntuple
+theLArHVScaleCorr2Ntuple = LArHVScaleCorr2Ntuple("LArHVScaleCorr2Ntuple")
+theLArHVScaleCorr2Ntuple.AddFEBTempInfo = False
+topSequence += theLArHVScaleCorr2Ntuple
+
+theApp.HistogramPersistency = "ROOT"
+from GaudiSvc.GaudiSvcConf import NTupleSvc
+svcMgr += NTupleSvc()
+svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='hvcorr_read.root' OPT='NEW'" ]
+
+theApp.EvtMax=1
+svcMgr.MessageSvc.OutputLevel=INFO
+
+#DetStore=Service("DetectorStore");
+#svcMgr.DetStore.Dump=TRUE
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArTimePhysPrediction_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArTimePhysPrediction_jobOptions.py
new file mode 100755
index 00000000000..b04d802cbf1
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArTimePhysPrediction_jobOptions.py
@@ -0,0 +1,206 @@
+###########################################################################
+# 01/2009 T. Guillemin
+# JO for tphys prediction
+# uses the algorithm LArTimePhysPrediction in LArCalibUtils
+# 11/09 T. Guillemin
+# corrections of the special crates fiber lengths
+###########################################################################
+
+from StoreGate.StoreGateConf import StoreGateSvc
+#----------------
+# Dump StoreGate
+#----------------
+#sgStore = StoreGateSvc("StoreGateSvc")
+#sgStore.Dump = True
+#sgStore.OutputLevel = DEBUG
+
+#--------------------
+# Dump DetectorStore
+#--------------------
+#dtStore = StoreGateSvc("DetectorStore")
+#dtStore.Dump = True
+#dtStore.OutputLevel = DEBUG
+
+#----------------------
+# Dump ConditionsStore
+#----------------------
+#cdStore = StoreGateSvc("ConditionsStore")
+#cdStore.Dump = True
+#cdStore.OutputLevel = DEBUG 
+
+#Pool file input 
+# PoolFileList = [ "/tmp/tguillem/LArCaliWave_89206_EB-EMBC_StripsXtalkCorr.pool.root"]
+PoolFileList = [ "/afs/cern.ch/user/l/larcalib/w0/data/WorkingDirectory/00135322_00135323_00135326_Barrel-EMB-EMEC_MEDIUM_26_15.5.1_2/poolFiles/LArCaliWave_00135323_EB-EMBA_StripsXtalkCorr.pool.root"]
+
+###########################################################################
+#
+#                           Global settings
+#
+###########################################################################
+
+## get a handle to the default top-level algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+
+## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+# include modified version of LArCalibProcessing/LArCalib_P3C_MinimalSetup.py
+# because of problems with detector flags
+# include("LArCalibProcessing/LArCalib_P3C_MinimalSetup.py")
+
+from AthenaCommon.GlobalFlags import GlobalFlags
+GlobalFlags.DetGeo.set_commis()
+GlobalFlags.Luminosity.set_zero()
+GlobalFlags.DataSource.set_data()
+GlobalFlags.InputFormat.set_bytestream()
+
+from AthenaCommon.JobProperties import jobproperties
+jobproperties.Global.DetDescrVersion = "ATLAS-Comm-02-00-00"
+
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.Calo_setOn()  #Switched on for the prediction
+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" )
+
+# end of modified version of LArCalibProcessing/LArCalib_P3C_MinimalSetup.py
+
+#to read the Calo descriptor
+include ("CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py")
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+###############################################################################
+#
+# Read POOL file(s)
+#
+###############################################################################
+
+include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py")
+include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py")
+
+from IOVDbSvc.CondDB import conddb
+conddb.setGlobalTag('COMCOND-006-00')
+
+if ( len(PoolFileList)>0 ):
+
+   from AthenaCommon.ConfigurableDb import getConfigurable
+   svcMgr += getConfigurable( "ProxyProviderSvc" )()
+   svcMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+   
+   svcMgr += getConfigurable( "CondProxyProvider" )()
+   svcMgr.CondProxyProvider.InputCollections += PoolFileList
+
+###############################################################################
+#
+# Cables/fibers lengths required for the prediction of the physics time
+#
+###############################################################################
+# speed of the signal in the cables
+# approximation: same speed in all the cables (neglect the cables resistance influence)
+sCalib = 5.5
+sSignal = 5.5
+sPig = 5.5
+sLTP = 5.5
+
+########### calibration cables
+# all the vacuum cables and the warm cables have ~the same length for all the FTs
+# ==> they do not introduce any relative delays (it may have to be taken into account for the FCAL)
+
+# barrel: divide in 16 bins of 0.1
+LCalib_EMB = [[4.58,4.58,4.62,4.62,4.7,4.7,4.81,4.81,4.94,4.94,5.19,5.19,5.46,5.46,5.62,5.62],[4.38,4.38,4.38,4.38,4.38,4.38,4.38,4.38,4.63,4.63,4.83,4.83,5.13,5.13,5.13,0],[3.03,3.03,3.03,3.03,3.03,3.03,3.03,3.03,3.28,3.28,3.48,3.48,3.78,3.78,0],[5.13,3.03,3.03,3.03,3.03,3.03,3.03,3.03,3.03,3.28,3.28,3.48,3.48,3.78,3.78,0,0]]
+EtaMin_EMB = [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5]
+EtaMax_EMB = [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6]
+LPigCalib_EMB = 0.7
+
+# EMEC
+# only one length of calibration cables is used on the detector
+LCalib_EMEC = 4.90
+LPigCalib_EMEC = 0.9
+# HEC
+LCalib_HEC = 13.0
+# FCAL: signal injected at the FEB level => no calibration cables
+
+########### signal cables (only important for the FCAL)
+#EMB
+LSignal_EMB = [[3.35,3.35,3.06,3.06,2.75,2.75,2.41,2.41,2.03,2.03,1.58,1.58,1.06,1.06,0.58,0.58],[3.56,3.56,3.31,3.31,2.96,2.96,2.82,2.82,2.45,2.45,2.01,2.01,1.53,1.53,1.37],[3.03,3.03,3.03,3.03,2.31,2.31,2.31,2.31,1.37,1.37,1.37,1.37,0.45,0.45,1.37],[3.68,3.6,3.6,3.6,3.37,2.93,2.43,1.87,2.55,1.88,1.32,0.81,0.93,1.88]]
+#EMEC (approximation for first iteration: lengths have to be coded for a dedicated study)
+LSignal_EMEC = 4.0
+#HEC (takes pigtail into account)
+LSignal_HEC = 13.0
+#FCAL (takes pigtail into account)
+LSignal_FCAL = [8.4,7.55,7.4]
+
+########### TTC fibers
+# The values can be found in the note ATL-AL-EN-0077
+# Delays in ns are given with respect to the longest fiber
+# barrel: 2 * 32 FTs (0->C,1->A)
+DeltaTTC_EMB = [[93.02,92.49,94.1,92.02,93.04,91.84,92.81,91.87,92.98,92.36,93.27,91.96,93.24,92.28,93.56,92.73,94.03,91.01,92.9,92.2,92.89,90.45,91.34,92.37,93.27,91.31,92.5,91.09,92.3,92.25,92.88,91.97],[93.49,91.02,92.6,92.99,94.21,92.36,93.55,91.93,93.24,92.21,92.98,92.95,94.04,92.5,93.44,92.1,93,92.74,93.64,97.16,98.24,90.42,91.96,91.05,92.75,91.89,93.1,92.4,93.09,93.38,94.36,91.97]]
+
+# end-caps: 2 * 25 FTs (0->C,1->A)
+DeltaTTC_EC = [[14.4,14.5,0,0,13.6,15.1,15.4,12.7,14.3,0,0,1.7,2.5,12.7,14.1,0,0,13.4,14.5,11.7,13.1,0,0,12.7,14.3],[13.7,15.1,0,0,13.8,14.7,15.8,13.9,14.9,0,0,4.7,5.7,13.6,14.5,0,0,13.1,13.9,13.9,14.7,0,0,0,1]]
+# special crates: 3 fibers per crate
+DeltaTTC_ECC_SPEC = [[14.7,15.6,16.7],[13.6,14.9,17.3],[15.9,17.6,18.3],[13.5,14.5,14.5]]
+DeltaTTC_ECA_SPEC = [[13.5,14.6,15.9],[13.8,15,18],[13.9,15,15.9],[12.5,14,15]]
+
+###############################################################################
+#
+# Algorithms
+#
+############################################################################### 
+# make sure that other subdetectors are not built
+#from AthenaCommon.GlobalFlags import GlobalFlags
+#GlobalFlags.DetGeo.set_atlas()
+#GlobalFlags.DataSource.set_geant4()
+#GlobalFlags.Luminosity.set_zero()
+
+DetDescrCnvSvc = Service( "DetDescrCnvSvc" )
+
+from LArCalibUtils.LArCalibUtilsConf import LArTimePhysPrediction
+LArTimePhysPrediction = LArTimePhysPrediction()
+LArTimePhysPrediction.KeyInput = "LArCaliWave"
+LArTimePhysPrediction.nchannels_max = 1000000
+topSequence += LArTimePhysPrediction
+LArTimePhysPrediction.sCalib = sCalib
+LArTimePhysPrediction.sSignal = sSignal
+LArTimePhysPrediction.sPig = sPig
+LArTimePhysPrediction.sLTP = sLTP
+LArTimePhysPrediction.vLCalib_EMB = LCalib_EMB
+LArTimePhysPrediction.vEtaMin_EMB = EtaMin_EMB
+LArTimePhysPrediction.vEtaMax_EMB = EtaMax_EMB
+LArTimePhysPrediction.vLCalib_EMEC = LCalib_EMEC
+LArTimePhysPrediction.vLCalib_HEC = LCalib_HEC
+LArTimePhysPrediction.vLSignal_EMB = LSignal_EMB
+LArTimePhysPrediction.vLSignal_EMEC = LSignal_EMEC
+LArTimePhysPrediction.vLSignal_HEC = LSignal_HEC
+LArTimePhysPrediction.vLSignal_FCAL = LSignal_FCAL
+LArTimePhysPrediction.vDeltaTTC_EMB = DeltaTTC_EMB
+LArTimePhysPrediction.vDeltaTTC_EC = DeltaTTC_EC
+LArTimePhysPrediction.vDeltaTTC_ECC_SPEC = DeltaTTC_ECC_SPEC
+LArTimePhysPrediction.vDeltaTTC_ECA_SPEC = DeltaTTC_ECA_SPEC
+
+###########################################################################
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel  = INFO
+#MessageSvc.defaultLimit = 1000;
+###########################################################################
+#save the ntuple
+theApp.HistogramPersistency = "ROOT"
+from GaudiSvc.GaudiSvcConf import NTupleSvc
+svcMgr += NTupleSvc()
+svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='Test.ntuple.root' OPT='NEW'" ]
+###########################################################################
+theApp.EvtMax = 1 # Leave this unchanged!
+###########################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LAr_updateHVcalib_online.sh b/LArCalorimeter/LArExample/LArCalibProcessing/share/LAr_updateHVcalib_online.sh
new file mode 100755
index 00000000000..4e785c7e534
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LAr_updateHVcalib_online.sh
@@ -0,0 +1,292 @@
+#!/bin/bash
+
+if [[ $# < 3 ]];
+then
+    echo "Syntax: $0 <time>  <Run> <LB> "
+    echo " <time> = time in UTC at which the HV is stable at the new conditions (and HV mapping updated if needed) like \"2010-07-29:13:00:00\" "
+    echo " <Run> <LB> = run/lumiblock to start IoV for UPD3/UPD4 update (allows to backdate)"
+    exit
+fi
+
+
+echo " -----"
+echo "This script will compute the HV scale correction for the given time (UTC) " 
+echo "    the new HV setting should be correct / stable for this Time "
+echo "    in case of HV mapping change, the new mapping should be valid (in the UPD4 tag) for this specified time (be careful of glitch at the mapping db is in run/lb IoV) "
+echo " "
+echo "It will also produce new noise tables for online/offline database"
+echo "   this assumes that the current state of the UPD1 offline noise database is in synch with the HV corrections used in DSP before this new setting, at the time specified by Time"
+echo " "
+
+
+time=$1
+run=$2
+lb=$3
+
+summaryFile=noise_summary.txt
+
+echo " Time to look at HV situation                           " ${time}
+echo " Run /LB for IoOV start update for noise   in UPD4 tag  " ${run} ${lb}
+
+echo "    be careful: you need ~60 Mbytes of free disk space in the running directory... "
+
+if [ -f LArHVScaleCorr_dummy.pool.root ];
+   then
+   echo "ERROR: Output pool file for HV scale correction already exists LArHVScaleCorr_dummy.pool.root. Remove it before running this script !"
+   exit
+fi
+
+if [ -f myDB200_hvDummy.db ];
+   then
+   echo "ERROR: local sqlite file for HV scale correction already exists  myDB200_hvDummy.db. Remove it before running this script !"
+   exit
+fi
+
+if [ -f myDB200_hvOnline.db ];
+    then
+    /bin/rm myDB200_hvOnline.db
+fi
+
+if [ -f myDB200_UPD3.db ];
+    then
+    /bin/rm myDB200_UPD3.db
+fi
+
+if [ -f larnoisesqlite.db ];
+    then
+    echo "ERROR: Output file larnoisesqlite.db exists already. Remove it before running this script !"
+    exit
+fi
+
+if [ -f caloSqlite_UPD1_offline.db ];
+    then
+    /bin/rm caloSqlite_UPD1_offline.db
+fi
+
+
+if [ -f $summaryFile ]
+    then 
+    /bin/rm  $summaryFile
+fi
+
+if [ -f calonoise.txt ]
+    then
+    /bin/rm calonoise.txt
+fi
+
+if [ -f cellnoise_data.root ]
+    then
+    /bin/rm cellnoise_data.root
+fi
+
+if [ -f dumpMapping.txt ]
+    then
+    /bin/rm dumpMapping.txt
+fi
+
+touch $summaryFile
+
+if ! which AtlCoolCopy.exe 1>/dev/null 2>&1
+then
+    echo "No offline setup found!"
+    exit
+fi
+
+cat > getGlobalTag.py << _EOF4_
+import sys
+from PyCool import cool
+sys.path.append('/afs/cern.ch/user/a/atlcond/utils/python/')
+from AtlCoolBKLib import resolveAlias
+resolver=resolveAlias()
+currentGlobal=resolver.getCurrent().replace("*","ST")
+print currentGlobal
+_EOF4_
+
+globalTag=`python getGlobalTag.py | awk '{print($1)}'`
+#globalTag="COMCOND-BLKPA-006-01"
+
+echo $globalTag
+
+
+
+echo "Running athena to compute new HV corrections"
+athena.py -c "date=\"${time}\";GlobalTag=\"${globalTag}\""  LArCalibProcessing/LArCalib_Example_HVCorr.py > hv.log 2>&1
+if [ $? -ne 0 ];  then
+      echo "Athena reported an error ! Please check hv.log!"
+      exit
+fi
+
+if grep -q ERROR hv.log
+      then
+      echo "An error occured ! Please check hv.log!"
+      exit
+fi
+
+usedRun=`grep "Working on run" hv.log | awk '{print($4)}'`
+echo " ---> the run number to read the HV mapping db in the UPD4 tag is " ${usedRun}
+
+cat > dumpMapping.py << _EOF1_
+from CoolConvUtilities import AtlCoolTool
+toolNew = AtlCoolTool.AtlCoolTool("COOLOFL_LAR/COMP200")
+toolNew.usetag("LARIdentifierOflHVLineToElectrodeMap-UPD4-01")
+a=toolNew.more("/LAR/IdentifierOfl/HVLineToElectrodeMap")
+f=file('dumpMapping.txt','w')
+f.write(str(a))
+f.close()
+exit()
+_EOF1_
+
+python dumpMapping.py >& python.log
+runHVmap=`grep LArHVMap dumpMapping.txt  | tail -1 | cut -f 1  -d , | cut -f 2 -d \[`
+
+echo "      the latest HV mapping change is valid from run " ${runHVmap}
+
+if test ${runHVmap} -gt ${usedRun}; then
+   echo "   BE CAREFUL  the used run is older than the latest HV mapping change... Check that you know what you are doing before any db upload "
+fi
+
+
+
+
+echo " "
+echo "Running athena to read current HV scale factor correction in database for comparison"
+athena.py -c "date=\"${time}\"" LArCalibProcessing/LArHVCool2Ntuple_jobOptions.py > readhv.log 2>&1
+if [ $? -ne 0 ];  then
+      echo "Athena reported an error ! Please check readhv.log!"
+      exit
+fi
+
+if grep -q ERROR readhv.log
+      then
+      echo "An error occured ! Please check readhv.log!"
+      exit
+fi
+
+cat > hvcheck.C << _EOF2_
+{
+ TFile f1("hvcorr_read.root");
+ TFile f2("hvcorr_ntuple.root");
+ TTree* t1 = f1.Get("HVSCALE");
+ TTree* t2 = f2.Get("HVSCALE");
+ t2->AddFriend(t1,"t1");
+ t2->SetScanField(99999999);
+ ((TTreePlayer*)(t2->GetPlayer()))->SetScanRedirect(true); 
+ ((TTreePlayer*)(t2->GetPlayer()))->SetScanFileName("hvlist.txt");
+ t2->Scan("barrel_ec:pos_neg:FT:layer:ieta:iphi:hvcorr:t1.hvcorr","abs(hvcorr-t1.hvcorr)>0.005"); 
+}
+_EOF2_
+
+root -b -l -n -q hvcheck.C > readroot.log 2>&1
+nHV=`grep "selected entries" readroot.log | awk '{print($2)}'`
+echo " -----> Number of channels which changed HV correction more than 0.5\%: " ${nHV}
+echo "        Look at the file hvlist.txt for the full list of these channels"
+
+echo " "
+echo "Make online folder for HVcorr sqlite file"
+AtlCoolCopy.exe "sqlite://;schema=myDB200_hvDummy.db;dbname=COMP200" "sqlite://;schema=myDB200_hvOnline.db;dbname=COMP200" -f /LAR/ElecCalibOfl/HVScaleCorr -of /LAR/ElecCalibOnl/HVScaleCorr -fs -alliov -create >& mergedb.log 
+/afs/cern.ch/user/l/larcalib/LArDBTools/python/setOnlineMode.py myDB200_hvOnline.db
+
+echo "create UPD3 tag for HV corr "
+AtlCoolCopy.exe  "sqlite://;schema=myDB200_hvDummy.db;dbname=COMP200" "sqlite://schema=myDB200_UPD3.db;dbname=COMP200" -f  /LAR/ElecCalibOfl/HVScaleCorr -of /LAR/ElecCalibOfl/HVScaleCorr -ot LARElecCalibOflHVScaleCorr-UPD3-00 -nrls ${run} ${lb} -create -alliov >> mergedb.log 
+
+
+echo " "
+echo "Running athena to rescale noise values from current UPD1 noise database"
+athena.py -c "date=\"${time}\";GlobalTag=\"${globalTag}\"" CaloCondPhysAlgs/CaloRescaleNoise_online_jobOptions.py > noise.log 2>&1
+
+if [ $? -ne 0 ];  then
+      echo "Athena reported an error ! Please check noise.log!"
+      exit    
+fi
+
+if grep -q ERROR noise.log
+      then    
+      echo "An error occured ! Please check noise.log!"
+      exit    
+fi
+
+
+nLines=`wc -l calonoise.txt | cut -f 1 -d " "`
+echo "  Ncells*Ngains for which noise is computed  " ${nLines}
+if [ $nLines -ne 547404 ]; then
+     echo "Number of lines in noise ascii file is not correct, check log file to investigate possible problem or disk space"
+     exit
+fi
+
+grep DifferentNoise noise.log > ${summaryFile}
+nTotal=`wc -l ${summaryFile} | cut -f 1 -d " "`
+echo " ---> Number of cells*Number of gains(3) for which noise changed more than 5\%" ${nTotal}
+echo "      Check file "  ${summaryFile} " for the full list "
+echo "      You can also look at cellnoise_data.root for ntuple information "
+
+echo "Resolving current folder-level tag suffix for /LAR/NoiseOfl/CellNoise"
+fulltag=`getCurrentFolderTag.py "COOLOFL_LAR/COMP200"  /LAR/NoiseOfl/CellNoise | tail -1` 
+#upd4TagName=`echo $fulltag | grep -o "UPD4-[0-9][0-9]"` 
+echo "Found $fulltag"
+
+
+echo "Produce sqlite file for LAr noise values" 
+CaloNoise_fillDB.py ${run} ${lb} -1 -1 ${fulltag} larnoisesqlite.db > makedb.log 2>&1
+if [ $? -ne 0 ];  then
+    echo "An error is reported, check makedb.log"
+    exit
+fi
+
+cat >> dumpDB.py << _EOF3_
+from CoolConvUtilities import AtlCoolTool
+toolNew = AtlCoolTool.AtlCoolTool("sqlite://;schema=larnoisesqlite.db;dbname=COMP200")
+toolNew.usetag("$fulltag")
+a=toolNew.more('/LAR/NoiseOfl/CellNoise')
+f = file('dumpDB.txt','w')
+f.write(str(a))
+f.close()
+exit()
+_EOF3_
+
+if [ -f dumpDB.txt ]
+    then
+     /bin/rm dumpDB.txt
+fi
+
+python dumpDB.py
+
+echo " "
+echo "   Content of new noise UPD4 sqlite file : "
+cat dumpDB.txt
+
+echo " " 
+
+cp larnoisesqlite.db tempdb.db
+
+echo "Make UPD1 offline folder for noise "
+AtlCoolCopy.exe "sqlite://;schema=tempdb.db;dbname=COMP200" "sqlite://;schema=larnoisesqlite.db;dbname=COMP200" -f /LAR/NoiseOfl/CellNoise -t ${fulltag} -ot  LARNoiseOflCellNoise-UPD1-00 -create >> mergedb.log 
+
+/bin/rm tempdb.db
+
+echo "Make UPD1 online folder for noise "
+AtlCoolCopy.exe "sqlite://;schema=larnoisesqlite.db;dbname=COMP200" "sqlite://;schema=caloSqlite_UPD1_online.db;dbname=COMP200" -f /LAR/NoiseOfl/CellNoise -of /CALO/Noise/CellNoise -t ${fulltag} -ot  CaloNoiseCellnoise-UPD1-00 -create >> mergedb.log 
+
+echo "Doing check of the noise sqlite against P1HLT cache....."
+echo "Will take 3-5 minutes, be patient......"
+(mkdir /tmp/noise_test_$$; cp caloSqlite_UPD1_online.db /tmp/noise_test_$$/; cd /tmp/noise_test_$$/; source $AtlasSetup/scripts/asetup.sh --tags=AtlasP1HLT,17.1.5.21,setup,here; athena.py -c "sqlite='caloSqlite_UPD1_online.db'" TriggerRelease/test_hltConditions.py >/dev/null 2>&1 ) >/dev/null 2>&1
+if [ $? -ne 0 ];  then
+      echo "Testing job reported an error ! "
+      echo "Please, do not upload constants to online ! "
+      exit
+fi
+
+echo "  "
+echo " mergedb.log contains the log file of the various AtlCoolCopy operation to make local sqlite files"
+echo " " 
+echo "  After checking that everything is OK you can proceed with the database update"
+echo "  (1) ~atlcond/utils/registerFiles2 --wait --online cond12_data.lar.COND LArHVScaleCorr_dummy.pool.root "
+echo "  (2) ~atlcond/CondAFSBufferMgr/startAFSBufferReplication.py  myDB200_hvOnline.db"
+echo "  after checking that steps 1 and 2 went OK (you should get some e-mail confirmation, without ERROR) and after calling LAr RC"
+echo "  (3) ~atlcond/utils/AtlCoolMerge.py --online  myDB200_hvOnline.db  COMP200 ATONR_COOL  ATLAS_COOLONL_LAR_W  <password>"
+echo "  (4) ~atlcond/utils/AtlCoolMerge.py larnoisesqlite.db COMP200 ATLAS_COOLWRITE ATLAS_COOLOFL_LAR_W <password>"
+echo "  (5) ~atlcond/utils/AtlCoolMerge.py --online caloSqlite_UPD1_online.db  COMP200 ATONR_COOL ATLAS_COOLONL_CALO_W <password>"
+echo "  (6) ~atlcond/utils/AtlCoolMerge.py --partial myDB200_UPD3.db COMP200 ATLAS_COOLWRITE ATLAS_COOLOFL_LAR_W <password> "
+
+echo "  (note that password are different for LAr online,offline, Calo online offline databases"
+echo "  3 requires lar online password, 4 and 6 the lar offline password, 5 calo online password"
+exit
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/README b/LArCalorimeter/LArExample/LArCalibProcessing/share/README
new file mode 100644
index 00000000000..288ad649fe5
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/README
@@ -0,0 +1,26 @@
+==============================================================================
+LArCalibProcessing jobOptions (last update: 08/05/2008)
+==============================================================================
+
+* 'P3C' jobOptions:
+
+These are the most up-to-date jobOptions fragments for all the
+electronics calibration jobs (the ones you should use!). The
+Electronic Calibration developers are taking care to migrate them to
+the latest reelase, see the following list for compatibility.
+
+Please note that all these jobOptions file are NOT supposed to
+modified directly: all default settings can be externally set on the
+Athena command line, or trough a topOptions file. Examples for the
+different jobs are provided, please refer to them for guidelines.
+
+* 'CTB04' jobOptions:
+
+These are still here for hystorical reasons, even if they are
+certainly outdated and might not run on latest releases.
+
+* 'Example' jobOptions:
+
+There are 'uncommon' jobOptions documenting the possibile use cases of
+special algorithms. They might well be outdated.
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_AutoCorrPhys_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_AutoCorrPhys_jobOptions.py
new file mode 100644
index 00000000000..11593af9b26
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_AutoCorrPhys_jobOptions.py
@@ -0,0 +1,31 @@
+import commands
+
+#input bytestream files
+
+FullFileName = ["rfio:/castor/cern.ch/grid/atlas/DAQ/2009/00137909/express_express/data09_cos.00137909.express_express.daq.RAW._lb0000._SFO-1._0001.data"]
+
+
+IOVBegin = 137909
+
+RunNumberList = [137909]
+
+GainList = ["FREE"]
+
+NSamples = 5
+
+WriteNtuple = True
+
+# some hack to avoid trying to access low gain presampler calibration for AutoCorr
+#  (not filled usually but we have a very old file not on disk anymore from a wrong upload long ago...)
+
+from LArConditionsCommon.LArCondFlags import larCondFlags
+larCondFlags.LArCoolChannelSelection.set_Value_and_Lock("3:588,653:1036")
+
+
+include("LArCalibProcessing/LArCalib_AutoCorrPhys_jobOptions.py")
+
+theApp.EvtMax=1000
+
+from LArCalibProcessing.LArCalibCatalogs import larCalibCatalogs
+svcMgr.PoolSvc.ReadCatalog += larCalibCatalogs
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_CaliWaveMerger.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_CaliWaveMerger.py
new file mode 100644
index 00000000000..5b28a731386
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_CaliWaveMerger.py
@@ -0,0 +1,11 @@
+ContainerKeyList = [ "LArCaliWave1", "LArCaliWave2" ]
+PoolFileList     = [ "file1.pool.root", "file2.pool.root" ]
+
+OutDir    = "."
+KeyOutput = "LArCaliWave"
+
+###############################################################################
+
+include("LArCalibProcessing/LArCalib_CaliWaveMerger_jobOptions.py")
+
+###############################################################################
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_Delay.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_Delay.py
new file mode 100644
index 00000000000..64f4cd79ad2
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_Delay.py
@@ -0,0 +1,122 @@
+#######################################
+# you can choose the number of event
+#theApp.EvtMax = 500
+#######################################
+
+InputDir = "/castor/cern.ch/grid/atlas/DAQ/lar/ElecCalib/2009/00110555"
+RunNumberList = [ '00110555' ]
+IOVBegin =  110555
+Partition = "EB-EMBA"
+SubDet = 'Barrel'
+GainList = [ "MEDIUM" ]
+
+## where you want to put the outputfile
+#OutputCaliWaveRootFileDir  =""
+#OutputCaliWavePoolFileDir  =""
+
+StripsXtalkCorr = True
+WriteNtuple = True
+
+###################################################################
+# Check for empty (missing) phases
+# If found in at least one channel, will abort run
+# Don't enable if you;re running on a subset of events!
+###################################################################
+CheckEmptyPhases = False
+
+
+#########################
+# to read official DB
+#########################
+# by default, 
+# nothing to do it will pickup the GlobalTag
+
+
+#######################################
+# to read COOL in a local SQlite file 
+#######################################
+
+
+## Pedestal
+#######################
+## local SQlite file
+#InputPedSQLiteFile = "myDB200.db"
+# the folder tag
+#PedLArCalibFolderTag = "-UPD3-00"
+################################################################################
+# >>>>>>>>>> you NEED to have your POOL files inserter in the  PoolFileCatalog
+################################################################################
+
+
+## Bad Channel
+#######################
+#InputBadChannelSQLiteFile = "myDB200.db"
+# the folder tag
+#BadChannelsLArCalibFolderTag = "-UPD3-00"
+#MissingFEBsLArCalibFolderTag = "-empty"
+
+#######################################
+
+include("LArCalibProcessing/LArCalib_Delay_jobOptions.py")
+
+#######################################
+
+if ( StripsXtalkCorr ) :
+    theLArStripsCrossTalkCorrector.OutputLevel = INFO
+
+LArCaliWaveBuilder.OutputLevel = INFO
+
+if ( WriteNtuple ) :
+    LArCaliWaves2Ntuple.OutputLevel = INFO
+
+if (doCaliWaveSelector) :
+    LArCaliWaveSelector.OutputLevel = INFO
+
+## LArStripsCrossTalkCorrection 
+if (StripsXtalkCorr == True) :
+    theLArStripsCrossTalkCorrector.OutputLevel = INFO
+
+## LArMonTool
+if ( doMonitoring ) :
+    ToolSvc.LArFEBMon.OutputLevel = INFO
+    
+## LArCaliWave
+LArCaliWaveBuilder.OutputLevel = INFO
+LArCaliWaves2Ntuple.OutputLevel = INFO
+
+svcMgr.MessageSvc.OutputLevel = ERROR
+
+svcMgr.IOVDbSvc.OutputLevel = INFO
+    
+
+########################
+#        options
+#########################
+#------------
+# Message
+#------------
+#svcMgr.MessageSvc.defaultLimit = 9999999  # all messages
+#svcMgr.MessageSvc.OutputLevel = VERBOSE
+
+#from StoreGate.StoreGateConf import StoreGateSvc
+#----------------
+# Dump StoreGate
+#----------------
+#sgStore = StoreGateSvc("StoreGateSvc")
+#sgStore.Dump = True
+#sgStore.OutputLevel = DEBUG
+
+#--------------------
+# Dump DetectorStore
+#--------------------
+#dtStore = StoreGateSvc("DetectorStore")
+#dtStore.Dump = True
+#dtStore.OutputLevel = DEBUG
+
+#----------------------
+# Dump ConditionsStore
+#----------------------
+#cdStore = StoreGateSvc("ConditionsStore")
+#cdStore.Dump = True
+#cdStore.OutputLevel = DEBUG
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_OFC_Cali.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_OFC_Cali.py
new file mode 100644
index 00000000000..3e0df4538a5
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_OFC_Cali.py
@@ -0,0 +1,101 @@
+# this will triogger IOV to retriev CaliWave
+InputDir = "/castor/cern.ch/grid/atlas/DAQ/lar/ElecCalib/2009"
+RunNumber = '00110555'
+IOVBegin = 110555
+Partition = "EB-EMBA"
+SubDet = 'Barrel'
+GainList = [ "MEDIUM" ]
+
+#############################################################################################
+## this cool channel selection is using to Read only BarrelPS Medium gain Delay from the DB
+ChannelSelection='<channelSelection>385:416,1013</channelSelection>'
+#############################################################################################
+
+## where you want to put the outputfile
+#OutputOFCRootFileDir = ""
+#OutputOFCPoolFileDir =""
+#OutputShapePoolFileDir = ""
+
+WriteNtuple = True
+
+#########################
+# to read official DB
+#########################
+# by default, 
+# nothing to do it will pickup the GlobalTag
+
+
+#######################################
+# to read COOL in a local SQlite file 
+#######################################
+
+## AutoCorr
+#######################
+## local SQlite file
+#InputAutoCorrSQLiteFile = "myDB200.db"
+# the folder tag
+#AutoCorrLArCalibFolderTag = "-UPD3-00"
+#################################################################################
+# >>>>>>>>>> you NEED to have your POOL files inserter in the  PoolFileCatalog
+#################################################################################
+
+## CaliWave
+#######################
+## local SQlite file
+#InputCaliWaveSQLiteFile = "myDB200.db"
+# the folder tag
+#CaliWaveLArCalibFolderTag = "-UPD3-00"
+################################################################################
+# >>>>>>>>>> you NEED to have your POOL files inserter in the  PoolFileCatalog
+################################################################################
+
+## Bad Channel
+#######################
+#InputBadChannelSQLiteFile = "myDB200.db"
+# the folder tag
+#BadChannelsLArCalibFolderTag = "-UPD3-00"
+#MissingFEBsLArCalibFolderTag = "-empty"
+
+#######################################
+
+include("LArCalibProcessing/LArCalib_OFC_Cali_jobOptions.py")
+
+#######################################
+
+
+## LArOFCCali
+LArCaliOFCAlg.OutputLevel = INFO
+LArOFC2Ntuple.OutputLevel = DEBUG
+
+svcMgr.IOVDbSvc.OutputLevel = DEBUG
+
+########################
+#        options
+#########################
+#------------
+# Message
+#------------
+#svcMgr.MessageSvc.defaultLimit = 9999999  # all messages
+#svcMgr.MessageSvc.OutputLevel = VERBOSE
+
+#from StoreGate.StoreGateConf import StoreGateSvc
+#----------------
+# Dump StoreGate
+#----------------
+#sgStore = StoreGateSvc("StoreGateSvc")
+#sgStore.Dump = True
+#sgStore.OutputLevel = DEBUG
+
+#--------------------
+# Dump DetectorStore
+#--------------------
+#dtStore = StoreGateSvc("DetectorStore")
+#dtStore.Dump = True
+#dtStore.OutputLevel = DEBUG
+
+#----------------------
+# Dump ConditionsStore
+#----------------------
+#cdStore = StoreGateSvc("ConditionsStore")
+#cdStore.Dump = True
+#cdStore.OutputLevel = DEBUG
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_OFC_One_Phase_Phys.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_OFC_One_Phase_Phys.py
new file mode 100644
index 00000000000..8970b97b43f
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_OFC_One_Phase_Phys.py
@@ -0,0 +1,82 @@
+# this will triogger IOV to retriev AutoCorr and CaliWave
+RunNumber = 69129
+Partition = "EB-EMBA"
+SubDet = 'Barrel'
+GainList = [ "HIGH" ]
+
+## where you want to put the outputfile
+#OutputOFCRootFileDir= ""
+#OutputOFCPoolFileDir= ""
+
+#########################
+# to read official DB
+#########################
+# by default, 
+# nothing to do it will pickup the GlobalTag
+
+
+#######################################
+# to read COOL in a local SQlite file 
+#######################################
+
+## OFC
+#######################
+## local SQlite file
+#InputOFCSQLiteFile = "myDB200.db"
+#InputOFCSQLiteFile = "/afs/cern.ch/user/l/larcalib/w0/data/WorkingDirectory/69125_69129_69135_Barrel_24/poolFiles/myDB200_69125_69129_69135_EB-EMBA_OFCPhys.db"
+# the folder tag
+#OFCLArCalibFolderTag = "-comm-11"
+# >>>>>>>>>> you NEED to have your POOL files inserter in the  PoolFileCatalog
+
+#########################
+# to read a POOL file
+#########################
+
+## OFC
+########################
+#ReadAutoCorrFromCOOL = False
+# extern POOL file with the location
+#InputAutoCorrPoolDir = ""
+#InputAutoCorrPoolFileName = ""
+
+#######################################
+
+include ( "LArCalibProcessing/LArCalib_PickOFCOnePhase.py" )
+
+#######################################
+
+
+LArOFPhasePicker.OutputLevel = DEBUG
+LArOFC2Ntuple.OutputLevel = DEBUG
+
+#########################
+#        options
+#########################
+
+#------------
+# Message
+#------------
+#svcMgr.MessageSvc = Service( "MessageSvc" )
+#svcMgr.MessageSvc.defaultLimit = 9999999  # all messages
+#svcMgr.MessageSvc.OutputLevel = VERBOSE
+
+#----------------
+# Dump StoreGate
+#----------------
+#svcMgr.StoreGateSvc = Service("StoreGateSvc" )
+#svcMgr.StoreGateSvc.Dump = True
+#svcMgr.StoreGateSvc.OutputLevel = DEBUG
+
+#--------------------
+# Dump DetectorStore
+#--------------------
+#svcMgr.DetectorStore = Service("DetectorStore" )
+#svcMgr.DetectorStore.Dump = True
+#svcMgr.DetectorStore.OutputLevel = DEBUG
+
+#----------------------
+# Dump ConditionsStore
+#----------------------
+#svcMgr.ConditionsStore  = Service("ConditionsStore" )
+#svcMgr.ConditionsStore.Dump = True
+#svcMgr.ConditionsStore.OutputLevel = DEBUG
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_OFC_Phys.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_OFC_Phys.py
new file mode 100644
index 00000000000..7ecb1cf5568
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_OFC_Phys.py
@@ -0,0 +1,102 @@
+# this will triogger IOV to retriev CaliWave
+RunNumber = '00110555'
+IOVBegin = 110555
+Partition = "EB-EMBA"
+SubDet = 'Barrel'
+GainList = [ "MEDIUM" ]
+
+#############################################################################################
+## this cool channel selection is using to Read only BarrelPS Medium gain Delay from the DB
+ChannelSelection='<channelSelection>385:416,1013</channelSelection>'
+#############################################################################################
+
+
+## where you want to put the outputfile
+#OutputOFCRootFileDir= ""
+#OutputOFCPoolFileDir= ""
+#OutputShapePoolFileDir= ""
+
+WriteNtuple = True
+
+#########################
+# to read official DB
+#########################
+# by default, 
+# nothing to do it will pickup the GlobalTag
+
+
+#######################################
+# to read COOL in a local SQlite file 
+#######################################
+
+## AutoCorr
+#######################
+## local SQlite file
+#InputAutoCorrSQLiteFile = "myDB200.db"
+# the folder tag
+#AutoCorrLArCalibFolderTag = "-UPD3-00"
+################################################################################
+# >>>>>>>>>> you NEED to have your POOL files inserter in the  PoolFileCatalog
+################################################################################
+
+## PhysWave
+#######################
+## local SQlite file
+#InputPhysWaveSQLiteFile = "myDB200.db"
+# the folder tag
+#PhysWaveLArCalibFolderTag = "-UPD3-00"
+################################################################################
+# >>>>>>>>>> you NEED to have your POOL files inserter in the  PoolFileCatalo
+################################################################################
+
+## Bad Channel
+#######################
+#InputBadChannelSQLiteFile = "myDB200.db"
+# the folder tag
+#BadChannelsLArCalibFolderTag = "-UPD3-00"
+#MissingFEBsLArCalibFolderTag = "-empty"
+
+######################################
+
+include("LArCalibProcessing/LArCalib_OFC_Phys_jobOptions.py")
+
+#######################################
+
+LArPhysOFCAlg.OutputLevel = INFO
+LArOFC2Ntuple.OutputLevel = DEBUG
+LArPhysWaveShifter.OutputLevel  = INFO
+
+svcMgr.IOVDbSvc.OutputLevel = DEBUG    
+
+
+########################
+#        options
+#########################
+#------------
+# Message
+#------------
+#svcMgr.MessageSvc.defaultLimit = 9999999  # all messages
+#svcMgr.MessageSvc.OutputLevel = VERBOSE
+
+#from StoreGate.StoreGateConf import StoreGateSvc
+#----------------
+# Dump StoreGate
+#----------------
+#sgStore = StoreGateSvc("StoreGateSvc")
+#sgStore.Dump = True
+#sgStore.OutputLevel = DEBUG
+
+#--------------------
+# Dump DetectorStore
+#--------------------
+#dtStore = StoreGateSvc("DetectorStore")
+#dtStore.Dump = True
+#dtStore.OutputLevel = DEBUG
+
+#----------------------
+# Dump ConditionsStore
+#----------------------
+#cdStore = StoreGateSvc("ConditionsStore")
+#cdStore.Dump = True
+#cdStore.OutputLevel = DEBUG
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_Pedestal_AutoCorr.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_Pedestal_AutoCorr.py
new file mode 100644
index 00000000000..91f802dfc5d
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_Pedestal_AutoCorr.py
@@ -0,0 +1,108 @@
+#######################################
+# you can choose the number of event
+#theApp.EvtMax = 500
+
+#######################################
+
+InputDir="/castor/cern.ch/grid/atlas/DAQ/lar/ElecCalib/2009/00110554"
+IOVBegin = 110554
+RunNumberList = [ '00110554' ]
+SubDet = "Barrel"
+Partition = "EB-EMBA"
+GainList = ["MEDIUM"]
+runAccumulator = False
+
+## where you want to put the outputfile
+#OutputPedAutoCorrRootFileDir =""
+#OutputPedPoolFileDir = ""
+#OutputAutoCorrPoolFileDir= ""
+
+WriteNtuple = True
+
+#########################
+# to read official DB
+#########################
+# by default, 
+# nothing to do it will pickup the GlobalTag
+
+
+#######################################
+# to read COOL in a local SQlite file 
+#######################################
+
+## Bad Channel
+#######################
+#InputBadChannelSQLiteFile = "myDB200.db"
+# the folder tag
+#BadChannelsLArCalibFolderTag = "-UPD3-00"
+#MissingFEBsLArCalibFolderTag = "-empty"
+
+
+#######################################
+
+include("LArCalibProcessing/LArCalib_PedestalAutoCorr_jobOptions.py")
+
+#######################################
+
+## LArPedestal
+if ( Pedestal )  :
+    if runAccumulator :
+        LArPedestalMaker.OutputLevel = INFO
+    else :
+        LArPedACBuilder.OutputLevel = INFO
+    LArPedestals2Ntuple.OutputLevel = INFO
+
+## LArAutoCorr    
+if ( AutoCorr ) :
+    if runAccumulator :
+        LArAutoCorrMaker.OutputLevel = INFO
+    else :
+        LArPedACBuilder.OutputLevel = INFO
+    LArAutoCorr2Ntuple.OutputLevel = INFO
+
+## LArMonTool
+if ( doMonitoring ) :
+    if (doLArFEBMon) :
+        theLArFEBMon.OutputLevel = INFO
+        
+    if (doLArOddCellMonTool) :
+        theLArOddCellsMonTool.OutputLevel = INFO
+        theLArOddCellsMonTool.minimumRefNoise = [0.5,0.5]
+
+    if (doLArScaNoiseTool) :
+        theLArScaNoiseMonTool.OutputLevel = INFO
+        
+    if (doLArDigitNoiseMonTool) :
+        theLArDigitNoiseMon.OutputLevel = INFO
+    
+
+########################
+#        options
+#########################
+#------------
+# Message
+#------------
+#svcMgr.MessageSvc.defaultLimit = 9999999  # all messages
+#svcMgr.MessageSvc.OutputLevel = VERBOSE
+
+#from StoreGate.StoreGateConf import StoreGateSvc
+#----------------
+# Dump StoreGate
+#----------------
+#sgStore = StoreGateSvc("StoreGateSvc")
+#sgStore.Dump = True
+#sgStore.OutputLevel = DEBUG
+
+#--------------------
+# Dump DetectorStore
+#--------------------
+#dtStore = StoreGateSvc("DetectorStore")
+#dtStore.Dump = True
+#dtStore.OutputLevel = DEBUG
+
+#----------------------
+# Dump ConditionsStore
+#----------------------
+#cdStore = StoreGateSvc("ConditionsStore")
+#cdStore.Dump = True
+#cdStore.OutputLevel = DEBUG
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_PhysWavePredicted.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_PhysWavePredicted.py
new file mode 100644
index 00000000000..9e69d1df920
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_PhysWavePredicted.py
@@ -0,0 +1,80 @@
+
+# this will triogger IOV to retriev CaliWave
+RunNumber = 29142 
+IOVBegin = 29142
+Partition = "EB-EMBA"
+SubDet = 'Barrel'
+
+#########################
+# to read official DB
+#########################
+# by default, 
+# nothing to do
+
+#######################################
+# to read COOL in a local SQlite file 
+#######################################
+
+# local SQlite file
+#InputCaliWaveSQLiteFile = "myDB200.db"
+
+# or a extern SQlite file with the location 
+#InputCaliWaveSQLiteFile = "myDB200_29142_29143_29146.db"
+# if necessary give the folder tag
+#CaliWaveLArCalibFolderTag = "-comm-05"
+# you need to have your POOL files inserter in the  PoolFileCatalog
+
+#########################
+# to read a POOL file
+#########################
+#ReadCaliWaveFromCOOL = False
+
+# local POOL file
+#RunNumberAutoCorr= 30944
+
+# or a extern POOL file with the location
+#InputCaliWavePoolDir = "/afs/cern.ch/user/l/"
+#InputCaliWavePoolFileName = "LArCaliWave_29143_EB-EMBA.pool.root"
+
+# you need to have your POOL files inserter in the  PoolFileCatalog
+#######################################
+
+include("LArCalibProcessing/LArCalib_PhysWavePredictor_jobOptions.py")
+
+LArPhysWavePredictor.OutputLevel  = INFO
+LArPhysWaveTool.OutputLevel = INFO
+LArPhysWaves2Ntuple.OutputLevel = INFO
+
+
+########################
+#        options
+#########################
+#------------
+# Message
+#------------
+#svcMgr.MessageSvc.OutputLevel  = WARNING
+#svcMgr.MessageSvc.defaultLimit = 9999999  # all messages
+#svcMgr.MessageSvc.OutputLevel = VERBOSE
+
+#from StoreGate.StoreGateConf import StoreGateSvc
+#----------------
+# Dump StoreGate
+#----------------
+#sgStore = StoreGateSvc("StoreGateSvc")
+#sgStore.Dump = True
+#sgStore.OutputLevel = DEBUG
+
+#--------------------
+# Dump DetectorStore
+#--------------------
+#dtStore = StoreGateSvc("DetectorStore")
+#dtStore.Dump = True
+#dtStore.OutputLevel = DEBUG
+
+#----------------------
+# Dump ConditionsStore
+#----------------------
+#cdStore = StoreGateSvc("ConditionsStore")
+#cdStore.Dump = True
+#cdStore.OutputLevel = DEBUG
+
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_PhysWavePredictedAndShifted.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_PhysWavePredictedAndShifted.py
new file mode 100644
index 00000000000..2d8259c174d
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_PhysWavePredictedAndShifted.py
@@ -0,0 +1,130 @@
+# this will triogger IOV to retriev CaliWave
+RunNumber = '00110555'
+IOVBegin = 110555
+Partition = "EB-EMBA"
+SubDet = 'Barrel'
+GainList = [ "MEDIUM" ]
+
+#############################################################################################
+## this cool channel selection is using to Read only BarrelPS Medium gain Delay from the DB
+ChannelSelection='<channelSelection>385:416,1013</channelSelection>'
+#############################################################################################
+
+## where you want to put the outputfile
+#OutputPhysWaveRootFileDir= ""
+#OutputPhysWavePoolFileDir= ""
+#OutputMphysOverMcalPoolFileDir =""
+
+## Options
+
+UseDoubleTriangle = False
+
+isHEC=False
+if (isHEC) :
+    StripsXtalkCorr=False
+
+## DB folders for Parameters
+
+InputCaliPulseParamsFolder = "/LAR/ElecCalibOfl/CaliPulseParams/RTM"
+InputDetCellParamsFolder = "/LAR/ElecCalibOfl/DetCellParams/RTM"
+
+WriteNtuple = True
+
+#########################
+# to read official DB
+#########################
+# by default, 
+# nothing to do it will pickup the GlobalTag
+
+
+#######################################
+# to read COOL in a local SQlite file 
+#######################################
+
+
+## CaliWave
+#######################
+## local SQlite file
+#InputCaliWaveSQLiteFile = "myDB200.db"
+# the folder tag
+#CaliWaveLArCalibFolderTag = "-UPD3-00"
+################################################################################
+# >>>>>>>>>> you NEED to have your POOL files inserter in the  PoolFileCatalog
+################################################################################
+
+## PulseParams
+########################
+## local SQlite file
+#InputPulseParamsSQLiteFile = "myDB200.db"
+# the folder tag
+#PulseParamsLArCalibFolderTag= "-UPD3-00"
+################################################################################
+# >>>>>>>>>> you NEED to have your POOL files inserter in the  PoolFileCatalog
+################################################################################
+
+## DetCellParams
+########################    
+## local SQlite file
+#InputDetCellParamsSQLiteFile = "myDB200.db"
+# the folder tag
+#DetCellParamsLArCalibFolderTag =  "-UPD3-00"
+################################################################################
+# >>>>>>>>>> you NEED to have your POOL files inserter in the  PoolFileCatalog
+################################################################################
+
+## Bad Channel
+#######################
+#InputBadChannelSQLiteFile = "myDB200.db"
+# the folder tag
+#BadChannelsLArCalibFolderTag = "-UPD3-00"
+#MissingFEBsLArCalibFolderTag = "-empty"
+
+#######################################
+
+include ( "LArCalibProcessing/LArCalib_PhysWavePredictorAndShifter_jobOptions.py" )
+
+#######################################
+
+## LArPhysWave
+LArPhysWavePredictor.OutputLevel  = INFO
+if not (isHEC) :
+    LArPhysWaveTool.OutputLevel = INFO
+else :
+    LArPhysWaveHECTool.OutputLevel = INFO    
+LArPhysWaves2Ntuple.OutputLevel = INFO
+
+LArMphysOverMcal2Ntuple.OutputLevel = INFO
+
+svcMgr.IOVDbSvc.OutputLevel = DEBUG
+    
+
+########################
+#        options
+#########################
+#------------
+# Message
+#------------
+#svcMgr.MessageSvc.defaultLimit = 9999999  # all messages
+#svcMgr.MessageSvc.OutputLevel = VERBOSE
+
+#from StoreGate.StoreGateConf import StoreGateSvc
+#----------------
+# Dump StoreGate
+#----------------
+#sgStore = StoreGateSvc("StoreGateSvc")
+#sgStore.Dump = True
+#sgStore.OutputLevel = DEBUG
+
+#--------------------
+# Dump DetectorStore
+#--------------------
+#dtStore = StoreGateSvc("DetectorStore")
+#dtStore.Dump = True
+#dtStore.OutputLevel = DEBUG
+
+#----------------------
+# Dump ConditionsStore
+#----------------------
+#cdStore = StoreGateSvc("ConditionsStore")
+#cdStore.Dump = True
+#cdStore.OutputLevel = DEBUG
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_PhysWaveShifted.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_PhysWaveShifted.py
new file mode 100644
index 00000000000..82c95078f8c
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_PhysWaveShifted.py
@@ -0,0 +1,77 @@
+
+# this will triogger IOV to retriev CaliWave
+RunNumber = 29142 
+IOVBegin = 29142
+Partition = "EB-EMBA"
+SubDet = 'Barrel'
+
+#########################
+# to read official DB
+#########################
+# by default, 
+# nothing to do
+
+#######################################
+# to read COOL in a local SQlite file 
+#######################################
+
+# local SQlite file
+#InputPhysWaveSQLiteFile = "myDB200.db"
+
+# or a extern SQlite file with the location 
+#InputPhysWaveSQLiteFile = "myDB200_29142_29143_29146.db"
+# if necessary give the folder tag
+#PhysWaveLArCalibFolderTag = "-comm-05"
+# you need to have your POOL files inserter in the  PoolFileCatalog
+
+#########################
+# to read a POOL file
+#########################
+#ReadPhysWaveFromCOOL = False
+
+# or a extern POOL file with the location
+#InputPhysWavePoolDir = "/afs/cern.ch/user/t/tarrade/scratch0/CommissioningMonitoring/AtlasOfflineRelease/Calibration/13.0.30/run"
+#InputPhysWavePoolFileName = "FCalWave.pool.root"
+
+#InputPhysWavePoolDir = "/tmp/tarrade"
+#InputPhysWavePoolFileName = "LArPhysWave_RTM_29142_EB-EMBA.pool.root"
+
+# you need to have your POOL files inserter in the  PoolFileCatalog
+#######################################
+
+include("LArCalibProcessing/LArCalib_PhysWaveShifter_jobOptions.py")
+
+LArPhysWaveShifter.OutputLevel  = DEBUG
+
+
+########################
+#        options
+#########################
+#------------
+# Message
+#------------
+#svcMgr.MessageSvc.OutputLevel  = WARNING
+#svcMgr.MessageSvc.defaultLimit = 9999999  # all messages
+#svcMgr.MessageSvc.OutputLevel = VERBOSE
+
+#from StoreGate.StoreGateConf import StoreGateSvc
+#----------------
+# Dump StoreGate
+#----------------
+#sgStore = StoreGateSvc("StoreGateSvc")
+#sgStore.Dump = True
+#sgStore.OutputLevel = DEBUG
+
+#--------------------
+# Dump DetectorStore
+#--------------------
+#dtStore = StoreGateSvc("DetectorStore")
+#dtStore.Dump = True
+#dtStore.OutputLevel = DEBUG
+
+#----------------------
+# Dump ConditionsStore
+#----------------------
+#cdStore = StoreGateSvc("ConditionsStore")
+#cdStore.Dump = True
+#cdStore.OutputLevel = DEBUG
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_RTMParamsExtraction.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_RTMParamsExtraction.py
new file mode 100644
index 00000000000..b49f70e414d
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_RTMParamsExtraction.py
@@ -0,0 +1,128 @@
+## this will triogger IOV to retriev CaliWave
+RunNumber = '00110555'
+IOVBegin = 110555
+Partition = "EB-EMBA"
+SubDet = 'Barrel'
+GainList = [ "MEDIUM" ]
+
+#############################################################################################
+## this cool channel selection is using to Read only BarrelPS Medium gain Delay from the DB
+ChannelSelection='<channelSelection>385:416,1013</channelSelection>'
+#############################################################################################
+
+
+## where you want to put the outputfile
+#OutputParamsRootFileDir= ""
+#OutputPulseParamsPoolFileDir= ""
+#OutputDetCellParamsPoolFileDir= ""
+
+## DB folders for Parameters
+## extracted using RTM methode :
+InputCaliPulseParamsFolder     = "/LAR/ElecCalibOfl/CaliPulseParams/RTM"
+InputDetCellParamsFolder       = "/LAR/ElecCalibOfl/DetCellParams/RTM"  
+
+WriteNtuple = True
+
+###################################
+#     Extract All Parameters      #
+###################################
+ExtractAllParameters = True
+
+###################################
+#      Extract only tauR          #
+###################################
+#ExtractTauROnly = True
+
+#########################
+# to read official DB
+#########################
+# by default, 
+# nothing to do it will pickup the GlobalTag
+
+
+#######################################
+# to read COOL in a local SQlite file 
+#######################################
+
+
+## CaliWave
+#######################
+## local SQlite file
+#InputCaliWaveSQLiteFile = "myDB200.db"
+# the folder tag
+#CaliWaveLArCalibFolderTag = "-UPD3-00"
+################################################################################
+# >>>>>>>>>> you NEED to have your POOL files inserter in the  PoolFileCatalog
+################################################################################
+
+
+## CaliPulseParams
+########################
+## local SQlite file
+#InputCaliPulseParamsSQLiteFile = "myDB200.db"
+# folder tag
+#CaliPulseParamsLArCalibFolderTag = "-UPD3-00"
+################################################################################
+# >>>>>>>>>> you NEED to have your POOL files inserter in the  PoolFileCatalog
+################################################################################
+
+## DetCellParams
+########################
+#InputDetCellParamsSQLiteFile = "myDB200.db"
+# the folder tag
+#DetCellParamsLArCalibFolderTag = "-UPD3-00"
+################################################################################
+# >>>>>>>>>> you NEED to have your POOL files inserter in the  PoolFileCatalog
+################################################################################
+
+## Bad Channel
+#######################
+#InputBadChannelSQLiteFile = "myDB200.db"
+# the folder tag
+#BadChannelsLArCalibFolderTag = "-UPD3-00"
+#MissingFEBsLArCalibFolderTag = "-empty"
+
+#######################################
+
+include ( "LArCalibProcessing/LArCalib_RTMParams_jobOptions.py" )
+
+#######################################
+
+
+## LArRTMParams
+LArRTMParamExtractor.OutputLevel = INFO
+theLArWFParamTool.OutputLevel = INFO
+LArWFParams2Ntuple.OutputLevel = INFO
+
+svcMgr.IOVDbSvc.OutputLevel = DEBUG    
+
+#########################
+#        options
+#########################
+#------------
+# Message
+#------------
+#svcMgr.MessageSvc.defaultLimit = 9999999  # all messages
+#svcMgr.MessageSvc.OutputLevel = VERBOSE
+
+#from StoreGate.StoreGateConf import StoreGateSvc
+#----------------
+# Dump StoreGate
+#----------------
+#sgStore = StoreGateSvc("StoreGateSvc")
+#sgStore.Dump = True
+#sgStore.OutputLevel = DEBUG
+
+#--------------------
+# Dump DetectorStore
+#--------------------
+#dtStore = StoreGateSvc("DetectorStore")
+#dtStore.Dump = True
+#dtStore.OutputLevel = DEBUG
+
+#----------------------
+# Dump ConditionsStore
+#----------------------
+#cdStore = StoreGateSvc("ConditionsStore")
+#cdStore.Dump = True
+#cdStore.OutputLevel = DEBUG
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_Ramp.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_Ramp.py
new file mode 100644
index 00000000000..ba5f69c25de
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_Ramp.py
@@ -0,0 +1,131 @@
+#######################################
+# you can choose the number fo event
+#theApp.EvtMax = 500
+#######################################
+
+InputDir = "/castor/cern.ch/grid/atlas/DAQ/lar/ElecCalib/2009/00110556"
+RunNumberList = [ '00110556' ]
+IOVBegin = 110556
+Partition = "EB-EMBA"
+SubDet = 'Barrel'
+GainList = [ "MEDIUM" ]
+
+#############################################################################################
+## this cool channel selection is using to Read only BarrelPS Medium gain Delay from the DB
+ChannelSelection='<channelSelection>385:416,1013</channelSelection>'
+#############################################################################################
+
+## where you want to put the outputfile
+#OutputRampRootFileDir = ""
+#OutputRampPoolFileDir = ""
+
+isHEC = False
+CorrectBadChannels   = True
+ApplyAdHocCorrection = False
+PeakOF = True
+WriteNtuple = True
+
+#########################
+# to read official DB
+#########################
+# by default, 
+# nothing to do it will pickup the GlobalTag
+
+
+#######################################
+# to read COOL in a local SQlite file 
+#######################################
+
+## Pedestal
+#######################
+## local SQlite file
+#InputPedSQLiteFile = "myDB200.db"
+# the folder tag
+#PedLArCalibFolderTag = "-UPD3-00"
+#################################################################################
+# >>>>>>>>>> you NEED to have your POOL files inserter in the  PoolFileCatalog
+#################################################################################
+
+## OFC Cali
+#######################
+## local SQlite file
+#InputOFCSQLiteFile = "myDB200.db"
+# the folder tag
+#OFCLArCalibFolderTag = "-UPD3-00"
+################################################################################
+# >>>>>>>>>> you NEED to have your POOL files inserter in the  PoolFileCatalog
+################################################################################
+
+
+## Bad Channel
+#######################
+#InputBadChannelSQLiteFile = "myDB200.db"
+# the folder tag
+#BadChannelsLArCalibFolderTag = "-UPD3-00"
+#MissingFEBsLArCalibFolderTag = "-empty"
+
+#######################################
+
+include("LArCalibProcessing/LArCalib_Ramp_jobOptions.py")
+
+#######################################
+
+if ( CorrectBadChannels ) :
+    theLArBadChannelTool.OutputLevel = INFO
+    theLArRampPatcher.OutputLevel = INFO
+    theLArRCBMasker.OutputLevel = DEBUG
+
+## LArStripsCrossTalkCorrection
+if (StripsXtalkCorr == True) :
+    theLArStripsCrossTalkCorrector.OutputLevel = INFO
+
+## LArBadChannel
+if (CorrectBadChannels) :
+    theLArRampPatcher.OutputLevel = INFO
+    theLArRCBMasker.OutputLevel = DEBUG
+    theLArBadChannelTool.OutputLevel =VERBOSE
+
+## LArMonTool    
+if ( doMonitoring ) :
+    ToolSvc.LArFEBMon.OutputLevel = INFO
+
+## LArRamp    
+theLArOFPeakRecoTool.OutputLevel = VERBOSE
+theLArRampBuilder.OutputLevel = INFO
+LArRamps2Ntuple.OutputLevel = DEBUG
+
+svcMgr.MessageSvc.OutputLevel = ERROR
+
+svcMgr.IOVDbSvc.OutputLevel = INFO
+    
+    
+########################
+#        options
+#########################
+#------------
+# Message
+#------------
+#svcMgr.MessageSvc.defaultLimit = 9999999  # all messages
+#svcMgr.MessageSvc.OutputLevel = VERBOSE
+
+#from StoreGate.StoreGateConf import StoreGateSvc
+#----------------
+# Dump StoreGate
+#----------------
+#sgStore = StoreGateSvc("StoreGateSvc")
+#sgStore.Dump = True
+#sgStore.OutputLevel = DEBUG
+
+#--------------------
+# Dump DetectorStore
+#--------------------
+#dtStore = StoreGateSvc("DetectorStore")
+#dtStore.Dump = True
+#dtStore.OutputLevel = DEBUG
+
+#----------------------
+# Dump ConditionsStore
+#----------------------
+#cdStore = StoreGateSvc("ConditionsStore")
+#cdStore.Dump = True
+#cdStore.OutputLevel = DEBUG
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/UseLArExtendedSubDetGrouping.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/UseLArExtendedSubDetGrouping.py
new file mode 100644
index 00000000000..ba65915ac08
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/UseLArExtendedSubDetGrouping.py
@@ -0,0 +1,80 @@
+print 'LArExtendedSubDetGrouping'
+
+from LArConditionsCommon.LArExtendedSubDetGrouping import LArExtendedSubDetGrouping
+LArExtendedSubDetGrouping = LArExtendedSubDetGrouping()
+LArExtendedSubDetGrouping.setWithCorr(False)
+
+## defined gain :
+
+## HIGH
+if ( GainList[0]=="HIGH" ):
+    gain= [0]
+
+## MEDIUM    
+elif  ( GainList[0]=="MEDIUM" ) :
+    gain= [1]
+
+## LOW    
+elif  ( GainList[0]=="LOW" ) :
+    gain= [2]
+
+else:
+    gain=[0,1,2]
+
+## defined partition
+
+if (int(RunNumberFlag)<100000) :
+    ## EMB + EMBPS A 64 (32+32)   
+    if ( Partition=='EB-EMBA' and ( GainList[0]=="HIGH" or GainList[0]=="MEDIUM" ) ) :
+        partition =['EMBAPS','EMBA']
+        print 'EMBA+EMBAPS partition'
+    elif ( Partition=='EB-EMBC' and ( GainList[0]=="HIGH" or GainList[0]=="MEDIUM" ) ) :
+        partition =['EMBCPS','EMBC']
+        print 'EMBC+EMBCPS partition'
+    elif ( Partition=='EB-EMBA' and GainList[0]=="LOW" ) :
+        partition =['EMBA']
+        print 'EMBA partition'
+    elif ( Partition=='EB-EMBC' and GainList[0]=="LOW" ) :
+        partition =['EMBC']
+        print 'EMBC partition'
+
+else :
+    ## EMB  A+C    
+    if ( Partition=='EB-EMBA' and ( PartitionTypeGeneric!='EMBPS' ) ) :
+        partition =['EMBA']
+        print 'EMBA partition'
+    elif ( Partition=='EB-EMBC' and ( PartitionTypeGeneric!='EMBPS' ) ) :
+        partition =['EMBC']
+        print 'EMBC partition'
+        
+    ## EMBPS  A+C     
+    if ( Partition=='EB-EMBA' and ( PartitionTypeGeneric=='EMBPS' ) ) :
+        partition =['EMBAPS']
+        print 'EMBAPS partition'
+    elif ( Partition=='EB-EMBC' and ( PartitionTypeGeneric=='EMBPS' ) ) :
+        partition =['EMBCPS']
+        print 'EMBCPS partition'
+        
+        
+## EMEC + PS A  44    
+if ( Partition=='EB-EMECA' ) :
+    partition =['EMECAPS','EMECA']
+elif ( Partition=='EB-EMECC' ) :
+    partition =['EMECCPS','EMECC']
+
+## HEC A + C   8 (4+4)  
+elif ( PartitionType=='HEC'):
+    partition =['HECA','HECC']
+
+## FCAL A + C   2 (1+1)
+elif ( PartitionType=='FCAL') :   
+    partition =['FCALA','FCALC']
+
+selection = LArExtendedSubDetGrouping.getChannelSelection(partition,gain)
+ChannelSelection='<channelSelection>'+selection+'</channelSelection>'
+print ChannelSelection
+print "CoolChannel Selection for ", partition, " and ",gain, " gain. "
+    
+    
+
+   
diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/test/LArCalibProcessing_TestConfiguration.xml b/LArCalorimeter/LArExample/LArCalibProcessing/test/LArCalibProcessing_TestConfiguration.xml
new file mode 100644
index 00000000000..19e626e5f00
--- /dev/null
+++ b/LArCalorimeter/LArExample/LArCalibProcessing/test/LArCalibProcessing_TestConfiguration.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!DOCTYPE unifiedTestConfiguration SYSTEM "http://www.hep.ucl.ac.uk/atlas/AtlasTesting/DTD/unifiedTestConfiguration.dtd">
+
+<unifiedTestConfiguration>
+
+<atn>
+  <TEST name="LArCalib_Pedestal" type="athena" suite="LArElecCalib">
+     <options_atn> -c 'doMonitoring=False; runAccumulator=False; doLArCalibDataQuality=True; GainList=["HIGH"]; PartitionType="EMB"; Partition="EB-EMBA"; PartitionTypeGeneric="EMBPS"; RunNumberList=[174585]; RunNumberFlag=int(RunNumberList[0]); InputDir=" "; FullFileName=["/afs/cern.ch/user/l/larcalib/w0/Test/data11_calib.00174585.calibration_LArElec-Pedestal-7s-High-BarrelPS.daq.RAW._lb0000._EB-EMBA._0001.data"]; GroupingType="ExtendedSubDetector" ' LArCalibProcessing/UseLArExtendedSubDetGrouping.py  LArCalibProcessing/LArCalib_PedestalAutoCorr_jobOptions.py LArCalibProcessing/LArCalib_PedestalAutoCorr_testing.py</options_atn>
+     <timelimit>30</timelimit>
+     <author> Pavol Strizenec </author>
+     <mailto> pavol@mail.cern.ch </mailto>
+     <expectations>
+     </expectations>
+  </TEST>
+  <TEST name="LArCalib_Ramp" type="athena" suite="LArElecCalib">
+     <options_atn> -c 'doMonitoring=False; doLArCalibDataQuality=True; CorrectBadChannels=True; ApplyAdHocCorrection=False; GainList=["HIGH"]; PartitionType="EMB"; Partition="EB-EMBA"; PartitionTypeGeneric="EMBPS"; RunNumberList=[174586]; RunNumberFlag=int(RunNumberList[0]); InputDir=" "; FullFileName=["/afs/cern.ch/user/l/larcalib/w0/Test/data11_calib.00174586.calibration_LArElec-Ramp-7s-High-BarrelPS.daq.RAW._lb0000._EB-EMBA._0001.data"]; GroupingType="ExtendedSubDetector" ' LArCalibProcessing/UseLArExtendedSubDetGrouping.py  LArCalibProcessing/LArCalib_Ramp_jobOptions.py LArCalibProcessing/LArCalib_Ramp_testing.py</options_atn>
+     <timelimit>30</timelimit>
+     <author> Pavol Strizenec </author>
+     <mailto> pavol@mail.cern.ch </mailto>
+     <expectations>
+     </expectations>
+  </TEST>
+</atn>
+
+</unifiedTestConfiguration>
-- 
GitLab