From 54d6fe3c4a9b58d5468f4989a603b1a66443a2e8 Mon Sep 17 00:00:00 2001
From: Scott Snyder <scott.snyder@cern.ch>
Date: Thu, 12 Jun 2014 20:20:59 +0200
Subject: [PATCH] Const fixes. (LArMonitoring-01-00-02)

---
 .../LArMonitoring/LArNoiseBursts.h            |  322 ++++
 .../LArMonitoring/LArOddCellsMonTool.h        |  236 +++
 .../LArMonitoring/LArOnlineIDStrHelper.h      |  184 ++
 .../LArMonitoring/LArOnlineIDStrHelper.icc    |  419 +++++
 .../LArMonitoring/SelectAllLArRawChannels.h   |   47 +
 LArCalorimeter/LArMonitoring/cmt/requirements |   62 +
 .../python/HVTripsDB/CheckHVStatus.py         |  162 ++
 .../python/HVTripsDB/CheckHVStatus_daily.py   |  358 ++++
 .../LArMonitoring/python/HVTripsDB/README     |   56 +
 .../python/HVTripsDB/appendDb.py              |   50 +
 .../python/HVTripsDB/createDB.py              |   49 +
 .../LArMonitoring/python/HVTripsDB/dump.py    |   29 +
 .../python/HVTripsDB/favicon.ico              |  Bin 0 -> 30846 bytes
 .../LArMonitoring/python/HVTripsDB/index.bak  |   57 +
 .../LArMonitoring/python/HVTripsDB/index.py   |  285 +++
 .../python/HVTripsDB/recreateDB.py            |   11 +
 .../python/HVTripsDB/recreateDetails.py       |   51 +
 .../python/HVTripsDB/runHVChecks.py           |   12 +
 .../LArMonitoring/python/HVTripsDB/status.py  |   51 +
 .../LArMonitoring/python/HVTripsDB/styles.css |  128 ++
 .../LArMonitoring/python/HVTripsDB/trips.dat  |  383 ++++
 .../python/HVTripsDB/updateHVTripsDB.py       |   24 +
 .../LArMonitoring/python/LADIeS/UPDTools.py   |  884 +++++++++
 .../python/LADIeS/WeeklyReport.py             |  664 +++++++
 .../LArMonitoring/python/LADIeS/runList.py    |   12 +
 .../python/LArIdtranslator/create_LArBad.py   |   55 +
 .../python/LArIdtranslator/generate_db.sh     |   29 +
 .../python/LArIdtranslator/index.py           |  427 +++++
 .../python/LArIdtranslator/scripts.js         |   70 +
 .../python/LArIdtranslator/styles.css         |   82 +
 .../python/LArMonitoringFlags.py              |   20 +
 .../python/MiscLibraries/AtlasStyle.C         |   98 +
 .../python/MiscLibraries/AtlasStyle.h         |   26 +
 .../python/MiscLibraries/MyCOOLlib.py         |  614 +++++++
 .../LArMonitoring/python/MiscLibraries/gb.py  |  147 ++
 .../DataVisualizer/DataVisualizer.class       |  Bin 0 -> 1677 bytes
 .../DataVisualizer/DataVisualizer.java        |   89 +
 .../DataVisualizer/HVNode.class               |  Bin 0 -> 984 bytes
 .../TripVisualizer/DataVisualizer/HVNode.java |   34 +
 .../DataVisualizer/LumiBlock.class            |  Bin 0 -> 764 bytes
 .../DataVisualizer/LumiBlock.java             |   25 +
 .../DataVisualizer/PlotDrawer.class           |  Bin 0 -> 6449 bytes
 .../DataVisualizer/PlotDrawer.java            |  255 +++
 .../TripVisualizer/DataVisualizer/Trip.class  |  Bin 0 -> 2279 bytes
 .../TripVisualizer/DataVisualizer/Trip.java   |   74 +
 .../python/TripVisualizer/GenerateAllPlots.py |   45 +
 .../TripVisualizer/GenerateHVDatFiles.py      |  337 ++++
 .../python/TripVisualizer/GeneratePlot.py     |   58 +
 .../python/TripVisualizer/HVHistoryPic        |    1 +
 .../python/TripVisualizer/readme              |   21 +
 .../python/TripVisualizer/setup.sh            |   11 +
 .../python/TripVisualizer/updateDatFiles.py   |   17 +
 .../TripVisualizer/updateTripVisualizer.sh    |   34 +
 .../WebDisplayExtractor/WDE_documentation.txt |   47 +
 .../python/WebDisplayExtractor/atlasblue.ico  |  Bin 0 -> 7254 bytes
 .../aux/GetATLASReadyLBs.py                   |   21 +
 .../WebDisplayExtractor/aux/GetNEventsLB.py   |   90 +
 .../aux/detStatus_query.py                    |  235 +++
 .../WebDisplayExtractor/dev/index_cm.py       |  513 ++++++
 .../WebDisplayExtractor/dev/noisycells.py     |  627 +++++++
 .../WebDisplayExtractor/dev/print_rows.py     |  320 ++++
 .../WebDisplayExtractor/dev/print_top.py      |   69 +
 .../WebDisplayExtractor/dev/run_report.py     | 1206 +++++++++++++
 .../WebDisplayExtractor/dev/selection.py      |  125 ++
 .../WebDisplayExtractor/prod/index_cm.py      |  518 ++++++
 .../WebDisplayExtractor/prod/noisycells.py    |  603 +++++++
 .../WebDisplayExtractor/prod/print_rows.py    |  320 ++++
 .../WebDisplayExtractor/prod/print_top.py     |   69 +
 .../WebDisplayExtractor/prod/run_report.py    | 1206 +++++++++++++
 .../WebDisplayExtractor/prod/selection.py     |  125 ++
 .../python/WebDisplayExtractor/scripts_ref.js |  354 ++++
 .../python/WebDisplayExtractor/styles.css     |  107 ++
 .../share/LArNoiseBursts_prodJO.py            |  140 ++
 .../share/LArNoiseBursts_topOptions.py        |  152 ++
 .../LArMonitoring/src/LArNoiseBursts.cxx      | 1597 +++++++++++++++++
 .../LArMonitoring/src/LArOddCellsMonTool.cxx  | 1564 ++++++++++++++++
 .../src/LArOnlineIDStrHelper.cxx              |  751 ++++++++
 .../src/components/LArMonitoring_entries.cxx  |   11 +
 .../src/components/LArMonitoring_load.cxx     |    4 +
 79 files changed, 17879 insertions(+)
 create mode 100755 LArCalorimeter/LArMonitoring/LArMonitoring/LArNoiseBursts.h
 create mode 100755 LArCalorimeter/LArMonitoring/LArMonitoring/LArOddCellsMonTool.h
 create mode 100755 LArCalorimeter/LArMonitoring/LArMonitoring/LArOnlineIDStrHelper.h
 create mode 100644 LArCalorimeter/LArMonitoring/LArMonitoring/LArOnlineIDStrHelper.icc
 create mode 100644 LArCalorimeter/LArMonitoring/LArMonitoring/SelectAllLArRawChannels.h
 create mode 100755 LArCalorimeter/LArMonitoring/cmt/requirements
 create mode 100755 LArCalorimeter/LArMonitoring/python/HVTripsDB/CheckHVStatus.py
 create mode 100755 LArCalorimeter/LArMonitoring/python/HVTripsDB/CheckHVStatus_daily.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/HVTripsDB/README
 create mode 100755 LArCalorimeter/LArMonitoring/python/HVTripsDB/appendDb.py
 create mode 100755 LArCalorimeter/LArMonitoring/python/HVTripsDB/createDB.py
 create mode 100755 LArCalorimeter/LArMonitoring/python/HVTripsDB/dump.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/HVTripsDB/favicon.ico
 create mode 100755 LArCalorimeter/LArMonitoring/python/HVTripsDB/index.bak
 create mode 100755 LArCalorimeter/LArMonitoring/python/HVTripsDB/index.py
 create mode 100755 LArCalorimeter/LArMonitoring/python/HVTripsDB/recreateDB.py
 create mode 100755 LArCalorimeter/LArMonitoring/python/HVTripsDB/recreateDetails.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/HVTripsDB/runHVChecks.py
 create mode 100755 LArCalorimeter/LArMonitoring/python/HVTripsDB/status.py
 create mode 100755 LArCalorimeter/LArMonitoring/python/HVTripsDB/styles.css
 create mode 100755 LArCalorimeter/LArMonitoring/python/HVTripsDB/trips.dat
 create mode 100755 LArCalorimeter/LArMonitoring/python/HVTripsDB/updateHVTripsDB.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/LADIeS/UPDTools.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/LADIeS/WeeklyReport.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/LADIeS/runList.py
 create mode 100755 LArCalorimeter/LArMonitoring/python/LArIdtranslator/create_LArBad.py
 create mode 100755 LArCalorimeter/LArMonitoring/python/LArIdtranslator/generate_db.sh
 create mode 100755 LArCalorimeter/LArMonitoring/python/LArIdtranslator/index.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/LArIdtranslator/scripts.js
 create mode 100644 LArCalorimeter/LArMonitoring/python/LArIdtranslator/styles.css
 create mode 100644 LArCalorimeter/LArMonitoring/python/LArMonitoringFlags.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/MiscLibraries/AtlasStyle.C
 create mode 100644 LArCalorimeter/LArMonitoring/python/MiscLibraries/AtlasStyle.h
 create mode 100755 LArCalorimeter/LArMonitoring/python/MiscLibraries/MyCOOLlib.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/MiscLibraries/gb.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/DataVisualizer.class
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/DataVisualizer.java
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/HVNode.class
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/HVNode.java
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/LumiBlock.class
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/LumiBlock.java
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/PlotDrawer.class
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/PlotDrawer.java
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/Trip.class
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/Trip.java
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/GenerateAllPlots.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/GenerateHVDatFiles.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/GeneratePlot.py
 create mode 120000 LArCalorimeter/LArMonitoring/python/TripVisualizer/HVHistoryPic
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/readme
 create mode 100755 LArCalorimeter/LArMonitoring/python/TripVisualizer/setup.sh
 create mode 100644 LArCalorimeter/LArMonitoring/python/TripVisualizer/updateDatFiles.py
 create mode 100755 LArCalorimeter/LArMonitoring/python/TripVisualizer/updateTripVisualizer.sh
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/WDE_documentation.txt
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/atlasblue.ico
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/GetATLASReadyLBs.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/GetNEventsLB.py
 create mode 100755 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/detStatus_query.py
 create mode 100755 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/index_cm.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/noisycells.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/print_rows.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/print_top.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/run_report.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/selection.py
 create mode 100755 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/index_cm.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/noisycells.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/print_rows.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/print_top.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/run_report.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/selection.py
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/scripts_ref.js
 create mode 100644 LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/styles.css
 create mode 100644 LArCalorimeter/LArMonitoring/share/LArNoiseBursts_prodJO.py
 create mode 100644 LArCalorimeter/LArMonitoring/share/LArNoiseBursts_topOptions.py
 create mode 100644 LArCalorimeter/LArMonitoring/src/LArNoiseBursts.cxx
 create mode 100755 LArCalorimeter/LArMonitoring/src/LArOddCellsMonTool.cxx
 create mode 100755 LArCalorimeter/LArMonitoring/src/LArOnlineIDStrHelper.cxx
 create mode 100755 LArCalorimeter/LArMonitoring/src/components/LArMonitoring_entries.cxx
 create mode 100755 LArCalorimeter/LArMonitoring/src/components/LArMonitoring_load.cxx

diff --git a/LArCalorimeter/LArMonitoring/LArMonitoring/LArNoiseBursts.h b/LArCalorimeter/LArMonitoring/LArMonitoring/LArNoiseBursts.h
new file mode 100755
index 00000000000..aebedd386cf
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/LArMonitoring/LArNoiseBursts.h
@@ -0,0 +1,322 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef LArNoiseBursts_H
+#define LArNoiseBursts_H
+
+#include "GaudiKernel/ToolHandle.h"
+#include "GaudiKernel/Algorithm.h"
+#include "GaudiKernel/ObjectVector.h"
+#include "GaudiKernel/AlgTool.h"
+
+#include "CLHEP/Units/SystemOfUnits.h"
+#include "StoreGate/StoreGateSvc.h"
+#include "GaudiKernel/ITHistSvc.h"
+#include "AnalysisTools/AnalysisTools.h"
+
+//LAr services:
+#include "Identifier/Range.h" 
+#include "Identifier/IdentifierHash.h"
+//#include "Identifier/HWIdentifier.h"
+//#include "LArElecCalib/ILArPedestal.h"
+#include "LArRecConditions/ILArBadChannelMasker.h"
+#include "CaloInterface/ICaloNoiseTool.h"
+#include "CaloInterface/ICalorimeterNoiseTool.h"
+#include "TrigAnalysisInterfaces/IBunchCrossingTool.h"
+#include "LArTools/LArCablingService.h"
+#include "LArTools/LArHVCablingTool.h"
+#include "LArIdentifier/LArOnlineID.h"
+#include "LArIdentifier/LArElectrodeID.h"
+//#include "CaloDetDescr/CaloDetDescrManager.h"
+#include "LArCondUtils/LArHVToolDB.h"
+#include "LArElecCalib/ILArHVTool.h"
+
+// Trigger
+#include "TrigDecisionTool/TrigDecisionTool.h"
+
+// Electrons
+#include "egammaEvent/ElectronContainer.h"
+
+//CBNT_UTILS
+//#include "CBNT_Utils/CBNT_AthenaAwareBase.h"
+//#include "AthenaBaseComps/AthAlgorithm.h"
+
+//STL:
+#include <string>
+#include <bitset>
+
+
+class LArOnlineID;
+class LArElectrodeID;
+class HWIdentifier;
+class LArOnlineIDStrHelper;
+class LArCablingService;
+class LArEM_ID;
+class LArHEC_ID;
+class LArFCAL_ID;
+class CaloIdManager;
+class CaloDetDescrManager;
+
+class TileTBID;
+class TgcIdHelper;
+
+class TTree;
+
+class LArHVLineID;
+
+class LArNoiseBursts : public Algorithm  {
+
+ public:
+
+   LArNoiseBursts(const std::string& name, ISvcLocator* pSvcLocator);
+   ~LArNoiseBursts();
+
+   //virtual StatusCode initializeBeforeEventLoop();
+   virtual StatusCode initialize();
+   virtual StatusCode finalize();
+   virtual StatusCode execute();
+   virtual StatusCode clear();
+
+ private:
+
+   /** methods called by execute() */
+   StatusCode doTrigger();
+   StatusCode doEventProperties();
+   StatusCode doMBTSTimming();    
+   StatusCode doLArNoiseBursts();  
+   StatusCode doPhysicsObjects();
+
+   //functions
+   int GetPartitionLayerIndex(const Identifier& id);
+   std::vector<int>* GetHVLines(const Identifier& id);
+     
+
+ private:
+
+   StoreGateSvc* m_detectorStore;
+   ITHistSvc * m_thistSvc;
+   StoreGateSvc* m_storeGate;
+    
+   TTree* m_tree;
+
+   /*Tools*/
+   ToolHandle<LArCablingService> m_LArCablingService;
+   ToolHandle<LArHVCablingTool> m_LArHVCablingTool;
+   ToolHandle<ICaloNoiseTool> m_calo_noise_tool;
+   ToolHandle<Trig::IBunchCrossingTool> m_bc_tool;
+
+   ToolHandle< Trig::TrigDecisionTool > m_trigDec;
+
+   /*services*/
+   const LArOnlineID* m_LArOnlineIDHelper;
+   const LArHVLineID* m_LArHVLineIDHelper;
+   const LArElectrodeID* m_LArElectrodeIDHelper;
+   const LArEM_ID* m_LArEM_IDHelper;
+   const LArFCAL_ID* m_LArFCAL_IDHelper;
+   const LArHEC_ID*  m_LArHEC_IDHelper;
+   const CaloIdManager*  m_caloIdMgr;
+   const CaloDetDescrManager* m_calodetdescrmgr;
+
+   // Electrons
+   std::string m_elecContainerName;
+
+   /*event cuts */
+   double m_sigmacut;
+   double m_MBTSThreshold;  
+   bool m_CosmicCaloStream;
+   int m_frontbunches;
+   bool m_keepOnlyCellID;
+
+   /*declaration of branches*/
+   int m_nb_sat;
+   int m_lowqfactor;
+   int m_medqfactor;
+   int m_hiqfactor;
+   long n_noisycell;
+   int  m_nt_larcellsize;
+   int  m_nt_cellsize;
+   int  m_nt_npv;
+   int  m_nt_npvtracks;
+   //int  m_nt_cellpartition;
+   //int  m_nt_runnumber;
+   int  m_nt_evtId;
+   int  m_nt_evtTime;
+   int  m_nt_evtTime_ns;
+   int  m_nt_lb;
+   int  m_nt_bcid;
+   int  m_nt_ntracks;
+   int  m_nt_isbcidFilled;
+   int  m_nt_isbcidInTrain;
+   std::vector<int> m_nt_isBunchesInFront;
+   int  m_nt_bunchtype;
+   float m_nt_bunchtime;
+   unsigned int m_nt_atlasready;
+   unsigned int m_nt_stablebeams;
+   std::vector<std::string> m_nt_streamTagName;
+   std::vector<std::string> m_nt_streamTagType;
+   short  m_nt_larnoisyro;
+   short  m_nt_larnoisyro_satOne;
+   short  m_nt_larnoisyro_satTwo;
+
+   //event info veto variables
+   short  m_nt_veto_mbts;
+   //short  m_nt_veto_indet;
+   short  m_nt_veto_bcm;
+   short  m_nt_veto_lucid;
+   short  m_nt_veto_pixel;
+   short  m_nt_veto_sct;
+   short  m_nt_veto_mbtstdHalo;
+   short  m_nt_veto_mbtstdCol;
+   short  m_nt_veto_lartdHalo;
+   short  m_nt_veto_lartdCol;
+   short  m_nt_veto_csctdHalo;
+   short  m_nt_veto_csctdCol;
+   short  m_nt_veto_bcmtHalo;
+   short  m_nt_veto_bcmtCol;
+   short  m_nt_veto_muontCol;
+   short  m_nt_veto_muontCosmic;
+
+   // LAr event bit info
+   bool m_nt_larflag_badFEBs;
+   bool m_nt_larflag_mediumSaturatedDQ;
+   bool m_nt_larflag_tightSaturatedDQ;
+   bool m_nt_larflag_noiseBurstVeto;
+   bool m_nt_larflag_dataCorrupted;
+   bool m_nt_larflag_dataCorruptedVeto;
+
+   // NoiseBurst trigger
+   bool m_nt_L1_J75;
+   bool m_nt_L1_J10_EMPTY;
+   bool m_nt_L1_J30_FIRSTEMPTY;
+   bool m_nt_L1_J30_EMPTY;
+   bool m_nt_L1_XE40;
+   bool m_nt_L1_XE50;
+   bool m_nt_L1_XE50_BGRP7;
+   bool m_nt_L1_XE70;
+
+   bool m_nt_EF_j165_u0uchad_LArNoiseBurst;
+   bool m_nt_EF_j30_u0uchad_empty_LArNoiseBurst;
+   bool m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurst;
+   bool m_nt_EF_j55_u0uchad_empty_LArNoiseBurst;
+   bool m_nt_EF_xe45_LArNoiseBurst;
+   bool m_nt_EF_xe55_LArNoiseBurst;
+   bool m_nt_EF_xe60_LArNoiseBurst;
+   bool m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurstT;
+   bool m_nt_EF_j100_u0uchad_LArNoiseBurstT;
+   bool m_nt_EF_j165_u0uchad_LArNoiseBurstT;
+   bool m_nt_EF_j130_u0uchad_LArNoiseBurstT;
+   bool m_nt_EF_j35_u0uchad_empty_LArNoiseBurst;
+   bool m_nt_EF_j35_u0uchad_firstempty_LArNoiseBurst;
+   bool m_nt_EF_j80_u0uchad_LArNoiseBurstT;
+   
+   //Pixel variables
+   int m_nt_nPixelhits;
+   int m_nt_nPixelclusters;
+
+   //SCT variables
+   int m_nt_nSCThits;
+   int m_nt_nSCTclusters;
+   int m_nt_nSCTspacepoints;
+   //TRT variables
+   int m_nt_nTRThits;
+
+   //TGC variables
+   int m_nt_nTGChits_a;
+   int m_nt_nTGChits_c;
+
+   //LAr Time variables
+   float m_nt_ECTimeDiff;
+   float m_nt_ECTimeAvg;
+   int  m_nt_nCellA;
+   int  m_nt_nCellC;
+
+   //MBTS Time variables   
+   float  m_nt_mbtstimediff; 
+   int    m_nt_nmbtscellA;
+   int    m_nt_nmbtscellC;
+   float  m_nt_mbtstimeavrg;
+
+   //Quantites for noisy cells
+   std::vector<float> m_nt_energycell;
+   std::vector<float> m_nt_qfactorcell;
+   std::vector<float> m_nt_phicell;
+   std::vector<float> m_nt_etacell;
+   std::vector<float> m_nt_signifcell;
+   float m_nt_noisycellpercent;
+   std::vector<short> m_nt_ft_noisy;
+   std::vector<short> m_nt_slot_noisy;
+   std::vector<short> m_nt_channel_noisy;
+   std::vector<short>    m_nt_cellpartlayerindex;
+   std::vector< unsigned int > m_nt_cellIdentifier;
+   std::vector<float> m_nt_noisycellpart;
+   std::vector<int> m_nt_nominalhv;
+   std::vector<int> m_nt_maximalhv;
+   std::vector<int> m_nt_noisycellHVphi;
+   std::vector<int> m_nt_noisycellHVeta;
+   std::vector<std::vector<short> > m_nt_samples;
+   std::vector<int> m_nt_gain;
+   std::vector<int> m_nt_isbadcell;
+
+   /*
+   std::vector<int> m_nt_isbarrel;
+   std::vector<int> m_nt_isendcap;
+   std::vector<int> m_nt_isfcal;
+   std::vector<int> m_nt_ishec;
+   */
+   
+   std::vector<int>  m_nt_partition;
+   std::vector<int>  m_nt_layer;
+   
+   //Quanties for the saturated cells
+   std::vector<int> m_nt_isbadcell_sat;
+   std::vector<int>  m_nt_barrelec_sat;
+   std::vector<int>  m_nt_posneg_sat;
+   std::vector<short>  m_nt_ft_sat;
+   std::vector<short>  m_nt_slot_sat;
+   std::vector<short>  m_nt_channel_sat;
+   std::vector<int>  m_nt_partition_sat;
+   std::vector<float> m_nt_energy_sat;
+   std::vector<float> m_nt_phicell_sat;
+   std::vector<float> m_nt_etacell_sat;
+   std::vector<int> m_nt_layer_sat;
+   std::vector<unsigned int> m_nt_cellIdentifier_sat;
+
+   ///ZDC quantities
+   int   m_nt_nzdcAside;
+   int   m_nt_nzdcCside;
+   float m_nt_zdcAsideenergy;
+   float m_nt_zdcCsideenergy;
+   float m_nt_zdctimediff;
+
+   //LUCID quantities
+   int m_nt_lucidA;
+   int m_nt_lucidAnBX;
+   int m_nt_lucidApBX;
+
+   int m_nt_lucidC;
+   int m_nt_lucidCnBX;
+   int m_nt_lucidCpBX;
+
+   int m_nt_lucidchannels;
+   int m_nt_lucidchannelsnBX;
+   int m_nt_lucidchannelspBX;
+
+   //electron variables
+   int   m_nt_el_n;
+   std::vector<float> m_nt_el_E;
+   std::vector<float> m_nt_el_Et;
+   std::vector<float> m_nt_el_eta;
+   std::vector<float> m_nt_el_phi;
+   std::vector<float> m_nt_el_cl_E;
+   std::vector<float> m_nt_el_cl_Et;
+   std::vector<float> m_nt_el_cl_eta;
+   std::vector<float> m_nt_el_cl_phi;
+   std::vector<int> m_nt_el_author;
+   std::vector<int> m_nt_el_loosePP;
+   std::vector<int> m_nt_el_mediumPP;
+   std::vector<int> m_nt_el_tightPP;
+};
+
+#endif // LArNoiseBursts_H
+
diff --git a/LArCalorimeter/LArMonitoring/LArMonitoring/LArOddCellsMonTool.h b/LArCalorimeter/LArMonitoring/LArMonitoring/LArOddCellsMonTool.h
new file mode 100755
index 00000000000..2098b7d2973
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/LArMonitoring/LArOddCellsMonTool.h
@@ -0,0 +1,236 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+ * @class LArOddCellsMonTool
+ * @author Benjamin Trocme <benjamin.trocme@lpsc.in2p3.fr>
+ *
+ */
+
+#ifndef LARODDCELLSMONTOOL_H
+#define LARODDCELLSMONTOOL_H
+
+#include "AthenaMonitoring/ManagedMonitorToolBase.h"
+#include "CaloIdentifier/CaloGain.h"
+#include "Identifier/HWIdentifier.h"
+#include "LArMonitoring/LArOnlineIDStrHelper.h"
+#include "LArElecCalib/ILArPedestal.h"
+#include "LArTools/LArCablingService.h"
+#include "LArRecConditions/ILArBadChannelMasker.h"
+
+#include <map>
+#include <string>
+#include <vector>
+#include <bitset>
+
+class LArEM_ID;
+class LArOnlineID;
+class TH1I_LW;
+class TH1D_LW;
+class TH2I_LW;
+class TH2F_LW;
+class LWHist;
+class LWHist2D;
+class TProfile2D_LW;
+class TTree;
+
+class LArOddCellsMonTool: public ManagedMonitorToolBase
+{
+ public:
+  LArOddCellsMonTool(const std::string& type, 
+                      const std::string& name,
+		      const IInterface* parent);
+
+  /** @brief Default destructor */
+  virtual ~LArOddCellsMonTool();
+
+  StatusCode initialize();
+
+  // Book general histograms
+  StatusCode bookHistograms();
+
+  // Called each event
+  StatusCode fillHistograms();
+  StatusCode checkHists(bool fromFinalize);
+  StatusCode procHistograms();
+
+ protected:
+
+  // services
+  const LArOnlineID* m_LArOnlineIDHelper;
+  const LArEM_ID* m_LArEM_IDHelper;
+  LArOnlineIDStrHelper* m_strHelper;
+  /** Handle to LArCablingService */
+  ToolHandle<LArCablingService> m_LArCablingService;
+   /** Handle to bad-channel mask */
+  ToolHandle<ILArBadChannelMasker> m_badChannelMask;
+  const DataHandle<ILArPedestal>  m_larPedestal;
+  
+ private:
+
+  struct summaryHistos {
+    summaryHistos();
+    TH2F_LW* YieldPerChan;
+    TH2I_LW* NbOddPerFEB;
+    TH2F_LW* YieldPerFEB;
+    TH2I_LW* NbOddSumPerFEB;
+    TH2F_LW* YieldSumPerFEB;
+    TH1D_LW* YieldPerEvent;
+    TH1D_LW* YieldPerEventCleanQ;
+    TH1I_LW* TimeBursty;
+    TH1I_LW* BurstStatus;
+    TH2I_LW* CellNbPerSlot;
+  };
+
+  class Simple2DSumHist;
+
+  struct feedthroughInfo {
+    bool bookedHists;
+    bool toBeMonitored;
+    int barrel_ec;
+    int pos_neg;
+    int feedthrough;
+    TProfile2D_LW* hReference;
+    TH2F_LW* hReferenceCool;
+    TH1D_LW* hReferenceCool_sum2;
+    TH2I_LW* NbOddPerChan;
+    TH2F_LW* YieldPerChan;
+    TH2I_LW* hIndivTimeDistrib;
+    Simple2DSumHist * hTempSumComput;
+  };
+
+  // initialize monitoring bookkeeping info
+  StatusCode initMonInfo();
+  // Summary histograms booking
+  void bookHistsPartition(summaryHistos& summary,std::string partitionName);
+  // book per feedthrough reference and odd cells histos
+  StatusCode bookPerFeedthrough(HWIdentifier feedthroughID, CaloGain::CaloGain gain);
+  // retrieve reference pedestal per feb
+  StatusCode retrievePedPerFeb(HWIdentifier febID, HWIdentifier feedthroughID, CaloGain::CaloGain gain);
+  // Copy yield from FT TH2 fo parition TH2
+  void copyChanYield(feedthroughInfo ftInfo);
+  // get the max slot number in the corresponding feedthrough - HEC:10  EMECStandard:13  EMECSpecial:15  FCAL:14  Barrel:14
+  int feedthroughSlotMax(HWIdentifier id);
+  // get gain string
+  std::string gain_str(CaloGain::CaloGain gain);
+  // Fill feedthrough summary histos
+  void fillFeedthroughHistos(HWIdentifier FTId,int slotNumber,int weight,bool cellCnt = false);
+
+  void fillYieldHistos(TH2I_LW* summaryHisto,TH2F_LW* statusHisto,TH2I_LW* cellCountingHisto = NULL);
+
+  void fillYieldPerEvent(summaryHistos& summaryPart,double yieldEvent,int typeOfBursty);
+
+  void fillSumPerFEBHistos(feedthroughInfo& ftInfo);
+
+  void defineAxisTitle(LWHist2D* hist,int typeH);
+
+  void deregisterHisto(LWHist* hist);
+
+// Data members related to job options property================================
+
+  // List used to restrict monitoring to certain feedthrough
+  std::vector<std::string> m_feedthroughNames;
+  // Key to retrieve pedestal ref from COOL
+  std::string m_larPedestalKey;
+  // Key to retrieve LArDigit
+  std::string m_LArDigitContainerKey;
+  // Monitor only gain per partition : [EM+FCAL;HEC]
+  std::vector < std::string> m_gainMonitored;
+  // m_sampleNumber contains the sample to be checked - If negative or greater than the nb of samples,all samples are accumulated
+  int m_sampleNumber;
+  // An event is said odd if m_oddnessThreshold times noise away from its pedestal
+  float m_oddnessThreshold;
+  // If m_posNeg = [-1,1,0], takes only odd events with digit [lower,higher,all] than pedestal reference
+  int m_posNeg;
+  // If the reference noise if outside [m_minimumRefNoise,m_maximumRefNoise], the channel is not monitored
+  std::vector<double> m_maximumRefNoise;
+  std::vector<double> m_minimumRefNoise;
+  // Threshold used on a partition basis to flag an event as bursty (and store it if activated)
+  float m_burstyThreshold;
+  float m_burstyThresholdQ;
+  // Activation of bad channels masking. Exact policy of masking defined in LArAllMonitoring
+  bool m_maskBadChannels;
+  // If m_coolRetrieval is set to false, the reference pedestal/noise are computed from the m_computePeds first events
+  bool m_coolRetrieval;
+  int m_computePeds;
+  // If useEvtCounter set to true, use the event counter to flag bursty event instead of evt id
+  bool m_useEvtCounter;
+  // Maximum time used in temporal distribution histogram of bursty events
+  int m_maxTimingHisto;
+  // If set to tree, store caracteristics of odd cells of bursty events
+  bool m_createTree;
+  // If set to true, switch off alg if physic mode + non zero dsp thresholds
+  bool m_monPhys;
+  // If set to true, also stores histograms of pedestal/noise (reference or computed ones)
+  bool m_storeRefs;
+  // If set to true; also stores histogram per FT (useless as priori as copied in partition TH2)
+  bool m_storePerFT;
+  // If set to true, perform monitoring per detailed endcap (i. EM + FCAL + HEC)
+  bool m_detailEndCap;
+  // Key to retrieve DSP thresholds (used to switch off algo if physic mode + non zero dsp thresholds)
+  std::string m_keyDSPThresholds;
+
+  std::vector<std::string> m_noise_streams;
+
+  float m_evtTime;
+
+
+  // Tree used to store odd cells characteristics of bursty events
+  TTree* m_tOdd;
+  int m_treeNbOfOdd;
+  int m_treeBarrelEc[60000];
+  int m_treePosNeg[60000];
+  int m_treeFT[60000];
+  int m_treeSlot[60000];
+  int m_treeChannel[60000];
+  int m_treeSample[60000];
+  int m_treeSampling[60000];
+  int m_treeRegion[60000];
+  int m_treeEta[60000];
+  int m_treePhi[60000];
+  float m_treeSignif[60000];
+  //Info on which partition is bursty
+  int m_treeBurstyPartition[10];
+  // Event counter incremented at each event read
+  int m_eventsCounter;
+  // EvtId retrieved from event info block
+  int m_evtId;
+  // Nb of samples (useful for normalization in determination of status)
+  int m_nbOfSamples;
+  // Nb of channel monitored per partition (sub partition of endcap also available) and in total
+  int m_nbMonitoredChan[10];
+  int m_nbMonitoredTotal;
+  // If any bursty partition is detected, set thie flag to true so save odd events in the tree.
+  bool m_eventToBeStored;
+  // If physic mode with non zero dsp thresholds, and m_monPhys = true, skip the monitoring
+  bool m_skipAlgo;
+  bool m_skipEvent;
+
+  // Basic histograms per feedthrough/gain to monitor odd cells
+  std::vector< std::map< CaloGain::CaloGain, feedthroughInfo> > m_feedthroughInfo;//TK: maps are things to avoid for performance reasons.
+  // m_febPedRetrieved[febHash] is true if the pedestals corresponding to this 
+  // FEB has been retrieved from the reference file and filled in the reference
+  // histogram in m_feedthroughInfo
+  std::vector< std::map< CaloGain::CaloGain, bool> > m_febPedRetrieved;//TK: maps are things to avoid for performance reasons.
+
+  // Summary of nb of monitored channels per partition
+  TH1I_LW* m_hMonitoredChan;
+  // Nb of odd cells per event vs time (evtid or event counter)
+  TH1I_LW* m_hTimeDistrib;
+  // Yield of odd cells per event
+  TH1D_LW* m_hOddEventsYield;
+  // Summary per partition of yield of odd events
+  summaryHistos m_barrelCSummary;
+  summaryHistos m_barrelASummary;
+  summaryHistos m_endcapCSummary;
+  summaryHistos m_endcapASummary;
+  summaryHistos m_emecCSummary;
+  summaryHistos m_emecASummary;
+  summaryHistos m_hecCSummary;
+  summaryHistos m_hecASummary;
+  summaryHistos m_fcalCSummary;
+  summaryHistos m_fcalASummary;
+};
+
+#endif
diff --git a/LArCalorimeter/LArMonitoring/LArMonitoring/LArOnlineIDStrHelper.h b/LArCalorimeter/LArMonitoring/LArMonitoring/LArOnlineIDStrHelper.h
new file mode 100755
index 00000000000..96ec064acf9
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/LArMonitoring/LArOnlineIDStrHelper.h
@@ -0,0 +1,184 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+ * @class LArOnlineIDStrHelper
+ * @author Michel Lefebvre <lefebvre@uvic.ca>
+ * @date 09-March-2006
+ * @brief Helper class to manipulate strings for LArOnlineID names
+ *
+ * Helper class to manipulate strings for LArOnlineID names:
+ * cryostatEnd, feedthroug, feb, channel, partition names
+ * Four different types of names are supported: see enum NameType below */
+
+#ifndef LARONLINEIDSTRHELPER_H
+#define LARONLINEIDSTRHELPER_H
+
+#include "Identifier/HWIdentifier.h"
+
+#include <vector>
+#include <string>
+#include <map>
+
+class LArOnlineID;
+class TAxis;
+class TH2;
+
+//NB: Some methods are templated to support both ROOT and LW hists
+
+
+class LArOnlineIDStrHelper
+{
+ public:
+  /** @brief enum of name types */
+  enum NameType {            //               example for feb id 38008000
+    DEFAULT            = 0,  // must be min
+    EXPERTS            = 1,  //               BarrelCFT09LFront0
+    EXPERTSCOMPACT     = 2,  //               EMC09LF0
+    LARONLINEID        = 3,  //               BarrelCFT00Slot02
+    LARONLINEIDCOMPACT = 4,  //               [4.4.0.0.0.2]
+    BEYONDLASTNAMETYPE = 5   // must be max
+  };
+
+  /** @brief constructructor */
+  LArOnlineIDStrHelper(const LArOnlineID* pLArOnlineIDHelper,
+                       NameType defaultNameType = EXPERTS);
+
+  /** @brief default destructor */
+  ~LArOnlineIDStrHelper();
+
+  /** @brief set default name type */
+  void setDefaultNameType(NameType defaultNameType);
+
+  /** @brief name type string */
+  std::string nameType_str(NameType nameType);
+
+  /** @brief get cryostatEnd name */
+  std::string cryostatEnd_str(HWIdentifier id,
+                              NameType nameType = DEFAULT);
+
+  /** @brief get feedthrough name, as BarrelCFT09L or BarrelCFT00*/
+  std::string feedthrough_str(HWIdentifier id,
+                              NameType nameType = DEFAULT,
+                              bool noSpaces = true);
+
+  /** @brief get feedthrough only name, as 09L or 00*/
+  std::string feedthroughOnly_str(HWIdentifier id,
+                                  NameType nameType = DEFAULT);
+
+  /** @brief get feb name */
+  std::string feb_str(HWIdentifier id,
+                      NameType nameType = DEFAULT,
+                      bool noSpaces = true);
+
+  /** @brief get feb only name, as Presampler, or Ps, or 01 */
+  std::string febOnly_str(HWIdentifier id,
+                          NameType nameType = DEFAULT);
+
+  /** @brief get channel name */
+  std::string channel_str(HWIdentifier id,
+                          NameType nameType = DEFAULT,
+                          bool noSpaces = true);
+
+  /** @brief get feedthrough HWId from feedthrough name (case insensitive)*/
+  HWIdentifier feedthrough_id(const std::string& feedthroughName);
+
+  /** @brief get feb HWId from feb name (case insensitive)*/
+  HWIdentifier feb_id(const std::string& febName);
+
+  /** @brief set the axis bin labels for a feedthrough axis*/
+  // labels are feedthrough expert names associated to the relavant feedthroughs
+  // works also for variable bin sizes
+  // possible detector strings (not case sensitive)
+  //  BARRELA, BARRELC, EMBA (EMA), EMBC (EMC)
+  //  ENDCAPA, ENDCAPC, EMECA (ECA), EMECC (ECC), HECA, HECC, FCALA, FCALC
+  void setAxisBinLabelsFeedthroughs(TAxis* axis,
+                                    const std::string& detector);
+
+  /** @brief set the axis bin labels for an all Febs feb axis*/
+  // labels are feedthrough expert names associated to the first relevant feb in a feedthrough
+  // works also for variable bin sizes
+  // possible detector strings (not case sensitive)
+  //  BARRELA, BARRELC, EMBA (EMA), EMBC (EMC)
+  //  ENDCAPA, ENDCAPC, EMECA (ECA), EMECC (ECC), HECA, HECC, FCALA, FCALC
+  template<class Taxis>
+  void setAxisBinLabelsAllFebs(Taxis* axis,
+                               const std::string& detector);
+
+  /** @brief set the axis bin labels for a feb axis*/
+  // labels are experts compact feb names for the desired feedthrough
+  // works also for variable bin sizes
+  template<class Taxis>
+  void setAxisBinLabelsFebs(Taxis* axis,
+                            HWIdentifier feedthroughID);
+
+
+  template<class THist2D>
+  StatusCode definePartitionSummProp(THist2D* hist,bool HWNaming = false);
+  template<class THist2D>
+  StatusCode definePartitionSummProp2(THist2D* hist,bool HWNaming = false);
+
+  /** @brief test function for this class */
+  void test();
+
+ private:
+
+  // preclude the use of the default constructor
+  LArOnlineIDStrHelper() {};
+
+  // fill feedthrough experts names vector
+  void fillFeedthroughExpertsNames();
+
+  // fill feb experts names vectors
+  void fillFebExpertsNames();
+
+  // fill feedthrough HWId map, keyed by feedthrough names (all upper case)
+  void fillFeedthroughHWIds();
+
+  // fill feb HWId map, keyed by feb names (all upper case)
+  void fillFebHWIds();
+
+  // set axis bin labels with feedthrough names
+  // common code for setAxisBinLabelsAllfebs and setAxisBinLabelsFeedthroughs
+  template<class Taxis>
+  void setAxisBinLabelsFeedthroughNames(Taxis* axis,
+                                        const std::string& detector,
+                                        bool allFebs = false);
+
+  // integer to string converter
+  // width <= 0 means no setw used and no leading zeros
+  std::string int_to_str(int n, int width = 0, bool leadingZeros = false);
+
+  // convert a string to an all upper case string
+  std::string str_to_upper(std::string stringToConvert);
+
+  //FindFixBin which works for both root and LW hists:
+  template<class Taxis>
+  int findFixBin(Taxis*,const double&) const;
+
+  // service
+  const LArOnlineID* m_LArOnlineIDHelper;
+
+  // keep track of default name type
+  NameType m_defaultNameType;
+
+  // feedthrough experts name string vector, indexed with feedthrough_hash
+  std::vector<std::string> m_feedthroughExpertsNames;      // as 09L
+
+  // feb experts name string vector, indexed with feb_hash
+  std::vector<std::string> m_febExpertsNames;
+  std::vector<std::string> m_febExpertsCompactNames;
+
+  // feedthrough HWId map, keyex with feedthrough names of all types
+  std::map<std::string, HWIdentifier> m_feedthroughHWIds;
+
+  // feb HWId map, keyex with feb names of all types
+  std::map<std::string, HWIdentifier> m_febHWIds;
+
+};
+
+#include "LArOnlineIDStrHelper.icc"
+
+#endif
+
diff --git a/LArCalorimeter/LArMonitoring/LArMonitoring/LArOnlineIDStrHelper.icc b/LArCalorimeter/LArMonitoring/LArMonitoring/LArOnlineIDStrHelper.icc
new file mode 100644
index 00000000000..33f8d78e417
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/LArMonitoring/LArOnlineIDStrHelper.icc
@@ -0,0 +1,419 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+
+#include "LArIdentifier/LArOnlineID.h"
+#include "TAxis.h"
+
+/*---------------------------------------------------------*/
+template<class THist2D>
+inline StatusCode 
+LArOnlineIDStrHelper::definePartitionSummProp(THist2D* hist,bool HWNaming)
+// Define the labels for a TH2 with FT on Y axis
+// The name of the histogram should contain the name of
+// the partition
+// Typically used for summary TH2 : (FTs) vs (slots) (1 bin per FEB)
+// Beware: bins start at 1, feedthroughs start at 0
+{
+  hist->SetMinimum(0);
+  hist->GetXaxis()->SetTitle("Slot");
+  if (HWNaming) hist->GetYaxis()->SetTitle("Half Crate");
+  else hist->GetYaxis()->SetTitle("Feedthrough"); 
+
+  const unsigned nx(hist->GetNbinsX());
+  for (unsigned ix = 1;ix <= nx;ix++) (hist->GetXaxis())->SetBinLabel(ix,Form("%d",ix));
+
+  if (HWNaming){
+  std::string hName = hist->GetName();
+  
+  if ( hName.find("BarrelA",0) != std::string::npos || 
+       hName.find("EMBA",0) != std::string::npos ){
+    int barrel_ec = 0;  // Barrel
+    int pos_neg = 1;    // A
+    for (int ft = 0; ft < 32; ++ft) {
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      std::string label = "I"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+      (hist->GetYaxis())->SetBinLabel(ft+1, label.c_str());
+    }
+  }
+
+  if ( hName.find("BarrelC",0) != std::string::npos || 
+       hName.find("EMBC",0) != std::string::npos ){
+    int barrel_ec = 0;  // Barrel
+    int pos_neg = 0;    // C
+    for (int ft = 0; ft < 32; ++ft) {
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      std::string label = "H"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+      (hist->GetYaxis())->SetBinLabel(ft+1, label.c_str());
+    }
+  }
+
+  if (hName.find("EndcapA",0) != std::string::npos || 
+      hName.find("EmecA",0) != std::string::npos ||
+      hName.find("EMECA",0) != std::string::npos ){
+    int barrel_ec = 1;  // Endcap
+    int pos_neg = 1;    // A
+    // select which feedthroughs to have labels for
+    int ftL[] = {0,1,4,5,6,7,8,11,12,15,16,19,20,23,24};  // 15 labels
+    for (int i = 0; i < 15; ++i) {
+      int ft = ftL[i];
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      std::string label = "A"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+      (hist->GetYaxis())->SetBinLabel(ft+1, label.c_str());
+    }
+  }
+
+  if (hName.find("HecA",0) != std::string::npos || 
+      hName.find("HECA",0) != std::string::npos){
+    int barrel_ec = 1;  // Endcap
+    int pos_neg = 1;    // A
+    // select which feedthroughs to have labels for
+    int ftL[] = {3,10,16,22};  // 4 labels
+    for (int i = 0; i < 4; ++i) {
+      int ft = ftL[i];
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      std::string label = "A"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+      (hist->GetYaxis())->SetBinLabel(ft+1, label.c_str());
+    }
+  }
+
+  if (hName.find("FcalA",0) != std::string::npos 
+      || hName.find("FCALA",0) != std::string::npos){
+    int barrel_ec = 1;  // Endcap
+    int pos_neg = 1;    // A
+    int ft = 6;         // FCal only feedthrough
+    HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+    std::string label = "A"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+    (hist->GetYaxis())->SetBinLabel(ft+1, label.c_str());
+  }
+
+  if (hName.find("EndcapC",0) != std::string::npos || 
+      hName.find("EmecC",0) != std::string::npos ||
+      hName.find("EMECC",0) != std::string::npos ){
+    int barrel_ec = 1;  // Endcap
+    int pos_neg = 0;    // C
+    // select which feedthroughs to have labels for
+    int ftL[] = {0,1,4,5,6,7,8,11,12,15,16,19,20,23,24};  // 15 labels
+    for (int i = 0; i < 15; ++i) {
+      int ft = ftL[i];
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      std::string label = "C"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+      (hist->GetYaxis())->SetBinLabel(ft+1, label.c_str());
+    }
+  }
+
+  if (hName.find("HecC",0) != std::string::npos || 
+      hName.find("HECC",0) != std::string::npos){
+    int barrel_ec = 1;  // Endcap
+    int pos_neg = 0;    // C
+    // select which feedthroughs to have labels for
+    int ftL[] = {3,10,16,22};  // 4 labels
+    for (int i = 0; i < 4; ++i) {
+      int ft = ftL[i];
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      std::string label = "C"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+      (hist->GetYaxis())->SetBinLabel(ft+1, label.c_str());
+    }
+  }
+
+  if (hName.find("FcalC",0) != std::string::npos ||
+      hName.find("FCALC",0) != std::string::npos){
+    int barrel_ec = 1;  // Endcap
+    int pos_neg = 0;    // C
+    int ft = 6;         // FCal only feedthrough
+    HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+    std::string label = "C"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+    (hist->GetYaxis())->SetBinLabel(ft+1, label.c_str());
+  }
+  }
+
+  (hist->GetYaxis())->SetLabelSize(0.045);
+  //Not supported in LWHists: (hist->GetYaxis())->SetTitleOffset(1.2);
+
+  return StatusCode::SUCCESS;
+}
+
+/*---------------------------------------------------------*/
+template<class THist2D>
+inline StatusCode 
+LArOnlineIDStrHelper::definePartitionSummProp2(THist2D* hist,bool HWNaming)
+// Define the labels for a TH2 with FT+FEB on X axis
+// The name of the histogram should contain the name of
+// the partition
+// Typically used for TH2 (All FEBs) vs (Channels) (1 bin per channel)
+// Both slots and bins start at 1
+{
+  hist->SetMinimum(0);
+  if (HWNaming) hist->GetXaxis()->SetTitle("Half Crate(+Slot increasing)");
+  else hist->GetXaxis()->SetTitle("Feedthrough(+Slot increasing)");
+  hist->GetYaxis()->SetTitle("Channel");
+
+  std::string hName = hist->GetName();
+  
+  if (hName.find("BarrelA",0) != std::string::npos ||
+      hName.find("EMBA",0) != std::string::npos ){
+    int barrel_ec = 0;  // Barrel
+    int pos_neg = 1;    // A
+    for (int ft = 0; ft < 32; ++ft) {
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      std::string label; 
+      if (HWNaming) label = "I"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+      else label = int_to_str(ft);
+      int bin = ft*14 + 1;  // feedthrough label on first slot of desired feedthroughs
+      (hist->GetXaxis())->SetBinLabel(bin, label.c_str());
+    }
+  }
+
+  if (hName.find("BarrelC",0) != std::string::npos ||
+      hName.find("EMBC",0) != std::string::npos ){
+    int barrel_ec = 0;  // Barrel
+    int pos_neg = 0;    // C
+    for (int ft = 0; ft < 32; ++ft) {
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      std::string label; 
+      if (HWNaming) label = "H"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+      else label = int_to_str(ft);
+      int bin = ft*14 + 1;  // feedthrough label on first slot of desired feedthroughs
+      (hist->GetXaxis())->SetBinLabel(bin, label.c_str());
+    }
+  }
+
+  if (hName.find("EndcapA",0) != std::string::npos || hName.find("EmecA",0) != std::string::npos
+      || hName.find("EMECA",0) != std::string::npos){
+    int barrel_ec = 1;  // Endcap
+    int pos_neg = 1;    // A
+    for (int ft = 0; ft < 25; ++ft) {
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      std::string label; 
+      if (HWNaming) label = "A"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+      else label = int_to_str(ft);
+      int bin = ft*15 + 1;  // feedthrough label on first slot of desired feedthroughs
+      (hist->GetXaxis())->SetBinLabel(bin, label.c_str());
+    }
+  }
+
+  if (hName.find("HecA",0) != std::string::npos || hName.find("HECA",0) != std::string::npos){
+    int barrel_ec = 1;  // Endcap
+    int pos_neg = 1;    // A
+    // select which feedthroughs to have labels for
+    int ftL[] = {3,10,16,22};  // 4 labels
+    for (int i = 0; i < 4; ++i) {
+      int ft = ftL[i];
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      std::string label; 
+      if (HWNaming) label = "A"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+      else label = int_to_str(ft);
+      int bin = ft*15 + 1;  // feedthrough label on first slot of desired feedthroughs
+      (hist->GetXaxis())->SetBinLabel(bin, label.c_str());
+    }
+  }
+
+  if (hName.find("FcalA",0) != std::string::npos){
+    int barrel_ec = 1;  // Endcap
+    int pos_neg = 1;    // A
+    int ft = 6;         // FCal only feedthrough
+    HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+    std::string label; 
+    if (HWNaming) label = "A"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+    else label = int_to_str(ft);
+    int bin = ft*15 + 1;  // feedthrough label on first slot of desired feedthroughs
+    (hist->GetXaxis())->SetBinLabel(bin, label.c_str());
+  }
+
+  if (hName.find("EndcapC",0) != std::string::npos || 
+      hName.find("EmecC",0) != std::string::npos ||
+      hName.find("EMECC",0)!= std::string::npos) {
+    int barrel_ec = 1;  // Endcap
+    int pos_neg = 0;    // C
+    for (int ft = 0; ft < 25; ++ft) {
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      std::string label; 
+      if (HWNaming) label = "C"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+      else label = int_to_str(ft);
+      int bin = ft*15 + 1;  // feedthrough label on first slot of desired feedthroughs
+      (hist->GetXaxis())->SetBinLabel(bin, label.c_str());
+    }
+  }
+
+  if (hName.find("HecC",0) != std::string::npos || hName.find("HECC",0)!= std::string::npos ){
+    int barrel_ec = 1;  // Endcap
+    int pos_neg = 0;    // C
+    // select which feedthroughs to have labels for
+    int ftL[] = {3,10,16,22};  // 4 labels
+    for (int i = 0; i < 4; ++i) {
+      int ft = ftL[i];
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      std::string label; 
+      if (HWNaming) label = "C"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+      else label = int_to_str(ft);
+      int bin = ft*15 + 1;  // feedthrough label on first slot of desired feedthroughs
+      (hist->GetXaxis())->SetBinLabel(bin, label.c_str());
+    }
+  }
+
+  if (hName.find("FcalC",0) != std::string::npos || hName.find("FCALC",0)!= std::string::npos ){
+    int barrel_ec = 1;  // Endcap
+    int pos_neg = 0;    // C
+    int ft = 6;         // FCal only feedthrough
+    HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+    std::string label; 
+    if (HWNaming) label = "C"+this->feedthroughOnly_str(feedthroughID, EXPERTS);
+    else label = int_to_str(ft);
+    int bin = ft*15 + 1;  // feedthrough label on first slot of desired feedthroughs
+    (hist->GetXaxis())->SetBinLabel(bin, label.c_str());
+  }
+
+  (hist->GetXaxis())->SetLabelSize(0.04);
+  //Not supported in LWHists: (hist->GetXaxis())->SetTitleOffset(1.5);
+
+  return StatusCode::SUCCESS;
+}
+
+/*---------------------------------------------------------*/
+/*---------------------------------------------------------*/
+template<class Taxis>
+inline void
+LArOnlineIDStrHelper::setAxisBinLabelsFebs(Taxis* axis, HWIdentifier feedthroughID)
+{
+  // labels are experts compact feb names for the desired feedthrough
+
+  int nSlots = (m_LArOnlineIDHelper->isEmBarrelOnline(feedthroughID)) ? 14 : 15;
+  int nBins = axis->GetNbins();
+  if (nSlots > nBins) nSlots = nBins;
+  bool changeAxis = false;
+
+  // loop over all febs and look for matching feedthrough
+  // slow, but ensures blank fields for unused slots
+  for (std::vector<HWIdentifier>::const_iterator p = m_LArOnlineIDHelper->feb_begin(); 
+       p != m_LArOnlineIDHelper->feb_end(); ++p) {
+    HWIdentifier febID = HWIdentifier(*p);
+    if (m_LArOnlineIDHelper->feedthrough_Id(febID) == feedthroughID) {
+      int slot = m_LArOnlineIDHelper->slot(febID);
+      if (slot <= nSlots) {
+        std::string label = this->febOnly_str(febID, EXPERTSCOMPACT);
+        axis->SetBinLabel(slot, label.c_str());  // slots and bins start at 1
+        changeAxis = true;
+      }
+    }
+  }
+
+  if (changeAxis) {
+    axis->SetLabelSize(0.045);
+    //Not supported in LWHists: axis->SetTitleOffset(1.2);
+  }
+
+}
+
+/*---------------------------------------------------------*/
+template<class Taxis>
+inline void
+LArOnlineIDStrHelper::setAxisBinLabelsAllFebs(Taxis* axis, const std::string& detector)
+{
+  // set the axis bin labels of an all febs axis with feedthrough names
+  // see setAxisBinLabelsFeedthroughNames
+
+  this->setAxisBinLabelsFeedthroughNames(axis, detector, true);
+}
+
+/*---------------------------------------------------------*/
+template<class Taxis>
+inline int LArOnlineIDStrHelper::findFixBin(Taxis*a,const double& x) const { return a->FindBin(x); }//LWHists never rebin (unless root backed)
+template<>
+inline int LArOnlineIDStrHelper::findFixBin(TAxis*a,const double& x) const { return a->FindFixBin(x); }//Root specialisation
+
+/*---------------------------------------------------------*/
+template<class Taxis>
+inline void
+LArOnlineIDStrHelper::setAxisBinLabelsFeedthroughNames(Taxis* axis, const std::string& detector, bool allFebs)
+{
+  // set the axis bin labels with feedthrough names
+  // for feedthrough axis: labels are feedthrough expert names associated to the relavant feedthroughs
+  // for all febs axis: labels are feedthrough expert names associated to the first relevant feb in a feedthrough
+  // works also for variable bin sizes
+  // possible detector strings (not case sensitive)
+  //  BARRELA, BARRELC, EMBA (EMA), EMBC (EMC)
+  //  ENDCAPA, ENDCAPC, EMECA (ECA), EMECC (ECC), HECA, HECC, FCALA, FCALC
+
+  int nBins = axis->GetNbins();
+  std::string detStr = this->str_to_upper(detector);
+  int barrel_ec = -1 ; // invalid value
+
+  if (detStr == "BARRELA" || detStr == "EMBA" || detStr == "EMA" || 
+      detStr == "BARRELC" || detStr == "EMBC" || detStr == "EMC") {
+    barrel_ec = 0;  // Barrel
+    int pos_neg = (detStr == "BARRELA" || detStr == "EMBA" || detStr == "EMA") ? 1 : 0; // 0=C, 1=A
+    for (int ft = 0; ft < 32; ++ft) {
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      int x = (allFebs) ? ft*14 + 1 : ft; // allFebs: feedthrough label on first slot of desired feedthroughs
+      int bin = findFixBin(axis,x);
+      if (bin > 0 && bin <= nBins) {
+	std::string label = this->feedthroughOnly_str(feedthroughID, m_defaultNameType);
+	axis->SetBinLabel(bin, label.c_str());
+      }
+    }
+  } else if (detStr == "ENDCAPA" || detStr == "ENDCAPC") {
+    barrel_ec = 1;  // Endcap
+    int pos_neg = (detStr == "ENDCAPA") ? 1 : 0; // 0=C, 1=A
+    for (int ft = 0; ft < 25; ++ft) {
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      int x = (allFebs) ? ft*15 + 1 : ft; // allFebs: feedthrough label on first slot of desired feedthroughs
+      int bin = findFixBin(axis,x);
+      if (bin > 0 && bin <= nBins) {
+        std::string label = this->feedthroughOnly_str(feedthroughID, m_defaultNameType);
+        axis->SetBinLabel(bin, label.c_str());
+      }
+    }
+  } else if (detStr == "EMECA" || detStr == "ECA" || 
+             detStr == "EMECC" || detStr == "ECC") {
+    barrel_ec = 1;  // Endcap
+    int pos_neg = (detStr == "EMECA" || detStr == "ECA") ? 1 : 0; // 0=C, 1=A
+    for (int ft = 0; ft < 25; ++ft) {
+      // select which feedthroughs to have labels for
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      // emec standard or emec special or HEC feedthrough
+      // the first slot of all these feedthroughs is an EMEC slot
+      if (m_LArOnlineIDHelper->isEmEndcapOnline(feedthroughID) || m_LArOnlineIDHelper->isHecOnline(feedthroughID)) {   
+        int x = (allFebs) ? ft*15 + 1 : ft; // allFebs: feedthrough label on first slot of desired feedthroughs
+        int bin = findFixBin(axis,x);
+        if (bin > 0 && bin <= nBins) {
+          std::string label = this->feedthroughOnly_str(feedthroughID, m_defaultNameType);
+          axis->SetBinLabel(bin, label.c_str());
+        }
+      }
+    }
+  } else if (detStr == "HECA" || detStr == "HECC") {
+    barrel_ec = 1;  // Endcap
+    int pos_neg = (detStr == "HECA") ? 1 : 0; // 0=C, 1=A
+    for (int ft = 0; ft < 25; ++ft) {
+      // select which feedthroughs to have labels for
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+      // only select HEC feedthroughs
+      if (m_LArOnlineIDHelper->isHecOnline(feedthroughID)) {
+        int x = (allFebs) ? ft*15 + 5 : ft; // allFebs: fifth slot of HEC feedthtoughs is first HEC feb
+        int bin = findFixBin(axis,x);
+        if (bin > 0 && bin <= nBins) {
+          std::string label = this->feedthroughOnly_str(feedthroughID, m_defaultNameType);
+          axis->SetBinLabel(bin, label.c_str());
+        }
+      }
+    }
+  } else if (detStr == "FCALA" || detStr == "FCALC") {
+    barrel_ec = 1;  // Endcap
+    int pos_neg = (detStr == "FCALA") ? 1 : 0; // 0=C, 1=A
+    int ft = 6;         // FCal only feedthrough
+    HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(barrel_ec, pos_neg, ft);
+    int x = (allFebs) ? ft*15 + 1 : ft; // allFebs: feedthrough label on first slot of desired feedthroughs
+    int bin = findFixBin(axis,x);
+    if (bin > 0 && bin <= nBins) {
+      std::string label = this->feedthroughOnly_str(feedthroughID, m_defaultNameType);
+      axis->SetBinLabel(bin, label.c_str());
+    }
+  }
+
+  if (barrel_ec >= 0) {
+    axis->SetLabelSize(0.045);
+    //axis->SetTitleOffset(1.2);
+  }
+
+}
diff --git a/LArCalorimeter/LArMonitoring/LArMonitoring/SelectAllLArRawChannels.h b/LArCalorimeter/LArMonitoring/LArMonitoring/SelectAllLArRawChannels.h
new file mode 100644
index 00000000000..0a04abe8040
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/LArMonitoring/SelectAllLArRawChannels.h
@@ -0,0 +1,47 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+//Dear emacs, this is -*-c++-*-
+
+
+//This construct is a TEMORARY solution to allow the clients of LArRawChannel to compile 
+//in 13.X.Y as well as in 14.0.0 despite of the schema evolution of LArRawChannelContainer
+//This file should go away as soon as the migration towards Rel 14 is finsihed.
+
+#ifndef LARMONTOOLS_SELECTALLLARRAWCHANNELS_H
+#define LARMONTOOLS_SELECTALLLARRAWCHANNELS_H
+
+#include "LArRawEvent/LArRawChannelContainer.h"
+
+#ifdef LARRAWCHANNELCONTAINER_IS_NOT_IDENTIFIABLE
+
+class SelectAllLArRawChannels {
+ public:
+  SelectAllLArRawChannels(const LArRawChannelContainer* rc) : m_container(rc) {}
+
+  class const_iterator : public LArRawChannelContainer::const_iterator {
+  public:
+    const_iterator() : LArRawChannelContainer::const_iterator() {}
+    const_iterator(LArRawChannelContainer::const_iterator it) : LArRawChannelContainer::const_iterator(it) {}
+    const LArRawChannel* operator*() {return &(LArRawChannelContainer::const_iterator::operator*());}
+    const LArRawChannel operator->() {return (LArRawChannelContainer::const_iterator::operator*());}
+  };
+
+  const_iterator begin() 
+    { return const_iterator(m_container->begin()); }
+  
+  const_iterator end() 
+    { return const_iterator(m_container->end()); }
+
+ private:
+  const LArRawChannelContainer* m_container;
+
+};
+#else
+
+#include "EventContainers/SelectAllObject.h" 
+typedef SelectAllObject<LArRawChannelContainer> SelectAllLArRawChannels; 
+
+#endif //LARRAWCHANNELCONTAINER_IS_NOT_IDENTIFIABLE
+#endif //LARMONTOOLS_SELECTALLLARRAWCHANNELS_H
diff --git a/LArCalorimeter/LArMonitoring/cmt/requirements b/LArCalorimeter/LArMonitoring/cmt/requirements
new file mode 100755
index 00000000000..4099f9cdc59
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/cmt/requirements
@@ -0,0 +1,62 @@
+package LArMonitoring
+
+author Rob McPherson <Robert.McPherson@cern.ch>
+
+use AtlasPolicy         AtlasPolicy-*
+use GaudiInterface      GaudiInterface*        External
+use StoreGate           StoreGate-*            Control
+use AtlasROOT           AtlasROOT-*            External
+
+use AthenaMonitoring    AthenaMonitoring-* Control
+
+use EventContainers     EventContainers-*      Event
+
+use LArElecCalib        LArElecCalib-*         LArCalorimeter
+use LArIdentifier       LArIdentifier-*        LArCalorimeter
+use LArRawEvent         LArRawEvent-*          LArCalorimeter
+use LArTools            LArTools-*             LArCalorimeter
+use LArRecConditions    LArRecConditions-*     LArCalorimeter
+use LArCondUtils        LArCondUtils-*         LArCalorimeter
+
+use CaloIdentifier      CaloIdentifier-*       Calorimeter
+use CaloInterface       CaloInterface-*        Calorimeter
+use Identifier          Identifier-*           DetectorDescription
+
+use AnalysisTools       AnalysisTools-*        PhysicsAnalysis/AnalysisCommon
+
+
+use TrigDecisionTool TrigDecisionTool-* Trigger/TrigAnalysis
+use egammaEvent         egammaEvent-*           Reconstruction/egamma
+
+use TrigAnalysisInterfaces TrigAnalysisInterfaces-* Trigger/TrigAnalysis
+use AtlasCLHEP	        AtlasCLHEP-*            External
+
+private
+use CaloEvent           CaloEvent-*            Calorimeter
+use CaloDetDescr        CaloDetDescr-*         Calorimeter
+use xAODEventInfo       xAODEventInfo-*        Event/xAOD
+end_private
+
+
+apply_pattern declare_python_modules files="*.py"
+apply_pattern declare_joboptions files="*.txt *.py"
+
+library LArMonitoring *.cxx -s=components *.cxx
+apply_pattern component_library
+
+
+private
+use AtlasCLHEP           AtlasCLHEP-*           External
+use AtlasBoost           AtlasBoost-*           External
+use CxxUtils             CxxUtils-*             Control
+use LWHists              LWHists-*              Tools
+use PathResolver         PathResolver-*         Tools
+use CaloDetDescr         CaloDetDescr-*         Calorimeter
+use LArRawConditions     LArRawConditions-*     LArCalorimeter
+use LArRecEvent          LArRecEvent-*          LArCalorimeter
+use AthenaPoolUtilities  AthenaPoolUtilities-*  Database/AthenaPOOL
+use LArHV                LArHV-*                LArCalorimeter/LArGeoModel
+use LArReadoutGeometry   LArReadoutGeometry-*   LArCalorimeter/LArGeoModel
+use NavFourMom	         NavFourMom-*           Event
+use Particle             Particle-*	        Reconstruction
+use VxVertex            VxVertex-*             Tracking/TrkEvent
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/CheckHVStatus.py b/LArCalorimeter/LArMonitoring/python/HVTripsDB/CheckHVStatus.py
new file mode 100755
index 00000000000..0fc7a6b502c
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/CheckHVStatus.py
@@ -0,0 +1,162 @@
+#!/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# CheckHVStatus.py
+# Script to return the HV status and additonal info from COOL
+
+import os,sys
+from optparse import OptionParser
+import time
+from time import localtime
+from calendar import timegm
+import math
+
+outputList = {}
+
+def PrintHVInfo(hvline,tmstmp,folderName):
+    from PyCool import cool
+    outputList["voltage"] = []
+    outputList["current"] = []
+    outputList["status"] = []
+    outputList["time"] = []
+    #from time import asctime,localtime
+    dbSvc = cool.DatabaseSvcFactory.databaseService()
+    db=dbSvc.openDatabase("oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_DCS;dbname=COMP200")
+    folder=db.getFolder(folderName)
+    range=3*60*60*1e9 # 1 day in ns
+    t1=long(tmstmp-range)
+    t2=long(tmstmp+range)
+    itr=folder.browseObjects(t1,t2,cool.ChannelSelection(hvline))
+    while itr.goToNext():
+        obj=itr.currentRef()
+        pl=obj.payload()
+        time_out = time.strftime("%Y-%m-%d:%H:%M:%S",localtime(obj.since()/1e9))
+        #print '{0:.2f}  {1:5d}  {2:23s}'.format(voltage,status,time_out)
+        outputList["voltage"].append(pl["R_VMEAS"])
+        outputList["current"].append(pl["R_IMEAS"])
+        outputList["status"].append(pl["R_STAT"])
+        outputList["time"].append(time_out)
+    itr.close()
+    db.closeDatabase()
+    return
+
+def GetCOOLInfo(folderName,dbName,channel,tmstmp,params):
+    from PyCool import cool
+    dbSvc = cool.DatabaseSvcFactory.databaseService()
+    db=dbSvc.openDatabase(dbName)
+    folder=db.getFolder(folderName)
+    range=0.5*60*60*1e9 # 1 day in ns
+    chanList = []
+
+    if type(channel)==type(int()):
+        chanList.append(channel)
+    elif type(channel)==type(list()):
+        chanList = channel
+    else:
+        print channel," should be a list or an integer"
+        sys.exit(-1)
+    
+    for p in params:
+        for ch in chanList:
+            outputList[p+str(ch)]=[]
+    for t in tmstmp:
+        t1=long(t-range)
+        t2=long(t+range)
+        for ch in chanList:
+            itr=folder.browseObjects(t1,t2,cool.ChannelSelection(ch))
+            infoFound=False
+            while itr.goToNext():
+                obj=itr.currentRef()
+                if obj.until()>t:
+                    pl=obj.payload()
+                    for p in params:
+                        outputList[p+str(ch)].append(pl[p])
+                        infoFound=True
+                    break
+            itr.close()
+            if infoFound==False:
+                for p in params:
+                    outputList[p+str(ch)].append(0)
+    db.closeDatabase()
+    return
+
+                
+def ConvertToUTC(ts_in):
+    return time.gmtime(time.mktime(time.strptime(ts_in,"%Y-%m-%d:%H:%M:%S")))
+
+
+if __name__=='__main__':
+    if (os.system('which AtlCoolCopy.exe  2>/dev/null 1>/dev/null')!=0):
+        print "Cannot find AtlCoolCopy.exe - need offline release setup"
+        sys.exit(-1)
+    try:
+        from PyCool import cool
+    except Exception, e:
+        print e
+        print "ERROR: Can't import PyCool module, wrong setup?"
+        sys.exit(-1)
+
+    parser=OptionParser()
+    (options,args)=parser.parse_args()
+    if len(args)!=2:
+        print "ERROR: you must provide hvline timestamp (local time):\n eg. ./CheckHVStatus.py 161014 2011-03-23:01:12:54"
+        sys.exit(-1)
+    hv = int(args[0])
+    #print hv
+
+    #print args[1]
+    ts = ConvertToUTC(args[1])
+    #print time.strftime("%Y-%m-%d:%H:%M:%S",ts),"UTC"
+    
+    TimeStamp=int(timegm(ts))*1000000000L
+
+    PrintHVInfo(hv,TimeStamp,"/LAR/DCS/HV/BARREl/I16")
+    if len(outputList["time"])==0:
+        PrintHVInfo(hv,TimeStamp,"/LAR/DCS/HV/BARREL/I8")
+
+    ts_list = []
+    for it in outputList["time"]:
+        ts_list.append(int(timegm(ConvertToUTC(it)))*1000000000L)
+
+    GetCOOLInfo("/TRIGGER/LUMI/LBTIME","oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200",0,ts_list,["Run","LumiBlock"])
+    GetCOOLInfo("/LHC/DCS/FILLSTATE","oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_DCS;dbname=COMP200",1,ts_list,["StableBeams","FillNumber","NumBunchColl"])
+    GetCOOLInfo("/EXT/DCS/MAGNETS/SENSORDATA","oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_DCS;dbname=COMP200",[1,3],ts_list,["value"])
+
+    for s,solc in enumerate(outputList["value1"]):
+        if abs(solc-7730.) < 10:
+            outputList["value1"][s] = "ON"
+        elif abs(solc-0.) < 10:
+            outputList["value1"][s] = "OFF"
+        else:
+            outputList["value1"][s] = "RAMP"
+
+    for s,torc in enumerate(outputList["value3"]):
+        if abs(torc-20400.) < 10:
+            outputList["value3"][s] = "ON"
+        elif abs(torc-0.) < 10:
+            outputList["value3"][s] = "OFF"
+        else:
+            outputList["value3"][s] = "RAMP"
+
+    print "\nInformation for HV line",hv,"\n"
+    print "      Date/Time       Voltage     Current   Status     Run       LB  StableBeams  Fill  #CollBunches  Solenoid  Toroid"
+    for i,v in enumerate(outputList["voltage"]):
+        print "%19s" % (outputList["time"][i]),
+        print " ",
+        print ('{0:.2f}'.format(v)).rjust(7),
+        print "  ",
+        print ('{0:.3f}'.format(outputList["current"][i])).rjust(7),
+        print "  ",
+        print ('{0:5d}'.format(outputList["status"][i])).rjust(5),
+        print "  ",
+        print ('{0:5d}'.format(outputList["Run0"][i])).rjust(6),
+        print " ",
+        print ('{0:5d}'.format(outputList["LumiBlock0"][i])).rjust(4),
+        print "     ",("N","Y")[outputList["StableBeams1"][i]],
+        print "    ",
+        print ('{0:5d}'.format(outputList["FillNumber1"][i])).rjust(5),
+        print "  ",
+        print ('{0:5d}'.format(outputList["NumBunchColl1"][i])).rjust(4),
+        print "      ",outputList["value1"][i].rjust(4),
+        print "   ",outputList["value3"][i].rjust(4)
+
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/CheckHVStatus_daily.py b/LArCalorimeter/LArMonitoring/python/HVTripsDB/CheckHVStatus_daily.py
new file mode 100755
index 00000000000..3de13c097b5
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/CheckHVStatus_daily.py
@@ -0,0 +1,358 @@
+#!/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# CheckHVStatus_daily.py
+# Script to return the HV status and additonal info from COOL
+
+import os,sys
+from optparse import OptionParser
+import time
+from time import localtime
+from calendar import timegm
+import cPickle
+
+def printStatus(stat):
+
+    if stat & 0x400:
+        result="Channel ON"
+    else:
+        result="Channel OFF"
+    
+    if stat & 1:
+        result+= " Current Trip"
+    if stat & 2:
+        result+= " Sum error"
+    if stat & 0x200:
+        result+= " Input error"
+    if stat & 0x800:
+        result+=" Ramping"
+    if stat & 0x1000:
+        result+=" Emergency stop"
+    if stat & 0x2000:
+        result+=" Kill enable"
+    if stat & 0x4000:
+        result+= " Current Limit Error"
+    if stat & 0x8000:
+        result+= " Voltage Limit Error"
+    return result
+
+
+def isAllOk(stat):
+    #Ignore kill-enable bit, after that must be "channel on" and nothing else
+    #return (stat & 0xffffdfff) == 0x400 
+    return (stat & 0xde81)==0x400 #ignores all undefined bits
+
+def isOff(stat):
+    return (stat & 0x400)==0
+
+def isRamp(stat):
+    return (stat & 0x800)!=0
+
+def isRampUp(stat):
+    # ramp bit set, no current or voltage limit error, channel on
+    return ((stat & 0x800)!=0 and (stat & 0xD000)==0 and (stat & 0x400)!=0)
+
+def isStableZero(stat,v,i):
+    return (not isRamp(stat) and v<50 and i<0.50)
+
+def findLArHVTrips(folderName,t1,t2,lbtimes=None):
+
+    dbSvc = cool.DatabaseSvcFactory.databaseService()
+    db=dbSvc.openDatabase("oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_DCS;dbname=COMP200")
+    
+    allTrips={}
+
+    tripCount = int(0)
+
+    if not db.existsFolder(folderName):
+        print "ERROR: Folder",folderName,"does not exist"
+        return None
+    
+    f=db.getFolder(folderName)
+
+    print "Checking",folderName
+
+    #lastVoltage=dict()
+    #lastStat=dict()
+
+    offMap=dict()
+
+    tripped=set()
+    rampingUp=set()
+    stablezero=set()
+
+    itr=f.browseObjects(cool.ValidityKey(t1),cool.ValidityKey(t2),
+                        cool.ChannelSelection.all())
+
+    prev=0
+
+    while itr.goToNext():
+        obj=itr.currentRef()
+        chid=obj.channelId();
+        pl=obj.payload()
+        stat=pl["R_STAT"]
+        v=pl["R_VMEAS"]
+        i=pl["R_IMEAS"]
+
+        #if chid==286013:
+        #    print obj.payload(),prev.payload()
+
+        if not offMap.has_key(chid):
+            offMap[chid]=isOff(stat)
+
+        if offMap[chid]==True:
+            if not isOff(stat):
+                print "Line",chid," was OFF but is now ON"
+            continue
+
+        ##if isOff(stat): continue #Ignore channels that are switched off
+
+        if not isAllOk(stat):
+
+            if chid in tripped:
+                if isRampUp(stat):
+                    if not chid in rampingUp:
+                        rampingUp.add(chid)
+                        rampStartTime = time.strftime("%Y-%m-%d:%H:%M:%S",localtime(obj.since()/1e9))
+                        allTrips[chid][len(allTrips[chid])-1][3] = rampStartTime
+
+                if chid in rampingUp:
+                    if not isRampUp(stat):
+                        rampingUp.remove(chid)
+
+                if chid in stablezero:
+                    if not isStableZero(stat,v,i):
+                        stablezero.remove(chid)
+                else:
+                    if isStableZero(stat,v,i):
+                        stablezero.add(chid)
+                        stableZeroTime = time.strftime("%Y-%m-%d:%H:%M:%S",localtime(obj.since()/1e9))
+                        allTrips[chid][len(allTrips[chid])-1][2] = stableZeroTime
+            
+            if chid not in tripped:
+                #if prev and abs(obj.payload()["R_VMEAS"]-prev.payload()["R_VMEAS"])>10.:
+                if prev:
+                    tripCount += 1
+                    #print obj.payload(),prev.payload()
+                    #print "\nTrip: ",eventInfo(obj,stat,v,lbtimes)
+                    tripTime = time.strftime("%Y-%m-%d:%H:%M:%S",localtime(obj.since()/1e9))
+                    #print obj.channelId(),tripTime
+                    tripped.add(chid)
+                    if chid not in allTrips.keys():
+                        allTrips[chid] = []
+                    allTrips[chid].append([tripTime,"none","none","none"])
+
+        else: #Not tripped
+            if chid in tripped:
+                #print "Recovered: ",eventInfo(obj,stat,v,lbtimes)
+                tripped.remove(chid)
+                recoTime = time.strftime("%Y-%m-%d:%H:%M:%S",localtime(obj.since()/1e9))
+                #print obj.channelId(),recoTime
+                allTrips[chid][len(allTrips[chid])-1][1] = recoTime
+
+                if chid in rampingUp: rampingUp.remove(chid)
+                if chid in stablezero: stablezero.remove(chid)
+
+
+        prev=obj
+
+    print "Found",tripCount,"hv trips"
+    itr.close()
+    return allTrips
+
+
+def GetCOOLInfo(folderName,dbName,channel,tmstmp,params):
+    from PyCool import cool
+    dbSvc = cool.DatabaseSvcFactory.databaseService()
+    db=dbSvc.openDatabase(dbName)
+    folder=db.getFolder(folderName)
+    range=0.5*60*60*1e9 # 1 day in ns
+
+    coolInfoDict = {}
+
+    chanList = []
+    tmstmpList = []
+
+    if type(channel)==type(int()):
+        chanList.append(channel)
+    elif type(channel)==type(list()):
+        chanList = channel
+    else:
+        print channel," should be a list or an integer"
+        sys.exit(-1)
+
+    if type(tmstmp)==type(long()):
+        tmstmpList.append(tmstmp)
+    elif type(tmstmp)==type(list()):
+        tmstmpList = tmstmp
+    else:
+        print tmstmp," should be a list or a long"
+        sys.exit(-1)
+
+##     for p in params:
+##         for ch in chanList:
+##             coolInfoDict[p+str(ch)]=[]
+    for t in tmstmpList:
+        t1=long(t-range)
+        t2=long(t+range)
+        for ch in chanList:
+            itr=folder.browseObjects(t1,t2,cool.ChannelSelection(ch))
+            infoFound=False
+            while itr.goToNext():
+                obj=itr.currentRef()
+                if obj.until()>t:
+                    pl=obj.payload()
+                    for p in params:
+                        coolInfoDict[p+str(ch)] = pl[p]
+                        infoFound=True
+                    break
+            itr.close()
+            if infoFound==False:
+                for p in params:
+                    coolInfoDict[p+str(ch)] = 0
+    db.closeDatabase()
+    return coolInfoDict
+
+def ConvertToUTC(ts_in):
+    return time.gmtime(time.mktime(time.strptime(ts_in,"%Y-%m-%d:%H:%M:%S")))
+
+
+if __name__=='__main__':
+    if (os.system('which AtlCoolCopy.exe  2>/dev/null 1>/dev/null')!=0):
+        print "Cannot find AtlCoolCopy.exe - need offline release setup"
+        sys.exit(-1)
+    try:
+        from PyCool import cool
+    except Exception, e:
+        print e
+        print "ERROR: Can't import PyCool module, wrong setup?"
+        sys.exit(-1)
+
+    parser=OptionParser()
+    (options,args)=parser.parse_args()
+    if len(args)==1:
+        ts = ConvertToUTC(args[0])
+    else:
+        now = time.strftime("%Y-%m-%d:%H:%M:%S",(localtime(time.time())))
+        print "no timestamp provided; using now:",now
+        ts = ConvertToUTC(now)
+
+    #print timegm(ts),timegm(ts) - 60*60*24
+  
+    TimeStamp=int(timegm(ts))*1000000000L
+    TimeStamp1=int(timegm(ts) - 60*60*24)*1000000000L
+    #TimeStamp1=int(timegm(ts) + 60*60*1)*1000000000L
+
+    allTrips8 = findLArHVTrips("/LAR/DCS/HV/BARREL/I8",TimeStamp1,TimeStamp)
+    allTrips16 = findLArHVTrips("/LAR/DCS/HV/BARREl/I16",TimeStamp1,TimeStamp)
+
+    #allTrips = allTrips16
+    allTrips = dict(allTrips8.items() + allTrips16.items())
+
+##     print allTrips
+
+##    allTrips = {154009L: [['2011-06-08:07:14:36', '2011-06-08:07:15:54', 'none', '2011-06-08:07:14:45']], 40015L: [['2011-06-07:08:25:46', '2011-06-07:08:27:24', 'none', '2011-06-07:08:25:53']], 75009L: [['2011-06-08:01:37:32', 'none', '2011-06-08:01:40:27', '2011-06-08:01:37:41']]}
+
+    FILE = open("/afs/cern.ch/user/l/larmon/public/HVTripsDB/dailyFiles/HVTrips_"+args[0]+".dat","w")
+
+    #print " HV line    TRIP Date/Time [Run,LB]          Stable Zero   Ramp Up     RECOVERY Date/Time [Run,LB]       StableBeams  Fill  #CollBunches  Solenoid  Toroid"
+
+    for hvline,tripList in allTrips.iteritems():
+
+        #print tripList
+
+        stableZeroLB = -1
+
+        for itrip in tripList:
+
+            ts = int(timegm(ConvertToUTC(itrip[0])))*1000000000L
+            tripDict = GetCOOLInfo("/TRIGGER/LUMI/LBTIME","oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200",0,ts,["Run","LumiBlock"])
+
+            if itrip[1] != "none":
+                recots = int(timegm(ConvertToUTC(itrip[1])))*1000000000L
+                recoDict = GetCOOLInfo("/TRIGGER/LUMI/LBTIME","oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200",0,recots,["Run","LumiBlock"])
+
+            if itrip[2] != "none":
+                stableZerots = int(timegm(ConvertToUTC(itrip[2])))*1000000000L
+                stableZeroLB = GetCOOLInfo("/TRIGGER/LUMI/LBTIME","oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200",0,stableZerots,["Run","LumiBlock"])["LumiBlock0"]
+                #print "stable zero",stableZeroLB
+
+            if itrip[3] != "none":
+                rampStartts = int(timegm(ConvertToUTC(itrip[3])))*1000000000L
+                rampStartLB = GetCOOLInfo("/TRIGGER/LUMI/LBTIME","oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200",0,rampStartts,["Run","LumiBlock"])["LumiBlock0"]
+                #print "ramp start",rampStartLB
+
+            fillDict = GetCOOLInfo("/LHC/DCS/FILLSTATE","oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_DCS;dbname=COMP200",1,ts,["StableBeams","FillNumber","NumBunchColl"])
+            magnetDict = GetCOOLInfo("/EXT/DCS/MAGNETS/SENSORDATA","oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_DCS;dbname=COMP200",[1,3],ts,["value"])
+
+            if abs(magnetDict["value1"]-7730.) < 10:
+                magnetDict["value1"] = "ON"
+            elif abs(magnetDict["value1"]-0.) < 10:
+                magnetDict["value1"] = "OFF"
+            else:
+                magnetDict["value1"] = "RAMP"
+
+            if abs(magnetDict["value3"]-20400.) < 10:
+                magnetDict["value3"] = "ON"
+            elif abs(magnetDict["value3"]-0.) < 10:
+                magnetDict["value3"] = "OFF"
+            else:
+                magnetDict["value3"] = "RAMP"
+
+            writeString = "%d " % (hvline)
+            writeString += "%s " % (itrip[0])
+            writeString += "%d " % tripDict["Run0"]
+            writeString += "%d " % tripDict["LumiBlock0"]
+            if itrip[1] == "none":
+                writeString += "%d " % stableZeroLB
+                writeString += "-1 "
+                writeString += "9999-12-31:23:00:00 "
+                writeString += "0 "
+                writeString += "0 "
+            else:
+                if itrip[2] == "none":
+                    writeString += "-1 "
+                else:
+                    writeString += "%d " % stableZeroLB
+                if itrip[3] == "none":
+                    writeString += "-1 "
+                else:
+                    writeString += "%d " % rampStartLB
+                writeString += "%s " % (itrip[1])
+                writeString += "%d " % recoDict["Run0"]
+                writeString += "%d " % recoDict["LumiBlock0"]
+            writeString += ("N","Y")[fillDict["StableBeams1"]]
+            writeString += " %d " % fillDict["FillNumber1"]
+            writeString += "%d " % fillDict["NumBunchColl1"]
+            writeString += magnetDict["value1"]
+            writeString += " "
+            writeString += magnetDict["value3"]
+            writeString += " \n"
+
+            FILE.write(writeString)
+
+##             print ('{0:8d}'.format(hvline)).rjust(8),
+##             print "  ",
+##             print "%19s" % (itrip[0]),
+##             print ('[{0:d},{1:d}]'.format(tripDict["Run0"],tripDict["LumiBlock0"])),
+##             if itrip[1] != "none":
+##                 print ('{0:d}'.format(rampStartLB)),
+##                 print "  ",
+##                 print ('{0:d}'.format(rampEndLB)),
+##             else:
+##                 print "            ",
+##             print "%19s" % (itrip[1]),
+##             if itrip[1] != "none":
+##                 print ('[{0:d},{1:d}]'.format(recoDict["Run0"],recoDict["LumiBlock0"])),
+##             else:
+##                 print "            ",
+##             print "     ",("N","Y")[fillDict["StableBeams1"]],
+##             print "    ",
+##             print ('{0:5d}'.format(fillDict["FillNumber1"])).rjust(5),
+##             print "  ",
+##             print ('{0:5d}'.format(fillDict["NumBunchColl1"])).rjust(4),
+##             print "      ",magnetDict["value1"].rjust(4),
+##             print "   ",magnetDict["value3"].rjust(4)
+    
+
+    FILE.close()
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/README b/LArCalorimeter/LArMonitoring/python/HVTripsDB/README
new file mode 100644
index 00000000000..3980d9ae8e1
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/README
@@ -0,0 +1,56 @@
+Instructions for the LAr HV expert on how to update the HV shift DB
+===================================================================
+
+At 7:45 every morning, a cron job is run that executes updateDB.py
+This adds information of new HV trips from the past 24 hours (until 
+7:30am, to allow for a 15-minute delay in writing the values to COOL) 
+to the bottom of trips.dat. The previous list is in trips.dat.bak.
+More information is stored in the subfolder dailyFiles, including the log
+file called dailyCheck.log
+
+1. Make sure the new HV trips added to trips.dat are correct
+Instructions on how the information should be added are in
+
+  tripTypes_improved.pdf
+
+in this folder.
+
+NOTE that 
+  "Recovered" means "back to its nominal state"
+and
+  "stable V" means "stable at non-nominal value"
+The script currently (July 29, 2011) might report "Stable V" as "Recovered"
+in certain cases. 
+
+
+Useful to check what are the new entries:
+  diff trips.dat trips.dat.bak
+
+(should be the same as cat dailyFiles/HVTrips_<date>.dat)
+
+
+2. Reproduce the actual DB
+
+Once the trips.dat is all correct simply run:
+
+  ./recreateDB.py 
+
+The updated DB can be seen immediately at:
+
+https://atlas-larmon.cern.ch/HVTripsDB/
+
+Please be careful! ATLAS data quality & LAr HV experts are depending on you!
+
+3. If needed (for complicated situations), make use of the standalone script:
+
+source ~/public/scripts/LADIeS/setup17.sh
+./CheckHVStatus.py 152002 2012-05-03:22:00:00
+
+(the first argument is the HV line, and the second is the approximate timestamp)
+This outputs the voltage/current/status evolution (and corresponding LBs) for a given line.
+
+PS: (Added by Nikiforos)
+
+Please keep this directory clean! Any backup "trips.dat" and/or 
+"trips.db" in the "dbbackups" directory. Delete any temporary files you 
+create or move them in "retired" if you are not sure.
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/appendDb.py b/LArCalorimeter/LArMonitoring/python/HVTripsDB/appendDb.py
new file mode 100755
index 00000000000..79a097c50ca
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/appendDb.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python2.5
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+import sqlite3
+import datetime
+
+conn = sqlite3.connect('trips2.db',detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
+#conn = sqlite3.connect('trips2.db')
+
+c = conn.cursor()
+#c.execute('create table TRIPS (HVLINE INTEGER,TripTimeStamp LONG INTEGER,TripRunNumber INTEGER,TripLB INTEGER,StableZero INTEGER,RampUp INTEGER,RecoveryTimeStamp LONG INTEGER,RecoveryRunNumber INTEGER,RecoveryLB INTEGER, StableBeams TEXT,FillNumber INTEGER,NumCollBunches INTEGER,Solenoid TEXT,Toroid TEXT)')
+cmd = 'insert into TRIPS values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)'
+
+f = file('newTrips.dat','r')
+
+for l in f:
+  a = l.split()
+
+
+  
+  tripString = a[1]
+  recoveryString = a[6]
+  tripDateTime=datetime.datetime.strptime(tripString, '%Y-%m-%d:%H:%M:%S')
+  recoveryDateTime=datetime.datetime.strptime(recoveryString, '%Y-%m-%d:%H:%M:%S')
+  b = (a[0],tripDateTime.strftime('%Y-%m-%d %H:%M:%S'),a[2],a[3],a[4],a[5],recoveryDateTime.strftime('%Y-%m-%d %H:%M:%S'),a[7],a[8],a[9].upper(),a[10],a[11],a[12].upper(),a[13].upper())
+  c.execute( cmd,b )
+
+  print b
+
+conn.commit()
+
+#c.execute('create table DETAILS (HVLINE INTEGER PRIMARY KEY,Module INTEGER,Channel INTEGER,Det TEXT,Side TEXT,PhiWedge INTEGER,SubPhiWedge INTEGER,EtaSector INTEGER,ElectrodeSide TEXT,Map TEXT, PoweredElectrodes INTEGER)')
+
+#f2 = file('hvdetails.dat','r')
+
+#cmd =  'insert into DETAILS values (?,?,?,?,?,?,?,?,?,?,?)'
+#for l2 in f2:
+#  a = l2.split()
+
+#  side = a[4][0]
+#  phiWedge= a[4][1:]
+#  sector=0
+#  if len(a[6]) == 2:
+#    sector=a[6][1]
+  
+#  b = (a[0],a[1],a[2],a[3],side,phiWedge,a[5],sector,a[7],a[8],a[9])
+#  c.execute( cmd,b )
+
+#conn.commit()
+#conn.close()
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/createDB.py b/LArCalorimeter/LArMonitoring/python/HVTripsDB/createDB.py
new file mode 100755
index 00000000000..d43ab4b7461
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/createDB.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python2.6
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+import sqlite3
+import datetime
+
+conn = sqlite3.connect('trips.db',detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
+#conn = sqlite3.connect('trips.db')
+
+c = conn.cursor()
+c.execute('create table TRIPS (HVLINE INTEGER,TripTimeStamp LONG INTEGER,TripRunNumber INTEGER,TripLB INTEGER,StableZero INTEGER,RampUp INTEGER,RecoveryTimeStamp LONG INTEGER,RecoveryRunNumber INTEGER,RecoveryLB INTEGER, StableBeams TEXT,FillNumber INTEGER,NumCollBunches INTEGER,Solenoid TEXT,Toroid TEXT)')
+cmd = 'insert into TRIPS values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)'
+
+f = file('trips.dat','r')
+
+for l in f:
+  a = l.split()
+  
+  tripString = a[1]
+  recoveryString = a[6]
+  tripDateTime=datetime.datetime.strptime(tripString, '%Y-%m-%d:%H:%M:%S')
+  recoveryDateTime=datetime.datetime.strptime(recoveryString, '%Y-%m-%d:%H:%M:%S')
+  b = (a[0],tripDateTime.strftime('%Y-%m-%d %H:%M:%S'),a[2],a[3],a[4],a[5],recoveryDateTime.strftime('%Y-%m-%d %H:%M:%S'),a[7],a[8],a[9].upper(),a[10],a[11],a[12].upper(),a[13].upper())
+  c.execute( cmd,b )
+
+conn.commit()
+
+c.execute('create table DETAILS (HVLINE INTEGER PRIMARY KEY,Module INTEGER,Channel INTEGER,Det TEXT,Side TEXT,PhiWedge INTEGER,SubPhiWedge INTEGER,EtaSector INTEGER,ElectrodeSide TEXT,Map TEXT, PoweredElectrodes INTEGER, status STRING)')
+
+f2 = file('hvdetails.dat','r')
+
+cmd =  'insert into DETAILS values (?,?,?,?,?,?,?,?,?,?,?,?)'
+for l2 in f2:
+  a = l2.split()
+
+  if a[0][0] =='#':
+    print 'ignoring comment'
+  else:
+    side = a[4][0]
+    phiWedge= a[4][1:]
+    sector=0
+    if len(a[6]) == 2:
+      sector=a[6][1]
+    
+    b = (a[0],a[1],a[2],a[3],side,phiWedge,a[5],sector,a[7],a[8],a[9],a[10])
+    c.execute( cmd,b )
+
+conn.commit()
+conn.close()
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/dump.py b/LArCalorimeter/LArMonitoring/python/HVTripsDB/dump.py
new file mode 100755
index 00000000000..34d3a96e52d
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/dump.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python2.5
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+import sqlite3
+import datetime
+
+conn = sqlite3.connect('/afs/cern.ch/user/l/larmon/public/HVTripsDB/trips.db')
+#conn = sqlite3.connect('trips.db')
+
+c = conn.cursor()
+
+f = file('resultDump.txt','w')
+
+cmd =  'select trips.TripRunNumber,details.Det,details.Side, trips.TripLB, trips.RecoveryLB from trips INNER JOIN details ON trips.HVLINE = details.HVLINE order by trips.TripRunNumber;'
+
+c.execute(cmd)
+
+r=c.fetchall()
+
+for i in range(len(r)):
+	s=''
+	for k in r[i]:
+		s='%s%s '%(s,k)
+
+	f.write(s+'\n')
+	
+f.close()
+
+conn.close()
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/favicon.ico b/LArCalorimeter/LArMonitoring/python/HVTripsDB/favicon.ico
new file mode 100644
index 0000000000000000000000000000000000000000..d1edb140df1c2d395996d6820c7b5372bc093883
GIT binary patch
literal 30846
zcmeI4Ka=CO6~IACTuDoEwWmMUdbuYa_b7@-8C0%tX0Euxg$oxhu1Mj+MT(or6)s$O
zCRez*B1H<9E}WTkZu0?BxNwmoMOv3BT)N0t2uO;+BMA}!CGqZNh@F){5CndB03IG5
zxQmcRet!HLBA;XQr#~a~0YWGwzdw@S-)mVqiPnT68V<*3IJVH(x<*55fv&F?XncK#
zt`~R6TKMSt#z)o-MvF%nUHi|_4gLfz@C$VJ^aZk>eu)+ze~H3ppQG^k7wG2sS1A1S
zCA$9P4Z8dETXgr?U(n*S@6huXuTc2n4SMwAd-UiJe@FO>@6fZCKcKrm{uAMs|3Ln$
zpU~Z_e<A;?|DdN||BRl0^AmdX^)Kkz>whEvn_tn>*S{eD^{?pjH$Nl)+uzW~Z~lwI
zH@~50fBj!gyZYo_0=)!862R|6AdPq*Fmca$+HN|?bNdd4LPImo?Zxn&3lkrL9ykph
zHT-Bv&`%ObeTSeAjnU|0bO?qqG>i!e_Vf^DVU-j6n{I+PpqO3|!Vm=6bqwiPoIJ)Z
z&L7(jDd%IQ+Pda6-V@GVo=U?=l(`?DA_=M8@8zi`FH!DjW+!2Gb#=8B<t^OrSbyR;
z4ZmXyk>|Si?6NM_HD`$<b}iy<7_4emOP2fXa&D%2x;|<19Yf;A-XiDTU$Rxy<<hal
zx5pVdlT?=3$DAQ?V{eOdmkvw@IuT6&x5K&f=4AT7V7!Bz`*2Fl<($=yxZO<?Nj@6y
zC=#tkIUW7hoPBfcopX|bN$FUmxM|}ccg?xsQKCs85NEgkkiB0Wm_$&6`GzCGVp5m#
z^jA=0=AEwFo^aK~9m+FuFH5>8B{kQAnV!kDGkJPewv^{$%)TeLzG!52$+_RmD;kr4
z>T}`z$wz4?@{De&!2!gn*+EVr{_cP?TJxq4GF_1^2kFnx>DfSrG&)&HO&^MSZqD2i
zrhsW=u#_H{2huZhKH)7t`pi@5@|5(<oZIRI(kvOhPCL9Cc{0C3-tm{N+Q96FGc3t-
zvJ%+CWjW^8XYTip3Y>#!!RMYc$b6rfGXRUFW_xmLB#-;doF0>>^{~~zJV2kDlge`-
zwlR5f%+t=yxu%?=jc*QA^L<{<{fe5L<}tl~b~|}R<d6kh!f3CNWs*z^X}EjztwoNB
z=I!Ttr<~WvwOLM{`<B9pXH=dK&d(XTx3}$9<%rpyi?efj6EbNvtBwBKQcGT2otyLi
z;0?NLu{JYvN%zjpNr#xomC6CxQZ=tD?AbU4iS^QkuF%>;UIC41VRxK&bjBi6*>?Ph
zat;b_Cp0#WdsC>FK4hFocq&n@f|+&txjBJ6k*?bFfK$0IiftCk)2HK;WL52XkM{eK
z=8||G;W_Ad)t+CU%3PA*^r@~U!1`UWI|Nt2TsqFIli<WI?K}di)_=fU60}Hkn^Y~z
zQtEkOc97u#9WzHR?=tel{+L!rdR}xA2{3WDoS049r03-|;eJXRc%&I3B~QF#<BU`+
zukD#xr#n#0E#jnJiKily3Wk_?(ml`2y1|j=lAJs-X7BG2;0sw(l&ulRnoF{rctJI`
zLeD>@8qJU&)co$1>vxPJ=y287{KCqq8_Idn6({!S8+@c`6Nxuu2y{TQW}!2AVqBQ>
zQ>kSzpo2y98UWr2JmI9d<=(2fF7&*%mf0yY&gSKIAG$O9wsB`7&sm)FBblD}s65Rl
zHLWMfu{TS0w8&^0^$MJrSwG~dS$)OyjzjWgVOBFv_ITr%d25=?a8e8{RuqZtyjt?D
zHMRaw5*yO|Wit*Po2mp-=BQpPsBq!{+V&Hnwr^hE_mMLl<)X|4(D0Us66gL7mOB%9
z3Ik?g-<0}lAGynPP-cMn=SA&YQsTtSuprNgYzyx)uO4YdGb9Qe?rD63jibhinb(0l
zIH_%YB0UETlEPpPZ%lBDwk3_!x_1;gF`L5V$$5Rx$16BNG`g+w*YoPzOMum`(f6vH
zg*o4_&NIh+3X%Dy;$YDTNwU@zsmdwW^V{<4bJ`+`gOv$oobp#c#(Yhy%!vz<nsZC_
zZKxMg7R|JIZ-`VmYaFHOoZ>kju!&yf;HGGxUHsXp&WSg0`#G*^dylD2E>tCPICC5T
z$~_rr!HHd1)3iK6*P^KcpC%K>Tx{Zfbj4DQYSY`DAH{6DTb-b5xnY=LX%|Z`Thrmz
z+b%6$$tB6pNfjgo7p(QjfZ9GT?4v*~UeuVa>DypC;BMn7`&OK_Js&T@IOCzQG~IG2
zWFnRg=m*XjBjDWok0Ti?ofH~_)&mP~0|x{{;>5<QpuCnXSvIzO(T-)Do7rSw&evfq
z!y3Xlo$u#2Fp<?-iH+uKj(0f(z6`Tsh*C~3%cdFj(v>(VVjfshLN@0gL48$$%M*0d
zsX$~>14U}LWi66(LeGp&8XQFBoU{wlNTKKTWLM|b8bLWCQ4W(;z+J(TG9f}mH|3lU
zi%YLQn2;gRgnAF9HwkwuFb^15F=nl6M48EeZTs>r%F>h117}1}-B`)mWa>1$y2W0p
zAe*JxZLyuK6c95-;|WZ|vTizXGS3<)mqhi++=cp)H4yJWsl|u*SK7Q$m`TY{*-t@L
zBudIm61HHnm8&t#TaTx(e6<BqxShg<rkA{z2hO5brc8=7lMI0ht1GS4$;fz6)|W+j
zWmorLE?R{Nmvh1~T)|8eG;`^elrz-!{D)}jqEIW3F-?QZF5RmncSu2LhJtNDOD{#V
zfxXy(3Jco4l(%rHFPc<G3Xpwlz*s6A1d!sg9QV+{S*WCVp_}v7CLaQYqora#cx5<}
zn0N<w3rp}6Delmm$eHUB%7r|j4asOtm1`u`^NkKJAj~8RcMH&|&p7dZ7rINyT?`tG
zY-bZ=xF|yj!uUw(3<0d3hxIsZ3E)hw_wi;mr4BS$8z*j%nI$&lE|f3}0tL#x#F?^2
z!O8*(f<wrX43Tac%Q#9?ksUsuvbX3B4rhAr-o2ICZ8PASn5Bw|;c+VS_tbF`*m$$H
zCvr2Z1`=tuIwrmcb<(#S8#oE-F7_OY{LhY-LF2n2XlK?$pk<#s`kFbDf}VuyTT{Yl
ztF}d3f;FLriI)rwhurHR=1fY8ywyy32(-l{E=kbl!wHZaCqa$FU||hJvl~>PiT?<j
zC(I-bT5o#xe@3J^$>aOo#+^49fB=%5vPiF$99p34HFeIUK(Y`xw#2^DkU9wCAf`#c
zDr(7@vWgdivHD-c6quQTa|CBnVoZhr=fL97^<%ZQvVfRgFgMQO#8G8@rX>JBMC3VB
zF6(6r?OtN_4%^wm;pGWc&e*h9u21zMF|iirptKN}JjY;(Lv*?KQj2+*+n}nP<PUW;
z-LT1Si5js{uwDXNK(o~TV^JNkH#dwaeJxs*Gk;NJFqwTwH}`w85G=BVKr`l|U3wi@
zC4IZ4{YLjkl}t4WH>6>C7?`)~4Hat~ddsUTr)IZbQ=D`%sZ%;{k`ZzyyoR+3g#H7i
z8u*!&IjbwDHnAL;%{d=HGF6omTHA>{vruz5CCMO@jnpHPjpivF!RMH$?o^UKc63CQ
zGlEA5lry(xkH)DjK$UaHUX`SjXmqAY4yaW*3%<Xclyg1-syInhnG-rJ4xAMy^-0Kz
zg(!34pt4t57K=Q~l{zPeXQqinD<_=i0BynfWC`sfO~Oxn0`L}`c<(YVrO|%3rbOR{
z6JvjUnK+gP<TyyFw)UCZaT4!C;Cyi7F}tfhf!vdAIps<}U9O(<bh1oJ>gCzX^RyB;
zZE5}Z?B#h{37odHeth=wJgo#yTUtLpdwHH#0;esFjL$yw66ht+OQ4rPFM(bHy##s*
S^b+VL&`Y3~KrewVCGdZRpL{_8

literal 0
HcmV?d00001

diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/index.bak b/LArCalorimeter/LArMonitoring/python/HVTripsDB/index.bak
new file mode 100755
index 00000000000..b05ff4717fa
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/index.bak
@@ -0,0 +1,57 @@
+#!/usr/bin/env python2.5
+print 'Content-type: text/html;charset=utf-8\n'
+import cgitb;cgitb.enable()
+
+print '''
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>HVTrips database</title>
+<meta name="author" content="Nikiforos Nikiforou <nikiforo@cern.ch>"/>
+<link rel="icon" type="image/vnd.microsoft.icon" 
+href="favicon.ico" />
+<link rel="Stylesheet" href="styles.css" type="text/css" />
+<base target="_self">
+</head>
+<body>
+<div class="wrapper"><br />
+<font style="font-size:20pt">HVTrips database test</font><br>
+'''
+cols = ['TripTimeStamp','RecoveryTimeStamp','HVLINE','RunNumber','TripLB','RecoveryLB','Comment']
+import cgi,sqlite3,operator
+
+query = cgi.FieldStorage()
+a = []
+for i in cols:
+  if query.has_key(i): a.append( query.getvalue(i) )
+
+conn = sqlite3.connect('trips.db')
+c = conn.cursor()
+
+if len(a)==len(cols):
+  cmd = 'insert into TRIPS values %s' % ( str(tuple(a)) )
+  c.execute(cmd)
+  conn.commit()
+elif len(a)>0: print 'Put entries in all the columns to edit the db file'
+
+cmd = 'select * from TRIPS'
+c.execute(cmd)
+r = c.fetchall()
+
+SortedTrips = sorted(r,key=operator.itemgetter(1))
+
+print '<form method="post"><table class="list">\n<tr>\n'
+for i in cols: print '<td>%s</td>\n' % (i)
+print '</tr>\n<tr>\n'
+for i in cols: print '<td><input type="text" name="%s"/></td>\n' % (i)
+for i in range(len(SortedTrips)):
+  print '<tr class="g%d">\n' % (i%2)
+  for j in SortedTrips[i]: print '<td>%s</td>' % (j)
+  print '</tr>\n'
+print '</tr>\n</table><input type="submit" value="Submit"/></form>\n'
+#for i in list_files: print '<a href="%s">%s</a><br>' % (i,i)
+print '<div class="push"></div>\n</div>\n'
+print '<div class="footer">Developer: Nikiforos Nikiforou<a href="mailto:eaolltt@gmail.com">&lt;nikiforo@cern.ch&gt;</a></div>\n'
+print '</body>\n</html>'
+
+c.close()
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/index.py b/LArCalorimeter/LArMonitoring/python/HVTripsDB/index.py
new file mode 100755
index 00000000000..990e98eae6e
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/index.py
@@ -0,0 +1,285 @@
+#!/usr/bin/env python2.5
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+years = ('2011','2012')
+allDbNames = {'2012': 'trips.db', '2011': 'trips2011.db'}
+allDatNames = {'2012': 'trips.dat', '2011':'trips2011.dat'}
+allPicsDirNames = {'2012': 'HVHistoryPic', '2011': 'HVHistoryPic2011'}
+
+
+print 'Content-type: text/html;charset=utf-8\n'
+import cgitb
+cgitb.enable()
+
+import cgi, sqlite3, operator, datetime
+import os, stat
+
+form = cgi.FieldStorage()
+
+selected_year = form.getvalue('YEAR', years[-1])
+selected_module = form.getvalue('MODULE', '')
+selected_channel = form.getvalue('CHANNEL', '')
+selected_detector = form.getvalue('DETECTOR', '')
+selected_side = form.getvalue('SIDE', '')
+selected_sb = form.getvalue('SB', '')
+selected_from = form.getvalue('FROM','')
+selected_to = form.getvalue('TO', '')
+selected_limit = int(form.getvalue('LIMIT', '100'))
+selected_run = form.getvalue('RUN', '')
+selected_status = form.getvalue('STATUS', '')
+
+dbName = allDbNames[selected_year]
+datName = allDatNames[selected_year]
+picsDirName = allPicsDirNames[selected_year]
+
+dt1 = datetime.datetime.fromtimestamp(os.stat(dbName).st_mtime)
+dt2 = datetime.datetime.fromtimestamp(os.stat(datName).st_mtime)
+
+cmd = 'select  trips.rowid,*  from trips INNER JOIN details ON trips.HVLINE = details.HVLINE order by trips.TripTimeStamp desc limit %d;' % selected_limit
+if form.has_key('query'): 
+    cmd = form.getvalue('query')
+
+print '''
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Query the HVTrips database</title>
+<meta name="author" content="Nikiforos Nikiforou <nikiforo@cern.ch>, Ruggero Turra <ruggero.turra@cern.ch>"/>
+<link rel="shortcut icon" href="favicon.ico" />
+<link rel="Stylesheet" href="styles.css" type="text/css" />
+<script>
+
+function get_query(detail, stable_beam, module, channel, detector, side, from, to, run, status, limit) {
+  var query = "select  trips.rowid,*  from trips";
+  if (detail) query += " INNER JOIN details ON trips.HVLINE = details.HVLINE";
+  selections = [];
+  if (module)           selections.push("trips.HVLINE>" + module*1000 + " and trips.HVLINE<" + (parseInt(module)+1)*1000);
+  if (channel)          selections.push("trips.HVLINE%1000=" + channel);
+  if (detector)         selections.push("Det='" + detector + "'");
+  if (side)             selections.push("Side='" + side + "'");
+  if (stable_beam=='Y') selections.push("StableBeams='Y'");
+  else if (stable_beam=='N') selections.push("StableBeams='N'");
+  if (from)             selections.push("strftime('%s', '" + from + "') < strftime('%s', TripTimeStamp)");
+  if (to)               selections.push("strftime('%s', '" + to + "') > strftime('%s', TripTimeStamp) + 24*3600");
+  if (run)              selections.push("TripRunNumber=" + run);
+  if (status)           selections.push("status='" + status + "'");
+//  console.log(selections)
+  if (selections.length) query += " where " + selections.join(" and ");
+  query += " order by trips.TripTimeStamp desc";  
+  if (limit) query += " limit " + limit;
+  query += ';';
+  return query;
+};
+
+function change_query() {
+  stable_beam = document.getElementById("SB").value;
+  module = document.getElementById("MODULE").value;
+  channel = document.getElementById("CHANNEL").value;
+  detector = document.getElementById("DETECTOR").value;
+  side = document.getElementById("SIDE").value;
+  from = document.getElementById("FROM").value;
+  to = document.getElementById("TO").value;
+  limit = document.getElementById("LIMIT").value;
+  status = document.getElementById("STATUS").value;
+  run = document.getElementById("RUN").value;  
+
+  query = get_query(true, stable_beam, module, channel, detector, side, from, to, run, status, limit);
+  query_field = document.getElementById("qq");
+  query_field.value = query;
+};
+</script>
+<base target="_self">
+</head>
+<body>
+'''
+print '''
+<div class="wrapper">
+<font style="font-size:20pt">Query the HVTrips database</font>'''
+
+print '<form class="form" method="post">'
+
+print '''
+<p>
+  <label for="YEAR">Database:</label>
+  <select name="YEAR" id ="YEAR">
+'''
+for year in years:
+    print '   <option value="%s" %s>%s</option>' % (year, (year==selected_year and "selected") or "", year) # why python 2.5??
+print '''
+  </select>
+</p>
+'''
+
+detectors = ("", "EMB", "EMEC", "HEC", "EMBPS", "EMECPS")
+sides = ("", "A", "C")
+hv_statuses = ("", "current", "new")
+
+def print_options(options, default=None):
+    result = ""
+    for option in options:
+        result += ' <option value="%s" %s>%s</option>' % (option, (option==default and "selected") or "", option) # why python 2.5??
+    return result
+
+
+print '''
+<p>
+<label for="MODULE">Module: </label>
+<input oninput="javascript:change_query()" type="text" id="MODULE" name="MODULE" size="10" value="%(module)s" />
+<label for="CHANNEL">Channel: </label>
+<input oninput="javascript:change_query()" type="text" id="CHANNEL" name="CHANNEL" size="10" value="%(channel)s" />
+</p>
+<p>
+<label for="DETECTOR">Detector: </label>
+<select onchange="javascript:change_query()" id="DETECTOR" name="DETECTOR">
+''' % {"module": selected_module, "channel": selected_channel}
+print print_options(detectors, selected_detector)
+print '''
+</select>
+<label for="SIDE">Side: </label>
+<select onchange="javascript:change_query()" id="SIDE" name="SIDE">
+'''
+print print_options(sides, selected_side)
+print '''
+</select></p>
+<p>
+<label for="STATUS">Status</label>
+<select onchange="javascript:change_query()" id="STATUS" name="STATUS">
+'''
+print print_options(hv_statuses, selected_status)
+print '''
+</select>
+</p>
+<p>
+<label for="RUN">Trip RunNumber</label>
+<input oninput="javascript:change_query()" type="text" id="RUN" name="RUN" size="10" value="%(run)s" />
+''' % {"run": selected_run}
+print '''
+<label for="SB">Stable beam:</label>
+<select onchange="javascript:change_query()" id="SB" name="SB">
+'''
+print print_options(("", "Y", "N"), selected_sb)
+print '''
+</select></p>
+'''
+print '''
+<p>
+<label for="qds">From (yyyy-mm-dd):</label>
+<input oninput="javascript:change_query()" type="text" id="FROM" name="FROM" size="10" value="%(from)s" />
+<label for="qdt">To (yyyy-mm-dd):</label>
+<input oninput="javascript:change_query()" type="text" id="TO" name="TO" size="10" value="%(to)s" />
+</p>
+''' % { "from": selected_from, "to": selected_to}
+print '''
+<p>
+<label for="LIMIT">Limit: </label>
+<input oninput="javascript:change_query()" type="text" id="LIMIT" name="LIMIT" size="10" value="%d" />
+</p>''' % int(selected_limit)
+print '<p><textarea id="qq" name="query" rows="5" cols="60">%s</textarea></p>' % cmd
+print '''
+<p>
+<input type="submit" value="Send">
+</p>
+</form>(Enter an SQL query and hit "Enter". The default query returns the 100 most recently recorded trips in descending TripTimeStamp order)
+'''
+#print '<font style="font-size:18pt" color="red">DEVELOPMENT IN PROGRESS! DONT USE!</font><br>'
+print '<br> Db last updated:%s, dat file last updated: %s'%(dt1,dt2)
+
+print '<br> <font style="font-size:12pt">Instructions:</font> <br> Use sqlite commands (Local copy of the <a href="./sqlite-doc/index.html" target="_blank"> sqlite reference </a> or visit the <a href="http://www.sqlite.org/lang.html" target="_blank"> sqlite website </a>). I suggest to use the <b>limit</b> keyword to limit the output and avoid slow rendering of the page.<br>'
+
+print 'The trips themselves are stored in a table named "trips" and the static additional details are stored in a table named "details". Use the "INNER JOIN details ON trips.HVLINE = details.HVLINE" command as indicated to correlate the two tables using the common "HVLINE" entry.<br>'
+
+print 'The column names are the ones shown below (no spaces between words).<br>'
+
+print '<b> Example queries:</b><br>'
+print 'A. <b> select  trips.rowid,*  from trips INNER JOIN details ON trips.HVLINE = details.HVLINE where Det=\'EMBPS\' order by trips.TripTimeStamp desc </b>. Select all EMBPS trips.<br> '
+print 'B. <b> select  trips.rowid,*  from trips INNER JOIN details ON trips.HVLINE = details.HVLINE where (strftime(\'%M\',RecoveryTimeStamp) - strftime(\'%M\',TripTimeStamp)) > 10 order by trips.TripTimeStamp desc </b>. Select all trips that lasted more than 10  minutes.<br> '
+
+
+#Also uncomment the print statements in the bottom to show os.system output
+#log='Log: os.system("ls -l) result:'
+#log+= str(os.system("ls -l"))
+
+#log='Log: os.system("ln -s /afs/cern.ch/user/l/larmon/public/TripVisualizer/HVHistoryPic2011") result:'
+#log+= str(os.system("ln -s /afs/cern.ch/user/l/larmon/public/TripVisualizer/HVHistoryPic2011"))
+#Do not use!
+#os.remove("trips.db")
+#execfile("createDB.py")
+#os.chmod("trips.db",stat.S_IRWXU|stat.S_IRWXG|stat.S_IRWXO)
+
+conn = sqlite3.connect(dbName,detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
+#conn = sqlite3.connect('trips.db')
+
+c = conn.cursor()
+
+
+
+
+detcols = ['HVLINE','Trip\nTimeStamp','Trip\nRunNumber','Trip\nLB','Stable\nZero','Ramp\nUp','Recovery\nTimeStamp','Recovery\nRunNumber','Recovery\nLB', 'Stable\nBeams','Fill\nNumber','Num\nCollBunches','Solenoid','Toroid','Module','Channel','Det','Side','Phi\nWedge','SubPhi\nWedge','Eta\nSector','Electrode\nSide','Map', 'Powered\nElectrodes','HVLINE\nStatus',]
+
+
+print '<br> Executing query command <b>'+cmd+' </b><br>'
+
+c.execute(cmd)
+r = c.fetchall()
+
+print '<br><font style="font-size:20pt">Query result:</font><p font style="font-size:10pt">%d results returned</font></p>' % (len(r))
+print 'HINT1: Clicking on the HVLINE entry pops up the relevant LArIdtranslator query page showing the affected channels. The affected eta-phi range is visible at the very bottom of the page. <br>'
+print 'HINT2: Clicking on the RunNumber entry pops up the relevant Atlas Query page. <br>'
+print 'HINT3: Clicking on the TripId entry pops up a visualization of the trip. <br>'
+
+print '<table class="list">\n<tr>\n'
+print '</tr>\n<tr>\n'
+print '<td>TripId</td>'
+for i in detcols: 
+    print '<td>%s</td>\n' % (i)
+
+print '</tr>\n<tr>\n'
+
+for i in range(len(r)):
+  #incompleteRow = False
+  #for k in r[i]:
+    #if k == 'Not entered' or k =='9998.12.31 00:00:00': 
+      #incompleteRow = True
+      #break
+
+  #if incompleteRow:   print '<tr class="g%d">\n' % (2)
+  #else: 
+    print '<tr class="g%d">\n' % (i%2)
+    curColumn = 0
+    for j in r[i]:
+        if curColumn == 3 or curColumn == 8:
+          print '<td><a href="http://atlas-runquery.cern.ch/query.py?q=find+run+%s+and+ready+/+show+all+and+dq+lar+DCSOFL+" target="_blank">%s</a></td>' % (j,j)
+        elif curColumn == 1:
+            print '<td><a href="https://atlas-larmon.cern.ch/LArIdtranslator/?HVLINES=%s&expert=1&run=999999" target="_blank">%s</a></td>' % (j,j)
+        elif curColumn == 15:
+            print '' #Do not display second instance of HVLINE
+        elif curColumn == 18 or curColumn == 19 or curColumn == 10:
+            print '<td class="%s">%s</td>' % (j,j)
+        elif curColumn == 0 and len(r[i])>10:
+            if r[i][10]=='Y':
+                picPath = picsDirName+'/trip_%s.png' % (j)
+                if os.path.isfile(picPath):
+                    print '<td><a href="https://atlas-larmon.cern.ch/HVTripsDB/%s" target="_blank">%s</a></td>' % (picPath,j)
+                else:
+                    print'<td>%s</td>' % (j)
+            else:
+                print'<td>%s</td>' % (j)
+
+        else: print '<td>%s</td>' % (j)
+        curColumn = curColumn +1;
+
+    print '</tr>\n'
+print '</tr>\n</table>\n'
+
+#for i in list_files: print '<a href="%s">%s</a><br>' % (i,i)
+print '<div class="push"></div>\n</div>\n'
+print '<div class="footer">Developed very badly by Nikiforos K. Nikiforou <IMG SRC="http://www.cern.ch/mmmservices/AntiSpam/nospam.aspx?email=6voXPH0hIQhzOwUVkFEqM4k4jmbV8zQiqLND%2bmWxRn%2bFh%2fqDibWQA6qs6WMxqC77">, updated by R. Turra <IMG SRC="http://www.cern.ch/mmmservices/AntiSpam/nospam.aspx?email=CBP83JQFQq6%2fTOtBtq8e2lwa0GC8GQlRI5%2fPVbpSWP2FRDSZUVaQw90xXvaZA0DH"></div>\n'
+
+#Uncomment these two lines to print log for os.system operations 
+#print '<br> <font style="font-size:8pt"> Debug:',log
+#print '</font>'
+
+print '</body>\n</html>'
+
+c.close()
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/recreateDB.py b/LArCalorimeter/LArMonitoring/python/HVTripsDB/recreateDB.py
new file mode 100755
index 00000000000..d877efe441d
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/recreateDB.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python2.6
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+import os
+
+os.remove("trips.db")
+
+execfile("createDB.py")
+
+
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/recreateDetails.py b/LArCalorimeter/LArMonitoring/python/HVTripsDB/recreateDetails.py
new file mode 100755
index 00000000000..890ced597e4
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/recreateDetails.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python2.5
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+import sqlite3
+import datetime
+
+conn = sqlite3.connect('trips.db',detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
+#conn = sqlite3.connect('trips.db')
+
+c = conn.cursor()
+#c.execute('create table TRIPS (HVLINE INTEGER,TripTimeStamp LONG INTEGER,TripRunNumber INTEGER,TripLB INTEGER,StableZero INTEGER,RampUp INTEGER,RecoveryTimeStamp LONG INTEGER,RecoveryRunNumber INTEGER,RecoveryLB INTEGER, StableBeams TEXT,FillNumber INTEGER,NumCollBunches INTEGER,Solenoid TEXT,Toroid TEXT)')
+#cmd = 'insert into TRIPS values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)'
+
+#f = file('trips2.dat','r')
+
+#for l in f:
+#  a = l.split()
+#  
+#  tripString = a[1]
+#  recoveryString = a[6]
+#  tripDateTime=datetime.datetime.strptime(tripString, '%Y-%m-%d:%H:%M:%S')
+#  recoveryDateTime=datetime.datetime.strptime(recoveryString, '%Y-%m-%d:%H:%M:%S')
+#  b = (a[0],tripDateTime.strftime('%Y-%m-%d %H:%M:%S'),a[2],a[3],a[4],a[5],recoveryDateTime.strftime('%Y-%m-%d %H:%M:%S'),a[7],a[8],a[9].upper(),a[10],a[11],a[12].upper(),a[13].upper())
+#  c.execute( cmd,b )
+
+#  print b
+#conn.commit()
+
+c.execute('drop table DETAILS')
+c.execute('create table DETAILS (HVLINE INTEGER PRIMARY KEY,Module INTEGER,Channel INTEGER,Det TEXT,Side TEXT,PhiWedge INTEGER,SubPhiWedge INTEGER,EtaSector INTEGER,ElectrodeSide TEXT,Map TEXT, PoweredElectrodes INTEGER, status STRING)')
+
+f2 = file('hvdetails.dat','r')
+
+cmd =  'insert into DETAILS values (?,?,?,?,?,?,?,?,?,?,?,?)'
+for l2 in f2:
+  a = l2.split()
+
+  if a[0][0] =='#':
+    print 'ignoring comment'
+  else:
+    side = a[4][0]
+    phiWedge= a[4][1:]
+    sector=0
+    if len(a[6]) == 2:
+      sector=a[6][1]
+  
+    b = (a[0],a[1],a[2],a[3],side,phiWedge,a[5],sector,a[7],a[8],a[9],a[10])
+    c.execute( cmd,b )
+
+conn.commit()
+conn.close()
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/runHVChecks.py b/LArCalorimeter/LArMonitoring/python/HVTripsDB/runHVChecks.py
new file mode 100644
index 00000000000..d56d5f96261
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/runHVChecks.py
@@ -0,0 +1,12 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+import CheckHVStatus_daily
+import os
+import subprocess as sp
+
+for day in range(14,26):
+    date = "2011-03-%02d:07:30:00" % day
+    print date
+    sp.Popen("python CheckHVStatus_daily.py %s" % date,shell=True)
+    
+print "done!"
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/status.py b/LArCalorimeter/LArMonitoring/python/HVTripsDB/status.py
new file mode 100755
index 00000000000..30c14d4dbfd
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/status.py
@@ -0,0 +1,51 @@
+#!/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+#  Usage:
+#    python status.py STATUSCODE
+#
+#  Exmple:
+#    python status.py 19456
+#  returns:
+#     Status 19456:
+#     Channel ON, Ramping, Current Limit Error
+#
+#
+# stolen parsing part from Walter Lamp's script
+# ~/public/HVTripsDB/CheckHVStatus_daily.py
+
+import sys
+
+def printStatus(stat):
+
+    if stat & 0x400:
+        result="Channel ON"
+    else:
+        result="Channel OFF"
+    
+    if stat & 1:
+        result+= ", Current Trip"
+    if stat & 2:
+        result+= ", Sum error"
+    if stat & 0x200:
+        result+= ", Input error"
+    if stat & 0x800:
+        result+=", Ramping"
+    if stat & 0x1000:
+        result+=", Emergency stop"
+    if stat & 0x2000:
+        result+=", Kill enable"
+    if stat & 0x4000:
+        result+= ", Current Limit Error"
+    if stat & 0x8000:
+        result+= ", Voltage Limit Error"
+    return result
+
+#print sys.argv.length
+
+if len(sys.argv)-1:
+    print
+    print "   Status",sys.argv[1],":"
+    print "    ",printStatus(int(sys.argv[1]))
+    print
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/styles.css b/LArCalorimeter/LArMonitoring/python/HVTripsDB/styles.css
new file mode 100755
index 00000000000..5d72ea9b8af
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/styles.css
@@ -0,0 +1,128 @@
+html,body {
+    border-collapse:collapse;
+    padding:0px;
+    margin:0px;
+    text-decoration:none;
+    font-family:"Calibri";
+    font-size:15px;
+    height:100%;
+}
+
+.form label {
+  margin-left: 10px;
+  color: #666;
+}
+
+input, textarea {
+  padding: 9px;
+  border: solid 1px #AAA;
+  outline: 0;
+  width: 100px;
+  background: #fff;
+}
+
+textarea {
+  width: 600px;
+  max-width: 600px;
+  height: 100px;
+  line-height: 150%;
+}
+
+input:hover, textarea:hover,
+input:focus, textarea:focus {
+   border-color: #222;
+}
+
+
+a {
+    text-decoration:none;
+}
+
+td, pre {
+    padding:0px;
+    border-collapse:collapse;
+}
+
+div {
+    margin:0px;
+    font-size:10px;
+}
+
+input {
+    border-collapse:collapse;
+    padding:0px;
+    margin:0px;
+    font-size:10px;
+}
+
+select {
+    border-collapse:collapse;
+    text-align:center;
+    padding:0px;
+    margin:0px;
+    font-size:10px;
+    width:5
+}
+
+
+table {
+    border-collapse:collapse;
+    text-align:center;
+    padding:0px;
+    font-size:13px;
+}
+
+table.list {
+    font-family:"Calibri";
+    padding:1px;
+    background: #FF8000;
+    font-weight: bold;
+    font-size: 12px;
+    table-layout: fixed;
+}
+
+table.list td {
+    padding:1px;
+    border: 1px solid white;
+}
+
+td.EMB { color: #AEB404 ; font-weight: bold;}
+td.EMEC { color: #5FB404 ; font-weight: bold; }
+td.EMBPS { color: #01DFD7 ; font-weight: bold;  font-size: 100%;}
+
+td.HEC { color: #FF00FF ;font-weight: bold;}
+td.FCAL {color: #9A2EFE ;font-weight: bold;}
+
+td.A { color: #DF01D7 ; font-weight: bold;}
+td.C { color: #088A85 ; font-weight: bold;}
+
+td.Y { color: #FF0000 ; font-weight: bold;}
+td.N { color: #0000FF ; font-weight: bold;}
+
+table.list pre { 
+    margin:0px;
+}
+
+body.thick {font-weight:bold;}
+
+td.mag {  -webkit-transform: rotate(90deg); 
+	  -moz-transform: rotate(90deg);}
+td.vert {writing-mode: tb-rl; }
+
+tr.g0 { background: #F6E3CE;  font-size: 90%; font-weight: normal;}
+tr.g1 { background: #F7BE81;  font-size: 90%; font-weight: normal;}
+tr.g2 { background: #FFFF00;  font-size: 90%; font-weight: normal;}
+tr.f1 { background: #FF8000;  font-size: 50%; font-weight: normal;}
+
+
+.wrapper {
+    min-height: 100%;
+    height: 100%;
+    height: auto !important;
+    margin: 0px 0px -30px 5px;
+}
+
+.footer, .push {
+    height: 30px;
+    margin: auto 5px;
+}
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/trips.dat b/LArCalorimeter/LArMonitoring/python/HVTripsDB/trips.dat
new file mode 100755
index 00000000000..32fe94205bd
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/trips.dat
@@ -0,0 +1,383 @@
+259012 2012-03-24:20:48:47 200156 181 -1 181 2012-03-24:20:49:16 200156 182 N 2401 0 ON ON
+36006 2012-03-30:19:46:23 200498 435 -1 435 2012-03-30:19:49:59 200498 438 N 2428 1 ON ON
+73015 2012-04-02:21:57:25 200730 77 -1 77 2012-04-02:22:01:29 200730 81 N 2448 1 ON ON 
+124000 2012-04-03:22:44:10 200768 240 247 257 2012-04-03:23:08:26 200768 266 N 2461 0 ON ON
+315008 2012-04-05:21:39:51 200863 166 166 351 2012-04-06:00:44:36 200863 367 Y 2472 72 ON ON 
+36006 2012-04-05:22:02:46 200863 192 -1 193 2012-04-05:22:06:22 200863 197 Y 2472 72 ON ON 
+132006 2012-04-05:20:20:10 200863 84 -1 85 2012-04-05:20:22:44 200863 87 Y 2472 72 ON ON 
+237005 2012-04-05:20:12:24 200863 75 -1 75 2012-04-05:20:30:36 200863 96 Y 2472 72 ON ON 
+18004 2012-04-05:17:06:07 200842 48 -1 48 2012-04-05:17:07:28 200842 50 Y 2471 28 ON ON 
+110005 2012-04-05:21:30:59 200863 157 -1 157 2012-04-05:21:33:49 200863 159 Y 2472 72 ON ON 
+65014 2012-04-06:03:05:57 200899 45 -1 -1 9999-12-31:23:00:00 0 0 N 2473 1 ON ON
+73015 2012-04-05:23:52:07 200863 312 -1 312 2012-04-06:00:07:11 200863 327 Y 2472 72 ON ON 
+339003 2012-04-06:15:51:19 200913 161 170 -1 9999-12-31:23:00:00 0 0 Y 2479 72 ON ON
+267006 2012-04-06:17:49:38 200913 292 293 -1 9999-12-31:23:00:00 0 0 Y 2479 72 ON ON 
+267006 2012-04-07:02:09:26 200926 319 320 -1 9999-12-31:23:00:00 0 0 Y 2482 249 ON ON 
+239006 2012-04-07:04:16:56 200926 467 -1 468 2012-04-07:04:36:20 200926 490 Y 2482 249 ON ON 
+237006 2012-04-07:04:17:07 200926 468 -1 469 2012-04-07:04:40:03 200926 492 Y 2482 249 ON ON 
+276002 2012-04-06:15:49:24 200913 159 160 -1 9999-12-31:23:00:00 0 0 Y 2479 72 ON ON 
+276002 2012-04-07:02:07:57 200926 317 318 -1 9999-12-31:23:00:00 0 0 Y 2482 249 ON ON 
+110007 2012-04-07:04:49:45 200926 501 -1 502 2012-04-07:04:50:22 200926 503 Y 2482 249 ON ON 
+259012 2012-04-07:04:09:14 200926 459 515 460 9999-12-31:23:00:00 0 0 Y 2482 249 ON ON 
+233013 2012-04-08:02:27:52 200967 295 -1 296 2012-04-08:02:41:15 200967 310 Y 2488 249 ON ON 
+65004 2012-04-08:04:17:19 200967 410 -1 411 2012-04-08:04:19:11 200967 412 Y 2488 249 ON ON 
+276002 2012-04-07:20:21:17 200965 94 -1 -1 9999-12-31:23:00:00 0 0 Y 2486 72 ON ON
+41000 2012-04-07:17:44:38 0 0 -1 -1 2012-04-07:17:44:45 0 0 N 2486 0 ON ON
+18004 2012-04-07:17:44:38 0 0 -1 -1 2012-04-07:17:44:46 0 0 N 2486 0 ON ON
+22007 2012-04-08:09:37:42 200967 747 749 0 9999-12-31:23:00:00 0 0 Y 2489 249 ON ON 
+313010 2012-04-08:18:46:40 200987 52 53 -1 9999-12-31:23:00:00 0 0 Y 2491 618 ON ON 
+170012 2012-04-08:12:37:21 0 0 0 0 9999-12-31:23:00:00 0 0 N 2490 0 ON ON 
+178009 2012-04-08:13:04:49 0 0 -1 0 2012-04-08:13:10:06 0 0 N 2490 0 ON ON 
+73015 2012-04-08:15:41:02 200982 129 -1 130 2012-04-08:15:44:15 200982 132 Y 2490 249 ON ON 
+73015 2012-04-09:01:26:27 200987 462 -1 463 2012-04-09:01:29:35 200987 467 Y 2491 618 ON ON 
+142011 2012-04-09:02:41:48 200987 571 -1 571 2012-04-09:02:50:36 200987 579 Y 2491 618 ON ON
+51002 2012-04-08:15:33:48 200982 122 -1 123 2012-04-08:15:35:14 200982 124 Y 2490 249 ON ON 
+237014 2012-04-08:15:44:19 200982 132 -1 132 2012-04-08:16:13:00 0 0 Y 2490 249 ON ON 
+69004 2012-04-09:11:47:54 201006 161 -1 162 2012-04-09:12:02:58 201006 177 Y 2493 618 ON ON 
+105006 2012-04-10:05:06:19 201052 201 -1 222 2012-04-10:05:26:03 201052 232 Y 2497 618 ON ON 
+145014 2012-04-09:12:05:15 201006 180 -1 181 2012-04-09:12:09:25 201006 185 Y 2493 618 ON ON 
+259012 2012-04-12:06:44:22 0 0 -1 -1 9999-12-31:23:00:00 0 0 N 2506 0 ON ON 
+105006 2012-04-11:08:16:47 201120 306 324 -1 9999-12-31:23:00:00 0 0 Y 2501 618 ON ON 
+261014 2012-04-12:00:29:08 201138 676 -1 677 2012-04-12:00:45:31 201138 692 Y 2505 618 ON ON 
+267006 2012-04-12:18:06:37 201190 226 227 -1 9999-12-31:23:00:00 0 0 Y 2508 807 ON ON 
+76001 2012-04-13:22:05:11 201257 48 -1 49 2012-04-13:22:14:41 201257 58 N 2512 0 ON ON 
+76001 2012-04-14:03:15:14 201257 362 -1 363 2012-04-14:03:24:30 201257 373 Y 2513 1054 ON ON 
+76001 2012-04-14:04:30:17 201257 442 454 443 9999-12-31:23:00:00 0 0 Y 2513 1054 ON ON 
+76001 2012-04-14:04:48:24 201257 461 465 -1 9999-12-31:23:00:00 0 0 Y 2513 1054 ON ON 
+30010 2012-04-14:03:46:13 201257 395 421 -1 9999-12-31:23:00:00 0 0 Y 2513 1054 ON ON 
+145014 2012-04-14:03:36:44 201257 385 -1 386 2012-04-14:03:52:04 201257 401 Y 2513 1054 ON ON 
+30010 2012-04-15:01:19:52 0 0 -1 0 2012-04-15:01:20:26 0 0 N -1 0 ON ON 
+30010 2012-04-15:18:29:34 201289 287 -1 288 2012-04-15:18:34:09 201289 292 Y 2516 1051 ON ON 
+30010 2012-04-15:19:16:47 201289 336 344 337 9999-12-31:23:00:00 0 0 Y 2516 1051 ON ON 
+105006 2012-04-15:17:35:11 201289 232 -1 233 2012-04-15:17:40:59 201289 239 Y 2516 1051 ON ON 
+31004 2012-04-15:11:23:52 201280 147 -1 148 2012-04-15:11:28:03 201280 153 Y 2515 1051 ON ON 
+154002 2012-04-15:21:32:04 201289 476 -1 477 2012-04-15:21:33:03 201289 478 Y 2516 1051 ON ON 
+158006 2012-04-15:23:32:46 0 0 0 0 2012-04-16:00:13:31 0 0 N 2517 0 ON ON 
+102001 2012-04-16:17:58:02 201351 131 -1 132 2012-04-16:18:08:18 201351 142 N 2520 35 ON ON
+102001 2012-04-16:23:15:49 201351 456 -1 457 2012-04-16:23:25:56 201351 467 Y 2520 35 ON ON
+76001 2012-04-18:20:54:18 201489 66 79 67 9999-12-31:23:00:00 0 0 Y 2533 1331 ON ON 
+61010 2012-04-19:01:53:09 201489 374 -1 -1 2012-04-19:02:17:44 0 0 Y 2533 1331 ON ON 
+145014 2012-04-19:06:39:12 201494 51 -1 52 2012-04-19:06:54:33 201494 68 Y 2534 1331 ON ON 
+294014 2012-04-18:22:13:31 201489 153 154 -1 9999-12-31:23:00:00 0 0 Y 2533 1331 ON ON 
+65004 2012-04-20:06:02:46 201556 492 -1 493 2012-04-20:06:04:03 201556 495 Y 2536 1331 ON ON 
+30010 2012-04-20:05:33:09 201556 463 -1 464 2012-04-20:05:35:42 201556 466 Y 2536 1331 ON ON 
+100012 2012-04-19:09:19:44 201494 219 -1 220 2012-04-19:09:20:42 201494 221 Y 2534 1331 ON ON 
+62006 2012-04-19:20:00:04 201555 152 155 153 9999-12-31:23:00:00 0 0 Y 2535 1331 ON ON 
+62006 2012-04-19:21:17:01 201555 235 240 236 9999-12-31:23:00:00 0 0 N 2535 0 ON ON 
+30010 2012-04-20:11:15:36 201556 831 -1 832 2012-04-20:11:19:07 201556 836 Y 2536 1331 ON ON
+65004 2012-04-20:10:00:00 201556 746 -1 747 2012-04-20:10:01:16 201556 748 Y 2536 1331 ON ON 
+78001 2012-05-01:06:26:20 202609 306 319 -1 9999-12-31:23:00:00 0 0 N 2575 0 RAMP RAMP 
+51005 2012-05-01:05:56:19 202609 256 -1 256 2012-05-01:05:58:27 202609 260 Y 2574 75 ON ON
+343002 2012-05-01:05:43:06 202609 238 -1 -1 2012-05-01:05:43:18 202609 239 Y 2574 75 ON ON
+132002 2012-05-01:20:33:37 202660 340 -1 -1 2012-05-01:20:33:44 202660 340 Y 2576 75 ON ON 
+1000 2012-05-01:20:58:02 202660 368 -1 368 2012-05-01:20:58:55 202660 369 Y 2576 75 ON ON 
+13010 2012-05-02:10:44:33 202668 199 -1 199 2012-05-02:10:48:08 202668 202 Y 2580 471 ON ON 
+110007 2012-05-02:09:26:34 202668 114 -1 114 2012-05-02:09:29:22 202668 117 Y 2580 471 ON ON 
+110007 2012-05-02:09:48:21 202668 140 -1 140 2012-05-02:09:50:00 202668 141 Y 2580 471 ON ON 
+110007 2012-05-02:22:34:37 202712 300 -1 300 2012-05-02:22:37:32 202712 303 Y 2583 807 ON ON 
+110007 2012-05-03:05:28:34 202740 84 -1 85 2012-05-03:05:29:47 202740 86 Y 2584 807 ON ON 
+110007 2012-05-03:05:42:13 202740 101 -1 102 2012-05-03:05:43:52 202740 103 Y 2584 807 ON ON 
+152002 2012-05-03:22:27:54 202798 559 570 -1 2012-05-03:22:45:32 202798 0 Y 2587 807 ON ON 
+240006 2012-05-07:06:56:05 202991 287 -1 288 2012-05-07:07:18:55 202991 313 Y 2593 1051 ON ON 
+58000 2012-05-07:09:09:34 202991 428 434 570 2012-05-07:11:41:06 0 0 Y 2593 0 ON ON 
+69002 2012-05-08:06:45:47 203027 931 -1 932 2012-05-08:06:47:57 203027 934 Y 2596 1051 ON ON 
+61007 2012-05-07:19:01:57 203027 204 -1 205 2012-05-07:19:02:23 203027 206 N 2596 0 ON ON 
+61007 2012-05-09:06:43:05 203088 357 373 411 2012-05-09:07:56:20 203088 430 N 2603 0 ON ON 
+19004 2012-05-10:14:12:36 203184 1 -1 2 2012-05-10:14:13:00 203184 3 N 2607 24 ON ON 
+159013 2012-05-10:21:27:57 203195 127 -1 128 2012-05-10:21:30:08 203195 130 Y 2609 1331 ON ON 
+19004 2012-05-11:20:18:59 203256 54 -1 54 2012-05-11:20:19:26 203256 54 N 2617 0 ON ON 
+39005 2012-05-12:09:39:36 203258 101 -1 -1 2012-05-12:09:39:55 203258 101 Y 2621 1331 ON ON 
+39005 2012-05-12:21:29:57 203258 813 824 -1 9999-12-31:23:00:00 0 0 Y 2621 1331 ON ON 
+19003 2012-05-13:03:41:00 203277 98 -1 98 2012-05-13:03:41:22 203277 98 N 2623 1043 ON ON 
+19004 2012-05-13:03:40:44 203277 98 -1 98 2012-05-13:03:41:38 203277 99 N 2623 1043 ON ON 
+19006 2012-05-13:05:29:55 203277 212 -1 213 2012-05-13:05:30:49 203277 213 Y 2623 1331 ON ON 
+19007 2012-05-13:03:50:40 203277 107 -1 109 2012-05-13:03:51:47 203277 109 N 2623 1331 ON ON 
+19011 2012-05-13:04:22:25 203277 140 -1 140 2012-05-13:04:23:16 203277 140 N 2623 1331 ON ON 
+73001 2012-05-14:05:03:33 203336 273 -1 273 2012-05-14:05:06:55 203336 276 Y 2627 1331 ON ON 
+169005 2012-05-13:21:55:51 203335 220 -1 221 2012-05-13:22:01:40 203335 228 Y 2624 1331 ON ON 
+69002 2012-05-15:01:56:19 203353 489 -1 490 2012-05-15:01:58:36 203353 492 Y 2628 1331 ON ON 
+283001 2012-05-15:16:09:02 203432 229 229 -1 2012-05-15:20:45:44 0 0 Y 2629 1331 ON ON 
+65014 2012-05-15:23:22:19 203454 112 -1 -1 2012-05-15:23:22:23 203454 112 Y 2630 1331 ON ON 
+281001 2012-05-17:10:07:57 203524 256 275 -1 9999-12-31:23:00:00 0 0 Y 2635 1331 ON ON 
+283001 2012-05-17:07:57:07 203524 122 123 -1 9999-12-31:23:00:00 0 0 Y 2635 1331 ON ON 
+20005 2012-05-18:17:40:59 203602 258 -1 -1 2012-05-18:17:41:13 203602 258 Y 2644 1331 ON ON
+69002 2012-05-19:16:55:28 203636 293 -1 294 2012-05-19:16:57:13 203636 295 Y 2646 1377 ON ON 
+132003 2012-05-20:04:03:48 203636 978 -1 -1 2012-05-20:04:03:59 203636 978 Y 2646 1377 ON ON 
+132003 2012-05-20:05:07:03 203636 1043 -1 -1 2012-05-20:05:07:11 203636 1044 Y 2646 1377 ON ON 
+10004 2012-05-19:18:23:49 203636 386 -1 386 2012-05-19:18:26:13 203636 388 Y 2646 1377 ON ON 
+240014 2012-05-19:17:39:43 203636 340 -1 340 2012-05-19:17:57:01 203636 358 Y 2646 1377 ON ON 
+263006 2012-05-21:00:34:53 203681 39 -1 40 2012-05-21:00:36:28 203681 41 N 2649 0 ON ON 
+245007 2012-05-21:16:33:28 203719 266 -1 266 2012-05-21:16:38:43 203719 271 Y 2649 1377 ON ON 
+170002 2012-05-22:18:37:44 203745 175 -1 176 2012-05-22:18:38:50 203745 177 Y 2651 1377 ON ON 
+237014 2012-05-22:18:17:47 203745 154 -1 154 2012-05-22:18:37:23 203745 174 Y 2651 1377 ON ON 
+263006 2012-05-23:09:34:30 203760 230 -1 230 2012-05-23:09:58:24 203765 1 N 2653 0 ON ON 
+261006 2012-05-23:09:34:30 203760 230 -1 230 2012-05-23:09:58:24 203765 1 N 2653 0 ON ON 
+132003 2012-05-23:22:26:25 203779 548 -1 -1 2012-05-23:22:26:36 203779 548 Y 2657 1377 ON ON
+132003 2012-05-23:22:37:34 203779 560 -1 -1 2012-05-23:22:37:44 203779 561 Y 2657 1377 ON ON  
+178009 2012-05-23:18:55:23 203779 331 -1 331 2012-05-23:19:01:49 203779 338 Y 2657 1377 ON ON 
+65014 2012-05-25:04:51:58 203876 528 534 -1 9999-12-31:23:00:00 0 0 Y 2663 1380 ON ON 
+211015 2012-05-26:22:48:04 203989 220 246 306 2012-05-27:00:53:46 203989 347 N 2670 0 ON ON
+209015 2012-05-26:22:48:04 203989 220 251 258 2012-05-27:00:04:51 203989 299 N 2670 0 ON ON
+310007 2012-05-26:08:59:55 203934 812 815 -1 9999-12-31:23:00:00 0 0 Y 2670 0 ON ON 
+221008 2012-05-28:01:50:16 204025 162 -1 162 2012-05-28:01:59:09 204025 171 Y 2670 1380 ON ON 
+239006 2012-05-27:19:50:43 204024 376 -1 376 2012-05-27:20:08:01 204024 393 N 2670 0 ON ON 
+65004 2012-05-29:07:37:38 204073 218 227 218 2012-05-29:10:54:26 0 0 Y 2676 0 ON ON 
+230007 2012-05-29:12:13:34 0 0 -1 -1 2012-05-29:12:14:10 -1 -1 N 2676 0 ON ON 
+158002 2012-06-01:15:38:13 204240 710 712 -1 9999-12-31:23:00:00 0 0 Y 2691 1380 ON ON 
+148013 2012-06-01:14:07:01 204240 613 -1 613 2012-06-01:14:12:57 204240 619 Y 2691 1380 ON ON 
+132003 2012-06-02:12:24:22 204265 456 -1 -1 2012-06-02:12:24:36 204265 456 Y 2692 1380 ON ON
+54004 2012-06-02:12:06:57 204265 438 -1 438 2012-06-02:12:11:07 204265 442 Y 2692 1380 ON ON
+179009 2012-06-05:19:13:45 204474 582 -1 583 2012-06-05:19:15:42 204474 584 Y 2701 1377 ON ON
+148006 2012-06-05:07:52:09 204442 246 -1 246 2012-06-05:07:53:36 204442 248 Y 2700 1380 RAMP ON
+124013 2012-06-05:08:53:16 0 0 -1 -1 2012-06-05:08:53:27 0 0 N 2701 0 OFF ON
+78001 2012-06-05:07:51:58 204442 246 259 0 2012-06-05:08:45:05 0 0 Y 2700 1380 RAMP ON
+158002 2012-06-05:22:17:06 204474 776 -1 776 2012-06-05:22:24:43 204474 785 Y 2701 1377 ON ON
+150009 2012-06-05:10:01:25 204474 0 14 15 2012-06-05:10:40:06 204474 27 N 2701 1377 RAMP ON
+66013 2012-06-05:13:51:00 204474 249 -1 249 2012-06-05:13:53:31 204474 252 Y 2701 1377 ON ON
+150009 2012-06-06:10:30:28 204564 10 -1 10 2012-06-06:10:30:57 204564 10 N 2705 0 ON ON 
+150009 2012-06-06:10:32:34 204564 12 -1 12 2012-06-06:10:32:42 204564 12 N 2705 0 ON ON 
+150009 2012-06-06:10:33:28 204564 13 -1 13 2012-06-06:10:33:35 204564 13 N 2705 0 ON ON 
+171014 2012-06-08:03:12:58 204668 309 -1 309 2012-06-08:03:14:12 204668 310 Y 2712 1377 ON ON 
+161003 2012-06-09:15:00:55 204763 175 -1 176 2012-06-09:15:02:01 204763 177 Y 2717 1377 ON ON 
+205010 2012-06-09:14:22:49 204763 136 -1 136 2012-06-09:14:33:06 204763 146 Y 2717 1377 ON ON 
+158002 2012-06-10:18:58:39 204772 217 -1 218 2012-06-10:19:00:00 204772 219 Y 2718 1377 ON ON 
+132003 2012-06-10:16:21:55 204772 58 -1 -1 2012-06-10:16:22:08 204772 58 Y 2718 1377 ON ON 
+20005 2012-06-13:00:38:52 204932 246 -1 -1 2012-06-13:00:39:09 204932 246 Y 2726 1377 ON ON 
+228015 2012-06-13:03:55:10 204932 456 -1 456 2012-06-13:04:02:28 204932 465 Y 2726 1377 ON ON 
+333007 2012-06-13:05:10:06 204932 534 -1 -1 2012-06-13:05:10:17 204932 534 Y 2726 1377 ON ON 
+306006 2012-06-12:11:08:30 204910 383 383 1 2012-06-12:17:12:24 204913 4 Y 2725 1377 ON ON 
+103001 2012-06-12:10:10:02 204910 319 -1 320 2012-06-12:10:10:42 204910 320 Y 2725 1377 ON ON 
+241001 2012-06-12:14:03:05 204910 582 -1 582 2012-06-12:14:13:48 204910 593 Y 2725 1377 ON ON
+73001 2012-06-14:22:12:17 205010 187 -1 188 2012-06-14:22:17:04 205010 192 Y 2732 1377 ON ON 
+132003 2012-06-16:01:05:15 205055 442 -1 -1 2012-06-16:01:05:20 205055 443 Y 2734 1368 ON ON 
+55009 2012-06-16:13:48:56 205055 1217 1227 -1 9999-12-13:23:00:00 0 0  Y 2734 1368 ON ON 
+158002 2012-06-16:22:18:59 205071 354 -1 354 2012-06-16:22:20:20 205071 356 Y 2736 1368 ON ON 
+0 2012-06-19:17:04:16 205263 28 -1 28 2012-06-19:17:04:42 205263 29 N 2743 2 ON ON 
+217004 2012-06-21:08:41:18 0 0 -1 0 2012-06-21:08:42:11 0 0 N 2751 3 RAMP RAMP 
+107013 2012-06-22:16:19:18 0 0 -1 0 2012-06-22:16:19:58 0 0 N 2756 1 OFF OFF 
+48009 2012-07-02:03:52:48 206248 494 -1 495 2012-07-02:03:55:21 206248 498 N 2795 0 ON OFF 
+313005 2012-07-02:01:27:37 206248 145 146 -1 9999-12-31:23:00:00 0 0 N 2795 72 ON OFF 
+313005 2012-07-02:06:45:09 206253 32 33 -1 9999-12-31:23:00:00 0 0 N 2797 471 ON OFF 
+10008 2012-07-02:19:47:22 206299 70 -1 71 2012-07-02:20:00:54 206299 85 Y 2798 807 ON ON 
+165006 2012-07-02:08:16:37 206253 137 -1 138 2012-07-02:08:20:53 206253 142 Y 2797 471 ON OFF 
+6008 2012-07-02:19:47:23 206299 70 72 -1 9999-12-31:23:00:00 0 0 Y 2798 807 ON ON 
+154014 2012-07-03:21:38:53 206367 44 -1 45 2012-07-03:21:40:24 206367 47 Y 2805 807 RAMP RAMP 
+66013 2012-07-04:11:18:53 206369 299 -1 300 2012-07-04:11:20:29 206369 301 Y 2806 1368 ON ON
+256012 2012-07-07:09:11:24 206554 58 -1 58 2012-07-07:09:14:07 206554 60 N 2815 3 OFF RAMP 
+237006 2012-07-08:02:52:24 206573 32 -1 33 2012-07-08:03:13:34 206573 54 Y 2816 1368 ON RAMP 
+173010 2012-07-07:17:58:37 206564 135 -1 136 2012-07-07:17:59:45 206564 137 Y 2816 1368 ON OFF 
+10008 2012-07-07:13:04:37 206554 297 -1 298 2012-07-07:13:16:45 206554 310 N 2815 3 RAMP OFF 
+169014 2012-07-15:01:09:18 206971 322 -1 323 2012-07-15:01:12:41 206971 326 Y 2843 1368 ON ON 
+163002 2012-07-16:00:41:00 207046 135 -1 136 2012-07-16:00:44:01 207046 140 Y 2848 1368 ON ON 
+102011 2012-07-16:03:14:38 207046 309 -1 309 2012-07-16:03:15:28 207046 309 Y 2848 1368 ON ON 
+228015 2012-07-15:19:22:21 207044 245 -1 246 2012-07-15:19:28:07 207044 254 Y 2847 1368 ON ON 
+318000 2012-07-20:15:04:32 207221 835 835 0 2012-07-20:20:45:11 0 0 Y 2858 1368 ON ON 
+102011 2012-07-22:16:55:58 0 0 -1 0 2012-07-22:16:56:38 0 0 N 2872 0 ON ON 
+3 2012-07-23:07:45:52 207332 823 -1 824 2012-07-23:07:56:00 207332 834 Y 2872 1368 ON ON 
+158014 2012-07-24:02:43:04 207397 484 492 -1 9999-12-31:23:00:00 0 0 Y 2873 1368 ON ON 
+322000 2012-07-23:07:45:49 207332 823 -1 -1 2012-07-23:07:45:50 207332 823 Y 2872 1368 ON ON 
+163009 2012-07-25:09:45:13 0 0 -1 0 2012-07-25:09:47:53 0 0 N 2876 0 ON ON 
+54013 2012-07-26:07:44:17 207490 788 -1 788 2012-07-26:07:47:23 207490 791 Y 2880 1368 ON ON 
+62002 2012-07-27:07:56:27 207532 135 -1 135 2012-07-27:07:58:22 207532 137 Y 2884 1368 ON ON 
+132003 2012-07-29:22:13:49 207664 414 439 -1 9999-12-31:23:00:00 0 0 Y 2891 1368 ON ON 
+132003 2012-07-31:19:45:02 207809 339 363 400 2012-07-31:21:01:28 207809 419 Y 2898 1368 ON ON 
+158006 2012-08-01:03:51:14 207809 830 -1 831 2012-08-01:04:20:42 207809 861 Y 2898 1368 ON ON 
+139009 2012-08-01:23:59:28 207864 188 215 -1 9999-12-31:23:00:00 0 0 Y 2902 1368 ON ON 
+4004 2012-08-02:06:36:18 207865 179 -1 180 2012-08-02:06:48:58 207865 191 Y 2902 1368 ON ON 
+223013 2012-08-02:00:18:40 207864 212 -1 213 2012-08-02:00:29:44 207864 224 Y 2902 1368 ON ON 
+171014 2012-08-01:08:57:56 207809 1140 -1 1141 2012-08-01:08:59:16 207809 1144 N 2898 1368 ON ON 
+8004 2012-08-02:06:36:20 207865 179 -1 180 2012-08-02:06:39:00 207865 182 Y 2902 1368 ON ON 
+102011 2012-08-02:05:28:59 207865 108 -1 109 2012-08-02:05:29:42 207865 110 Y 2902 1368 ON ON 
+161013 2012-08-02:14:48:42 207884 82 -1 83 2012-08-02:14:51:22 207884 86 N 2904 1 ON ON 
+8004 2012-08-04:16:44:03 207982 169 -1 170 2012-08-04:16:45:50 207982 172 Y 2912 1368 ON ON 
+4004 2012-08-04:16:44:05 207982 169 -1 170 2012-08-04:16:46:19 207982 173 Y 2912 1368 ON ON 
+61012 2012-08-04:10:29:58 207975 653 -1 654 2012-08-04:10:31:59 207975 656 Y 2911 1368 ON ON 
+61013 2012-08-04:10:25:48 207975 649 -1 650 2012-08-04:10:26:45 207975 651 Y 2911 1368 ON ON 
+161001 2012-08-06:22:41:44 208123 472 -1 473 2012-08-06:22:43:19 208123 474 Y 2918 1368 ON ON 
+163002 2012-08-08:13:55:57 208189 227 -1 228 2012-08-08:13:57:02 208189 229 Y 2928 1368 ON ON 
+166006 2012-08-08:21:47:30 208258 271 -1 272 2012-08-08:21:54:38 208258 279 Y 2929 1368 ON ON 
+333007 2012-08-13:04:36:10 208485 261 -1 -1 2012-08-13:04:36:21 208485 262 Y 2957 1368 ON ON 
+4004 2012-08-16:00:35:34 208662 449 -1 449 2012-08-16:00:37:19 208662 450 Y 2976 1368 ON ON 
+142011 2012-08-15:16:29:37 208642 254 -1 -1 2012-08-15:16:29:47 208642 255 Y 2975 465 ON ON 
+8004 2012-08-16:00:35:32 208662 449 -1 449 2012-08-16:00:36:52 208662 450 Y 2976 1368 ON ON
+208011 2012-08-18:13:22:15 208811 249 -1 250 2012-08-18:13:29:14 208811 260 Y 2984 1368 ON ON 
+102011 2012-08-21:00:53:49 208931 161 -1 162 2012-08-21:01:02:12 208931 170 Y 2991 1368 ON ON 
+132003 2012-08-20:20:53:58 208930 221 -1 -1 2012-08-20:20:54:09 208930 222 Y 2991 1368 ON ON 
+64013 2012-08-21:05:32:12 208931 445 -1 446 2012-08-21:05:37:16 208931 453 Y 2991 1368 ON ON 
+317005 2012-08-20:19:04:12 208930 106 107 -1 9999-12-31:23:00:00 0 0 Y 2991 1368 ON ON 
+170012 2012-08-21:17:19:25 208970 319 323 -1 2012-08-21:23:42:09 0 0 Y 2992 1368 ON ON 
+317004 2012-08-21:21:02:37 208970 545 546 0 2012-08-21:23:39:13 0 0 Y 2992 1368 ON ON 
+64013 2012-08-21:08:21:18 208931 632 -1 632 2012-08-21:08:26:11 208931 636 N 2991 0 ON ON 
+166006 2012-08-22:13:55:11 208982 800 -1 800 2012-08-22:14:02:49 208982 809 Y 2993 1368 ON ON 
+168005 2012-08-23:18:13:44 209074 183 192 315 2012-08-23:20:34:31 209082 1 Y 2996 1368 ON ON 
+153015 2012-08-24:06:02:30 209109 33 -1 33 2012-08-24:06:10:51 209109 41 N 2998 0 ON ON 
+161003 2012-08-25:21:13:46 209183 993 -1 994 2012-08-25:21:15:14 209183 995 Y 3002 1368 ON ON 
+161003 2012-08-25:21:27:53 209183 1007 -1 1007 2012-08-25:21:29:54 209183 1009 Y 3002 1368 ON ON 
+161003 2012-08-25:21:44:04 209183 1023 1027 -1 2012-08-25:22:42:08 209203 2 Y 3002 1368 ON ON 
+161003 2012-08-26:01:49:48 209214 112 -1 112 2012-08-26:01:53:29 209214 116 Y 3003 1368 ON ON 
+161003 2012-08-26:01:58:13 209214 123 125 -1 2012-08-26:03:10:13 0 0 Y 3003 1368 ON ON 
+161003 2012-08-26:07:29:54 209252 1 -1 1 2012-08-26:07:38:54 209252 9 N 3005 0 ON ON 
+161003 2012-08-26:09:10:39 209254 48 55 -1 2012-08-26:17:43:55 0 0 Y 3005 1368 ON ON 
+206015 2012-08-27:20:55:12 209353 30 -1 -1 2012-08-27:20:55:42 209353 30 N 3009 0 ON ON 
+10004 2012-08-28:08:00:13 209381 503 -1 504 2012-08-28:08:01:06 209381 504 Y 3011 1368 ON ON 
+75014 2012-08-28:09:11:25 209381 585 -1 586 2012-08-28:09:26:31 209381 603 Y 3011 1368 ON ON 
+30011 2012-08-31:00:41:50 209550 340 -1 -1 2012-08-31:00:42:04 209550 341 Y 3016 1368 ON ON 
+317005 2012-08-31:00:10:21 209550 297 -1 298 2012-08-31:00:10:57 209550 298 Y 3016 1368 ON ON 
+317005 2012-08-31:00:13:02 209550 300 300 -1 9999-12-31:23:00:00 0 0 Y 3016 1368 ON ON 
+317005 2012-08-31:19:54:05 209580 499 500 -1 2012-09-01:08:23:55 0 0 Y 3016 1368 ON ON
+154011 2012-09-02:12:51:44 209629 414 -1 415 2012-09-02:12:55:31 209629 419 Y 3021 1368 ON ON 
+318009 2012-09-02:09:42:50 209629 212 213 -1 2012-09-02:23:51:25 209644 4 Y 3021 1368 ON ON 
+318010 2012-09-02:09:42:51 209629 212 278 246 9999-12-31:23:00:00 0 0 Y 3021 1368 ON ON 
+318011 2012-09-02:09:42:51 209629 212 213 -1 2012-09-02:23:51:25 209644 4 Y 3021 1368 ON ON 
+318003 2012-09-02:09:42:48 209629 212 213 -1 2012-09-02:23:51:25 209644 4 Y 3021 1368 ON ON 
+316004 2012-09-02:09:42:49 209629 212 213 -1 2012-09-02:23:37:40 209644 1 Y 3021 1368 ON ON 
+316010 2012-09-02:10:06:57 209629 237 255 240 9999-12-31:23:00:00 0 0 Y 3021 1368 ON ON 
+146004 2012-09-04:04:45:56 209736 723 -1 -1 2012-09-04:04:46:29 209736 724 Y 3025 1368 ON ON
+132003 2012-09-04:04:16:19 209736 693 -1 -1 2012-09-04:04:16:32 209736 694 Y 3025 1368 ON ON
+79004 2012-09-05:02:53:00 209787 378 -1 379 2012-09-05:02:58:42 209787 388 Y 3029 1368 ON ON 
+317004 2012-09-05:00:24:26 209787 207 217 -1 2012-09-05:07:11:11 0 0 Y 3029 1368 ON ON 
+317004 2012-09-05:16:33:32 209812 394 394 -1 9999-12-31:23:00:00 0 0 Y 3032 1368 ON ON 
+317012 2012-09-05:18:34:34 209812 527 528 -1 2012-09-06:07:45:33 209863 287 Y 3032 1368 ON ON 
+139014 2012-09-08:03:05:31 209937 7 21 -1 2012-09-08:03:20:36 209937 23 N 3040 0 ON ON 
+139014 2012-09-08:03:20:56 209937 24 26 24 2012-09-08:03:24:17 209937 28 N 3040 1 ON ON 
+139014 2012-09-08:03:25:00 209937 31 -1 -1 2012-09-08:03:27:59 209937 34 N 3040 1 ON ON 
+139014 2012-09-08:03:28:18 209937 35 36 35 2012-09-08:03:32:49 209937 39 N 3040 1 ON ON 
+139014 2012-09-08:03:32:59 209937 39 46 -1 2012-09-08:03:43:12 209937 49 N 3040 0 ON ON 
+171014 2012-09-07:08:07:33 209899 270 -1 271 2012-09-07:08:08:47 209899 272 Y 3036 1368 ON ON 
+318006 2012-09-07:15:07:53 0 0 -1 0 2012-09-07:15:14:44 0 0 N 3037 0 ON ON 
+132003 2012-09-09:19:47:20 209994 447 -1 -1 2012-09-09:19:47:31 209994 448 Y 3047 1368 ON ON 
+4004 2012-09-15:19:41:30 210302 218 -1 219 2012-09-15:19:43:29 210302 220 N 3067 1368 ON ON 
+318002 2012-09-15:19:29:46 210302 206 217 -1 9999-12-31:23:00:00 0 0 N 3067 1368 ON ON 
+132003 2012-09-15:20:13:36 210302 252 -1 -1 2012-09-15:20:13:49 210302 253 Y 3067 1368 ON ON 
+8004 2012-09-15:19:41:29 210302 218 -1 219 2012-09-15:19:42:48 210302 220 N 3067 1368 ON ON 
+316003 2012-09-15:20:51:05 210302 294 296 -1 9999-12-31:23:00:00 0 0 Y 3067 1368 ON ON 
+65014 2012-09-16:20:00:54 210308 583 -1 -1 2012-09-16:20:17:49 210308 584 N 3071 1368 ON ON 
+284015 2012-09-26:14:50:45 211522 186 189 193 2012-09-26:15:03:51 211522 220 Y 3087 72 ON ON 
+286015 2012-09-26:14:50:45 211522 186 189 192 2012-09-26:15:02:46 211522 216 Y 3087 72 ON ON 
+82000 2012-09-29:06:09:55 211697 265 -1 -1 2012-09-29:06:09:56 211697 266 N 3110 1368 ON ON 
+82002 2012-09-29:06:09:55 211697 265 -1 -1 2012-09-29:06:09:56 211697 266 N 3110 1368 ON ON 
+82003 2012-09-29:06:09:55 211697 265 -1 -1 2012-09-29:06:09:56 211697 266 N 3110 1368 ON ON 
+82004 2012-09-28:07:51:08 211620 788 -1 -1 2012-09-28:07:51:09 211620 789 N 3108 801 ON ON 
+82004 2012-09-28:18:28:12 211670 105 -1 -1 2012-09-28:18:28:13 211670 106 N 3109 720 ON ON 
+82004 2012-09-28:22:31:02 211670 447 -1 -1 2012-09-28:22:31:03 211670 448 Y 3109 720 ON ON 
+82006 2012-09-28:07:51:09 211620 788 -1 -1 2012-09-28:07:51:10 211620 789 N 3108 801 ON ON 
+82006 2012-09-28:18:28:15 211670 105 -1 -1 2012-09-28:18:28:16 211670 106 N 3109 720 ON ON 
+82007 2012-09-28:07:51:09 211620 788 -1 -1 2012-09-28:07:51:10 211620 789 N 3108 801 ON ON 
+82007 2012-09-28:18:28:16 211670 105 -1 -1 2012-09-28:18:28:17 211670 106 N 3109 720 ON ON 
+83000 2012-09-28:07:51:41 211620 790 -1 -1 2012-09-28:07:51:42 211620 791 N 3108 801 ON ON 
+83000 2012-09-29:06:09:53 211697 265 -1 -1 2012-09-29:06:09:54 211697 266 N 3110 1368 ON ON 
+83001 2012-09-28:07:51:41 211620 790 -1 -1 2012-09-28:07:51:42 211620 791 N 3108 801 ON ON 
+83001 2012-09-29:06:09:53 211697 265 -1 -1 2012-09-29:06:09:54 211697 266 N 3110 1368 ON ON 
+83002 2012-09-28:07:51:07 211620 788 -1 -1 2012-09-28:07:51:08 211620 789 N 3108 801 ON ON 
+83002 2012-09-29:06:10:11 211697 266 -1 -1 2012-09-29:06:10:12 211697 267 N 3110 1368 ON ON 
+83005 2012-09-28:07:51:08 211620 788 -1 -1 2012-09-28:07:51:09 211620 789 N 3108 801 ON ON 
+83005 2012-09-28:18:28:11 211670 105 -1 -1 2012-09-28:18:28:12 211670 106 N 3109 720 ON ON 
+83005 2012-09-28:22:17:53 211670 431 -1 -1 2012-09-28:22:17:53 211670 432 Y 3109 720 ON ON 
+83005 2012-09-29:06:09:54 211697 265 -1 -1 2012-09-29:06:09:55 211697 266 N 3110 1368 ON ON 
+83007 2012-09-28:18:28:12 211670 105 -1 -1 2012-09-28:18:28:13 211670 106 N 3109 720 ON ON 
+182000 2012-09-28:07:51:09 211620 788 -1 -1 2012-09-28:07:51:10 211620 789 N 3108 801 ON ON 
+182000 2012-09-28:18:28:11 211670 105 -1 -1 2012-09-28:18:28:12 211670 106 N 3109 720 ON ON 
+182001 2012-09-28:07:51:09 211620 788 -1 -1 2012-09-28:07:51:10 211620 789 N 3108 801 ON ON 
+182001 2012-09-28:18:28:11 211670 105 -1 -1 2012-09-28:18:28:12 211670 106 N 3109 720 ON ON 
+182001 2012-09-28:22:31:03 211670 447 -1 -1 2012-09-28:22:31:04 211670 448 Y 3109 720 ON ON 
+182002 2012-09-28:07:51:09 211620 788 -1 -1 2012-09-28:07:51:10 211620 789 N 3108 801 ON ON 
+182002 2012-09-28:18:28:12 211670 105 -1 -1 2012-09-28:18:28:13 211670 106 N 3109 720 ON ON 
+182004 2012-09-28:22:17:51 211670 431 -1 -1 2012-09-28:22:17:52 211670 432 Y 3109 720 ON ON 
+182004 2012-09-29:06:09:56 211697 265 -1 -1 2012-09-29:06:09:59 211697 266 N 3110 1368 ON ON 
+182005 2012-09-28:22:17:51 211670 431 -1 -1 2012-09-28:22:17:52 211670 432 Y 3109 720 ON ON 
+182005 2012-09-29:06:09:57 211697 265 -1 -1 2012-09-29:06:09:58 211697 266 N 3110 1368 ON ON 
+182006 2012-09-29:06:09:57 211697 265 -1 -1 2012-09-29:06:09:59 211697 266 N 3110 1368 ON ON 
+183000 2012-09-28:07:51:07 211620 788 -1 -1 2012-09-28:07:51:08 211620 789 N 3108 801 ON ON 
+183000 2012-09-28:18:28:15 211670 105 -1 -1 2012-09-28:18:28:16 211670 106 N 3109 720 ON ON 
+183001 2012-09-28:07:51:07 211620 788 -1 -1 2012-09-28:07:51:08 211620 789 N 3108 801 ON ON 
+183001 2012-09-28:18:28:15 211670 105 -1 -1 2012-09-28:18:28:16 211670 106 N 3109 720 ON ON 
+183001 2012-09-29:06:09:54 211697 265 -1 -1 2012-09-29:06:09:55 211697 266 N 3110 1368 ON ON 
+183002 2012-09-28:07:51:30 211620 789 -1 -1 2012-09-28:07:51:31 211620 790 N 3108 801 ON ON 
+183002 2012-09-28:18:28:44 211670 106 -1 -1 2012-09-28:18:28:45 211670 107 N 3109 720 ON ON 
+183003 2012-09-28:07:51:07 211620 788 -1 -1 2012-09-28:07:51:08 211620 789 N 3108 801 ON ON 
+183004 2012-09-29:06:09:54 211697 265 -1 -1 2012-09-29:06:09:55 211697 266 N 3110 1368 ON ON 
+183005 2012-09-28:07:51:08 211620 788 -1 -1 2012-09-28:07:51:09 211620 789 N 3108 801 ON ON 
+183005 2012-09-28:22:18:01 211670 431 -1 -1 2012-09-28:22:18:02 211670 432 Y 3109 720 ON ON 
+183005 2012-09-28:22:31:01 211670 447 -1 -1 2012-09-28:22:32:02 211670 448 Y 3109 720 ON ON 
+183006 2012-09-29:06:10:09 211697 266 -1 -1 2012-09-29:06:10:10 211697 267 N 3110 1368 ON ON 
+175010 2012-09-29:06:51:29 211697 313 -1 314 2012-09-29:06:55:58 211697 320 Y 3110 1368 ON ON
+8004 2012-09-29:06:09:42 211697 265 -1 -1 2012-09-29:06:10:21 211697 267 N 3110 1368 ON ON 
+182004 2012-09-30:05:12:00 211772 415 -1 -1 2012-09-30:05:12:01 211772 416 N 3113 1368 ON ON 
+182005 2012-09-30:05:12:01 211772 415 -1 -1 2012-09-30:05:12:02 211772 416 N 3113 1368 ON ON 
+182006 2012-09-30:05:12:00 211772 415 -1 -1 2012-09-30:05:12:00 211772 416 N 3113 1368 ON ON 
+83000 2012-09-30:05:11:55 211772 415 416 -1 9999-12-31:23:00:00 0 0 N 3113 1368 ON ON 
+183004 2012-09-30:05:12:01 211772 415 -1 -1 2012-09-30:05:12:02 211772 416 N 3113 1368 ON ON 
+83005 2012-09-30:05:11:56 211772 415 416 -1 9999-12-31:23:00:00 0 0 N 3113 1368 ON ON 
+183006 2012-09-30:05:11:58 211772 415 -1 -1 2012-09-30:05:11:59 211772 416 N 3113 1368 ON ON 
+83007 2012-09-30:05:11:56 211772 415 416 -1 9999-12-31:23:00:00 0 0 N 3113 1368 ON ON 
+316015 2012-10-02:08:13:16 211867 978 980 -1 2012-10-02:14:15:34 211902 1 Y 3121 1224 ON ON
+48009 2012-10-05:18:58:04 212144 723 -1 723 2012-10-05:19:05:11 212144 731 Y 3133 1368 ON ON 
+48009 2012-10-06:01:06:57 212144 1142 -1 1143 2012-10-06:01:13:15 212144 1150 Y 3133 1368 ON ON 
+211000 2012-10-08:10:00:23 212293 1 -1 -1 2012-10-08:10:00:41 212293 1 N 3139 0 ON ON 
+257000 2012-10-08:09:29:39 212291 1 -1 1 2012-10-08:09:43:44 212291 7 N 3139 0 ON ON 
+223014 2012-10-08:09:25:15 212291 1 -1 1 2012-10-08:09:43:42 212291 7 N 3139 0 ON ON
+171011 2012-10-15:10:33:01 212721 51 -1 52 2012-10-15:10:35:26 212721 54 N 3185 0 ON ON 
+163009 2012-10-19:16:03:36 212967 448 -1 449 2012-10-19:16:04:41 212967 450 Y 3200 1368 ON ON 
+158006 2012-10-19:19:40:44 0 0 -1 0 2012-10-19:19:47:18 0 0 N 3201 0 ON ON 
+142011 2012-10-20:01:47:40 212993 196 -1 -1 2012-10-20:01:47:51 212993 197 Y 3201 1368 ON ON 
+242005 2012-10-20:02:49:48 212993 260 -1 261 2012-10-20:03:07:11 212993 279 Y 3201 1368 ON ON 
+171006 2012-10-20:05:36:55 212993 440 -1 -1 2012-10-20:05:37:02 212993 441 Y 3201 1368 ON ON 
+153015 2012-10-20:10:02:04 212993 725 -1 725 2012-10-20:10:08:22 212993 733 Y 3201 1368 ON ON 
+146003 2012-10-21:18:47:52 213079 524 -1 -1 2012-10-21:18:47:57 213079 524 Y 3204 1368 ON ON 
+8004 2012-10-22:01:50:43 213092 271 -1 -1 2012-10-22:01:50:52 213092 272 N 3207 1368 ON ON 
+4004 2012-10-22:14:44:00 213130 241 -1 -1 2012-10-22:14:44:18 213130 245 Y 3208 1368 ON ON 
+132003 2012-10-23:07:48:38 213157 157 -1 -1 2012-10-23:07:48:52 213157 158 Y 3210 1368 ON ON 
+333007 2012-10-24:05:00:40 213250 259 -1 -1 2012-10-24:05:00:52 213250 260 Y 3214 1368 ON ON 
+103005 2012-10-27:04:15:39 213431 222 -1 -1 2012-10-27:04:15:45 213431 222 Y 3229 1368 ON ON
+73005 2012-10-27:19:45:06 213486 143 -1 143 2012-10-27:19:46:25 213486 144 Y 3232 1368 ON ON 
+103005 2012-10-28:19:38:56 213539 239 246 -1 9999-12-31:23:00:00 0 0 Y 3236 1368 ON ON 
+122007 2012-10-30:01:18:12 213640 60 -1 60 2012-10-30:01:22:15 213640 64 Y 3238 1368 ON ON 
+79006 2012-10-30:10:50:52 213684 77 -1 77 2012-10-30:10:55:05 213684 81 N 3240 1 ON ON 
+154005 2012-11-01:19:45:16 213796 331 -1 331 2012-11-01:19:54:39 213796 342 Y 3250 1368 ON ON 
+132003 2012-11-02:10:27:24 213819 236 -1 -1 2012-11-02:10:27:35 213819 236 Y 3253 1368 ON ON 
+336005 2012-11-02:09:04:42 213819 143 154 -1 2012-11-02:13:13:56 213821 1 Y 3253 1368 ON ON 
+336005 2012-11-02:13:18:36 213821 1 1 -1 2012-11-02:13:23:00 0 0 N 3254 0 ON ON 
+48009 2012-11-03:05:26:58 213900 667 -1 667 2012-11-03:05:30:46 213900 671 Y 3259 1368 ON ON 
+8004 2012-11-03:19:08:16 213951 252 -1 -1 2012-11-03:19:08:30 213951 252 N 3261 1368 ON ON 
+132003 2012-11-05:23:14:27 214086 231 -1 -1 2012-11-05:23:14:34 214086 232 Y 3266 1368 ON ON 
+147012 2012-11-06:03:03:58 214086 469 -1 -1 2012-11-06:03:04:12 214086 470 Y 3266 1368 ON ON 
+132003 2012-11-07:23:59:54 214160 729 -1 -1 2012-11-08:00:00:05 214160 730 Y 3269 1368 ON ON 
+4004 2012-11-07:19:05:34 214160 428 -1 431 2012-11-07:19:08:14 214160 431 Y 3269 1368 ON ON 
+072011 2012-11-11:22:42:32 214390 32 -1 33 2012-11-11:22:46:50 214390 38 Y 3279 1368 ON ON
+148006 2012-11-12:01:10:01 214390 192 -1 192 2012-11-12:01:11:28 214390 193 Y 3279 1368 ON ON
+158013 2012-11-14:05:04:31 214523 205 -1 205 2012-11-14:05:39:00 214523 242 Y 3286 1368 ON ON 
+158013 2012-11-15:21:25:51 214602 1 -1 1 2012-11-15:22:00:43 214602 21 N 3289 0 ON ON 
+120004 2012-11-17:17:15:24 214680 1110 -1 -1 2012-11-17:17:15:35 214680 1112 Y 3296 1368 ON ON 
+48009 2012-11-26:04:03:01 215091 632 -1 633 2012-11-26:04:05:55 215091 635 Y 3323 1368 ON ON 
+240012 2012-11-25:22:51:58 215091 316 -1 317 2012-11-25:23:10:37 215091 337 Y 3323 1368 ON ON 
+169014 2012-11-25:23:24:07 215091 350 -1 351 2012-11-25:23:31:10 215091 358 Y 3323 1368 ON ON 
+256012 2012-11-26:09:19:46 0 0 -1 0 2012-11-26:09:24:03 0 0 N 3324 0 RAMP OFF 
+256012 2012-11-26:09:25:24 0 0 -1 -1 9999-12-31:23:00:00 0 0 N 3324 0 OFF OFF 
+3011 2012-11-30:05:04:15 215414 259 -1 260 2012-11-30:05:15:41 215414 275 Y 3347 1368 ON ON 
+50005 2012-12-01:00:34:34 215433 398 -1 398 2012-12-01:00:43:33 215433 407 Y 3350 1368 ON ON 
+171001 2012-12-03:00:19:04 215473 430 -1 432 2012-12-03:00:21:47 215473 434 Y 3363 1368 ON ON 
+65014 2012-12-03:04:56:34 215473 732 -1 732 2012-12-03:05:19:10 215473 757 Y 3363 1368 ON ON 
+165006 2012-12-02:09:25:03 215464 1008 -1 1009 2012-12-02:09:30:31 215464 1014 Y 3360 1368 ON ON 
+119007 2012-12-03:04:47:22 215473 722 -1 722 2012-12-03:04:55:55 215473 731 Y 3363 1368 ON ON 
+150010 2012-12-04:21:13:43 215571 321 -1 0 2012-12-04:23:13:55 0 0 Y 3374 1368 ON ON 
+166008 2012-12-10:13:50:48 216004 19 -1 76 2012-12-10:14:54:49 216004 83 N 3408 3 RAMP RAMP 
+203010 2012-12-15:21:28:24 216416 170 -1 170 2012-12-15:21:28:39 216416 170 Y 3442 186 ON ON 
+178014 2013-01-08:18:03:36 216956 55 55 -1 2013-01-08:18:48:06 0 -1 N 3459 0 OFF OFF
+276011 2013-01-09:11:32:12 0 -1 -1 -1 9999-12-31:23:00:00 0 -1 N 3459 0 OFF OFF
+100015 2013-01-10:06:50:49 217093 173 -1 183 2013-01-10:07:00:10 217093 184 N 3459 0 OFF OFF
+78001 2013-01-12:19:36:35 217369 357 -1 357 2013-01-12:19:44:50 217369 357 N 3461 1 RAMP RAMP
+307000 2013-01-12:20:13:08 217369 357 357 -1 9999-12-31:23:00:00 0 -1 N 3461 0 OFF RAMP
+307001 2013-01-12:20:13:08 217369 357 357 -1 9999-12-31:23:00:00 0 -1 N 3461 0 OFF RAMP
+308003 2013-01-12:20:13:08 217369 357 357 -1 9999-12-31:23:00:00 0 -1 N 3461 0 OFF RAMP
+309002 2013-01-12:20:13:08 217369 357 357 -1 9999-12-31:23:00:00 0 -1 N 3461 0 OFF RAMP
+309004 2013-01-12:20:13:08 217369 357 357 -1 9999-12-31:23:00:00 0 -1 N 3461 0 OFF RAMP
+74002 2013-01-18:11:17:14 0 -1 -1 -1 2013-01-18:11:22:17 0 -1 N 3468 0 ON ON
+64007 2013-01-19:11:20:11 217906 14 -1 15 2013-01-19:11:23:08 217906 17 N 3469 0 ON ON
+161003 2013-01-20:01:11:15 217907 341 -1 341 2013-01-20:01:12:09 217907 341 N 3470 5 ON ON
+250006 2013-01-20:01:50:14 217907 380 -1 443 2013-01-20:02:49:50 217907 445 N 3470 5 ON ON
+248006 2013-01-20:01:50:14 217907 380 -1 466 2013-01-20:03:10:22 217907 468 N 3470 5 ON ON
+224014 2013-01-23:12:27:22 218048 611 721 -1 2013-01-23:21:18:06 218086 5 Y 3485 296 ON ON
+240011 2013-01-24:10:31:38 218157 30 -1 30 2013-01-24:10:32:17 218157 30 N 3487 1 ON ON 
+78007 2013-02-05:17:19:33 0 0 -1 0 2013-02-05:17:24:36 0 0 N 3530 0 ON ON 
+78007 2013-02-06:04:22:53 218898 30 -1 31 2013-02-06:04:28:10 218898 37 N 3533 0 ON ON 
+78007 2013-02-06:06:43:19 218898 184 -1 196 9999-12-31:23:00:00 0 0 Y 3533 296 ON ON 
diff --git a/LArCalorimeter/LArMonitoring/python/HVTripsDB/updateHVTripsDB.py b/LArCalorimeter/LArMonitoring/python/HVTripsDB/updateHVTripsDB.py
new file mode 100755
index 00000000000..58798b17f1c
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/HVTripsDB/updateHVTripsDB.py
@@ -0,0 +1,24 @@
+#!/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+import CheckHVStatus_daily
+import os
+import time
+
+date = time.strftime("%Y-%m-%d",time.localtime(time.time()))
+date = date+":07:30:00"
+##date = "2011-04-12:23:55:55"
+##date = "2012-11-12:07:30:00"
+print date
+
+os.system("export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup; source $AtlasSetup/scripts/asetup.sh 16.6.2.4; python /afs/cern.ch/user/l/larmon/public/HVTripsDB/CheckHVStatus_daily.py %s" % date)
+
+os.system("cp -f /afs/cern.ch/user/l/larmon/public/HVTripsDB/trips.dat /afs/cern.ch/user/l/larmon/public/HVTripsDB/trips.dat.bak")
+
+os.system("cat /afs/cern.ch/user/l/larmon/public/HVTripsDB/dailyFiles/HVTrips_%s.dat >> /afs/cern.ch/user/l/larmon/public/HVTripsDB/trips.dat" % date)
+
+os.system("cat /afs/cern.ch/user/l/larmon/public/HVTripsDB/dailyFiles/HVTrips_%s.dat > /afs/cern.ch/user/l/larmon/public/HVTripsDB/newTrips.dat" % date)
+
+#os.system("source /afs/cern.ch/user/l/larmon/public/TripVisualizer/updateTripVisualizer.sh")
+
+
diff --git a/LArCalorimeter/LArMonitoring/python/LADIeS/UPDTools.py b/LArCalorimeter/LArMonitoring/python/LADIeS/UPDTools.py
new file mode 100644
index 00000000000..3cb08e56e2f
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/LADIeS/UPDTools.py
@@ -0,0 +1,884 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+#############################################################################
+# Authors : Emmanuel Sauvan, sauvan@lapp.in2p3.fr
+#         : Julien Morel,    julien.morel@cern.ch
+#         : Walter Lampl,    Walter.Lampl@cern.ch 
+#############################################################################
+#...Import
+import time
+import os
+import PyCintex as PyLCGDict
+import ECalDBLib
+
+from array import array
+from PyCool import cool,coral
+from CoolConvUtilities.AtlCoolLib import indirectOpen
+
+PyLCGDict.loadDict('BadChanDict')
+import ROOT
+from ROOT import LArBadChannelDBTools,AthenaAttributeList
+from CoolTools import *
+
+#############################################################################
+#...General definition
+bct        = LArBadChannelDBTools()
+A          = AthenaAttributeList(bct.createCoolSpec())
+log        = bct.getDefaultMsgStream()
+Tags       = {'UPD1':'ES1','UPD4':'BLK'}
+connect    = 0
+folderName = 0
+folder     = 0
+dbSvc      = 0
+db         = 0
+option     = ''
+#############################################################################
+def DateToIOV(dateSince,dateUntil):
+    #...Get the run-lumi corresonding to the dates
+    IOVSince = 0
+    IOVUntil = 0
+    if ':' in str(dateSince) and ':' in str(dateUntil):
+        runlumi = GetRunNumberLumiblock(dateSince,dateUntil)
+        IOVSince = int(runlumi[0][0]<<32) + int(runlumi[0][1]<<0)
+        IOVUntil = int(runlumi[1][0]<<32) + int(runlumi[1][1]<<0)
+    elif ':' in str(dateSince) and int(dateUntil)==-1:
+        runlumi = GetRunNumberLumiblock(dateSince,'2099-07-13:14:27:00')
+        IOVSince = int(runlumi[0][0]<<32) + int(runlumi[0][1]<<0)
+        IOVUntil = (cool.ValidityKeyMax>>32)<<32 
+    elif int(dateUntil)!=-1:
+        IOVSince = int(dateSince)<<32
+        IOVUntil = int(dateUntil)<<32
+    else:
+        IOVSince = int(dateSince)<<32
+        IOVUntil = (cool.ValidityKeyMax>>32)<<32
+
+    return IOVSince, IOVUntil
+
+#############################################################################
+def GetBadChanByIOV(IOV,list='UPD4'):
+    res={}
+    
+    #...Get the info in the database
+    fld = db.getFolder(folderName)
+    if list=='UPD3':
+        tag = 'LARBadChannelsOflBadChannels-UPD3-00'
+    elif list=='BULK-00':
+        tag = 'LARBadChannelsOflBadChannels-Bulk-00'
+    else:
+        tag = fld.resolveTag('COMCOND-%sPST-004-05'%(Tags[list])) #...New tag since 6 april 2011
+    objs = fld.browseObjects(IOV,IOV,cool.ChannelSelection.all(),tag)
+
+    #...Loop and store the channels
+    for obj in objs:
+        p = obj.payload()
+        for i in ['Blob','ChannelSize','StatusWordSize','Endianness','Version']: A[i] = p[i]
+        badChanList = bct.readBadChan(A,log)
+        updatetime = obj.insertionTime()
+        since      = obj.since()
+        for i in range(badChanList.size()):
+            badchan   = badChanList.at(i)
+            channelId = badchan[0].get_compact()
+            badChan   = badchan[1].packedData() 
+            res[channelId] = {'Id':channelId, 'badchanNew':badChan, 'badchanOld':badChan, 'badchanStart':badChan, 'updateTime':updatetime, 'IOVSince':since}
+
+    return res
+
+#############################################################################
+def GetBadChanChangeLog(dateSince,dateUntil,list='UPD4'):
+
+    chantest = 0
+
+    resNew     = {}
+    resUp      = {}
+    resRemoved = {}
+    DBContent  = {}
+
+    def PreviousSince(channelID,badChan,IOVSince):
+        IOVKeys = DBContent.keys()
+        IOVKeys.sort()
+        IOVKeys.reverse()
+        for IOV in IOVKeys:
+            if IOVSince<=IOV: continue
+            list = DBContent[IOV]
+            for blob in list:
+                if channelID == blob[0]:
+                    blob.append(IOV)
+                    return blob
+        return -1
+
+    def NextSince(channelID,IOVSince):
+        IOVKeys = DBContent.keys()
+        IOVKeys.sort()
+        for IOV in IOVKeys:
+            if IOVSince>=IOV: continue
+            for blob in DBContent[IOV]:
+                if channelID == blob[0]:
+                    if IOV == IOVKeys[0]: return -1
+                    blob.append(IOV)
+                    return blob
+        return -1
+
+    def IsModified(channelId,since):
+        if since in DBContent.keys(): 
+            for i in range(len(DBContent[since])):
+                blob = DBContent[since][i]
+                if channelId==blob[0]:
+                    return i
+        return -1
+            
+    
+    #...Get the run-lumi corresonding to the dates
+    IOVSince, IOVUntil = DateToIOV(dateSince,dateUntil)
+
+    #...Get channel at the start and the end
+    channelStart = GetBadChanByIOV(IOVSince,list)
+    channelEnd   = GetBadChanByIOV(IOVUntil,list)
+
+    #...Get the info in the database
+    fld = db.getFolder(folderName)
+    if list=='UPD3':
+        tag = 'LARBadChannelsOflBadChannels-UPD3-00'
+    elif list=='BULK-00':
+        tag = 'LARBadChannelsOflBadChannels-Bulk-00'
+    else:
+        tag = fld.resolveTag('COMCOND-%sPST-004-05'%(Tags[list])) #...New tag since 6 april 2011
+    objs = fld.browseObjects(IOVSince,IOVUntil,cool.ChannelSelection.all(),tag)
+
+    #...Store DB content in a python dict
+    for obj in objs:
+        #...Get the UPD content
+        plCurrent = obj.payload()
+        for i in ['Blob','ChannelSize','StatusWordSize','Endianness','Version']: A[i] = plCurrent[i]
+        badChanListCurrent = bct.readBadChan(A,log)
+
+        updatetime = obj.insertionTime()
+        since      = obj.since()
+        until      = obj.until()
+
+        for j in range(badChanListCurrent.size()):
+            currentChan = badChanListCurrent.at(j)
+            channelId = currentChan[0].get_compact()
+            badChan   = currentChan[1].packedData()
+
+            #...if already modified update the status
+            if since!=cool.ValidityKeyMax and (since>=IOVSince and since<=IOVUntil):
+                if not(since in DBContent.keys()): DBContent[since] = []
+                index = IsModified(channelId,since)
+                if index!=-1:
+                    DBContent[since][index][1]=badChan
+                    DBContent[since][index][2]=updatetime
+                    if channelId == chantest:
+                        print '-00-',chantest,'->',since>>32,until>>32, [channelId,badChan,updatetime]
+                #...else add the modification
+                else:
+                    DBContent[since].append([channelId,badChan,updatetime])
+                    if channelId == chantest:
+                        print '-01-',chantest,'->',since>>32,until>>32, [channelId,badChan,updatetime]
+            if until!=cool.ValidityKeyMax and (until>=IOVSince and until<=IOVUntil):
+                #...in any case add the end of the modification    
+                if not(until in DBContent.keys()): DBContent[until] = []
+                if channelId in channelStart.keys():
+                    DBContent[until].append([channelId,channelStart[channelId]['badchanNew'],updatetime])
+                    if channelId == chantest:
+                        print '-1-',chantest,'->',since>>32,until>>32, [channelId,channelStart[channelId]['badchanNew'],updatetime]
+                else:
+                    DBContent[until].append([channelId,0,updatetime])
+                    if channelId == chantest:
+                        print '-2-',chantest,'->',since>>32,until>>32, [channelId,0,updatetime]
+                
+    #...Loop and compute the differences
+    keylist = DBContent.keys()
+    keylist.sort()
+    for indice in range(len(keylist)):
+        since = keylist[indice]
+
+        resUp     [since]=[]
+        resNew    [since]=[]
+        resRemoved[since]=[]
+
+        
+        if chantest != 0:
+            print '                       ',since>>32
+        for chan in DBContent[since]:                
+            channelId  = chan[0]
+            badChan    = chan[1]
+            updatetime = chan[2]
+            badChanStart = 0
+            if channelId in channelStart.keys():
+                badChanStart = channelStart[channelId]['badchanStart']
+
+
+            if channelId == chantest:
+                print '--',chantest,'->',indice,channelId,badChan,since>>32
+                
+            #...Count the updated and new channels
+            previousIOV = PreviousSince(channelId,badChan,since)
+            if previousIOV != -1:
+                if channelId == chantest:
+                    print previousIOV[0], previousIOV[1], previousIOV[3]>>32
+                    print 'comparaison ', badChan,'!=',previousIOV[1]
+                if badChan!=previousIOV[1]:
+                    resUp[since].append({'Id':channelId, 'badchanNew':badChan, 'badchanOld':previousIOV[1], 'badchanStart':badChanStart, 'updateTime':updatetime, 'IOVSince':since})
+                    if channelId == chantest:
+                        print '--up->',indice,channelId,'badchanNew',badChan,'badchanOld',previousIOV[1],since>>32
+
+            elif not(channelId in channelStart.keys()):
+                resNew[since].append({'Id':channelId, 'badchanNew':badChan, 'badchanOld':0, 'badchanStart':badChanStart, 'updateTime':updatetime, 'IOVSince':since})
+                resUp [since].append({'Id':channelId, 'badchanNew':badChan, 'badchanOld':0, 'badchanStart':badChanStart, 'updateTime':updatetime, 'IOVSince':since})
+                if channelId == chantest:
+                    print '-new->',indice,channelId,badChan,since>>32
+
+
+            nextIOV = NextSince(channelId,since)
+            if nextIOV == -1 and not(channelId in channelEnd.keys()):
+                resRemoved[since].append({'Id':channelId, 'badchanNew':0, 'badchanOld':badChan, 'badchanStart':badChanStart, 'updateTime':updatetime, 'IOVSince':since})
+                if channelId == chantest:
+                    print '--rm->',indice,channelId,badChan,since>>32
+                    
+                    
+    return resNew, resUp, resRemoved
+
+
+
+#############################################################################
+def DisplayBadChanChangeLog(dateSince,dateUntil,list='UPD4'):
+
+    #...Get the run-lumi corresonding to the dates
+    IOVSince, IOVUntil = DateToIOV(dateSince,dateUntil)
+
+    #...shape the date for the display
+    DispDate1 = ''
+    if ':' in str(dateSince):
+        DispDate1 = dateSince +'('+str(IOVSince>>32)+' '+str(IOVSince&0xFFFFFFFF)+')'
+    else:
+        DispDate1 = str(dateSince)
+
+    DispDate2 = ''
+    if ':' in str(dateUntil):
+        DispDate2 = dateUntil +'('+str(IOVUntil>>32)+' '+str(IOVUntil&0xFFFFFFFF)+')'
+    elif int(dateUntil)==-1:
+        DispDate2 = 'cool.ValidityKeyMax'
+    else:
+        DispDate2 = str(dateUntil)
+
+    print ' '
+    print ' '
+    print ' '
+    print ' '
+    print '**********************************************************************************************************************'
+    print '       ',list,'changes beetwen',DispDate1,'and',DispDate2
+    print '**********************************************************************************************************************'
+
+    ListNew, ListUp, ListRemoved = GetBadChanChangeLog(dateSince,dateUntil,list)
+    channelStart = GetBadChanByIOV(IOVSince,list)
+
+    if len(ListUp)!=0:
+        print ' '
+        print '*********************************************************************'
+        print 'Summary of modified channels:'
+        DisplayLogSummary(ListUp)
+        
+    if len(ListUp)!=0:
+        print ' '
+        print '*********************************************************************'
+        print 'Log for modified channels:'
+        keylist = ListUp.keys()
+        keylist.sort()
+        for since in keylist:
+            list=ListUp[since]
+            if len(list)==0: continue
+
+            time   = list[0]['updateTime']            
+            UpDate = " %i-%.2i-%.2i %.2i:%.2i:%.2i" % (time.year(),time.month(),time.day(),time.hour(),time.minute(),time.second())
+            print UpDate,'(IOV',since>>32,str(since&0xFFFFFFFF)+')  -> ', len(list),'updated channels :'
+
+            for Blob in list:
+                Id        = Blob['Id']
+                badchNew  = Blob['badchanNew']            
+                time      = Blob['updateTime']            
+                badchOld  = Blob['badchanOld']            
+                UpDate = " %i-%.2i-%.2i %.2i:%.2i:%.2i" % (time.year(),time.month(),time.day(),time.hour(),time.minute(),time.second())
+                chan = GetChannelByOnlineId(Id)
+                print '   ','channel=0x%x  %7s FT%2.0d SL%2.0d CH%3.0d - %s (0x%x) --> %s (0x%x)' % (Id,chan['subSubPartition'],chan['FT'],chan['SL'],chan['CH'],BadChanInterpreter(badchOld),badchOld,BadChanInterpreter(badchNew),badchNew)
+
+
+    if len(ListUp)>1:
+        if 'Histo' in option:
+            DisplayHisto(IOVSince, IOVUntil,ListUp,channelStart)
+
+##     if len(ListNew)!=0:
+##         print ' '
+##         print '*********************************************************************'
+##         print 'Summary for new channels:'
+##         DisplayLogSummary(ListNew)
+##     if len(ListRemoved)!=0:
+##         print ' '
+##         print '*********************************************************************'
+##         print 'Summary for removed channels:'
+##         DisplayLogSummary(ListRemoved)
+         
+##     if len(ListNew)!=0:
+##         print ' '
+##         print '*********************************************************************'
+##         print 'Log for new channels:'
+##         keylist = ListNew.keys()
+##         keylist.sort()
+##         for since in keylist:
+##             list=ListNew[since]
+##             if len(list)==0: continue
+            
+##             time   = list[0]['updateTime']            
+##             UpDate = " %i-%.2i-%.2i %.2i:%.2i:%.2i" % (time.year(),time.month(),time.day(),time.hour(),time.minute(),time.second())
+##             print UpDate,'(IOV',since>>32,str(since&0xFFFFFFFF)+')  -> ', len(list),'new channels :'
+##             for Blob in list:
+##                 Id     = Blob['Id']
+##                 badch  = Blob['badchanNew']            
+##                 time   = Blob['updateTime']
+##                 UpDate = " %i-%.2i-%.2i %.2i:%.2i:%.2i" % (time.year(),time.month(),time.day(),time.hour(),time.minute(),time.second())
+##                 chan = GetChannelByOnlineId(Id)
+##                 print '   ','channel=0x%x  %7s FT%2.0d SL%2.0d CH%3.0d - %s (0x%x)' % (Id,chan['subSubPartition'],chan['FT'],chan['SL'],chan['CH'],BadChanInterpreter(badch),badch)
+
+                
+##     if len(ListRemoved)!=0:
+##         print ' '
+##         print '*********************************************************************'
+##         print 'Log for removed channeld:'
+##         keylist = ListRemoved.keys()
+##         keylist.sort()
+##         for since in keylist:
+##             list=ListRemoved[since]
+##             if len(list)==0: continue
+            
+##             time   = list[0]['updateTime']            
+##             UpDate = " %i-%.2i-%.2i %.2i:%.2i:%.2i" % (time.year(),time.month(),time.day(),time.hour(),time.minute(),time.second())
+##             print UpDate,'(IOV',since>>32,str(since&0xFFFFFFFF)+')  -> ', len(list),'removed channels :'
+            
+##             for Blob in list:
+##                 Id     = Blob['Id']
+##                 badch  = Blob['badchanNew']            
+##                 chan = GetChannelByOnlineId(Id)
+##                 print '   ','channel=0x%x  %7s FT%2.0d SL%2.0d CH%3.0d - %s (0x%x)' % (Id,chan['subSubPartition'],chan['FT'],chan['SL'],chan['CH'],BadChanInterpreter(badch),badch)
+
+#############################################################################
+def DisplayLogSummary(ListUp):
+    """
+    Display the number of different channels in the list ListUp.
+    Display the channel and corresponding IOVs if more then 1 IOV is associate to the channel in the list.
+    """
+    def FillHisto(since, Blob,Hist):
+        Id           = Blob['Id']
+        badChan      = BadChanInterpreter(Blob['badchanNew'])
+        badChanStart = BadChanInterpreter(Blob['badchanStart'])
+        chan         = GetChannelByOnlineId(Id)
+
+        #...count the number of channels in different part of the detec
+        if badChan!=badChanStart:
+            Hist['ALL']['all'] +=1
+            if   'highNoiseHG'        in badChan: Hist['ALL']['highNoiseHG']        +=1
+            elif 'sporadicBurstNoise' in badChan: Hist['ALL']['sporadicBurstNoise'] +=1            
+            else                                : Hist['ALL']['other'] +=1
+        for Part in Partitions:
+            if   chan['subSubPartition'][0:-1]==Part:
+                if badChan!=badChanStart:
+                    Hist[Part]['all'] +=1
+                    if   'highNoiseHG'        in badChan: Hist[Part]['highNoiseHG']        +=1
+                    elif 'sporadicBurstNoise' in badChan: Hist[Part]['sporadicBurstNoise'] +=1
+                    else                                : Hist[Part]['other'] +=1
+        
+    #...Count the number of different channel (separate for EMB, EMBPS, EMEC, EMECPS, HEC and FCAL) and store IOVSince for channel with more then one occurence
+    channelDict = {} #...channelDict[ChannelId] = [IOV1,IOV2,...]
+    Partitions  = ['ALL', 'EMB', 'EMBPS', 'EMEC', 'EMECPS', 'HEC', 'FCAL']
+    BadChannels = ['highNoiseHG','sporadicBurstNoise','other','all']
+
+    countHist   = {}
+    for part in Partitions:
+        countHist[part]={}
+        for bc in BadChannels:
+            countHist[part][bc] = 0
+
+
+    iovSet = set()
+    for since,list in ListUp.iteritems():        
+        if len(list)==0: continue
+        for Blob in list:
+            FillHisto(since,Blob,countHist)                        
+            iovSet.add(since>>32)
+            #...Fill the list of channels
+            Id           = Blob['Id']
+            if not(Id in channelDict.keys()):
+                channelDict[Id] = []
+                channelDict[Id].append(Blob)
+            else:
+                channelDict[Id].append(Blob)
+    #...count the number of good run
+    numberOfGoodRun = 0
+    GoodRun = []
+    for iov in iovSet:
+        if len(GoodLB(iov))>0:
+            GoodRun.append(iov)
+            numberOfGoodRun += 1
+
+    #...Display the summary
+    ecalDB = ECalDBLib.ECalDBLib()
+    ecalDB.Open('sqlite://'+ECalDBLib.dbBasePath+'/ECalDB.db')
+
+    
+    print '   '
+    print '   ',' This report is done over %d AtlasReady runs : ' % numberOfGoodRun ,GoodRun
+    print '   ','/---------------------------------------------------------------------------------\\'
+    print '   ','| Partition        | highNoiseHG | sporadicBurstNoise | Other       | Total       |'
+    print '   ','|------------------|-------------|--------------------|-------------|-------------|'
+    print '   ','| in EMB  (EMBPS)  | %4i (%4i) | %4i (%4i)        | %4i (%4i) | %4i (%4i) |' % (countHist['EMB' ]['highNoiseHG']+countHist['EMBPS' ]['highNoiseHG'] , countHist['EMBPS' ]['highNoiseHG'], countHist['EMB' ]['sporadicBurstNoise']+countHist['EMBPS' ]['sporadicBurstNoise'] , countHist['EMBPS' ]['sporadicBurstNoise'], countHist['EMB' ]['other']+countHist['EMBPS' ]['other'] , countHist['EMBPS' ]['other'], countHist['EMB' ]['all']+countHist['EMBPS' ]['all'] , countHist['EMBPS' ]['all'])
+    print '   ','| in EMEC (EMECPS) | %4i (%4i) | %4i (%4i)        | %4i (%4i) | %4i (%4i) |' % (countHist['EMEC']['highNoiseHG']+countHist['EMECPS']['highNoiseHG'] , countHist['EMECPS']['highNoiseHG'], countHist['EMEC']['sporadicBurstNoise']+countHist['EMECPS']['sporadicBurstNoise'] , countHist['EMECPS']['sporadicBurstNoise'], countHist['EMEC']['other']+countHist['EMECPS']['other'] , countHist['EMECPS']['other'], countHist['EMEC']['all']+countHist['EMECPS']['all'] , countHist['EMECPS']['all'])
+    print '   ','| in HEC           | %4i        | %4i               | %4i        | %4i        |'     % (countHist['HEC' ]['highNoiseHG'], countHist['HEC' ]['sporadicBurstNoise'], countHist['HEC' ]['other'], countHist['HEC' ]['all'])
+    print '   ','| in FCAL          | %4i        | %4i               | %4i        | %4i        |'     % (countHist['FCAL']['highNoiseHG'], countHist['FCAL']['sporadicBurstNoise'], countHist['FCAL']['other'], countHist['FCAL']['all'])
+    print '   ','|------------------|-------------|--------------------|-------------|-------------|'
+    print '   ','| Total            | %4i        | %4i               | %4i        | %4i        |'     % (countHist['ALL' ]['highNoiseHG'], countHist['ALL' ]['sporadicBurstNoise'], countHist['ALL' ]['other'], countHist['ALL' ]['all'])
+    print '   ','\\---------------------------------------------------------------------------------/'
+    print '   '
+    print ' List of channels with many occurences:'
+
+    #...Print the log
+    keylist = channelDict.keys()
+    keylist.sort()
+    occDict = {}
+    for Id in keylist:
+        taille = len(channelDict[Id])
+        if not(taille in occDict.keys()):
+            occDict[taille] = []
+            occDict[taille].append(Id)
+        else:
+            occDict[taille].append(Id)
+
+    occList = occDict.keys()
+    occList.sort()
+    occList.reverse()
+    for nb in occList:
+        occDict[nb].sort()
+        occDict[nb].reverse()
+        for Id in occDict[nb]:
+            list=channelDict[Id]
+            if len(list)<3 : continue
+            badch = channelDict[Id][0]['badchanNew']
+            chan  = GetChannelByOnlineId(Id)
+            list.sort()
+
+            outline = []
+            count   = 0
+            for i in range(len(list)):
+                Blob =  list[i]
+                    
+                badchNew  = Blob['badchanNew']
+                badchOld  = Blob['badchanOld']
+                since     = Blob['IOVSince']
+                time      = Blob['updateTime']            
+
+                #...Do not display the 2 line add and remove for the same channel
+                disp = 1
+                if i>0:
+                    prevBlob =  list[i-1]
+                    prevSince     = prevBlob['IOVSince']
+                    prevBadchNew  = prevBlob['badchanNew']
+                    prevBadchOld  = prevBlob['badchanOld']
+
+##                     if int(since>>32) == int(prevSince>>32)+1:
+##                         if badchNew==prevBadchOld:
+##                             disp=0
+                             
+                UpDate = "%i-%.2i-%.2i %.2i:%.2i:%.2i" % (time.year(),time.month(),time.day(),time.hour(),time.minute(),time.second())
+
+                action = 'Updated'
+                if badchOld == 0:
+                    action = 'Added'
+                if badchNew == 0:
+                    action = 'Removed'
+
+                if disp==1:
+                    if since>>32 in GoodRun:
+                        outline.append('          '+UpDate+' (IOV %6i* %10i '%(since>>32,since&0xFFFFFFFF)+')  '+' %s (0x%x)  -->  %s (0x%x)'%(BadChanInterpreter(badchOld),badchOld,BadChanInterpreter(badchNew),badchNew)+' '+action)
+                        count += 1
+                    else:
+                        outline.append('          '+UpDate+' (IOV %6i  %10i '%(since>>32,since&0xFFFFFFFF)+')  '+' %s (0x%x)  -->  %s (0x%x)'%(BadChanInterpreter(badchOld),badchOld,BadChanInterpreter(badchNew),badchNew)+' '+action)
+            print ' ','channel=0x%x  %7s FT%2.0d SL%2.0d CH%3.0d  - %s (0x%x)' % (Id,chan['subSubPartition'],chan['FT'],chan['SL'],chan['CH'],BadChanInterpreter(badch),badch)
+            print '      ','Observed in %d AtlasReady IOV* over %d (~%2.0d per cent):' % (count, numberOfGoodRun, 100 * count/ numberOfGoodRun)
+            for i in outline:
+                print i
+                
+            #...Print history from ECal
+            idMax = ecalDB.GetCampaignId()-1
+            idMin = 1
+            historyList = ecalDB.GetChannelHistoryByCampaingId(chan['subSubPartition'],chan['FT'],chan['SL'],chan['CH'], idMin, idMax)
+            histSummuray = {}
+
+            for type in ECalDBLib.typeRun.keys():
+                for history in historyList:
+                    if type in history.keys():
+                        if type in histSummuray.keys():
+                            histSummuray[type].append([history['id'],history['date']])
+                        else:
+                            histSummuray[type]=[]
+                            histSummuray[type].append([history['id'],history['date']])
+
+
+            if len(histSummuray)>0:
+                print '      ','Calibration deviations :'
+                for type in histSummuray.keys():
+                    if len(histSummuray[type])>0:
+                        displayedCamp = ''
+                        for i in histSummuray[type]:
+                            displayedCamp += str(i[0])+' '
+                        print '         ',type+' -> '+str(len(histSummuray[type]))+' times in campaigns: '+displayedCamp
+        
+    ecalDB.Close()
+#############################################################################
+def DisplayHisto(min,max,ListUp,channelStart={}):
+    """
+    Display the number of different channels in the list ListUp.
+    Display the channel and corresponding IOVs if more then 1 IOV is associate to the channel in the list.
+    """
+
+    def FillHisto(since, Blob,Hist,binList):
+        Id           = Blob['Id']
+        badChanNew   = BadChanInterpreter(Blob['badchanNew'])
+        badChanOld   = BadChanInterpreter(Blob['badchanOld'])
+        badChanStart = BadChanInterpreter(Blob['badchanStart'])
+        chan         = GetChannelByOnlineId(Id)
+        
+        def FilluptoEnd(Histo,since,weight):
+            for i in range(Histo.GetNbinsX()):
+                if binList[i] >= since:
+                    Histo.SetBinContent(i+1,weight+Histo.GetBinContent(i+1))
+                    
+        def FindBad(list):
+            res = []
+            list = list.split('/')
+            for i in list:
+                if i=='': continue
+                if i in BadChannels:
+                    res.append(i)
+                elif not('other' in res):
+                    res.append('other')
+            return res
+                    
+        #...count the number of channels in different part of the detec
+        listOld = FindBad(badChanOld)
+        for bad in listOld:
+            if bad=='' :continue
+            if 'Debug' in option: print since>>32, 'Remove '+bad+' : ',badChanOld,'->',badChanNew            
+            FilluptoEnd(Hist['ALL'][bad]       ,since>>32,-1)
+
+        listNew = FindBad(badChanNew)
+        for bad in listNew:
+            if bad=='' :continue
+            if 'Debug' in option: print since>>32, 'Add '+bad+' : ',badChanOld,'->',badChanNew            
+            FilluptoEnd(Hist['ALL'][bad]       ,since>>32,1)
+
+        for Part in Partitions:
+            if   chan['subSubPartition'][0:-1]==Part:
+                listOld = FindBad(badChanOld)
+                for bad in listOld:
+                    if bad=='' :continue
+                    if 'Debug' in option: print since>>32, 'Remove '+bad+' : ',badChanOld,'->',badChanNew            
+                    FilluptoEnd(Hist[Part][bad]       ,since>>32,-1)
+
+                listNew = FindBad(badChanNew)
+                for bad in listNew:
+                    if bad=='' :continue
+                    if 'Debug' in option: print since>>32, 'Add '+bad+' : ',badChanOld,'->',badChanNew            
+                    FilluptoEnd(Hist[Part][bad]       ,since>>32,1)
+        
+    #...Count the number of different channel (separate for EMB, EMBPS, EMEC, EMECPS, HEC and FCAL) and store IOVSince for channel with more then one occurence
+    channelDict = {} #...channelDict[ChannelId] = [IOV1,IOV2,...]
+    Partitions  = ['ALL', 'EMB', 'EMBPS', 'EMEC', 'EMECPS', 'HEC', 'FCAL']
+    color       = {'ALL':1, 'EMB':2, 'EMBPS':3, 'EMEC':4, 'EMECPS':5, 'HEC':6, 'FCAL':7}
+    BadChannels = ['highNoiseHG','sporadicBurstNoise','other','all']
+
+    #...Get the bin list
+    binList = [min>>32]
+    for i,blob in ListUp.iteritems():        
+        if (i>min and i<max):
+            binList.append(i>>32)
+
+    
+    if max>>32!=cool.ValidityKeyMax>>32: binList.append(max>>32)
+    binList.sort()
+
+    print 'bins are ',binList
+
+    def SetXLabel(h,binlist):
+       for i in range(len(binlist)-1):
+           if binlist[i]==binlist[i+1]-1:
+               h.GetXaxis().SetBinLabel(i+1,str(binlist[i]))
+            
+
+    countHist   = {}
+    startHist   = {}
+    for part in Partitions:
+        countHist[part]={} 
+        startHist[part]={}
+        for bc in BadChannels:
+            if 'FixedSizeBin' in option:
+                countHist[part][bc] = ROOT.TH1I('countHist_'+part+'_'+bc,part,len(binList)-1,binList[0],binList[-1])
+                startHist[part][bc] = ROOT.TH1I('startHist_'+part+'_'+bc,part,len(binList)-1,binList[0],binList[-1])
+            else:
+                countHist[part][bc] = ROOT.TH1I('countHist_'+part+'_'+bc,part,len(binList)-1,array('d',binList))
+                startHist[part][bc] = ROOT.TH1I('startHist_'+part+'_'+bc,part,len(binList)-1,array('d',binList))
+            SetXLabel(countHist[part][bc],binList)
+            SetXLabel(startHist[part][bc],binList)
+                    
+    for since,list in ListUp.iteritems():        
+        if len(list)==0: continue
+        for Blob in list:
+            FillHisto(since,Blob,countHist,binList)
+            
+            #...Fill the list of channels
+            Id           = Blob['Id'] 
+            if not(Id in channelDict.keys()):
+                channelDict[Id] = []
+                channelDict[Id].append(Blob)
+            else:
+                channelDict[Id].append(Blob)
+
+    #...Display the summary
+    if channelStart != {}:
+        #...Get the status at the starting point
+        def FillStartHisto(histo):
+            for i in range(histo.GetNbinsX()):
+                histo.SetBinContent(i+1,1+histo.GetBinContent(i+1))
+
+        for Id, Blob in channelStart.iteritems():            
+            Id           = Blob['Id']
+            badChan      = BadChanInterpreter(Blob['badchanNew'])
+            chan         = GetChannelByOnlineId(Id)
+            
+            #...count the number of channels in different part of the detec
+            FillStartHisto(startHist['ALL']['all'])
+            if   'highNoiseHG'        in badChan: FillStartHisto(startHist['ALL']['highNoiseHG'])
+            elif 'sporadicBurstNoise' in badChan: FillStartHisto(startHist['ALL']['sporadicBurstNoise'])
+            else                                : FillStartHisto(startHist['ALL']['other'])
+            for Part in Partitions:
+                if   chan['subSubPartition'][0:-1]==Part:
+                    FillStartHisto(startHist[Part]['all'])
+                    if   'highNoiseHG'        in badChan: FillStartHisto(startHist[Part]['highNoiseHG']       )
+                    elif 'sporadicBurstNoise' in badChan: FillStartHisto(startHist[Part]['sporadicBurstNoise'])
+                    else                                : FillStartHisto(startHist[Part]['other'])
+        #...Add the modified channels
+        for part in Partitions:
+            for bc in BadChannels:
+                countHist[part][bc].Add(startHist[part][bc])
+                
+    #...cumulate the partition
+    listPart = Partitions
+    listPart.reverse()
+    listPart.pop()
+    for part1 in listPart:
+        for part2 in listPart:
+            if part1==part2: continue
+            if listPart.index(part1)>listPart.index(part2): continue
+            for bc in BadChannels:
+                countHist[part1][bc].Add(countHist[part2][bc])
+            
+
+    #...Draw the graph
+    countFig   = {}
+    leg = ROOT.TLegend(0.15,0.15,0.3,0.5)
+    texte = ROOT.TText()
+    countFig = {}
+    
+    for bc in BadChannels:
+        countFig[bc] = ROOT.TCanvas()
+        ROOT.gPad.SetGridy()
+        countHist[listPart[0]][bc].Draw()
+        countHist[listPart[0]][bc].SetXTitle("IOV")
+        countHist[listPart[0]][bc].SetYTitle(bc)
+        for part in listPart:
+            countHist[part][bc].SetLineColor(1)
+            countHist[part][bc].SetFillColor(color[part])
+            if bc==BadChannels[0]:
+                leg.AddEntry(countHist[part][bc],countHist[part][bc].GetTitle(),"f")
+            countHist[part][bc].Draw('same')
+#        texte.DrawTextNDC(0.2,0.95,bc)
+        max = countHist[listPart[0]][bc].GetBinContent(countHist[listPart[0]][bc].GetMaximumBin())
+        max = 1.1*max
+        countHist[listPart[0]][bc].GetYaxis().SetRangeUser(0,max)
+        countHist[listPart[0]][bc].GetYaxis().SetNdivisions(4 + 100*0 + 10000*0)
+        ROOT.gPad.RedrawAxis()
+        
+        leg.Draw()
+    raw_input("Press Enter To Continue: ")                
+
+
+
+#####################################################################################
+def GetBadChanBetweenDates(dateSince,dateUntil,list='UPD4'):
+    resNew={}
+    resUp={}
+    resRemoved={}
+
+    #...Get the run-lumi corresonding to the dates
+    IOVSince, IOVUntil = DateToIOV(dateSince,dateUntil)
+
+    listSince = GetBadChanByIOV(IOVSince,list)
+    listUntil = GetBadChanByIOV(IOVUntil,list)
+
+    #...Count the updated and new channels
+    for chanUntil in listUntil.keys():
+        if chanUntil<IOVSince or chanUntil>IOVUntil: continue
+        if chanUntil in listSince.keys():
+            if listUntil[chanUntil]['badchanNew']!=listSince[chanUntil]['badchanNew']:
+                listUntil[chanUntil]['badchanOld'] = listSince[chanUntil]['badchanNew']
+                resUp[chanUntil]=listUntil[chanUntil]
+            else: continue
+        else:
+            resNew[chanUntil]=listUntil[chanUntil]
+
+    #...Count the removed channels
+    countRemoved = 0
+    for chanSince in listSince.keys():
+        if chanSince<IOVSince or chanSince>IOVUntil: continue
+        if not(chanSince in listUntil.keys()):
+            resRemoved[chanSince]=listSince[chanSince]
+
+    return resNew, resUp, resRemoved
+
+#####################################################################################
+def DisplayBadChanBetweenDates(dateSince,dateUntil,list='UPD4'):
+
+    #...Get the run-lumi corresonding to the dates
+    IOVSince, IOVUntil = DateToIOV(dateSince,dateUntil)
+
+    #...shape the date for the display
+    DispDate1 = ''
+    if ':' in str(dateSince):
+        DispDate1 = dateSince +'('+str(IOVSince>>32)+' '+str(IOVSince&0xFFFFFFFF)+')'
+    else:
+        DispDate1 = str(dateSince)
+
+    DispDate2 = ''
+    if ':' in str(dateUntil):
+        DispDate2 = dateUntil +'('+str(IOVUntil>>32)+' '+str(IOVUntil&0xFFFFFFFF)+')'
+    elif int(dateUntil)==-1:
+        DispDate2 = 'cool.ValidityKeyMax'
+    else:
+        DispDate2 = str(dateUntil)
+
+    print ' '
+    print ' '
+    print ' '
+    print ' '
+    print '**********************************************************************************************************************'
+    print '       ',list,'differences beetwen',DispDate1,'and',DispDate2
+    print '**********************************************************************************************************************'
+
+    ListNew, ListUp, ListRemoved = GetBadChanBetweenDates(dateSince,dateUntil,list)
+
+    if len(ListNew)!=0:
+        print ' '
+        print '*********************************************************************'
+        print 'List of new channels:'
+        for Id,Blob in ListNew.iteritems():
+            if Id in ListUp.keys() : continue
+            badch  = Blob['badchanNew']            
+            chan = GetChannelByOnlineId(Id)
+            DispIOV = '(IOV '+str(Blob['IOVSince']>>32)+' '+str(Blob['IOVSince']&0xFFFFFFFF)+')'
+            print '   ','channel=0x%x  %7s FT%d SL%d CH%d - %s (0x%x)' % (Id,chan['subSubPartition'],chan['FT'],chan['SL'],chan['CH'],BadChanInterpreter(badch),badch) +'  '+DispIOV
+
+    if len(ListUp)!=0:
+        print ' '
+        print '*********************************************************************'
+        print 'List of updated channels:'
+        for Id,Blob in ListUp.iteritems():
+            badchNew  = Blob['badchanNew']
+            badchOld  = Blob['badchanOld']
+            chan = GetChannelByOnlineId(Id)
+            DispIOV = '(IOV '+str(Blob['IOVSince']>>32)+' '+str(Blob['IOVSince']&0xFFFFFFFF)+')'
+            print '   ','channel=0x%x  %7s FT%d SL%d CH%d - %s (0x%x) --> %s (0x%x)' % (Id,chan['subSubPartition'],chan['FT'],chan['SL'],chan['CH'],BadChanInterpreter(badchOld),badchOld,BadChanInterpreter(badchNew),badchNew)+'  '+DispIOV
+          
+    if len(ListRemoved)!=0:
+        print ' '
+        print '*********************************************************************'
+        print 'List of removed channels:'
+        for Id,Blob in ListRemoved.iteritems():
+            badch  = Blob['badchanNew']
+            chan = GetChannelByOnlineId(Id)
+            DispIOV = '(IOV '+str(Blob['IOVSince']>>32)+' '+str(Blob['IOVSince']&0xFFFFFFFF)+')'
+            print '   ','channel=0x%x  %7s FT%d SL%d CH%d - %s (0x%x)' % (Id,chan['subSubPartition'],chan['FT'],chan['SL'],chan['CH'],BadChanInterpreter(badch),badch)+'  '+DispIOV
+
+
+    print ' '
+    print '  ','Between',DispDate1,'and',DispDate2,'in',list,':'
+    print '  ','There is',len(ListNew)+len(ListUp),'channels in the list.'
+    print '  ',len(ListNew),'are new,'
+    print '  ',len(ListUp),'were updated,'
+    print '  ',len(ListRemoved),'were removed.'
+
+
+#####################################################################
+#...main
+if __name__ == "__main__":
+
+    def PrintHelp():
+        print ' '
+        print ' '
+        print ' '
+        print '   **************************************************************************************************************************************************** '
+        print '   Print the changes in List between the two dates.'
+        print '   Use : '
+        print '   python '+sys.argv[0]+' dateSince dateUntil line list option'
+        print '   dateSince and dateUntil = IOV or dates with the format : YYYY-MM-DD:hh:mm:ss'
+        print '   line   = OFFLINE or ONLINE '
+        print '   list   = UPD1 / UPD3 / UPD4 / BULK-00 '
+        print '   option = Histo to draw histograms '
+        print '            FixedSizeBin to have fixed size bin'
+        print ' '
+        print '   Default values are:'        
+        print '   dateSince = No default value'
+        print '   dateUntil = cool.ValidityKeyMax (use -1 if you want cool.ValidityKeyMax and other arguments)'
+        print '   line      = OFFLINE'
+        print '   list      = UPD4'
+        print '   option    = ""'
+        print ' '
+        print '   Ex : python UPDTools.py 2011-02-16:00:00:00 -1 OFFLINE UPD4'
+        print '   **************************************************************************************************************************************************** '
+        print ' '
+        print ' '
+        print ' '
+
+    if len(sys.argv)<2:
+        PrintHelp()
+        sys.exit()
+        
+
+    #...Get the argument
+    dateUntil = -1
+    line      = 'OFFLINE'
+    list      = 'UPD4'
+    if len(sys.argv)>1:
+        dateSince = sys.argv[1]
+    if len(sys.argv)>2:
+        dateUntil = sys.argv[2]
+    if len(sys.argv)>3:
+        line = sys.argv[3]
+    if len(sys.argv)>4:
+        list = sys.argv[4]
+    if len(sys.argv)>5:
+        option = sys.argv[5]
+
+    #...Connect to the COOL database
+    if line=='ONLINE':
+        connect="oracle://ATLR;schema=ATLAS_COOLONL_LAR;dbname=COMP200"
+        folderName="/LAR/BadChannels/BadChannels"
+    elif line=='OFFLINE':
+        connect="oracle://ATLR;schema=ATLAS_COOLOFL_LAR;dbname=COMP200"
+        folderName="/LAR/BadChannelsOfl/BadChannels"
+    else:
+        PrintHelp()
+
+    dbSvc  = cool.DatabaseSvcFactory.databaseService()
+    db     = dbSvc.openDatabase(connect+";user=ATLAS_COOL_READER;password=COOLRED4PRO")
+
+        
+    #...Diplay the log and the summuray
+    DisplayBadChanBetweenDates(dateSince,dateUntil,list)
+    DisplayBadChanChangeLog(dateSince,dateUntil,list)
+#############################################################################
diff --git a/LArCalorimeter/LArMonitoring/python/LADIeS/WeeklyReport.py b/LArCalorimeter/LArMonitoring/python/LADIeS/WeeklyReport.py
new file mode 100644
index 00000000000..cd2b8a62315
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/LADIeS/WeeklyReport.py
@@ -0,0 +1,664 @@
+#! /usr/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Produce LAr DQ plots with all inefficiencies summarized
+# Author : B.Trocme
+
+import os, sys  
+import string
+from ROOT import *
+from ROOT import gStyle, TCanvas, TString, TPad,TPaveText
+from time import asctime,gmtime,localtime
+sys.path.append("../MiscLibraries")
+import MyCOOLlib
+import xmlrpclib
+
+import gb
+import time
+import runList
+
+sys.path.append("/afs/cern.ch/user/l/larcalib/LArDBTools/python/")
+
+import showEventVeto
+
+########################################################################
+def listify(l):
+  if len(l)==0: return ''
+  elif len(l)==1: return str(l[0]) 
+  l.sort()
+  interval=False
+  a = ''
+  for i in range(len(l)-1):
+    if interval: 
+      if l[i+1]-l[i]==1: pass
+      else: a += str(l[i])+' '; interval=False
+    else:
+      a += str(l[i])
+      if l[i+1]-l[i]==1: a += '-'; interval=True
+      else: a += ' '
+  a += str(l[-1])
+  return a
+
+########################################################################
+def printBoth(string,boolean,f):
+  print string
+  if boolean:# This is a single run report or the end of a weekly report - Also write on txt file
+    f.write(string+'\n')
+  return
+
+########################################################################
+def findLB(lbTimeStampS,startOfVetoPeriod):
+  for i in xrange(len(lbTimeStampS)):
+    if (startOfVetoPeriod<lbTimeStampS[i]):
+#      print startOfVetoPeriod,lbTimeStampS[i]
+      return i
+  return i
+
+########################################################################
+from DQDefects import DefectsDB
+
+partcolors = { 'EMBA':kYellow-9,'EMBC':kYellow,'EMECA':kOrange,'EMECC':kOrange-3,'HECA':kRed-3,'HECC':kRed+2,'FCALA':kBlue-3,'FCALC':kBlue+2}
+partitions = partcolors.keys()
+
+partIntolDefect = ["HVTRIP","SEVNOISEBURST","SEVCOVERAGE","HVNONNOMINAL","SEVNOISYCHANNEL"] # Order determines what defect is proeminent
+partTolDefect = ["NOISEBURST"]
+globIntolDefect = ["DATACORRUPT","RECOCORRUPT"]
+globTolDefect = []
+
+defectName = {"HVTRIP":"high voltage trip","NOISEBURST":"noise bursts (before veto)","HVNONNOMINAL":"HV non nominal(not corrected)","SEVNOISEBURST":"noise burst (after veto)","SEVNOISYCHANNEL":"noisy channels","SEVCOVERAGE":"coverage","DATACORRUPT":"data corruption","RECOCORRUPT":"corrupted reconstruction"}
+defectColor= {"HVTRIP":kBlue,"HVNONNOMINAL":kPink,"SEVNOISEBURST":kOrange,"SEVNOISYCHANNEL":kBlack,"SEVCOVERAGE":kRed,"DATACORRUPT":kGreen,"RECOCORRUPT":kMagenta} # Color only for intolerable defects
+
+# Options to switch by hand
+doplot = True;#doplot = False
+doSubPeriod = True;#doSubPeriod = False # Plot results in term of data period
+doSaveHisto = True;doSaveHisto = False # Save histo at the end
+keepVdM_LHC = True;#keepVDM_LHC = True; # Keep the special run (VDM or LHCComm)
+exactVetoComput = True;#exactVetoComput = False # By setting this flag to true, ignore veto period if LB affected by intol defect. Slower
+defectTag="";#defectTag = "DetStatus-v53-pro13-04"
+vetoTag="LARBadChannelsOflEventVeto-UPD4-04"
+
+if len(sys.argv) < 2  :
+    print
+    print "usage: python %s <run1> [<run2>]"%(sys.argv[0])
+    print
+    sys.exit()
+
+runlistToUse = runList.runlist2012
+runlistToUse = runlistToUse + runList.runlist2012_heavyIon
+runlistToUse = runlistToUse + runList.runlist2011
+
+
+runlist = []
+missingSignOff = []
+
+if len(sys.argv) == 2:
+  singleRunNumber = int(sys.argv[1])
+  doplot=False;doSubPeriod=False; doSaveHisto=False#Only 1 run - Do not produce plots, nor period plots, nor save them! 
+  singleRun=True
+  if (singleRunNumber not in (runlistToUse)):
+    print "------------>Please first add the run in the run list"
+    sys.exit()
+  runlist.append(singleRunNumber)
+
+if len(sys.argv) == 3:
+  startrun = int(sys.argv[1])
+  endrun   = int(sys.argv[2])+1
+  singleRun = False
+  runlistTmp = []
+  for runnum in (runlistToUse):
+    if (runnum>=startrun and runnum<endrun):
+      runlistTmp.append(runnum)
+# Retrieve data period - Not useful in single run
+  passfile = open("/afs/cern.ch/user/l/larmon/passfile.txt")
+  passwd = passfile.read().strip(); passfile.close()
+  s = xmlrpclib.ServerProxy('https://%s@atlasdqm.cern.ch'%(passwd))
+  run_spec = {'run_list': runlistTmp}
+  period = s.get_data_periods(run_spec)
+  periodlist = []
+  dataPeriod = {}
+  for runnum in runlistTmp:
+    if (len(period["%d"%(runnum)])>1):
+      dataPeriod[runnum]=period["%d"%(runnum)][1]
+      if (keepVdM_LHC or not("LHC" in dataPeriod[runnum] or "VdM" in dataPeriod[runnum])):
+        if (period["%d"%(runnum)][1] not in periodlist):
+          periodlist.append(period["%d"%(runnum)][1])
+    else:
+      dataPeriod[runnum]="???"
+    if (keepVdM_LHC or not("LHC" in dataPeriod[runnum] or "VdM" in dataPeriod[runnum])):
+      runlist.append(runnum)
+
+### Book Histograms - Run inefficiency per partition
+
+h1_partDefect = {}
+# Partition defects vs run number
+for idef in partIntolDefect+partTolDefect:
+  h1_partDefect[idef] = {}
+  for ipart in partitions:
+    h1_partDefect[idef][ipart] = gb.MakeTH1("h1_%s_%s"%(idef,ipart),"Run Number","Fraction of LBs with %s - %s"%(defectName[idef],ipart),-0.5,-0.5+len(runlist),len(runlist),partcolors[ipart])
+    gb.SetXLabel(h1_partDefect[idef][ipart],runlist)
+  h1_partDefect[idef]["AllPartitions"] = gb.MakeTProfile("h1_%s_AllPartitions"%(idef),"Run Number","Prop. of LBs with %s"%(defectName[idef]),-0.5,-0.5+len(runlist),len(runlist),1)
+  gb.SetXLabel(h1_partDefect[idef]["AllPartitions"],runlist)
+
+### Book Histograms for general plot with intolerable defects
+h1_shortrun = gb.MakeTProfile("h1_shortrun","Short Runs","",-0.5,-0.5+len(runlist),len(runlist),kCyan-3)
+
+h1_LArIntolDefect = {}
+if (doSubPeriod):
+  hProf_LArIntolDefect_period = {}
+  h1_LArIntolDefect_period = {} # Will be used later on to display properly the stacked histo
+for idef in globIntolDefect+partIntolDefect:#Intolerable defects only
+  h1_LArIntolDefect[idef] = gb.MakeTH1("h1_ineff_%s"%(idef),"%s"%(defectName[idef]),"Lost luminosity (%)", -0.5,+0.5+len(runlist),len(runlist)+1,defectColor[idef])
+  gb.SetXLabel(h1_LArIntolDefect[idef],runlist)
+  h1_LArIntolDefect[idef].GetXaxis().SetBinLabel(len(runlist)+1,"All")
+  if (doSubPeriod):
+    hProf_LArIntolDefect_period[idef] = gb.MakeTProfile("h1_ineff_%s_period"%(idef),"%s"%(defectName[idef]),"Lost luminosity (%)", -0.5,+0.5+len(periodlist),len(periodlist)+1,defectColor[idef])
+    gb.SetXLabel(hProf_LArIntolDefect_period[idef],periodlist)
+    hProf_LArIntolDefect_period[idef].GetXaxis().SetBinLabel(len(periodlist)+1,"All")
+    
+
+# Book histograms for time window veto
+hprof_veto_snb = gb.MakeTProfile("hprof_veto_snb","","Inefficiency - Time veto (%)", -0.5,+0.5+len(runlist),len(runlist)+1,1)
+hprof_veto_dc = gb.MakeTProfile("hprof_veto_dc","","", -0.5,+0.5+len(runlist),len(runlist)+1,1)
+hprof_veto_snb.SetMarkerStyle(22)
+hprof_veto_dc.SetMarkerStyle(23)
+hprof_veto_snb.SetMarkerColor(kBlue)
+hprof_veto_dc.SetMarkerColor(kRed)
+gb.SetXLabel(hprof_veto_snb,runlist)
+hprof_veto_snb.GetXaxis().SetBinLabel(len(runlist)+1,"All")
+if (doSubPeriod):
+  hprof_veto_snb_period = gb.MakeTProfile("hprof_veto_snb_period","","Inefficiency - Time veto (%)", -0.5,+0.5+len(periodlist),len(periodlist)+1,1)
+  hprof_veto_dc_period = gb.MakeTProfile("hprof_veto_dc_period","","", -0.5,+0.5+len(periodlist),len(periodlist)+1,1)
+  hprof_veto_snb_period.SetMarkerStyle(22)
+  hprof_veto_dc_period.SetMarkerStyle(23)
+  hprof_veto_snb_period.SetMarkerColor(kBlue)
+  hprof_veto_dc_period.SetMarkerColor(kRed)
+  gb.SetXLabel(hprof_veto_snb_period,periodlist)
+  hprof_veto_snb_period.GetXaxis().SetBinLabel(len(periodlist)+1,"All")
+  gb.SetXLabel(hprof_veto_dc_period,periodlist)
+  hprof_veto_dc_period.GetXaxis().SetBinLabel(len(periodlist)+1,"All")
+ 
+
+if (singleRun): pass # File report defined later f = open('Reports/Run/report-%s.txt' % (startrun), 'w')
+else: f = open('Reports/Weekly/report-%s-%s.txt' % (startrun, endrun), 'w')
+
+defAffLumiAllRuns = {}
+for idef in partIntolDefect+partTolDefect+globIntolDefect+globTolDefect:
+  defAffLumiAllRuns[idef] = 0.
+lumiTotAllRuns = 0
+totLumiVetoDB = 0.; totLumi_veto_snb = 0.; totLumi_veto_dc = 0. # Luminosity affected by time window veto - WARNING: the lumi used to normalize may be slightly different from the ones used elsewhere
+heavyIonRun=True # Bit to correctly display the luminosity in heavy ions
+firstEntry = True
+
+#### Loop over selected runs
+for irun,runnum in enumerate(runlist):
+
+  print "=============================================================" 
+  print "=============================Run %d======================"%(runnum) 
+  # Init variables - List (indexed by partition) of tables of lumi blocks affected by defects
+  lbAffected = {}
+  for idef in partIntolDefect+partTolDefect:
+    lbAffected[idef] = {}
+  for idef in globIntolDefect+globTolDefect:
+    lbAffected[idef] = [] # Global defect - Simple list and not dictionnary
+  lbAffected["IntolDefect"] = [] # List of LBs affected with intolerable defect independant of the defect/partition
+
+  exprSignedOff = True
+  bulkSignedOff = True
+
+  # Get run infos
+  # Luminosity blocks UTC timestamps
+  LBTS = MyCOOLlib.GetLBTimeStamps(runnum)
+  # Number of luminosity blocks
+  nLB = len(LBTS)-1
+  # Online COOL preferred luminosity for this LB
+  atlaslumi = MyCOOLlib.GetOnlineLumiFromCOOL(runnum,nLB,0)
+#  atlaslumi = MyCOOLlib.GetOfflineLumiFromCOOL(runnum,nLB,0)
+  duration = MyCOOLlib.GetLBDuration(runnum)
+  PeakLumi = 0.
+  # Look for peak lumi
+  for lb in atlaslumi: 
+    if lb > PeakLumi: PeakLumi=lb 
+    if lb > 1: heavyIonRun=False# Lumi in 10^30
+  # Atlas Ready
+  atlasready=MyCOOLlib.GetReadyFlag(runnum)
+  readylist=[lb+1 for lb in xrange(len(atlasready)) if atlasready[lb]>0 ]
+  nLBReady = float(len(readylist))    
+  nBunches = MyCOOLlib.GetNumberOfCollidingBunches(runnum)
+  # Keep track of short runs
+  if (nLBReady<100): h1_shortrun.Fill(irun,3.)
+
+  # Get defects
+  db = DefectsDB(tag=defectTag)
+  lar_defects = [d for d in (db.defect_names | db.virtual_defect_names) if d.startswith("LAR")]
+  defects = db.retrieve((runnum, 1), (runnum+1, 0), lar_defects)    
+  #    nHVTrips = 0 - STILL RELEVANT??
+
+  # Look over all defects and store in list (1 per partition and type) the affected LB
+  # Consider only LB in readylist
+  for defect in defects:
+    # keep track of runs with missing sign-off
+    if 'UNCHECKED' in defect.channel: missingSignOff.append([runnum,defect.channel])
+    #print defect.since.run,defect.since.lumi,defect.until.lumi,defect.channel
+    defectSplitted = defect.channel.split("_")
+    partAffected=defectSplitted[1] # Return dummy value for a non partition defect but not problematic
+    defectFound=defectSplitted[len(defectSplitted)-1] # take the last part of the name - May not work with zerobias_unsparsified
+
+    for idef in partIntolDefect+partTolDefect:
+      if idef==defectFound:
+        for lb in range(defect.since.lumi,defect.until.lumi):
+          if((lb in readylist) or nLBReady==0):
+            if not lbAffected[idef].has_key(partAffected):
+              lbAffected[idef][partAffected]=[]
+            lbAffected[idef][partAffected].append(lb)
+            if ((idef in partIntolDefect) and lb not in lbAffected["IntolDefect"]):
+              lbAffected["IntolDefect"].append(lb)
+
+    for idef in globIntolDefect+globTolDefect:
+      if idef==defectFound:
+        for lb in range(defect.since.lumi,defect.until.lumi):
+          if((lb in readylist) or nLBReady==0):
+            lbAffected[idef].append(lb)
+          if ((idef in partIntolDefect) and lb not in lbAffected["IntolDefect"]):
+            lbAffected["IntolDefect"].append(lb)
+
+
+# When all defects have been found, fill per partition histos
+  for ipart in partitions:
+    if nLBReady>0:
+      nLBRef = float(nLBReady)
+    else:
+      nLBRef = float(nLB)
+    for idef in partIntolDefect+partTolDefect:
+      if lbAffected[idef].has_key(ipart):
+        h1_partDefect[idef][ipart].Fill(irun,100.*float(len(lbAffected[idef][ipart]))/nLBRef)
+      
+
+# Now remove duplication between partition/defects (intolerable only!)
+# lbAffected[idef]["AllPartition"] are referred to all partition for this run
+  lbAffectedPrevDef = []
+  for idef in partIntolDefect:
+    lbAffected[idef]["AllPartitions"]=[]
+    for ipart in partitions:
+      if lbAffected[idef].has_key(ipart):
+        for lumiBlock in lbAffected[idef][ipart]:
+          if (lumiBlock not in lbAffected[idef]["AllPartitions"]) and (lumiBlock not in lbAffectedPrevDef):
+            lbAffected[idef]["AllPartitions"].append(lumiBlock)
+            lbAffectedPrevDef.append(lumiBlock)
+  for idef in partTolDefect: # In tolerable defect, do not remove overlap with previous defects
+    lbAffected[idef]["AllPartitions"]=[]
+    for ipart in partitions:
+      if lbAffected[idef].has_key(ipart):
+        for lumiBlock in lbAffected[idef][ipart]:
+          if (lumiBlock not in lbAffected[idef]["AllPartitions"]):
+            lbAffected[idef]["AllPartitions"].append(lumiBlock)
+        
+  # Extract inst. lumi to cumpute affected luminosity
+  defAffLumiRun = {}
+  for idef in (partIntolDefect+partTolDefect+globIntolDefect+globTolDefect):
+    defAffLumiRun[idef] = 0.
+  lumiTotRun = 0
+  if nLBReady>0:
+    lbrange=range(readylist[0],readylist[len(readylist)-1]+1)
+  else:
+    lbrange=range(1,nLB)
+  for lb in lbrange:
+    lumiTotRun = lumiTotRun +atlaslumi[lb-1]*duration[lb-1]
+    lumiTotAllRuns = lumiTotAllRuns +atlaslumi[lb-1]*duration[lb-1]
+    for idef in (partIntolDefect+partTolDefect):
+      if lb in lbAffected[idef]["AllPartitions"]:
+        defAffLumiRun[idef] = defAffLumiRun[idef] + atlaslumi[lb-1]*duration[lb-1]
+        defAffLumiAllRuns[idef] = defAffLumiAllRuns[idef] + atlaslumi[lb-1]*duration[lb-1]
+
+    for idef in (globIntolDefect+globTolDefect): # Duplicate with partdefect to be fixed
+      if lb in lbAffected[idef]:
+        defAffLumiRun[idef] = defAffLumiRun[idef] + atlaslumi[lb-1]*duration[lb-1]
+        defAffLumiAllRuns[idef] = defAffLumiAllRuns[idef] + atlaslumi[lb-1]*duration[lb-1]
+
+  if runnum == 211541: # STILL RELEVANT?
+     lumiTotRun = 3.344
+     
+  if lumiTotRun==0: lumiTotRun=1e-50
+  # Fill AllPartitions histos for partition defects
+  LArIneffRun = 0
+  for idef in (partIntolDefect):
+    h1_partDefect[idef]["AllPartitions"].Fill(irun,100*defAffLumiRun[idef]/lumiTotRun)
+    LArIneffRun = LArIneffRun + defAffLumiRun[idef]
+    h1_LArIntolDefect[idef].Fill(irun,100*defAffLumiRun[idef]/lumiTotRun)
+    if (doSubPeriod and dataPeriod[runnum]!="???"):
+      hProf_LArIntolDefect_period[idef].Fill(periodlist.index(dataPeriod[runnum]),100*defAffLumiRun[idef]/lumiTotRun,lumiTotRun)
+      hProf_LArIntolDefect_period[idef].Fill(len(periodlist),100*defAffLumiRun[idef]/lumiTotRun,lumiTotRun)
+  for idef in (partTolDefect):
+    h1_partDefect[idef]["AllPartitions"].Fill(irun,100*defAffLumiRun[idef]/lumiTotRun)
+  for idef in (globIntolDefect):
+    LArIneffRun = LArIneffRun + defAffLumiRun[idef]
+    h1_LArIntolDefect[idef].Fill(irun,100*defAffLumiRun[idef]/lumiTotRun) 
+    if (doSubPeriod and dataPeriod[runnum]!="???"):
+      hProf_LArIntolDefect_period[idef].Fill(periodlist.index(dataPeriod[runnum]),100*defAffLumiRun[idef]/lumiTotRun,lumiTotRun) 
+      hProf_LArIntolDefect_period[idef].Fill(len(periodlist),100*defAffLumiRun[idef]/lumiTotRun,lumiTotRun)
+  for idef in (globTolDefect):
+    h1_partDefect[idef]["AllPartitions"].Fill(irun,100*defAffLumiRun[idef]/lumiTotRun)
+   
+  LArIneffRun=100*LArIneffRun/lumiTotRun
+
+  # Retrieve the length of time period vetoed
+  db="COOLOFL_LAR/COMP200"
+  totalVeto = showEventVeto.showEventVetoFolder(db,vetoTag,runnum,runnum,0)
+  #print "totalVeto,totalVeto/1.e9:",totalVeto,[y/1.e9 for y in totalVeto]
+  lumiUsed = 0.
+  if (exactVetoComput):# Computation of veto rejection w/o considering LB already in defect list - Slower...
+    veto_snb = 0
+    for iVetoedLB in xrange(len(totalVeto["allNoise"])): 
+      lb = findLB(LBTS,totalVeto["allNoise"][iVetoedLB][0]/1e9)
+#      print iVetoedLB,totalVeto["allNoise"][iVetoedLB][0]/1e9,lb,(totalVeto["allNoise"][iVetoedLB][1]-totalVeto["allNoise"][iVetoedLB][0])/1e9
+      if (lb not in lbAffected["IntolDefect"]):
+          veto_snb = veto_snb + atlaslumi[lb-1]*((totalVeto["allNoise"][iVetoedLB][1]-totalVeto["allNoise"][iVetoedLB][0])/1e9)
+    veto_snb = veto_snb/lumiTotRun*100.
+
+    veto_dc = 0
+    for iVetoedLB in xrange(len(totalVeto["allCorruption"])):
+      lb = findLB(LBTS,totalVeto["allCorruption"][iVetoedLB][0]/1e9)
+#      print iVetoedLB,totalVeto["allCorruption"][iVetoedLB][0]/1e9,lb,(totalVeto["allCorruption"][iVetoedLB][1]-totalVeto["allCorruption"][iVetoedLB][0])/1e9
+      if (lb not in lbAffected["IntolDefect"]):
+          veto_dc = veto_dc + atlaslumi[lb-1]*((totalVeto["allCorruption"][iVetoedLB][1]-totalVeto["allCorruption"][iVetoedLB][0])/1e9)
+    veto_dc = veto_dc/lumiTotRun*100.
+
+    lumiUsed = lumiTotRun
+  else:
+    veto_snb = totalVeto['noiseBurst'][2]*100/totalVeto['totalLumi']
+    veto_dc = totalVeto['corruption'][2]*100/totalVeto['totalLumi']
+    lumiUsed = totalVeto['totalLumi']
+
+  veto_all = veto_snb+veto_dc
+  hprof_veto_snb.Fill(irun,veto_snb)
+  hprof_veto_dc.Fill(irun,veto_dc)
+  hprof_veto_snb.Fill(len(runlist),veto_snb,lumiUsed) # Fill last bins (all runs)
+  hprof_veto_dc.Fill(len(runlist),veto_dc,lumiUsed) # Fill last bins (all runs)
+  if (doSubPeriod and dataPeriod[runnum]!="???"):
+    hprof_veto_snb_period.Fill(periodlist.index(dataPeriod[runnum]),veto_snb,lumiUsed)
+    hprof_veto_dc_period.Fill(periodlist.index(dataPeriod[runnum]),veto_dc,lumiUsed)
+    hprof_veto_snb_period.Fill(len(periodlist),veto_snb,lumiUsed) # Fill last bins (all runs)
+    hprof_veto_dc_period.Fill(len(periodlist),veto_dc,lumiUsed) # Fill last bins (all runs)
+  totLumi_veto_snb = totLumi_veto_snb + lumiUsed/100*veto_snb
+  totLumi_veto_dc = totLumi_veto_dc + lumiUsed/100*veto_dc
+  totLumiVetoDB = totLumiVetoDB+lumiUsed
+
+  # Writing the report in a text file for WeeklyReports
+  normLB = 1. # Set it to 60 by hand if the true duration is not retrieved from LB
+  if (firstEntry and not singleRun):
+    firstEntry = False
+    column = []
+    labels_col = ["Run","Run start / stop","LB ready","Peak lumi","Int. lumi","GRL ineff.","Veto ineff.","Period","Status"]
+    labels_xlow = [0.01,0.08,0.41,0.49,0.58,0.665,0.755,0.855,0.925,0.99]
+    for i in xrange(len(labels_col)):
+      column.append(TPaveText(labels_xlow[i],max(.99-0.08*len(runlist),0.01),labels_xlow[i+1],0.99))
+      column[i].AddText(labels_col[i])
+      if (i%2 == 0):
+        column[i].SetFillColor(kOrange-3)
+      else:
+        column[i].SetFillColor(kGreen+2)
+                      
+  if (not singleRun and irun<25): # This is a weekly report
+    column[0].AddText("%d"%(runnum))
+    column[1].AddText("%s / %s"%(time.strftime("%a, %d %b %H:%M",time.localtime(LBTS[0])),(time.strftime("%a, %d %b %H:%M",time.localtime(LBTS[len(LBTS)-1])))))
+    column[2].AddText("%s"%(listify(readylist)))
+    if heavyIonRun:
+      column[3].AddText("%.1f.10^28"%(PeakLumi*1e2))
+      column[4].AddText("~%.1f ub-1"%(lumiTotRun*normLB))
+    else:
+      column[3].AddText("%d.10^32"%(int(PeakLumi)/100))
+      column[4].AddText("~%d pb-1"%(int(lumiTotRun*normLB/1e6)))
+    column[5].AddText("%.1f %%"%(LArIneffRun))
+    column[6].AddText("%.1f %%"%(veto_all))
+    column[7].AddText("%s"%(dataPeriod[runnum]))
+    if ([runnum,"LAR_UNCHECKED"] in missingSignOff): # Express stream not yet signed off
+      column[8].AddText("EXPR.")
+    else:
+      if ([runnum,"LAR_BULK_UNCHECKED"] in missingSignOff):
+        column[8].AddText("BULK")
+      else:
+        column[8].AddText("DONE")
+
+  if singleRun: # For single run, create a report file if only the run was signed off
+    if ([runnum,"LAR_UNCHECKED"] in missingSignOff): # Express stream not yet signed off
+      exprSignedOff = False
+      bulkSignedOff = False
+      f = open('Reports/Run/Dummy.txt', 'w')
+    else:
+      if ([runnum,"LAR_BULK_UNCHECKED"] in missingSignOff):
+        bulkSignedOff = False
+        f = open('Reports/Run/%sExpress.txt' % (runnum), 'w')
+        f.write('Offline LAr DQ (Express) - Run %d\n'%(runnum))
+      else:
+        exprSignedOff = False
+        f = open('Reports/Run/%sBulk.txt' % (runnum), 'w')          
+        f.write('Offline LAr DQ (Bulk) - Run %d\n'%(runnum))
+
+  printBoth('Run start : %s'%(time.strftime("%a, %d %b %H:%M",time.localtime(LBTS[0]))),singleRun and exprSignedOff,f)
+  printBoth('Run stop  : %s'%(time.strftime("%a, %d %b %H:%M",time.localtime(LBTS[len(LBTS)-1]))),singleRun and exprSignedOff,f)
+  printBoth('LB with ATLAS ready = %9s'%(listify(readylist)),singleRun and exprSignedOff,f)
+  if singleRun and exprSignedOff: f.write('Nb of bunches = %d\n'%(nBunches))
+  if heavyIonRun:
+    printBoth('Peak lumi = %.1f * 10^28'%(PeakLumi*1e2),singleRun and exprSignedOff,f)
+  else:
+    printBoth('Peak lumi = %d * 10^32'%(int(PeakLumi)/100),singleRun and exprSignedOff,f)
+  if singleRun and exprSignedOff:
+    if heavyIonRun:
+      f.write('Integrated lumi ~ %.1f ub-1\n\n'%(lumiTotRun*normLB))
+    else:
+      f.write('Integrated lumi ~ %d pb^-1\n\n'%(int(lumiTotRun*normLB/1e6)))
+  printBoth('LAr performance=================================================',singleRun and bulkSignedOff,f)
+  for idef in (globIntolDefect):
+    if (len(lbAffected[idef])>0):
+      printBoth('Nb of LBs with %24s: %i -> %.2f%%'%(string.ljust(defectName[idef],24),len(lbAffected[idef]),defAffLumiRun[idef]/lumiTotRun*100),singleRun and bulkSignedOff,f)
+      print "-----> LBs affected : ",lbAffected[idef]
+  for idef in (partIntolDefect):
+    if (len(lbAffected[idef]["AllPartitions"])>0):
+      printBoth('Nb of LBs with %24s: %i -> %.2f%%'%(string.ljust(defectName[idef],24),len(lbAffected[idef]["AllPartitions"]),defAffLumiRun[idef]/lumiTotRun*100),singleRun and bulkSignedOff,f)
+      print "-----> LBs affected : ",lbAffected[idef]["AllPartitions"]
+      
+  printBoth('LAr GRL inefficiency                   : %.2f%%'%(LArIneffRun),singleRun and bulkSignedOff,f)
+  printBoth('LAr data corruption veto inefficiency  : %.2f%%'%(veto_dc),singleRun and bulkSignedOff,f)
+  printBoth('LAr noise burst veto inefficiency      : %.2f%%\n'%(veto_snb),singleRun and (exprSignedOff or bulkSignedOff),f)
+  if (veto_snb < 0.01):
+    print "WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING"
+    print "The veto inefficiency is very low. If this is a high lumi run, this is surprising and this means that the time veto veto was probably not updated."
+    print "In this case, make sure that it is done before the end of the calib loop by getting in contact with db expert" 
+    print "WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING===WARNING"
+  if singleRun and exprSignedOff: f.write('High voltage trips===============================================\n')
+  if singleRun and exprSignedOff: f.write('Please detail here the different trips with the LBs affected and\n')
+  if singleRun and exprSignedOff: f.write('link to ATLOG.Indicate whether the noise was corrected or not yet.\n')
+  if singleRun and exprSignedOff: f.write('Link to HV trip db : https://atlas-larmon.cern.ch/HVTripsDB/index.py?query=select%%20+trips.rowid,*+from+trips+INNER+JOIN+details+ON+trips.HVLINE+=+details.HVLINE+where+trips.TripRunNumber=%d'%(runnum))
+  if singleRun and exprSignedOff: f.write('\nUPD4 bad channels flagging during 48 hours calib loop==========\n')
+  if singleRun and exprSignedOff: f.write('Total number of sporadicBurstNoise(PS) : ???(???)\n')
+  if singleRun and exprSignedOff: f.write('Total number of highNoiseHG(PS)        : ???(???)\n')
+  if singleRun and bulkSignedOff: f.write('\nUPD3 bad channels flagging for future reprocessing ============\n')
+  if singleRun and bulkSignedOff: f.write('Total number of sporadicBurstNoise(PS) : ???(???)\n')
+  if singleRun and bulkSignedOff: f.write('Total number of highNoiseHG(PS)        : ???(???)\n')
+  if singleRun and (exprSignedOff or bulkSignedOff): f.write('\nAdditionnal remarks==============================================\n')
+  if singleRun and (exprSignedOff or bulkSignedOff): f.write('Any remark related to data taking, CP groups observations...\n')
+  
+  if (singleRun):
+    if (exprSignedOff) : print "Please use the elog skeleton in : Reports/Run/%sExpress.txt"%(runnum)
+    if (bulkSignedOff) : print "Please use the elog skeleton in : Reports/Run/%sBulk.txt"%(runnum)
+# End of loop on runs
+    
+# Treatment when a run range was considered (weekly report)
+if (not singleRun and lumiTotAllRuns!=0):
+  # Compute inefficiencies for the whole period
+  lostLumiAllRuns = 0.
+  for idef in (partIntolDefect+globIntolDefect):
+    lostLumiAllRuns = lostLumiAllRuns + defAffLumiAllRuns[idef]
+
+
+  if heavyIonRun:
+    printBoth("Number of runs:%i  Total Luminosity:%.2f ub-1"%(len(runlist),lumiTotAllRuns*normLB),True,f)
+  else:
+    printBoth("Number of runs:%i  Total Luminosity:%.2f pb-1"%(len(runlist),lumiTotAllRuns*normLB/1e6),True,f)
+  printBoth( "Period GRL inefficiency     : %.2f%%"%(lostLumiAllRuns/lumiTotAllRuns*100),True,f)
+  for idef in (partIntolDefect+globIntolDefect):
+    printBoth( " - %24s : %.2f%%"%(string.ljust(defectName[idef],24),defAffLumiAllRuns[idef]/lumiTotAllRuns*100),True,f)
+    h1_LArIntolDefect[idef].Fill(len(runlist),defAffLumiAllRuns[idef]/lumiTotAllRuns*100)
+     # The filling for the period TProfile was done before.
+     # This is correct as this is a TProfile. It is not possible for run TH1.
+#    if (doSubPeriod):
+#      hProf_LArIntolDefect_period[idef].Fill(len(periodlist),defAffLumiAllRuns[idef]/lumiTotAllRuns*100)
+  printBoth( "Period veto inefficiency:",True,f)
+  printBoth( " - data corruption: %.2f%%"%(totLumi_veto_dc*100/totLumiVetoDB),True,f)
+  printBoth( " - noise bursts   : %.2f%%"%(totLumi_veto_snb*100/totLumiVetoDB),True,f)
+#  h1_veto_snb.Fill(len(runlist),totLumi_veto_snb*100/totLumiVetoDB)
+#  h1_veto_dc.Fill(len(runlist),totLumi_veto_dc*100/totLumiVetoDB)
+
+  column[0].AddText("All")
+  column[1].AddText("-")
+  column[2].AddText("-")
+  column[3].AddText("-")
+  if heavyIonRun:
+    column[4].AddText("~%.1f ub-1"%(lumiTotAllRuns*normLB))
+  else:
+    column[4].AddText("~%d pb-1"%(int(lumiTotAllRuns*normLB/1e6)))
+  column[5].AddText("%.2f %%"%(lostLumiAllRuns/lumiTotAllRuns*100))
+  column[6].AddText("%.2f %%"%((totLumi_veto_dc+totLumi_veto_snb)*100/totLumiVetoDB))
+  column[7].AddText("-")
+  column[8].AddText("-")
+
+## Checks runs with missing Sign-Off
+  print "---------------------------------"
+  print "Runs with missing sign-off"
+  print "---------------------------------"
+  for item in missingSignOff:
+    print "@%s"%(item[0])
+    print "%s G # Signed off"%(item[1])
+#    print "---> WARNING for run %s: %s"%(item[0],item[1])
+  print "---------------------------------"
+
+f.close()
+### Show Plots
+if doplot:
+  c1=TCanvas("Summary","Summary for the whole period",10,10,1000,600)
+  for i in xrange(len(column)):
+    column[i].Draw()
+#  raw_input("Press Enter To Continue: ")
+  c1.Print('Plots/Summary-%s-%s.png' % (startrun, endrun))
+
+  gStyle.SetOptStat(0)
+  gStyle.SetHistMinimumZero()
+
+  c2= TCanvas( 'c2',"LAr inefficiency (GRL) vs Run Number", 200, 10, 1000, 500)
+  c2.SetGridy(1)
+  h_stack_ineff = THStack("h_stack_ineff","")
+  lg2 = gb.MakeLegend(0.65,0.65,0.8,0.9)
+  lg2.AddEntry(h1_shortrun,"short run (nLBs<100)","p")
+  for idef in (globIntolDefect+partIntolDefect):
+    h_stack_ineff.Add(h1_LArIntolDefect[idef])
+    if (h1_LArIntolDefect[idef].GetMaximum() != 0): lg2.AddEntry(h1_LArIntolDefect[idef],defectName[idef],"f")
+  mx = h_stack_ineff.GetMaximum()*1.2
+  h_stack_ineff.SetMaximum(mx)
+  h_stack_ineff.Draw("hist")
+  h_stack_ineff.GetYaxis().SetTitle("Run number")
+  h_stack_ineff.GetYaxis().SetTitle("Lost luminosity - GRL (%)")
+  # mark shortruns
+  h1_shortrun.SetMarkerStyle(29)
+  h1_shortrun.SetMarkerSize(2.)
+  h1_shortrun.Draw("psame")
+  lg2.Draw()
+#  raw_input("Press Enter To Continue: ")
+  c2.Print('Plots/LArIneffVsRunNumber-%s-%s.png' % (startrun, endrun))
+
+  if (doSubPeriod):
+    c3= TCanvas( 'c3',"LAr inefficiency (GRL) vs Period", 200, 10, 1000, 500)
+    c3.SetGridy(1)
+    h_stack_ineff_period = THStack("h_stack_ineff","")
+    lg3 = gb.MakeLegend(0.65,0.65,0.8,0.9)
+    for idef in (globIntolDefect+partIntolDefect):
+      h1_LArIntolDefect_period[idef]=hProf_LArIntolDefect_period[idef].ProjectionX()# Need to project to transform TProfile in TH1 to allow stacking
+      h1_LArIntolDefect_period[idef].SetFillColor(defectColor[idef])
+      h_stack_ineff_period.Add(h1_LArIntolDefect_period[idef])
+      if (hProf_LArIntolDefect_period[idef].GetMaximum() != 0): lg3.AddEntry(hProf_LArIntolDefect_period[idef],defectName[idef],"f")
+    mx = h_stack_ineff_period.GetMaximum()*1.2
+    h_stack_ineff_period.SetMaximum(mx)
+    h_stack_ineff_period.Draw("hist")
+    h_stack_ineff_period.GetYaxis().SetTitle("Period")
+    h_stack_ineff_period.GetYaxis().SetTitle("Lost luminosity - GRL (%)")
+    lg3.Draw()
+#    raw_input("Press Enter To Continue: "
+    c3.Print('Plots/LArIneffVsPeriod-%s-%s.png' % (startrun, endrun))    
+
+  c4= TCanvas('c4',"LAr inefficiency (Time veto) vs Run Number", 200, 10, 1000, 500)
+  c4.SetGridy(1)
+  c4.SetLogy(1)
+  hprof_veto_snb.SetMaximum(max(hprof_veto_snb.GetMaximum(),hprof_veto_dc.GetMaximum())*2)
+  hprof_veto_snb.SetTitle("")
+  hprof_veto_snb.Draw("P")
+  hprof_veto_dc.Draw("PSAME")
+  h1_shortrun.Draw("psame")
+  lg4 = gb.MakeLegend(0.65,0.65,0.8,0.9)
+  lg4.AddEntry(hprof_veto_snb,"Noise bursts")
+  lg4.AddEntry(hprof_veto_dc,"Data corruption")
+  lg4.AddEntry(h1_shortrun,"short run (nLBs<100)","p")
+  lg4.Draw()
+#  raw_input("Press Enter To Continue: ")
+  c4.Print('Plots/LArIneffTimevetoVsRunNumber-%s-%s.png' % (startrun, endrun))
+
+  if (doSubPeriod):
+    c5= TCanvas('c5',"LAr inefficiency (Time veto) vs Period", 200, 10, 1000, 500)
+    c5.SetGridy(1)
+    c5.SetLogy(1)
+    hprof_veto_snb_period.SetMaximum(max(hprof_veto_snb_period.GetMaximum(),hprof_veto_dc_period.GetMaximum())*2)
+    hprof_veto_snb_period.SetTitle("")
+    hprof_veto_snb_period.Draw("P")
+    hprof_veto_dc_period.Draw("PSAME")
+    lg5 = gb.MakeLegend(0.65,0.65,0.8,0.9)
+    lg5.AddEntry(hprof_veto_snb_period,"Noise bursts")
+    lg5.AddEntry(hprof_veto_dc_period,"Data corruption")
+    lg5.Draw()
+#    raw_input("Press Enter To Continue: ")
+    c5.Print('Plots/LArIneffTimevetoVsPeriod-%s-%s.png' % (startrun, endrun))
+
+
+  hStackPartDefect = {}
+  cStack = {}
+  lg = gb.MakeLegend(0.70,0.55,0.80,0.85)
+  for ipart in partitions:
+    lg.AddEntry(h1_partDefect["HVTRIP"][ipart],ipart,"f")
+      
+  for idef in partIntolDefect+partTolDefect:
+    hStackPartDefect[idef] = THStack("hs_%s"%(idef),"%s"%(defectName[idef]))
+    for ipart in partitions:
+      hStackPartDefect[idef].Add(h1_partDefect[idef][ipart])
+      hStackPartDefect[idef].SetMaximum(hStackPartDefect[idef].GetMaximum()*1.4)
+    if (hStackPartDefect[idef].GetMaximum() != 0.):
+      cStack[idef]=TCanvas( "canvas%s"%(idef),"%s vs Run Number"%(defectName[idef]), 200, 10, 1000, 650)
+      cStack[idef].Divide(1,2)
+      cStack[idef].cd(1)
+      hStackPartDefect[idef].Draw("hist")
+      hStackPartDefect[idef].GetXaxis().SetLabelSize(0.08)
+      hStackPartDefect[idef].GetYaxis().SetTitle("% of unrecoverable LBs       ")
+      lg.Draw()
+      cStack[idef].cd(2)
+      h1_partDefect[idef]["AllPartitions"].Draw("p")
+      h1_partDefect[idef]["AllPartitions"].GetXaxis().SetLabelSize(0.08)
+      cStack[idef].Update()
+      cStack[idef].Print('Plots/%sVsRunNumber-%s-%s.png' % (idef,startrun, endrun))
+#      raw_input("Press Enter To Continue: ")
+
+
+if (doSaveHisto):
+  f = TFile("weeklyHisto.root","recreate")
+  for idef in (globIntolDefect+partIntolDefect):
+    h1_LArIntolDefect[idef].Write()
+    if (doSubPeriod):
+      h1_LArIntolDefect_period[idef].Write()
+  h_stack_ineff.Write()
+  hprof_veto_snb.Write()
+  hprof_veto_dc.Write()
+  if (doSubPeriod):
+    h_stack_ineff_period.Write()
+    hprof_veto_snb_period.Write()
+    hprof_veto_dc_period.Write()
+  f.Close()
+  print "Histos saved!"
+
+  
+#raw_input("Press Enter To Continue: ")
+
+    
diff --git a/LArCalorimeter/LArMonitoring/python/LADIeS/runList.py b/LArCalorimeter/LArMonitoring/python/LADIeS/runList.py
new file mode 100644
index 00000000000..98ac3f6d652
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/LADIeS/runList.py
@@ -0,0 +1,12 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+## LADIeS : please add in this list all new runs with stable beam
+runlist2011 = [177986,178020,178021,178026,178044,178047,178109,178163,178211,178229,178264,179581,179710,179725,179739,179771,179804,179938,179939,179940,180122,180124,180139,180144,180153,180164,180225,180241,180242,180309,180400,180448,180481,180614,180636,180664,180710,180776,182008,182013,182032,182034,182161,182284,182346,182372,182424,182449,182450,182454,182455,182456,182486,182516,182518,182519,182726,182747,182766,182787,182796,182879,182886,182997,183003,183021,183038,183045,183054,183078,183081,183112,183127,183129,183130,183216,183272,183286,183347,183391,183407,183412,183426,183462,183544,183580,183581,183602,183780,183963,184022,184066,184072,184074,184088,184130,184169,185353,185518,185536,185644,185649,185731,185747,185761,185823,185856,185976,185998,186049,186156,186169,186178,186179,186180,186182,186214,186216,186217,186275,186361,186396,186399,186456,186493,186516,186532,186533,186669,186673,186721,186729,186753,186755,186873,186877,186878,186923,186933,186934,186965,187014,187196,187219,187453,187457,187501,187552,187763,187811,187812,187815,188902,188903,188906,188908,188909,188910,188921,188949,188951,189011,189027,189028,189049,189079,189090,189184,189205,189207,189242,189280,189288,189366,189372,189421,189424,189425,189481,189483,189530,189536,189561,189598,189602,189610,189639,189655,189660,189692,189693,189719,189751,189774,189781,189813,189822,189836,189845,189875,189963,189965,190046,190116,190119,190120,190236,190256,190295,190297,190300,190343,190503,190504,190505,190608,190611,190617,190618,190643,190644,190661,190689,190728,190872,190878,190933,190934,190975,191138,191139,191149,191150,191190,191217,191218,191235,191239,191381,191425,191426,191428,191513,191514,191517,191628,191635,191676,191715,191920,191933]
+
+runlist2011_heavyIon = [193211,193270,193291,193294,193295,193321,193402,193403,193411,193412,193447,193463,193481,193491,193492,193493,193494,193546,193558,193599,193604,193641,193655,193662,193679,193687,193718,193795,193823,193825,193826,193834,193890,194017,194056,194059,194060,194061,194079,194121,194160,194163,194179,194192,194193,194287,194370,194374,194382]
+
+runlist2012 = [200804,200805,200841,200842,200863,200913,200926,200965,200967,200982,200987,201006,201052,201113,201120,201138,201190,201191,201257,201269,201280,201289,201351,201383,201489,201494,201555,201556,202660,202668,202712,202740,202798,202965,202987,202991,203027,203169,203191,203195,203228,203256,203258,203277,203335,203336,203353,203432,203454,203456,203523,203524,203602,203605,203636,203680,203719,203739,203745,203760,203779,203792,203875,203876,203934,204025,204026,204071,204073,204134,204153,204158,204240,204265,204416,204442,204474,204564,204633,204668,204707,204726,204763,204769,204772,204796,204853,204857,204910,204932,204955,204976,204954,205010,205016,205017,205055,205071,205112,205113,206248,206253,206299,206367,206368,206369,206409,206497,206564,206573,206614,206717,206724,206725,206881,206884,206885,206955,206962,206971,207044,207046,207113,207214,207215,207216,207217,207219,207221,207262,207304,207306,207332,207397,207447,207490,207528,207531,207532,207582,207589,207620,207664,207696,207749,207772,207800,207809,207845,207864,207865,207929,207931,207934,207975,207982,208123,208126,208179,208184,208189,208258,208261,208354,208484,208485,208631,208642,208662,208705,208717,208720,208780,208781,208811,208870,208930,208931,208970,208982,209024,209025,209074,209084,209109,209161,209183,209214,209254,209265,209269,209353,209381,209550,209580,209608,209628,209629,209736,209776,209787,209812,209864,209866,209899,209909,209980,209994,209995,210184,210185,210186,210302,210308,211522,211541,211620,211670,211697,211772,211787,211867,211902,211937,212034,212103,212142,212144,212172,212199,212272,212619,212663,212687,212721,212742,212809,212815,212858,212967,212993,213039,213079,213092,213130,213155,213157,213204,213250,213314,213359,213431,213479,213480,213486,213539,213627,213640,213684,213695,213702,213754,213796,213816,213819,213900,213951,213964,213968,214021,214086,214160,214176,214216,214388,214390,214494,214523,214544,214553,214618,214651,214680,214714,214721,214758,214777,214912,214984,214989,215021,215027,215061,215063,215091,215414,215433,215456,215464,215473,215541,215559,215571,215589,215643,216399,216416,216432] # 201350 removed due to lumi =0
+
+runlist2012_heavyIon = [217946,217948,217999,218006,218035,218036,218048,218118,218168,218179,218197,218213,218222,218223,218224,218279,218301,218338,218391,218436,218473,218527,218536,218589,218677,218679,218716,218751,218771,218783,218829,218898,218940,218968,219001,219028,219039,219055,219089,219111,219114,219171,219228,219257,219263,219296,219305,219320,219322,219336,219364,219365] 
+# could remove 218527,218536 that had Stable Beams but no collision
+# but they might be used for background studies
diff --git a/LArCalorimeter/LArMonitoring/python/LArIdtranslator/create_LArBad.py b/LArCalorimeter/LArMonitoring/python/LArIdtranslator/create_LArBad.py
new file mode 100755
index 00000000000..042e68e79e7
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/LArIdtranslator/create_LArBad.py
@@ -0,0 +1,55 @@
+#!/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+import sys,os,sqlite3
+sys.path.append('/afs/cern.ch/user/a/atlcond/utils/python/')
+from AtlCoolBKLib import resolveAlias
+current = resolveAlias.getCurrent()
+current=current.replace('BLKP*','%sPST')
+from PyCool import cool
+import PyCintex as PyLCGDict
+PyLCGDict.loadDict('BadChanDict')
+
+from ROOT import LArBadChannelDBTools,AthenaAttributeList
+bct = LArBadChannelDBTools()
+connect = 'oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=COMP200'
+dbSvc = cool.DatabaseSvcFactory.databaseService()
+db = dbSvc.openDatabase(connect,False)
+A = AthenaAttributeList(bct.createCoolSpec())
+log = bct.getDefaultMsgStream()
+
+conn = sqlite3.connect('/afs/cern.ch/user/l/larmon/public/LArIdtranslator/tmp.db')
+c = conn.cursor()
+Tags = ['ES1','BLK']
+
+for u,upd in enumerate(['1','4']):
+  for b,bad in enumerate(['BadChannels','MissingFEBs']):
+    table = bad+'UPD'+upd
+    c.execute('create table %s (since integer,until integer,channel integer,status blob)'%(table))
+    cmd = 'insert into %s values (?,?,?,?)' % (table)
+    fld = db.getFolder('/LAR/BadChannelsOfl/'+bad)
+    tag = fld.resolveTag(current%(Tags[u]))
+    objs = fld.browseObjects(cool.ValidityKeyMin,cool.ValidityKeyMax,cool.ChannelSelection.all(),tag)
+
+    for obj in objs:
+      since = int(obj.since()>>32)
+      #if since<158255: continue
+      #if obj.channelId()!=2: continue
+      p = obj.payload()
+      for i in ['Blob','ChannelSize','StatusWordSize','Endianness','Version']: A[i] = p[i]
+      until = int(obj.until()>>32)
+      a = bct.readBadChan(A,log)
+      C = {}
+      I = a.size()
+      for i in range(I):
+        bc = a.at(i)
+        id = bc[0].get_compact()
+        bit = bc[1].packedData() 
+        C[id] = bit
+      load = (since,until,obj.channelId(),sqlite3.Binary(str(C)))
+      #print load
+      c.execute(cmd,load)
+
+conn.commit() 
+conn.close()
+os.system('mv -f /afs/cern.ch/user/l/larmon/public/LArIdtranslator/tmp.db /afs/cern.ch/user/l/larmon/public/LArIdtranslator/LArBad.db')
diff --git a/LArCalorimeter/LArMonitoring/python/LArIdtranslator/generate_db.sh b/LArCalorimeter/LArMonitoring/python/LArIdtranslator/generate_db.sh
new file mode 100755
index 00000000000..eeb70329972
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/LArIdtranslator/generate_db.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+export installPath=/afs/cern.ch/user/l/larmon/public/LArIdtranslator/LArIdtranslator_17.1.0/
+cd $installPath
+#source setup.sh
+export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup
+source $AtlasSetup/scripts/asetup.sh 17.2.9.1,32bit,opt 
+
+cd ./LArIdtranslator/run/
+rm -f usedTags.txt
+rm -f LArId.out
+rm -f LArBad.out
+
+echo " "
+echo " ------ Will create the LarId.db ------ "
+echo " BT - July 13: this step does not work after slc6 migration"
+echo " No problem as long as no change in mapping, I guess"
+python ./create_LArId.py > LArId.out
+mv ./LArId_tmp.db /afs/cern.ch/user/l/larmon/public/LArCalorimeter/LArMonitoring/python/LArIdtranslator/LArId.db
+
+echo " "
+echo " "
+echo " "
+echo " ------ Will create the LarBad.db ------ "
+echo " "
+python ./create_LArBad.py > LArBad.out
+mv ./LArBad_tmp.db /afs/cern.ch/user/l/larmon/public/LArCalorimeter/LArMonitoring/python/LArIdtranslator/LArBad.db
+
+grep 'Tag used for LAr' *.out | awk -F ":" '{print $2}' > usedTags.txt
+mv ./usedTags.txt /afs/cern.ch/user/l/larmon/public/LArCalorimeter/LArMonitoring/python/LArIdtranslator/usedTags.txt
diff --git a/LArCalorimeter/LArMonitoring/python/LArIdtranslator/index.py b/LArCalorimeter/LArMonitoring/python/LArIdtranslator/index.py
new file mode 100755
index 00000000000..33ae2e717a1
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/LArIdtranslator/index.py
@@ -0,0 +1,427 @@
+#!/usr/bin/env python2.5
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+print 'Content-type: text/html;charset=utf-8\n'
+
+########################################################################
+cols = ['OFF_ID','ONL_ID','TT_COOL_ID','DET','AC','FT','SL','CH','SAM','ETA','PHI','HVLINES','HVCORR','CL','IETA','IPHI','R','Z','FTNAME','P1_ID','FEB','DSP','PU','ROL','ROS_ROL','ROD','FEB_ID']
+DETlist = ['EMB','EMEC','HEC','FCAL']
+ACmap = {1:'A+','1':'A+','A+':'A+',-1:'C-','-1':'C-','C-':'C-'}
+BadChannels = ['deadReadout','deadCalib','deadPhys','almostDead','short','unstable','distorted','lowNoiseHG','highNoiseHG','unstableNoiseHG','lowNoiseMG','highNoiseMG','unstableNoiseMG','lowNoiseLG','highNoiseLG','unstableNoiseLG','missingFEB','peculiarCL','problematicFor?','sporadicBurstNoise']
+BadFEBs = {0:'deadAllBit',1:'deadReadoutBit',2:'inErrorBit',3:'deactivatedInOKSBit',16:'maskParity',17:'maskBCID',18:'maskSampleHeader',19:'maskEVTID',20:'maskScacStatus',21:'maskScaOutOfRange',22:'maskGainMismatch',23:'maskTypeMismatch',24:'maskNumOfSamples',25:'maskEmptyDataBlock',26:'maskDspBlockSize',27:'maskCheckSum',28:'maskMissingHeader',29:'maskBadGain'}
+
+########################################################################
+def PrintFields():
+  out = '<tr>\n'
+  for i in cols[:expert]+['STATUSUPD1','STATUSUPD4']: out += '<td>'+i+'</td>\n'
+  print out+'</tr>\n'
+
+########################################################################
+def PrintTopRow():
+  colsWidths = {'OFF_ID':12,'ONL_ID':12,'TT_COOL_ID':12,'DET':1,'AC':1,'FT':1,'SL':1,'CH':1,'SAM':1,'ETA':4,'PHI':4,'HVLINES':10,'HVCORR':5,'CL':4,'IETA':3,'IPHI':3,'R':5,'Z':5,'FTNAME':5,'P1_ID':5,'FEB':16,'DSP':18,'PU':14,'ROL':23,'ROS_ROL':22,'ROD':12,'FEB_ID':9}
+  out = '<tr>\n'
+
+  for i in cols[:expert]:
+    selected = False
+    if query.has_key(i): selected = query[i]
+    out += '<td>'
+    if i=='DET':
+      out += '<select name="DET" value="">\n'
+      out += ' <option value=""></option>\n'
+      for d in range(4):
+        out += ' <option value="%d" ' % (d)
+        if selected==str(d): out += ' selected'
+        out += '>'+DETlist[d]+'</option>\n'
+      out += '</select>'
+    elif i=='AC':
+      out += '<select name="AC" value="">\n'
+      for ac in [['',''],['A+','1'],['C-','-1']]:
+        if ac[1]==selected: out += ' <option value="'+ac[1]+'" selected>'+ac[0]+'</option>\n'
+        else:               out += ' <option value="'+ac[1]+'">'+ac[0]+'</option>\n'
+      out += '</select>'
+    else:
+      out += '<input size="%d" type="text" name="%s" ' % (colsWidths[i],i)
+      if selected: out += 'value="'+selected+'" '
+      out += ' />'
+    out += '</td>\n'
+
+  for i in ['STATUSUPD1','STATUSUPD4']:
+    selected = False
+    if query.has_key(i): selected = query[i]
+    out += '<td><select name="'+i+'" value="">\n'
+    out += ' <option value=""></option>\n'
+    out += ' <option value="0x8FFFF"'
+    if selected=='0x8FFFF': out += ' selected'
+    out += '>any (!missingFEB)</option>\n'
+    for p in range(20):
+      out += ' <option value="%s" ' % (str(hex(1<<p)))
+      if selected==str(hex(1<<p)): out += 'selected'
+      out += '>'+BadChannels[p]+'</option>\n'
+    out += '</select>'
+    out += '</td>\n'
+
+  print out+'</tr>\n'
+
+########################################################################
+def PrintRows(Cmds):
+  import sqlite3,operator
+  #print Cmds,'<br>'
+
+  # fetch badchannels
+  fields = cols[:expert]
+  B = [{},{},{},{}]
+  run = opts['run']
+  if run>0:
+    if expert<12: fields.append(cols[-1])
+    conn = sqlite3.connect(dbfile)
+    c = conn.cursor()
+    for u,upd in enumerate(['1','4']):
+      for b,bad in enumerate(['BadChannels','MissingFEBs']):
+        c.execute('select status from %s where %d>=since and %d<=until'%(bad+'UPD'+upd,run,run))
+        for d in c.fetchall(): B[2*u+b].update(eval(str(d[0])))
+    conn.close()
+
+  # if STATUS query, get the ONL_ID/FEB_ID of the badchannels/missingfebs
+  cmd = 'select '+','.join(fields)+' from LARID where '+Cmds[0]
+  for u in range(2):
+    if len(Cmds[1][u])>0:
+      bit = eval(Cmds[1][u])
+      theBad = []
+      status_cmd = ''
+      if len(Cmds[0])>0: status_cmd += ' and'
+      status_cmd += ' ONL_ID in ('
+      Bad = B[2*u]
+      for b in Bad.keys():
+        if Bad[b]&bit!=0x0: theBad.append(str(b))
+      if len(theBad)>0: cmd += status_cmd+','.join(theBad)+')'
+
+      if bit&(1<<16)!=0x0:
+        status_cmd = ''
+        if len(Cmds[0])>0: status_cmd += ' and'
+        theBad = []
+        status_cmd += ' FEB_ID in ('
+        Bad = B[2*u+1]
+        for b in Bad.keys(): theBad.append(str(b))
+        if len(theBad)>0: cmd += status_cmd+','.join(theBad)+')'
+
+  # connect to LArId and get the channels
+  conn = sqlite3.connect('/afs/cern.ch/user/l/larmon/public/LArCalorimeter/LArMonitoring/python/LArIdtranslator/LArId.db')
+  #conn = sqlite3.connect('/afs/cern.ch/user/l/larmon/public/LArIdtranslator/LArId_new.db')
+  cursor = conn.cursor()
+  cursor.execute(cmd+' limit 1000')
+  r = cursor.fetchall()
+  if len(r)==1000: print '<tr><td colspan="%d">**** more than 1000 results for this query ****</td></tr>\n' % (expert+2)
+  global SortedChannels
+  SortedChannels = sorted(r,key=operator.itemgetter(3,5,6,7))
+
+  nRows = 0
+  scan = [1,2,3,4,5,6,7,8,11,13]  
+  T = []
+  for j in scan: T.append(set())
+
+  for i in SortedChannels:
+    bec = 0
+    if i[3]>0: bec = 1
+    side = 0  
+    if i[4]>0: side = 1
+    fmt = "'%d %d %2d %2d %3d 0 %s # %s'" % (bec,side,i[5],i[6],i[7],'ProposedFlag',str(hex(i[1])))
+    out = '<tr class="out'+str(nRows%2)+'" ondblclick="PrintFormat('+fmt+')" onclick="ChangeColor(this)" >\n'
+    out += '<td>'+str(hex(i[0]))+'</td><td>'+str(hex(i[1]))+'</td><td>'+str(hex(i[2]))+'</td>\n'
+    out += '<td align="right">'+DETlist[i[3]]+'</td><td align="left">'+ACmap[i[4]]+'</td>\n'
+    for j in i[5:9]: out += '<td>'+str(j)+'</td>\n'
+    for j in i[9:11]: out += '<td>%.4f</td>\n' % (j)
+    for j,J in enumerate(scan[:8]): T[j].add(i[J])
+    if expert>11:
+      out += '<td>%s</td>\n' % (i[11])
+      out += '<td>%.4f</td>\n' % (i[12])
+      out += '<td>%s</td>\n' % (i[13])
+      for j in i[14:16]: out += '<td>%d</td>\n' % (j)
+      for j in i[16:18]: out += '<td>%.2f</td>\n' % (j)
+      for j in range(8): out += '<td>%s</td>\n' % (i[j+18])
+      out += '<td>'+str(hex(i[26])).rstrip('L')+'</td>\n'
+      for k in i[11].split(): T[8].add(k)
+      for k in i[13].split(): T[9].add(k)
+    for k in range(2):
+      status = ''
+      if B[2*k].has_key(i[1]): 
+        bit = B[2*k][i[1]]
+        for j in range(20): 
+          if bit&(1<<j)!=0x0: status += BadChannels[j]+' '
+      if B[2*k+1].has_key(i[-1]):
+        bit = B[2*k+1][i[-1]]
+        for j in BadFEBs.keys():
+          if bit&(1<<j)!=0x0: status += BadFEBs[j]+' '
+      out += '<td>'+status.rstrip(' ')+'</td>\n'
+    print out+'</tr>\n'
+
+    nRows += 1
+    if nRows%32==0: PrintFields()
+
+  print '<tr>'
+  for j in range(expert):
+    if j in scan: print '<td>%d</td>'%(len(T[scan.index(j)]))
+    else: print '<td></td>'
+  print '<td></td><td></td></tr>'
+
+########################################################################
+def ProcessQuery():
+  where = ''
+  status = ['','']
+  sql_query = ''
+
+  if query.has_key('sql_query'):
+    # parse the sql_query 
+    sql_query = query['sql_query'].replace('  ',' ').replace('"',"'") 
+    for i in ['OR','AND','BETWEEN','IN']:
+      if i in sql_query: sql_query = sql_query.replace(i,i.lower())
+    for i in cols:
+      if i.lower() in sql_query: sql_query = sql_query.replace(i.lower(),i.upper())
+    for i in [',','=']:
+      sql_query = sql_query.replace(' '+i,i)
+      sql_query = sql_query.replace(i+' ',i)
+
+    # create the where of the sql query
+    I = sql_query.split()
+    for i in I:
+      if   'UPD1' in i: 
+        status[0] = (i.split('!')[0]).lstrip('STATUSUPD1&')
+        where = where.rstrip('and ')+' '  
+      elif 'UPD4' in i: 
+        status[1] = (i.split('!')[0]).lstrip('STATUSUPD4&')
+        where = where.rstrip('and ')+' '  
+      elif '_ID' in i:
+        if '=' in i:
+          j=i.split('=')
+          where += j[0]+'='+str(eval(j[1]))+' '
+        elif I.pop(I.index(i)+1)=='in':
+          tup = eval(I.pop(I.index(i)+1))
+          if type(tup)=='tuple':
+            for k in range(1,len(tup)): where += ','+str(tup[k])
+          else: where += i+' in '+str(tup)
+          where += ' '
+      elif 'DET' in i:
+        for key in ['=','<=','=>','<','>']:
+          if key in i:
+            j=i.split(key)
+            if j[1] in DETlist: where += j[0]+key+str(DETlist.index(j[1]))+' '
+            else: where += i+' '
+            break                                                                   
+      else: where += i+' '
+
+    sql_query = where
+
+    # from the sql_query, get the selection for the tabs
+    if 'or' in sql_query: Q = sql_query.split('or')[0].split('and')
+    else: Q = sql_query.split('and')
+    for q in Q:
+      #for i in ['<=','=>','<','>','=','like','between','in']:
+      for i in ['=']:
+        if i in q: 
+          sq = q.split(i)
+          key = sq[0].upper().replace(' ','')
+          sq[1] = sq[1].replace(' ','')
+          if i=='between':
+            low = eval(sq[1].replace(' ',''))
+            high = eval(Q.pop(Q.index(q)+1).replace(' ',''))
+            query[key] = str(0.5*(high+low))
+            if key=='ETA': opts['deta']=0.5*(high-low)
+            if key=='PHI': opts['dphi']=0.5*(high-low)
+          elif i!='in': query[key]=sq[1].replace("'",'')
+          if key=='DET':
+            if query[key] in DETlist: query[key]=str(DETlist.index(query[key]))
+          break
+
+  else:
+    # build the "where" query from the tabs
+    for i in cols:
+      if not query.has_key(i): continue
+      v = query[i]
+      if (',' in v) and (i in ['FT','SL','CH','SAM','IETA','IPHI']): 
+        w = v.split(',')
+        where += '%s>=%s and %s<=%s' % (i,w[0],i,w[1])
+      elif i=='AC': 
+        if v[0]=='A': v = '1'
+        elif v[0]=='C': v = '-1'
+        where += '%s=%s' % (i,v)
+      elif i=='DET':
+        if v in DETlist: where += '%s=%s' % (i,DETlist.index(v))
+        else: where += '%s=%s' % (i,v)
+      elif i=='ETA': 
+        if not opts.has_key('deta'): opts['deta'] = 0.025 
+        where += '%s between %s and %s' % (i,str(float(v)-opts['deta']),str(float(v)+opts['deta']))
+      elif i=='PHI': 
+        if not opts.has_key('dphi'): opts['dphi'] = 0.05 
+        where += '%s between %s and %s' % (i,str(float(v)-opts['dphi']),str(float(v)+opts['dphi']))
+      elif i in ['HVLINES','FTNAME','CL','P1_ID','FEB','DSP','PU','ROL','ROS_ROL','ROD']: where += i+" like '%"+v+"%'"
+      elif '_ID' in i: where += '%s=%s' % (i,str(eval(v)))
+      else: where += '%s=%s' % (i,v)
+      where += ' and '
+    where = where.rstrip(' and ').rstrip(' ')
+
+    sql_query = ''
+    for i in where.split():
+      if '_ID' in i:
+        j=i.split('=')
+        sql_query += j[0]+'='+str(hex(int(j[1])))+' '
+      elif 'DET' in i:
+        j=i.split('=')
+        sql_query += j[0]+'='+DETlist[int(j[1])]+' '
+      else: sql_query += i.replace('"',"'")+' '
+
+    for t,T in enumerate(['STATUSUPD1','STATUSUPD4']):
+      if query.has_key(T): status[t] = query[T]
+
+  for t,T in enumerate(['STATUSUPD1','STATUSUPD4']):
+    if len(status[t])>0: 
+      if len(sql_query)>0: sql_query += 'and '
+      sql_query += T+'&'+status[t]+'!=0x0 '
+  print '<input type="text" name="sql_query" value="'+sql_query+'"/>\n</form></td>'
+  print '<td style="text-align:right;width:40%"><form name="selection" id="selection" method="post">'
+  n = {'deta':951,'dphi':966}
+  for i in ['deta','dphi']:
+    print '&#916;&#%d;=<input type="text" size="3" name="%s" ' % (n[i],i)
+    if opts.has_key(i): print 'value="'+str(opts[i])+'" '
+    print '/>'
+
+  return [where,status]
+
+########################################################################
+import os,time,cgi
+#import cgitb; cgitb.enable()
+
+dbfile = '/afs/cern.ch/user/l/larmon/public/LArCalorimeter/LArMonitoring/python/LArIdtranslator/LArBad.db'
+f0 = os.stat(dbfile)
+f1 = os.stat('index.py')
+from datetime import datetime
+f0 = os.stat(dbfile)
+
+print '''
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>LArIdtranslator</title>
+<meta name="author" content="Mathieu Plamondon [Mathieu.Plamondon@cern.ch]"/>
+<link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico" />
+<link rel="Stylesheet" href="styles.css" type="text/css" />
+<script type="text/javascript" src="scripts.js"></script>
+<base target="_self">
+</head>
+<body>
+<div class="wrapper"><br />
+<a href="https://atlas-larmon.cern.ch/LArIdtranslator" style="color:#000000;font-size:20pt;font-weight:bold" target="_self">LArID translator browser</a>'''
+#<br><font style="color:#FF0000">Is using a new db file (new ROS_ROL mapping, new FCAL2 hv mapping, hospital hv lines): please report any problem</font><br>
+#td = (datetime.today()-datetime.fromtimestamp(f0.st_ctime))
+#if (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6 > 12*3600:
+#  print '<font style="color:#FF0000">DB file is old: regenerate it!</font>'
+#  #print '<font style="color:#FF0000">Development in progress (1 hour)</font>'
+
+print '''
+<table style="text-align:right;width:70%">
+<tr>
+<td style="text-align:right;width:50%">
+<form name="query" id="query" method="post">'''
+
+global query
+global opts
+query = {}
+opts = {'run':999999}
+c = cgi.FieldStorage()
+expert = 11
+for i in c.keys():
+  a = c.getvalue(i)
+  if type(a)==type([]): a = a[0]
+  if i in ['deta','dphi','run']: opts[i] = float(a)
+  elif i=='expert': expert=28
+  elif i=='expert1': expert=28
+  elif i=='sql_query': query[i] = a
+  else: query[i.upper()] = a
+the_url='https://atlas-larmon.cern.ch/LArIdtranslator/index.py'
+
+if expert>11: print '<input type="hidden" name="expert1" value="1" />'
+if len(query)>0:
+  the_url += '?'
+  for k in query.keys(): the_url += k+'='+query[k]+'&'
+  if expert>11: the_url += 'expert=1&'
+  the_url += 'run=%d'%(opts['run'])
+  the_url = the_url.rstrip('&').replace(' ','%20')
+  if query.has_key('expert'): expert=27
+
+  if c.has_key('info'):
+    the_url = 'https://atlas-larmon.cern.ch/WebDisplayExtractor/LArWebDisplayExtractor?'
+    for k in query.keys(): the_url += k+'='+query[k]+'&'
+    the_url = the_url.rstrip('&').replace(' ','%20')
+    info = int(c.getvalue('info'))
+    if info in [0,4]: the_url='&info=0' 
+    elif info==1: the_url='&info=1&rawchannels=on' 
+    elif info==2: the_url='&info=1&calocells=on' 
+    elif info==3: the_url='&info=1&sporadic=on' 
+    print '<a href="%s">Click here to be redirected to the new WebExtractor</a>' % (the_url) 
+    import sys
+    sys.exit()  
+
+  Cmds = ProcessQuery()
+else:
+  print '''
+<input type="text" name="sql_query"/>
+</form>
+</td>
+<td style="text-align:right;width:50%">
+<form name="selection" id="selection" method="post">
+&#916;&#951;=<input type="text" size="3" name="deta" />
+&#916;&#966;=<input type="text" size="3" name="dphi" />'''
+
+out = 'run:<input type="text" size="6" name="run" value="%d"/>' % (opts['run'])
+out += '&nbsp;expert:<input type="checkbox" name="expert" '
+if expert>11: out += 'checked="checked"'
+out += ' />&nbsp;'
+out += '<input type="submit" value="Submit"/>\n'
+out += '<input type="reset" value="Reset" onclick="ResetForm(1)" />\n'
+out += '<input type="reset" value="Help" onclick="putHelper()" />\n'
+print out+'</td>\n'
+print '</tr></table>\n<br />'
+print '<table class="list">\n' 
+PrintFields()
+PrintTopRow()
+if 'Cmds' in dir(): PrintRows(Cmds)
+
+print '''
+</form>
+</table>
+<div id="help">'''
+if len(query)>0:
+  from operator import itemgetter
+  print 'eta-phi range: [%.4f,%.4f] x [%.4f,%.4f]<br />' %(min(SortedChannels,key=itemgetter(9))[9],max(SortedChannels,key=itemgetter(9))[9],min(SortedChannels,key=itemgetter(10))[10],max(SortedChannels,key=itemgetter(10))[10])
+  #print '&#951;-&#966; range: [%.4f,%.4f] x [%.4f,%.4f]<br />' %(min(SortedChannels,key=itemgetter(9))[9],max(SortedChannels,key=itemgetter(9))[9],min(SortedChannels,key=itemgetter(10))[10],max(SortedChannels,key=itemgetter(10))[10])
+  print '<a href="%s" target="_blank">Link to this query</a><br />'%(the_url)
+
+
+tag_upd1 = ""
+tag_upd4 = ""
+ftag = open("/afs/cern.ch/user/l/larmon/public/LArCalorimeter/LArMonitoring/python/LArIdtranslator/usedTags.txt")
+for line in ftag:
+#    print line
+    if 'LArBad.db UPD1' in line : tag_upd1 = line.split(" = ")[1]
+    if 'LArBad.db UPD4' in line : tag_upd4 = line.split(" = ")[1]
+
+print '''
+</div>
+<div class="push"></div>
+</div>
+<div class="footer">
+Developer: <a href="mailto:???">???</a><br />
+Last updates:&nbsp &nbsp
+LArBad.db file (%s)
+&nbsp &nbsp &nbsp &nbsp Tags : UPD1=%s,  UPD4=%s
+&nbsp &nbsp &nbsp &nbsp <a href="https://svnweb.cern.ch/trac/atlasoff/browser/LArCalorimeter/LArMonitoring/trunk/python/LArIdtranslator" target="_blank">script file</a> (%s)
+</div>
+</body>
+</html>''' % (time.ctime(f0.st_ctime),tag_upd1,tag_upd4,time.ctime(f1.st_ctime))
+
+#if len(query)>0:
+  #ip = os.environ['HTTP_X_FORWARDED_FOR']
+  #import urllib2
+  #req = urllib2.Request("http://www.ipmap.com/"+ip)
+  #response = urllib2.urlopen(req)
+  #pg = response.read()
+  #pg = pg[pg.find('<table'):pg.find('<div id="footer"')]
+  #os.system('echo "%s" | mail -s "LArIdtranslator query %s" Mathieu.Plamondon@cern.ch' % (the_url,ip))
diff --git a/LArCalorimeter/LArMonitoring/python/LArIdtranslator/scripts.js b/LArCalorimeter/LArMonitoring/python/LArIdtranslator/scripts.js
new file mode 100644
index 00000000000..54678825777
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/LArIdtranslator/scripts.js
@@ -0,0 +1,70 @@
+<!--
+var FMT = "bec side ft sl ch 0 Proposed Flag # onlid"
+//var FMT = "|OFF_ID|ONL_ID|TT_COOL_ID|SUBCALO|FT|SLOT|CHAN|REG|SAM|ETA|PHI|ETAF|PHIF|"
+
+function putHelper() {
+    var help = "<br /><hr />"
+           + "<ul>"
+           + "<li>More information <a href='https://twiki.cern.ch/twiki/bin/view/Atlas/LArIDTranslator'>here</a></li>"
+           + "<li>Use the fields to make your selection and press the Submit button</li>"
+           + "<li>Set ranges using , (e.g. for CH: 15,19 means 15<=CH<=19)</li>"
+           + "<li>Alternatively, fill by hand the top input bar with a sql selection (use =,and,or,like,between,in) and press Enter</li>"
+           + "<li>Double-click on a channel to get the standard format of it printed at the bottom:<br />"+FMT+"</li>"
+           + "<li>DB file generated with tags ATLAS-GEO-16-00-00, COMCOND-ES1PST-004-01 (UPD1) and COMCOND-BLKPST-004-01 (UPD4) for run 0x7fffffff, i.e. IOV to infinity</li>"
+           + "<li>Double-click on the title <LArID translator browser> at the top to perform an extraction of webdisplay info</li>"
+           + "<li>Code available on svn <a href='https://svnweb.cern.ch/trac/atlasusr/browser/mplamond/projects/LArIdtranslator/trunk'>here</a></li>"
+           + "<li>Contact <a href='http://cern.ch/mplamond'>Mathieu.Plamondon@cern.ch</a> for bugs and suggestions</li>"
+           + "</ul>";
+    document.getElementById("help").innerHTML = help;
+    //document.getElementById("help").innerHTML += '<img width="300" src="/afs/cern.ch/user/l/larmon/public/ATLAS_schema.png">';
+}
+
+function putCaloCellsHelper() {
+    var help = "<br /><hr />"
+           + "<ul>"
+           + "<li>Fill-in a run number and select a stream</li>"
+           + "<li>By default, only <h style='color:red'>red</h> flags are reported. Check the box to display also the channels with the yellow ones.</li>"
+           + "<li>Selections are effective only in the DET, AC and SAM fields</li>"
+           + "<li>The DEVIATION column gives 4 links in blue to the history tool for this channel and the value of the deviation. A click on the latter redirects to the relevant savannah report: if bold, this link does not exist; if in italic, the channel number wasn't found in the savannah page (verify that this channel is concerned by that entry).</li>"
+           + "<li>Double-click on a channel to get the standard format of it printed at the bottom:<br />"+FMT+"</li>"
+           + "<li>Contact <a href='http://cern.ch/mplamond'>Mathieu.Plamondon@cern.ch</a> for bugs and suggestions</li>"
+           + "</ul>";
+    document.getElementById("help").innerHTML = help;
+}
+
+function ResetForm(f) {
+  var el = document.forms[f].elements;
+  for (var i=0;i<el.length;i++) {
+    if ( el[i].hasAttribute("value") ) {
+      if ( el[i].getAttribute("value")!="Reset" && el[i].getAttribute("value")!="Submit" && el[i].getAttribute("value")!="Help" ) el[i].setAttribute("value","");
+    }
+    if ( el[i].hasAttribute("selected") ) el[i].removeAttribute("selected");
+    opt = el[i].getElementsByTagName("option");
+    for (var j=0;j<opt.length;j++) {
+      if ( opt[j].hasAttribute("selected") ) opt[j].removeAttribute("selected");
+    }
+  }
+  if ( f>0 ) { 
+    document.getElementById("help").innerHTML = "";
+    var el0 = document.forms[0].elements;
+    el0[0].setAttribute("value","");
+  }   
+}
+
+function PrintFormat(fmt) {
+  if ( !document.getElementById("format") ) {
+    document.getElementById("help").innerHTML += "<br /><hr />"+FMT+"<br /><hr /><pre id=\"format\"></pre>";
+  } 
+  document.getElementById("format").innerHTML += fmt+"<br />";
+}
+
+function ChangeColor(tr) {
+ if (tr.style.backgroundColor!="white") { tr.style.backgroundColor="white"; }
+ else { tr.style.backgroundColor="#DDFFDD"; }
+}
+
+function showit(td,i) {
+  td.innerHTML = i;
+}
+
+-->
diff --git a/LArCalorimeter/LArMonitoring/python/LArIdtranslator/styles.css b/LArCalorimeter/LArMonitoring/python/LArIdtranslator/styles.css
new file mode 100644
index 00000000000..6baeec7b884
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/LArIdtranslator/styles.css
@@ -0,0 +1,82 @@
+html,body {
+border-collapse:collapse;
+padding:0px;
+margin:0px;
+text-decoration:none;
+font-family:"Arial";
+font-size:15px;
+height:100%;
+}
+
+a {
+text-decoration:none;
+}
+
+/*
+input[type='checkbox'] {
+vertical-align:middle-top;
+}
+*/
+
+td, pre {
+padding:0px;
+border-collapse:collapse;
+}
+
+div {
+margin:0px;
+font-size:10px;
+}
+
+input,select {
+border-collapse:collapse;
+text-align:center;
+padding:0px;
+margin:0px;
+font-size:10px;
+}
+
+select[name="DET"] { border:0px; }
+input[name="deta"] { text-align:left; }
+input[name="dphi"] { text-align:left; }
+input[name="sql_query"] { 
+text-align:left; 
+width:100%;
+}
+
+table {
+border-collapse:collapse;
+text-align:center;
+padding:0px;
+font-size:10px;
+}
+
+table.list {
+font-family:"Arial";
+padding:1px;
+background: #4F81BD;
+}
+
+table.list td {
+padding:1px;
+border: 1px solid white;
+}
+
+table.list pre { 
+margin:0px;
+}
+
+tr.out0 { background: #E9EDF4;  font-size: 90%; }
+tr.out1 { background: #D0D8E8;  font-size: 90%; }
+
+.wrapper {
+min-height: 100%;
+height: 100%;
+height: auto !important;
+margin: 0px 0px -30px 5px;
+}
+
+.footer, .push {
+height: 30px;
+margin: auto 5px;
+}
diff --git a/LArCalorimeter/LArMonitoring/python/LArMonitoringFlags.py b/LArCalorimeter/LArMonitoring/python/LArMonitoringFlags.py
new file mode 100644
index 00000000000..9157c32e26a
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/LArMonitoringFlags.py
@@ -0,0 +1,20 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from AthenaCommon.JobProperties import jobproperties
+
+class outputFile(JobProperty):
+    statusOn = False
+    allowedTypes = ['str']
+    StoredValue = "LArNoiseBurst.root"
+    pass
+
+
+class LArNoiseBurstFlags(JobPropertyContainer):
+    pass
+
+jobproperties.add_Container(LArNoiseBurstFlags)
+
+jobproperties.LArNoiseBurstFlags.add_JobProperty(outputFile)
+
+larNoiseBurstFlags=jobproperties.LArNoiseBurstFlags
diff --git a/LArCalorimeter/LArMonitoring/python/MiscLibraries/AtlasStyle.C b/LArCalorimeter/LArMonitoring/python/MiscLibraries/AtlasStyle.C
new file mode 100644
index 00000000000..e954a0ac158
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/MiscLibraries/AtlasStyle.C
@@ -0,0 +1,98 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+//
+// ATLAS Style, based on a style file from BaBar
+//
+
+#include <iostream>
+
+#include "AtlasStyle.h"
+
+#include "TROOT.h"
+
+void SetAtlasStyle ()
+{
+  static TStyle* atlasStyle = 0;
+  std::cout << "\nApplying ATLAS style settings...\n" << std::endl ;
+  if ( atlasStyle==0 ) atlasStyle = AtlasStyle();
+  gROOT->SetStyle("ATLAS");
+  gROOT->ForceStyle();
+}
+
+TStyle* AtlasStyle() 
+{
+  TStyle *atlasStyle = new TStyle("ATLAS","Atlas style");
+
+  // use plain black on white colors
+  Int_t icol=0; // WHITE
+  atlasStyle->SetFrameBorderMode(icol);
+  atlasStyle->SetFrameFillColor(icol);
+  atlasStyle->SetCanvasBorderMode(icol);
+  atlasStyle->SetCanvasColor(icol);
+  atlasStyle->SetPadBorderMode(icol);
+  atlasStyle->SetPadColor(icol);
+  atlasStyle->SetStatColor(icol);
+  //atlasStyle->SetFillColor(icol); // don't use: white fill color for *all* objects
+
+  // set the paper & margin sizes
+  atlasStyle->SetPaperSize(20,26);
+
+  // set margin sizes
+  atlasStyle->SetPadTopMargin(0.05);
+  atlasStyle->SetPadRightMargin(0.05);
+  atlasStyle->SetPadBottomMargin(0.16);
+  atlasStyle->SetPadLeftMargin(0.16);
+
+  // set title offsets (for axis label)
+  atlasStyle->SetTitleXOffset(1.4);
+  atlasStyle->SetTitleYOffset(1.4);
+
+  // use large fonts
+  //Int_t font=72; // Helvetica italics
+  Int_t font=42; // Helvetica
+  Double_t tsize=0.05;
+  atlasStyle->SetTextFont(font);
+
+  atlasStyle->SetTextSize(tsize);
+  atlasStyle->SetLabelFont(font,"x");
+  atlasStyle->SetTitleFont(font,"x");
+  atlasStyle->SetLabelFont(font,"y");
+  atlasStyle->SetTitleFont(font,"y");
+  atlasStyle->SetLabelFont(font,"z");
+  atlasStyle->SetTitleFont(font,"z");
+  
+  atlasStyle->SetLabelSize(tsize,"x");
+  atlasStyle->SetTitleSize(tsize,"x");
+  atlasStyle->SetLabelSize(tsize,"y");
+  atlasStyle->SetTitleSize(tsize,"y");
+  atlasStyle->SetLabelSize(tsize,"z");
+  atlasStyle->SetTitleSize(tsize,"z");
+
+  // use bold lines and markers
+  atlasStyle->SetMarkerStyle(20);
+  atlasStyle->SetMarkerSize(1.2);
+  atlasStyle->SetHistLineWidth(2.);
+  atlasStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
+
+  // get rid of X error bars 
+  //atlasStyle->SetErrorX(0.001);
+  // get rid of error bar caps
+  atlasStyle->SetEndErrorSize(0.);
+
+  // do not display any of the standard histogram decorations
+  atlasStyle->SetOptTitle(0);
+  //atlasStyle->SetOptStat(1111);
+  atlasStyle->SetOptStat(0);
+  //atlasStyle->SetOptFit(1111);
+  atlasStyle->SetOptFit(0);
+
+  // put tick marks on top and RHS of plots
+  atlasStyle->SetPadTickX(1);
+  atlasStyle->SetPadTickY(1);
+
+  return atlasStyle;
+
+}
+
diff --git a/LArCalorimeter/LArMonitoring/python/MiscLibraries/AtlasStyle.h b/LArCalorimeter/LArMonitoring/python/MiscLibraries/AtlasStyle.h
new file mode 100644
index 00000000000..2127cdfa53b
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/MiscLibraries/AtlasStyle.h
@@ -0,0 +1,26 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+//
+//   @file    AtlasStyle.h         
+//   
+//            ATLAS Style, based on a style file from BaBar
+//
+//
+//   @author M.Sutton
+// 
+//   Copyright (C) 2010 Atlas Collaboration
+//
+//   $Id: AtlasStyle.h 551977 2013-06-21 10:06:44Z larmon $
+
+#ifndef  __ATLASSTYLE_H
+#define __ATLASSTYLE_H
+
+#include "TStyle.h"
+
+void SetAtlasStyle();
+
+TStyle* AtlasStyle(); 
+
+#endif // __ATLASSTYLE_H
diff --git a/LArCalorimeter/LArMonitoring/python/MiscLibraries/MyCOOLlib.py b/LArCalorimeter/LArMonitoring/python/MiscLibraries/MyCOOLlib.py
new file mode 100755
index 00000000000..338a6246c05
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/MiscLibraries/MyCOOLlib.py
@@ -0,0 +1,614 @@
+#!/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+import os, sys  
+import time
+import glob
+from time import mktime, gmtime
+import calendar
+from datetime import datetime
+
+import cx_Oracle
+
+from PyCool import cool
+from CoolConvUtilities.AtlCoolLib import indirectOpen
+
+from ROOT import *
+
+#TAG = 'OflLumi-7TeV-002'
+TAG = 'OflLumi-UPD2-004'
+#############################################################################
+def GetBeamIntensities(runnumber,beam):    
+    res = []
+    LBtimes = GetLBTimeStamps(runnumber)
+    trigDB = indirectOpen('COOLONL_TDAQ/COMP200',oracle=True)
+    if (trigDB is None):
+        print "ERROR: Cannot connect to COOLONL_TDAQ/COMP200"
+        return None
+    try:
+        folder = trigDB.getFolder('/TDAQ/OLC/LHC/LBDATA')
+        limmin = LBtimes[0] *1000000000
+        limmax = LBtimes[-1]*1000000000
+        chansel = cool.ChannelSelection(0)
+        objs = folder.browseObjects(limmin,limmax,chansel)
+        while objs.goToNext():
+            obj = objs.currentRef()
+            payload = obj.payload()
+            res.append(float(payload['Beam'+beam+'Intensity']))
+    except Exception,e:
+        print "ERROR accessing /TDAQ/OLC/LHC/LBDATA"
+        print e        
+    trigDB.closeDatabase()
+    if len(res) < len(LBtimes)-1:
+        while len(res) != len(LBtimes)-1:
+            res.append(res[-1])
+    return res
+#############################################################################
+def GetLBTimeStamps(runnumber):
+    res = []
+    trigDB=indirectOpen('COOLONL_TRIGGER/COMP200',oracle=True)
+    if (trigDB is None):
+        print "ERROR: Cannot connect to COOLONL_TRIGGER/COMP200"
+        return None
+    try:
+        folder=trigDB.getFolder('/TRIGGER/LUMI/LBLB')
+        limmin=(runnumber << 32)+1
+        limmax=(runnumber << 32)+10000
+        chansel=cool.ChannelSelection.all()
+        objs = folder.browseObjects(limmin,limmax,chansel)
+        tmp=0
+        while objs.goToNext():
+            obj=objs.currentRef()
+            payload=obj.payload()
+            res.append(int(payload['StartTime']/1000000000))
+            tmp=int(payload['EndTime']/1000000000)
+        res.append(tmp)
+    except Exception,e:
+        print "ERROR accessing /TRIGGER/LUMI/LBLB"
+        print e        
+    trigDB.closeDatabase()
+    return res
+#############################################################################
+def GetLBDuration(runnumber): 
+    res = []
+    trigDB=indirectOpen('COOLONL_TRIGGER/COMP200',oracle=True)
+    if (trigDB is None):
+        print "ERROR: Cannot connect to COOLONL_TRIGGER/COMP200"
+        return None
+    try:
+        folder=trigDB.getFolder('/TRIGGER/LUMI/LBLB')
+        limmin=(runnumber << 32)+1
+        limmax=(runnumber << 32)+10000
+        chansel=cool.ChannelSelection.all()
+        objs = folder.browseObjects(limmin,limmax,chansel)
+        while objs.goToNext():
+            obj=objs.currentRef()
+            payload=obj.payload()
+            res.append(int(payload['EndTime']/1000000000)-int(payload['StartTime']/1000000000))
+    except Exception,e:
+        print "ERROR accessing /TRIGGER/LUMI/LBLB"
+        print e        
+    trigDB.closeDatabase()
+    return res
+#############################################################################
+def GetRunNumberLumiblock(since,until):
+    res = []
+    trigDB=indirectOpen('COOLONL_TRIGGER/COMP200',oracle=True)
+    if (trigDB is None):
+        print "ERROR: Cannot connect to COOLONL_TRIGGER/COMP200"
+        return None
+    try:
+        folder = trigDB.getFolder('/TRIGGER/LUMI/LBTIME')
+        limmin = ConvertUTCtoIOV(since)*1000000000
+        limmax = ConvertUTCtoIOV(until)*1000000000
+        chansel = cool.ChannelSelection.all()
+        objs = folder.browseObjects(limmin,limmax,chansel)
+        while objs.goToNext():
+            obj=objs.currentRef()
+            payload=obj.payload()
+            res.append([int(payload['Run']),int(payload['LumiBlock'])])
+    except Exception,e:
+        print "ERROR accessing /TRIGGER/LUMI/LBLB"
+        print e        
+    trigDB.closeDatabase()
+    return res[0],res[-1]
+#############################################################################
+def GetTDaqOnlineLumi(runnumber,chan,type):
+    LBTS = GetLBTimeStamps(runnumber)
+    nlb = len(LBTS)-1
+    res = [0.*i for i in range(nlb)]
+    trigDB = indirectOpen('COOLONL_TDAQ/COMP200',oracle=True)
+    if (trigDB is None):
+        print "ERROR: Cannot connect to COOLONL_TDAQ/COMP200"
+    try:
+        folder = trigDB.getFolder('/TDAQ/OLC/LUMINOSITY')
+        limmin = LBTS[0]*1000000000
+        limmax = LBTS[-1]*1000000000
+        chansel = cool.ChannelSelection(chan)
+        objs = folder.browseObjects(limmin,limmax,chansel)
+        while objs.goToNext():
+            obj = objs.currentRef()
+            payload = obj.payload()
+            if int(payload['RunLB']) > 0:
+                lb = int( payload['RunLB'] - (runnumber<<32) ) - 1
+                res[lb] = [payload['LBAvInstLum%s'%type] if payload['Valid']&3 == 0 else 0.][0]
+    except Exception,e:
+        print "ERROR accessing /TDAQ/OLC/LUMINOSITY"
+        print e        
+    trigDB.closeDatabase()
+    return res
+#############################################################################
+def GetOnlineLumiFromCOOL(runnumber,nlb,channelid):
+    res = [0.*i for i in range(nlb)]
+    trigDB=indirectOpen('COOLONL_TRIGGER/COMP200',oracle=True)
+    if (trigDB is None):
+        print "ERROR: Cannot connect to COOLONL_TRIGGER/COMP200"
+        return None
+    try:
+        folder=trigDB.getFolder('/TRIGGER/LUMI/LBLESTONL')
+        limmin=(runnumber << 32)+1
+        limmax=(runnumber << 32)+10000
+        chansel=cool.ChannelSelection(channelid)
+        objs = folder.browseObjects(limmin,limmax,chansel)
+        lb = 0
+        while objs.goToNext():
+            obj=objs.currentRef()
+            lb = obj.since() - limmin
+            payload=obj.payload()
+            res[lb] = payload['LBAvInstLumi']
+    except Exception,e:
+        print "ERROR accessing /TRIGGER/LUMI/LBLESTONL"
+        print e        
+    trigDB.closeDatabase()
+    return res
+############################################################################# 
+def GetOfflineLumiFromCOOL(runnumber,nlb,channelid):
+    res = [0.*i for i in range(nlb)]
+    trigDB=indirectOpen('COOLOFL_TRIGGER/COMP200',oracle=True)
+    if (trigDB is None):
+        print "ERROR: Cannot connect to COOLOFL_TRIGGER/COMP200"
+        return None
+    try:
+        folder=trigDB.getFolder('/TRIGGER/OFLLUMI/LBLESTOFL')
+        limmin=(runnumber << 32)+1
+        limmax=(runnumber << 32)+10000
+        chansel=cool.ChannelSelection(channelid)
+        objs = folder.browseObjects(limmin,limmax,chansel,TAG)
+        lb = 0
+        while objs.goToNext():
+            obj=objs.currentRef()
+            lb = obj.since() - limmin
+            if lb >= nlb:
+                break
+            payload=obj.payload()
+            res[lb] = payload['LBAvInstLumi']
+    except Exception,e:
+        print "ERROR accessing /TRIGGER/OFLLUMI/LBLESTOFL"
+        print e        
+    trigDB.closeDatabase()
+    return res
+#############################################################################
+def GetOnlineMuFromCOOL(runnumber,nlb,channelid):
+    res = [0.*i for i in range(nlb)]
+    trigDB=indirectOpen('COOLONL_TRIGGER/COMP200',oracle=True)
+    if (trigDB is None):
+        print "ERROR: Cannot connect to COOLONL_TRIGGER/COMP200"
+        return None
+    try:
+        folder=trigDB.getFolder('/TRIGGER/LUMI/LBLESTONL')
+        limmin=(runnumber << 32)+1
+        limmax=(runnumber << 32)+10000
+        chansel=cool.ChannelSelection(channelid)
+        objs = folder.browseObjects(limmin,limmax,chansel)
+        lb = 0
+        while objs.goToNext():
+            obj=objs.currentRef()
+            lb = obj.since() - limmin
+            payload=obj.payload()
+            res[lb] = payload['LBAvEvtsPerBX']
+    except Exception,e:
+        print "ERROR accessing /TRIGGER/LUMI/LBLESTONL"
+        print e        
+    trigDB.closeDatabase()
+    return res
+#############################################################################
+def GetOfflineMuFromCOOL(runnumber,nlb,channelid):
+    res = [0.*i for i in range(nlb)]
+    trigDB=indirectOpen('COOLOFL_TRIGGER/COMP200',oracle=True)
+    if (trigDB is None):
+        print "ERROR: Cannot connect to COOLOFL_TRIGGER/COMP200"
+        return None
+    try:
+        folder=trigDB.getFolder('/TRIGGER/OFLLUMI/LBLESTOFL')
+        limmin=(runnumber << 32)+1
+        limmax=(runnumber << 32)+10000
+        chansel=cool.ChannelSelection(channelid)
+        objs = folder.browseObjects(limmin,limmax,chansel,TAG)
+        lb = 0
+        while objs.goToNext():
+            obj = objs.currentRef()
+            lb  = obj.since() - limmin
+            if lb >= nlb:
+                break
+            payload = obj.payload()
+            res[lb] = payload['LBAvEvtsPerBX']
+    except Exception,e:
+        print "ERROR accessing /TRIGGER/OFLLUMI/LBLESTOFL"
+        print e        
+    trigDB.closeDatabase()
+    return res
+#############################################################################
+def GetReadyFlag(runnumber):
+    res = []
+    LBtimes = GetLBTimeStamps(runnumber)
+    nLB = len(LBtimes)-1
+    db  = indirectOpen('COOLONL_TDAQ/COMP200',oracle=True)
+    folder = "/TDAQ/RunCtrl/DataTakingMode"
+    frc = db.getFolder(folder)
+    for lb in range(nLB):
+        runlb = (runnumber<<32)+lb+1
+        try:
+            objrc = frc.findObject(runlb,0)
+            plrc = objrc.payload()
+            atlReady = plrc["ReadyForPhysics"]
+        except RuntimeError:
+            atlReady = 0
+        res.append(int(atlReady))
+    db.closeDatabase()
+    return res
+#############################################################################
+def GetFillTimeStamp(start):
+    res = []
+    TIMESTAMP = []
+    trigDB = indirectOpen('COOLOFL_DCS/COMP200',oracle=True)
+    if (trigDB is None):
+        print "ERROR: Cannot connect to COOLOFL_DCS/COMP200"
+        return None
+    try:
+        folder = trigDB.getFolder('/LHC/DCS/FILLSTATE')
+        limmin = (start - 86400)*1000000000
+        limmax = start*1000000000
+        chansel = cool.ChannelSelection.all()
+        objs = folder.browseObjects(limmin,limmax,chansel)
+        while objs.goToNext():
+            obj = objs.currentRef()
+            payload = obj.payload()
+            fill = int(payload['FillNumber'])
+            since = (obj.since())/1000000000
+            res.append([fill,since])
+        for pair in res:
+            if pair[0] == res[-1][0]:
+                TIMESTAMP.append(pair[1])
+    except Exception,e:
+        print "ERROR accessing /LHC/DCS/FILLSTATE"
+        print e        
+    trigDB.closeDatabase()
+    return TIMESTAMP[0]
+#############################################################################
+def ConvertIOVtoUTC( iovtime ):
+    if len(str(iovtime))>10:
+        tsec = int(float(iovtime)/1.E9)
+    else:
+        tsec = int(iovtime)
+    utctime = time.asctime( time.gmtime(tsec) )
+    return utctime
+#############################################################################
+def ConvertUTCtoIOV( utctime ):
+    try:
+        ts   = time.strptime( utctime + '/UTC','%Y-%m-%d:%H:%M:%S/%Z' )
+        tsec = int(calendar.timegm(ts))
+        return tsec
+    except ValueError:
+        print "ERROR in time specification: '%s' (use format: 2007-05-25:14:01:00)" % utctime
+#############################################################################
+def ConvertIOVtoSQL( iovtime ):
+    if len(str(iovtime))>10:
+        tsec = int(float(iovtime)/1.E9)
+    else:
+        tsec = int(iovtime)
+    sqltime = time.strftime('%d%m%y%H%M',time.gmtime(tsec))
+    return sqltime
+#############################################################################
+def GetBeamSpotFromCOOL(runnumber,nlb):
+    res = [[-999. for i in range(nlb)],
+           [-999. for i in range(nlb)],
+           [-999. for i in range(nlb)],
+           [-999. for i in range(nlb)],
+           [-999. for i in range(nlb)],
+           [-999. for i in range(nlb)]]
+    trigDB=indirectOpen('COOLOFL_INDET/COMP200',oracle=True)
+    if (trigDB is None):
+        print "ERROR: Cannot connect to COOLONL_TRIGGER/COMP200"
+        return None
+    try:
+        folder=trigDB.getFolder('/Indet/Beampos')
+        limmin=(runnumber << 32)+1
+        limmax=(runnumber << 32)+10000
+        chansel=cool.ChannelSelection(0)
+        objs = folder.browseObjects(limmin,limmax,chansel,'IndetBeampos-ES1-UPD2')
+        lb = 0
+        while objs.goToNext():
+            obj=objs.currentRef()
+            lb = obj.since() - limmin + 1
+            payload=obj.payload()
+            res[0][lb] = payload['posX']
+            res[1][lb] = payload['posY']
+            res[2][lb] = payload['posZ']
+            res[3][lb] = payload['sigmaX']
+            res[4][lb] = payload['sigmaY']
+            res[5][lb] = payload['sigmaZ']
+    except Exception,e:
+        print "ERROR accessing /Indet/Beampos"
+        print e        
+    trigDB.closeDatabase()
+    return res
+#############################################################################
+def GetStableBeams(runnumber):
+    res = []
+    LBtimes = GetLBTimeStamps(runnumber)
+    nlb = len(LBtimes)-1
+    trigDB = indirectOpen('COOLOFL_DCS/COMP200',oracle=True)
+    if (trigDB is None):
+        print "ERROR: Cannot connect to COOLOFL_DCS/COMP200"
+        return None
+    try:
+        folder = trigDB.getFolder('/LHC/DCS/FILLSTATE')
+        limmin = (LBtimes[0]) *1000000000
+        limmax = (LBtimes[-1])*1000000000
+        chansel = cool.ChannelSelection.all()
+        objs = folder.browseObjects(limmin,limmax,chansel)
+        while objs.goToNext():
+            obj = objs.currentRef()
+            payload = obj.payload()
+            iovtime = obj.since()/1000000000
+            res.append([iovtime,int(payload['StableBeams'])])
+    except Exception,e:
+        print "ERROR accessing /LHC/DCS/FILLSTATE"
+        print e
+    trigDB.closeDatabase()
+    sb = [None for i in range(nlb)]
+    for p in xrange(len(res)):
+        for lb in xrange(nlb):
+            if res[p][0] <= LBtimes[lb]:
+                sb[lb] = res[p][1]
+                continue
+    return sb
+#############################################################################
+def GetNumberOfCollidingBunches(runnumber):
+    res = []
+    LBtimes = GetLBTimeStamps(runnumber)
+    nlb = len(LBtimes)-1
+    trigDB = indirectOpen('COOLOFL_DCS/COMP200',oracle=True)
+    if (trigDB is None):
+        print "ERROR: Cannot connect to COOLOFL_DCS/COMP200"
+        return None
+    try:
+        folder = trigDB.getFolder('/LHC/DCS/FILLSTATE')
+        limmin = (LBtimes[0]) *1000000000
+        limmax = (LBtimes[-1])*1000000000
+        chansel = cool.ChannelSelection.all()
+        objs = folder.browseObjects(limmin,limmax,chansel)
+        while objs.goToNext():
+            obj = objs.currentRef()
+            payload = obj.payload()
+            iovtime = obj.since()/1000000000
+            res.append([iovtime,int(payload['NumBunchColl'])])
+    except Exception,e:
+        print "ERROR accessing /LHC/DCS/FILLSTATE"
+        print e
+    trigDB.closeDatabase()
+    sb = [0 for i in range(nlb)]
+    for p in xrange(len(res)):
+        for lb in xrange(nlb):
+            if res[p][0] <= LBtimes[lb]:
+                sb[lb] = res[p][1]
+                continue
+    return max(sb)
+#############################################################################
+def doOracleQuery(runnumber,dpe):
+    #
+    LBTS = GetLBTimeStamps(runnumber)
+    nLB = len(LBTS)-1
+    since = LBTS[0]
+    until = LBTS[-1]
+    #
+    args = {'since' : ConvertIOVtoSQL(since),
+            'until' : ConvertIOVtoSQL(until),
+            'dp'    : dpe}
+    #
+    if 'ATLLAR' in dpe:
+        ev = "atlas_pvsslar.eventhistory"
+        el = "atlas_pvsslar.elements"
+    elif 'ATLIDE' in dpe:
+        ev = "atlas_pvsside.eventhistory"
+        el = "atlas_pvsside.elements"
+    elif 'ATLGCS' in dpe:
+        ev = "atlas_pvssdcs.eventhistory"
+        el = "atlas_pvssdcs.elements"
+    else:
+        print "Could not resolve system name for %s" % dpe
+        exit(0)
+    #
+    conn_str = 'ATLAS_PVSS_READER/pvssred4pro@ATLR'
+    cx_oracle_connection = cx_Oracle.Connection(conn_str)
+    cursor = cx_Oracle.Cursor(cx_oracle_connection)
+    #
+    query = """
+    select ev.ts, ev.value_number
+    from %s ev, %s el
+    where el.element_id = ev.element_id
+    and ev.ts between to_date(:since, 'ddmmyyhh24mi') and to_date(:until,'ddmmyyhh24mi')
+    and el.element_name = :dp
+    order by ts
+    """ % (ev,el)
+    #
+    cursor.execute(query,args)
+    result = cursor.fetchall()
+    #
+    data = []
+    for row in result:
+        utctime = row[0] 
+        value = row[1]
+        tsec = calendar.timegm(utctime.timetuple())+1e-6*utctime.microsecond
+        data.append([tsec,value])
+    #
+    if len(data) == 0:
+        print "No data for dpe : %s" % dpe
+    #
+    h = TProfile(dpe,dpe,nLB,0,nLB)
+    h.SetDirectory(0)
+    for i in xrange(len(data)):
+        iovtime = data[i][0]
+        val = data[i][1]
+        if iovtime < since or iovtime > until:
+            continue
+        for lb in xrange(nLB):
+            if iovtime < LBTS[lb+1]:   
+                h.Fill(lb,val)
+                break
+    LBav_data = []
+    for bin in xrange(1,h.GetNbinsX()+1):
+        LBav_data.append(h.GetBinContent(bin))
+    return LBav_data
+#############################################################################
+def getOracleBaseline(runnumber,dpe):
+    #
+    LBTS  = GetLBTimeStamps(runnumber)
+    since = GetFillTimeStamp(LBTS[0])
+    until = since + 3600
+    nLB   = len(LBTS)-1
+    #
+    args = {'since' : ConvertIOVtoSQL(since),
+            'until' : ConvertIOVtoSQL(until),
+            'dp'    : dpe}
+    #
+    if 'ATLLAR' in dpe:
+        ev = "atlas_pvsslar.eventhistory"
+        el = "atlas_pvsslar.elements"
+    elif 'ATLIDE' in dpe:
+        ev = "atlas_pvsside.eventhistory"
+        el = "atlas_pvsside.elements"
+    elif 'ATLGCS' in dpe:
+        ev = "atlas_pvssdcs.eventhistory"
+        el = "atlas_pvssdcs.elements"
+    else:
+        print "Could not resolve system name for %s" % dpe
+        exit(0)
+    #
+    conn_str = 'ATLAS_PVSS_READER/pvssred4pro@ATLR'
+    cx_oracle_connection = cx_Oracle.Connection(conn_str)
+    cursor = cx_Oracle.Cursor(cx_oracle_connection)
+    #
+    query = """
+    select ev.ts, ev.value_number
+    from %s ev, %s el
+    where el.element_id = ev.element_id
+    and ev.ts between to_date(:since, 'ddmmyyhh24mi') and to_date(:until,'ddmmyyhh24mi')
+    and el.element_name = :dp
+    order by ts
+    """ % (ev,el)
+    #
+    cursor.execute(query,args)
+    result = cursor.fetchall()
+    #
+    data = []
+    for row in result:
+        value = row[1]
+        data.append(value)
+    #
+    if len(data) == 0:
+        print "No data for dpe : %s" % dpe
+    #
+    h = TH1F(dpe,dpe,51000,-10,500)
+    h.SetDirectory(0)
+    for i in xrange(len(data)):
+        h.Fill(data[i])
+    #h.Draw()
+    #raw_input('...')
+    return h.GetMean(),h.GetRMS()
+#############################################################################
+def get_max_width(table, index):
+    """Get the maximum width of the given column index"""
+    #
+    return max([len(str(row[index])) for row in table])
+#############################################################################
+def pprint_table(out, table):
+    """Prints out a table of data, padded for alignment
+    @param out: Output stream (file-like object)
+    @param table: The table to print. A list of lists.
+    Each row must have the same number of columns. """
+    #
+    col_paddings = []
+    #
+    for i in range(len(table[0])):
+        col_paddings.append(get_max_width(table, i))
+    #
+    for row in table:
+        # left col
+        print >> out, str(row[0]).ljust(col_paddings[0] + 1),
+        # rest of the cols
+        for i in range(1, len(row)):
+            col = str(row[i]).rjust(col_paddings[i] + 2)
+            print >> out, col,
+        print >> out
+#############################################################################
+def ATLASLabel(x,y):
+    l = TLatex(x,y,'ATLAS')
+    l.SetNDC()
+    l.SetTextFont(72)
+    #l.Draw()
+    #delx = 0.115*696*gPad.GetWh()/(472*gPad.GetWw())
+    p = TLatex(x+0.117,y,'Preliminary')
+    p.SetNDC()
+    p.SetTextFont(42)
+    #p.Draw()
+    return p,l
+############################################################################# 
+if __name__=='__main__':
+    #
+    # print getOracleBaseline(177539,'ATLLARHV6:M185.C0.R.IMeas')
+    #
+    # print GetNumberOfCollidingBunches(177968)
+    #
+    ready = GetReadyFlag(182013)
+    #print ready
+
+
+
+
+
+
+
+
+"""
+    n_coll = {}
+    n_lb = {}
+    since = {}
+    until = {}
+    peak_lumi = {}
+    peak_mu = {}
+    #
+    files = glob.glob('./trees/*')
+    files.sort()
+    for file in files:
+        #
+        run = int(file[8:14])
+        #
+        n_coll[run] = GetNumberOfCollidingBunches(run)
+        LBTS = GetLBTimeStamps(run)
+        n_lb[run] = len(LBTS)-1
+        since[run] = ConvertIOVtoUTC(LBTS[0])
+        until[run] = ConvertIOVtoUTC(LBTS[-1])
+        peak_lumi[run] = round(max(GetOnlineLumiFromCOOL(run,n_lb[run],0)),1)
+        peak_mu[run] = round(max(GetOnlineMuFromCOOL(run,n_lb[run],0)),1)
+    #
+    table = []
+    table.append(['Run','Start (UTC)','End (UTC)','# LB','# Colliding Bunches','Peak Lumi (10^30 cm2s-1)','Peak mu'])
+    for k in sorted(n_lb.iterkeys()):
+        #
+        table.append([k,since[k],until[k],n_lb[k],n_coll[k],peak_lumi[k],peak_mu[k]])
+        #
+    out = sys.stdout
+    pprint_table(out, table)
+"""
diff --git a/LArCalorimeter/LArMonitoring/python/MiscLibraries/gb.py b/LArCalorimeter/LArMonitoring/python/MiscLibraries/gb.py
new file mode 100644
index 00000000000..a6622ef3b20
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/MiscLibraries/gb.py
@@ -0,0 +1,147 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from ROOT import *
+import math
+from array import array
+
+# global graphic settings
+ROOT.gROOT.LoadMacro("../MiscLibraries/AtlasStyle.C")
+SetAtlasStyle()
+gStyle.SetOptFit(00111)
+gStyle.SetPalette(1)
+gStyle.SetOptStat("emrou")
+#gStyle.SetOptStat("emr")
+gStyle.SetOptTitle(1)
+gStyle.SetPadRightMargin(0.15);
+
+def MakeLegend(xmin,ymin,xmax,ymax):
+    l = TLegend(xmin,ymin,xmax,ymax)
+    l.SetFillColor(kWhite)
+    l.SetTextSize(0.03)
+    l.SetBorderSize(0)
+    return l
+
+def SetXLabel(h,list):
+    for i in xrange(len(list)):
+         h.GetXaxis().SetBinLabel(i+1,str(list[i]))
+    return
+
+def SetYLabel(h,list):
+    for i in xrange(len(list)):
+         h.GetYaxis().SetBinLabel(i+1,str(list[i]))
+    return
+
+def MakeTProfile(name,xtitle,ytitle,xmin,xmax,nbins,color):
+   h = TProfile(name,name, nbins, xmin, xmax)
+   h.SetYTitle(ytitle)
+   h.SetXTitle(xtitle)
+   h.SetMarkerStyle(22)
+   h.SetMarkerColor(color)
+   h.SetLineColor(1)
+   h.SetFillColor(color)
+   h.SetStats(0)
+   h.SetTitle("")
+   return h
+
+def MakeTH1(name,xtitle,ytitle,xmin,xmax,nbins,color):
+   h = TH1F(name,name,nbins, xmin,xmax)
+   #h.SetStats(0)
+   #h.GetXaxis().SetTitleOffset(-3.)
+   #h.GetYaxis().SetTitleOffset(-3.)
+   h.SetYTitle(ytitle)
+   h.SetXTitle(xtitle)
+   h.SetLineColor(1)
+   h.SetMarkerStyle(22)
+   h.SetMarkerColor(color)
+   h.SetFillColor(color)
+   #h.SetTitle("")
+   h.Sumw2()
+   return h
+
+def MakeTH1VarBin(name,xtitle,ytitle,nbins,xval,color):
+   h = TH1F(name,name,nbins, xval)
+   #h.SetStats(0)
+   #h.GetXaxis().SetTitleOffset(-3.)
+   #h.GetYaxis().SetTitleOffset(-3.)
+   h.SetYTitle(ytitle)
+   h.SetXTitle(xtitle)
+   h.SetLineColor(1)
+   h.SetMarkerStyle(22)
+   h.SetMarkerColor(color)
+   h.SetFillColor(color)
+   #h.SetTitle("")
+   h.Sumw2()
+   return h
+
+def MakeTH2(name,xtitle,ytitle,xmin,xmax,nbinx,ymin,ymax,nbiny):
+   h = TH2F(name,name,nbinx, xmin,xmax,nbiny,ymin,ymax)
+   h.SetYTitle(ytitle)
+   h.SetXTitle(xtitle)
+   h.SetMarkerStyle(22)
+   h.SetTitle("")
+   #h.SetStats(0)
+   return h
+
+def MakeFrame(title,xtitle,ytitle,xmin,xmax,nbins):
+   h = TH1F(title,title,nbins,xmin,xmax)
+   h.SetStats(0)
+   h.SetYTitle(ytitle)
+   h.SetXTitle(xtitle)
+   return h
+
+def MakeEffPlot(title,xtitle,ytitle,xmin,xmax,nbins,color):
+    h=TH1F(title,title,nbins,xmin,xmax)
+    h.SetStats(0)
+    h.SetYTitle(ytitle)
+    h.SetXTitle(xtitle)
+    h0=TGraphAsymmErrors(h)
+    return h0
+        
+def Normalize(h,value):
+    if value != 0:
+        scale = float(value)/h.Integral()
+        h.Scale(scale)
+    return
+
+def TransMass(ptele,phiele,exmiss,eymiss):
+    phimiss = math.atan2(eymiss, exmiss)
+    etmiss = math.sqrt(exmiss*exmiss+eymiss*eymiss)
+    tm = math.sqrt(2*ptele*etmiss*(1-cos(phiele-phimiss)))
+    return tm
+
+def dr(eta1,phi1,eta2,phi2):
+    deta=eta1-eta2
+    dphi=phi1-phi2
+    if dphi > math.pi:
+        dphi=fabs(dphi)-math.pi
+    dist=deta*deta+dphi*dphi
+    return math.sqrt(dist)
+
+# fancy Root palette found on: http://ultrahigh.org/2007/08/20/making-pretty-root-color-palettes/
+def set_palette(name="palette", ncontours=999):
+    """Set a color palette from a given RGB list
+    stops, red, green and blue should all be lists of the same length
+    see set_decent_colors for an example"""
+
+    if name == "gray":
+        stops = [0.00, 0.34, 0.61, 0.84, 1.00]
+        red   = [1.00, 0.84, 0.61, 0.34, 0.00]
+        green = [1.00, 0.84, 0.61, 0.34, 0.00]
+        blue  = [1.00, 0.84, 0.61, 0.34, 0.00]
+    # elif name == "whatever":
+        # (define more palettes)
+    else:
+        # default palette, looks cool
+        stops = [0.00, 0.34, 0.61, 0.84, 1.00]
+        red   = [0.00, 0.00, 0.87, 1.00, 0.51]
+        green = [0.00, 0.81, 1.00, 0.20, 0.00]
+        blue  = [0.51, 1.00, 0.12, 0.00, 0.00]
+
+    s = array('d', stops)
+    r = array('d', red)
+    g = array('d', green)
+    b = array('d', blue)
+
+    npoints = len(s)
+    TColor.CreateGradientColorTable(npoints, s, r, g, b, ncontours)
+    gStyle.SetNumberContours(ncontours) # set to 999 for an awesome result
diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/DataVisualizer.class b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/DataVisualizer.class
new file mode 100644
index 0000000000000000000000000000000000000000..5882857b6b687f420756ff6f067dde043d430ab8
GIT binary patch
literal 1677
zcmaJ>&vzPC6#ia-dBZT|$F!4nN?NgM1vHF}5e<;Gwy_4Arf5<sjar8=C6mIy83wiL
z($k$Acj-B9+;rojbwNDloE%qrj!XX&*B%@1BcW*;6qx(oyYIU{zI*TR$KzkN0ZgHx
z;CYw|Uc=ci9bcC*t>6u0INnqs!Ibfqj2VtBM@~URKqJV@m=)_e8Rx}%L4ks|Wn2^{
zmpJAW=y*qn%L?Abyo`ca-xK1B5DPM{%2<?fjboal$ROn%*YVFW1QN*-L-10wYBP*1
zIIg|eX;f@)*{ak@6Kq(H%P^i;Sy;C|v&_2X*32c}bKF`^7)F<TYxT}mtJT933y$|W
zKA@Z!l%;0JTeUAc!qJgA%eP8SyJOXzFKsU^ys0>i7dVzwEaN&yNyQC($S`~m%28Hv
z6D#DfSa14sp7puyQLgE<IbWK0+J4i!OBT;)iq0x!zw9|JhGWmBezD`!tG1`&BYaG?
zFo{p=mN<PvHtDM6tGI<vMS7M{wA`AC3do__^W-#5K}y`OsHnmw(kgDF#t_<bwFWYA
zu&&|`>cn1T9>3l6;^IDDn2XQG8JI$k$uPQ~-?hrRy-Hl3Qteiod<<v-!`QxU!S(H$
zD2?2*ytYk820byLZ-s;Y@3wurL6gwz2!mZbQ7lrEeF|<{jT}YqGk;3Wz*_=TrwJJt
zhz3NmS}ohHGE5H2<WO>ZouPmei9+&!u4TX3FU--zVIVmePZSQ>_hwe9(g@9$L`xWA
zi3Kqvxxvt2o#soBOAai)Ow8Ih9DnUU_}`?NZTptz?}4Pc?bZaE-a2YRxZSC=X&_u0
z9Ljb8-yHp0#OV>AAu#d2kbIF&CuwE0hEkhgk7&d25=p72ln}-lyi9w74uufHFaa(E
z^1<2E_6F2cVCrWK<pZ-nA)p1j2yH<sZ-OssayF=iv!RLmC~iS1$F>lm3)LV{R2wD{
z>taM3rA-%Oo6xe-q#^Y|p#z{JyPz(PKEUr=(91?}6XRLQkh(aQ<p%!^4-KA`4S72g
z4rCNv(ZfIBdqdWhscgiEh$zQ5aF2FI7biCGwGokxNEb0)?P7umWK_z3FSvG+!s)8W
z?o>Z8(NfB~+E1^?;W@e#PWt&rCyi(y@Ff3TKl=o}QP_i>im38XugVo1r@cz2D1sQF
zYL8(Q8hv$~pu5u~&me{rP9aV0yH0)hf-Jv668A{^Ehh0DO#Fzm_!ZOm6B+!48Kxu8
zW?-`OC?Y`-t|0UeG{zodjU&mCqTddAk8r%g*b^1UtEA}ZfWL8nhZ-&&gpf0O1$zY2
F{{j=kc;x^9

literal 0
HcmV?d00001

diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/DataVisualizer.java b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/DataVisualizer.java
new file mode 100644
index 00000000000..9b9c8735875
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/DataVisualizer.java
@@ -0,0 +1,89 @@
+import java.awt.*; 
+import javax.swing.*;
+import java.io.File;
+
+
+public class DataVisualizer
+{
+
+
+  public static void main(String args[])
+  {
+	int specID = 0;
+	boolean processAllFiles = true;
+
+	if (args.length != 0)
+	{
+		specID = Integer.parseInt(args[0]);
+		processAllFiles = false;
+	}
+			
+	System.out.println("DataVisualizer");
+
+	// Allocating plot drawer
+	PlotDrawer p = new PlotDrawer();
+
+	String folderData = "../HVHistoryDat";
+	String folderPict = "../HVHistoryPic";
+
+
+	if ( ! processAllFiles)
+	{
+		// Load trip history from file
+		Trip t = new Trip(specID, folderData + "/trip_" + specID + ".dat");
+		
+		// Draw corresponding plot
+		p. drawHVPlot(t, folderPict + "/trip_" + specID + ".png");
+	}
+	else
+	{
+		// Looping all data files in directory
+		File folder = new File(folderData);
+		String[] fileNames = folder.list();
+
+	
+		if(fileNames != null)
+		{
+		  for (String filename : fileNames)
+		  {
+		    if(filename.endsWith(".dat") && filename.startsWith("trip_"))
+		    {
+			// Get trip id from filename
+			int tripID = Integer.parseInt(filename.substring(5, filename.length() - 4)); // between "trip_" and ".dat" 
+		
+			System.out.println("Plot for trip ID = " + tripID + "\n");
+
+			// Load trip history from file
+			Trip t = new Trip(tripID, folderData + "/" + filename);
+		
+			// Draw corresponding plot
+			p. drawHVPlot(t, folderPict + "/trip_" + tripID + ".png");
+		    }
+	    	  }
+	  	}
+	}
+
+/*
+	// For testing purpose only : displaying the generated plot
+
+	Trip t = new Trip(1, "../HVHistoryDat/trip_1.dat");
+
+	p. drawHVPlot(t, "../HVHistoryPic/trip_1.png");
+	
+	JFrame f = new JFrame("Trip info");
+	f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+	f.getContentPane().add(p);
+	f.setLocation(200,100);
+	f.pack();
+	f.show();
+*/
+}
+
+
+
+
+
+
+
+
+}
\ No newline at end of file
diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/HVNode.class b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/HVNode.class
new file mode 100644
index 0000000000000000000000000000000000000000..a198652dd730adfd4ac6ed5f0a610541a7617f5b
GIT binary patch
literal 984
zcmaJ<+int36kUhg40K8<6tUV1^$G(mTJNQ{wInD6YYYvEPiBBgGnHGWL%+da@E`i1
ziO@t7qpyCHah(}r8;yP0Ywvyb*?aAE&d*<8z5!TADS|m<!$?4vCMQi^npJ7m6ci#*
zkX3O<;$3OhRos(!U&RB74^=!;@mRV~6l^FcD%cbVI9Asb5LE$RZI@0(KsoMr9OFQy
z%Zyq>+ctZSK<LOZoZ%6jO{-@)TLNmPS}B(+*#;Yx`fc8rsaZX9Z`f^`_P){VFrzyC
zx?@|t1A)0rwsvS78-<S1J1BVBqCmLS?+y&x-0uq{Gv_K^H4n{}Q_Panblovp?_L^%
zN!LidKeStB*^(osUNrVNeNFb(u!N@?E+M7iGUhd0!Bq_l(kx<LAoVwa-J#WKn>M%F
zrxY7$4O`fjW{0VKy0+`3o(Tl=>4q0jC<c{{w2O6_yoT$n_lO9@&Zc-vaQU-T$=%nJ
z$Dfhvg^a<#?6n0}&+k7`=wHz$oT=SHrh4&l<>KS=|Btc4zcmNG34(}8Mfn$FQdAeI
ztBaJ@MXF2mvwjK7v}s1K87ssU{S-o99>J$Cj^Ni*fe`|FDmX$=PliSaePWT|K=87>
zFpU7B2xEpeMiR4p#yDF_I#hbn{;fL>c>Wd2n^UOq@E8&OGkjxA#Wm0Ok1-vOdVXMx
znRv|egVLY%{19u#h=2S;BE$jUrUEx`b24m)lzhylazBvxfLS>w_Z<m>`ToRz!Xux%
ZL6oe(AE)rcB`L)%MwBJVKDXVX%x`T5yeI$w

literal 0
HcmV?d00001

diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/HVNode.java b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/HVNode.java
new file mode 100644
index 00000000000..e713071e8c0
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/HVNode.java
@@ -0,0 +1,34 @@
+public class HVNode implements Comparable
+{
+	final long time;
+	final int LB;
+  	final float voltage;
+  	final float current;
+  	final int status;
+  
+  	public HVNode(	long _time,
+			int _LB, 
+			float _voltage, float _current,
+			int _status)
+  	{
+		time = _time;		
+		LB = _LB;
+		voltage = _voltage;
+ 		current = _current;
+		status = _status;
+
+	};
+
+	public String toString()
+	{
+		return ("Time: " + time + ", LB: " + LB + ", V: " + voltage + ", I: " + current + ", S: " + status);
+	}
+	public int compareTo(Object o)
+	{
+		if (o instanceof HVNode)
+			return (int)((time - ((HVNode)o).time));
+		else
+			return 0;
+	}
+
+}
diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/LumiBlock.class b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/LumiBlock.class
new file mode 100644
index 0000000000000000000000000000000000000000..d7ceb6b3eda0ae21dcd9c48b404b6d0536eb79dd
GIT binary patch
literal 764
zcmaJ<+iuf95It+Bv16P|(}n;o#l1isr)?0t5rj}GAtf^9Ar%sj8)sFyP3*|s@D2Pz
z|Dg{c(NqEn!7Cqyn02hS0)Z@@*_|1mnRD!)zrK6}@C1)76tPx-jRy)G1M3!YSTnJq
z;--Qv6Ax8<q+r{CYoKAkW5~&HEErgiLGwFw=rZJ=hfyeBFf6#;UgIq_?Z-oED*It1
z4yNOQNDld6L>W`YeVK&O5yP_E@Q?X>-Wu`fs5Q^F845u>p72B*#tb$0M#r1Mu?S?l
zLGy}z$%B*Ee3G$R{dk%L;#H_dl>F&9?2O{zWKYrCSVGfA85J9gs4~?59NL+NqoGJ>
zYrpf%v9W_)1$zv(b1Hcv#n9n0EwpUZafg<?n!!-H=9{lb(ymkcshYWX-BsS?`D7xZ
zA;a!Xb(#LZEy=bcXI9<r|I599m$6PCx(IRy8Y;>S`V%V35Q;kGm#|D&quW!u=O~uF
zOEAy5faa}SK>tK3hTDYIv}_QXD9}@aMHTWTBWS0Dz~)!v-d$p$nxDb&K0}|utQO{H
zZ3b(GTOY4T^Yk)^is3HqWkfG&ghttV^9SrREE0#-{0^If_;9YDQ%OrVD$zuc1cOA>
QD6>L05>+Ff)wJpUZ;}L;TmS$7

literal 0
HcmV?d00001

diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/LumiBlock.java b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/LumiBlock.java
new file mode 100644
index 00000000000..3284ad2e22b
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/LumiBlock.java
@@ -0,0 +1,25 @@
+public class LumiBlock implements Comparable
+{
+	final long time;
+	final int LB;
+  
+  	public LumiBlock(int _LB, long _time) 
+	{
+		time = _time;		
+		LB = _LB;
+	};
+
+	public String toString()
+	{
+		return ("LB: " + LB + " started at " + time);
+	}
+
+	public int compareTo(Object o)
+	{
+		if (o instanceof LumiBlock)
+			return (int)((time - ((LumiBlock)o).time));
+		else
+			return 0;
+	}
+
+}
diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/PlotDrawer.class b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/PlotDrawer.class
new file mode 100644
index 0000000000000000000000000000000000000000..e3fbce7de1309139e594ec5ef04572adf05d5d3e
GIT binary patch
literal 6449
zcma)A3w)H-mH(f4<eLm1BpDJgybMqC5Q0%DCV=Eg210^K1OrwWGGAa|G81PeJk%;y
zYTard>uR67)IMo<TdR~zP*z)Qb+@+K?sk2)yX&^AeQkHUUEA(bh5pa|W|BeD{dFMs
zo^$WH=Y7t-GtZoT^l<<U@}3}W#khr2L3l7;jCbJ?9UcvGI9-gt#bb&-uF%(};p=!}
z8lJ>Aboi!)r}WU%O7M5Zn2x^>;#+t|(QhmC9fh9Njpr2ouA<*l=pPjNN8R|oqW`4m
z^9sG7(2Kh9l0q-*@QR{8Q0RxM#6Mg3mtrhcS^tVxRm*=<C4S_;?VS7ZAE90P@#>2A
z2qE8X1bqag7(d3p2k{zS_pN^b2;e7*{4{`{S@?MnzrcS4@k{)tuk{R|wEq>ruPpp`
z5bH1=z^`@wp8(#_`8T@%+W>y2^Z#1-zW~kzu>rqVj&E9cD}b{>Y{EHJ?+HJp^W&}J
zt{@=PWU0Dkop_3_e)Wmo)yvaP(fZq08mb_6iB}1ImiY50e;ULNDI!O)ED4ZAqxEAc
z4oEN{(-gGz$aEu4p&6Ex1QC-``cBFe3Kh#tDc7Mw31-oIGFyj>bf^r-982Z~k)h5q
zPv%>)pja-Js(>sE;-D-F%3@g(l%=xFl1nV97WlV?+xj~N5*AEvO(xQrNFuW}5+8NE
zwDqW<sIxu1p|hWu=Q?67J-u!1y~LP!DDEHF(!R4VyuDo)0s>z&l8Fdrb?u8Bh}4f}
zV)6Q}SYp2u?TV!{O+3&S+mnc7MpKTUYD%ItU7cIIlToK>9m#|7(c#$ccye%mTCn(!
z(07rhMQO|t&+eFDflC@Wn5mBqNA@`NEu%w2PRfaf6(eJ7IF{&-4O0u*s95BXi}|_U
z)k3duMQ5eknv7>i*WuE+SP|D-M^p3%2@Rl>eVGU;m75C{?L82WB`Bn5O)L@1tP^;v
zYqru$tu#<jLf1Imqr<zMRDWc5oGZa-Dsr%M>y~(ueCAen^`~MZO|C8RNMcWYUnUhx
z>}gUS(<x$b|K`YuIciA_l}<TnhX;$5OW$BbIbKvf>52`h$jIK<V7j4=98COcnd3}l
zrEfmu(8uPeichmM<n-xJcEprbMUK_^npjfDB%|<=NGw6&v!)Pe6b|+!M^l52%d13X
zv{9^+TA`_8;}||ED4!~AZ2TGCXXE`kd>)^)<WgIf<A{yF;vg%e-jbEJTqX^4f-RTJ
z6}DU{t2A*<BH8i|S#9Ibajz{`;a*D`ZE2D<HvU3a)+%(LGFqoYlU!}%eudU5^kIC&
zmi0O`NwbZQDzsLik15o`0Uy`l6MCYR1O8H>HmRp8C-TygcAM$5!NynckS(2RL)d2G
zZL*}+mM+=M7*uIuF*$ANmL9ru>6I&14hc$)M~usRcJFfrGnQ<z<r?Xw-)-rWep{}U
zO+3#eOgV{6m0<Sd5jS62Mq}})!({bVRaM!tRkkVrD^@fN*>ar>*s@(YOw(kmN;8E=
z)3)r;rRj!~R#8V%W9x5D#UgRWN_uR$UfwB~V<<Atp-g>WY<MK@v_&#bM=~|6g%IfM
zY#bhLOs6%vH2enHDS#@l%a(}jwq;PFf*FQ~=@oif+0zSsLhI*GD6q##4%asi4Y6YS
zQ;|e^h%#*1qgn=|(dC;rFF(wW%G}x&?rv|SoqJ`IEiu_?%RUu6Z-UnpEkT9uxA8%I
z$d<SaTavIPDfB}|Mr}DD2W@-_U$AjphcDv`^yQZB4FcORjV0?ftt~lZ%VD`mFw-oX
zsI?y&bVf3<WWti0ZMj9>#Rk!yN+naO;;k}Z$!)eA!9$kZZp*vn4%#zW8-kE>I#i!N
z$hxoJxFwQs;<-h)yM{APDw0VuxUNhM)?}TZmp^VYu={ABO?hblA+YyAEHRWMt=lSc
zUEB2Qg4k#Wr+;G;0%uj%6dcGaqRn-0B;C!FFzs$T1tttqo~JL!W>R}2Q6|B8&Be|1
zrW!q)F<si#!yMck$?WARwp%7-^~Q}gY~WtDT!F`Q?&@&3hIg5Dz^x}G>gcG^?mg(1
z2rYKAoaee)*z_t)w2axU$#|Sa#&B`nmrkZ=#LQeroAitJU;kj-iO}t?X6kmH)j0TC
zx~^@XaOT7YEe)_c=ZNw=C%2WSY5(~!&7Pv&(lnBlOlDU{JZY|+1A1Ziuwu%qJ91Gm
z&NBNHU8MD*lvho`b%z_q!mt$b$Xz=0R&RS7Sw%)hoCHI*d<s?<p35~KH9wQg+jf2`
zObGCA=xuNBrVBUpHV-gh^q1RsLOD_DE?qGfin+Gj6t)<2*EjR3!~dTSWqX`VZ<0OE
z37ePBAoG7obz56o?vM(Ys?|_^o7zmY9>Jmlm8LwQk@8h<)M-hMcB02MU8o}^_*=S~
zTiMY3+d9MjOrgL~EFSM=I_AJ0Mw$LsTb1jK!IVQo^3~49pD!@ABEQVbK7S?XaxX*Y
z=p&+&w>5LTbW{7l&gSm^aC29<xi8$k!IGnl^d^VB)D9;SPO3E?NvHK~FyBp+3%M*I
zHHCz>HZ$`lneFUhC_@+K7KPH4=P4p+C~)U_TWQ1nLN4k7Q@DrRCmwsSdEABd@;sPg
zn-Vk^Fm;>0%R2uKEZ~~UL3btB&rJg=xPbc(r!&qly^|beNGc|1x6q#%GH@cpbVHCS
zw%JLid6(y#GWiwIFtJDUM4Sz*%#?CrymD_aV~gPO0t?JiQ#kC()ibV5X1!;3+DRR7
zQby;w6I?HJB^L7g)~$T4hfs;za0G(eiFxpD;&&9_M~T0u0Kb#?dkgTpc!m!%p1<3i
zzlS*AXcPDci1R)*dwhJEnNKb=^TB0izO>BDcb1v?z%nzRS7zqp%FKLUnVGLEGxO!g
zIY3!_HgbG`*wye70_N6^LuyaMGcXSC7<`kU|6y(mKE*KvAID2LR-*(pn1fpGd>Wr|
znaNY|^B<&%%!+F3PQn^PfK%}!2nxEFKZ0q(N8o7!w(u+U^hRIpN%$&#S<Kj0OR%KU
zcM_$iP&S4V#X~uK<`_bXmn&Xz3bV#guK4U6e$g0aD_*JioKu)PhDycf<?#7qn5Xyx
z#V<Dd3ly));oPrMe4*lt4F83SFV5lQzxepM7Mil;d{dh8rYtq4_}^yAvbUK+TunKC
z?#bF|sv?a)g-ba3b-HvM)#_}IarO<EO}L)Uz6>_5psQDLT#Ytdg?=<5iY9(xU4x@o
z%cuA{e3r31iS_s<n(-pq@f&_6KZi~!L0A@Hvs{86S%EEbCHkZh*ODG6hwn|yvhcYx
z`1+eDHo$ty=NASyq&Sevj}Fx}i<;VU)M{|bajC{6v_c~hs#pJqR;o#%%hcBjFEDVG
zp;>5X7Eh+q0$7y4o#PHv;Cj~AJFy%$(6*h_eHV4$qtVsD^8$a7D5hIx*PTE^7MD|%
zdHky!3SE&<y{h=PK#|qHy3m#0($Xwec~|)>{DIG4U0vuMzQ?e7z^f-J{C6(hxBC>X
z>N|x-Z<%MASqL@l<EG0pad(ubkNSl%qPR5_R~K4a=IuR?Yk%EotYf8I9a^77bEsuP
z!U8g!?VAw6%`94Z+7-neSC*@Bfvhi4R-2L4UM3$hvbfTrE2ptxAk^tA4UQw6#m3Xv
zG!W_<$L2;qmG)=R-B?svl&h?dDr8D)X`@xzP-&gSGE$W|<>-kK2pMGfu3f7Fbrpfq
zhKc|c%i@{|b9$+<p6bh@pPG{<5G`F!kJOdp+KRw?%dzbg2C~>*SLr{E9Ro%}Ij)b5
z<AyADD!&y<eHy#yo(Kt#pNrCx-G!FSD6nMESd!zW+D$Sm^H!C4wz%9}XEQX-qzSmn
zl{UEBlO=O2E@o0WOsYLh?Y&rpIO>pK*(4F;oWv*-`XF2PVYb|x@I2=qu&w`yE&Z2l
z<8R=o_;4pn<}Q}X`=kqZ%K+|?oAG|R8y}D_;)8M$_sTf#lgDwtJcp0S%lMf54j=c-
z;+I%0sTvfW!wM8x_@afshR4J1dIsy?M7f;7*0-?6!rz!WJH{O6x1(I0-NVM|;qiVt
z%TZ@}y=C5`WuEJ@7|Q#vw3g8-^KQ?@%q@nx(%RAnv!ij$Wh{y4ojm1a)h*LHV&Ave
zVP>*%&tdDXq1r3)Id+lHv$q^aA9eERx3ygLJxS^yoBHeYyvd*Yj>!)Rvm5MbEXo5`
zrIpLUX$mn1x8+yl!HKM#-WbU3YV$8<h6dR0$>YKdUCYhlKeo9_?~TR$TliVTXtb6N
zy`tO}>1wo0-q@QbiN>Srbd%hs++5|ao9B<t_eU)&i@kLfK7X{rpU39Sukcl{%B~?d
zQ?>UWGZM8i<Ro6qEw&%iL?#M5FLBDvKUt#bN%tQ+J5C$5^W`MYp+t7S^V?Ql;*^_z
zn#AL0yWd_+5AyDL2n%q6SN>O-C*!<%9zh2lMK6DoPU11XUcSbkc%I;m@g!Hifme6~
zy^g0?Oi$x1z9m6?Tgvbq7SyvWsORK5d{>6>JsH9G<rX|Ici;ti057tjUXo|<vb=;>
z<Tbo%im3y>a}*lL6%%uprNjT=&GsyU?lOO6%q?4ZkpF?-<HmEm8$A=pJo+0_uF{@C
zk$J`p@re@~aEr`8j(ua;Pq*&RBEI?36Bs^$L>5WClSg#8QHPWggwm&x8K@h_=qVi7
zb{tjRCvYf#9UNwdV!OP_ZTwl>{4k|n&Ks?hZO6UWS6~|Lc#V&#*I9o*!4mw8HTZM(
zj9-xQSLWvK#IF&i2Oa#@_+b`2yvpG<20g5OMJ$|{N8VrMo$tQn*5*1$xhnZIO6qj>
udTX<|W!q#_XYfAPhGfx6Gx3(;&KKZJDmTUr53-Wt9E8XSe=fh#SNsQOdP+tB

literal 0
HcmV?d00001

diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/PlotDrawer.java b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/PlotDrawer.java
new file mode 100644
index 00000000000..bc3a5da86d3
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/PlotDrawer.java
@@ -0,0 +1,255 @@
+import java.util.LinkedList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+
+import java.awt.*; 
+import java.awt.image.BufferedImage;
+import java.awt.geom.AffineTransform;
+import java.awt.Font;
+import javax.swing.*;
+
+import java.io.File;
+import java.io.IOException;
+import javax.imageio.ImageIO;
+
+public class PlotDrawer extends JPanel
+{
+   public static final int WIDTH = 900;
+   public static final int HEIGHT = 600;
+   public static final int BORDER = 50; 
+   public static final int TYPE_SIZE = 8; 
+
+
+   private LinkedList<HVNode>  data;
+   private LinkedList<LumiBlock>  lumiblocks;
+
+   private BufferedImage bi;	
+
+
+   private long minTime, maxTime;
+   private int minLB, maxLB;
+   private float minVolt, maxVolt;
+   private float minCur, maxCur;
+   private int minStat, maxStat;
+   private int hvline;
+		
+   public PlotDrawer()
+   {
+	data = new LinkedList<HVNode>();
+	lumiblocks = new LinkedList<LumiBlock>();
+   }   
+
+   public void drawHVPlot(Trip t, String filename)
+   {
+	// Clearing previous data
+	reset();
+
+	hvline = t.HVLine;
+
+	// Add smith to lists
+	for (HVNode n : t.hvinfo)
+        {
+		data.add(n);
+
+		minTime = Math.min(minTime, n.time);
+		maxTime = Math.max(maxTime, n.time);
+		minLB = Math.min(minLB, n.LB);
+		maxLB = Math.max(maxLB, n.LB);
+		minVolt = Math.min(minVolt, n.voltage);
+		maxVolt = Math.max(maxVolt, n.voltage);
+		minCur = Math.min(minCur, n.current);
+		maxCur = Math.max(maxCur, n.current);
+		minStat = Math.min(minStat, n.status);
+		maxStat = Math.max(maxStat, n.status);
+
+	}
+
+	for (LumiBlock lb : t.LBs)
+	{
+		lumiblocks.add(lb);
+		minTime = Math.min(minTime, lb.time);
+		maxTime = Math.max(maxTime, lb.time);
+	}
+
+	// For a clear drawing
+	minVolt = 0;
+	
+	Collections.sort(data);
+	Collections.sort(lumiblocks);
+
+	// Initialize 
+	drawToFile(filename);
+
+   }
+   
+
+   private void reset()
+   {
+	data.clear();
+	minTime = Long.MAX_VALUE; maxTime = Long.MIN_VALUE;
+  	minLB = Integer.MAX_VALUE; maxLB = Integer.MIN_VALUE;
+ 	minVolt = Float.MAX_VALUE; maxVolt = Float.MIN_VALUE;
+	minCur = Float.MAX_VALUE; maxCur = Float.MIN_VALUE;
+   	minStat = Integer.MAX_VALUE; maxStat = Integer.MIN_VALUE;
+   } 	
+
+   private void drawScale(Graphics2D g)
+   {
+	final int NPoints = 5;
+        g.setColor(Color.BLUE);
+	
+	float dV = (maxVolt - minVolt) / NPoints;
+	float dI = (maxCur - minCur) / NPoints;
+
+	// Voltage axe
+
+	g.drawString(" Voltage", 0, 2 * TYPE_SIZE);
+ 
+	for (int i = 0; i <= NPoints; i++)
+		g.drawString(String.format("%5.0f", minVolt + i * dV),
+			     0,
+		 	     HEIGHT - BORDER - (int)((i * dV) * (HEIGHT - 2 * BORDER) / (maxVolt - minVolt)));
+
+
+	// Current axe
+        g.setColor(Color.RED);
+
+	g.drawString("Current ", WIDTH - BORDER, 2 * TYPE_SIZE);
+	
+	for (int i = 0; i <= NPoints; i++)
+		g.drawString("   " + String.format("%4.2f", minCur + i * dI),
+			     WIDTH - BORDER,
+		 	     HEIGHT - BORDER - (int) (  (i * dI) * (HEIGHT - 2 * BORDER) / (maxCur - minCur)));
+
+	g.setColor(Color.GREEN);
+	g.drawString("Trip status", WIDTH/2 - BORDER, 2 * TYPE_SIZE);
+	
+	
+	// Time axe	
+	g.setColor(Color.GRAY);
+	g.setFont(new Font("Arial", 1, 10));
+	
+	SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");
+
+	for (LumiBlock lb : lumiblocks)
+	{
+		int x = BORDER + (int)((lb.time - minTime) * (WIDTH - 2 * BORDER) / (maxTime - minTime));
+		g.drawLine(x, BORDER, x, HEIGHT-BORDER);
+		g.drawString( "" + lb.LB, x - TYPE_SIZE, BORDER - 5);
+		g.setTransform(AffineTransform.getRotateInstance(Math.PI / 6, x, HEIGHT - BORDER));
+		g.drawString(df.format(new Date(lb.time*1000)), x, HEIGHT-BORDER+TYPE_SIZE);
+		g.setTransform(new AffineTransform());
+		
+
+	}
+	
+	g.setColor(Color.BLACK);
+	g.setFont(new Font("Arial", 1, 14));
+
+	df = new SimpleDateFormat("dd-MM-yyyy");
+
+	g.drawString(df.format(new Date(minTime*1000)), WIDTH - 2 * BORDER, HEIGHT - TYPE_SIZE);
+	g.drawString("HVLINE: " + hvline, BORDER, HEIGHT - TYPE_SIZE);
+	
+   }
+
+   private void drawAxes(Graphics2D g)
+   {
+        g.setColor(Color.WHITE);
+        g.fillRect(0, 0, WIDTH, HEIGHT);
+        g.setColor(Color.BLACK);
+	g.drawLine(BORDER-TYPE_SIZE, HEIGHT-BORDER, WIDTH-BORDER+TYPE_SIZE, HEIGHT-BORDER);
+        g.setColor(Color.BLUE);
+	g.drawLine(BORDER-TYPE_SIZE, BORDER, BORDER-TYPE_SIZE, HEIGHT-BORDER);
+        g.setColor(Color.RED);
+	g.drawLine(WIDTH-BORDER+TYPE_SIZE, BORDER, WIDTH-BORDER+TYPE_SIZE, HEIGHT-BORDER);
+   }	
+
+   private void drawPlots(Graphics2D g)
+   {
+	int x1, y1, x2, y2;
+
+	if (maxTime > minTime)
+	{
+		Iterator it = data.iterator(), itn = data.iterator();
+
+		if(itn.hasNext())
+			itn.next();
+
+		HVNode n1, n2;
+		
+		while(itn.hasNext())
+		{
+			n1 = (HVNode)it.next();
+			n2 = (HVNode)itn.next();
+		
+			x1 = BORDER + (int)((n1.time - minTime) * (WIDTH - 2 * BORDER) / (maxTime - minTime));
+			x2 = BORDER + (int)((n2.time - minTime) * (WIDTH - 2 * BORDER) / (maxTime - minTime));
+		
+			if(maxStat > minStat)
+			{
+				g.setColor(Color.GREEN);
+				y1 = HEIGHT - BORDER - (n1.status - minStat) * (HEIGHT - 2 * BORDER) / (maxStat - minStat);
+				y2 = HEIGHT - BORDER - (n2.status - minStat) * (HEIGHT - 2 * BORDER) / (maxStat - minStat);
+				g.fillOval(x1-2, y1-2, 4, 4);
+				g.fillOval(x2-2, y2-2, 4, 4);
+				g.drawLine(x1, y1, x2, y2);
+			}
+
+			if(maxCur > minCur)
+			{
+				g.setColor(Color.RED);
+				y1 = HEIGHT - BORDER - (int)((n1.current - minCur) * (HEIGHT - 2 * BORDER) / (maxCur - minCur));
+				y2 = HEIGHT - BORDER - (int)((n2.current - minCur) * (HEIGHT - 2 * BORDER) / (maxCur - minCur));
+				g.fillOval(x1-2, y1-2, 4, 4);
+				g.fillOval(x2-2, y2-2, 4, 4);
+				g.drawLine(x1, y1, x2, y2);
+			}
+
+			if(maxVolt > minVolt)
+			{
+				g.setColor(Color.BLUE);
+				y1 = HEIGHT - BORDER - (int)((n1.voltage - minVolt) * (HEIGHT - 2 * BORDER) / (maxVolt - minVolt));
+				y2 = HEIGHT - BORDER - (int)((n2.voltage - minVolt) * (HEIGHT - 2 * BORDER) / (maxVolt - minVolt));
+				g.fillOval(x1-2, y1-2, 4, 4);
+				g.fillOval(x2-2, y2-2, 4, 4);
+				g.drawLine(x1, y1, x2, y2);
+			}
+	
+		}  
+	}
+
+   }
+
+
+   private void drawToFile(String filename)
+   {
+	bi = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB);
+	Graphics2D g = bi.createGraphics();
+	g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+	
+	drawAxes(g);
+	drawScale(g);
+	drawPlots(g);
+
+	// Save to file
+	try
+	{
+		ImageIO.write(bi, "PNG", new File(filename));
+	}
+	catch (Exception e)
+	{
+		System.out.println("Error: " + e.getMessage());
+	}
+   }
+
+   public void paint(Graphics g)
+   {
+	if (bi != null)
+  		g.drawImage(bi, 0, 0, this);      
+        
+   }
+
+}
diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/Trip.class b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/Trip.class
new file mode 100644
index 0000000000000000000000000000000000000000..c52f8cb005e2b3500d2661cbf90660aa06bcc01e
GIT binary patch
literal 2279
zcmZ`*TXYje82+YBGRbxerEOZuodS|ZLPQZTfr_OKO-)OowHUl^lWEvC*^RrKaue@(
z7w?LwFTU{N3mi$*oa3VpzIl$%KJ)A==ZODo+B8DwX=i8VpZWg(`~Pod`p3V&{s!P-
ze6JviL;$;SR5qg=Nd=zT%$S^ck|X8ExB@>WIF4~lDo`<@pbf`mb3(xsre*V#f*G9j
z<7qiabDUBTlnaA+hT~ZUYw?^!d0xQ_c+pGV>8JIU0u8eq83mh>ZG*rZM@~UMPD^y1
zV?KZd<T(lob|T@2A-|@A9Vp7)OA0L591cf`!RJ_dF*(e@k~A2dN$G~5&gn(nm@^qV
zQuErP7A-k?KAO^PC(aO<(sPF9lq_1e?k@Ae)acBFnHBLtTG*NzvKcnsvm{k2=tFrk
zv*51s9n=lo8D#K;k^?jJIYRpxR?9#pN`+ZrO>47xn&}B8YfyR3$VI0pZX*|$JKCol
zEweDL72Sm{u|=wZoBMeNWy&mB8IjN>NMM@i?v|WXJcctW9>N}#s=9}vyOF7}AhMFL
zibt?l#eVE1vhD&$oOPm8dZCyX!<r)!rd7}!hOTq;6B!?mWV5l+(O97nvu)|(ECufF
z)6M8mX>LwfB6~t;Sz$4BE*oTQwMn_<oQm_fz_F;}Wn5J83SQ-SO~vbYgQ2aSJv*l2
zO}xd>w-R_QE7RtJF!b}nQgI0v7<yL%pVTZ{Oq#at=%yi^5y;zkhvQup@8Nxp4^(`J
zk6bCpLdqqVIX+hL2|lIt)xAr@XDU9&8REXoBYAA(Y(^9%Hpdq#zQk9{-W!TGRMPV<
ze?DSarWM<w;%i({@eMAhxGI@{tKvJEIghLsiO|J&5suByiwvc^VXDTN<Q9@*2!@)A
zq-$xO%23O+D;>W@rKm~1J2Y_bPRc`G7&+&(3r{B`V3%fXS9-1>lTG)mS&27kI3g!&
z?JvsA)9^ka61HMHn&sFhb?L4tk5d$YLHctG%;0q~84fk!T;t-3^?x;wFGcL0XenSi
zsH@y~>oW{IC!A@$K<9;$I!1?ag-{}IO1Uep>!m@{SQErKG?q*x+*94)LLMsu*0R~V
zSk`JAA0U?AP;yLG)0@egHigkx?sK*y3It%5WG-twsj8E7A2_51p%sXdPb(IMK^`Ja
za&vFdmLy3V6{0>aY+K8bTfbv2tE;Z@20xUjqV$?Ku$3<UC|%DU`lBmF-qi9|aldqf
zfZ<W<w_qQ&beYu02WXDTV@PeBY{$_`Gr*2;1uVS&CR)O+H_;ld!jrDRdlSBuF27C-
z84gmr4nAtT$bB~g^nR>D5BkuH?evC7_(L`LmL9UU)28ti_@>BJ_|u(%3Y3_)ineqW
zYI;`%?G>zw`TBfitWHn-j_z=z!yhT5ql`5_qm#m{o6bZ!yUOUk3Zsf(I#NMT%+u%X
z^OVtB#oBah1$||#D`R~(HWc=A*FX^a0!zJ32b6lRt!`DrKfzbU=5!Aa26~m=wxC+U
zmS3>71t+iFxm5Q)*5FjSl*s)4?)?PItLRS$d5^z>ZOec+B;fXI=#Tks;DIW3QUyYt
z17(Dz;X(SAv8#;8bxLlSg;|7N*cP`O7B)~h)>An)P{KD-Q8v+Iy$xY{e&ZOx2=!(V
zflivSNiUa4DOX4@KhSIQBdMcII{A}y@)wovZ`yH-Q2)Up){a5ekHc&ShFBO!$>T7i
ze@0jeqZlNQ`{BJqz?|c8#&MW_!SMvg5O5n8Z)5TfjeSd2NE>L~kxfKkn6|fI<Uc%t
B9Yp{D

literal 0
HcmV?d00001

diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/Trip.java b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/Trip.java
new file mode 100644
index 00000000000..70db908c4e5
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/TripVisualizer/DataVisualizer/Trip.java
@@ -0,0 +1,74 @@
+import java.util.List;
+import java.util.LinkedList;
+import java.util.StringTokenizer;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.io.*;
+import java.io.BufferedReader;
+import java.io.FileReader;
+
+public class Trip
+{
+  int tripID;
+  int HVLine;
+  List<HVNode> hvinfo;
+  List<LumiBlock> LBs;
+
+  public Trip(int id)
+  {
+	tripID = id;
+	HVLine = 0;
+	hvinfo = new LinkedList<HVNode>();
+	LBs = new LinkedList<LumiBlock>();
+  }
+
+  public Trip(int id, String filename)
+  {
+	tripID = id;
+	hvinfo = new LinkedList<HVNode>();
+	LBs = new LinkedList<LumiBlock>();
+	
+	// Reading from file
+	String str;
+	StringTokenizer st;
+	SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd:HH:mm:ss");
+
+	try
+	{
+		BufferedReader in = new BufferedReader(new FileReader(filename));
+		// Get HVLine number
+		if ((str = in.readLine()) != null)
+			HVLine = Integer.parseInt(str.substring(8, str.length()));
+		
+		// Get parameters varaiation
+		while (((str = in.readLine()) != null) && !str.startsWith("LumiBlocks:")) 
+		{
+			st = new StringTokenizer(str);
+      			long time = df.parse(st.nextToken(), new ParsePosition(0)).getTime()/1000;	// seconds from Jan, 1, 1970 
+  			int lb = Integer.parseInt(st.nextToken());
+     			float voltage = Float.parseFloat(st.nextToken());
+      			float current = Float.parseFloat(st.nextToken());
+     			int status = Integer.parseInt(st.nextToken());
+
+			hvinfo.add(new HVNode(time, lb, voltage, current, status));
+    	 	}
+
+		while ((str = in.readLine()) != null)
+		{
+			st = new StringTokenizer(str);
+ 			int lb = Integer.parseInt(st.nextToken());
+      			long time = df.parse(st.nextToken(), new ParsePosition(0)).getTime()/1000;	// seconds from Jan, 1, 1970 
+ 			LBs.add(new LumiBlock(lb, time));
+ 
+		}
+       		
+    		in.close();
+	}
+	catch (IOException e)
+	{
+		System.out.println("Error: " + e.getMessage());
+	}
+  }
+
+}
\ No newline at end of file
diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/GenerateAllPlots.py b/LArCalorimeter/LArMonitoring/python/TripVisualizer/GenerateAllPlots.py
new file mode 100644
index 00000000000..2150886c9c3
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/TripVisualizer/GenerateAllPlots.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python2.5
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# GenerateAllPlots.py
+
+import os, sys
+
+dataDir = 'HVHistoryDat'  # No '/' here!
+pictDir = 'HVHistoryPic'
+
+# Clearing data and picture directories
+
+try:
+	if not os.path.exists(dataDir):
+		print 'No directory with dat files found, exiting'
+		sys.exit()
+
+	if not os.path.exists(pictDir):
+		os.mkdir(pictDir)
+	else:
+		for the_file in os.listdir(pictDir):
+	   		os.unlink(os.path.join(pictDir, the_file))
+		
+except Exception, e:
+	print e
+
+curDir = os.getcwd()
+os.chdir(curDir + '/DataVisualizer')
+
+classpath = os.getcwd()
+
+# Verify if we need to compile it first
+if not os.path.exists(classpath + '/DataVisualizer.class') :
+	cmd = 'javac -cp ' + classpath + ' DataVisualizer.java'
+	print 'Compiling: ' + cmd 
+	os.system(cmd)
+
+# Starting Java
+
+cmd = 'java -cp ' + classpath + ' DataVisualizer '
+print 'Starting: ' + cmd 
+os.system(cmd)
+
+print 'Done!'
+os.chdir(curDir)
\ No newline at end of file
diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/GenerateHVDatFiles.py b/LArCalorimeter/LArMonitoring/python/TripVisualizer/GenerateHVDatFiles.py
new file mode 100644
index 00000000000..50a0446a389
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/TripVisualizer/GenerateHVDatFiles.py
@@ -0,0 +1,337 @@
+#!/usr/bin/env python2.5
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# GenerateHVDatFiles.py
+
+import sqlite3, datetime, os, sys, datetime
+
+# no arguments = recreate
+# ./GetHVHistory.py startID = append evth starting from given id
+
+
+from optparse import OptionParser
+import time
+from time import localtime
+from time import mktime
+from calendar import timegm
+from datetime import datetime
+from PyCool import cool
+import math
+
+outputList = {}
+dataDir = 'HVHistoryDat'
+
+def PrintHVInfo(hvline,tmstmp,folderName):
+   
+    from PyCool import cool
+    outputList["voltage"] = []
+    outputList["current"] = []
+    outputList["status"] = []
+    outputList["time"] = []
+ 
+    dbSvc = cool.DatabaseSvcFactory.databaseService()
+    db=dbSvc.openDatabase("oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_DCS;dbname=COMP200")
+    folder=db.getFolder(folderName)
+    
+    range=3*60*60*1e9 # 1 day in ns
+    t1=long(tmstmp-range)
+    t2=long(tmstmp+range)
+    
+    itr=folder.browseObjects(t1, t2, cool.ChannelSelection(hvline))
+    while itr.goToNext():
+        obj=itr.currentRef()
+        pl=obj.payload()
+        time_out = time.strftime("%Y-%m-%d:%H:%M:%S",localtime(obj.since()/1e9))
+        outputList["voltage"].append(pl["R_VMEAS"])
+        outputList["current"].append(pl["R_IMEAS"])
+        outputList["status"].append(pl["R_STAT"])
+        outputList["time"].append(time_out)
+
+    itr.close()
+    db.closeDatabase()
+    return
+
+def PrintLumiBlockTimes(tmstmp, minLB, maxLB, file):
+
+    file.write("LumiBlocks:\n")
+    tmstmp = int(time.mktime(time.strptime(tmstmp,"%Y-%m-%d %H:%M:%S")))*1000000000L
+
+    dbSvc = cool.DatabaseSvcFactory.databaseService()
+    db=dbSvc.openDatabase("oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200")
+    folder=db.getFolder("/TRIGGER/LUMI/LBTIME")
+    timerange=60*60*1e9 # 1 hour in ns
+    t1=long(tmstmp-timerange)
+    t2=long(tmstmp+timerange)
+    
+    itr=folder.browseObjects(t1,t2,cool.ChannelSelection.all())
+    while itr.goToNext():
+        obj=itr.currentRef()
+        if obj.until()>t1:
+            pl=obj.payload()
+            run=pl["Run"]
+            lb=pl["LumiBlock"]
+            if(lb >= minLB) and (lb <= maxLB + 1):
+                s = '{0:5d} {1:19s}\n'.format(lb, time.strftime("%Y-%m-%d:%H:%M:%S",localtime(obj.since()/1e9))) 
+                file.write(s)
+    itr.close()
+    db.closeDatabase()
+    return
+
+
+def GetCOOLInfo(folderName,dbName,channel,tmstmp,params):
+    from PyCool import cool
+    dbSvc = cool.DatabaseSvcFactory.databaseService()
+    db=dbSvc.openDatabase(dbName)
+    folder=db.getFolder(folderName)
+    range=0.5*60*60*1e9 # 1 day in ns
+    chanList = []
+
+    if type(channel)==type(int()):
+        chanList.append(channel)
+    elif type(channel)==type(list()):
+        chanList = channel
+    else:
+        print channel," should be a list or an integer"
+        sys.exit(-1)
+    
+    for p in params:
+        for ch in chanList:
+            outputList[p+str(ch)]=[]
+    for t in tmstmp:
+        t1=long(t-range)
+        t2=long(t+range)
+        for ch in chanList:
+            itr=folder.browseObjects(t1,t2,cool.ChannelSelection(ch))
+            infoFound=False
+            while itr.goToNext():
+                obj=itr.currentRef()
+                if obj.until()>t:
+                    pl=obj.payload()
+                    for p in params:
+                        outputList[p+str(ch)].append(pl[p])
+                        infoFound=True
+                    break
+            itr.close()
+            if infoFound==False:
+                for p in params:
+                    outputList[p+str(ch)].append(0)
+    db.closeDatabase()
+    return
+
+                
+def ConvertToUTC(ts_in):
+    return time.gmtime(time.mktime(time.strptime(ts_in,"%Y-%m-%d:%H:%M:%S")))
+
+
+
+def GetHVlineHistory(tripID, hvline, timestamp, startLB, stopLB):
+
+    hv = int(hvline)
+    TimeStamp=int(time.mktime(time.strptime(timestamp,"%Y-%m-%d %H:%M:%S")))*1000000000L
+	
+    PrintHVInfo(hv,TimeStamp,"/LAR/DCS/HV/BARREl/I16")
+
+    if len(outputList["time"]) == 0:
+        PrintHVInfo(hv,TimeStamp,"/LAR/DCS/HV/BARREL/I8")
+
+    ts_list = []
+    for it in outputList["time"]:
+        ts_list.append(int(timegm(ConvertToUTC(it)))*1000000000L)
+
+    GetCOOLInfo("/TRIGGER/LUMI/LBTIME","oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=COMP200",0,ts_list,["Run","LumiBlock"])
+    GetCOOLInfo("/LHC/DCS/FILLSTATE","oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_DCS;dbname=COMP200",1,ts_list,["StableBeams","FillNumber","NumBunchColl"])
+    GetCOOLInfo("/EXT/DCS/MAGNETS/SENSORDATA","oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_DCS;dbname=COMP200",[1,3],ts_list,["value"])
+
+    for s,solc in enumerate(outputList["value1"]):
+        if abs(solc-7730.) < 10:
+            outputList["value1"][s] = "ON"
+        elif abs(solc-0.) < 10:
+            outputList["value1"][s] = "OFF"
+        else:
+            outputList["value1"][s] = "RAMP"
+
+    for s,torc in enumerate(outputList["value3"]):
+        if abs(torc-20400.) < 10:
+            outputList["value3"][s] = "ON"
+        elif abs(torc-0.) < 10:
+            outputList["value3"][s] = "OFF"
+        else:
+       	    		outputList["value3"][s] = "RAMP"
+
+    filename = dataDir + '/trip_' + str(tripID) + '.dat' 
+    f = file(filename,'w')
+
+    s = 'HVLINE: ' + str(hvline) + '\n'
+    f.write(s)
+
+
+    # How much time before TripLb and after RecoveryLB to consider (in LB)
+    offset = 3
+    prefilled = False
+    postfilled = False
+
+    for i,v in enumerate(outputList["voltage"]):
+		
+        lb = outputList["LumiBlock0"][i]
+	
+        if (lb == startLB) and (not prefilled):
+            # "Pre trip history"
+			
+            sec_time = time.mktime(time.strptime(outputList["time"][i], "%Y-%m-%d:%H:%M:%S"))
+			
+            # Checking for the previous entry
+            if( sec_time - time.mktime(time.strptime(outputList["time"][i-1], "%Y-%m-%d:%H:%M:%S")) < 30) and (i >= 2):
+			
+                # If it is too close, we consider the one before as a stable
+
+                voltageStable = outputList["voltage"][i-2]
+                currentStable = outputList["current"][i-2]
+                statusStable = outputList["status"][i-2]
+                sec_time = time.mktime(time.strptime(outputList["time"][i-1], "%Y-%m-%d:%H:%M:%S"))
+
+                # Writing down few entries before with stable values
+
+                for j in range(0, offset):
+                    lb = outputList["LumiBlock0"][i-1] - offset + j
+                    node_time = time.strftime("%Y-%m-%d:%H:%M:%S", time.localtime(sec_time - 60 * (offset - j)))
+                    s = '{0:19s} {1:5d} {2:.2f} {3:.3f} {4:5d}\n'.format(node_time, lb, voltageStable, currentStable, statusStable) 
+                    f.write(s)
+				
+                # Writing down current entry (it is the real beginning of the trip)
+                s = '{0:19s} {1:5d} {2:.2f} {3:.3f} {4:5d}\n'.format(outputList["time"][i-1],
+										     outputList["LumiBlock0"][i-1],
+										     outputList["voltage"][i-1],
+ 										     outputList["current"][i-1],
+										     outputList["status"][i-1]) 
+                f.write(s)
+				
+
+
+            else:
+
+                # Otherwise the current one is considered stable
+                voltageStable = outputList["voltage"][i-1]
+                currentStable = outputList["current"][i-1]
+                statusStable = outputList["status"][i-1]
+
+                # Writing down few entries before with stable values
+
+                for j in range(0, offset):	
+                    lb = startLB - offset + j
+                    node_time = time.strftime("%Y-%m-%d:%H:%M:%S", time.localtime(sec_time - 60 * (offset - j)))
+                    s = '{0:19s} {1:5d} {2:.2f} {3:.3f} {4:5d}\n'.format(node_time, lb, voltageStable, currentStable, statusStable) 
+                    f.write(s)
+                    
+            prefilled = True
+		
+
+
+        elif(lb >= startLB) and (lb <= stopLB) :
+
+            s = '{0:19s} {1:5d} {2:.2f} {3:.3f} {4:5d}\n'.format(outputList["time"][i],
+                                                                 outputList["LumiBlock0"][i],
+                                                                 outputList["voltage"][i],
+                                                                 outputList["current"][i],
+                                                                 outputList["status"][i]) 
+            f.write(s)
+
+
+
+
+        elif (lb > stopLB) and prefilled and (not postfilled):
+            # "Post trip history"
+
+            voltage = outputList["voltage"][i]
+            current = outputList["current"][i]
+            status = outputList["status"][i]
+
+            sec_time = time.mktime(time.strptime(outputList["time"][i-1], "%Y-%m-%d:%H:%M:%S"))
+
+            for j in range(1, offset+1):
+                lb = stopLB + j
+                sec_time = sec_time + 60;
+                node_time = time.strftime("%Y-%m-%d:%H:%M:%S", time.localtime(sec_time))
+			
+                s = '{0:19s} {1:5d} {2:.2f} {3:.3f} {4:5d}\n'.format(node_time,
+                                                                     lb,
+                                                                     outputList["voltage"][i],
+                                                                     outputList["current"][i],
+                                                                     outputList["status"][i]) 
+
+                f.write(s)
+
+            postfilled = True
+
+    # Writing down LumiBlocks' times
+    PrintLumiBlockTimes(timestamp, startLB - offset, stopLB + offset, f)
+
+    f.close()
+    
+    return
+
+
+# Main program
+
+startID = int(0)
+
+parser=OptionParser()
+(options,args)=parser.parse_args()
+
+# If no argument provided, we recreate everything
+# Otherwise, append only new for trip with ID > startID
+
+if len(args) == 0:
+	newDB = True
+else:
+	newDB = False
+	startID = int(args[0])
+
+
+# Clearing data and picture directories
+
+try:
+	if not os.path.exists(dataDir):
+		os.mkdir(dataDir)
+	elif newDB:
+		for the_file in os.listdir(dataDir):
+	    		os.unlink(os.path.join(dataDir, the_file))		
+except Exception, e:
+	print e
+
+#Connect to the database
+
+dbName='trips.db'
+conn = sqlite3.connect(dbName,detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
+
+c = conn.cursor()
+
+# Get TripId and HVLINE
+
+if newDB:
+	query = 'SELECT trips.rowid, trips.HVLINE, trips.TripTimeStamp, trips.TripLB, trips.RecoveryLB, trips.StableZero from trips WHERE (trips.StableBeams=\'Y\') ORDER BY trips.rowid'
+else:
+	query = 'SELECT trips.rowid, trips.HVLINE, trips.TripTimeStamp, trips.TripLB, trips.RecoveryLB, trips.StableZero from trips WHERE (trips.StableBeams=\'Y\') & (trips.rowID>=' + str(startID) + ') ORDER BY trips.rowid'
+
+c.execute(query); 
+
+
+# Get history for each trip
+
+r = c.fetchall();
+
+
+print len( r ), " trips found"
+   
+for i in range(len(r)):
+	print "Working with tripId = ", r[i][0], ", HVLINE = ", r[i][1], ", timestamp = ", r[i][2], ", TripLB = ", r[i][3], ", RecoveryLB = ", r[i][4], "StableZero = ", r[i][5]
+	if r[i][3] <= r[i][4]:
+		GetHVlineHistory(r[i][0], r[i][1], r[i][2], r[i][3], r[i][4])
+	else:
+		# RecoveryLB is smaller then TripLB, using StableZero instead
+		GetHVlineHistory(r[i][0], r[i][1], r[i][2], r[i][3], r[i][5])
+
+# Closing
+
+c.close()
+conn.close()
+print 'Done!'
diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/GeneratePlot.py b/LArCalorimeter/LArMonitoring/python/TripVisualizer/GeneratePlot.py
new file mode 100644
index 00000000000..0f1eefb625b
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/TripVisualizer/GeneratePlot.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python2.5
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# GeneratePlot.py
+
+import os, sys
+from optparse import OptionParser
+
+dataDir = 'HVHistoryDat'  # No '/' here!
+pictDir = 'HVHistoryPic'
+
+parser=OptionParser()
+(options,args)=parser.parse_args()
+
+if len(args) == 0:
+	print 'No argument provided'
+	print 'Should use: python GeneratePlot.py tripID instead'
+else:
+	ID = args[0]
+
+
+
+# Clearing data and picture directories
+
+try:
+	if not os.path.exists(dataDir):
+		print 'No directory with dat files found, exiting'
+		sys.exit(-1)
+
+	if not os.path.exists(pictDir):
+		os.mkdir(pictDir)
+
+	elif os.path.exists(pictDir + '/trip_' + ID + '.png'):
+		print 'Plot already exists, exiting'
+		sys.exit(0)
+	
+except Exception, e:
+	print e
+
+curDir = os.getcwd()
+os.chdir(curDir + '/DataVisualizer')
+
+classpath = os.getcwd()
+
+# Verify if we need to compile it first
+if not os.path.exists(classpath + '/DataVisualizer.class') :
+	cmd = 'javac -cp ' + classpath + ' DataVisualizer.java'
+	print 'Compiling: ' + cmd 
+	os.system(cmd)
+
+# Starting Java
+
+cmd = 'java -cp ' + classpath + ' DataVisualizer ' + ID
+print 'Starting: ' + cmd 
+os.system(cmd)
+
+print 'Done!'
+os.chdir(curDir)
\ No newline at end of file
diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/HVHistoryPic b/LArCalorimeter/LArMonitoring/python/TripVisualizer/HVHistoryPic
new file mode 120000
index 00000000000..ba8f40ebceb
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/TripVisualizer/HVHistoryPic
@@ -0,0 +1 @@
+/afs/cern.ch/user/l/larmon/scratch0/HighVoltage/HVHistoryPic
\ No newline at end of file
diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/readme b/LArCalorimeter/LArMonitoring/python/TripVisualizer/readme
new file mode 100644
index 00000000000..b5dc4f7baec
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/TripVisualizer/readme
@@ -0,0 +1,21 @@
+
+1) You first need to generate all data files. To do so, run
+
+python GenerateHVDatFiles
+
+All previous files will be erased. If you only want to append the data for new plots, run
+
+python GenerateHVDatFiles #startID
+
+where #startID is a tripID to start with. The tool will delete no files and only append new ones.
+
+2) You might want to generate all plots as well. To do so, run
+
+python GenerateAllPlots.py
+
+Previous plots will be deleted.
+
+3) To (re)create only one plot, run
+
+python GenerateAllPlots.py #tripID
+ 
diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/setup.sh b/LArCalorimeter/LArMonitoring/python/TripVisualizer/setup.sh
new file mode 100755
index 00000000000..68eb1465159
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/TripVisualizer/setup.sh
@@ -0,0 +1,11 @@
+#export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup
+#source $AtlasSetup/scripts/asetup.sh 16.6.2.4
+
+last=`ls -t HVHistoryDat | head -1 |sed -e "s/trip_//" -e "s/.dat// " `
+echo $last
+
+next=$((last+1))
+echo $next
+
+#python GenerateHVDatFiles.py $next
+#python GenerateAllPlots.py  #should be a way to do this only for new ones...
diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/updateDatFiles.py b/LArCalorimeter/LArMonitoring/python/TripVisualizer/updateDatFiles.py
new file mode 100644
index 00000000000..51d22ee36b1
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/TripVisualizer/updateDatFiles.py
@@ -0,0 +1,17 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+import os
+import fnmatch
+
+tripIds=[]
+for file in os.listdir('HVHistoryDat'):
+	if fnmatch.fnmatch(file,'trip_[0-9]*.dat'):
+		tripIds.append(int(file.strip('trip_.dat')))
+
+
+startFrom = max(tripIds)+1
+
+cmd= 'python GenerateHVDatFiles.py %i'%startFrom
+
+print cmd
+os.system(cmd) 
\ No newline at end of file
diff --git a/LArCalorimeter/LArMonitoring/python/TripVisualizer/updateTripVisualizer.sh b/LArCalorimeter/LArMonitoring/python/TripVisualizer/updateTripVisualizer.sh
new file mode 100755
index 00000000000..31c4974b1b8
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/TripVisualizer/updateTripVisualizer.sh
@@ -0,0 +1,34 @@
+
+basePath=/afs/cern.ch/user/l/larmon/public/TripVisualizer
+
+pushd $basePath  #seems like the visualizer package was not written with absolute paths, temporary workaround
+
+
+
+if [ "$AtlasSetup" = "" ]; then
+    export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup
+    source $AtlasSetup/scripts/asetup.sh 16.6.2.4
+fi
+
+last=`ls -t ${basePath}/HVHistoryDat | head -1 |sed -e "s/trip_//" -e "s/.dat// " `
+echo $last
+
+next=$((last+1))
+echo "generating dat files starting from TripId=$next"
+
+python ${basePath}/GenerateHVDatFiles.py $next | tee .log
+
+cat .log |
+while read dummy dummy dummy dummy tripId dummy
+  do
+  if [ "$tripId" != "" ]; then
+      echo "generating plots for trip $tripId"
+      python ${basePath}/GeneratePlot.py $tripId
+  fi 
+  tripId=""
+done
+
+echo "Trip Visualizer has been updated!"
+
+popd
+
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/WDE_documentation.txt b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/WDE_documentation.txt
new file mode 100644
index 00000000000..7e2e1dffe6c
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/WDE_documentation.txt
@@ -0,0 +1,47 @@
+
+
+WebDisplayExtractor (WDE) version 3:
+
+Original single python file written by Matthieu Plamondon now divided into 6 files based on functionality.  
+A folder with a version 3_0, 3_1, etc is found here: /afs/cern.ch/user/l/larmon/public/WebDisplayExtractor/WDE_files_* and contains a production version of the following files:
+	
+	index_cm.py  main class (the webpage points to file /afs/cern.ch/user/l/larmon/public/WebDisplayExtractor/index.py which is a soft link to the current version of index_cm.py) calls the selection based on user input calls run_report or  noisycells with the requested values.
+	selection.py - handles the input for run number, report type, express/bulk and expert options, also contains the AddReportButton function
+	run_report.py  main function to fill the Run report table
+	noisycells.py  main function to analyse the noisy cells
+	print_rows.py  prints out the rows of interesting clusters/cells for the noisycells report
+	print_top.py  contains the code for the top of the noisycells table
+	Also in this folder are two unchanged backup files (index_Rel17_backup.py  the former Release 17 version of the WDE and scripts_backup.js  the java scripts used with the python)
+
+WDE_files_dev contains the development version of each file.  
+
+The following developments have been implemented at the same time as the splitting of into sub-files:
+1.	Remove Multiple Runs
+2.	Change version notation
+3.	Collision Lumi Blocks moved to renamed LAr Global column
+4.	Some superficial changes: bolding, capitalization, etc….
+5.	New row for stream used or stream invalid
+6.	Three new columns for the run report:
+	a.	Noise Bursts (LArNoisyRO-q factor) - Noise bursts in the LAr Global column and the Noise Burst (Energy) column will be retained for cross-checks
+	b.	DSP computation - Check if Eoffline != Eonline with precision for FEBs in each partition (# of FEBs/LBs
+	c.	Timing  Checking for each layer that the mean time is not outside the accepted interval
+7.	Options simplified for shifters:
+	a.	Choosing the run number and report type sets Data stream and processing version options automatically in most cases
+	b.	LADIeS express (express), LADIeS bulk (JetTauEtmiss), or Use Expert Options
+	c.	Run Report and NoisyLArCells (CosmicCalo)
+	d.	All options still available on Expert Option menu
+
+
+
+Changes to WDE between v3.4 and v3.5:
+
+--Proper extraction of the proc version derived from the AMI tag using DQMF function get_next_proc_pass
+--run_spec[“high_run”] variable set always to be the same as low_run
+Run Report:
+--Link to “Timeline” in column 1 is removed and replaced by link to “DQ logbook”
+--Wording is changed for clarity from “DQ web” to “Tier 0 Webdisplay” also in column 1
+--Correct the Athena software version setup for the retrieval of red LBs from DCS (from 16.0.1 to 17.2.1.1)
+--replacement of HVNONNOMINAL by HVNONNOMINAL_CORRECTED for the bulk when there is trip of a new module
+NoisyCells:
+--new flag for noisy LArCells not associated to a cluster but with a green number in CaloCells column (if pink number(Percentage of Qfactor >4000) >80% : sporadicBurstNoise; if <80% : highNoiseHG)
+--Modified flag for noisy LArCells not associated to a cluster but some information in LCE column: up to now, only cells with <E> (green number) above 5GeV was proposed.  This cut is lowered 3 GeV.
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/atlasblue.ico b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/atlasblue.ico
new file mode 100644
index 0000000000000000000000000000000000000000..c1f261b4d2a11f41c855c1bf6207cfd10ca2421b
GIT binary patch
literal 7254
zcmeHMX;)L(nzsK$ul~@zR@c2MsLX>`Ev3}HTI%hqmX=keS1o4*WJn-^gh4<iQ4xn&
zfXq{XfDl6FIUxiH86XK{p4Iy^`q}4bb#?c$*RuT9t9KoaC;ROEKJWXy!`^4twr&4_
z|F-9C!~LJO9scKS+x~Iewr$Dy+m62){E_}owfLvo+ju+@eH)F(-^OE!`1?pK7Ei<y
zZ{wsV5y5j5f9NEAq@ja)o4^w~F^s;ygMk0F5ukXK48p`{)bHE$yKO$(vS&@_Fe_Y(
z3mdvwyLx&<Jz-ajI#eSL<@maa?@&)TwQt;u!p$YgrbX?wn*uIt*z1aiL*aPhQ-DNa
z=tZ@SRkdlV)6mZ~@CsE=E~#72D;iF!8oyQ49aYvIk<}blalet*<f-e9%Igl3{s*UY
zE$6gPF6wx<%)P9&iFT)cE*cJh3Jd(esP_pl7n^OrJ9s;Fwq&=cWS6uwNmNWOap^AH
zB_+uVCCQ?aWJ$?RJj@p-;V!28OLq!Olf`AbC1t6q_8&G~tDnLm?8m`*A{vYE3jd9F
z@m~gR{44+V_Q|{3=L(bNi;~2}JBWM;yti|%V8>k1&e_5pxaNw`54at|!kvPG<f*$!
z{5xL>SchE}{im=ZZ;4%SI}B6L^bS{l|2#jZ>sosEwOze8zJdg4$!;+tdA2Bd>h{jz
z8-M7#MqO98kKWo2Tw%#B{@s+3{FMHJy`$W-rZ-)&Xz){5@2DulTN)DaVPDoRizn3l
zj#qcGMsDm_fN5n(+RiJ6@itk1y|}kgGSDn|QuzAk?bAg`M&51n!oaFz%w|*~#t_e+
z0zyC7BX8+=CNcaDqoah_cvso+SC_vM<Zp-jY=U-r*gFi5B^)Mc&y^iBg*&YLrZ9R)
zPLPH%NE|Zqa~h_oCSG-3+5yuf#k=&KSAzi$1VEESBB7o9rRVzg+2Wm=rjtRJ<#)*c
ztu7=@Vxj5B1-;k*D7=@XdT`ulGr%H@3CAMR*AM!ye<iw?EM@H3P)(6^{(=S;0jC{(
zIB;v{d~vdjk!qXc!6=x3h?RD6hHjugNm8~OG!n+Yph0FN>>s;-Vf@Yx2vjn58N2VH
zCmMSfiH3zwi^gsx&6Vz!Gxivt---qUUjRj7Cg62<<?kQAvlHnInX0Cf>xw}XBA?$o
zSATZ$PLiZ_kAjh;Z8;qdxV{97&=rY}u>Zo(C#6HdOo3~(^~YC-tF{a?lE%LZi&Nx`
zU9$32Rb5`tZTk`|Qc1$$G42_D{!YjQmYkWaVx%Z4(sb<?^c_EdSSd3_#!OMyAN@is
z*cIG#_Lt;M6r{))X;NmYw0yU;EJaqHreN+?RA$M`Qx%L<S@~|1<;bS}OYFj2&-(J~
zg50U1Bzakiq#_j%kgudJdBq+jGfi2(hv?97DzxPS4_LoYcHSkZ;_x}xu*<h@?Yf;k
zc4rp?9wsQt(`g`}sLIpj%rroYm}xdiKb?1^a3rXu^K*dcvC%-Vm-#KQ$YN1JB&%7e
z3Knr0!6F9kF?2IyVLw@Csd|EY=<{n7NzX*=O-Ir2?IdwY8X!~^1O*Qu5H=zLB~|-e
z76asyRHjM_$`?$-ug`5r=LH^n>~1pXf?djrOkk-iGGGw`o?oy_!7B}+vJ>glT1@sH
zzXu3LVWOPJm@3>wNMmQ<u4NH2B{fIpn=dZBV0xW43<E%fEJ&m*|7zgp+JzN%ruL+S
zk)mQ{Dl5}8m8m**nu3$FWta~8eThgI3l^ddcG3R&{nb7iRdrX+7ZZzgtPE9Es)n5b
zP<{PDpKTFpN3gSdOLh-v#J3>w;}#B}^jb#0A|uF{5A>3eaBqy%@KDej^tc_G83{K}
zUXiY@%+yw9;*JZr`s#ga6ZKBTpl4YbT3-qIw@6fwh#<}a3dyo4`rcyw#6OUUPU2JY
z0G%RWBN`5c-0M!Wa!ow2!hg8<<dUQ+OUcPnS7qs{GBj0Ls>)1VRhFhQTUVW>X*ss~
z^5>=AV%uz|e`6VT5&Njs91j4Z`2;ADPg#LGlmQ$5tqq56c3IGA8mQ4c`J1BlYghsK
zdQPUkGM$DnR01?h&Cb$tGl8h#WT-i5+WUEyA$D-x6pIo=XvqM5k7W)JlnQ`Iyo~}S
z9E}B?Yd|sdG8cPFwGY47)$W5dZB>rGDhKk3Sp1~q>p1DK4wM?X8BhabppU8cPu9VT
zXwXAqpGs<C2o;%Rb3!#@W;Eip8V#eZI$ogx8{PZg=&ExmbFztWZn~0{C1a*5Du}am
zHJNgD<~$=+Se7C$&rq<liH(#Wb#;dVc0KKV*h5iDa0#(ggHdja-Z)sNdv;Y-pQqtu
z8@M^R2z!;;+NxZbFju*Migj?Zh=3Yv_L*N6ys0}ia3_7LI9*+RK*>EMV`X5xp=R&8
zv^(fp4f{7C7TYk83Cpm>qFuIW)9d<bV2+~ZpqhgK%SD*UDl)~aTq!$C!OD=;pLChT
zIsvc$cCwI>p{>qxnr88Ju<)#GyeM^+ohN^IL0<D`DVun9sr|HNyvehwq39!6bXekN
z*ymODaFh+l4Rwd~HQ8EDHi()n%b9QaQT6nuh?Og@JGQl|!1y)gn_qrTo+?TMoLf5s
zZI%5G7Md@r`l|;EGUlpJ$hmolRTU@4%x?<fQ-vxZFpdgy67;L$!3EYn4JQXc7%5_8
zNLv54BpzH-3FM7uB-Mvp`gy1X!b9H8vAUlCH+}!Sf5Qg!nbs@D!TWe6>ucoQ*geBO
zB&*0?;@u|sOXV6KBH?Jj>k7IYn}#_>+xH~WNF?OSYL8ij-Pp7Qwp_~gpB5@|ETY#C
z1>a)V1jPdGHM3%B)3E{}*sf1E{sdJ?`bQ(O-lp!GDg2^z`w)}12zMB@X<al=Ki3V^
z$(qh6IJr7*j=UmQ+i}flltdEYpx>$KVM@!hmWG-M15lC*Bq9^qQjGjP5%+CarkgJY
zohzgR^&uRcc~<)R#vXCY`H0U+=T|rwR1Y@mhZ`0LIBND@byc>kYM=PgWeKlBH{M}Y
zO(MnQ?ESiqOOc>ALAIP9ATXWaekkLKWyzT0B?GznYb6YNJp+uR<7NA|7H2UFgF(CS
zQIW2nyV!A2%gvQne@%FcCwxwaS<aU|FO{$lB4yS@-F}w^gNgiD;_p<!L<K|i!VGkZ
zUzS@WL&Qv?1PvHBiH2X_*lilBMGwi}Xhc5ru<ur?n3bch&$CGeF&EmSMWR9FtFn1k
zwsD}^IQ~dB(7Yn*L183yH5wtG>K_6)zOkYcwO<KrZQ`396S1HmxPciA28S8P<{Qq0
zJ#PHOwdt@-aZfE&WUtRW{ouz$1ZCMMc(G8vSO4rfR7aIZkSj(XNnh9M#vW}LBr%^e
zg4#@_r?!`C8m=eaB$b>hL&UfQKH}8FZDYlIH_cK=M)SGs3(eoj*twRehoLPS%t8RW
z*No!(CuH0_k3|ilNa2E~;&FUoDTdqUpA>0E+FYx0grC>GtZcu!xvC@5$r3?I5KS@}
zZ&vr`r&+|^c#egFhMDJ(Y3#fzX*{p#VS61*5x;M7xJkjzHBYosY>?Fl3_u60I7pI>
z6|HixWxk_uWuYI{Y^j$K3;O^;!%?+}ln7itmvxwN#5~%F{Qx#RBaDNJhEsMC&%Gj@
zYPuxpD6&chwGBs%kI#o)YuKc~t+cif27$Q3(I|?N)2tRhXG}A)aj+0@tVUxY0*3^o
zS6J%q_qh0+Q^sC4By5<q{UryK&+gd8eW)Zs-{$<&;y0`#8t#6(umkR(<NQ5Yg`g^7
z62XIGoM4QoZ5(SCHJ)8~avd9kHO+LyhZrDZzyqv9pa5&K<~vg_3kpYq9_h<+)vIz~
zVI>7c&Q-ObG)G?b^~z)mdSa0XWRfaPz8v2{ZHgQcY<B&uwDm{VvL@p92w$)#8-6s7
zwRxS(Bn_xzpZBqNz`H(GeP(g62F8X19%1_}aBi0lpnyOn{q!>tGk3A4SkqM{d2+`p
z8xDA!*b5MpL<IkkoJhpLfV|@-4s*~$qc4m4$Lh{WI}3fwYJB%090BQZTW6|{txmLK
z3aY_ed;ZEqD-M*LCK0}O<PR?@ThGOU0YFFwo2Ke7XnJaJzC>y@3L(WL2wfI+$r{i5
z+-rn1$`I^du$`NGd<O<%3lzr@R6Oon(F&LcHl%$R772w!FUkxfjZTBuD(7$L-$<*!
zvCck6$Uy>R*q7AvJoa?`kEZb_TQ+?hhhUMgZ`~|=e8nmofkht*7f#;D0v`+byo#aL
zN$zQzcnHzrko3=Uj(Aq&7zsb9`|6c1$~+F^@|#Z0i@Tb}Z$q1Qydn{fd+Z%f6;_o3
zLDSVY?Kjp$1AdFfJiuBR<iJK~j!K1i0T7-E(a<jz(T#PEb51+7)27!9!{ZC#kPibO
z&@{!9G@Zebon`W|sN%rNP$gy%IneW?1PDO@80QD(9^X>6T~gH_+fa;p*H^K1A@VWo
z<L(9VhFMTjJ=#9ocv)3{$|7jP7}Qv7|Af5q$>L16PT-Jqq4sVlhCu~6jief42@Qka
zMoAE^3j0Ldqw>esgpaPPdO29p+@^(qb2a4iBF9lDgHe*jFo7IFwEn1n@U7pugdoJa
zgF-6ryFXt2z4S$qxv$F5aL8{K(}YlAPJl2M4RAK~l(g}TS;)ht-JzWqzN!|qT@gLa
zSM*d`1RW09sM{p-JC*}3Ysj<iHj8x+&o2E^ggOT0NvWhbcUzYx>dwz|zcDr(UY~k^
za|yVK(DHG0z_&lb2HSuoejD)!uw(C#Vp|ULlBi$Ndmkqo!qyuL53kCf-qv+9&0`Hq
z&wkd{9WXq*j^!J2h);<#Nx72`woDXd8{5v>hB>x{-nWr3k%)Kk_xSoi49i>3FOD=4
zqNqmd2X<jFnsU0&V_P>VO$!5Xle(LwYWl08`fF2HF$yep7=$R=p)s=RIIV^e)^Tma
zF}H4PWw6|-89}ZA3W;x53@Dn<EsnK>qG5<86G1687xa=IVkwCSL<P2jwz(IY`$reM
z3UEq{lm|tGLwc>DW`R|~gNySO`>aDur?hM3^}TiZP+(1KpM9=s`EF(ADXbul0}!Po
z9jL@ET4BINqc}`nnrPP4A67R0#p^KBZ!wGZ6j6^N0Y8PEr6Yw|_}aDh6+6bOEuBBv
zx^6CaUUcioi5UT+%=u5#sGR`4W+5eUvTg1ukyY=PJvh5zn8y^vKRppsNMsV*sj!YE
zaLPT%{`Zl4*>j9P;dENpbkf*z!pg6Ob%-k%j$i<*xIqGRgCQt8VYkg?5Lzc%RyxnC
z>yF?A!0TM2GlkIln}&(>FR+RfTwhd4`<td8T%K#WJY2G0SbG8lF7s|W1#Mm}A775p
zKkTvloT~xHl5a`ulJ+9^b#33NYxWtNPvXR$$fp7oR{REsJVHZUX!L>zXqXw?+Q61c
z|E7Do<??9h!O7B`Ip$snw7kw==hxcDs+YTqv5u>oPm8$+XDbg1n|~NB$x`u3ffGWc
zP@j+xL`$Z`lN%({7YL<F3q=m?h*&h__1Fyx_1F_Z!w>x8EO8~_cA@6j4EKbf?wt7P
zJ^kb}?5yxfXqxTw+f8)XP@0nv`mYpzh%1o)E17s8Sw%JU<4X{wY;#q^uRS-;KE62f
zOK{Wbaj#?VjlBxdoQ^|EZSs@K2<of!{r|8FmL^DHq=e&6dmmHCGa{P$xc(r45{Td@
kiTqJ(;umT#k`#`DEqIIYhMfOq*Qfsf(f{}V-(=uF04jG`Pyhe`

literal 0
HcmV?d00001

diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/GetATLASReadyLBs.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/GetATLASReadyLBs.py
new file mode 100644
index 00000000000..bc6449986ad
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/GetATLASReadyLBs.py
@@ -0,0 +1,21 @@
+#! /usr/bin/env python 
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+import os, sys, string ,re
+
+from ROOT import * 
+
+sys.path.append("/afs/cern.ch/user/l/larmon/public/LArCalorimeter/LArMonitoring/python/MiscLibraries")
+import MyCOOLlib
+
+LB = []
+
+if len(sys.argv) == 0  :
+  sys.exit()
+else:
+  runnum = int(sys.argv[1])
+  atlasready = MyCOOLlib.GetReadyFlag(runnum)
+  for lb,ready in enumerate(atlasready):
+    if ready: LB.append(lb+1)
+print LB
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/GetNEventsLB.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/GetNEventsLB.py
new file mode 100644
index 00000000000..da49b339c1a
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/GetNEventsLB.py
@@ -0,0 +1,90 @@
+#!/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+#
+# ----------------------------------------------------------------
+# Script : GetNEventsLB.py
+# Purpose: Utility to retrieve number of events per LB from SFO DB
+# Authors: Andreas Hoecker (CERN)
+# Created: May 16, 2011
+# ----------------------------------------------------------------
+
+import sys, getopt
+
+def GetSFO_LBNEvents( cursor, runno, streamname ):
+    """returns nfiles, fsize, nevents"""
+    stype, sep, sname = streamname.partition('_')
+    cursor.execute( "SELECT SUM(NREVENTS),LUMIBLOCKNR FROM SFO_TZ_File WHERE RUNNR=:arg_1 and STREAMTYPE=:arg_2 and STREAM=:arg_3 GROUP BY LUMIBLOCKNR ORDER BY LUMIBLOCKNR",
+                    arg_1=runno, arg_2=stype, arg_3=sname )
+    return cursor.fetchall()
+
+def GetSFO_LBs( cursor, runno ):
+    cursor.execute( "SELECT MIN(LUMIBLOCKNR), MAX(LUMIBLOCKNR) FROM SFO_TZ_Lumiblock WHERE RUNNR=:arg_1", arg_1=runno )
+    return cursor.fetchone()[0:2]
+
+def OpenSFOConnection():
+    import cx_Oracle
+    return cx_Oracle.connect("ATLAS_SFO_T0_R/readmesfotz2008@atlr")
+
+def usage():
+    print ' '
+    print 'Usage: python %s [options]' % sys.argv[0]
+    print '  -r | --run      : run number (REQUIRED)'
+    print '  -s | --stream   : full stream name (REQUIRED)'
+    print '  -h | --help     : print this usage message'
+    print ' '
+    exit(1)
+
+def main():
+
+    try:
+        shortopts  = "r:s:h?"
+        longopts   = ["run=", "stream=", "help", "usage"]
+        opts, args = getopt.getopt( sys.argv[1:], shortopts, longopts )
+
+    except getopt.GetoptError:
+        # print help information and exit:
+        print >> sys.stderr, 'ERROR: unknown options in argument %s' % sys.argv[1:]
+        usage()
+
+    runno   = None
+    stream  = None
+    for o, a in opts:
+        if o in ("-?", "-h", "--help", "--usage"):
+            usage()
+        elif o in ("-r", "--run"):
+            runno = a
+        elif o in ("-s", "--stream"):
+            stream = a
+    if not runno or not stream: usage()
+    runno = int(runno)
+
+    connection = OpenSFOConnection()
+    cursor     = connection.cursor()
+
+    #print 'Results for run: %i, stream: "%s"' % (runno, stream)
+
+    # min/max LB number for given run/stream
+    # --> this command is slow... don't know why
+    # minLB, maxLB = GetSFO_LBs( cursor, runno )
+    # print 'LB range: %i -- %i' % (minLB, maxLB)
+
+    # list with 
+    lblist = GetSFO_LBNEvents( cursor, runno, stream )
+    if len(lblist)==0:
+        return
+    else:
+        print lblist
+    #print 'First non-zero LB: ',lblist[0][1]
+    #print 'Last  non-zero LB: ',lblist[-1][1]
+
+    # access to all LBs
+    #for (nev,lb) in lblist:
+    #    print ' ... LB %4i has %5i events' % (lb,nev)
+    
+    cursor.close()
+    connection.close()
+
+if __name__ == '__main__':
+    main()
+    
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/detStatus_query.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/detStatus_query.py
new file mode 100755
index 00000000000..2ec468de7d3
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/detStatus_query.py
@@ -0,0 +1,235 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# detStatus_query.py - tool for querying detector status in COOL conditions DB
+# Richard Hawkings, 5/2/07
+# execute without arguments for help
+import os,sys
+from PyCool import cool,coral
+from CoolConvUtilities import AtlCoolLib
+from DetectorStatus import DetStatusLib
+
+class queryStatus(AtlCoolLib.coolTool):
+    def setup(self,args):
+        # set values of non-optional parameters
+        self.foldername=''
+        self.tag=str(args[0])
+        self.dets=args[1:]
+        self.summ=False
+        self.graphics=False
+        self.pictfile=""
+        # access to name encoding
+        self.namelookup=DetStatusLib.DetStatusNames()
+
+    def usage(self):
+        """ Define the additional syntax for options """
+        self._usage1()
+        print 'COOL_tag det1 {det2 ..}'
+        print 'det specifies a flag or flags to be checked (ALL=all flags)'
+        print '--folder <folder>: Set foldername to be used'
+        print '--summ : Produce summary statistics instead of listing all flags'
+        print '--graphics : Display status matrix graphically'
+        print '--pictfile=file : Write matrix to file (.eps,.gif etc)'
+        self._usage2()
+
+    def procopts(self,opts):
+        "Process the additional non-standard options"
+        for o,a in opts:
+            if (o=='--folder'):
+                self.foldername=str(a)
+            elif (o=='--summ'):
+                self.summ=True
+            elif (o=='--graphics'):
+                self.graphics=True
+                self.summ=True
+            elif (o=='--pictfile'):
+                self.pictfile=str(a)
+                self.graphics=True
+                self.summ=True
+
+    def execute(self):
+        # find folder name from timestamp options
+        if (self.foldername==''):
+            folder=DetStatusLib.folderName(self.runLumi)
+        else:
+            folder=self.foldername
+        # setup channel object
+        (chanlist,chansel)=self.getChannels(self.dets)
+        if (self.summ):
+            # prepare for summary - get number of LBs in each folder
+            lumiblocks=self.getLBs()
+            runlist=lumiblocks.keys()
+            runlist.sort()
+            lbtot=0
+            lboffset={}
+            for run in runlist:
+                lb=lumiblocks[run]
+                lboffset[run]=lbtot
+                lbtot+=lb
+            statusbychan={}
+            chanindex={}
+            index=0
+            for chan in chanlist:
+                # statusbychan gives [nBLACK,nUNKNOWN,nRED,nYELLOW,nGREEN]
+                statusbychan[chan]=[0,0,0,0,0]
+                chanindex[chan]=index
+                index+=1
+            if (self.graphics):
+                hist,canvas=self.initGraphics(len(chanlist),lbtot)
+        print ">== Reading status from folder %s tag %s" % (folder,self.tag)
+        try:
+            cfolder=self.db.getFolder(folder)
+            tag=self.tag
+            if (tag=="HEAD"): tag=""
+            objs=cfolder.browseObjects(self.since,self.until,chansel,tag)
+            while objs.goToNext():
+                obj=objs.currentRef()
+                chan=obj.channelId()
+                if chan not in chanlist: continue
+                name=self.namelookup.name(obj.channelId())
+                since=obj.since()
+                until=obj.until()
+                sincerun=since >> 32
+                untilrun=until >> 32
+                payload=obj.payload()
+                code=payload['Code']
+                if (code>=0): code=code & 3
+                deadFrac=payload['deadFrac']
+                deadThrust=payload['Thrust']
+                if (self.summ):
+                    # increment the counts of all appropriate runs
+                    for (run,lbn) in lumiblocks.iteritems():
+                        # slice represents IOV of LBs in this run
+                        startslice=1+(run<<32)
+                        endslice=1+(run<<32)+lbn
+                        comstart=max(startslice,since)
+                        comend=min(endslice,until)
+                        nlb=comend-comstart
+                        if nlb>0:
+                            #print "Overlap %i LB for db [%i %i] [%i %i] in run %i with %i LB status %i %i" % (nlb,since >> 32, since & 0xFFFFFFFF, until >> 32, until & 0xFFFFFFFF, run,lbn,code,chan)
+                            ((statusbychan[chan])[code+1])+=nlb
+                            if (self.graphics):
+                                for i in range(0,nlb):
+                                    ixfill=i+lboffset[run]+(comstart & 0xFFFFFFFF)
+                                    
+                                    hist.Fill(chanindex[chan]+1,ixfill,[7,4,41,30,45][code+1])
+                else:
+                    # printout data
+                    print name,":",
+                    if (self.runLumi):
+                        print '[',(since >> 32),',',(since % (1 << 32) ),'] - [',(until >> 32),',',(until % (1 << 32) ),' ]',
+                    else:
+                        print '{',AtlCoolLib.timeString(since),',',AtlCoolLib.timeString(until),'} ',
+                    print '%s %5.3f %5.3f' % (DetStatusLib.colour(code),deadFrac,deadThrust),
+                    if ('Comment' in payload.keys()):
+                        print payload['Comment'],
+                    if ('NConfig' in payload.keys()):
+                        print "(%i/%i)" % (payload['NConfig'],payload['NWorking']),
+                    print
+        except Exception,e:
+            print e
+            print 'Problem accessing COOL data'
+            sys.exit(1)
+        # produce summary if required
+        if (self.summ):
+            print ">=== Status flags for runs %i to %i with total of %i LBs\n>=== Folder %s tag %s" % (self.runmin,self.runmax,lbtot,self.foldername,self.tag)
+            print "Chan Flag  NMiss (frac) NBlck (frac) NUnkn (frac) NRed  (frac) NYlw  (frac) NGrn  (frac)"
+            for chan in chanlist:
+                counters=statusbychan[chan]
+                cfrac=5*[0]
+                nmiss=lbtot
+                for i in range(0,5):
+                    cfrac[i]=float(counters[i])/float(lbtot)
+                    nmiss-=counters[i]
+                print "%i %6s %6i %5.3f %6i %5.3f %6i %5.3f %6i %5.3f %6i %5.3f %6i %5.3f" % (chan,self.namelookup.name(chan),nmiss,float(nmiss)/float(lbtot),counters[0],cfrac[0],counters[1],cfrac[1],counters[2],cfrac[2],counters[3],cfrac[3],counters[4],cfrac[4])
+        if (self.graphics):
+            hist.Draw("COL")
+            self.addAxis(canvas,chanindex,chanlist,runlist,lboffset,lbtot)
+            canvas.Update()
+            if (self.pictfile!=""):
+                print "Writing picture to %s" % self.pictfile
+                canvas.Print(self.pictfile)
+            raw_input("Press return to remove canvas when done")
+            
+    def getLBs(self):
+        "Get the number of lumiblocks in each run, using the LBLB folder"
+        lbdata={}
+        tdaqdbname='COOLONL_TRIGGER/COMP200'
+        tdaqdb=AtlCoolLib.indirectOpen(tdaqdbname,True,True)
+        if tdaqdb is None:
+            print "ERROR - cannot access %s for run/LB mapping lookup" % tdaqdbname
+        try:
+            lbfolder=tdaqdb.getFolder('/TRIGGER/LUMI/LBLB')
+            objs=lbfolder.browseObjects(self.since,self.until,cool.ChannelSelection(0))
+            oldrun=0
+            maxlb=0
+            while objs.goToNext():
+                obj=objs.currentRef()
+                iovsince=obj.since()
+                run=int(iovsince >> 32)
+                lb=int(iovsince & 0xFFFFFFFF)
+                if (run!=oldrun):
+                    if oldrun!=0:
+                        lbdata[oldrun]=maxlb
+                    maxlb=0
+                    oldrun=run
+                if lb>maxlb: maxlb=lb
+            if oldrun!=0: lbdata[oldrun]=maxlb
+            
+        except Exception,e:
+            print e
+            print "ERROR accessing data for run/LB mapping"
+        return lbdata
+
+    def getChannels(self,dets):
+        "Return a list of the channels to be selected, and COOL selector"
+        # COOL selector may give more channels
+        chanlist=[]
+        for det in dets:
+            updet=det.upper()
+            if updet in ['ALL','A']:
+                chanlist+=self.namelookup.allNums()
+            else:
+                chanlist+=self.namelookup.nums(updet)
+        chanlist.sort()
+        chansel=cool.ChannelSelection(min(chanlist),max(chanlist))
+        return (chanlist,chansel)
+
+    def initGraphics(self,ndet,nlb):
+        "Initialise graphics and setup histogram for status matrix"
+        from ROOT import gROOT,TCanvas,TH2F,gStyle
+        hist=TH2F("DetectorStatus","%s tag %s runs %i to %i (%i LBs)" % (self.foldername,self.tag,self.runmin,self.runmax,nlb),ndet+1,0.5,ndet+1.5,nlb,0.5,nlb+0.5)
+        hist.Fill(ndet+1,1,49.)
+        hist.SetNdivisions(0)
+        gROOT.SetStyle("Plain")
+        gStyle.SetPalette(0)
+        gStyle.SetOptStat(0)
+        gStyle.SetOptFit(0)
+        canvas=TCanvas(self.foldername,self.foldername,0,0,500,600)
+        return (hist,canvas)
+    
+    def addAxis(self,canvas,chanindex,chanlist,runlist,lboffset,lbtot):
+        from ROOT import TLatex
+        txt=TLatex()
+        txt.SetNDC()
+        txt.SetTextAngle(90.)
+        txt.SetTextSize(0.012)
+        for chan in chanlist:
+            txt.DrawLatex(0.11+0.8*float(chanindex[chan])/(len(chanindex)+1),0.06,self.namelookup.name(chan))
+        txt.SetTextAngle(0.)
+        txt.SetTextSize(0.02)
+        ndiv=1+len(lboffset)/20
+        j=0
+        for run in runlist:
+            lb=lboffset[run]
+            j+=1
+            if (j==ndiv):
+                txt.DrawLatex(0.91,0.11+0.8*float(lb)/lbtot,str(run))
+                j=0
+        
+            
+        
+mytool=queryStatus('detStatus_query.py',True,3,99,['summ','graphics','folder=','pictfile='])
+
+
+        
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/index_cm.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/index_cm.py
new file mode 100755
index 00000000000..74fd5a92388
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/index_cm.py
@@ -0,0 +1,513 @@
+#!/usr/bin/env python2.5
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+print 'Content-type: text/html;charset=utf-8\n'
+
+########################################################################
+import os,re,time,sys,cgi,string,math
+import cgitb; cgitb.enable()
+import sqlite3
+import xmlrpclib
+global server
+#server = xmlrpclib.ServerProxy('http://atlasdqm.cern.ch')
+
+passfile = open("/afs/cern.ch/user/l/larmon/public/atlasdqmpass.txt")
+passwd = passfile.read().strip(); passfile.close()  
+passurl = 'https://%s@atlasdqm.cern.ch' % passwd
+server = xmlrpclib.ServerProxy(passurl)
+
+from threading import Thread
+dbfile = 'LArBad.db'
+global cursor
+global conn
+
+global info
+global beambkg
+global opts
+global expert
+global run_spec
+global esproc
+global bulkproc
+global reproc
+global cleanesproc
+global cleanbulkproc
+global lce_inputfile
+global cluster_threshold
+global includenotready
+global ladies
+global isexpress
+global pass_letter
+global cluster_E
+
+global DCSGET  
+
+global defects
+
+DCSGET={};
+
+defects = [];hvdefects = []
+
+global Sides
+Sides = []
+global Times
+Times = [time.time()]
+Duplicated = [];Clusters = []
+Clusters_found = 200*[0]
+ClusterTypes = ['EMTopoClusters','CaloTopoClusters']
+ 
+global multicall
+multicall = xmlrpclib.MultiCall( server )
+
+# set defaults
+isexpress =False
+info = False
+beambkg = False
+includenotready = False
+ladies = False
+expert = 10
+opts = {}
+run_spec = {}
+the_url = 'https://atlas-larmon.cern.ch/WebDisplayExtractor/index.py?'
+esproc=1;bulkproc=2;reproc=3;
+cleanesproc=101;cleanbulkproc=102;
+cluster_threshold = 50;
+cluster_E = 'Et>10GeV'
+
+global rawchannels
+global calocells
+global sporadic
+global larcellempty
+global clusters
+
+c = cgi.FieldStorage()
+########################print c
+for i in c.keys():
+  v = c.getvalue(i)
+  if i=='info': info = int(v)
+  elif i=='ladies': ladies = int(v)
+  elif i=='beambkg': beambkg = True
+  elif i=='expert': expert = 14
+  elif i=='rawchannels': rawchannels = True
+  elif i=='calocells': calocells = True
+  elif i=='sporadic': sporadic = True
+  elif i=='larcellempty': larcellempty = True
+  elif i=='clusters': clusters = True
+  elif i in ['DET','AC','SAM']: opts[i] = v
+  elif i=='cluster_threshold': cluster_threshold = int(v)
+  elif i=='includenotready': includenotready = True
+  elif i=='cluster_E': cluster_E = v
+  else: run_spec[i] = v
+  the_url += i+'='+v+'&'
+  lce_inputfile="LCE/BadCellList_run%s.txt"%run_spec['low_run']
+
+########################################################################################
+print '''
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>LAr WebDisplay Extractor</title>
+<meta name="author" content="Mathieu Plamondon [Mathieu.Plamondon@cern.ch]"/>
+<link rel="icon" type="image/vnd.microsoft.icon" href="../favicon.ico" />
+<link rel="Stylesheet" href="styles.css" type="text/css" />
+<script type="text/javascript" src="scripts_ref.js"></script>
+<base target="_blank">
+</head>
+<body>
+<div class="wrapper"><br />
+<a href="https://atlasop.cern.ch/atlas-point1/twiki/bin/view/Main/LArWebDisplayExtractor" style="color:#000000;font-size:20pt;font-weight:bold" title="click to access the twiki">LAr WebDisplay Extractor <font color=red>Version 3.12</font>  </a>'''
+#print '<font style="color:#FF0000">WARNING: Stuff might break unexpectedly... Development and tests in progress</font><br>'
+#<img src="twiki.gif" style="width:50px" alt="twiki"/></a><br />
+
+#########################################################################################
+
+if not 'rawchannels' in dir() and not 'calocells' in dir() and not 'sporadic' in dir() and not 'larcellempty' in dir() and not 'clusters' in dir(): 
+  rawchannels = True
+  calocells = True
+  sporadic = True
+  larcellempty = True
+  clusters = True
+else:
+  if not 'rawchannels' in dir(): rawchannels = False
+  if not 'calocells' in dir(): calocells = False
+  if not 'sporadic' in dir(): sporadic = False
+  if not 'larcellempty' in dir(): larcellempty = False
+  if not 'clusters' in dir(): clusters = False
+
+the_url = the_url.rstrip('?').rstrip('&')
+if not run_spec.has_key('proc_ver'): run_spec['proc_ver'] = 1
+else:  run_spec['proc_ver'] = int(run_spec['proc_ver']) 
+if run_spec.has_key('stream'):
+  if run_spec['stream']=='express': run_spec['stream']='express_express'
+  else: run_spec['stream'] = 'physics_'+run_spec['stream']
+else: run_spec['stream'] = 'physics_CosmicCalo'
+if not run_spec.has_key('source'): run_spec['source'] = 'tier0'
+
+if run_spec.has_key('low_run'):
+  run_spec['high_run'] = run_spec['low_run']
+  multicall.get_runs_streams(run_spec)
+  results = multicall()
+  if len(results[0])==0:
+    print "<h3><font color=red>&#8224 RUN '%s' DOES NOT EXIST</font></h3>"%(run_spec['low_run'])
+    sys.exit()
+
+
+
+if info == 0:  #RunReport
+  if ladies == 1 :  #ladies-bulk
+    run_spec['stream'] = 'physics_JetTauEtmiss'
+    run_spec['proc_ver'] = 1
+    isexpress = False
+    run_spec['source'] = 'tier0'
+    pass_letter = 'f'
+    if run_spec.has_key('low_run'):
+      run_info = server.get_run_information(run_spec)
+      run_tag  = run_info[run_spec['low_run']]
+      run_tag_string = run_tag[1]
+      if 'data13' in run_tag_string:
+        run_spec['stream'] = 'physics_HardProbes'
+  
+  elif ladies == 0:  #ladies-express
+    run_spec['stream']='express_express'
+    run_spec['proc_ver'] = 1
+    isexpress = True
+    run_spec['source'] = 'tier0'
+    pass_letter = 'x'
+
+  #expert options
+  elif ladies == 2:
+    isexpress = True
+    pass_letter = 'x'
+  else:
+    isexpress = False
+    pass_letter = 'f'
+    
+  #else:
+  #  if run_spec['stream'] == 'physics_CosmicCalo':
+  #    if  run_spec['proc_ver'] == 1: isexpress = True
+  #    #elif run_spec['proc_ver'] == 2: isexpress = True
+  #    else: isexpress = False
+  #  elif run_spec['stream'] == 'express_express':
+  #    if  run_spec['proc_ver'] == 1: isexpress = True
+  #    else: isexpress = False
+  #  else:  isexpress = False
+      
+    
+else:  #NoisyCells
+  if ladies == 1 : #ladies-bulk
+    run_spec['stream'] = 'physics_CosmicCalo'
+    run_spec['proc_ver'] = 102
+    isexpress = False
+    run_spec['source'] = 'test'
+    pass_letter ='f'
+    multicall.get_runs_streams(run_spec)
+    results = multicall()
+    if len(results[0])==0:
+        run_spec['proc_ver'] = 1
+        run_spec['source'] = 'tier0'
+        print "<font color=red>You are using the basic tier0 output. If more than 10-20 UPD3 channels are proposed, you should perform a cleaning to confirm this diagnostic.</font>"
+
+      
+  
+  elif ladies == 0: #ladies-express
+    run_spec['stream']='physics_CosmicCalo'
+    run_spec['proc_ver'] = 111
+    isexpress = True
+    run_spec['source'] = 'larcomm'
+    pass_letter = 'x'
+    multicall.get_runs_streams(run_spec)
+    results = multicall()
+    if len(results[0])==0:
+      run_spec['proc_ver'] = 101
+      run_spec['source'] = 'test'
+      multicall.get_runs_streams(run_spec)
+      results = multicall()
+      if len(results[0])==0:
+        run_spec['proc_ver'] = 1
+        run_spec['source'] = 'tier0'
+ 
+
+  #expert options
+  elif ladies == 2:
+    isexpress = True
+    pass_letter = 'x'
+  else:
+    isexpress = False
+    pass_letter ='f'
+
+if run_spec.has_key('low_run') and run_spec['proc_ver'] == 1:
+  mapping = server.get_procpass_amitag_mapping(run_spec)
+  Proc_ver = []
+  run_list = mapping[run_spec['low_run']]
+  for i,item in enumerate(run_list):
+    #    print item,"<br>"
+    check_tag = False
+    for f,field in enumerate(item):
+      if f == 0:
+        proc = field
+      if f == 1:
+        if field == run_spec['stream']:
+          check_tag = True
+      if (f == 2 and check_tag == True):
+        tag = field[:1]
+        if tag == pass_letter: Proc_ver.append(proc)        
+  #print Proc_ver,"<br>"
+  if not Proc_ver :
+    print "<h3><font color=red>&#8224 BULK FOR RUN '%s' NOT YET FINISHED</font></h3>"%(run_spec['low_run'])
+    sys.exit()
+  else: run_spec['proc_ver'] = max(Proc_ver)
+
+    
+
+#if not opts.has_key('shifter'): opts['shifter'] = 'shifter'
+f0 = os.stat(dbfile)
+f1 = os.stat('index.py')  
+
+
+########################################################################
+class dcs(Thread):
+  def __init__(self):
+    Thread.__init__(self)
+
+  def run(self):
+
+    athena_version = "17.2.6"
+    import subprocess as sp
+    cmd="export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup;"
+    cmd+="source $AtlasSetup/scripts/asetup.sh %s,32,here;"%(athena_version)
+    cmd+='detStatus_query.py --folder /GLOBAL/DETSTATUS/DCSOFL --r=%s "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_GLOBAL;dbname=COMP200;user=ATLAS_COOL_READER;password=COOLRED4PRO" HEAD EM HEC FCAL;'%(run_spec['low_run'])
+    P = sp.Popen(cmd,shell=True,stdout=sp.PIPE,stderr=sp.PIPE)
+    self.DCSflags = P.communicate()
+
+
+########################################################################
+# i[12:16] = [[-3s,+3s,LB,Sat.Q],[Eth,5s,DB,Q],[E>20,LB,Q],[<E>,E>1,LB,Q],DR]
+# R[0:4] = [[-3s,+3s,LB,Sat.Q],[Eth,5s,DB,Q],[E>20,LB,Q],[<E>,E>1,LB,Q],DR]
+########################################################################
+
+#proposed_flag
+#import prop_flag
+
+#print top 
+import print_top
+
+#print rows
+#import print_rows
+
+#Print Selection
+#Add report button
+import selection
+
+#Listify
+#RunReport
+import run_report
+
+#noisycells
+import noisycells
+
+########################################################################
+def ShowPlots():
+  size = 300 
+  if len(Sides)>1: size = 250 
+  print '<div id="plots">\n'
+  print '<br />\n'
+  for i in ClusterTypes:
+    if info==1: print "<br><b>",i,"</b><br>"
+    for j in Sides:
+      if i == "EMTopoClusters":
+        if cluster_E == 'Et>5GeV': tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_EMclus_etaphi_Et_thresh1@JJJ'.replace('III',i).replace('JJJ',j)
+        elif cluster_E == 'E>5GeV': tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_EMclus_EtavsPhi1@JJJ'.replace('III',i).replace('JJJ',j)
+        elif cluster_E == 'E>10GeV': tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_EMclus_EtavsPhi2@JJJ'.replace('III',i).replace('JJJ',j)
+        else: tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_EMclus_etaphi_Et_thresh2@JJJ'.replace('III',i).replace('JJJ',j)
+      if i == "CaloTopoClusters":
+        if cluster_E == 'Et>5GeV': tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_clus_etaphi_Et_thresh1@JJJ'.replace('III',i).replace('JJJ',j)
+        elif cluster_E == 'E>5GeV': tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_EtavsPhi1@JJJ'.replace('III',i).replace('JJJ',j)
+        elif cluster_E == 'E>10GeV': tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_EtavsPhi2@JJJ'.replace('III',i).replace('JJJ',j)
+        else: tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_clus_etaphi_Et_thresh2@JJJ'.replace('III',i).replace('JJJ',j)
+        #tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_clus_etaphi_Et_thresh2@JJJ'.replace('III',i).replace('JJJ',j)
+      print ('<a href="AA"><img style="width:%dpx" src="AA.png" /></a>\n'%(size)).replace('AA',tmp_url)
+    if len(Sides)>1: print '<br />'                                                                                             
+  print '<br />\n</div>\n'
+   
+#########################################################################################
+#print '''
+#<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+#<html xmlns="http://www.w3.org/1999/xhtml">
+#<head>
+#<title>LAr WebDisplay Extractor</title>
+#<meta name="author" content="Mathieu Plamondon [Mathieu.Plamondon@cern.ch]"/>
+#<link rel="icon" type="image/vnd.microsoft.icon" href="../favicon.ico" />
+#<link rel="Stylesheet" href="styles.css" type="text/css" />
+#<script type="text/javascript" src="scripts_dev.js"></script>
+#<base target="_blank">
+#</head>
+#<body>
+#<div class="wrapper"><br />
+#<a href="https://atlasop.cern.ch/atlas-point1/twiki/bin/view/Main/LArWebDisplayExtractor" style="color:#000000;font-size:20pt;font-weight:bold" title="click to access the twiki">LAr WebDisplay Extractor <font color=red>Version 3.8</font>  </a>'''
+##print '<font style="color:#FF0000">WARNING: Stuff might break unexpectedly... Development and tests in progress</font><br>'
+##<img src="twiki.gif" style="width:50px" alt="twiki"/></a><br />
+#########################################################################################
+
+
+#if ladies == 1 and not run_spec['proc_ver'] == 102 :
+    #procpass = server.get_next_proc_pass(run_spec['low_run'],run_spec['stream'],'tier0')
+    #print procpass
+    #proc_ver = procpass-1
+    #run_spec['proc_ver'] = proc_ver 
+
+selection.PrintSelection(run_spec,info,cluster_threshold,beambkg,expert,includenotready,ladies,cluster_E)
+
+if run_spec.has_key('low_run'):
+  import sqlite3
+  conn = sqlite3.connect('LArId.db')
+  cursor = conn.cursor()
+
+  run_string = (run_spec['low_run']).strip(); run_spec['low_run'] = run_string
+
+  # first line of upload defect text file
+  defects.append("@%s"%run_spec['low_run'])
+
+  #if run_spec['proc_ver'] == 1: defects.append("LAR_FIRSTDEFECTS_UNCHECKED G # Express processing defects uploaded")
+  if isexpress: defects.append("LAR_FIRSTDEFECTS_UNCHECKED G # Express processing defects uploaded")
+
+  # set web display links
+  global url
+  url = 'https://atlasdqm.cern.ch/webdisplay/%s/%d/%s/run_%s/run/' % (run_spec['source'],run_spec['proc_ver'],run_spec['stream'],run_spec['low_run'])
+
+  if not run_spec.has_key('high_run'):# or info!=0: 
+    run_spec['high_run'] = run_spec['low_run']
+    #multicall.get_runs_streams(run_spec)
+      
+    #results = multicall()
+    #if len(results[0])==0:
+    #  print "<h3><font color=red>&#8224 RUN '%s' DOES NOT EXIST</font></h3>"%(run_spec['low_run'])
+    #  sys.exit()
+
+    _stream = run_spec['stream']
+    for i in results[0][run_spec['low_run']]: 
+      if _stream in i: _stream=i   
+    if 'tmp_' in _stream:
+      url = url.replace(run_spec['stream'],_stream) 
+      run_spec['stream'] = _stream
+      print "<font color=red>WARNING</font>: <b>DO NOT FILL the DEFECT DB YET</b>. The processing of this run is still ongoing. You will get partal info. Some LBs might be missing.<br><br>"
+  ## Display info depending on the menu:
+  ## 0: Run Report
+  ## 1: Noisy LAr Cells
+  try:
+    ## Run Report Menu
+    if info==0:
+      
+      print '</form>\n'
+      
+      DataIntegrityProblem = ['Parity','BCID','Sample Header','EVTID','SCAC status','SCA out of range','Gain mismatch','Type mismatch','# of samples','Empty data block','Checksum/block size','Missing header','Bad gain']
+      ## Retrieve RED LBs from DCS
+      DCS = dcs()
+      DCS.start()
+      DCS.join()
+      d = DCS.DCSflags[0].replace('\n','<br>')
+      # if RED, store partition and affected LBs
+      # EMBA : [ 174693 , 1 ] - [ 174693 , 19 ]
+      RE = re.compile(r'(?P<PART>\S+)\s*\:\s*\[\s*(?P<RUN1>\S+)\s*\,\s*(?P<LB1>\S+)\s*\]\s*\-\s*\[\s*(?P<RUN2>\S+)\s*\,\s*(?P<LB2>\S+)\s*\]')
+      test = d.split('HEAD')[1].split(')')
+      for item in test:
+        if not 'RED' in item: continue
+        st = item.split('RED')[0].replace('<br>','')
+        m = RE.search(st).groupdict()
+        for lb in range(int(m['LB1']),int(m['LB2'])):
+          if DCSGET.has_key(m['PART']): DCSGET[m['PART']].append(lb)
+          else: DCSGET[m['PART']] = [lb]
+   
+
+      #print DCSGET
+      #print "Mark 2 <br>"
+      #print m['PART']
+      #get_dqmf_summary_flags_lb(run_spec, PART, COMP200_DCS, HEAD)
+
+      ## Link to HV Trips DB & DCS
+      #print "DQ flags from DCS automatically retrieved"
+      #print '<input type="button" value="Check DCS flags" onclick=DCSQuery(%s) />'%(run_spec['low_run'])
+      #print '<input type="button" value="Check HV Trips DB" onclick="HVTripsDB()"/>'
+
+      Part = ['EMBA','EMBC','EMECA','EMECC','HECA','HECC','FCALA','FCALC']
+      for P in Part:
+        new_dcs = server.get_dqmf_summary_flags_lb(run_spec,P,"DCSOFL","HEAD")
+      
+
+      ## Now get run report
+      print '<br><table class="report">\n'
+
+      run_report.RunReport(run_spec,multicall,url,DCSGET,defects,includenotready,esproc,cleanesproc,bulkproc,cleanbulkproc,isexpress)
+ 
+      print '</table>\n'
+
+      # Finally, add report button
+      selection.AddReportButton(defects,run_spec,info,beambkg)
+
+    ## Noisy LAr Cells Menu
+    else:
+      run_spec['high_run'] = run_spec['low_run']
+      #print "<font color=red><h3>Warning: DQ checks based on TopoClusters only !</h3></font><br>"
+      
+      clusters=True
+      print '<table class="list">\n' 
+      print_top.PrintFields(expert)
+      print_top.PrintTopRow(expert,opts,rawchannels,calocells,sporadic,larcellempty,clusters)
+      noisycells.NoisyLArCells(run_spec,opts,Sides,rawchannels,calocells,sporadic,larcellempty,clusters,Clusters,Duplicated,cluster_threshold,Clusters_found,lce_inputfile,expert,cursor,url,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,beambkg,isexpress,cluster_E)
+      print '</table>\n</form>\n'
+      # Add report button
+      selection.AddReportButton(defects,run_spec,info,beambkg)
+
+      
+  except ValueError:
+    print 'ValueError:',ValueError
+  except:
+    print 'Unexpected error:', sys.exc_info()
+    print '<br />Problem encountered: a bug report has been sent<br />'
+    #os.system('echo "%s\n%s" | mail -s "WebExtractor problem" christopher.marino@cern.ch' % (the_url,sys.exc_info()))
+    
+  ShowPlots()
+  conn.close()
+else:
+  print '<table class="list">\n' 
+  print_top.PrintFields(expert)
+  print_top.PrintTopRow(expert,opts,rawchannels,calocells,sporadic,larcellempty,clusters)
+  print '</table>\n</form>\n'
+
+## here is the section to print non-matched clusters
+Times.append(time.time())
+print '<div id="help" style="background:#CCCCCC">\n'
+if clusters and info!=0:
+  #print '<br>Non-matched clusters:<hr><pre>'
+  first = 1
+  for cl in range(len(Clusters)):
+    CL = Clusters[cl]
+    if Clusters_found[cl]==0:
+      type = CL[3].split("/")[3].split("Topo")[0]
+      if type=="EM" or CL[3].split('@')[1] != "BAR":
+        if first: print '<br>Non-matched clusters:<hr><pre>';first=0;
+        print '%s %s <a href="%s/%s" class="det2">%s</a> Nentries:%i'%(type,CL[3].split('@')[1],url,CL[3],CL[4],CL[5])
+  print '</pre>'
+  # And here, print duplicated clusters
+  if len(Duplicated)>0:
+    print 'Duplicated clusters:<hr><pre>'
+    for cl in  range(len(Duplicated)):
+      CL = Duplicated[cl]
+      type = CL[3].split("/")[3].split("Topo")[0]
+      print '%s %s <a href="%s/%s" class="det2">%s</a> Nentries:%i'%(type,CL[3].split('@')[1],url,CL[3],CL[4],CL[5])
+    print '</pre>'
+      
+## Footer
+print '''</div>
+<div class="push"></div>
+</div>
+<div class="footer">
+<hr>
+%6.1f seconds (total time) <a href="%s">Link to this query</a>, <a href="https://atlas-larmon.cern.ch/WebDisplayExtractor/logs/">logs server</a><br />
+Developer: <a href="mailto:Mathieu.Plamondon@cern.ch">Mathieu Plamondon</a>&nbsp;
+DQ contacts: <a href="mailto:trocme@lpsc.in2p3.fr,christopher.marino@cern.ch">Benjamin Trocm&eacute;, Christopher Marino &nbsp;<br></a>
+Last updates: DB file (%s), <a href="https://svnweb.cern.ch/trac/atlasusr/browser/mplamond/projects/LArIdtranslator/trunk/www" >script file</a> (%s)<br>
+<br />
+</div>
+</body>
+</html>''' % (Times[-1]-Times[0],the_url,time.ctime(f0.st_ctime),time.ctime(f1.st_ctime))
+
+#if info: os.system('echo "%s" | mail -s "LArWebExtractor query %s" Mathieu.Plamondon@cern.ch' % (the_url,os.environ['HTTP_X_FORWARDED_FOR']))
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/noisycells.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/noisycells.py
new file mode 100644
index 00000000000..64de331282d
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/noisycells.py
@@ -0,0 +1,627 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+DETlist = ['EMB','EMEC','HEC','FCAL']
+dbfile = 'LArBad.db'
+from threading import Thread
+import sqlite3
+import os,re,time,sys,cgi,string,math
+import xmlrpclib
+
+passfile = open("/afs/cern.ch/user/l/larmon/public/atlasdqmpass.txt")
+passwd = passfile.read().strip(); passfile.close()  
+passurl = 'https://%s@atlasdqm.cern.ch' % passwd
+server = xmlrpclib.ServerProxy(passurl)
+
+global Parts
+Parts = []
+
+import print_rows
+import print_top
+
+ACmap = {1:'A+','1':'A+','A+':'A+',-1:'C-','-1':'C-','C-':'C-'}
+ACmap2 = {'A':1,'C':-1}
+inv_ACmap2 = {1:'A+','1':'A+','A+':'A+',-1:'C-','-1':'C-','C-':'C-'}
+dd=[0.,0.,0.,0.]
+## CaloCell bins variations to match real cells: [EMB[sampling],EMEC[sampling],HEC[sampling],FCAL[sampling]]
+de=[[0.01,0.001,0.005,0.01],[0.01,0.001,0.01,0.01],[0.001,0.001,0.001,0.001],[0.,0.02,0.1,0.1]]
+dp=[[0.01,0.003,0.005,0.02],[0.01,0.005,0.01,0.01],[0.05,0.05,0.05,0.05],[0.,0.05,0.03,0.02]]
+cols = ['OFF_ID','ONL_ID','DET','AC','FT','SL','CH','SAM','ETA','PHI','HVLINES','HVCORR','CL','TT_COOL_ID']
+
+ClusterTypes = ['EMTopoClusters','CaloTopoClusters']
+BadChannels = ['deadReadout','deadCalib','deadPhys','almostDead','short','unstable','distorted','lowNoiseHG','highNoiseHG','unstableNoiseHG','lowNoiseMG','highNoiseMG','unstableNoiseMG','lowNoiseLG','highNoiseLG','unstableNoiseLG','missingFEB','peculiarCL','problematicFor?','sporadicBurstNoise']
+
+########################################################################
+mp = ['noise_acceptance_AVG','acceptance_AVG','signal_AVG','quality_AVG','fractionOverQ','DB','5Sigma','hiEth','Quality','ENLB','EN','Warning','Error','Cluster','LCE0','LCE1','LCE2','LCE3']
+# 0:GREEN 1:RED 2:BLUE 3:PINK 4:YELLOW 5:BLACK  
+col = [1,0,2,3,3,2,1,0,3,2,1,4,1,5,0,1,2,3]
+def GetClass(plot):
+  for a in range(18):
+    if mp[a] in plot:
+     return col[a]
+
+
+########################################################################
+def get_id(c):
+  a = 7<<27
+  be=0
+  if c[0]>0: be=1
+  a |= be<<25
+  ac=0
+  if c[1]>0: ac=1
+  a |= ac<<24
+  a |= c[2]<<19
+  a |= (c[3]-1)<<15
+  a |= c[4]<<8
+  return a
+
+
+########################################################################
+class db(Thread):
+  def __init__(self,cmd,plot,par,V):
+    Thread.__init__(self)
+    self.cmd = cmd
+    self.plot = plot
+    self.par = par
+    self.V = V
+  def run(self):
+    con = sqlite3.connect('LArId.db')
+    cur = con.cursor()
+    cur.execute(self.cmd)
+    self.R = cur.fetchall()
+    con.close()
+
+########################################################################
+class mc2(Thread):
+  def __init__(self):
+    Thread.__init__(self)
+    self.multicall = xmlrpclib.MultiCall( server )
+  def run(self):
+    self.results = self.multicall()
+########################################################################
+class mc3(Thread):
+  def __init__(self,P,run_spec):
+    Thread.__init__(self)
+    self.multicall = xmlrpclib.MultiCall( server )
+    self.P = P
+    self.run_spec = run_spec
+  def run(self):
+    self.results = self.multicall()
+    ##print "DEBUG - mc3 - 1:",self.P,len(self.multicall._MultiCall__call_list),time.time(),"<br>"  
+    ##print "DEBUG - mc3 - 2:",self.multicall._MultiCall__call_list,"<br>" 
+    ##print "DEBUG - mc3 - 3:",self.results,"<br>" 
+    N = self.run_spec['low_run']
+    H = self.results[0][N]['hists']
+    calls = []
+    i=0
+    for h in H:
+      ##print "DEBUG", h,"<br>"
+      if not 'Sl' in h: continue
+      if i%50==0: calls.append( mc2() )
+      calls[-1].multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Noise/Single_Cells/Non_Gaussian_Tails/'+h)
+      i+=1
+
+    self.h2p = []
+    for c in calls: c.start()
+    for c in calls:
+      c.join()
+      for i,I in enumerate(c.multicall._MultiCall__call_list):
+        plot = I[1][-1].split('/')[-1]
+        self.h2p.append( [plot,c.results[i][N]] )
+
+
+########################################################################
+class GetLArCellEmpty(Thread):
+  def __init__(self,cluster_threshold,lce_inputfile):
+    Thread.__init__(self)
+    self.cluster_threshold = cluster_threshold
+    self.lce_inputfile = lce_inputfile
+  def run(self):
+
+    self.Chans = {}
+    f = open(self.lce_inputfile,"r")
+    for line in f:
+      fields=string.split(line)
+      
+      if fields[0]=='onlid':continue
+      # skip cells found only with algo 1
+      algo=int(fields[11])
+
+      if algo == 1: continue
+      # retrieve all cells
+      onlid = fields[0]
+      part=fields[1][0:-2]
+      side=fields[1][-1]
+      FT=int(fields[2])
+      SL=int(fields[3])
+      CH=int(fields[4])
+      evt=int(fields[6])
+      emean=float(fields[7])
+      lb=float(fields[8])
+      qf=float(fields[9])
+      lblist=fields[11].split(";")
+      comment="LB:"
+      for item in lblist:comment+=" %s"%item
+     
+      d=DETlist.index(part)
+      id = get_id((d,ACmap2[side],FT,SL,CH))
+      # store the channels
+      # cut to match the cluster threshold
+      if evt < self.cluster_threshold: continue
+      # now store the channel
+      if not self.Chans.has_key(id): self.Chans[id] = [ [],[],[],[] ]
+      self.Chans[id][0].append([int(emean),'&lt;E&gt;GeV','LCE0'])
+      self.Chans[id][1].append([evt,'Nevts&gt;1GeV','LCE1'])
+      self.Chans[id][2].append([int(lb),comment,'LCE2'])
+      self.Chans[id][3].append([int(qf*100),'%qfac&gt;4000','LCE3'])
+       
+########################################################################
+class GetRawChannels(Thread):
+  def __init__(self,run_spec,Parts):
+    Thread.__init__(self)
+    self.run_spec = run_spec
+    self.Parts = Parts
+  def run(self):
+
+    RE = re.compile(r'\S*\((?P<SSLN>\S+)\.0*\)\s*y-axis\s*\((?P<CH>\S+)\.0*\)\S+')
+    N = self.run_spec['low_run']
+    calls = []
+    Plots = ['acceptance_AVG','noise_acceptance_AVG','signal_AVG','quality_AVG']
+    for P in self.Parts:
+      calls.append( mc2() )
+      for p in Plots: calls[-1].multicall.get_dqmf_all_results(self.run_spec,'LAr/'+P+'/Noise/Single_Cells/'+P+'_'+p)
+      calls[-1].start()
+
+    self.Chans = {}
+    #print "DEBUG %i <br>"%(len(calls))
+    for c in calls:
+      c.join()
+      for i,I in enumerate(c.multicall._MultiCall__call_list):
+        plot = I[1][-1]
+        part = plot.split('/')[1]
+        d = DETlist.index(part[:-1])
+        for p,P in enumerate(Plots): 
+          if P in plot: pi=p; break
+        r = c.results[i][N]
+        K = r.keys()
+        for k in K:
+          if not 'x-axis' in k: continue
+          m = RE.search(k).groupdict()
+          SSLN = int(m['SSLN'])
+          if d: FT = (SSLN-1)/15; SL = SSLN-FT*15
+          else: FT = (SSLN-1)/14; SL = SSLN-FT*14
+          CH = int(m['CH'])
+          id = get_id((d,ACmap2[part[-1]],FT,SL,CH))
+          if not self.Chans.has_key(id): self.Chans[id] = [ [],[],[],[] ]
+          if 'noise_acceptance' in plot: self.Chans[id][1].append( [r[k],k,plot] )
+          elif 'acceptance' in plot:  self.Chans[id][0].append( [r[k],k,plot] )
+          elif 'signal' in plot: self.Chans[id][2].append( [r[k],k,plot] )
+          elif 'quality' in plot: self.Chans[id][3].append( [r[k],k,plot] )
+
+########################################################################
+class GetClusters(Thread):
+  def __init__(self,run_spec,Sides,Clusters,Duplicated,cluster_threshold,cluster_E):
+    Thread.__init__(self)
+    self.run_spec = run_spec
+    self.Sides = Sides
+    self.Clusters = Clusters
+    self.Duplicated = Duplicated
+    self.cluster_threshold = cluster_threshold
+    self.cluster_E = cluster_E
+  def run(self):
+
+    # Distance cells/clusters; 
+    DR_match = 0.2;
+    # Decoding the DQ bin output
+    RE = re.compile(r'(?P<cat>\S+)-\(eta,phi\)\[OSRatio\]=\((?P<eta>\S+),(?P<phi>\S+)\)\[(?P<sigma>\S+)\]')
+    N = self.run_spec['low_run']
+    multicall = xmlrpclib.MultiCall( server )
+
+    print "<br> Energy setting",self.cluster_E
+
+    for j in self.Sides:
+      for i in ClusterTypes:
+        if i=='EMTopoClusters':
+          if self.cluster_E == 'E>5GeV': multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_EMclus_EtavsPhi1@%s' % (j,i,j,j) )
+          elif self.cluster_E == 'E>10GeV': multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_EMclus_EtavsPhi2@%s' % (j,i,j,j) )
+          elif self.cluster_E == 'Et>5GeV': multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_EMclus_etaphi_Et_thresh1@%s' % (j,i,j,j) )
+          else: multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_EMclus_etaphi_Et_thresh2@%s' % (j,i,j,j) )
+        if i=='CaloTopoClusters':
+          if self.cluster_E == 'E>5GeV': multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_EtavsPhi1@%s' % (j,i,j,j) )
+          elif self.cluster_E == 'E>10GeV': multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_EtavsPhi2@%s' % (j,i,j,j) )
+          elif self.cluster_E == 'Et>5GeV': multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_clus_etaphi_Et_thresh1@%s' % (j,i,j,j) )
+          else: multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_clus_etaphi_Et_thresh2@%s' % (j,i,j,j) )
+          #multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_clus_etaphi_Et_thresh2@%s' % (j,i,j,j) )
+    
+    #print "DEBUG - clusters :",len(multicall._MultiCall__call_list),time.time(),"<br>"
+    R = multicall()
+
+    for i,I in enumerate(multicall._MultiCall__call_list):
+      r = R[i][N]
+      K = r.keys()
+      #print "DEBUG",r,K,"<br>"
+      for k in K:
+        if k[0] == "Y" or k[0] == "R":
+          # select clusters above threshold
+          #print "DEBUG",k,r[k],"<br>"
+          if int(r[k])<self.cluster_threshold: continue
+          m = RE.search(k).groupdict()
+          # Clusters can be both in EC and BARREL plots. Avoid double counting.
+          is_duplicate = False
+          for cl in self.Clusters:
+            #print "DEBUG CLUSTERS",cl[4],k,"<br>"
+            if k.split("=")[1] == cl[4].split("=")[1]: is_duplicate = True
+          if is_duplicate:
+            self.Duplicated.append( [float(m['eta']),float(m['phi']),DR_match,I[1][-1],k,int(r[k])] )
+          else:
+            self.Clusters.append( [float(m['eta']),float(m['phi']),DR_match,I[1][-1],k,int(r[k])] )
+            
+########################################################################
+class GetCaloCells(Thread):
+  def __init__(self,run_spec,Parts):
+    Thread.__init__(self)
+    self.run_spec = run_spec
+    self.Parts = Parts
+  def run(self):
+
+    N = self.run_spec['low_run'] 
+    RE = re.compile(r'.*=\((?P<eta>\S+),(?P<phi>\S+)\).*')
+    RE1 = re.compile(r'(?P<cat>\S+)-\(eta,phi\)\[OSRatio\]=\((?P<eta>\S+),(?P<phi>\S+)\)\[(?P<sigma>\S+)\]')
+    RE2 = re.compile(r'x-axis\s*\S*\((?P<eta>\S+)\)\s*y-axis\s*\((?P<phi>\S+)\)\)')
+    S  = {0:'P',1:'1',2:'2',3:'3'}
+    Si = {'r':0,'0':0,'1':1,'2':2,'3':3}
+    calls = []
+
+    for P in self.Parts:
+      d = DETlist.index(P[:-1])
+      calls.append( mc2() )
+      plot = 'LAr/'+P+'/Noise/Single_Cells/'
+      for s in range(4):
+        sam = 'Sampling'+str(s)
+        s2 = S[s]
+        if s==0:
+          if d==3: continue
+          if d==2: s2='0'
+          else: sam='Presampler'
+  
+        # change in plot name after run 182161
+        suffix='_hiEth'
+        comment1='Nevts&gt;Eth'
+        comment2='%qfac>4000(E&gt;Eth)'
+        if int(self.run_spec['low_run']) < 182161:
+          suffix='_4Sigma'
+          comment1='%evts&gt;4&#963'
+          comment2='%qfac>4000(E&gt;4&#963)'
+ 
+        calls[-1].multicall.get_dqmf_all_results(self.run_spec,plot+'%s/fractionOverQthVsEtaPhi_%s'%(sam,P[:-1]+s2+P[-1])+suffix )
+        calls[-1].multicall.get_dqmf_all_results(self.run_spec,plot+'%s/EnergyRMSvsDB_%s_noEth'%(sam,P[:-1]+s2+P[-1]) )
+        calls[-1].multicall.get_dqmf_all_results(self.run_spec,plot+'%s/CellOccupancyVsEtaPhi_%s_hiEth'%(sam,P[:-1]+s2+P[-1]) )
+        calls[-1].multicall.get_dqmf_all_results(self.run_spec,plot+'%s/CellOccupancyVsEtaPhi_%s_5Sigma'%(sam,P[:-1]+s2+P[-1]) )
+                    
+      calls[-1].start()
+
+    DB = []
+
+
+    for p,P in enumerate(self.Parts):
+      c = calls[p] 
+      c.join()
+      d = DETlist.index(P[:-1])
+      AC = P[-1]
+      for i,I in enumerate(c.multicall._MultiCall__call_list):
+        plot = I[1][-1]
+        sam = Si[plot.split('/')[4][-1]] 
+        par = (d,AC,sam)      
+        V = [] 
+        cmd = 'select ONL_ID,ETA,PHI from LARID where DET=%d and AC=%d and SAM=%d and (' % (d,ACmap2[AC],sam)
+        r = c.results[i][N]
+        K = r.keys()
+        yellow_bins = 0
+        red_bins = 0
+        bad_cells = 0
+   
+        #print "DEBUG     --->",K,"<br>"
+        for k in K:
+          #print k, r[k],"<br>"
+          if 'NRedBins' in k:
+            red_bins = r[k]
+            bad_cells += red_bins
+            continue
+          elif 'NYellowBins' in k:
+            yellow_bins = r[k]
+            bad_cells += yellow_bins
+            continue
+          elif 'NBins' in k: 
+            continue
+          #elif 'eta' in k:
+          elif 'OSRatio' in k:  
+            m = RE.search(k).groupdict()
+          elif 'axis' in k: 
+            m = RE2.search(k).groupdict()
+          else:
+            continue  
+          if 'CellOccupancy' in plot and r[k]<50:
+            bad_cells -= 1
+            continue              
+          elif 'DB' in plot and r[k]<2000:
+            bad_cells -= 1
+            continue
+        
+          eta = float(m['eta'])
+          if d==1 and sam in [1,2]: eta+=0.0005
+          phi = float(m['phi'])
+          if AC=='A': phi-=dd[sam]
+          else:       phi+=dd[sam] 
+          limits = (eta-de[d][sam],eta+de[d][sam],phi-dp[d][sam],phi+dp[d][sam])
+          V.append([limits,r[k],k])
+          cmd += '(ETA between %f and %f and PHI between %f and %f) or ' % limits
+          #print P[:-1]+AC,sam,k,r[k],"<br>"
+          
+        #if 'CellOccupancy' in plot and bad_cells != 0:
+        #  print "<br>", plot, "<br>"
+        #  print "Bad:", bad_cells, "<br>"
+        #  print len(V), "<br>"
+        if ('CellOccupancy' in plot or 'DB' in plot) and len(V) != bad_cells:
+          print "<br> WARNING!  there is a discrepancy between the number of red and yellow bins (",int(bad_cells),") and the cells downloaded to be examined (",len(V),") for the plot:", plot
+          
+        # this I am not sure what it does yet
+        if 'or' in cmd:
+          DB.append( db(cmd.rstrip(' or ')+')',plot,par,V) )
+          DB[-1].start()
+
+      
+    self.Chans = {}
+    for s in DB:
+      s.join()
+      for r in s.R:
+        id = r[0]
+        com = []
+        for v in s.V:
+          if r[1]>v[0][0] and r[1]<v[0][1]:
+            if r[2]>v[0][2] and r[2]<v[0][3]: com.append([v[1],v[2]]) 
+        if not self.Chans.has_key(id): self.Chans[id] = [[],[],[],[]]
+        for a in com:
+          if 'CellOccupancy' in s.plot:
+            if 'hiEth' in s.plot:
+              self.Chans[id][0].append( [a[0],comment1,s.plot] )
+            if '5S' in s.plot:
+              self.Chans[id][1].append( [a[0],'Nevts&gt;5&#963;',s.plot] )
+          if 'DB' in s.plot:
+            self.Chans[id][2].append( [a[0],'DB noise deviation',s.plot] )
+          if 'Qth' in s.plot:
+            self.Chans[id][3].append( [a[0]*100,comment2,s.plot] )
+ 
+########################################################################
+class GetSporadic(Thread):
+  def __init__(self,run_spec,Parts):
+    Thread.__init__(self)
+    self.run_spec = run_spec
+    self.Parts = Parts
+  def run(self):
+
+    N = self.run_spec['low_run'] 
+    RE0 = re.compile(r'FT(?P<FT>\S+)Sl(?P<SL>\S+)Ch(?P<CH>\S+)')
+    RE1 = re.compile(r'\((?P<LB>\S+)\.0*\)')
+    calls = []
+    for P in self.Parts:
+      calls.append( mc3(P,self.run_spec) )
+      calls[-1].multicall.get_dqmf_sub_assessments(self.run_spec,'LAr/'+P+'/Noise/Single_Cells/Non_Gaussian_Tails')
+      calls[-1].start()
+
+    self.Chans = {}
+    LBs = {}
+
+    for p,P in enumerate(self.Parts):
+      calls[p].join()
+      plot = 'LAr/'+P+'/Noise/Single_Cells/Non_Gaussian_Tails/'
+      for h in calls[p].h2p:
+        m = RE0.search(h[0].split('_')[0]).groupdict()
+        SL = int(m['SL'])
+        FT = int(m['FT'])
+        CH = int(m['CH'])
+        d = DETlist.index(P[:-1])
+        id = get_id((d,ACmap2[P[-1]],FT,SL,CH))
+        dev = 0.
+        if h[1].has_key('SideBands'):
+       
+          if 'EN' in plot+h[0]:
+            title = "E>5-15GeV"
+          else:
+            title = "Qfac>4000"            
+          dev = float(h[1]['SideBands'])
+          if str(dev)=='nan': dev=-0.01
+        elif h[1].has_key('NBins'): 
+          title = 'LB: '
+          dev = int(h[1]['NBins'])
+          LB = []
+          for lb in h[1].keys():
+            if 'NBins' in lb: continue
+            m = RE1.search(lb).groupdict()
+            LB.append( int(m['LB']) )
+            title+=m['LB']+' '
+          LBs[id] = LB
+        if not self.Chans.has_key(id): self.Chans[id] = [ [],[],[] ]
+        if 'ENLB' in h[0]: self.Chans[id][1].append( [dev,title,plot+h[0]] )
+        elif 'EN' in h[0]: self.Chans[id][0].append( [dev,title,plot+h[0]] )
+        else: self.Chans[id][2].append( [100*dev,title,plot+h[0]] )
+
+    """
+    f = file('reports/%s.txt'%(N),'r')
+    while not 'Remove' in f.readline(): pass
+    removed_LBs = []
+    b = f.readline().split()
+    for i in b:
+      if '-' in i:
+        a = i.split('-')
+        for j in range(int(a[0]),int(a[1])+1): removed_LBs.append( int(j) )
+      else: removed_LBs.append( int(i) )
+
+    from copy import copy
+    for id in LBs.keys():
+      LB = LBs[id]
+      LB.sort()
+      LB1 = copy(LB)
+      #for lb in LBs[id]:
+      #  if lb in removed_LBs: LB1.remove(lb)
+      #if len(LB1)==0: self.Chans.pop(id) 
+      #else:
+      for ch in self.Chans[id]: ch.append(str(LB1))
+    """          
+
+########################################################################
+def NoisyLArCells(run_spec,opts,Sides,rawchannels,calocells,sporadic,larcellempty,clusters,Clusters,Duplicated,cluster_threshold,Clusters_found,lce_inputfile,expert,cursor,url,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,beambkg,isexpress,cluster_E):
+
+ 
+  # Queries 
+  DETs = range(4)
+  if opts.has_key('DET'):
+    if clusters: 
+      if int(opts['DET'])==0: DETs = [0]
+      else: DETs = [1,2,3]
+    else: DETs = [int(opts['DET'])]
+  sides = ['A','C']
+  if opts.has_key('AC'): 
+    if clusters and 0 in DETs: pass
+    else: sides = [ACmap[opts['AC']][0]]
+
+  lce_exists = True
+  lce_message = False
+  try:open(lce_inputfile)
+  except IOError:
+    print '<h3><font color=red>WARNING:  LArCellEmpty file not found!'
+    lce_exists = False
+    lce_message = True
+  if lce_exists:  
+    size = os.path.getsize(lce_inputfile)
+    if (size < 1000):
+      print '<h3><font color=red>WARNING:  LArCellEmpty file is very small!'
+      lce_message = True
+  if not larcellempty:
+    print '<h3><font color=red>WARNING:  LArCellEmpty channels were not retrieved!'
+    lce_message = True
+  if lce_message and (not isexpress): print 'This is however not problematic for the bulk, as this output is not used for flagging proposal.</font></h3>'
+  else: print '</font></h3>'
+
+  for d in DETs:    
+    for AC in sides:      
+      Parts.append( DETlist[d]+AC )      
+  if 'EMECC' in Parts or 'HECC' in Parts or 'FCALC' in Parts: Sides.append('ECC')
+  if 'EMBA'  in Parts or 'EMBC' in Parts: Sides.append('BAR')
+  if 'EMECA' in Parts or 'HECA' in Parts or 'FCALA' in Parts: Sides.append('ECA')
+
+  # fetch DQ results
+  jobs = [0,0,0,0]
+  if rawchannels: raw = GetRawChannels(run_spec,Parts); raw.start(); jobs[0] = raw
+  if calocells: calo = GetCaloCells(run_spec,Parts); calo.start(); jobs[1] = calo
+  if sporadic: spo = GetSporadic(run_spec,Parts); spo.start(); jobs[2] = spo
+  if larcellempty: lce = GetLArCellEmpty(cluster_threshold,lce_inputfile); lce.start();jobs[3] = lce
+  if clusters: clus = GetClusters(run_spec,Sides,Clusters,Duplicated,cluster_threshold,cluster_E); clus.start()
+
+
+  # fetch badchannels
+  Bad = [{},{},{},{}]
+  run = int(run_spec['low_run'])
+  if run>0:
+    b_conn = sqlite3.connect(dbfile)
+    b_cursor = b_conn.cursor()
+    for u,upd in enumerate(['1','4']):
+      for b,bad in enumerate(['BadChannels','MissingFEBs']):
+        b_cursor.execute('select status from %s where %d>=since and %d<=until'%(bad+'UPD'+upd,run,run))
+        for d in b_cursor.fetchall(): Bad[2*u+b].update(eval(str(d[0])))
+    b_conn.close()
+
+  # Get results
+  R = []
+  Chans = set([])
+  for i,j in enumerate(jobs):
+ 
+    if j==0: continue
+    j.join()
+    try: j.Chans.keys()
+    except:
+      print '<h3><font color=red> Histograms are not found.  Please verify that the plots in the webdisplay exist. </font></h3>'
+      sys.exit()
+    C = j.Chans.keys()
+    for ch in C:Chans.add(ch)
+
+  R1 = []
+  if len(Chans)>0:
+    cmd = 'select '+','.join(cols[:expert])+',FEB_ID from LARID where ONL_ID in ('    
+    for ch in Chans: cmd += '%d,'%(ch)   
+    cursor.execute(cmd.rstrip(',')+')')   
+    R1 = cursor.fetchall()
+ 
+  R2 = []
+  for r in R1:
+    id = r[1]
+    feb_id = r[-1]
+    upd1=[0,0] 
+    if Bad[0].has_key(id): upd1[0] = Bad[0][id] 
+    if Bad[1].has_key(feb_id): upd1[1] = Bad[1][feb_id]
+    upd4=[0,0] 
+    if Bad[2].has_key(id): upd4[0] = Bad[2][id] 
+    if Bad[3].has_key(feb_id): upd4[1] = Bad[3][feb_id]
+    i = list(r[:-1])+[ upd1,upd4, [[],[],[],[]] , [[],[],[],[]] , [[],[],[]] ,[[],[],[],[]] ,-1 ]
+    for j,J in enumerate(jobs):
+      if J:
+        if J.Chans.has_key(id):
+          i[expert+2+j] = J.Chans[id]
+          #print "JL DEBUG",j,J,id,i,"<br><br>"
+    R2.append(i)
+
+  if not clusters:
+    print_rows.PrintRows(beambkg,clusters,url,run_spec,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,expert,R2)
+
+  else:
+
+    clus.join()
+    from math import pi,sqrt
+    R_used = len(R2)*[0]
+
+    for cl in Clusters:
+      R3 = []
+     
+      clusterType=cl[3].split("/")[3].split("Topo")[0]
+      for i in R2:
+        eta = i[8]
+        phi = i[9]
+        det = i[2]
+        sampling = i[7]
+       
+        #print "  DEBUG Cells",clusterType,i[1],i[2],i[3],i[7],"<br>"
+        #print "DEBUG CLUSTERS",cl,"<br>"
+        ##### WARNING: issue with EMTopo
+        #: use CaloTopo Only ##### 
+        #if clusterType=="EM":continue
+        ##### Match EM clusters with EMB,EMEC cells #####
+        ##### Match TopoClusters with HEC,FCAL cells #####
+        if clusterType=="EM" and not(det==0 or det ==1):continue
+        if clusterType=="Calo" and not(det==2 or det==3):continue
+       
+        if i[3]>0: phi-=dd[i[7]]
+        else:      phi+=dd[i[7]]
+        deta = abs( eta-cl[0] )
+        dphi = abs( phi-cl[1] )
+        if dphi>2*pi: dphi-=2*pi
+        dR = sqrt(deta*deta+dphi*dphi)
+       
+        if dR<cl[2]:
+          Clusters_found[ Clusters.index(cl) ] += 1
+          R_used[ R2.index(i) ] += 1
+          i[-1] = dR
+          R3.append(i)
+ 
+      if cl[4][0] == "Y":Class = GetClass("Warning")
+      if cl[4][0] == "R":Class = GetClass("Error")
+
+      if len(R3)>0:
+        print '<tr><td colspan="%d"><font style="color:#FFFFFF">%s</font>&nbsp;:&nbsp;<a class="det%d" href="%s/%s">%s &nbsp; %d</a></td></tr>' % (expert+7,cl[4],Class,url,cl[3],cl[3].split('Clusters')[0].split("/")[3],cl[5])
+
+        print_rows.PrintRows(beambkg,clusters,url,run_spec,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,expert,R3)
+
+    print_top.PrintFields(expert)
+    R4 = []
+
+    for i in range(len(R2)): 
+      if R_used[i]==0: R4.append( R2[i] )
+    print_rows.PrintRows(beambkg,clusters,url,run_spec,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,expert,R4)
+
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/print_rows.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/print_rows.py
new file mode 100644
index 00000000000..8a779ebd08d
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/print_rows.py
@@ -0,0 +1,320 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+ACmap = {1:'A+','1':'A+','A+':'A+',-1:'C-','-1':'C-','C-':'C-'}
+BadChannels = ['deadReadout','deadCalib','deadPhys','almostDead','short','unstable','distorted','lowNoiseHG','highNoiseHG','unstableNoiseHG','lowNoiseMG','highNoiseMG','unstableNoiseMG','lowNoiseLG','highNoiseLG','unstableNoiseLG','missingFEB','peculiarCL','problematicFor?','sporadicBurstNoise']
+BadFEBs = {0:'deadAllBit',1:'deadReadoutBit',2:'inErrorBit',3:'deactivatedInOKSBit',16:'maskParity',17:'maskBCID',18:'maskSampleHeader',19:'maskEVTID',20:'maskScacStatus',21:'maskScaOutOfRange',22:'maskGainMismatch',23:'maskTypeMismatch',24:'maskNumOfSamples',25:'maskEmptyDataBlock',26:'maskDspBlockSize',27:'maskCheckSum',28:'maskMissingHeader',29:'maskBadGain'}
+DETlist = ['EMB','EMEC','HEC','FCAL']
+global CHANNELS
+CHANNELS={}
+import string,math
+
+########################################################################
+mp = ['noise_acceptance_AVG','acceptance_AVG','signal_AVG','quality_AVG','fractionOverQ','DB','5Sigma','hiEth','Quality','ENLB','EN','Warning','Error','Cluster','LCE0','LCE1','LCE2','LCE3']
+# 0:GREEN 1:RED 2:BLUE 3:PINK 4:YELLOW 5:BLACK  
+col = [1,0,2,3,3,2,1,0,3,2,1,4,1,5,0,1,2,3]
+def GetClass(plot):
+  for a in range(18):
+    if mp[a] in plot:
+     return col[a]
+
+
+########################################################################
+def BeamBackground(phicell,beambkg):
+  if not beambkg:
+    return False
+  else:
+    dphi = 0.25
+    if abs(phicell) < dphi: return True
+    if abs(phicell-math.pi)< dphi*2: return True
+    if abs(phicell+math.pi)< dphi*2: return True
+    return False
+    
+
+##########################################################################
+def ProposedFlag(beambkg,run_spec,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,expert,r):
+
+  ## Check if a cell has DB status different from noisy
+  ECAL_flag = -1
+  for k in [expert,expert+1]:   
+    if r[k][0]&(0x7927F)!=0x0: ECAL_flag = 1
+  
+  ## Check if cell already flagged in UPD4
+  ## Sporadic: bit 19 (0x80000)
+  ## HighNoise: bit 8 (0x100)
+  UPD4_flag = -1
+  for k in [expert,expert+1]:   
+    if r[k][0]&(0x80000)!=0x0: UPD4_flag = 1
+    if r[k][0]&(0x100)!=0x0: UPD4_flag = 1
+
+  ## Check if it's bulk or not
+  IsBulk = -1
+  if (run_spec['proc_ver'] == bulkproc or run_spec['proc_ver'] == cleanbulkproc or run_spec['proc_ver'] == reproc): IsBulk = 1
+  if run_spec['proc_ver'] == 103: IsBulk =1
+
+  ## Get cluster matched variable
+  dR = r[-1]
+
+  ## Store results of each DQ test
+  R = [ [-1,-1,-1,-1] , [-1,-1,-1,-1] , [-1,-1,-1] , [-1,-1,-1,-1] ]
+  for i in range(4):
+    for j in range(len(R[i])):
+      if len(r[i+expert+2][j])>0: R[i][j] = r[i+expert+2][j][0][0]
+      
+  ## change flag by clicking on a cell
+  flag = '<td onclick="ToggleFlag(this)" '
+
+  ###################################
+  ## Automatic diagnosis for Cells ##
+  ###################################
+
+  sporadic_threshold = 50
+  sporadic_threshold_lce = 500
+  
+  ### Set flags for noisy cells associated to clusters
+  if dR>0:
+    ## check CaloCells column
+    if R[1][0]>0 and R[1][1]>0:
+
+      if R[1][3]>0:
+        qfclean= R[1][0]-(R[1][0]*R[1][3])/100
+
+        if qfclean < sporadic_threshold:
+
+          if not BeamBackground(float(r[9]),beambkg): # Mask beam background only for sporadic cells
+            flag += 'style="background-color:#FF6600">sporadicBurstNoise'
+          else:
+            #flag += 'style="background-color:#009900">BeamBkg'
+            flag += 'style="background-color:#FF6600">sporadicBurstNoise'
+        else:
+          flag += 'style="background-color:#FF0000">highNoiseHG'
+      else:
+        flag += 'style="background-color:#FF0000">highNoiseHG' 
+
+    ## check Sporadic column
+    elif R[2][0]>0:
+
+      if R[2][2]>0:
+        qfclean= R[2][0]-(R[2][0]*R[2][2])/100
+        if qfclean < sporadic_threshold:
+          if not BeamBackground(float(r[9]),beambkg): # Mask beam background only for sporadic cells
+            flag += 'style="background-color:#FF6600">sporadicBurstNoise'
+          else:
+            flag += 'style="background-color:#009900">BeamBkg'             
+        else:
+          flag += 'style="background-color:#FF0000">highNoiseHG'
+      else:
+        flag += 'style="background-color:#FF0000">highNoiseHG'
+    ## check flag from LArCellEmpty column
+    ## (ES) or (bulk if not already flagged in UPD4)
+    elif (R[3][1]>0 and IsBulk<0) or (R[3][1]>0 and IsBulk>0 and UPD4_flag<0):
+
+      if BeamBackground(float(r[9]),beambkg): # Mask beam background for all cells
+        flag += 'style="background-color:#009900">BeamBkg'             
+      else:
+        if R[3][3]>0:
+          qfclean= R[3][1]-(R[3][1]*R[3][3])/100
+          if qfclean < sporadic_threshold_lce:
+            flag += 'style="background-color:#78c7c7">sporadicBurstNoise'
+          else:
+            flag += 'style="background-color:#307D7E">highNoiseHG'
+        else:
+          flag += 'style="background-color:#307D7E">highNoiseHG'
+
+
+   ##############################################################      
+   ### Set flags for some cells even if not responsible for clusters        
+  else:
+    ##check CaloCell column
+    if R[1][0]>100:
+    #if R[1][0]>50:    
+      if BeamBackground(float(r[9]),beambkg):
+        flag += 'style="background-color:#009900">BeamBkg'
+      else:
+        if R[1][3]>0:
+          if R[1][3]>0.8:
+            flag += 'style="background-color:#FF6600">sporadicBurstNoise'
+          else:   
+            flag += 'style="background-color:#FF0000">highNoiseHG'
+        else:
+          flag += 'style="background-color:#FF0000">highNoiseHG'
+    
+    ## check Sporadic column
+    elif R[2][0]>0:
+      if R[2][2]>0:
+        qfclean= R[2][0]-(R[2][0]*R[2][2])/100
+        if qfclean < sporadic_threshold*10:
+          if not BeamBackground(float(r[9]),beambkg):
+            flag += 'style="background-color:#FF6600">sporadicBurstNoise'
+          else:
+            flag += 'style="background-color:#009900">BeamBkg'                                 
+        else:
+          flag += 'style="background-color:#FF0000">highNoiseHG'
+      else:
+        flag += 'style="background-color:#FF0000">highNoiseHG'
+    ## check flag from LArCellEmpty column
+    ## (ES) or (bulk if not already flagged in UPD4)
+    elif (R[3][0]>3 and IsBulk<0): #or (R[3][0]>3 and IsBulk>0 and UPD4_flag<0):      
+      if BeamBackground(float(r[9]),beambkg):
+        flag += 'style="background-color:#009900">BeamBkg'                     
+      else:
+        if R[3][3]>0:
+          qfclean= R[3][1]-(R[3][1]*R[3][3])/100
+          if qfclean < sporadic_threshold_lce*10:
+            flag += 'style="background-color:#78c7c7">sporadicBurstNoise'
+          else:
+            flag += 'style="background-color:#307D7E">highNoiseHG'
+        else:
+          flag += 'style="background-color:#307D7E">highNoiseHG'
+        #ignore LCE only at bulk level    
+        #if R[3][3]>0:
+        #  qfclean= R[3][1]-(R[3][1]*R[3][3])/100
+        #  if qfclean < sporadic_threshold_lce*10:
+        #    flag += 'style="background-color:#78c7c7">LCEonly'
+        #  else:
+        #    flag += 'style="background-color:#307D7E">LCEonly'
+        #else:
+        #  flag += 'style="background-color:#307D7E">LCEonly'
+    ##elif R[3][0]>0:
+    ## print "DEBUG: Channel %s %s not associated to cluster, in LCE file, not put on the display
+    ##Average Energy=%.2f <br>"%(str(hex(r[0])),str(hex(r[1])),R[3][0])
+    # Set warnings for cell already known or with high deviations
+    elif (R[1][0]>0 and R[1][1]>0) or (R[0][0]>0 and R[0][1]>0):
+      flag += 'style="background-color:#FFFF00">Warning:ECAL'
+    ## Look for pedestal shifts
+    elif abs(R[0][2])>0:
+      ped_threshold = 25 # EM Barrel and EMEC OW
+      if r[2]==1 and (r[4]==3 or r[4]==10 or r[4]==16 or r[4]== 22): ped_threshold = 100 # EMEC IW FT=3/10/16/22
+      if r[2]==2: ped_threshold = 300 # HEC
+      if r[2]==3: ped_threshold = 500 # FCAL
+      if abs(R[0][2])>ped_threshold:
+        flag += 'style="background-color:#FFFFCC">PedShift:ECAL'
+
+  if  'BeamBkg' in flag:
+    if R[1][0]>100:
+      if R[1][3]>0:
+        if R[1][3]>0.8:
+          flag = '<td onclick="ToggleFlag(this)"style="background-color:#FF6600">sporadicBurstNoise'
+        else:   
+          flag = '<td onclick="ToggleFlag(this)"style="background-color:#FF0000">highNoiseHG'
+      else:
+        flag = '<td onclick="ToggleFlag(this)"style="background-color:#FF0000">highNoiseHG'
+    
+          
+  ### Overwrite flags in case of beam background
+  #if beambkg:
+  #  #if 'sporadicBurstNoise' in flag or 'highNoiseHG' in flag:
+  #  if 'sporadicBurstNoise' in flag:
+  #    dphi = 0.25
+  #    phicell = float(r[9])
+  #    if abs(phicell) < dphi or abs(phicell-math.pi)<dphi or abs(phicell+math.pi)<dphi:
+  #      flag = '<td onclick="ToggleFlag(this)" style="background-color:#009900">BeamBkg'          
+  #      # print "debug phi = %f <br>"%phicell
+    
+  ### Keep only Sporadic and HighNoiseHG to fill defects
+  if 'sporadicBurstNoise' in flag or 'highNoiseHG' in flag:
+    part = DETlist[r[2]]+ACmap[r[3]][:-1]
+    if CHANNELS.has_key(part):
+      is_duplicate=False
+      for ch in CHANNELS[part]:
+        if str(r[0]) in ch: is_duplicate= True
+      if not is_duplicate:
+        CHANNELS[part].append("(%i,%.2f,%.2f)"%(r[0],r[8],r[9]))
+        #print "DEBUG",part,r[0],r[8],r[9],"<br>"
+    else: CHANNELS[part] = ["(%i,%.2f,%.2f)"%(r[0],r[8],r[9])]
+  ### end
+  if not 'style' in flag: flag+='>'
+  return flag+'</td>'
+
+
+#######################################################################################################################
+def PrintRows(beambkg,clusters,url,run_spec,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,expert,channels=[]):
+  import operator
+  SortedChannels = sorted(channels,key=operator.itemgetter(2,3,4,5,6,7))
+  nRows = 0
+
+  for i in SortedChannels:
+    ## Store results of each DQ test (RawChannels/CaloCells/Sporadic/LArCellEmpty)
+    ## i[12:15] = [[-3s,+3s,E,Sat.Q],[>Eth,>5s,DB,Sat.Q],[E>20,ENLB,Sat.Q],[<E>,E>1,LB,Sat.Q]]
+    ## R[0:4] = [[-3s,+3s,E,Sat.Q],[>Eth,>5s,DB,Sat.Q],E>20,[E>20,ENLB,Sat.Q],[<E>,E>1,LB,Sat.Q]]
+    R = [ [-1,-1,-1,-1] , [-1,-1,-1,-1] , [-1,-1,-1], [-1,-1,-1,-1] ]
+    for index in range(4):
+      for j in range(len(i[index+12])):
+        if len(i[index+12][j])>0:
+          R[index][j] = i[index+12][j][0][0]
+          #print "index,j,i[index+12][j],i[index+12][j][0][0],'<br>'
+
+    ## Check if QFactor is filled:
+    if R[0][3]>0 or R[1][3]>0 or R[2][2]>0:
+      ## if nothing filled but Q factor, skip the channel
+      mysum = 0
+      mysum += R[0][0]+R[0][1]+R[0][2]
+      mysum += R[1][0]+R[1][1]+R[1][2]
+      mysum += R[2][0]+R[2][1]
+      mysum += R[3][0]+R[3][1]+R[3][2]
+      if mysum == -11: continue
+
+    ## Check if only LCE is filled in BULK. Skip if already flagged in UPD4      
+    if run_spec['proc_ver']==bulkproc or run_spec['proc_ver']==cleanbulkproc or run_spec['proc_ver']==reproc :
+      ## sum results of the last column. If empty, result is -4
+
+      mysum=0
+      for index in range(3):
+        for j in range(len(R[index])):
+          mysum+=R[index][j]
+      ## Check UPD4 status
+      ## Sporadic: bit 19 (0x80000)
+      ## HighNoise: bit 8 (0x100)
+      LCE_flag = -1
+      for k in [expert,expert+1]:   
+        if i[k][0]&(0x80000)!=0x0: LCE_flag = 1
+        if i[k][0]&(0x100)!=0x0: LCE_flag = 1
+      if (LCE_flag > 0) and (mysum==-11): 
+        #print 'DEBUG: skipping channel %s %i %i<br>'%(str(hex(i[0])),mysum,LCE_flag)
+        continue
+
+    ## And now print all the remaining channels
+    out = '<tr class="out%d" title="%d">\n'%(nRows%2,nRows)
+    out += '<td>'+str(hex(i[0]))+'</td>\n<td>'+str(hex(i[1]))+'</td>\n'
+    out += '<td style="text-align:right">'+DETlist[i[2]]+'</td><td style="text-align:left">'+ACmap[i[3]]+'</td>\n'
+    for j in i[4:8]: out += '<td>'+str(j)+'</td>\n'
+    for j in i[8:10]: out += '<td>%.4f</td>\n' % (j)
+    if expert>10:
+      out += '<td>%s</td>\n' % (i[10])
+      out += '<td>%.3f</td>\n' % (i[11])
+      out += '<td>%s</td>\n' % (i[12])
+      out += '<td>'+str(hex(i[13])).rstrip('L')+'</td>\n'
+    for k in [expert,expert+1]:
+      status=''
+      if i[k][0]!=0:
+        for j in range(20):
+          if i[k][0]&(1<<j)!=0x0: status += BadChannels[j]+' '
+      if i[k][1]!=0:
+        for j in BadFEBs.keys():
+          if i[k][1]&(1<<j)!=0x0: status += BadFEBs[j]+' '
+      out += '<td style="width:70px">'+status.rstrip(' ')+'</td>\n'
+ 
+    for j in range(4):
+      K = i[expert+2+j]
+      out += '<td>' 
+      for k in K:
+        if len(k)>0:
+          k.sort()
+          k.reverse()
+          for g in k:
+            if 'LCE' in g[2]: 
+              lce_url='https://atlas-larmon.cern.ch/WebDisplayExtractor/LCE/Plots/%s_EnergyCut_Algo0.png'%run_spec['low_run']
+              out+='<a class="det%d" href="%s" title="%s">%d</a>&nbsp;' % (GetClass(g[2]),lce_url,g[1],g[0]) 
+            #elif 'hiEth' in g[2]:
+            #  out+='<a class="det%d" href="%s/%s" title="%s">%.2f</a>&nbsp;' % (GetClass(g[2]),url,g[2],g[1],g[0])
+            else:
+              out+='<a class="det%d" href="%s/%s" title="%s">%.0f</a>&nbsp;' % (GetClass(g[2]),url,g[2],g[1],g[0]) 
+      out += '</td>\n'
+    dR = i[-1]
+    if dR>0: out += '<td>%.3f</td>\n' % (dR) 
+    else: out += '<td></td>\n'
+    if clusters: out += ProposedFlag(beambkg,run_spec,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,expert,i)
+    else: out += '<td></td>\n'
+
+    nRows += 1
+    print out+'</tr>\n'
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/print_top.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/print_top.py
new file mode 100644
index 00000000000..ae8d4040717
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/print_top.py
@@ -0,0 +1,69 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+cols = ['OFF_ID','ONL_ID','DET','AC','FT','SL','CH','SAM','ETA','PHI','HVLINES','HVCORR','CL','TT_COOL_ID']
+DETlist = ['EMB','EMEC','HEC','FCAL']
+
+########################################################################
+def PrintFields(expert):
+  out = '<tr>\n'
+  for i in cols[:expert]+['STATUSUPD1','STATUSUPD4','RawChannels','CaloCells','Sporadic','LArCellEmpty','Clusters','Proposed Flag']: out += '<td>'+i+'</td>\n'
+  print out+'</tr>\n'
+
+
+########################################################################
+def PrintTopRow(expert,opts, rawchannels,calocells,sporadic,larcellempty,clusters):
+  colsWidths = {'OFF_ID':6,'ONL_ID':6,'DET':1,'AC':1,'FT':2,'SL':2,'CH':2,'SAM':1,'ETA':4,'PHI':4,'STATUSUPD1':6,'STATUSUPD4':6,'HVLINES':7,'HVCORR':5,'CL':2,'TT_COOL_ID':6}
+
+  out = '<tr>\n'
+  
+  for i in cols[:expert]+['STATUSUPD1','STATUSUPD4']:
+    selected = False
+    if opts.has_key(i): selected = opts[i]
+
+    out += '<td style="width:%dpx;">' % (10*colsWidths[i])
+    if i=='DET':
+      out += '<select name="DET" value="">\n'
+      out += ' <option value=""></option>\n'
+      for d in range(4):
+        out += ' <option value="%d" ' % (d)
+        if str(d)==selected: out += ' selected'
+        out += '>'+DETlist[d]+'</option>\n'
+      out += '</select>'
+    elif i=='AC':
+      out += '<select name="AC" value="">\n'
+      for ac in [['',''],['A+','1'],['C-','-1']]:
+        if ac[1]==selected: out += ' <option value="'+ac[1]+'" selected>'+ac[0]+'</option>\n'
+        else:               out += ' <option value="'+ac[1]+'">'+ac[0]+'</option>\n'
+      out += '</select>'
+    else:
+      out += '&nbsp;'
+    out += '</td>\n'
+
+  out +='<td>'
+  for i,j in enumerate(['&gt;3&#963','&lt;-3&#963','&lt;E&gt','Sat.Q']):out += '<a class="det%d">%s</a>\n' % (i,j)
+  out += '<input type="checkbox" name="rawchannels"'
+  if rawchannels: out += ' checked="checked"'
+  out += '></td><td>\n'
+  
+  for i,j in enumerate(['&gt;Eth','&gt;5&#963','DB','Q&gt;4000']):out += '<a class="det%d">%s</a>\n' % (i,j)
+  out += '<input type="checkbox" name="calocells"'
+  if calocells: out += ' checked="checked"'
+  out += '></td><td>\n'
+
+  for i,j in enumerate(['','E&gt;5-15','LB','Q&gt;4000']):
+    if j != '': out += '<a class="det%d">%s</a>\n' % (i,j)
+  out += '<input type="checkbox" name="sporadic"' 
+  if sporadic: out += ' checked="checked"'
+  out += '></td><td>\n'
+
+  for i,j in enumerate(['&lt;E&gt;','E>1','LB','Q&gt;4000']):
+    if j != '': out += '<a class="det%d">%s</a>\n' % (i,j)
+  out += '<input type="checkbox" name="larcellempty"' 
+  if larcellempty: out += ' checked="checked"'
+
+  out += '></td>\n<td>&#916;R <input type="checkbox" name="clusters"'
+  if clusters: out += ' checked="checked"'
+  out += '></td>\n<td></td>\n</tr>\n'
+  
+  print out
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/run_report.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/run_report.py
new file mode 100644
index 00000000000..6307c76fa22
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/run_report.py
@@ -0,0 +1,1206 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from threading import Thread
+import xmlrpclib
+
+global server
+
+passfile = open("/afs/cern.ch/user/l/larmon/public/atlasdqmpass.txt")
+passwd = passfile.read().strip(); passfile.close()  
+passurl = 'https://%s@atlasdqm.cern.ch' % passwd
+server = xmlrpclib.ServerProxy(passurl)
+
+import sqlite3
+
+import os,re,time,sys,cgi,string,math
+import cgitb; cgitb.enable()
+
+Eventtype = {2:'Raw data',4:'Result',8:'Calib',12:'Pedestal',16:'All+Result'}
+global ATLASREADY
+ATLASREADY = []
+global NBR
+global NBY
+NBR = {}; NBY = {};
+global noisedefects
+global sevnoisedefects
+noisedefects = []; sevnoisedefects = []
+
+########################################################################
+def listify(l):
+  if len(l)==0: return ''
+  elif len(l)==1: return str(l[0]) 
+  l.sort()
+  interval=False
+  a = ''
+  for i in range(len(l)-1):
+    if interval: 
+      if l[i+1]-l[i]==1: pass
+      else: a += str(l[i])+' '; interval=False
+    else:
+      a += str(l[i])
+      if l[i+1]-l[i]==1: a += '-'; interval=True
+      else: a += ' '
+  a += str(l[-1])
+  return a
+
+########################################################################
+class queryhvtripdb(Thread):
+  def __init__(self,run_spec):
+    Thread.__init__(self)
+    self.run_spec = run_spec
+
+  def run(self):
+    dbName='/afs/cern.ch/user/l/larmon/public/HVTripsDB/trips.db'    
+    querycmd='select details.Det,details.Side,details.HVLINE,trips.TripLB,trips.RampUp,trips.StableZero,trips.RecoveryLB,trips.RecoveryRunNumber,details.status from trips INNER JOIN details ON trips.HVLINE = details.HVLINE where trips.TripRunNumber=%s order by trips.TripTimeStamp desc limit 100;'%self.run_spec['low_run']
+    hv_conn = sqlite3.connect(dbName,detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
+    c = hv_conn.cursor()
+    c.execute(querycmd)
+    trip = c.fetchall()
+    self.List = trip
+    #print "DEBUG inside:",self.List,"<br>"
+
+########################################################################
+class queryatlasready(Thread):
+  def __init__(self,run_spec):
+    Thread.__init__(self)
+    self.run_spec = run_spec
+
+  def run(self):
+    athena_version = "17.2.6"
+    import subprocess as sp
+    cmd="export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup;"
+    cmd+="source $AtlasSetup/scripts/asetup.sh %s,32,here;"%(athena_version)
+    cmd+="python /afs/cern.ch/user/l/larmon/public/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/GetATLASReadyLBs.py %s"%(self.run_spec['low_run'])
+    P = sp.Popen(cmd,shell=True,stdout=sp.PIPE,stderr=sp.PIPE)
+    tmp =  str(P.communicate()[0]).split('\n')[:-1]
+    self.List=eval(tmp[-1])
+    
+########################################################################
+class queryeventsperlb(Thread):
+  def __init__(self,run_spec):
+    Thread.__init__(self)
+    self.run_spec = run_spec
+
+  def run(self):
+
+    athena_version = "17.2.6"
+    
+    if 'tmp_' in self.run_spec['stream']:
+      stream = self.run_spec['stream'][4:]
+    else:
+      stream = self.run_spec['stream']
+
+    import subprocess as sp
+    cmd="export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup;"
+    #cmd+="source $AtlasSetup/scripts/asetup.sh 16.6.5,32,here,builds;"
+    cmd+="source $AtlasSetup/scripts/asetup.sh %s,32,here;"%(athena_version)
+    cmd+="python /afs/cern.ch/user/l/larmon/public/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/GetNEventsLB.py --run %s --stream %s;"%(self.run_spec['low_run'],stream)
+
+    P = sp.Popen(cmd,shell=True,stdout=sp.PIPE,stderr=sp.PIPE)
+    tmp = eval(P.communicate()[0])
+    self.List = dict( [(x[1],x[0]) for x in list(tmp)] )
+
+########################################################################
+_Part = {'EMBA':'BarrelA','EMBC':'BarrelC','EMECA':'EmecA','EMECC':'EmecC','HECA':'HecA','HECC':'HecC','FCALA':'FcalA','FCALC':'FcalC'}
+
+class mc(Thread):
+  def __init__(self,run_spec,P):
+    Thread.__init__(self)
+    self.P = P
+    self.run_spec = run_spec
+    #self.mixed = mixed
+    self.multicall = xmlrpclib.MultiCall( server )
+    self.multicall.get_dqmf_sub_assessments(self.run_spec,'LAr/'+self.P+'/Data_Integrity')
+    self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Detector_Status/NDeviatingChannels'+self.P)
+    self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Data_Integrity/NullDigit_'+_Part[self.P])
+    self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Data_Integrity/Saturation_'+_Part[self.P])
+    self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Data_Integrity/LArFEBMonErrors'+_Part[self.P])
+    
+    for j in ['_burst','_timeVetoBurst','_pedestal_evolution','_quality_nChannel_burst']:
+      #if self.mixed:
+       # self.run_spec['stream'] = 'physics_CosmicCalo'
+       # self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Noise/Partition/'+self.P+j)
+       # self.run_spec['stream'] = 'express_express'      
+      #else:
+      self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Noise/Partition/'+self.P+j)
+    
+
+    self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Data_Integrity/Out_E_FT_vs_SLOT_'+_Part[self.P])  
+    self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Data_Integrity/missingTriggerType'+_Part[self.P])
+
+
+  def run(self):
+
+    self.results = self.multicall()
+    self.runs = self.results[0].keys()
+    self.FEBErrors_list = {}
+    self.FEBErrors_results = {}
+
+    for n,N in enumerate(self.runs):
+      run_spec1 = self.run_spec.copy()
+      run_spec1['high_run'] = N
+      run_spec1['low_run'] = N
+      H = self.results[0][N]['hists']
+      self.multicall._MultiCall__call_list = []
+      self.FEBErrors_results[N] = []
+
+      ## Retrieve number of errors per FEB
+      for h in H:
+        if not 'LArFEBMonErrors' in h: continue
+        self.multicall.get_dqmf_all_results(run_spec1,'LAr/'+self.P+'/Data_Integrity/'+h)
+        self.FEBErrors_results[N].append( h )
+
+      ## Retrieve error type per FEB
+      #for h in H:
+      #  if not 'FT' in h: continue
+      #  self.multicall.get_dqmf_results(run_spec1,'LAr/'+self.P+'/Data_Integrity/'+h+':Mean')
+      #  self.FEBErrors_results[N].append( [h] )
+      #  #print 'JL check FEB errors:',h,self.FEBErrors_results,'<br>'
+          
+      r = self.multicall()
+      for i,I in enumerate(self.multicall._MultiCall__call_list): 
+        self.FEBErrors_results[N].append( r[i][N] )
+        #print 'JL        ',r[i][N],'<br>'
+        #print 'JL        ',self.FEBErrors_results[N],'<br>'  
+
+
+########################################################################
+def RunReport(run_spec,multicall,url,DCSGET,defects,includenotready,esproc,cleanesproc,bulkproc,cleanbulkproc,isexpress):
+
+  # Queries
+  Part = ['EMBA','EMBC','EMECA','EMECC','HECA','HECC','FCALA','FCALC']
+  Part2 = ['EMBA','EMBC','EMECA','EMECC']
+  _Part2 = {'EMBA':'BarrelA','EMBC':'BarrelC','EMECA':'EMECA','EMECC':'EMECC'}
+  Part3 = {'EMBA':['EMB1A','EMB2A','EMB3A','EMBPA'],'EMBC':['EMB1C','EMB2C','EMB3C','EMBPC'],'EMECA':['EMEC1A','EMEC2A','EMEC3A','EMECPA'],'EMECC':['EMEC1C','EMEC2C','EMEC3C','EMECPC'],'HECA':['HEC0A','HEC1A','HEC2A','HEC3A'],'HECC':['HEC0C','HEC1C','HEC2C','HEC3C'],'FCALA':['FCAL1A','FCAL2A','FCAL3A'],'FCALC':['FCAL1C','FCAL2C','FCAL3C']}
+  calls = []
+
+  EMECA_lb=[]
+  EMECC_lb=[]
+  EMECA_mb=[]
+  EMECC_mb=[]
+
+
+  for p,P in enumerate(Part):
+    calls.append( mc(run_spec,P) )
+    calls[p].start()
+ 
+  multicall._MultiCall__call_list = [] 
+  multicall.get_dqmf_results(run_spec,'Global/DataFlow/m_release_stage_lowStat:Average')
+  multicall.get_dqmf_all_results(run_spec,'LAr/LAR_GLOBAL/Run_Parameters/Eventtype')
+  multicall.get_dqmf_all_results(run_spec,'LAr/LAR_GLOBAL/Run_Parameters/NbOfSamples')
+  multicall.get_dqmf_all_results(run_spec,'LAr/LAR_GLOBAL/Data_Integrity/EventsRejectedYield')
+  multicall.get_dqmf_all_results(run_spec,'LAr/LAR_GLOBAL/Collisions/LArCollTimeLumiBlockTimeCut')
+ 
+  Plots = ['Data_Integrity/YieldOfRejectedEventsVsLBout','Data_Integrity/YieldOfRejectedEventsVsLB','Noise_Bursts/NoisyEvent_TimeVeto','Noise_Bursts/SaturatedTightEvent_TimeVeto']  
+  Plots_description = ['Data Integrity(TimeVeto)','Data Integrity','Noise Burst(NoisyRO)','Noise Burst(Sat.Tight.)']
+  for p in Plots: multicall.get_dqmf_all_results(run_spec,'LAr/LAR_GLOBAL/'+p)
+
+  for p,P in enumerate(Part2):
+    multicall.get_dqmf_all_results(run_spec,'LAr/'+P+'/Noise/Partition/NoisyEvent_TimeVeto_'+_Part2[P])
+
+
+  for p,P in enumerate(Part):
+    Layers = Part3[P]
+    for j,J in enumerate(Layers):
+      multicall.get_dqmf_all_results(run_spec,'LAr/'+P+'/Signal_Time/Single_Cells/CellEnergyVsTime_'+J)
+  
+  multicall.get_dqmf_all_results(run_spec,'LAr/LAR_GLOBAL/Data_Integrity/EErrorsPerLB')
+   
+  results = multicall()
+
+
+  # Retrieve HV trip from hv trip db
+  hvtrip=queryhvtripdb(run_spec)
+  hvtrip.start()
+  hvtrip.join()
+  HVTRIPS=hvtrip.List
+
+
+  # Retrieve events per LB in the current stream from run query
+  evtstream=queryeventsperlb(run_spec)
+  evtstream.start()
+  evtstream.join()
+  NevtPerLB=evtstream.List
+
+    
+
+  # Retrieve stable beam info
+  readyinfo = queryatlasready(run_spec)
+  readyinfo.start()
+  readyinfo.join()
+  ATLASREADY=readyinfo.List
+
+  # Print header
+  S = ['NullDigit','Saturation']
+  color = ['#FF0000','#0000FF']
+  h_names = ['_burst','_timeVetoBurst','_pedestal_evolution','_quality_nChannel_burst']
+  RE0 = re.compile(r'(?P<P>\S+)FT(?P<FT>\S+)Slot(?P<SL>\S+)')
+  RE1 = re.compile(r'\((?P<LB>\S+)\.0*\)')
+  RE2 = re.compile(r'x-axis\s*\S*\((?P<SL>\S+)\.0*\)\s*y-axis\s*\((?P<FT>\S+)\.0*\)\S+')
+
+
+  print '''
+<tr class="row">
+<td><b>Run Info</td>
+<td title="LAr Global"><b>LAr Global</b></td>
+<td><b>Partition</td>
+<td><b>Data integrity</b></td>
+<td><b>Non-nominal HV</b></td>
+<td><b>NullDigit/Saturation</td>
+<td><b>Noise Bursts (LArNoisyRO-q factor)</td>
+<td><b>Noise Bursts (Energy)</td>
+<td><b>DSP computation</td>
+<td><b>Timing</td>
+</tr>
+<tr>
+<td></td>
+<td>LB: &#37;ev (n) </td>
+<td></td>
+<td>(FT,SL)</td>
+<td>HV correction</td>
+<td>FT,SL,CH,&#37;ev,error</td>
+<td>LB: &#37;ev (n) </td>
+<td>LB:&nbsp;<a class="lb0" title="Number of events with more than 1% of all channels reporting |E|>3&#963;">Y3&#963</a>&nbsp;&nbsp;&nbsp;<a class="lb1" title="Number of events with more than 1% of all channels reporting |E|>3&#963; With Time Veto">Y3&#963(TimeVeto)</a>&nbsp;\n &nbsp;<a class="lb2" title="Sum of the energy (MeV) in all channels">SumE</a>&nbsp;&nbsp;<a class="lb3" title="number of cells with saturated Q factor">Sat Q</td>
+<td><a class="lb3" title="Is Eoffline != Eonline for more than 20 events (per FEB) and (per LB)"><font color = black> # of FEBs/LBs</td>
+<td><a class="lb3" title="check whether |<timing>| < 1.0 ns for layer 2 or < 2.0 ns for other layers"><font color = black>(ns)</td>
+</tr>
+'''
+
+  if run_spec['stream'] == "physics_CosmicCalo" or run_spec['stream'] == "tmp_physics_CosmicCalo": CosmicCalo = True
+  else: CosmicCalo =False
+  if CosmicCalo:
+
+    print '''
+<tr>
+<td>Stream</td>
+<td></td>
+<td></td>
+<td>%s</td>
+<td>%s</td>
+<td>%s</td>
+<td>%s</td>
+<td>%s</td>
+<td><a class="lb1">Not Valid for CosmicCalo<a></td>
+<td><a class="lb1">Not Valid for CosmicCalo<a></td>
+</tr>
+''' % ('CosmicCalo','CosmicCalo','CosmicCalo','CosmicCalo','CosmicCalo')
+
+  else:   
+
+    print '''
+<tr>
+<td>Stream</td>
+<td></td>
+<td></td>
+<td>%s</td>
+<td>%s</td>
+<td>%s</td>
+<td>%s</td>
+<td><a class="lb1">Only Valid for CosmicCalo<a></td>
+<td>%s</td>
+<td>%s</td>
+</tr>
+''' % (run_spec['stream'].split('_')[1],run_spec['stream'].split('_')[1],run_spec['stream'].split('_')[1],run_spec['stream'].split('_')[1],run_spec['stream'].split('_')[1],run_spec['stream'].split('_')[1])
+
+  #<td title="LB with defects"><b>LBs with Defects</b></td>
+  #<td title="# of collision candidates per LB">Collisions</td>
+  #<td>LB: n</td>
+
+  runs = results[1].keys()
+  runs.sort()
+
+
+  # Loop over runs
+  for n,N in enumerate(runs):
+    
+    #F = file('/afs/cern.ch/user/l/larmon/public/reports/%s.txt'%(N),'w')
+    Nev = -1
+    if results[0].has_key(N): Nev = int(results[0][N])
+
+    print '''
+<tr class="out0">
+<td rowspan="8" style="vertical-align:top">
+<a href="http://atlas-runquery.cern.ch/query.py?q=find+run+%s+/+show+all+and+duration+and+ptag+and+dq+lar/+nodef" >%s</a><br /><hr />
+<a href="https://atlasdqm.cern.ch/dqsignoff/%s"> DQ logbook </a><br /><hr />
+<a href="%s">Tier 0 <br /> Webdisplay</a><hr />
+%d<br />
+%s<br />
+%d samples<br />
+<hr />
+rejection<br />
+<a href="%s/LAr/LAR_GLOBAL/Data_Integrity/EventsRejectedYield">%.3f&#37;</a>
+</td>
+''' % (N,N,N,url,Nev,Eventtype[int(results[1][N]['Mean'])],int(results[2][N]['Mean']),url,results[3][N]['Total'])
+
+
+    Data_Integrity = []
+    Data_Integrity_TimeVeto = []
+    MediumNoisy_Events = []
+    TightNoisy_Events = []
+    Collisions = []
+
+    # Bad LBs Spotting
+    out = '<td rowspan="8" onclick="showit2(this);" style="vertical-align:top">\n'
+
+    # Stable beam
+    if len(ATLASREADY)==0:
+      out += '<pre style="font-family:Arial"><font color=green>ATLAS Ready</font>: None<br/>'
+    else:
+      out += '<pre style="font-family:Arial"><font color=green>ATLAS Ready</font>: %s<br/>'%listify(ATLASREADY)
+    out += '</pre>'
+
+    # Print Red DCS flags
+    if len(DCSGET)>0:
+      dcsurl="http://atlas-runquery.cern.ch/query.py?q=find+run+%s+&#37;2F+show++dq+lar+DCSOFL"%run_spec['low_run']
+      out += '<pre style="font-family:Arial"><a href=%s><font color=red>DCS Errors</font></a><br/>'%dcsurl
+      for item in DCSGET:
+        out+="%s lb %s<br/>"%(item,listify(DCSGET[item]))
+      out += '</pre>'
+
+    # Print HV Trips & Fill Defects
+    hvtripurl="https://atlas-larmon.cern.ch/HVTripsDB/index.py?query=select&#37;20+trips.rowid,*+from+trips+INNER+JOIN+details+ON+trips.HVLINE+=+details.HVLINE+where+trips.TripRunNumber=%s+order+by&#37;20trips.TripTimeStamp+desc"%run_spec['low_run']
+    out += '<pre style="font-family:Arial"><a href=%s><font color=red>HV Trips</font></a><br/>'%hvtripurl
+
+    
+    if len(HVTRIPS)>0:
+      for trip in HVTRIPS:
+        loc=str(trip[0])+str(trip[1]);    
+        # warning: remove "PS" in partition name
+        if loc=="EMBPSC": loc="EMBC";
+        if loc=="EMBPSA": loc="EMBA";
+        if loc=="EMECPSC":loc="EMECC";
+        if loc=="EMECPSA":loc="EMECA";
+        ch=int(trip[2]);
+        triplb=int(trip[3]);rampup=int(trip[4]);
+        stablezero=int(trip[5]);recoverlb=int(trip[6]);
+        recoverrun=int(trip[7]);
+        moduletype=str(trip[8]);
+
+
+        ##########################
+        ## Trip in a new module ##
+        ##########################
+        if (moduletype == "new"):
+          if (recoverrun==int(run_spec['low_run'])):
+            out+="%s trip %i-%i (new module) <br/>"%(loc,triplb,recoverlb) 
+            # set defects
+            #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+            if isexpress:  
+              df = "LAR_%s_HVTRIP_NEWMODULE <font color=yellow>Y</font> %i-%i # channel %i - New HV module"%(loc,triplb,recoverlb,ch)
+              defects.append(df)
+          #in case of a short   
+          else:
+             out+="%s trip %i-%i (new module short) <br/>"%(loc,triplb,stablezero)
+             if isexpress: 
+               df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i # channel %i"%(loc,triplb,stablezero,ch)
+               defects.append(df)
+               df = "LAR_%s_HVNONNOMINAL <font color=yellow>Y</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+               defects.append(df)
+             else:
+               df = "LAR_%s_HVNONNOMINAL <font color=green>G</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+               defects.append(df)
+               df = "LAR_%s_HVNONNOM_CORRECTED <font color=red>R</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+               defects.append(df)
+               
+                      
+   
+        #################################
+        ## Recovered trip within one LB  ##
+        #################################
+        elif (triplb == recoverlb):
+            out+="%s trip %i (recovered) <br/>"%(loc,triplb) 
+            # set defects
+            #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+            if isexpress:  
+              df = "LAR_%s_HVTRIP <font color=red>R</font> %i # channel %i"%(loc,triplb,ch)
+              defects.append(df)
+
+         
+        #######################################
+        ## Recovered trip - More than one LB ##
+        #######################################
+        elif (recoverrun==int(run_spec['low_run'])):
+  
+          ## autorecovered
+          if (stablezero<0):
+            out+="%s trip %i ramp %i-%i (recovered) <br/>"%(loc,triplb,rampup,recoverlb)
+            # set defects
+            #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+            if isexpress:  
+              df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i #  channel %i"%(loc,triplb,rampup,ch)
+              defects.append(df)
+              df = "LAR_%s_HVRAMPUP <font color=red>R</font> %i-%i #  channel %i"%(loc,rampup,recoverlb,ch)
+              defects.append(df)
+          ## manually recovered
+          else:
+            out+="%s trip %i stable %i-%i ramp %i-%i (recovered) <br/>"%(loc,triplb,stablezero+1,rampup-1,rampup,recoverlb)
+            # set defects for ES
+            #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+            if isexpress:  
+              df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i # channel %i"%(loc,triplb,stablezero,ch)
+              defects.append(df)
+              df = "LAR_%s_HVRAMPUP <font color=red>R</font> %i-%i # channel %i"%(loc,rampup,recoverlb,ch)
+              defects.append(df)
+              df = "LAR_%s_HVNONNOMINAL <font color=yellow>Y</font> %i-%s # channel %i"%(loc,stablezero+1,rampup-1,ch)
+              defects.append(df)
+            # set defects for bulk
+            else:
+              df = "LAR_%s_HVNONNOMINAL <font color=green>G</font> %i-%s # channel %i"%(loc,stablezero+1,rampup-1,ch)
+              defects.append(df)
+              df = "LAR_%s_HVNONNOM_CORRECTED <font color=red>R</font> %i-%s # channel %i"%(loc,stablezero+1,rampup-1,ch)
+              defects.append(df)
+       
+        ########################
+        ## Not Recovered trip ##
+        ########################
+        else:
+          ## easiest case: no ramp-up, no auto recovery
+          if (rampup<0 and stablezero>0):
+            out+="%s trip %i-%i (not recovered) <br/>"%(loc,triplb,stablezero)
+            # set defects for ES
+            #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+            if isexpress:  
+              df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i # channel %i"%(loc,triplb,stablezero,ch)
+              defects.append(df)
+              df = "LAR_%s_HVNONNOMINAL <font color=yellow>Y</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+              defects.append(df)
+            # set defects for bulk
+            else:
+              df = "LAR_%s_HVNONNOMINAL <font color=green>G</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+              defects.append(df)
+              df = "LAR_%s_HVNONNOM_CORRECTED <font color=red>R</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+              defects.append(df)  
+          ## second case: single failed ramp-up, no stable non nominal HV
+          elif (rampup>0 and stablezero<0):
+            out+="%s trip %i ramp %i-%s (not recovered) <br/>"%(loc,triplb,rampup,"End")
+            # set defects for ES
+            #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+            if isexpress : 
+              df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i # channel %i"%(loc,triplb,rampup,ch)
+              defects.append(df)
+              df = "LAR_%s_HVRAMPUP <font color=red>R</font> %i-%s # channel %i"%(loc,rampup,"End",ch)
+              defects.append(df)
+          ## third case: failed ramp-up, with stable non nominal HV AFTER ramp-up
+          elif (rampup>0 and stablezero>0):
+            if (stablezero > rampup):
+              out+="%s trip %i ramp %i-%i stable %i-%s (not recovered) <br/>"%(loc,triplb,rampup,stablezero,stablezero+1,"End")
+              # set defects for ES
+              #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+              if isexpress:  
+                df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i # channel %i"%(loc,triplb,rampup,ch)
+                defects.append(df)
+                df = "LAR_%s_HVRAMPUP <font color=red>R</font> %i-%i # channel %i"%(loc,rampup,stablezero,ch)
+                defects.append(df)
+                df = "LAR_%s_HVNONNOMINAL <font color=yellow>Y</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+                defects.append(df)
+                # set defects for bulk
+              else:
+                df = "LAR_%s_HVNONNOMINAL <font color=green>G</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+                defects.append(df)
+                df = "LAR_%s_HVNONNOM_CORRECTED <font color=red>R</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+                defects.append(df)
+            else:
+
+              out+="%s trip %i-%i (not recovered) <br/>"%(loc,triplb,stablezero)
+              # set defects for ES
+              #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+              if isexpress:  
+                df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i # channel %i"%(loc,triplb,stablezero,ch)
+                defects.append(df)
+                df = "LAR_%s_HVNONNOMINAL <font color=yellow>Y</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+                defects.append(df)
+                # set defects for bulk
+              else:
+                df = "LAR_%s_HVNONNOMINAL <font color=green>G</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+                defects.append(df)
+                df = "LAR_%s_HVNONNOM_CORRECTED <font color=red>R</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+                defects.append(df)  
+              
+          # fourth case (highly improbable but already seen) :ramping until the end of the run !
+          else:  
+            out+="%s trip %i ramp %i-%s (not recovered) <br/>"%(loc,triplb,rampup,"End")
+            # set defects for ES
+            #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+            if isexpress:  
+              df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i # channel %i"%(loc,triplb,rampup,ch)
+              defects.append(df)
+              df = "LAR_%s_HVRAMPUP <font color=red>R</font> %i-%s # channel %i"%(loc,rampup,"End",ch)
+              defects.append(df)
+    
+    # No Trip
+    else:
+      out+="no trip found<br>"
+    out += '</pre>'
+
+
+
+    # Print Data integrity, noise bursts
+    for j,J in enumerate(Plots):
+      try: r = results[j+5][N]
+      except:
+        out += '?'
+        continue
+
+      if j==3 and isexpress:
+        if run_spec['proc_ver']==bulkproc or run_spec['proc_ver']==cleanbulkproc or run_spec['proc_ver']==102:continue
+
+
+      K = r.keys()
+      if len(K)>0: K.remove('NBins')
+      LB = {}
+      # Thresholds to display bursts on %events
+      # Data Integrity/NoisyRO/Sat.Tight]
+      thresholds = [1.,1.,0.,1.]
+      for k in K:
+        m = RE1.search(k).groupdict()
+        lb = int(m['LB'])
+        p = '%5.4f'%(r[k])
+        # Apply thresholds for display
+        if r[k] < thresholds[j]: continue
+        # store LB per output value
+        if includenotready or (lb in ATLASREADY):
+          if LB.has_key(p): LB[p].append(lb)
+          else: LB[p] = [lb]
+          #print "DEBUG",j,J,k,r[k],p,LB,"<br>"
+          if j==0: # Data Integrity Errors Outside Time Veto
+            Data_Integrity_TimeVeto.append(lb)
+          if j==1: # Data Integrity Errors
+            Data_Integrity.append(lb)
+          if j==2: # LArNoisyRO
+            if lb in TightNoisy_Events: continue # avoid double counting
+            TightNoisy_Events.append(lb)
+          ##if j==3: # Saturated Tight
+          ##  if r[k]> 5:
+          ##    if lb in TightNoisy_Events: continue # avoid double counting
+          ##    TightNoisy_Events.append(lb)
+       
+    
+      if len(LB)>0:
+        NBINS = 0
+        for item in LB: NBINS += len(LB[item])
+        a = '<a class="lb%d" href="%s/LAr/LAR_GLOBAL/%s">%s</a>' % (j,url,Plots_description[j],p)
+        out += '<pre style="font-family:Arial;"><a href="%s/LAr/LAR_GLOBAL/%s" >%i LBs: %s</a>\n' % (url,J,NBINS,Plots_description[j])
+        #if "Data Integrity" in Plots_description[j]:
+        #  print "DEBUG",LB,len(LB),NBINS,"<br>"
+        #for val in LB.keys():
+        #  for lb in LB[val]:
+        #    out += '%s: %s (%i)<br />' %(lb,val,round(float(val)*NevtPerLB[int(lb)]*0.01))
+        P = LB.keys()
+        P.sort()
+        P.reverse()
+        counter = 0;
+        morethanfour = False
+        for val in P:
+          for lb in LB[val]:
+            counter = counter+1
+            if counter < 5: out += '%s: %s (%i)<br />' %(lb,val,round(float(val)*NevtPerLB[int(lb)]*0.01))
+            elif counter == 5:
+                out += '<a> <p  onclick="showit2(this);"  style="font-family:times;color:blue;" ><u>show</u></p> <!--f <br />'
+                morethanfour = True
+                out += '%s: %s (%i)<br />' %(lb,val,round(float(val)*NevtPerLB[int(lb)]*0.01))
+            else: out += '%s: %s (%i)<br />' %(lb,val,round(float(val)*NevtPerLB[int(lb)]*0.01))
+        if morethanfour: out +=' f-->\n'
+        #if morethanfour: out +=' <p  onclick="showit3(this);"  style="font-family:times;color:blue;" ><u>hide</u></p> f-->\n'
+        out += '</a></pre>'
+
+        ### use this instead to compactify the list of LBs 
+        #P = LB.keys()
+        #P.sort()
+        #P.reverse()
+        #for p in P: 
+        #   if float(p)>0.015: out += '%s: %s<br />' % (listify(LB[p]),p)
+        #   else: out += '<!--%s: %s<br />-->' % (listify(LB[p]),p)
+        #out += '</pre>'     
+    
+    #out += '</td>\n'
+    Flagged_LBs = Data_Integrity_TimeVeto+TightNoisy_Events
+
+    ###print "DEBUG - list of TIGHT bursts:",TightNoisy_Events,"<br>"
+    ###print "DEBUG - list of MEDIUM bursts:",MediumNoisy_Events,"<br>"
+
+    #########################################################################
+    # May 2011:Store data integrity defects DUE to missing FEBs - ES only #
+    #########################################################################
+    ##if run_spec['proc_ver']==esproc or run_spec['proc_ver']==cleanesproc:
+      ##df = "LAR_EMBA_COVERAGE <font color=red>R</font> # Dead controller for 2 FEBs"
+      ##defects.append(df)
+
+    #########################################################################
+    # October 2012:Store data integrity defects DUE to missing FEBs - ES only #
+    #########################################################################
+    #if isexpress:
+    #  df = "LAR_HECC_COVERAGE <font color=red>R</font> # FEB FT 16 Slot 5 powered off (cooling)"
+    #  defects.append(df)
+  
+    ###################################################
+    # Store data integrity defects - GLOBAL - ES only #
+    ###################################################
+    #######if len(Data_Integrity)>0 and (run_spec['proc_ver']==esproc or run_spec['proc_ver']==cleanesproc):
+    #if len(Data_Integrity)>0 and (isexpress):  
+    #    df = "LAR_DATACORRUPT <font color=red>R</font> "+listify(Data_Integrity)+" # data integrity error"
+    #    defects.append(df)
+    #if len(Data_Integrity)>0 and (run_spec['proc_ver']==bulkproc or run_spec['proc_ver']==cleanbulkproc):
+    #if len(Data_Integrity)>0 and (not isexpress):
+    #    df = "LAR_DATACORRUPT <font color=green>G</font> "+listify(Data_Integrity)+" # data integrity error - Cleaned with Time Veto"
+    #    defects.append(df)
+    #if len(Data_Integrity_TimeVeto)>0 and (run_spec['proc_ver']==bulkproc or run_spec['proc_ver']==cleanbulkproc):
+    if len(Data_Integrity_TimeVeto)>0 and (not isexpress):
+        df = "LAR_DATACORRUPT <font color=red>R</font> "+listify(Data_Integrity_TimeVeto)+" # data integrity error - NOT cleaned with Time Veto"
+        defects.append(df)
+      
+    # Collisions
+    #out += '<td rowspan="8" onclick="showit2(this);" style="vertical-align:top">\n'
+    Collisions = []
+    LB = {}
+    try:
+      r = results[4][N]
+      K = r.keys()
+      K.remove('NBins')
+      for k in K:
+        m = RE1.search(k).groupdict()
+        lb = int(m['LB'])                                                                              
+        p = int(r[k])
+        if includenotready or (lb in ATLASREADY):
+          if LB.has_key(p): LB[p].append(lb)
+          else: LB[p] = [lb]
+          Collisions.append(lb)
+
+        #out += '<a href="%s/LAr/LAR_GLOBAL/Collisions/LArCollTimeLumiBlockTimeCut" >%d LBs</a><br />\n' % (url,r['NBins'])
+        #out += '<a href="%s/LAr/LAR_GLOBAL/Collisions/LArCollTimeLumiBlockTimeCut" >%i LBs</a><br />\n' % (url,len(LB))
+      out += '<pre style="font-family:Arial;"><a href="%s/LAr/LAR_GLOBAL/Collisions/LArCollTimeLumiBlockTimeCut" > Collisions: <br> %i LBs</a><br />\n' % (url,len(Collisions))
+      if len(LB)>0:
+        P = LB.keys()
+        P.sort()
+        P.reverse()
+        #if run_spec['stream'] == 'physics_CosmicCalo':
+        if CosmicCalo:  
+          for p in P: 
+            #if float(p)>1: out += '%s: <font color=red>%s</font><br />' %(listify(LB[p]),p)
+            #else: out += '<!--%s: <font color=red>%s</font><br />-->' %(listify(LB[p]),p)
+            out += '%s: <font color=red>%s</font><br />' %(listify(LB[p]),p)
+    except: out += '?'
+    out += '</td>\n'
+    print out
+
+
+    # Sum everything
+    All_Bad_LBs = Data_Integrity+TightNoisy_Events+Collisions
+
+    # Loop over partitions
+    for p,P in enumerate(Part):
+      calls[p].join()
+      p_results = calls[p].results
+      out = ''
+      if p>0: out += '<tr class="out0">\n'
+      out += '<td>'+P+'</td>\n'
+      Partition_NoisyEvents = []
+      Partition_MediumEvents = []
+      Check_lb =[];Check_mb = []; Check_tb = []
+
+
+      # FEB errors
+      FEBErrors = ''
+      error = ''
+      FEBErrors_results = calls[p].FEBErrors_results[N]
+      if len(FEBErrors_results)>0:
+        h = FEBErrors_results[0] 
+        r = FEBErrors_results[1] 
+        K = r.keys()
+        K.remove('NBins')
+        fe = {}
+        for k in K:
+          m = RE2.search(k).groupdict()
+          FT = int(m['FT'])
+          SL = int(m['SL'])
+          if fe.has_key(FT): fe[FT].append(SL)
+          else: fe[FT] = [SL]
+        if len(fe) > 0:  
+          out += '<td style="width:100px" onclick="showit2(this);"><font color=red>%i reg. FEB errors<!--<br ><br />\n'%len(fe)
+          for i in fe.keys():
+            FEBErrors += '<a style="font-size:9px;" href="%s/LAr/%s/Data_Integrity/%s">(%d,%s)</a>\n' % (url,P,h,i,listify(fe[i])) 
+          out += FEBErrors+'-->\n'
+        else:
+          out += '<td> %i reg. FEB errors <br ><br />'%len(fe)
+          
+      else: out += '<td>'
+      
+
+      try:
+        FEB_trig = p_results[10][N]
+        num_feb_trig = int(FEB_trig['NBins'])
+        if len(FEBErrors_results)>0:
+          if num_feb_trig > 0:
+            out += '<pre style="font-family:Arial;"><a href="%s/LAr/%s/Data_Integrity/missingTriggerType%s"><font color=red> <br>  %i PU trigger errors \n'%(url,P,_Part[P],FEB_trig['NBins'])
+          else:
+            out += ' %i PU trigger errors  <br ><br />' %(num_feb_trig)
+      except: out += "Trig. check unavailable"       
+        
+      out += '</td>\n'
+  
+      # Partition with non-nominal HV
+      HV = []
+      r = p_results[1][N]
+      if r['NBins']>0:
+        K = r.keys(); K.remove('NBins')
+        l = []                 
+        for k in K: 
+          m = RE1.search(k).groupdict()
+          HV.append(int(m['LB']))
+
+      if len(HV)>0:
+        out += '<td style="width:80px"><a href="%s/LAr/%s/Detector_Status/NDeviatingChannels%s">%s</a></td>\n' % (url,P,P,listify(HV)) 
+      else: out += '<td></td>\n'
+
+      # NullDigit, Saturation
+      prob=''
+      for s in range(2):
+        r = p_results[2+s][N]
+        if r['NBins']>0:
+          K = r.keys(); K.remove('NBins')
+          for k in K:
+            m = RE2.search(k).groupdict()
+            SL = int(m['SL'])
+            CH = int(m['FT'])
+            if p<2:
+              FT = (SL-1)/14
+              SL = SL-FT*14
+            else:                    
+              FT = (SL-1)/15
+              SL = SL-FT*15
+            prob += '<a style="font-size:9px;" href="%s/LAr/%s/Data_Integrity/%sChan_%s">(%d,%d,%d,<font style="color:%s">%.1f</font>,%s)</a><br />' % (url,P,S[s],P,FT,SL,CH,color[s],100*r[k],S[s])
+      if len(prob)>0: 
+        out += '<td style="width:30px" onclick="showit2(this);"><a href="%s/LAr/%s/Data_Integrity/">%d FEB</a><br /><!--%s--></td>' % (url,P,prob.count('<br />'),prob)
+      else: out += '<td style="width:30px"></td>\n'
+
+
+      #####################################
+      #NoiseBursts LArNoisyRO q-factor per partition
+      #####################################
+      out += '<td>'
+
+      fail = False
+      if p < 4:
+        try: results[9+p][N]
+        except: fail = True
+      else:
+        try: p_results[5][N]
+        except: fail =True
+
+      #EMB,EMEC        
+      if p < 4 and not fail:    
+        r = results[9+p][N]        
+     
+        K = r.keys()
+        if len(K)>0: K.remove('NBins')
+        LB = {}
+ 
+        for k in K:
+          m = RE1.search(k).groupdict()
+          lb = int(m['LB'])
+          x = '%5.4f'%(r[k])
+          # store LB per output value
+          if includenotready or (lb in ATLASREADY):
+            if LB.has_key(x): LB[x].append(lb)
+            else: LB[x] = [lb]
+ 
+        ##Organize and display LBs (ordered by LB)
+        #if len(LB)>0:
+        #  LBs = [];LBmap = {}
+        #  for val in LB.keys():
+        #    for lb in LB[val]:
+        #      LBs.append(lb)
+        #      LBmap[lb]=[val]
+        #  LBs.sort()   
+        #  NBINS = 0
+        #  for item in LB: NBINS += len(LB[item])
+        #  out += '<pre style="font-family:Arial;"><a href="%s/LAr/%s/Noise/Partition/NoisyEvent_TimeVeto_%s" >%i LBs: </a>\n' % (url,P,_Part2[P],NBINS)
+        #  for lb in LBs:
+        #  
+        #    for val in LBmap[lb]:
+        #
+        #      num_evt = round(float(val)*NevtPerLB[int(lb)]*0.01)
+        #      if isexpress:
+        #        Partition_NoisyEvents.append(lb)
+        #        if p == 2: EMECA_lb.append(lb) 
+        #        if p == 3: EMECC_lb.append(lb) 
+        #      else:
+        #        if num_evt > 1.0:
+        #          Partition_NoisyEvents.append(lb)
+        #          if p == 2: EMECA_lb.append(lb) 
+        #          if p == 3: EMECC_lb.append(lb) 
+        #        else:
+        #          Partition_MediumEvents.append(lb)
+        #          if p == 2: EMECA_mb.append(lb) 
+        #          if p == 3: EMECC_mb.append(lb) 
+        #      out += '%s: %s (%i)<br />' %(lb,val,num_evt)
+
+
+        #Organize and display LBs  (ordered by val)
+        if len(LB)>0:
+          NBINS = 0
+          for item in LB: NBINS += len(LB[item])
+          out += '<pre style="font-family:Arial;"><a href="%s/LAr/%s/Noise/Partition/NoisyEvent_TimeVeto_%s" >%i LBs: </a>\n' % (url,P,_Part2[P],NBINS)
+          Q = LB.keys()
+          Q.sort()
+          Q.reverse()
+          counter = 0;
+          morethanfour = False
+          for val in Q:
+            for lb in LB[val]:
+              num_evt = round(float(val)*NevtPerLB[int(lb)]*0.01)
+              if isexpress:
+                Partition_NoisyEvents.append(lb)
+                if p == 2: EMECA_lb.append(lb) 
+                if p == 3: EMECC_lb.append(lb) 
+              else:
+                if num_evt > 1.0:
+                  Partition_NoisyEvents.append(lb)
+                  if p == 2: EMECA_lb.append(lb) 
+                  if p == 3: EMECC_lb.append(lb) 
+                else:
+                  Partition_MediumEvents.append(lb)
+                  if p == 2: EMECA_mb.append(lb) 
+                  if p == 3: EMECC_mb.append(lb) 
+              counter = counter+1
+              if counter < 5: out += '%s: %s (%i)<br />' %(lb,val,num_evt)
+              elif counter == 5:
+                #out += '<p  onclick="showit2(this);"> ....<!-- <br />'
+                out += '<p  onclick="showit2(this);"><u style="font-family:times;color:blue;">show</u> <!--f <br />'
+                morethanfour = True
+                out += '%s: %s (%i)<br />' %(lb,val,num_evt)
+              else: out += '%s: %s (%i)<br />' %(lb,val,num_evt)
+          if morethanfour: out +=' f--></p>\n'
+      
+      #HEC/FCAL          
+      elif  not fail:
+        r = p_results[5][N]
+        if p == 4:
+          Check_lb = EMECA_lb
+          if not isexpress: Check_mb = EMECA_mb
+        if p == 5:
+          Check_lb = EMECC_lb
+          if not isexpress: Check_mb = EMECC_mb
+        if p == 6:
+          Check_lb = EMECA_lb
+          if not isexpress: Check_mb = EMECA_mb
+        if p == 7:
+          Check_lb = EMECC_lb
+          if not isexpress: Check_mb = EMECC_mb
+ 
+        K = r.keys()
+        if len(K)>0: K.remove('NBins')
+        LB = {} 
+ 
+        for k in K:
+          m = RE1.search(k).groupdict()
+          lb = int(m['LB'])
+          x = '%5.2f'%(r[k])
+          # store LB per output value
+          if includenotready or (lb in ATLASREADY):
+            if lb in Check_lb:
+              if LB.has_key(x): LB[x].append(lb)
+              else: LB[x] = [lb]
+              
+        #Organize and display LBs
+        if len(LB)>0:
+          LBs = [];LBmap = {}
+          for val in LB.keys():
+            for lb in LB[val]:
+              LBs.append(lb)
+              LBmap[lb]=[val]
+          LBs.sort()
+          NBINS = 0
+          for item in LB: NBINS += len(LB[item])
+          #out += '<pre style="font-family:Arial;"><a href="%s/LAr/%s/Noise/Partition/%s_burst" >%i LBs: </a>\n' % (url,P,P,NBINS)
+          for lb in LBs:
+            num_evt = round(float(val)*NevtPerLB[int(lb)]*0.01)
+            if isexpress: Partition_NoisyEvents.append(lb)
+            else:
+              if num_evt > 1.0:
+                Partition_NoisyEvents.append(lb)
+                Check_tb.append(lb)
+              else:
+                Partition_MediumEvents.append(lb)
+                Check_mb.append(lb)
+
+
+
+
+                
+            #Partition_NoisyEvents.append(lb)
+            #for val in LBmap[lb]:
+              #out += '%s: %s (%i)<br />' %(lb,val,math.ceil(float(val)*NevtPerLB[int(lb)]*0.01))
+
+      else:  out += "Not available"        
+
+    
+      out += '</td>\n'
+
+      #############################################################
+      # Noise Bursts (Energy) per partition
+      # Add thresholds O:N3sig>0 O:N3sigTV>0 1:E>10000 2:NQfactor>1
+      #############################################################
+      MinBias = False
+      if run_spec['stream'] == "physics_MinBias": MinBias = True
+
+      
+      threshold=[0,0,50000,1]
+      out += '<td onclick="showit2(this);">\n'
+      LB = {}
+      for j in range(4):
+        try: p_results[5+j][N]#try: p_results[5][N]
+        except:
+          out += "Not available"
+          continue
+        r = p_results[5+j][N]
+        K = r.keys()
+        for k in K:
+          if 'NBins' in k: continue
+          m = RE1.search(k).groupdict()
+
+          # store only lbs above threshold
+          if int(r[k])>threshold[j]:
+            lb = int(m['LB'])
+            if includenotready or (lb in ATLASREADY):
+              if not LB.has_key(lb): LB[lb] = [0,0,0,0]
+              LB[lb][j] = int(r[k])
+     
+      # now flag noise bursts in LBs
+    
+      if len(LB)>0:
+        LBs = LB.keys()
+        LBs.sort()
+        for i,lb in enumerate(LBs):
+          if LB[lb][0]+LB[lb][1]+LB[lb][2]+LB[lb][3]==0: continue
+          # Flag Red bursts per partition if Y3sigma TimeVeto > 0
+          if LB[lb][1]>0:
+            if NBR.has_key(P): NBR[P].append(lb)
+            else:  NBR[P] = [lb]
+          ## Flag Red bursts per partition if nQfactor > 10
+          ##if LB[lb][3]>10:
+          ##  if NBR.has_key(P): NBR[P].append(lb)
+          ##  else:  NBR[P] = [lb]            
+          # do not flag Yellow burst anymore
+          #elif  LB[lb][2]>=5:
+          #  if NBY.has_key(P): NBY[P].append(lb)
+          #  else:  NBY[P]=[lb]
+          mask = False
+          #if lb in NBR or lb in NBY: mask = False 
+          if mask: out += '<!--\n'
+          burst = '' 
+          for j,strength in enumerate(LB[lb]):
+            if abs(strength)<1: continue         
+            if j==1:burst += '<a class="lb%d" href="%s/LAr/%s/Noise/Partition/%s%s">(%d)</a>&nbsp;' % (j,url,P,P,h_names[j],strength)
+            else: burst += '<a class="lb%d" href="%s/LAr/%s/Noise/Partition/%s%s">%d</a>&nbsp;' % (j,url,P,P,h_names[j],strength)       
+                
+          #if lb in TightNoisy_Events:out += '<font style="font-weight:bold;">%d</font>:%s &nbsp;' % (lb,burst.rstrip('&nbsp;'))
+          if lb in Partition_NoisyEvents:out += '<font style="font-weight:bold;">%d</font>:%s &nbsp;' % (lb,burst.rstrip('&nbsp;'))
+              
+          else:out += '%d:%s &nbsp;' % (lb,burst.rstrip('&nbsp;'))
+          if mask: out += '-->\n'   
+    
+      if run_spec['stream'].split('_')[1] == 'express':
+
+        fail = False
+        p_LB_err = []
+        try: p_results[9][N]
+        except: fail = True
+        try: results[43][N]
+        except: fail = True
+
+        if not fail:
+          r = p_results[9][N]          
+          cells = r['NBins']
+          bins = r.keys()
+          bins.remove('NBins')
+          FEBs=0
+
+          LB_bins = results[43][N]
+          LB_keys = LB_bins.keys()
+          LB_keys.remove('NBins')
+          #if p == 1: print LB_keys,"<br>"
+          if (LB_bins['NBins'] > 0):
+            for x,X in enumerate(LB_keys):
+              if LB_bins[X] > 20.0:
+                #if p==0: print "Value: ", LB_bins[X], "  Key: ", X, "  partition: ", X.split('(')[2].split('.')[0] ,"  LB: ",X.split('(')[1].split('.')[0],"<br>"
+                found_p = X.split('(')[2].split('.')[0]
+                found_LB = X.split('(')[1].split('.')[0]
+                if p == 0 and found_p == '1': p_LB_err.append(found_LB)
+                if p == 1 and found_p == '0': p_LB_err.append(found_LB)
+                if p == 2 and found_p == '3': p_LB_err.append(found_LB)
+                if p == 3 and found_p == '2': p_LB_err.append(found_LB)
+                if p == 4 and found_p == '5': p_LB_err.append(found_LB)
+                if p == 5 and found_p == '4': p_LB_err.append(found_LB)
+                if p == 6 and found_p == '7': p_LB_err.append(found_LB)
+                if p == 7 and found_p == '6': p_LB_err.append(found_LB)
+          
+          out +=  '<td>'
+          #print "Partition: ", p, " LB: ",p_LB_err, "<br>"
+          if cells > 0:
+            for i,I in enumerate(bins):
+              if r[I] > 150.0: FEBs+=1
+              #print r[I],'<br>'
+            if FEBs > 0:    
+              #out +=  '<pre style="font-family:Arial;"><a href="%s/LAr/%s/Data_Integrity/Out_E_FT_vs_SLOT_%s"><font color=red> <br>  %i FEBs with E difference</a><br />\n' % (url,P,_Part[P],FEBs)
+              out +=  '<pre style="font-family:Arial;"><a href="%s/LAr/%s/Data_Integrity/Out_E_FT_vs_SLOT_%s"><font color=red> <br>  %i FEBs with > 150 \n errors in E computation </a>' % (url,P,_Part[P],FEBs)
+
+          if p_LB_err > 0:
+              num_LB = 0
+              for i in p_LB_err: num_LB = num_LB+1
+              if num_LB > 0: out +=  '<pre style="font-family:Arial;"><a href="%s/LAr/LAR_GLOBAL/Data_Integrity/EErrorsPerLB"><font color=red> <br> %d LBs with > 20 \n errors in E computation </font> </a><br>' % (url,num_LB)
+              for i in p_LB_err: out += '%s <br />' %(i)
+              
+          out +=  '</td>'
+          
+        else:    out +=  '<td> Not available </td>\n'
+
+      else: out +=  '<td></td>\n'
+
+      #####timing
+      if CosmicCalo == False and  MinBias == False:
+        
+        fail = False
+        Layers = Part3[P]
+        out += '<td>'
+        for j,J in enumerate(Layers):
+          try: results[13+j][N]
+          except: fail = True
+
+
+          if not fail:
+            if not p==7: r = results[13+j+p*4][N]
+            else:   r = results[13+j+p*4-1][N]
+            mean = r['Mean']
+            if j==1:
+              if mean > 1.0 or mean < -1.0:
+                out +=  '<pre style="font-family:Arial;"><a href="%s/LAr/%s/Signal_Time/Single_Cells/CellEnergyVsTime_%s"><font color=red> %s mean=%.2f </a> \n' % (url,P,J,J,mean)
+            elif mean > 2.0 or mean < -2.0:
+              out +=  '<pre style="font-family:Arial;"><font color=red><a href="%s/LAr/%s/Signal_Time/Single_Cells/CellEnergyVsTime_%s"><font color=red> %s mean=%.2f </a> \n' % (url,P,J,J,mean)
+                    
+          else:  out +=  'Not available'
+            
+        out +=  '</td>\n'  
+
+      else:out +=  '<td></td>\n'
+
+      print out+'</td>\n</tr>\n'
+      #Flagged_LBs += NBR+NBY
+      
+
+      ###############################################print "Noisy: ", NBR,Partition_NoisyEvents, "<br>"
+
+      ##################################
+      # Find noise bursts in partition #
+      ##################################
+      tb = []; mb = []
+      ###if P in NBR: print "DEBUG RED",P,NBR[P],"<br>"
+      ###if P in NBY: print "DEBUG YELLOW",P,NBY[P],"<br>"
+      #for lb in TightNoisy_Events:
+      #print Partition_NoisyEvents
+      for lb in Partition_NoisyEvents:
+        tb.append(lb)  ########################### NEW WAY ######################
+      for lb in Partition_MediumEvents:
+        mb.append(lb) 
+        
+        ###############################
+        ##### OLD WAY #################
+        ###############################
+        ## add red burst always
+        #if P in NBR and lb in NBR[P]:
+        #  tb.append(lb)
+        #  ###print "......DEBUG TIGHT partial tb (from NBR):",P,tb,"<br>" 
+        #  continue
+        ## add yellow bursts only if in more than 1 partition
+        #elif P in NBY and lb in NBY[P]:
+        #  ###print "***",P,lb,"<br>"
+        #  occured = 0
+        #  for part in NBR:
+        #    for item in NBR[part]:
+        #      if item == lb:
+        #        occured+=1
+        #        ###print "------------ found in NBR:",P,part,item,lb,occured,"<br>"
+        #  for part in NBY:
+        #    for item in NBY[part]:
+        #      if item == lb:
+        #        occured+=1
+        #        ###print "------------ found in NBY:",P,part,item,lb,occured,"<br>"
+        #  if occured > 1: tb.append(lb)
+        #  ###print "......DEBUG partial tb (from NBY):",tb,"<br>"
+          
+      #for lb in MediumNoisy_Events:
+      #  if lb in TightNoisy_Events: continue
+      #  # print "DEBUG %s checking MEDIUM lb %i to be assigned <br>"%(P,lb)
+      #  # add red burst always
+      #  if P in NBR and lb in NBR[P]:
+      #    mb.append(lb)
+      #    ###print "......DEBUG MEDIUM partial mb (from NBR):",P,mb,"<br>" 
+      #    continue
+      #  # add yellow bursts only if in more than 1 partition
+      #  elif P in NBY and lb in NBY[P]:
+      #    occured = 0
+      #    for part in NBR:
+      #      for item in NBR[part]:
+      #        if item == lb:
+      #          occured+=1
+      #    for part in NBY:
+      #      for item in NBY[part]:
+      #        if item == lb:
+      #          occured+=1
+      #    if occured > 1: mb.append(lb)
+
+ 
+      ###########################  
+      # Now fill bursts defects #
+      ###########################
+      #print "mb: ",mb," tb: ",tb," Check_mb: ",Check_mb," Check_lb: ",Check_lb, "<br>"
+      
+      if p > 3 and len(Check_lb) > 0:
+        tb = Check_lb
+        #if run_spec['proc_ver']==esproc or run_spec['proc_ver']==cleanesproc or run_spec['proc_ver']==101:
+        if isexpress:  
+          df = "LAR_"+P+"_NOISEBURST <font color=yellow>Y</font> "+listify(tb)+" # Noise burst in the LB spotted in %s - Cleaned by time veto"%(run_spec['stream'])
+          noisedefects.append(df)
+ 
+        # severe noise burst defect for BULK
+        #if run_spec['proc_ver']==bulkproc or run_spec['proc_ver']==cleanbulkproc or run_spec['proc_ver']==102:
+        if not isexpress:  
+          df = "LAR_"+P+"_SEVNOISEBURST <font color=red>R</font> "+listify(tb)+" # noise burst - NOT cleaned with Time Veto (v3)"
+          sevnoisedefects.append(df)
+          df = "LAR_"+P+"_NOISEBURST <font color=green>G</font> "+listify(tb)+" # noise bursts - NOT cleaned  with Time Veto (v3)"
+          noisedefects.append(df)
+      
+      elif len(tb)>0 :
+        # soft noise burst for ES
+        #if run_spec['proc_ver']==esproc or run_spec['proc_ver']==cleanesproc:
+        #if run_spec['proc_ver']==esproc or run_spec['proc_ver']==cleanesproc or run_spec['proc_ver']==101:
+        if isexpress:  
+          #df = "LAR_"+P+"_NOISEBURST <font color=yellow>Y</font> "+listify(tb)+" # noise bursts - Cleaned with Time Veto (v3)"
+          df = "LAR_"+P+"_NOISEBURST <font color=yellow>Y</font> "+listify(tb)+" # Noise burst in the LB spotted in %s - Cleaned by time veto"%(run_spec['stream'])
+          noisedefects.append(df)
+ 
+        # severe noise burst defect for BULK
+        #if run_spec['proc_ver']==bulkproc or run_spec['proc_ver']==cleanbulkproc or run_spec['proc_ver']==102:
+        if not isexpress:  
+          df = "LAR_"+P+"_SEVNOISEBURST <font color=red>R</font> "+listify(tb)+" # noise burst - NOT cleaned with Time Veto (v3)"
+          sevnoisedefects.append(df)
+          df = "LAR_"+P+"_NOISEBURST <font color=green>G</font> "+listify(tb)+" # noise bursts - NOT cleaned  with Time Veto (v3)"
+          noisedefects.append(df)
+
+      if not isexpress:    
+
+        if p > 3 and len(Check_mb) > 0:
+          mb = Check_mb
+          df = "LAR_"+P+"_NOISEBURST <font color=yellow>Y</font> "+listify(mb)+" # single isolated event flagged as LArNoisyRO_Std in JetTauEtmiss"
+          noisedefects.append(df)
+        elif len(mb)>0 :
+          df = "LAR_"+P+"_NOISEBURST <font color=yellow>Y</font> "+listify(mb)+" # single isolated event flagged as LArNoisyRO_Std in JetTauEtmiss"
+          noisedefects.append(df)  
+ 
+      
+    # include partition defects in global defects
+    for item in noisedefects:defects.append(item)
+    for item in sevnoisedefects:defects.append(item)
+      
+    if n<len(runs)-1: print '\n<tr><td colspan="8"><hr/></td></tr>\n'
+
+ 
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/selection.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/selection.py
new file mode 100644
index 00000000000..7c72f0cac31
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/dev/selection.py
@@ -0,0 +1,125 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+########################################################################
+def PrintSelection(run_spec,info,cluster_threshold,beambkg,expert,includenotready,ladies,cluster_E):
+
+  out = '<form name="selection" id="selection" method="post" target="_self">\n'
+  out += '<div style="text-align:left" id="queryrow">\n'
+
+  # runs menu
+  out +=  '<br><b>LADIeS Options -- </b>'
+  out += '<br> &nbsp;&nbsp; Run Number:<input type="text" size="6" name="low_run" '
+  if run_spec.has_key('low_run'): out += 'value="'+run_spec['low_run']+'" '
+
+   # job menu
+  out += '/>&nbsp;&nbsp;\n Report Type: '
+  out += '<select name="ladies" style="text-align:left">'
+  for j,job in enumerate(['LADIeS-express','LADIeS-bulk', 'ExpertOptions-express','ExpertOptions-bulk']):
+    out += '<option value="'+str(j)+'"'
+    if j==ladies: out+= ' selected'
+    out += '>'+job+'</option>'
+  out += '</select>\n'
+
+
+  # job menu
+  out += '&nbsp;&nbsp;\n  '
+  out += '<select name="info" style="text-align:left">'
+  for j,job in enumerate(['Run Report','Noisy LAr Cells']):
+    out += '<option value="'+str(j)+'"'
+    if j==info: out+= ' selected'
+    out += '>'+job+'</option>'
+  out += '</select>\n'
+
+  
+  #out += '<br>'
+
+  # buttons
+  out += '&nbsp;<input type="submit" value="Submit"/>\n'
+  out += '<input type="reset" value="Reset" onclick="ResetForm()" />\n'
+  out += '<input type="button" value="Help" onclick="Helper()" />\n'
+  
+
+  # end option section
+  out += '</div>\n'
+  
+  print out+'<br />'
+
+  
+  out = '<div style="text-align:left" id="expertrow">\n'
+
+  # stream menu
+  out += '<b>Expert Options (Stream, source and proc. version are defined by "Report Type" unless "ExpertOptions" is selected) -- <br></b>'
+  #out += '/>&nbsp;&nbsp;Data stream:<select name="stream" value="CosmicCalo" style="text-align:left;">'
+  out += '&nbsp;&nbsp;Data stream:<select name="stream" style="text-align:left;">'
+  ST = run_spec['stream'].split('_')[1]
+  for st in ['CosmicCalo','JetTauEtmiss','Egamma','express','MinBias','HardProbes']:
+    out += '<option value="'+st+'"'
+    if st==ST: out+= ' selected'
+    out += '>'+st+'</option>'
+  out += '</select>&nbsp;&nbsp;\n'
+    
+  # source menu
+  out += 'Source:<select name="source" style="text-align:left;">'
+  for source in ['tier0','reproc','larcomm','test']: 
+    out += '<option value="'+source+'"'      
+    if source==run_spec['source']: out+= ' selected'
+    out += '>'+source+'</option>' 
+  out += '</select>&nbsp;&nbsp;'
+      
+  # proc_ver menu
+  out += 'Processing_version:<input name="proc_ver" size="5" style="text-align:left" value="%d" />&nbsp;&nbsp;' % (run_spec['proc_ver'])
+
+  # end expert section
+  out += '</div>\n'
+  
+  print out+'<br />'
+
+  out = '<div style="text-align:left" id="Advanced">\n'
+
+  # stream menu
+  out += '<b> Advanced options (do not touch unless you know what you do!) -- <br></b>'     
+      
+  # cluster theshold
+  out += 'Clusters [evts]:<input name="cluster_threshold" size="2" style="text-align:left" value="%d" />&nbsp;&nbsp;' % (cluster_threshold)
+
+  # cluster E menu
+  out += 'Cluster E:<select name="cluster_E" style="text-align:left;">'
+  for clus_e in ['Et>10GeV','Et>5GeV','E>10GeV','E>5GeV']: 
+    out += '<option value="'+clus_e+'"'
+    if clus_e==cluster_E: out+= ' selected'
+    out += '>'+clus_e+'</option>' 
+  out += '</select>&nbsp;&nbsp;'
+  
+  # options
+  out += 'BeamBkg:<input type="checkbox" name="beambkg" '
+  if beambkg: out += 'checked="checked" />\n'
+  else:out += '/>\n'
+    
+    
+  #out += '&nbsp;Expert Output:<input type="checkbox" name="expert" '
+  #if expert>10:out += 'checked="checked" />\n'
+  #else:out += '/>\n'
+        
+        
+  # option to include non ATLAS ready LBs  &nbsp;
+  out += '&nbsp;&nbsp;&nbsp;Include ATLAS not ready LBs:<input type="checkbox" name="includenotready" '
+  if includenotready: out += 'checked="checked" />'
+  else:out += '/>\n'
+
+  out += '</div>\n'
+  
+  # end option section
+
+  print out+'<br />'
+
+  
+########################################################################
+def AddReportButton(defects,run_spec,info,beambkg):
+  dbdefects="'"+'<br>'.join(defects)+"'"
+  if not dbdefects:
+    dbdefects="''"
+  #if beambkg: dbdefects +="B"  
+  out = '<hr><input type="button" value="Get Report" onclick="Report(%s,%s,%s,%s,%i)" />\n'%(info,run_spec['low_run'],run_spec['proc_ver'],dbdefects,beambkg)
+  out += '<input type="button" value="Defect DB" onclick="DefectDB(%s)" />\n'%(run_spec['low_run'])
+  out += '<input type="button" value="LAr DB log" onclick="LArDBlog()" />'
+  print out+'<br />'
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/index_cm.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/index_cm.py
new file mode 100755
index 00000000000..1e211a4235d
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/index_cm.py
@@ -0,0 +1,518 @@
+#!/usr/bin/env python2.5
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+print 'Content-type: text/html;charset=utf-8\n'
+
+########################################################################
+import os,re,time,sys,cgi,string,math
+import cgitb; cgitb.enable()
+import sqlite3
+import xmlrpclib
+global server
+#server = xmlrpclib.ServerProxy('http://atlasdqm.cern.ch')
+
+passfile = open("/afs/cern.ch/user/l/larmon/public/atlasdqmpass.txt")
+passwd = passfile.read().strip(); passfile.close()  
+passurl = 'https://%s@atlasdqm.cern.ch' % passwd
+server = xmlrpclib.ServerProxy(passurl)
+
+from threading import Thread
+dbfile = 'LArBad.db'
+global cursor
+global conn
+
+global info
+global beambkg
+global opts
+global expert
+global run_spec
+global esproc
+global bulkproc
+global reproc
+global cleanesproc
+global cleanbulkproc
+global lce_inputfile
+global cluster_threshold
+global includenotready
+global ladies
+global isexpress
+global pass_letter
+global cluster_E
+
+global DCSGET  
+
+global defects
+
+DCSGET={};
+
+defects = [];hvdefects = []
+
+global Sides
+Sides = []
+global Times
+Times = [time.time()]
+Duplicated = [];Clusters = []
+Clusters_found = 200*[0]
+ClusterTypes = ['EMTopoClusters','CaloTopoClusters']
+ 
+global multicall
+multicall = xmlrpclib.MultiCall( server )
+
+# set defaults
+isexpress =False
+info = False
+beambkg = False
+includenotready = False
+ladies = False
+expert = 10
+opts = {}
+run_spec = {}
+the_url = 'https://atlas-larmon.cern.ch/WebDisplayExtractor/index.py?'
+esproc=1;bulkproc=2;reproc=3;
+cleanesproc=101;cleanbulkproc=102;
+cluster_threshold = 50;
+cluster_E = 'Et>10GeV'
+
+global rawchannels
+global calocells
+global sporadic
+global larcellempty
+global clusters
+
+c = cgi.FieldStorage()
+########################print c
+for i in c.keys():
+  v = c.getvalue(i)
+  if i=='info': info = int(v)
+  elif i=='ladies': ladies = int(v)
+  elif i=='beambkg': beambkg = True
+  elif i=='expert': expert = 14
+  elif i=='rawchannels': rawchannels = True
+  elif i=='calocells': calocells = True
+  elif i=='sporadic': sporadic = True
+  elif i=='larcellempty': larcellempty = True
+  elif i=='clusters': clusters = True
+  elif i in ['DET','AC','SAM']: opts[i] = v
+  elif i=='cluster_threshold': cluster_threshold = int(v)
+  elif i=='includenotready': includenotready = True
+  elif i=='cluster_E': cluster_E = v
+  else: run_spec[i] = v
+  the_url += i+'='+v+'&'
+  lce_inputfile="LCE/BadCellList_run%s.txt"%run_spec['low_run']
+
+########################################################################################
+print '''
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>LAr WebDisplay Extractor</title>
+<meta name="author" content="Mathieu Plamondon [Mathieu.Plamondon@cern.ch]"/>
+<link rel="icon" type="image/vnd.microsoft.icon" href="../favicon.ico" />
+<link rel="Stylesheet" href="styles.css" type="text/css" />
+<script type="text/javascript" src="scripts_ref.js"></script>
+<base target="_blank">
+</head>
+<body>
+<div class="wrapper"><br />
+<a href="https://atlasop.cern.ch/atlas-point1/twiki/bin/view/Main/LArWebDisplayExtractor" style="color:#000000;font-size:20pt;font-weight:bold" title="click to access the twiki">LAr WebDisplay Extractor <font color=red>Prod Version</font>  </a>'''
+#print '<font style="color:#FF0000">WARNING: Stuff might break unexpectedly... Development and tests in progress</font><br>'
+#<img src="twiki.gif" style="width:50px" alt="twiki"/></a><br />
+
+#########################################################################################
+
+if not 'rawchannels' in dir() and not 'calocells' in dir() and not 'sporadic' in dir() and not 'larcellempty' in dir() and not 'clusters' in dir(): 
+  rawchannels = True
+  calocells = True
+  sporadic = True
+  larcellempty = True
+  clusters = True
+else:
+  if not 'rawchannels' in dir(): rawchannels = False
+  if not 'calocells' in dir(): calocells = False
+  if not 'sporadic' in dir(): sporadic = False
+  if not 'larcellempty' in dir(): larcellempty = False
+  if not 'clusters' in dir(): clusters = False
+
+the_url = the_url.rstrip('?').rstrip('&')
+if not run_spec.has_key('proc_ver'): run_spec['proc_ver'] = 1
+else:  run_spec['proc_ver'] = int(run_spec['proc_ver']) 
+if run_spec.has_key('stream'):
+  if run_spec['stream']=='express': run_spec['stream']='express_express'
+  else: run_spec['stream'] = 'physics_'+run_spec['stream']
+else: run_spec['stream'] = 'physics_CosmicCalo'
+if not run_spec.has_key('source'): run_spec['source'] = 'tier0'
+
+if run_spec.has_key('low_run'):
+  run_spec['high_run'] = run_spec['low_run']
+  multicall.get_runs_streams(run_spec)
+  results = multicall()
+  if len(results[0])==0:
+    print "<h3><font color=red>&#8224 RUN '%s' DOES NOT EXIST</font></h3>"%(run_spec['low_run'])
+    sys.exit()
+
+
+
+if info == 0:  #RunReport
+  if ladies == 1 :  #ladies-bulk
+    run_spec['stream'] = 'physics_JetTauEtmiss'
+    run_spec['proc_ver'] = 1
+    isexpress = False
+    run_spec['source'] = 'tier0'
+    pass_letter = 'f'
+    if run_spec.has_key('low_run'):
+      run_info = server.get_run_information(run_spec)
+      run_tag  = run_info[run_spec['low_run']]
+      run_tag_string = run_tag[1]
+      if 'data13' in run_tag_string:
+        run_spec['stream'] = 'physics_HardProbes'
+  
+  elif ladies == 0:  #ladies-express
+    run_spec['stream']='express_express'
+    run_spec['proc_ver'] = 1
+    isexpress = True
+    run_spec['source'] = 'tier0'
+    pass_letter = 'x'
+
+  #expert options
+  elif ladies == 2:
+    isexpress = True
+    pass_letter = 'x'
+  else:
+    isexpress = False
+    pass_letter = 'f'
+    
+  #else:
+  #  if run_spec['stream'] == 'physics_CosmicCalo':
+  #    if  run_spec['proc_ver'] == 1: isexpress = True
+  #    #elif run_spec['proc_ver'] == 2: isexpress = True
+  #    else: isexpress = False
+  #  elif run_spec['stream'] == 'express_express':
+  #    if  run_spec['proc_ver'] == 1: isexpress = True
+  #    else: isexpress = False
+  #  else:  isexpress = False
+      
+    
+else:  #NoisyCells
+  if ladies == 1 : #ladies-bulk
+    run_spec['stream'] = 'physics_CosmicCalo'
+    run_spec['proc_ver'] = 102
+    isexpress = False
+    run_spec['source'] = 'test'
+    pass_letter ='f'
+    multicall.get_runs_streams(run_spec)
+    results = multicall()
+    if len(results[0])==0:
+        run_spec['proc_ver'] = 1
+        run_spec['source'] = 'tier0'
+        print "<font color=red>You are using the basic tier0 output. If more than 10-20 UPD3 channels are proposed, you should perform a cleaning to confirm this diagnostic.</font>"
+
+      
+  
+  elif ladies == 0: #ladies-express
+    run_spec['stream']='physics_CosmicCalo'
+    run_spec['proc_ver'] = 111
+    isexpress = True
+    run_spec['source'] = 'larcomm'
+    pass_letter = 'x'
+    multicall.get_runs_streams(run_spec)
+    results = multicall()
+    if len(results[0])==0:
+      run_spec['proc_ver'] = 101
+      run_spec['source'] = 'test'
+      multicall.get_runs_streams(run_spec)
+      results = multicall()
+      if len(results[0])==0:
+        run_spec['proc_ver'] = 1
+        run_spec['source'] = 'tier0'
+ 
+
+  #expert options
+  elif ladies == 2:
+    isexpress = True
+    pass_letter = 'x'
+  else:
+    isexpress = False
+    pass_letter ='f'
+
+if run_spec.has_key('low_run') and run_spec['proc_ver'] == 1:
+  mapping = server.get_procpass_amitag_mapping(run_spec)
+  #print mapping
+  Proc_ver = []
+  run_list = mapping[run_spec['low_run']]
+  for i,item in enumerate(run_list):
+    #    print item,"<br>"
+    check_tag = False
+    for f,field in enumerate(item):
+      if f == 0:
+        proc = field
+      if f == 1:
+        if field == run_spec['stream']:
+          check_tag = True
+      if (f == 2 and check_tag == True):
+        tag = field[:1]
+        if tag == pass_letter: Proc_ver.append(proc)
+        elif tag == 'o':
+           if 'x' in field: Proc_ver.append(proc)
+  #print Proc_ver,"<br>"
+  if not Proc_ver :
+    print "<h3><font color=red>&#8224 BULK FOR RUN '%s' NOT YET FINISHED</font></h3>"%(run_spec['low_run'])
+    sys.exit()
+  else: run_spec['proc_ver'] = max(Proc_ver)
+
+  
+#print run_spec
+    
+
+#if not opts.has_key('shifter'): opts['shifter'] = 'shifter'
+f0 = os.stat(dbfile)
+f1 = os.stat('index.py')  
+
+
+########################################################################
+class dcs(Thread):
+  def __init__(self):
+    Thread.__init__(self)
+
+  def run(self):
+
+    athena_version = "17.2.6"
+    import subprocess as sp
+    cmd="export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup;"
+    cmd+="source $AtlasSetup/scripts/asetup.sh %s,32,here;"%(athena_version)
+    cmd+='/afs/cern.ch/user/l/larmon/public/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/detStatus_query.py --folder /GLOBAL/DETSTATUS/DCSOFL --r=%s "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_GLOBAL;dbname=COMP200;user=ATLAS_COOL_READER;password=COOLRED4PRO" HEAD EM HEC FCAL;'%(run_spec['low_run'])
+    P = sp.Popen(cmd,shell=True,stdout=sp.PIPE,stderr=sp.PIPE)
+    self.DCSflags = P.communicate()
+
+
+########################################################################
+# i[12:16] = [[-3s,+3s,LB,Sat.Q],[Eth,5s,DB,Q],[E>20,LB,Q],[<E>,E>1,LB,Q],DR]
+# R[0:4] = [[-3s,+3s,LB,Sat.Q],[Eth,5s,DB,Q],[E>20,LB,Q],[<E>,E>1,LB,Q],DR]
+########################################################################
+
+#proposed_flag
+#import prop_flag
+
+#print top 
+import print_top
+
+#print rows
+#import print_rows
+
+#Print Selection
+#Add report button
+import selection
+
+#Listify
+#RunReport
+import run_report
+
+#noisycells
+import noisycells
+
+########################################################################
+def ShowPlots():
+  size = 300 
+  if len(Sides)>1: size = 250 
+  print '<div id="plots">\n'
+  print '<br />\n'
+  for i in ClusterTypes:
+    if info==1: print "<br><b>",i,"</b><br>"
+    for j in Sides:
+      if i == "EMTopoClusters":
+        if cluster_E == 'Et>5GeV': tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_EMclus_etaphi_Et_thresh1@JJJ'.replace('III',i).replace('JJJ',j)
+        elif cluster_E == 'E>5GeV': tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_EMclus_EtavsPhi1@JJJ'.replace('III',i).replace('JJJ',j)
+        elif cluster_E == 'E>10GeV': tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_EMclus_EtavsPhi2@JJJ'.replace('III',i).replace('JJJ',j)
+        else: tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_EMclus_etaphi_Et_thresh2@JJJ'.replace('III',i).replace('JJJ',j)
+      if i == "CaloTopoClusters":
+        if cluster_E == 'Et>5GeV': tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_clus_etaphi_Et_thresh1@JJJ'.replace('III',i).replace('JJJ',j)
+        elif cluster_E == 'E>5GeV': tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_EtavsPhi1@JJJ'.replace('III',i).replace('JJJ',j)
+        elif cluster_E == 'E>10GeV': tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_EtavsPhi2@JJJ'.replace('III',i).replace('JJJ',j)
+        else: tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_clus_etaphi_Et_thresh2@JJJ'.replace('III',i).replace('JJJ',j)
+        #tmp_url = url+'/CaloMonitoring/CaloMonShift/CaloMonJJJ/IIIJJJ/m_clus_etaphi_Et_thresh2@JJJ'.replace('III',i).replace('JJJ',j)
+      print ('<a href="AA"><img style="width:%dpx" src="AA.png" /></a>\n'%(size)).replace('AA',tmp_url)
+    if len(Sides)>1: print '<br />'                                                                                             
+  print '<br />\n</div>\n'
+   
+#########################################################################################
+#print '''
+#<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+#<html xmlns="http://www.w3.org/1999/xhtml">
+#<head>
+#<title>LAr WebDisplay Extractor</title>
+#<meta name="author" content="Mathieu Plamondon [Mathieu.Plamondon@cern.ch]"/>
+#<link rel="icon" type="image/vnd.microsoft.icon" href="../favicon.ico" />
+#<link rel="Stylesheet" href="styles.css" type="text/css" />
+#<script type="text/javascript" src="scripts_dev.js"></script>
+#<base target="_blank">
+#</head>
+#<body>
+#<div class="wrapper"><br />
+#<a href="https://atlasop.cern.ch/atlas-point1/twiki/bin/view/Main/LArWebDisplayExtractor" style="color:#000000;font-size:20pt;font-weight:bold" title="click to access the twiki">LAr WebDisplay Extractor <font color=red>Version 3.8</font>  </a>'''
+##print '<font style="color:#FF0000">WARNING: Stuff might break unexpectedly... Development and tests in progress</font><br>'
+##<img src="twiki.gif" style="width:50px" alt="twiki"/></a><br />
+#########################################################################################
+
+
+#if ladies == 1 and not run_spec['proc_ver'] == 102 :
+    #procpass = server.get_next_proc_pass(run_spec['low_run'],run_spec['stream'],'tier0')
+    #print procpass
+    #proc_ver = procpass-1
+    #run_spec['proc_ver'] = proc_ver 
+
+selection.PrintSelection(run_spec,info,cluster_threshold,beambkg,expert,includenotready,ladies,cluster_E)
+
+if run_spec.has_key('low_run'):
+  import sqlite3
+  conn = sqlite3.connect('LArId.db')
+  cursor = conn.cursor()
+
+  run_string = (run_spec['low_run']).strip(); run_spec['low_run'] = run_string
+
+  # first line of upload defect text file
+  defects.append("@%s"%run_spec['low_run'])
+
+  #if run_spec['proc_ver'] == 1: defects.append("LAR_FIRSTDEFECTS_UNCHECKED G # Express processing defects uploaded")
+  if isexpress: defects.append("LAR_FIRSTDEFECTS_UNCHECKED G # Express processing defects uploaded")
+
+  # set web display links
+  global url
+  url = 'https://atlasdqm.cern.ch/webdisplay/%s/%d/%s/run_%s/run/' % (run_spec['source'],run_spec['proc_ver'],run_spec['stream'],run_spec['low_run'])
+
+  if not run_spec.has_key('high_run'):# or info!=0: 
+    run_spec['high_run'] = run_spec['low_run']
+    #multicall.get_runs_streams(run_spec)
+      
+    #results = multicall()
+    #if len(results[0])==0:
+    #  print "<h3><font color=red>&#8224 RUN '%s' DOES NOT EXIST</font></h3>"%(run_spec['low_run'])
+    #  sys.exit()
+
+    _stream = run_spec['stream']
+    for i in results[0][run_spec['low_run']]: 
+      if _stream in i: _stream=i   
+    if 'tmp_' in _stream:
+      url = url.replace(run_spec['stream'],_stream) 
+      run_spec['stream'] = _stream
+      print "<font color=red>WARNING</font>: <b>DO NOT FILL the DEFECT DB YET</b>. The processing of this run is still ongoing. You will get partal info. Some LBs might be missing.<br><br>"
+  ## Display info depending on the menu:
+  ## 0: Run Report
+  ## 1: Noisy LAr Cells
+  try:
+    ## Run Report Menu
+    if info==0:
+      
+      print '</form>\n'
+      
+      DataIntegrityProblem = ['Parity','BCID','Sample Header','EVTID','SCAC status','SCA out of range','Gain mismatch','Type mismatch','# of samples','Empty data block','Checksum/block size','Missing header','Bad gain']
+      ## Retrieve RED LBs from DCS
+      DCS = dcs()
+      DCS.start()
+      DCS.join()
+      d = DCS.DCSflags[0].replace('\n','<br>')
+      # if RED, store partition and affected LBs
+      # EMBA : [ 174693 , 1 ] - [ 174693 , 19 ]
+      RE = re.compile(r'(?P<PART>\S+)\s*\:\s*\[\s*(?P<RUN1>\S+)\s*\,\s*(?P<LB1>\S+)\s*\]\s*\-\s*\[\s*(?P<RUN2>\S+)\s*\,\s*(?P<LB2>\S+)\s*\]')
+      test = d.split('HEAD')[1].split(')')
+      for item in test:
+        if not 'RED' in item: continue
+        st = item.split('RED')[0].replace('<br>','')
+        m = RE.search(st).groupdict()
+        for lb in range(int(m['LB1']),int(m['LB2'])):
+          if DCSGET.has_key(m['PART']): DCSGET[m['PART']].append(lb)
+          else: DCSGET[m['PART']] = [lb]
+   
+
+      #print DCSGET
+      #print "Mark 2 <br>"
+      #print m['PART']
+      #get_dqmf_summary_flags_lb(run_spec, PART, COMP200_DCS, HEAD)
+
+      ## Link to HV Trips DB & DCS
+      #print "DQ flags from DCS automatically retrieved"
+      #print '<input type="button" value="Check DCS flags" onclick=DCSQuery(%s) />'%(run_spec['low_run'])
+      #print '<input type="button" value="Check HV Trips DB" onclick="HVTripsDB()"/>'
+
+      Part = ['EMBA','EMBC','EMECA','EMECC','HECA','HECC','FCALA','FCALC']
+      for P in Part:
+        new_dcs = server.get_dqmf_summary_flags_lb(run_spec,P,"DCSOFL","HEAD")
+      
+
+      ## Now get run report
+      print '<br><table class="report">\n'
+
+      run_report.RunReport(run_spec,multicall,url,DCSGET,defects,includenotready,esproc,cleanesproc,bulkproc,cleanbulkproc,isexpress)
+ 
+      print '</table>\n'
+
+      # Finally, add report button
+      selection.AddReportButton(defects,run_spec,info,beambkg)
+
+    ## Noisy LAr Cells Menu
+    else:
+      run_spec['high_run'] = run_spec['low_run']
+      #print "<font color=red><h3>Warning: DQ checks based on TopoClusters only !</h3></font><br>"
+      
+      clusters=True
+      print '<table class="list">\n' 
+      print_top.PrintFields(expert)
+      print_top.PrintTopRow(expert,opts,rawchannels,calocells,sporadic,larcellempty,clusters)
+      noisycells.NoisyLArCells(run_spec,opts,Sides,rawchannels,calocells,sporadic,larcellempty,clusters,Clusters,Duplicated,cluster_threshold,Clusters_found,lce_inputfile,expert,cursor,url,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,beambkg,isexpress,cluster_E)
+      print '</table>\n</form>\n'
+      # Add report button
+      selection.AddReportButton(defects,run_spec,info,beambkg)
+
+      
+  except ValueError:
+    print 'ValueError:',ValueError
+  except:
+    print 'Unexpected error:', sys.exc_info()
+    print '<br />Problem encountered: a bug report has been sent<br />'
+    #os.system('echo "%s\n%s" | mail -s "WebExtractor problem" christopher.marino@cern.ch' % (the_url,sys.exc_info()))
+    
+  ShowPlots()
+  conn.close()
+else:
+  print '<table class="list">\n' 
+  print_top.PrintFields(expert)
+  print_top.PrintTopRow(expert,opts,rawchannels,calocells,sporadic,larcellempty,clusters)
+  print '</table>\n</form>\n'
+
+## here is the section to print non-matched clusters
+Times.append(time.time())
+print '<div id="help" style="background:#CCCCCC">\n'
+if clusters and info!=0:
+  #print '<br>Non-matched clusters:<hr><pre>'
+  first = 1
+  for cl in range(len(Clusters)):
+    CL = Clusters[cl]
+    if Clusters_found[cl]==0:
+      type = CL[3].split("/")[3].split("Topo")[0]
+      if type=="EM" or CL[3].split('@')[1] != "BAR":
+        if first: print '<br>Non-matched clusters:<hr><pre>';first=0;
+        print '%s %s <a href="%s/%s" class="det2">%s</a> Nentries:%i'%(type,CL[3].split('@')[1],url,CL[3],CL[4],CL[5])
+  print '</pre>'
+  # And here, print duplicated clusters
+  if len(Duplicated)>0:
+    print 'Duplicated clusters:<hr><pre>'
+    for cl in  range(len(Duplicated)):
+      CL = Duplicated[cl]
+      type = CL[3].split("/")[3].split("Topo")[0]
+      print '%s %s <a href="%s/%s" class="det2">%s</a> Nentries:%i'%(type,CL[3].split('@')[1],url,CL[3],CL[4],CL[5])
+    print '</pre>'
+      
+## Footer
+print '''</div>
+<div class="push"></div>
+</div>
+<div class="footer">
+<hr>
+%6.1f seconds (total time) <a href="%s">Link to this query</a>, <a href="https://atlas-larmon.cern.ch/WebDisplayExtractor/logs/">logs server</a><br />
+Original developer: Mathieu Plamondon &nbsp;
+Recent dev: <a href="mailto:trocme@lpsc.in2p3.fr,christopher.marino@cern.ch">Benjamin Trocm&eacute;, Christopher Marino &nbsp;<br></a>
+Last updates: DB file (%s), script file (%s)<br>
+<br />
+</div>
+</body>
+</html>''' % (Times[-1]-Times[0],the_url,time.ctime(f0.st_ctime),time.ctime(f1.st_ctime))
+
+#if info: os.system('echo "%s" | mail -s "LArWebExtractor query %s" Mathieu.Plamondon@cern.ch' % (the_url,os.environ['HTTP_X_FORWARDED_FOR']))
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/noisycells.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/noisycells.py
new file mode 100644
index 00000000000..f018db91026
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/noisycells.py
@@ -0,0 +1,603 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+DETlist = ['EMB','EMEC','HEC','FCAL']
+dbfile = 'LArBad.db'
+from threading import Thread
+import sqlite3
+import os,re,time,sys,cgi,string,math
+import xmlrpclib
+
+passfile = open("/afs/cern.ch/user/l/larmon/public/atlasdqmpass.txt")
+passwd = passfile.read().strip(); passfile.close()  
+passurl = 'https://%s@atlasdqm.cern.ch' % passwd
+server = xmlrpclib.ServerProxy(passurl)
+
+global Parts
+Parts = []
+
+import print_rows
+import print_top
+
+ACmap = {1:'A+','1':'A+','A+':'A+',-1:'C-','-1':'C-','C-':'C-'}
+ACmap2 = {'A':1,'C':-1}
+inv_ACmap2 = {1:'A+','1':'A+','A+':'A+',-1:'C-','-1':'C-','C-':'C-'}
+dd=[0.,0.,0.,0.]
+## CaloCell bins variations to match real cells: [EMB[sampling],EMEC[sampling],HEC[sampling],FCAL[sampling]]
+de=[[0.01,0.001,0.005,0.01],[0.01,0.001,0.01,0.01],[0.001,0.001,0.001,0.001],[0.,0.02,0.1,0.1]]
+dp=[[0.01,0.003,0.005,0.02],[0.01,0.005,0.01,0.01],[0.05,0.05,0.05,0.05],[0.,0.05,0.03,0.02]]
+cols = ['OFF_ID','ONL_ID','DET','AC','FT','SL','CH','SAM','ETA','PHI','HVLINES','HVCORR','CL','TT_COOL_ID']
+
+ClusterTypes = ['EMTopoClusters','CaloTopoClusters']
+BadChannels = ['deadReadout','deadCalib','deadPhys','almostDead','short','unstable','distorted','lowNoiseHG','highNoiseHG','unstableNoiseHG','lowNoiseMG','highNoiseMG','unstableNoiseMG','lowNoiseLG','highNoiseLG','unstableNoiseLG','missingFEB','peculiarCL','problematicFor?','sporadicBurstNoise']
+
+########################################################################
+mp = ['noise_acceptance_AVG','acceptance_AVG','signal_AVG','quality_AVG','fractionOverQ','DB','5Sigma','hiEth','Quality','ENLB','EN','Warning','Error','Cluster','LCE0','LCE1','LCE2','LCE3']
+# 0:GREEN 1:RED 2:BLUE 3:PINK 4:YELLOW 5:BLACK  
+col = [1,0,2,3,3,2,1,0,3,2,1,4,1,5,0,1,2,3]
+def GetClass(plot):
+  for a in range(18):
+    if mp[a] in plot:
+     return col[a]
+
+
+########################################################################
+def get_id(c):
+  a = 7<<27
+  be=0
+  if c[0]>0: be=1
+  a |= be<<25
+  ac=0
+  if c[1]>0: ac=1
+  a |= ac<<24
+  a |= c[2]<<19
+  a |= (c[3]-1)<<15
+  a |= c[4]<<8
+  return a
+
+
+########################################################################
+class db(Thread):
+  def __init__(self,cmd,plot,par,V):
+    Thread.__init__(self)
+    self.cmd = cmd
+    self.plot = plot
+    self.par = par
+    self.V = V
+  def run(self):
+    con = sqlite3.connect('LArId.db')
+    cur = con.cursor()
+    cur.execute(self.cmd)
+    self.R = cur.fetchall()
+    con.close()
+
+########################################################################
+class mc2(Thread):
+  def __init__(self):
+    Thread.__init__(self)
+    self.multicall = xmlrpclib.MultiCall( server )
+  def run(self):
+    self.results = self.multicall()
+########################################################################
+class mc3(Thread):
+  def __init__(self,P,run_spec):
+    Thread.__init__(self)
+    self.multicall = xmlrpclib.MultiCall( server )
+    self.P = P
+    self.run_spec = run_spec
+  def run(self):
+    self.results = self.multicall()
+    ##print "DEBUG - mc3 - 1:",self.P,len(self.multicall._MultiCall__call_list),time.time(),"<br>"  
+    ##print "DEBUG - mc3 - 2:",self.multicall._MultiCall__call_list,"<br>" 
+    ##print "DEBUG - mc3 - 3:",self.results,"<br>" 
+    N = self.run_spec['low_run']
+    H = self.results[0][N]['hists']
+    calls = []
+    i=0
+    for h in H:
+      ##print "DEBUG", h,"<br>"
+      if not 'Sl' in h: continue
+      if i%50==0: calls.append( mc2() )
+      calls[-1].multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Noise/Single_Cells/Non_Gaussian_Tails/'+h)
+      i+=1
+
+    self.h2p = []
+    for c in calls: c.start()
+    for c in calls:
+      c.join()
+      for i,I in enumerate(c.multicall._MultiCall__call_list):
+        plot = I[1][-1].split('/')[-1]
+        self.h2p.append( [plot,c.results[i][N]] )
+
+
+########################################################################
+class GetLArCellEmpty(Thread):
+  def __init__(self,cluster_threshold,lce_inputfile):
+    Thread.__init__(self)
+    self.cluster_threshold = cluster_threshold
+    self.lce_inputfile = lce_inputfile
+  def run(self):
+
+    self.Chans = {}
+    f = open(self.lce_inputfile,"r")
+    for line in f:
+      fields=string.split(line)
+      
+      if fields[0]=='onlid':continue
+      # skip cells found only with algo 1
+      algo=int(fields[11])
+
+      if algo == 1: continue
+      # retrieve all cells
+      onlid = fields[0]
+      part=fields[1][0:-2]
+      side=fields[1][-1]
+      FT=int(fields[2])
+      SL=int(fields[3])
+      CH=int(fields[4])
+      evt=int(fields[6])
+      emean=float(fields[7])
+      lb=float(fields[8])
+      qf=float(fields[9])
+      lblist=fields[11].split(";")
+      comment="LB:"
+      for item in lblist:comment+=" %s"%item
+     
+      d=DETlist.index(part)
+      id = get_id((d,ACmap2[side],FT,SL,CH))
+      # store the channels
+      # cut to match the cluster threshold
+      if evt < self.cluster_threshold: continue
+      # now store the channel
+      if not self.Chans.has_key(id): self.Chans[id] = [ [],[],[],[] ]
+      self.Chans[id][0].append([int(emean),'&lt;E&gt;GeV','LCE0'])
+      self.Chans[id][1].append([evt,'Nevts&gt;1GeV','LCE1'])
+      self.Chans[id][2].append([int(lb),comment,'LCE2'])
+      self.Chans[id][3].append([int(qf*100),'%qfac&gt;4000','LCE3'])
+       
+########################################################################
+class GetRawChannels(Thread):
+  def __init__(self,run_spec,Parts):
+    Thread.__init__(self)
+    self.run_spec = run_spec
+    self.Parts = Parts
+  def run(self):
+
+    RE = re.compile(r'\S*\((?P<SSLN>\S+)\.0*\)\s*y-axis\s*\((?P<CH>\S+)\.0*\)\S+')
+    N = self.run_spec['low_run']
+    calls = []
+    Plots = ['acceptance_AVG','noise_acceptance_AVG','signal_AVG','quality_AVG']
+    for P in self.Parts:
+      calls.append( mc2() )
+      for p in Plots: calls[-1].multicall.get_dqmf_all_results(self.run_spec,'LAr/'+P+'/Noise/Single_Cells/'+P+'_'+p)
+      calls[-1].start()
+
+    self.Chans = {}
+    #print "DEBUG %i <br>"%(len(calls))
+    for c in calls:
+      c.join()
+      for i,I in enumerate(c.multicall._MultiCall__call_list):
+        plot = I[1][-1]
+        part = plot.split('/')[1]
+        d = DETlist.index(part[:-1])
+        for p,P in enumerate(Plots): 
+          if P in plot: pi=p; break
+        r = c.results[i][N]
+        K = r.keys()
+        for k in K:
+          if not 'x-axis' in k: continue
+          m = RE.search(k).groupdict()
+          SSLN = int(m['SSLN'])
+          if d: FT = (SSLN-1)/15; SL = SSLN-FT*15
+          else: FT = (SSLN-1)/14; SL = SSLN-FT*14
+          CH = int(m['CH'])
+          id = get_id((d,ACmap2[part[-1]],FT,SL,CH))
+          if not self.Chans.has_key(id): self.Chans[id] = [ [],[],[],[] ]
+          if 'noise_acceptance' in plot: self.Chans[id][1].append( [r[k],k,plot] )
+          elif 'acceptance' in plot:  self.Chans[id][0].append( [r[k],k,plot] )
+          elif 'signal' in plot: self.Chans[id][2].append( [r[k],k,plot] )
+          elif 'quality' in plot: self.Chans[id][3].append( [r[k],k,plot] )
+
+########################################################################
+class GetClusters(Thread):
+  def __init__(self,run_spec,Sides,Clusters,Duplicated,cluster_threshold,cluster_E):
+    Thread.__init__(self)
+    self.run_spec = run_spec
+    self.Sides = Sides
+    self.Clusters = Clusters
+    self.Duplicated = Duplicated
+    self.cluster_threshold = cluster_threshold
+    self.cluster_E = cluster_E
+  def run(self):
+
+    # Distance cells/clusters; 
+    DR_match = 0.2;
+    # Decoding the DQ bin output
+    RE = re.compile(r'(?P<cat>\S+)-\(eta,phi\)\[OSRatio\]=\((?P<eta>\S+),(?P<phi>\S+)\)\[(?P<sigma>\S+)\]')
+    N = self.run_spec['low_run']
+    multicall = xmlrpclib.MultiCall( server )
+
+    print "<br> Energy setting",self.cluster_E
+
+    for j in self.Sides:
+      for i in ClusterTypes:
+        if i=='EMTopoClusters':
+          if self.cluster_E == 'E>5GeV': multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_EMclus_EtavsPhi1@%s' % (j,i,j,j) )
+          elif self.cluster_E == 'E>10GeV': multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_EMclus_EtavsPhi2@%s' % (j,i,j,j) )
+          elif self.cluster_E == 'Et>5GeV': multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_EMclus_etaphi_Et_thresh1@%s' % (j,i,j,j) )
+          else: multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_EMclus_etaphi_Et_thresh2@%s' % (j,i,j,j) )
+        if i=='CaloTopoClusters':
+          if self.cluster_E == 'E>5GeV': multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_EtavsPhi1@%s' % (j,i,j,j) )
+          elif self.cluster_E == 'E>10GeV': multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_EtavsPhi2@%s' % (j,i,j,j) )
+          elif self.cluster_E == 'Et>5GeV': multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_clus_etaphi_Et_thresh1@%s' % (j,i,j,j) )
+          else: multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_clus_etaphi_Et_thresh2@%s' % (j,i,j,j) )
+          #multicall.get_dqmf_all_results(self.run_spec,'CaloMonitoring/CaloMonShift/CaloMon%s/%s%s/m_clus_etaphi_Et_thresh2@%s' % (j,i,j,j) )
+    
+    #print "DEBUG - clusters :",len(multicall._MultiCall__call_list),time.time(),"<br>"
+    R = multicall()
+
+    for i,I in enumerate(multicall._MultiCall__call_list):
+      r = R[i][N]
+      K = r.keys()
+      #print "DEBUG",r,K,"<br>"
+      for k in K:
+        if k[0] == "Y" or k[0] == "R":
+          # select clusters above threshold
+          #print "DEBUG",k,r[k],"<br>"
+          if int(r[k])<self.cluster_threshold: continue
+          m = RE.search(k).groupdict()
+          # Clusters can be both in EC and BARREL plots. Avoid double counting.
+          is_duplicate = False
+          for cl in self.Clusters:
+            #print "DEBUG CLUSTERS",cl[4],k,"<br>"
+            if k.split("=")[1] == cl[4].split("=")[1]: is_duplicate = True
+          if is_duplicate:
+            self.Duplicated.append( [float(m['eta']),float(m['phi']),DR_match,I[1][-1],k,int(r[k])] )
+          else:
+            self.Clusters.append( [float(m['eta']),float(m['phi']),DR_match,I[1][-1],k,int(r[k])] )
+            
+########################################################################
+class GetCaloCells(Thread):
+  def __init__(self,run_spec,Parts):
+    Thread.__init__(self)
+    self.run_spec = run_spec
+    self.Parts = Parts
+  def run(self):
+
+    N = self.run_spec['low_run'] 
+    RE = re.compile(r'.*=\((?P<eta>\S+),(?P<phi>\S+)\).*')
+    RE1 = re.compile(r'(?P<cat>\S+)-\(eta,phi\)\[OSRatio\]=\((?P<eta>\S+),(?P<phi>\S+)\)\[(?P<sigma>\S+)\]')
+    RE2 = re.compile(r'x-axis\s*\S*\((?P<eta>\S+)\)\s*y-axis\s*\((?P<phi>\S+)\)\)')
+    S  = {0:'P',1:'1',2:'2',3:'3'}
+    Si = {'r':0,'0':0,'1':1,'2':2,'3':3}
+    calls = []
+
+    for P in self.Parts:
+      d = DETlist.index(P[:-1])
+      calls.append( mc2() )
+      plot = 'LAr/'+P+'/Noise/Single_Cells/'
+      for s in range(4):
+        sam = 'Sampling'+str(s)
+        s2 = S[s]
+        if s==0:
+          if d==3: continue
+          if d==2: s2='0'
+          else: sam='Presampler'
+  
+        # change in plot name after run 182161
+        suffix='_hiEth'
+        comment1='Nevts&gt;Eth'
+        comment2='%qfac>4000(E&gt;Eth)'
+        if int(self.run_spec['low_run']) < 182161:
+          suffix='_4Sigma'
+          comment1='%evts&gt;4&#963'
+          comment2='%qfac>4000(E&gt;4&#963)'
+ 
+        calls[-1].multicall.get_dqmf_all_results(self.run_spec,plot+'%s/fractionOverQthVsEtaPhi_%s'%(sam,P[:-1]+s2+P[-1])+suffix )
+        calls[-1].multicall.get_dqmf_all_results(self.run_spec,plot+'%s/EnergyRMSvsDB_%s_noEth'%(sam,P[:-1]+s2+P[-1]) )
+        calls[-1].multicall.get_dqmf_all_results(self.run_spec,plot+'%s/CellOccupancyVsEtaPhi_%s_hiEth'%(sam,P[:-1]+s2+P[-1]) )
+        calls[-1].multicall.get_dqmf_all_results(self.run_spec,plot+'%s/CellOccupancyVsEtaPhi_%s_5Sigma'%(sam,P[:-1]+s2+P[-1]) )
+                    
+      calls[-1].start()
+
+    DB = []
+
+    for p,P in enumerate(self.Parts):
+      c = calls[p] 
+      c.join()
+      d = DETlist.index(P[:-1])
+      AC = P[-1]
+      for i,I in enumerate(c.multicall._MultiCall__call_list):   
+        plot = I[1][-1]
+        sam = Si[plot.split('/')[4][-1]] 
+        par = (d,AC,sam)      
+        V = [] 
+        cmd = 'select ONL_ID,ETA,PHI from LARID where DET=%d and AC=%d and SAM=%d and (' % (d,ACmap2[AC],sam)
+        r = c.results[i][N]
+        K = r.keys()
+   
+        #print "DEBUG     --->",K,"<br>"
+        for k in K:
+          if 'NBins' in k: 
+            continue
+          elif 'eta' in k:
+            m = RE.search(k).groupdict()
+          elif 'axis' in k: 
+            m = RE2.search(k).groupdict()
+            #print "DEBUG",k,"<br>"
+          else: continue  
+          if 'CellOccupancy' in plot and r[k]<50:
+            continue              
+          elif 'DB' in plot and r[k]<2000:
+            continue
+        
+          eta = float(m['eta'])
+          if d==1 and sam in [1,2]: eta+=0.0005
+          phi = float(m['phi'])
+          if AC=='A': phi-=dd[sam]
+          else:       phi+=dd[sam] 
+          limits = (eta-de[d][sam],eta+de[d][sam],phi-dp[d][sam],phi+dp[d][sam])
+          V.append([limits,r[k],k])
+          cmd += '(ETA between %f and %f and PHI between %f and %f) or ' % limits
+          #print P[:-1]+AC,sam,k,r[k],"<br>"
+        # this I am not sure what it does yet
+        if 'or' in cmd:
+          DB.append( db(cmd.rstrip(' or ')+')',plot,par,V) )
+          DB[-1].start()
+
+    
+    self.Chans = {}
+    for s in DB:
+      s.join()
+      for r in s.R:
+        id = r[0]
+        com = []
+        for v in s.V:
+          if r[1]>v[0][0] and r[1]<v[0][1]:
+            if r[2]>v[0][2] and r[2]<v[0][3]: com.append([v[1],v[2]]) 
+        if not self.Chans.has_key(id): self.Chans[id] = [[],[],[],[]]
+        for a in com:
+          if 'CellOccupancy' in s.plot:
+            if 'hiEth' in s.plot:
+              self.Chans[id][0].append( [a[0],comment1,s.plot] )
+            if '5S' in s.plot:
+              self.Chans[id][1].append( [a[0],'Nevts&gt;5&#963;',s.plot] )
+          if 'DB' in s.plot:
+            self.Chans[id][2].append( [a[0],'DB noise deviation',s.plot] )
+          if 'Qth' in s.plot:
+            self.Chans[id][3].append( [a[0]*100,comment2,s.plot] )
+ 
+########################################################################
+class GetSporadic(Thread):
+  def __init__(self,run_spec,Parts):
+    Thread.__init__(self)
+    self.run_spec = run_spec
+    self.Parts = Parts
+  def run(self):
+
+    N = self.run_spec['low_run'] 
+    RE0 = re.compile(r'FT(?P<FT>\S+)Sl(?P<SL>\S+)Ch(?P<CH>\S+)')
+    RE1 = re.compile(r'\((?P<LB>\S+)\.0*\)')
+    calls = []
+    for P in self.Parts:
+      calls.append( mc3(P,self.run_spec) )
+      calls[-1].multicall.get_dqmf_sub_assessments(self.run_spec,'LAr/'+P+'/Noise/Single_Cells/Non_Gaussian_Tails')
+      calls[-1].start()
+
+    self.Chans = {}
+    LBs = {}
+
+    for p,P in enumerate(self.Parts):
+      calls[p].join()
+      plot = 'LAr/'+P+'/Noise/Single_Cells/Non_Gaussian_Tails/'
+      for h in calls[p].h2p:
+        m = RE0.search(h[0].split('_')[0]).groupdict()
+        SL = int(m['SL'])
+        FT = int(m['FT'])
+        CH = int(m['CH'])
+        d = DETlist.index(P[:-1])
+        id = get_id((d,ACmap2[P[-1]],FT,SL,CH))
+        dev = 0.
+        if h[1].has_key('SideBands'):
+       
+          if 'EN' in plot+h[0]:
+            title = "E>5-15GeV"
+          else:
+            title = "Qfac>4000"            
+          dev = float(h[1]['SideBands'])
+          if str(dev)=='nan': dev=-0.01
+        elif h[1].has_key('NBins'): 
+          title = 'LB: '
+          dev = int(h[1]['NBins'])
+          LB = []
+          for lb in h[1].keys():
+            if 'NBins' in lb: continue
+            m = RE1.search(lb).groupdict()
+            LB.append( int(m['LB']) )
+            title+=m['LB']+' '
+          LBs[id] = LB
+        if not self.Chans.has_key(id): self.Chans[id] = [ [],[],[] ]
+        if 'ENLB' in h[0]: self.Chans[id][1].append( [dev,title,plot+h[0]] )
+        elif 'EN' in h[0]: self.Chans[id][0].append( [dev,title,plot+h[0]] )
+        else: self.Chans[id][2].append( [100*dev,title,plot+h[0]] )
+
+    """
+    f = file('reports/%s.txt'%(N),'r')
+    while not 'Remove' in f.readline(): pass
+    removed_LBs = []
+    b = f.readline().split()
+    for i in b:
+      if '-' in i:
+        a = i.split('-')
+        for j in range(int(a[0]),int(a[1])+1): removed_LBs.append( int(j) )
+      else: removed_LBs.append( int(i) )
+
+    from copy import copy
+    for id in LBs.keys():
+      LB = LBs[id]
+      LB.sort()
+      LB1 = copy(LB)
+      #for lb in LBs[id]:
+      #  if lb in removed_LBs: LB1.remove(lb)
+      #if len(LB1)==0: self.Chans.pop(id) 
+      #else:
+      for ch in self.Chans[id]: ch.append(str(LB1))
+    """          
+
+########################################################################
+def NoisyLArCells(run_spec,opts,Sides,rawchannels,calocells,sporadic,larcellempty,clusters,Clusters,Duplicated,cluster_threshold,Clusters_found,lce_inputfile,expert,cursor,url,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,beambkg,isexpress,cluster_E):
+
+ 
+  # Queries 
+  DETs = range(4)
+  if opts.has_key('DET'):
+    if clusters: 
+      if int(opts['DET'])==0: DETs = [0]
+      else: DETs = [1,2,3]
+    else: DETs = [int(opts['DET'])]
+  sides = ['A','C']
+  if opts.has_key('AC'): 
+    if clusters and 0 in DETs: pass
+    else: sides = [ACmap[opts['AC']][0]]
+
+  lce_exists = True
+  lce_message = False
+  try:open(lce_inputfile)
+  except IOError:
+    print '<h3><font color=red>WARNING:  LArCellEmpty file not found!'
+    lce_exists = False
+    lce_message = True
+  if lce_exists:  
+    size = os.path.getsize(lce_inputfile)
+    if (size < 1000):
+      print '<h3><font color=red>WARNING:  LArCellEmpty file is very small!'
+      lce_message = True
+  if not larcellempty:
+    print '<h3><font color=red>WARNING:  LArCellEmpty channels were not retrieved!'
+    lce_message = True
+  if lce_message and (not isexpress): print 'This is however not problematic for the bulk, as this output is not used for flagging proposal.</font></h3>'
+  else: print '</font></h3>'
+
+  for d in DETs:    
+    for AC in sides:      
+      Parts.append( DETlist[d]+AC )      
+  if 'EMECC' in Parts or 'HECC' in Parts or 'FCALC' in Parts: Sides.append('ECC')
+  if 'EMBA'  in Parts or 'EMBC' in Parts: Sides.append('BAR')
+  if 'EMECA' in Parts or 'HECA' in Parts or 'FCALA' in Parts: Sides.append('ECA')
+
+  # fetch DQ results
+  jobs = [0,0,0,0]
+  if rawchannels: raw = GetRawChannels(run_spec,Parts); raw.start(); jobs[0] = raw
+  if calocells: calo = GetCaloCells(run_spec,Parts); calo.start(); jobs[1] = calo
+  if sporadic: spo = GetSporadic(run_spec,Parts); spo.start(); jobs[2] = spo
+  if larcellempty: lce = GetLArCellEmpty(cluster_threshold,lce_inputfile); lce.start();jobs[3] = lce
+  if clusters: clus = GetClusters(run_spec,Sides,Clusters,Duplicated,cluster_threshold,cluster_E); clus.start()
+
+
+  # fetch badchannels
+  Bad = [{},{},{},{}]
+  run = int(run_spec['low_run'])
+  if run>0:
+    b_conn = sqlite3.connect(dbfile)
+    b_cursor = b_conn.cursor()
+    for u,upd in enumerate(['1','4']):
+      for b,bad in enumerate(['BadChannels','MissingFEBs']):
+        b_cursor.execute('select status from %s where %d>=since and %d<=until'%(bad+'UPD'+upd,run,run))
+        for d in b_cursor.fetchall(): Bad[2*u+b].update(eval(str(d[0])))
+    b_conn.close()
+
+  # Get results
+  R = []
+  Chans = set([])
+  for i,j in enumerate(jobs):
+ 
+    if j==0: continue
+    j.join()
+    try: j.Chans.keys()
+    except:
+      print '<h3><font color=red> Histograms are not found.  Please verify that the plots in the webdisplay exist. </font></h3>'
+      sys.exit()
+    C = j.Chans.keys()
+    for ch in C:Chans.add(ch)
+
+  R1 = []
+  if len(Chans)>0:
+    cmd = 'select '+','.join(cols[:expert])+',FEB_ID from LARID where ONL_ID in ('    
+    for ch in Chans: cmd += '%d,'%(ch)   
+    cursor.execute(cmd.rstrip(',')+')')   
+    R1 = cursor.fetchall()
+ 
+  R2 = []
+  for r in R1:
+    id = r[1]
+    feb_id = r[-1]
+    upd1=[0,0] 
+    if Bad[0].has_key(id): upd1[0] = Bad[0][id] 
+    if Bad[1].has_key(feb_id): upd1[1] = Bad[1][feb_id]
+    upd4=[0,0] 
+    if Bad[2].has_key(id): upd4[0] = Bad[2][id] 
+    if Bad[3].has_key(feb_id): upd4[1] = Bad[3][feb_id]
+    i = list(r[:-1])+[ upd1,upd4, [[],[],[],[]] , [[],[],[],[]] , [[],[],[]] ,[[],[],[],[]] ,-1 ]
+    for j,J in enumerate(jobs):
+      if J:
+        if J.Chans.has_key(id):
+          i[expert+2+j] = J.Chans[id]
+          #print "JL DEBUG",j,J,id,i,"<br><br>"
+    R2.append(i)
+
+  if not clusters:
+    print_rows.PrintRows(beambkg,clusters,url,run_spec,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,expert,R2)
+
+  else:
+
+    clus.join()
+    from math import pi,sqrt
+    R_used = len(R2)*[0]
+
+    for cl in Clusters:
+      R3 = []
+     
+      clusterType=cl[3].split("/")[3].split("Topo")[0]
+      for i in R2:
+        eta = i[8]
+        phi = i[9]
+        det = i[2]
+        sampling = i[7]
+       
+        #print "  DEBUG Cells",clusterType,i[1],i[2],i[3],i[7],"<br>"
+        #print "DEBUG CLUSTERS",cl,"<br>"
+        ##### WARNING: issue with EMTopo
+        #: use CaloTopo Only ##### 
+        #if clusterType=="EM":continue
+        ##### Match EM clusters with EMB,EMEC cells #####
+        ##### Match TopoClusters with HEC,FCAL cells #####
+        if clusterType=="EM" and not(det==0 or det ==1):continue
+        if clusterType=="Calo" and not(det==2 or det==3):continue
+       
+        if i[3]>0: phi-=dd[i[7]]
+        else:      phi+=dd[i[7]]
+        deta = abs( eta-cl[0] )
+        dphi = abs( phi-cl[1] )
+        if dphi>2*pi: dphi-=2*pi
+        dR = sqrt(deta*deta+dphi*dphi)
+       
+        if dR<cl[2]:
+          Clusters_found[ Clusters.index(cl) ] += 1
+          R_used[ R2.index(i) ] += 1
+          i[-1] = dR
+          R3.append(i)
+ 
+      if cl[4][0] == "Y":Class = GetClass("Warning")
+      if cl[4][0] == "R":Class = GetClass("Error")
+
+      if len(R3)>0:
+        print '<tr><td colspan="%d"><font style="color:#FFFFFF">%s</font>&nbsp;:&nbsp;<a class="det%d" href="%s/%s">%s &nbsp; %d</a></td></tr>' % (expert+7,cl[4],Class,url,cl[3],cl[3].split('Clusters')[0].split("/")[3],cl[5])
+
+        print_rows.PrintRows(beambkg,clusters,url,run_spec,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,expert,R3)
+
+    print_top.PrintFields(expert)
+    R4 = []
+
+    for i in range(len(R2)): 
+      if R_used[i]==0: R4.append( R2[i] )
+    print_rows.PrintRows(beambkg,clusters,url,run_spec,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,expert,R4)
+
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/print_rows.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/print_rows.py
new file mode 100644
index 00000000000..8a779ebd08d
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/print_rows.py
@@ -0,0 +1,320 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+ACmap = {1:'A+','1':'A+','A+':'A+',-1:'C-','-1':'C-','C-':'C-'}
+BadChannels = ['deadReadout','deadCalib','deadPhys','almostDead','short','unstable','distorted','lowNoiseHG','highNoiseHG','unstableNoiseHG','lowNoiseMG','highNoiseMG','unstableNoiseMG','lowNoiseLG','highNoiseLG','unstableNoiseLG','missingFEB','peculiarCL','problematicFor?','sporadicBurstNoise']
+BadFEBs = {0:'deadAllBit',1:'deadReadoutBit',2:'inErrorBit',3:'deactivatedInOKSBit',16:'maskParity',17:'maskBCID',18:'maskSampleHeader',19:'maskEVTID',20:'maskScacStatus',21:'maskScaOutOfRange',22:'maskGainMismatch',23:'maskTypeMismatch',24:'maskNumOfSamples',25:'maskEmptyDataBlock',26:'maskDspBlockSize',27:'maskCheckSum',28:'maskMissingHeader',29:'maskBadGain'}
+DETlist = ['EMB','EMEC','HEC','FCAL']
+global CHANNELS
+CHANNELS={}
+import string,math
+
+########################################################################
+mp = ['noise_acceptance_AVG','acceptance_AVG','signal_AVG','quality_AVG','fractionOverQ','DB','5Sigma','hiEth','Quality','ENLB','EN','Warning','Error','Cluster','LCE0','LCE1','LCE2','LCE3']
+# 0:GREEN 1:RED 2:BLUE 3:PINK 4:YELLOW 5:BLACK  
+col = [1,0,2,3,3,2,1,0,3,2,1,4,1,5,0,1,2,3]
+def GetClass(plot):
+  for a in range(18):
+    if mp[a] in plot:
+     return col[a]
+
+
+########################################################################
+def BeamBackground(phicell,beambkg):
+  if not beambkg:
+    return False
+  else:
+    dphi = 0.25
+    if abs(phicell) < dphi: return True
+    if abs(phicell-math.pi)< dphi*2: return True
+    if abs(phicell+math.pi)< dphi*2: return True
+    return False
+    
+
+##########################################################################
+def ProposedFlag(beambkg,run_spec,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,expert,r):
+
+  ## Check if a cell has DB status different from noisy
+  ECAL_flag = -1
+  for k in [expert,expert+1]:   
+    if r[k][0]&(0x7927F)!=0x0: ECAL_flag = 1
+  
+  ## Check if cell already flagged in UPD4
+  ## Sporadic: bit 19 (0x80000)
+  ## HighNoise: bit 8 (0x100)
+  UPD4_flag = -1
+  for k in [expert,expert+1]:   
+    if r[k][0]&(0x80000)!=0x0: UPD4_flag = 1
+    if r[k][0]&(0x100)!=0x0: UPD4_flag = 1
+
+  ## Check if it's bulk or not
+  IsBulk = -1
+  if (run_spec['proc_ver'] == bulkproc or run_spec['proc_ver'] == cleanbulkproc or run_spec['proc_ver'] == reproc): IsBulk = 1
+  if run_spec['proc_ver'] == 103: IsBulk =1
+
+  ## Get cluster matched variable
+  dR = r[-1]
+
+  ## Store results of each DQ test
+  R = [ [-1,-1,-1,-1] , [-1,-1,-1,-1] , [-1,-1,-1] , [-1,-1,-1,-1] ]
+  for i in range(4):
+    for j in range(len(R[i])):
+      if len(r[i+expert+2][j])>0: R[i][j] = r[i+expert+2][j][0][0]
+      
+  ## change flag by clicking on a cell
+  flag = '<td onclick="ToggleFlag(this)" '
+
+  ###################################
+  ## Automatic diagnosis for Cells ##
+  ###################################
+
+  sporadic_threshold = 50
+  sporadic_threshold_lce = 500
+  
+  ### Set flags for noisy cells associated to clusters
+  if dR>0:
+    ## check CaloCells column
+    if R[1][0]>0 and R[1][1]>0:
+
+      if R[1][3]>0:
+        qfclean= R[1][0]-(R[1][0]*R[1][3])/100
+
+        if qfclean < sporadic_threshold:
+
+          if not BeamBackground(float(r[9]),beambkg): # Mask beam background only for sporadic cells
+            flag += 'style="background-color:#FF6600">sporadicBurstNoise'
+          else:
+            #flag += 'style="background-color:#009900">BeamBkg'
+            flag += 'style="background-color:#FF6600">sporadicBurstNoise'
+        else:
+          flag += 'style="background-color:#FF0000">highNoiseHG'
+      else:
+        flag += 'style="background-color:#FF0000">highNoiseHG' 
+
+    ## check Sporadic column
+    elif R[2][0]>0:
+
+      if R[2][2]>0:
+        qfclean= R[2][0]-(R[2][0]*R[2][2])/100
+        if qfclean < sporadic_threshold:
+          if not BeamBackground(float(r[9]),beambkg): # Mask beam background only for sporadic cells
+            flag += 'style="background-color:#FF6600">sporadicBurstNoise'
+          else:
+            flag += 'style="background-color:#009900">BeamBkg'             
+        else:
+          flag += 'style="background-color:#FF0000">highNoiseHG'
+      else:
+        flag += 'style="background-color:#FF0000">highNoiseHG'
+    ## check flag from LArCellEmpty column
+    ## (ES) or (bulk if not already flagged in UPD4)
+    elif (R[3][1]>0 and IsBulk<0) or (R[3][1]>0 and IsBulk>0 and UPD4_flag<0):
+
+      if BeamBackground(float(r[9]),beambkg): # Mask beam background for all cells
+        flag += 'style="background-color:#009900">BeamBkg'             
+      else:
+        if R[3][3]>0:
+          qfclean= R[3][1]-(R[3][1]*R[3][3])/100
+          if qfclean < sporadic_threshold_lce:
+            flag += 'style="background-color:#78c7c7">sporadicBurstNoise'
+          else:
+            flag += 'style="background-color:#307D7E">highNoiseHG'
+        else:
+          flag += 'style="background-color:#307D7E">highNoiseHG'
+
+
+   ##############################################################      
+   ### Set flags for some cells even if not responsible for clusters        
+  else:
+    ##check CaloCell column
+    if R[1][0]>100:
+    #if R[1][0]>50:    
+      if BeamBackground(float(r[9]),beambkg):
+        flag += 'style="background-color:#009900">BeamBkg'
+      else:
+        if R[1][3]>0:
+          if R[1][3]>0.8:
+            flag += 'style="background-color:#FF6600">sporadicBurstNoise'
+          else:   
+            flag += 'style="background-color:#FF0000">highNoiseHG'
+        else:
+          flag += 'style="background-color:#FF0000">highNoiseHG'
+    
+    ## check Sporadic column
+    elif R[2][0]>0:
+      if R[2][2]>0:
+        qfclean= R[2][0]-(R[2][0]*R[2][2])/100
+        if qfclean < sporadic_threshold*10:
+          if not BeamBackground(float(r[9]),beambkg):
+            flag += 'style="background-color:#FF6600">sporadicBurstNoise'
+          else:
+            flag += 'style="background-color:#009900">BeamBkg'                                 
+        else:
+          flag += 'style="background-color:#FF0000">highNoiseHG'
+      else:
+        flag += 'style="background-color:#FF0000">highNoiseHG'
+    ## check flag from LArCellEmpty column
+    ## (ES) or (bulk if not already flagged in UPD4)
+    elif (R[3][0]>3 and IsBulk<0): #or (R[3][0]>3 and IsBulk>0 and UPD4_flag<0):      
+      if BeamBackground(float(r[9]),beambkg):
+        flag += 'style="background-color:#009900">BeamBkg'                     
+      else:
+        if R[3][3]>0:
+          qfclean= R[3][1]-(R[3][1]*R[3][3])/100
+          if qfclean < sporadic_threshold_lce*10:
+            flag += 'style="background-color:#78c7c7">sporadicBurstNoise'
+          else:
+            flag += 'style="background-color:#307D7E">highNoiseHG'
+        else:
+          flag += 'style="background-color:#307D7E">highNoiseHG'
+        #ignore LCE only at bulk level    
+        #if R[3][3]>0:
+        #  qfclean= R[3][1]-(R[3][1]*R[3][3])/100
+        #  if qfclean < sporadic_threshold_lce*10:
+        #    flag += 'style="background-color:#78c7c7">LCEonly'
+        #  else:
+        #    flag += 'style="background-color:#307D7E">LCEonly'
+        #else:
+        #  flag += 'style="background-color:#307D7E">LCEonly'
+    ##elif R[3][0]>0:
+    ## print "DEBUG: Channel %s %s not associated to cluster, in LCE file, not put on the display
+    ##Average Energy=%.2f <br>"%(str(hex(r[0])),str(hex(r[1])),R[3][0])
+    # Set warnings for cell already known or with high deviations
+    elif (R[1][0]>0 and R[1][1]>0) or (R[0][0]>0 and R[0][1]>0):
+      flag += 'style="background-color:#FFFF00">Warning:ECAL'
+    ## Look for pedestal shifts
+    elif abs(R[0][2])>0:
+      ped_threshold = 25 # EM Barrel and EMEC OW
+      if r[2]==1 and (r[4]==3 or r[4]==10 or r[4]==16 or r[4]== 22): ped_threshold = 100 # EMEC IW FT=3/10/16/22
+      if r[2]==2: ped_threshold = 300 # HEC
+      if r[2]==3: ped_threshold = 500 # FCAL
+      if abs(R[0][2])>ped_threshold:
+        flag += 'style="background-color:#FFFFCC">PedShift:ECAL'
+
+  if  'BeamBkg' in flag:
+    if R[1][0]>100:
+      if R[1][3]>0:
+        if R[1][3]>0.8:
+          flag = '<td onclick="ToggleFlag(this)"style="background-color:#FF6600">sporadicBurstNoise'
+        else:   
+          flag = '<td onclick="ToggleFlag(this)"style="background-color:#FF0000">highNoiseHG'
+      else:
+        flag = '<td onclick="ToggleFlag(this)"style="background-color:#FF0000">highNoiseHG'
+    
+          
+  ### Overwrite flags in case of beam background
+  #if beambkg:
+  #  #if 'sporadicBurstNoise' in flag or 'highNoiseHG' in flag:
+  #  if 'sporadicBurstNoise' in flag:
+  #    dphi = 0.25
+  #    phicell = float(r[9])
+  #    if abs(phicell) < dphi or abs(phicell-math.pi)<dphi or abs(phicell+math.pi)<dphi:
+  #      flag = '<td onclick="ToggleFlag(this)" style="background-color:#009900">BeamBkg'          
+  #      # print "debug phi = %f <br>"%phicell
+    
+  ### Keep only Sporadic and HighNoiseHG to fill defects
+  if 'sporadicBurstNoise' in flag or 'highNoiseHG' in flag:
+    part = DETlist[r[2]]+ACmap[r[3]][:-1]
+    if CHANNELS.has_key(part):
+      is_duplicate=False
+      for ch in CHANNELS[part]:
+        if str(r[0]) in ch: is_duplicate= True
+      if not is_duplicate:
+        CHANNELS[part].append("(%i,%.2f,%.2f)"%(r[0],r[8],r[9]))
+        #print "DEBUG",part,r[0],r[8],r[9],"<br>"
+    else: CHANNELS[part] = ["(%i,%.2f,%.2f)"%(r[0],r[8],r[9])]
+  ### end
+  if not 'style' in flag: flag+='>'
+  return flag+'</td>'
+
+
+#######################################################################################################################
+def PrintRows(beambkg,clusters,url,run_spec,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,expert,channels=[]):
+  import operator
+  SortedChannels = sorted(channels,key=operator.itemgetter(2,3,4,5,6,7))
+  nRows = 0
+
+  for i in SortedChannels:
+    ## Store results of each DQ test (RawChannels/CaloCells/Sporadic/LArCellEmpty)
+    ## i[12:15] = [[-3s,+3s,E,Sat.Q],[>Eth,>5s,DB,Sat.Q],[E>20,ENLB,Sat.Q],[<E>,E>1,LB,Sat.Q]]
+    ## R[0:4] = [[-3s,+3s,E,Sat.Q],[>Eth,>5s,DB,Sat.Q],E>20,[E>20,ENLB,Sat.Q],[<E>,E>1,LB,Sat.Q]]
+    R = [ [-1,-1,-1,-1] , [-1,-1,-1,-1] , [-1,-1,-1], [-1,-1,-1,-1] ]
+    for index in range(4):
+      for j in range(len(i[index+12])):
+        if len(i[index+12][j])>0:
+          R[index][j] = i[index+12][j][0][0]
+          #print "index,j,i[index+12][j],i[index+12][j][0][0],'<br>'
+
+    ## Check if QFactor is filled:
+    if R[0][3]>0 or R[1][3]>0 or R[2][2]>0:
+      ## if nothing filled but Q factor, skip the channel
+      mysum = 0
+      mysum += R[0][0]+R[0][1]+R[0][2]
+      mysum += R[1][0]+R[1][1]+R[1][2]
+      mysum += R[2][0]+R[2][1]
+      mysum += R[3][0]+R[3][1]+R[3][2]
+      if mysum == -11: continue
+
+    ## Check if only LCE is filled in BULK. Skip if already flagged in UPD4      
+    if run_spec['proc_ver']==bulkproc or run_spec['proc_ver']==cleanbulkproc or run_spec['proc_ver']==reproc :
+      ## sum results of the last column. If empty, result is -4
+
+      mysum=0
+      for index in range(3):
+        for j in range(len(R[index])):
+          mysum+=R[index][j]
+      ## Check UPD4 status
+      ## Sporadic: bit 19 (0x80000)
+      ## HighNoise: bit 8 (0x100)
+      LCE_flag = -1
+      for k in [expert,expert+1]:   
+        if i[k][0]&(0x80000)!=0x0: LCE_flag = 1
+        if i[k][0]&(0x100)!=0x0: LCE_flag = 1
+      if (LCE_flag > 0) and (mysum==-11): 
+        #print 'DEBUG: skipping channel %s %i %i<br>'%(str(hex(i[0])),mysum,LCE_flag)
+        continue
+
+    ## And now print all the remaining channels
+    out = '<tr class="out%d" title="%d">\n'%(nRows%2,nRows)
+    out += '<td>'+str(hex(i[0]))+'</td>\n<td>'+str(hex(i[1]))+'</td>\n'
+    out += '<td style="text-align:right">'+DETlist[i[2]]+'</td><td style="text-align:left">'+ACmap[i[3]]+'</td>\n'
+    for j in i[4:8]: out += '<td>'+str(j)+'</td>\n'
+    for j in i[8:10]: out += '<td>%.4f</td>\n' % (j)
+    if expert>10:
+      out += '<td>%s</td>\n' % (i[10])
+      out += '<td>%.3f</td>\n' % (i[11])
+      out += '<td>%s</td>\n' % (i[12])
+      out += '<td>'+str(hex(i[13])).rstrip('L')+'</td>\n'
+    for k in [expert,expert+1]:
+      status=''
+      if i[k][0]!=0:
+        for j in range(20):
+          if i[k][0]&(1<<j)!=0x0: status += BadChannels[j]+' '
+      if i[k][1]!=0:
+        for j in BadFEBs.keys():
+          if i[k][1]&(1<<j)!=0x0: status += BadFEBs[j]+' '
+      out += '<td style="width:70px">'+status.rstrip(' ')+'</td>\n'
+ 
+    for j in range(4):
+      K = i[expert+2+j]
+      out += '<td>' 
+      for k in K:
+        if len(k)>0:
+          k.sort()
+          k.reverse()
+          for g in k:
+            if 'LCE' in g[2]: 
+              lce_url='https://atlas-larmon.cern.ch/WebDisplayExtractor/LCE/Plots/%s_EnergyCut_Algo0.png'%run_spec['low_run']
+              out+='<a class="det%d" href="%s" title="%s">%d</a>&nbsp;' % (GetClass(g[2]),lce_url,g[1],g[0]) 
+            #elif 'hiEth' in g[2]:
+            #  out+='<a class="det%d" href="%s/%s" title="%s">%.2f</a>&nbsp;' % (GetClass(g[2]),url,g[2],g[1],g[0])
+            else:
+              out+='<a class="det%d" href="%s/%s" title="%s">%.0f</a>&nbsp;' % (GetClass(g[2]),url,g[2],g[1],g[0]) 
+      out += '</td>\n'
+    dR = i[-1]
+    if dR>0: out += '<td>%.3f</td>\n' % (dR) 
+    else: out += '<td></td>\n'
+    if clusters: out += ProposedFlag(beambkg,run_spec,esproc,cleanesproc,bulkproc,cleanbulkproc,reproc,expert,i)
+    else: out += '<td></td>\n'
+
+    nRows += 1
+    print out+'</tr>\n'
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/print_top.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/print_top.py
new file mode 100644
index 00000000000..ae8d4040717
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/print_top.py
@@ -0,0 +1,69 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+cols = ['OFF_ID','ONL_ID','DET','AC','FT','SL','CH','SAM','ETA','PHI','HVLINES','HVCORR','CL','TT_COOL_ID']
+DETlist = ['EMB','EMEC','HEC','FCAL']
+
+########################################################################
+def PrintFields(expert):
+  out = '<tr>\n'
+  for i in cols[:expert]+['STATUSUPD1','STATUSUPD4','RawChannels','CaloCells','Sporadic','LArCellEmpty','Clusters','Proposed Flag']: out += '<td>'+i+'</td>\n'
+  print out+'</tr>\n'
+
+
+########################################################################
+def PrintTopRow(expert,opts, rawchannels,calocells,sporadic,larcellempty,clusters):
+  colsWidths = {'OFF_ID':6,'ONL_ID':6,'DET':1,'AC':1,'FT':2,'SL':2,'CH':2,'SAM':1,'ETA':4,'PHI':4,'STATUSUPD1':6,'STATUSUPD4':6,'HVLINES':7,'HVCORR':5,'CL':2,'TT_COOL_ID':6}
+
+  out = '<tr>\n'
+  
+  for i in cols[:expert]+['STATUSUPD1','STATUSUPD4']:
+    selected = False
+    if opts.has_key(i): selected = opts[i]
+
+    out += '<td style="width:%dpx;">' % (10*colsWidths[i])
+    if i=='DET':
+      out += '<select name="DET" value="">\n'
+      out += ' <option value=""></option>\n'
+      for d in range(4):
+        out += ' <option value="%d" ' % (d)
+        if str(d)==selected: out += ' selected'
+        out += '>'+DETlist[d]+'</option>\n'
+      out += '</select>'
+    elif i=='AC':
+      out += '<select name="AC" value="">\n'
+      for ac in [['',''],['A+','1'],['C-','-1']]:
+        if ac[1]==selected: out += ' <option value="'+ac[1]+'" selected>'+ac[0]+'</option>\n'
+        else:               out += ' <option value="'+ac[1]+'">'+ac[0]+'</option>\n'
+      out += '</select>'
+    else:
+      out += '&nbsp;'
+    out += '</td>\n'
+
+  out +='<td>'
+  for i,j in enumerate(['&gt;3&#963','&lt;-3&#963','&lt;E&gt','Sat.Q']):out += '<a class="det%d">%s</a>\n' % (i,j)
+  out += '<input type="checkbox" name="rawchannels"'
+  if rawchannels: out += ' checked="checked"'
+  out += '></td><td>\n'
+  
+  for i,j in enumerate(['&gt;Eth','&gt;5&#963','DB','Q&gt;4000']):out += '<a class="det%d">%s</a>\n' % (i,j)
+  out += '<input type="checkbox" name="calocells"'
+  if calocells: out += ' checked="checked"'
+  out += '></td><td>\n'
+
+  for i,j in enumerate(['','E&gt;5-15','LB','Q&gt;4000']):
+    if j != '': out += '<a class="det%d">%s</a>\n' % (i,j)
+  out += '<input type="checkbox" name="sporadic"' 
+  if sporadic: out += ' checked="checked"'
+  out += '></td><td>\n'
+
+  for i,j in enumerate(['&lt;E&gt;','E>1','LB','Q&gt;4000']):
+    if j != '': out += '<a class="det%d">%s</a>\n' % (i,j)
+  out += '<input type="checkbox" name="larcellempty"' 
+  if larcellempty: out += ' checked="checked"'
+
+  out += '></td>\n<td>&#916;R <input type="checkbox" name="clusters"'
+  if clusters: out += ' checked="checked"'
+  out += '></td>\n<td></td>\n</tr>\n'
+  
+  print out
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/run_report.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/run_report.py
new file mode 100644
index 00000000000..c4d22a1646a
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/run_report.py
@@ -0,0 +1,1206 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from threading import Thread
+import xmlrpclib
+
+global server
+
+passfile = open("/afs/cern.ch/user/l/larmon/public/atlasdqmpass.txt")
+passwd = passfile.read().strip(); passfile.close()  
+passurl = 'https://%s@atlasdqm.cern.ch' % passwd
+server = xmlrpclib.ServerProxy(passurl)
+
+import sqlite3
+
+import os,re,time,sys,cgi,string,math
+import cgitb; cgitb.enable()
+
+Eventtype = {2:'Raw data',4:'Result',8:'Calib',12:'Pedestal',16:'All+Result'}
+global ATLASREADY
+ATLASREADY = []
+global NBR
+global NBY
+NBR = {}; NBY = {};
+global noisedefects
+global sevnoisedefects
+noisedefects = []; sevnoisedefects = []
+
+########################################################################
+def listify(l):
+  if len(l)==0: return ''
+  elif len(l)==1: return str(l[0]) 
+  l.sort()
+  interval=False
+  a = ''
+  for i in range(len(l)-1):
+    if interval: 
+      if l[i+1]-l[i]==1: pass
+      else: a += str(l[i])+' '; interval=False
+    else:
+      a += str(l[i])
+      if l[i+1]-l[i]==1: a += '-'; interval=True
+      else: a += ' '
+  a += str(l[-1])
+  return a
+
+########################################################################
+class queryhvtripdb(Thread):
+  def __init__(self,run_spec):
+    Thread.__init__(self)
+    self.run_spec = run_spec
+
+  def run(self):
+    dbName='/afs/cern.ch/user/l/larmon/public/HVTripsDB/trips.db'    
+    querycmd='select details.Det,details.Side,details.HVLINE,trips.TripLB,trips.RampUp,trips.StableZero,trips.RecoveryLB,trips.RecoveryRunNumber,details.status from trips INNER JOIN details ON trips.HVLINE = details.HVLINE where trips.TripRunNumber=%s order by trips.TripTimeStamp desc limit 100;'%self.run_spec['low_run']
+    hv_conn = sqlite3.connect(dbName,detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
+    c = hv_conn.cursor()
+    c.execute(querycmd)
+    trip = c.fetchall()
+    self.List = trip
+    #print "DEBUG inside:",self.List,"<br>"
+
+########################################################################
+class queryatlasready(Thread):
+  def __init__(self,run_spec):
+    Thread.__init__(self)
+    self.run_spec = run_spec
+
+  def run(self):
+    athena_version = "17.2.6"
+    import subprocess as sp
+    cmd="export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup;"
+    cmd+="source $AtlasSetup/scripts/asetup.sh %s,32,here;"%(athena_version)
+    cmd+="python /afs/cern.ch/user/l/larmon/public/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/GetATLASReadyLBs.py %s"%(self.run_spec['low_run'])
+    P = sp.Popen(cmd,shell=True,stdout=sp.PIPE,stderr=sp.PIPE)
+    tmp =  str(P.communicate()[0]).split('\n')[:-1]
+    self.List=eval(tmp[-1])
+    
+########################################################################
+class queryeventsperlb(Thread):
+  def __init__(self,run_spec):
+    Thread.__init__(self)
+    self.run_spec = run_spec
+
+  def run(self):
+
+    athena_version = "17.2.6"
+    
+    if 'tmp_' in self.run_spec['stream']:
+      stream = self.run_spec['stream'][4:]
+    else:
+      stream = self.run_spec['stream']
+
+    import subprocess as sp
+    cmd="export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup;"
+    #cmd+="source $AtlasSetup/scripts/asetup.sh 16.6.5,32,here,builds;"
+    cmd+="source $AtlasSetup/scripts/asetup.sh %s,32,here;"%(athena_version)
+    cmd+="python /afs/cern.ch/user/l/larmon/public/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/aux/GetNEventsLB.py --run %s --stream %s;"%(self.run_spec['low_run'],stream)
+
+    P = sp.Popen(cmd,shell=True,stdout=sp.PIPE,stderr=sp.PIPE)
+    tmp = eval(P.communicate()[0])
+    self.List = dict( [(x[1],x[0]) for x in list(tmp)] )
+
+########################################################################
+_Part = {'EMBA':'BarrelA','EMBC':'BarrelC','EMECA':'EmecA','EMECC':'EmecC','HECA':'HecA','HECC':'HecC','FCALA':'FcalA','FCALC':'FcalC'}
+
+class mc(Thread):
+  def __init__(self,run_spec,P):
+    Thread.__init__(self)
+    self.P = P
+    self.run_spec = run_spec
+    #self.mixed = mixed
+    self.multicall = xmlrpclib.MultiCall( server )
+    self.multicall.get_dqmf_sub_assessments(self.run_spec,'LAr/'+self.P+'/Data_Integrity')
+    self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Detector_Status/NDeviatingChannels'+self.P)
+    self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Data_Integrity/NullDigit_'+_Part[self.P])
+    self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Data_Integrity/Saturation_'+_Part[self.P])
+    self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Data_Integrity/LArFEBMonErrors'+_Part[self.P])
+    
+    for j in ['_burst','_timeVetoBurst','_pedestal_evolution','_quality_nChannel_burst']:
+      #if self.mixed:
+       # self.run_spec['stream'] = 'physics_CosmicCalo'
+       # self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Noise/Partition/'+self.P+j)
+       # self.run_spec['stream'] = 'express_express'      
+      #else:
+      self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Noise/Partition/'+self.P+j)
+    
+
+    self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Data_Integrity/Out_E_FT_vs_SLOT_'+_Part[self.P])  
+    self.multicall.get_dqmf_all_results(self.run_spec,'LAr/'+self.P+'/Data_Integrity/missingTriggerType'+_Part[self.P])
+
+
+  def run(self):
+
+    self.results = self.multicall()
+    self.runs = self.results[0].keys()
+    self.FEBErrors_list = {}
+    self.FEBErrors_results = {}
+
+    for n,N in enumerate(self.runs):
+      run_spec1 = self.run_spec.copy()
+      run_spec1['high_run'] = N
+      run_spec1['low_run'] = N
+      H = self.results[0][N]['hists']
+      self.multicall._MultiCall__call_list = []
+      self.FEBErrors_results[N] = []
+
+      ## Retrieve number of errors per FEB
+      for h in H:
+        if not 'LArFEBMonErrors' in h: continue
+        self.multicall.get_dqmf_all_results(run_spec1,'LAr/'+self.P+'/Data_Integrity/'+h)
+        self.FEBErrors_results[N].append( h )
+
+      ## Retrieve error type per FEB
+      #for h in H:
+      #  if not 'FT' in h: continue
+      #  self.multicall.get_dqmf_results(run_spec1,'LAr/'+self.P+'/Data_Integrity/'+h+':Mean')
+      #  self.FEBErrors_results[N].append( [h] )
+      #  #print 'JL check FEB errors:',h,self.FEBErrors_results,'<br>'
+          
+      r = self.multicall()
+      for i,I in enumerate(self.multicall._MultiCall__call_list): 
+        self.FEBErrors_results[N].append( r[i][N] )
+        #print 'JL        ',r[i][N],'<br>'
+        #print 'JL        ',self.FEBErrors_results[N],'<br>'  
+
+
+########################################################################
+def RunReport(run_spec,multicall,url,DCSGET,defects,includenotready,esproc,cleanesproc,bulkproc,cleanbulkproc,isexpress):
+
+  # Queries
+  Part = ['EMBA','EMBC','EMECA','EMECC','HECA','HECC','FCALA','FCALC']
+  Part2 = ['EMBA','EMBC','EMECA','EMECC']
+  _Part2 = {'EMBA':'BarrelA','EMBC':'BarrelC','EMECA':'EMECA','EMECC':'EMECC'}
+  Part3 = {'EMBA':['EMB1A','EMB2A','EMB3A','EMBPA'],'EMBC':['EMB1C','EMB2C','EMB3C','EMBPC'],'EMECA':['EMEC1A','EMEC2A','EMEC3A','EMECPA'],'EMECC':['EMEC1C','EMEC2C','EMEC3C','EMECPC'],'HECA':['HEC0A','HEC1A','HEC2A','HEC3A'],'HECC':['HEC0C','HEC1C','HEC2C','HEC3C'],'FCALA':['FCAL1A','FCAL2A','FCAL3A'],'FCALC':['FCAL1C','FCAL2C','FCAL3C']}
+  calls = []
+
+  EMECA_lb=[]
+  EMECC_lb=[]
+  EMECA_mb=[]
+  EMECC_mb=[]
+
+
+  for p,P in enumerate(Part):
+    calls.append( mc(run_spec,P) )
+    calls[p].start()
+ 
+  multicall._MultiCall__call_list = [] 
+  multicall.get_dqmf_results(run_spec,'Global/DataFlow/m_release_stage_lowStat:Average')
+  multicall.get_dqmf_all_results(run_spec,'LAr/LAR_GLOBAL/Run_Parameters/Eventtype')
+  multicall.get_dqmf_all_results(run_spec,'LAr/LAR_GLOBAL/Run_Parameters/NbOfSamples')
+  multicall.get_dqmf_all_results(run_spec,'LAr/LAR_GLOBAL/Data_Integrity/EventsRejectedYield')
+  multicall.get_dqmf_all_results(run_spec,'LAr/LAR_GLOBAL/Collisions/LArCollTimeLumiBlockTimeCut')
+ 
+  Plots = ['Data_Integrity/YieldOfRejectedEventsVsLBout','Data_Integrity/YieldOfRejectedEventsVsLB','Noise_Bursts/NoisyEvent_TimeVeto','Noise_Bursts/SaturatedTightEvent_TimeVeto']  
+  Plots_description = ['Data Integrity(TimeVeto)','Data Integrity','Noise Burst(NoisyRO)','Noise Burst(Sat.Tight.)']
+  for p in Plots: multicall.get_dqmf_all_results(run_spec,'LAr/LAR_GLOBAL/'+p)
+
+  for p,P in enumerate(Part2):
+    multicall.get_dqmf_all_results(run_spec,'LAr/'+P+'/Noise/Partition/NoisyEvent_TimeVeto_'+_Part2[P])
+
+
+  for p,P in enumerate(Part):
+    Layers = Part3[P]
+    for j,J in enumerate(Layers):
+      multicall.get_dqmf_all_results(run_spec,'LAr/'+P+'/Signal_Time/Single_Cells/CellEnergyVsTime_'+J)
+  
+  multicall.get_dqmf_all_results(run_spec,'LAr/LAR_GLOBAL/Data_Integrity/EErrorsPerLB')
+   
+  results = multicall()
+
+
+  # Retrieve HV trip from hv trip db
+  hvtrip=queryhvtripdb(run_spec)
+  hvtrip.start()
+  hvtrip.join()
+  HVTRIPS=hvtrip.List
+
+
+  # Retrieve events per LB in the current stream from run query
+  evtstream=queryeventsperlb(run_spec)
+  evtstream.start()
+  evtstream.join()
+  NevtPerLB=evtstream.List
+
+    
+
+  # Retrieve stable beam info
+  readyinfo = queryatlasready(run_spec)
+  readyinfo.start()
+  readyinfo.join()
+  ATLASREADY=readyinfo.List
+
+  # Print header
+  S = ['NullDigit','Saturation']
+  color = ['#FF0000','#0000FF']
+  h_names = ['_burst','_timeVetoBurst','_pedestal_evolution','_quality_nChannel_burst']
+  RE0 = re.compile(r'(?P<P>\S+)FT(?P<FT>\S+)Slot(?P<SL>\S+)')
+  RE1 = re.compile(r'\((?P<LB>\S+)\.0*\)')
+  RE2 = re.compile(r'x-axis\s*\S*\((?P<SL>\S+)\.0*\)\s*y-axis\s*\((?P<FT>\S+)\.0*\)\S+')
+
+
+  print '''
+<tr class="row">
+<td><b>Run Info</td>
+<td title="LAr Global"><b>LAr Global</b></td>
+<td><b>Partition</td>
+<td><b>Data integrity</b></td>
+<td><b>Non-nominal HV</b></td>
+<td><b>NullDigit/Saturation</td>
+<td><b>Noise Bursts (LArNoisyRO-q factor)</td>
+<td><b>Noise Bursts (Energy)</td>
+<td><b>DSP computation</td>
+<td><b>Timing</td>
+</tr>
+<tr>
+<td></td>
+<td>LB: &#37;ev (n) </td>
+<td></td>
+<td>(FT,SL)</td>
+<td>HV correction</td>
+<td>FT,SL,CH,&#37;ev,error</td>
+<td>LB: &#37;ev (n) </td>
+<td>LB:&nbsp;<a class="lb0" title="Number of events with more than 1% of all channels reporting |E|>3&#963;">Y3&#963</a>&nbsp;&nbsp;&nbsp;<a class="lb1" title="Number of events with more than 1% of all channels reporting |E|>3&#963; With Time Veto">Y3&#963(TimeVeto)</a>&nbsp;\n &nbsp;<a class="lb2" title="Sum of the energy (MeV) in all channels">SumE</a>&nbsp;&nbsp;<a class="lb3" title="number of cells with saturated Q factor">Sat Q</td>
+<td><a class="lb3" title="Is Eoffline != Eonline for more than 20 events (per FEB) and (per LB)"><font color = black> # of FEBs/LBs</td>
+<td><a class="lb3" title="check whether |<timing>| < 1.0 ns for layer 2 or < 2.0 ns for other layers"><font color = black>(ns)</td>
+</tr>
+'''
+
+  if run_spec['stream'] == "physics_CosmicCalo" or run_spec['stream'] == "tmp_physics_CosmicCalo": CosmicCalo = True
+  else: CosmicCalo =False
+  if CosmicCalo:
+
+    print '''
+<tr>
+<td>Stream</td>
+<td></td>
+<td></td>
+<td>%s</td>
+<td>%s</td>
+<td>%s</td>
+<td>%s</td>
+<td>%s</td>
+<td><a class="lb1">Not Valid for CosmicCalo<a></td>
+<td><a class="lb1">Not Valid for CosmicCalo<a></td>
+</tr>
+''' % ('CosmicCalo','CosmicCalo','CosmicCalo','CosmicCalo','CosmicCalo')
+
+  else:   
+
+    print '''
+<tr>
+<td>Stream</td>
+<td></td>
+<td></td>
+<td>%s</td>
+<td>%s</td>
+<td>%s</td>
+<td>%s</td>
+<td><a class="lb1">Only Valid for CosmicCalo<a></td>
+<td>%s</td>
+<td>%s</td>
+</tr>
+''' % (run_spec['stream'].split('_')[1],run_spec['stream'].split('_')[1],run_spec['stream'].split('_')[1],run_spec['stream'].split('_')[1],run_spec['stream'].split('_')[1],run_spec['stream'].split('_')[1])
+
+  #<td title="LB with defects"><b>LBs with Defects</b></td>
+  #<td title="# of collision candidates per LB">Collisions</td>
+  #<td>LB: n</td>
+
+  runs = results[1].keys()
+  runs.sort()
+
+
+  # Loop over runs
+  for n,N in enumerate(runs):
+    
+    #F = file('/afs/cern.ch/user/l/larmon/public/reports/%s.txt'%(N),'w')
+    Nev = -1
+    if results[0].has_key(N): Nev = int(results[0][N])
+
+    print '''
+<tr class="out0">
+<td rowspan="8" style="vertical-align:top">
+<a href="http://atlas-runquery.cern.ch/query.py?q=find+run+%s+/+show+all+and+duration+and+ptag+and+dq+lar/+nodef" >%s</a><br /><hr />
+<a href="https://atlasdqm.cern.ch/dqsignoff/%s"> DQ logbook </a><br /><hr />
+<a href="%s">Tier 0 <br /> Webdisplay</a><hr />
+%d<br />
+%s<br />
+%d samples<br />
+<hr />
+rejection<br />
+<a href="%s/LAr/LAR_GLOBAL/Data_Integrity/EventsRejectedYield">%.3f&#37;</a>
+</td>
+''' % (N,N,N,url,Nev,Eventtype[int(results[1][N]['Mean'])],int(results[2][N]['Mean']),url,results[3][N]['Total'])
+
+
+    Data_Integrity = []
+    Data_Integrity_TimeVeto = []
+    MediumNoisy_Events = []
+    TightNoisy_Events = []
+    Collisions = []
+
+    # Bad LBs Spotting
+    out = '<td rowspan="8" onclick="showit2(this);" style="vertical-align:top">\n'
+
+    # Stable beam
+    if len(ATLASREADY)==0:
+      out += '<pre style="font-family:Arial"><font color=green>ATLAS Ready</font>: None<br/>'
+    else:
+      out += '<pre style="font-family:Arial"><font color=green>ATLAS Ready</font>: %s<br/>'%listify(ATLASREADY)
+    out += '</pre>'
+
+    # Print Red DCS flags
+    if len(DCSGET)>0:
+      dcsurl="http://atlas-runquery.cern.ch/query.py?q=find+run+%s+&#37;2F+show++dq+lar+DCSOFL"%run_spec['low_run']
+      out += '<pre style="font-family:Arial"><a href=%s><font color=red>DCS Errors</font></a><br/>'%dcsurl
+      for item in DCSGET:
+        out+="%s lb %s<br/>"%(item,listify(DCSGET[item]))
+      out += '</pre>'
+
+    # Print HV Trips & Fill Defects
+    hvtripurl="https://atlas-larmon.cern.ch/HVTripsDB/index.py?query=select&#37;20+trips.rowid,*+from+trips+INNER+JOIN+details+ON+trips.HVLINE+=+details.HVLINE+where+trips.TripRunNumber=%s+order+by&#37;20trips.TripTimeStamp+desc"%run_spec['low_run']
+    out += '<pre style="font-family:Arial"><a href=%s><font color=red>HV Trips</font></a><br/>'%hvtripurl
+
+    
+    if len(HVTRIPS)>0:
+      for trip in HVTRIPS:
+        loc=str(trip[0])+str(trip[1]);    
+        # warning: remove "PS" in partition name
+        if loc=="EMBPSC": loc="EMBC";
+        if loc=="EMBPSA": loc="EMBA";
+        if loc=="EMECPSC":loc="EMECC";
+        if loc=="EMECPSA":loc="EMECA";
+        ch=int(trip[2]);
+        triplb=int(trip[3]);rampup=int(trip[4]);
+        stablezero=int(trip[5]);recoverlb=int(trip[6]);
+        recoverrun=int(trip[7]);
+        moduletype=str(trip[8]);
+
+
+        ##########################
+        ## Trip in a new module ##
+        ##########################
+        if (moduletype == "new"):
+          if (recoverrun==int(run_spec['low_run'])):
+            out+="%s trip %i-%i (new module) <br/>"%(loc,triplb,recoverlb) 
+            # set defects
+            #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+            if isexpress:  
+              df = "LAR_%s_HVTRIP_NEWMODULE <font color=yellow>Y</font> %i-%i # channel %i - New HV module"%(loc,triplb,recoverlb,ch)
+              defects.append(df)
+          #in case of a short   
+          else:
+             out+="%s trip %i-%i (new module short) <br/>"%(loc,triplb,stablezero)
+             if isexpress: 
+               df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i # channel %i"%(loc,triplb,stablezero,ch)
+               defects.append(df)
+               df = "LAR_%s_HVNONNOMINAL <font color=yellow>Y</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+               defects.append(df)
+             else:
+               df = "LAR_%s_HVNONNOMINAL <font color=green>G</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+               defects.append(df)
+               df = "LAR_%s_HVNONNOM_CORRECTED <font color=red>R</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+               defects.append(df)
+               
+                      
+   
+        #################################
+        ## Recovered trip within one LB  ##
+        #################################
+        elif (triplb == recoverlb):
+            out+="%s trip %i (recovered) <br/>"%(loc,triplb) 
+            # set defects
+            #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+            if isexpress:  
+              df = "LAR_%s_HVTRIP <font color=red>R</font> %i # channel %i"%(loc,triplb,ch)
+              defects.append(df)
+
+         
+        #######################################
+        ## Recovered trip - More than one LB ##
+        #######################################
+        elif (recoverrun==int(run_spec['low_run'])):
+  
+          ## autorecovered
+          if (stablezero<0):
+            out+="%s trip %i ramp %i-%i (recovered) <br/>"%(loc,triplb,rampup,recoverlb)
+            # set defects
+            #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+            if isexpress:  
+              df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i #  channel %i"%(loc,triplb,rampup,ch)
+              defects.append(df)
+              df = "LAR_%s_HVRAMPUP <font color=red>R</font> %i-%i #  channel %i"%(loc,rampup,recoverlb,ch)
+              defects.append(df)
+          ## manually recovered
+          else:
+            out+="%s trip %i stable %i-%i ramp %i-%i (recovered) <br/>"%(loc,triplb,stablezero+1,rampup-1,rampup,recoverlb)
+            # set defects for ES
+            #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+            if isexpress:  
+              df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i # channel %i"%(loc,triplb,stablezero,ch)
+              defects.append(df)
+              df = "LAR_%s_HVRAMPUP <font color=red>R</font> %i-%i # channel %i"%(loc,rampup,recoverlb,ch)
+              defects.append(df)
+              df = "LAR_%s_HVNONNOMINAL <font color=yellow>Y</font> %i-%s # channel %i"%(loc,stablezero+1,rampup-1,ch)
+              defects.append(df)
+            # set defects for bulk
+            else:
+              df = "LAR_%s_HVNONNOMINAL <font color=green>G</font> %i-%s # channel %i"%(loc,stablezero+1,rampup-1,ch)
+              defects.append(df)
+              df = "LAR_%s_HVNONNOM_CORRECTED <font color=red>R</font> %i-%s # channel %i"%(loc,stablezero+1,rampup-1,ch)
+              defects.append(df)
+       
+        ########################
+        ## Not Recovered trip ##
+        ########################
+        else:
+          ## easiest case: no ramp-up, no auto recovery
+          if (rampup<0 and stablezero>0):
+            out+="%s trip %i-%i (not recovered) <br/>"%(loc,triplb,stablezero)
+            # set defects for ES
+            #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+            if isexpress:  
+              df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i # channel %i"%(loc,triplb,stablezero,ch)
+              defects.append(df)
+              df = "LAR_%s_HVNONNOMINAL <font color=yellow>Y</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+              defects.append(df)
+            # set defects for bulk
+            else:
+              df = "LAR_%s_HVNONNOMINAL <font color=green>G</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+              defects.append(df)
+              df = "LAR_%s_HVNONNOM_CORRECTED <font color=red>R</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+              defects.append(df)  
+          ## second case: single failed ramp-up, no stable non nominal HV
+          elif (rampup>0 and stablezero<0):
+            out+="%s trip %i ramp %i-%s (not recovered) <br/>"%(loc,triplb,rampup,"End")
+            # set defects for ES
+            #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+            if isexpress : 
+              df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i # channel %i"%(loc,triplb,rampup,ch)
+              defects.append(df)
+              df = "LAR_%s_HVRAMPUP <font color=red>R</font> %i-%s # channel %i"%(loc,rampup,"End",ch)
+              defects.append(df)
+          ## third case: failed ramp-up, with stable non nominal HV AFTER ramp-up
+          elif (rampup>0 and stablezero>0):
+            if (stablezero > rampup):
+              out+="%s trip %i ramp %i-%i stable %i-%s (not recovered) <br/>"%(loc,triplb,rampup,stablezero,stablezero+1,"End")
+              # set defects for ES
+              #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+              if isexpress:  
+                df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i # channel %i"%(loc,triplb,rampup,ch)
+                defects.append(df)
+                df = "LAR_%s_HVRAMPUP <font color=red>R</font> %i-%i # channel %i"%(loc,rampup,stablezero,ch)
+                defects.append(df)
+                df = "LAR_%s_HVNONNOMINAL <font color=yellow>Y</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+                defects.append(df)
+                # set defects for bulk
+              else:
+                df = "LAR_%s_HVNONNOMINAL <font color=green>G</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+                defects.append(df)
+                df = "LAR_%s_HVNONNOM_CORRECTED <font color=red>R</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+                defects.append(df)
+            else:
+
+              out+="%s trip %i-%i (not recovered) <br/>"%(loc,triplb,stablezero)
+              # set defects for ES
+              #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+              if isexpress:  
+                df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i # channel %i"%(loc,triplb,stablezero,ch)
+                defects.append(df)
+                df = "LAR_%s_HVNONNOMINAL <font color=yellow>Y</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+                defects.append(df)
+                # set defects for bulk
+              else:
+                df = "LAR_%s_HVNONNOMINAL <font color=green>G</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+                defects.append(df)
+                df = "LAR_%s_HVNONNOM_CORRECTED <font color=red>R</font> %i-%s # channel %i"%(loc,stablezero+1,"End",ch)
+                defects.append(df)  
+              
+          # fourth case (highly improbable but already seen) :ramping until the end of the run !
+          else:  
+            out+="%s trip %i ramp %i-%s (not recovered) <br/>"%(loc,triplb,rampup,"End")
+            # set defects for ES
+            #if (run_spec['proc_ver'] == esproc or run_spec['proc_ver'] == cleanesproc):
+            if isexpress:  
+              df = "LAR_%s_HVTRIP <font color=red>R</font> %i-%i # channel %i"%(loc,triplb,rampup,ch)
+              defects.append(df)
+              df = "LAR_%s_HVRAMPUP <font color=red>R</font> %i-%s # channel %i"%(loc,rampup,"End",ch)
+              defects.append(df)
+    
+    # No Trip
+    else:
+      out+="no trip found<br>"
+    out += '</pre>'
+
+
+
+    # Print Data integrity, noise bursts
+    for j,J in enumerate(Plots):
+      try: r = results[j+5][N]
+      except:
+        out += '?'
+        continue
+
+      if j==3 and isexpress:
+        if run_spec['proc_ver']==bulkproc or run_spec['proc_ver']==cleanbulkproc or run_spec['proc_ver']==102:continue
+
+
+      K = r.keys()
+      if len(K)>0: K.remove('NBins')
+      LB = {}
+      # Thresholds to display bursts on %events
+      # Data Integrity/NoisyRO/Sat.Tight]
+      thresholds = [1.,1.,0.,1.]
+      for k in K:
+        m = RE1.search(k).groupdict()
+        lb = int(m['LB'])
+        p = '%5.4f'%(r[k])
+        # Apply thresholds for display
+        if r[k] < thresholds[j]: continue
+        # store LB per output value
+        if includenotready or (lb in ATLASREADY):
+          if LB.has_key(p): LB[p].append(lb)
+          else: LB[p] = [lb]
+          #print "DEBUG",j,J,k,r[k],p,LB,"<br>"
+          if j==0: # Data Integrity Errors Outside Time Veto
+            Data_Integrity_TimeVeto.append(lb)
+          if j==1: # Data Integrity Errors
+            Data_Integrity.append(lb)
+          if j==2: # LArNoisyRO
+            if lb in TightNoisy_Events: continue # avoid double counting
+            TightNoisy_Events.append(lb)
+          ##if j==3: # Saturated Tight
+          ##  if r[k]> 5:
+          ##    if lb in TightNoisy_Events: continue # avoid double counting
+          ##    TightNoisy_Events.append(lb)
+       
+    
+      if len(LB)>0:
+        NBINS = 0
+        for item in LB: NBINS += len(LB[item])
+        a = '<a class="lb%d" href="%s/LAr/LAR_GLOBAL/%s">%s</a>' % (j,url,Plots_description[j],p)
+        out += '<pre style="font-family:Arial;"><a href="%s/LAr/LAR_GLOBAL/%s" >%i LBs: %s</a>\n' % (url,J,NBINS,Plots_description[j])
+        #if "Data Integrity" in Plots_description[j]:
+        #  print "DEBUG",LB,len(LB),NBINS,"<br>"
+        #for val in LB.keys():
+        #  for lb in LB[val]:
+        #    out += '%s: %s (%i)<br />' %(lb,val,round(float(val)*NevtPerLB[int(lb)]*0.01))
+        P = LB.keys()
+        P.sort()
+        P.reverse()
+        counter = 0;
+        morethanfour = False
+        for val in P:
+          for lb in LB[val]:
+            counter = counter+1
+            if counter < 5: out += '%s: %s (%i)<br />' %(lb,val,round(float(val)*NevtPerLB[int(lb)]*0.01))
+            elif counter == 5:
+                out += '<a> <p  onclick="showit2(this);"  style="font-family:times;color:blue;" ><u>show</u></p> <!--f <br />'
+                morethanfour = True
+                out += '%s: %s (%i)<br />' %(lb,val,round(float(val)*NevtPerLB[int(lb)]*0.01))
+            else: out += '%s: %s (%i)<br />' %(lb,val,round(float(val)*NevtPerLB[int(lb)]*0.01))
+        if morethanfour: out +=' f-->\n'
+        #if morethanfour: out +=' <p  onclick="showit3(this);"  style="font-family:times;color:blue;" ><u>hide</u></p> f-->\n'
+        out += '</a></pre>'
+
+        ### use this instead to compactify the list of LBs 
+        #P = LB.keys()
+        #P.sort()
+        #P.reverse()
+        #for p in P: 
+        #   if float(p)>0.015: out += '%s: %s<br />' % (listify(LB[p]),p)
+        #   else: out += '<!--%s: %s<br />-->' % (listify(LB[p]),p)
+        #out += '</pre>'     
+    
+    #out += '</td>\n'
+    Flagged_LBs = Data_Integrity_TimeVeto+TightNoisy_Events
+
+    ###print "DEBUG - list of TIGHT bursts:",TightNoisy_Events,"<br>"
+    ###print "DEBUG - list of MEDIUM bursts:",MediumNoisy_Events,"<br>"
+
+    #########################################################################
+    # May 2011:Store data integrity defects DUE to missing FEBs - ES only #
+    #########################################################################
+    ##if run_spec['proc_ver']==esproc or run_spec['proc_ver']==cleanesproc:
+      ##df = "LAR_EMBA_COVERAGE <font color=red>R</font> # Dead controller for 2 FEBs"
+      ##defects.append(df)
+
+    #########################################################################
+    # October 2012:Store data integrity defects DUE to missing FEBs - ES only #
+    #########################################################################
+    #if isexpress:
+    #  df = "LAR_HECC_COVERAGE <font color=red>R</font> # FEB FT 16 Slot 5 powered off (cooling)"
+    #  defects.append(df)
+  
+    ###################################################
+    # Store data integrity defects - GLOBAL - ES only #
+    ###################################################
+    #######if len(Data_Integrity)>0 and (run_spec['proc_ver']==esproc or run_spec['proc_ver']==cleanesproc):
+    #if len(Data_Integrity)>0 and (isexpress):  
+    #    df = "LAR_DATACORRUPT <font color=red>R</font> "+listify(Data_Integrity)+" # data integrity error"
+    #    defects.append(df)
+    #if len(Data_Integrity)>0 and (run_spec['proc_ver']==bulkproc or run_spec['proc_ver']==cleanbulkproc):
+    #if len(Data_Integrity)>0 and (not isexpress):
+    #    df = "LAR_DATACORRUPT <font color=green>G</font> "+listify(Data_Integrity)+" # data integrity error - Cleaned with Time Veto"
+    #    defects.append(df)
+    #if len(Data_Integrity_TimeVeto)>0 and (run_spec['proc_ver']==bulkproc or run_spec['proc_ver']==cleanbulkproc):
+    if len(Data_Integrity_TimeVeto)>0 and (not isexpress):
+        df = "LAR_DATACORRUPT <font color=red>R</font> "+listify(Data_Integrity_TimeVeto)+" # data integrity error - NOT cleaned with Time Veto"
+        defects.append(df)
+      
+    # Collisions
+    #out += '<td rowspan="8" onclick="showit2(this);" style="vertical-align:top">\n'
+    Collisions = []
+    LB = {}
+    try:
+      r = results[4][N]
+      K = r.keys()
+      K.remove('NBins')
+      for k in K:
+        m = RE1.search(k).groupdict()
+        lb = int(m['LB'])                                                                              
+        p = int(r[k])
+        if includenotready or (lb in ATLASREADY):
+          if LB.has_key(p): LB[p].append(lb)
+          else: LB[p] = [lb]
+          Collisions.append(lb)
+
+        #out += '<a href="%s/LAr/LAR_GLOBAL/Collisions/LArCollTimeLumiBlockTimeCut" >%d LBs</a><br />\n' % (url,r['NBins'])
+        #out += '<a href="%s/LAr/LAR_GLOBAL/Collisions/LArCollTimeLumiBlockTimeCut" >%i LBs</a><br />\n' % (url,len(LB))
+      out += '<pre style="font-family:Arial;"><a href="%s/LAr/LAR_GLOBAL/Collisions/LArCollTimeLumiBlockTimeCut" > Collisions: <br> %i LBs</a><br />\n' % (url,len(Collisions))
+      if len(LB)>0:
+        P = LB.keys()
+        P.sort()
+        P.reverse()
+        #if run_spec['stream'] == 'physics_CosmicCalo':
+        if CosmicCalo:  
+          for p in P: 
+            #if float(p)>1: out += '%s: <font color=red>%s</font><br />' %(listify(LB[p]),p)
+            #else: out += '<!--%s: <font color=red>%s</font><br />-->' %(listify(LB[p]),p)
+            out += '%s: <font color=red>%s</font><br />' %(listify(LB[p]),p)
+    except: out += '?'
+    out += '</td>\n'
+    print out
+
+
+    # Sum everything
+    All_Bad_LBs = Data_Integrity+TightNoisy_Events+Collisions
+
+    # Loop over partitions
+    for p,P in enumerate(Part):
+      calls[p].join()
+      p_results = calls[p].results
+      out = ''
+      if p>0: out += '<tr class="out0">\n'
+      out += '<td>'+P+'</td>\n'
+      Partition_NoisyEvents = []
+      Partition_MediumEvents = []
+      Check_lb =[];Check_mb = []; Check_tb = []
+
+
+      # FEB errors
+      FEBErrors = ''
+      error = ''
+      FEBErrors_results = calls[p].FEBErrors_results[N]
+      if len(FEBErrors_results)>0:
+        h = FEBErrors_results[0] 
+        r = FEBErrors_results[1] 
+        K = r.keys()
+        K.remove('NBins')
+        fe = {}
+        for k in K:
+          m = RE2.search(k).groupdict()
+          FT = int(m['FT'])
+          SL = int(m['SL'])
+          if fe.has_key(FT): fe[FT].append(SL)
+          else: fe[FT] = [SL]
+        if len(fe) > 0:  
+          out += '<td style="width:100px" onclick="showit2(this);"><font color=red>%i reg. FEB errors<!--<br ><br />\n'%len(fe)
+          for i in fe.keys():
+            FEBErrors += '<a style="font-size:9px;" href="%s/LAr/%s/Data_Integrity/%s">(%d,%s)</a>\n' % (url,P,h,i,listify(fe[i])) 
+          out += FEBErrors+'-->\n'
+        else:
+          out += '<td> %i reg. FEB errors <br ><br />'%len(fe)
+          
+      else: out += '<td>'
+      
+
+      try:
+        FEB_trig = p_results[10][N]
+        num_feb_trig = int(FEB_trig['NBins'])
+        if len(FEBErrors_results)>0:
+          if num_feb_trig > 0:
+            out += '<pre style="font-family:Arial;"><a href="%s/LAr/%s/Data_Integrity/missingTriggerType%s"><font color=red> <br>  %i PU trigger errors \n'%(url,P,_Part[P],FEB_trig['NBins'])
+          else:
+            out += ' %i PU trigger errors  <br ><br />' %(num_feb_trig)
+      except: out += "Trig. check unavailable"       
+        
+      out += '</td>\n'
+  
+      # Partition with non-nominal HV
+      HV = []
+      r = p_results[1][N]
+      if r['NBins']>0:
+        K = r.keys(); K.remove('NBins')
+        l = []                 
+        for k in K: 
+          m = RE1.search(k).groupdict()
+          HV.append(int(m['LB']))
+
+      if len(HV)>0:
+        out += '<td style="width:80px"><a href="%s/LAr/%s/Detector_Status/NDeviatingChannels%s">%s</a></td>\n' % (url,P,P,listify(HV)) 
+      else: out += '<td></td>\n'
+
+      # NullDigit, Saturation
+      prob=''
+      for s in range(2):
+        r = p_results[2+s][N]
+        if r['NBins']>0:
+          K = r.keys(); K.remove('NBins')
+          for k in K:
+            m = RE2.search(k).groupdict()
+            SL = int(m['SL'])
+            CH = int(m['FT'])
+            if p<2:
+              FT = (SL-1)/14
+              SL = SL-FT*14
+            else:                    
+              FT = (SL-1)/15
+              SL = SL-FT*15
+            prob += '<a style="font-size:9px;" href="%s/LAr/%s/Data_Integrity/%sChan_%s">(%d,%d,%d,<font style="color:%s">%.1f</font>,%s)</a><br />' % (url,P,S[s],P,FT,SL,CH,color[s],100*r[k],S[s])
+      if len(prob)>0: 
+        out += '<td style="width:30px" onclick="showit2(this);"><a href="%s/LAr/%s/Data_Integrity/">%d FEB</a><br /><!--%s--></td>' % (url,P,prob.count('<br />'),prob)
+      else: out += '<td style="width:30px"></td>\n'
+
+
+      #####################################
+      #NoiseBursts LArNoisyRO q-factor per partition
+      #####################################
+      out += '<td>'
+
+      fail = False
+      if p < 4:
+        try: results[9+p][N]
+        except: fail = True
+      else:
+        try: p_results[5][N]
+        except: fail =True
+
+      #EMB,EMEC        
+      if p < 4 and not fail:    
+        r = results[9+p][N]        
+     
+        K = r.keys()
+        if len(K)>0: K.remove('NBins')
+        LB = {}
+ 
+        for k in K:
+          m = RE1.search(k).groupdict()
+          lb = int(m['LB'])
+          x = '%5.4f'%(r[k])
+          # store LB per output value
+          if includenotready or (lb in ATLASREADY):
+            if LB.has_key(x): LB[x].append(lb)
+            else: LB[x] = [lb]
+ 
+        ##Organize and display LBs (ordered by LB)
+        #if len(LB)>0:
+        #  LBs = [];LBmap = {}
+        #  for val in LB.keys():
+        #    for lb in LB[val]:
+        #      LBs.append(lb)
+        #      LBmap[lb]=[val]
+        #  LBs.sort()   
+        #  NBINS = 0
+        #  for item in LB: NBINS += len(LB[item])
+        #  out += '<pre style="font-family:Arial;"><a href="%s/LAr/%s/Noise/Partition/NoisyEvent_TimeVeto_%s" >%i LBs: </a>\n' % (url,P,_Part2[P],NBINS)
+        #  for lb in LBs:
+        #  
+        #    for val in LBmap[lb]:
+        #
+        #      num_evt = round(float(val)*NevtPerLB[int(lb)]*0.01)
+        #      if isexpress:
+        #        Partition_NoisyEvents.append(lb)
+        #        if p == 2: EMECA_lb.append(lb) 
+        #        if p == 3: EMECC_lb.append(lb) 
+        #      else:
+        #        if num_evt > 1.0:
+        #          Partition_NoisyEvents.append(lb)
+        #          if p == 2: EMECA_lb.append(lb) 
+        #          if p == 3: EMECC_lb.append(lb) 
+        #        else:
+        #          Partition_MediumEvents.append(lb)
+        #          if p == 2: EMECA_mb.append(lb) 
+        #          if p == 3: EMECC_mb.append(lb) 
+        #      out += '%s: %s (%i)<br />' %(lb,val,num_evt)
+
+
+        #Organize and display LBs  (ordered by val)
+        if len(LB)>0:
+          NBINS = 0
+          for item in LB: NBINS += len(LB[item])
+          out += '<pre style="font-family:Arial;"><a href="%s/LAr/%s/Noise/Partition/NoisyEvent_TimeVeto_%s" >%i LBs: </a>\n' % (url,P,_Part2[P],NBINS)
+          Q = LB.keys()
+          Q.sort()
+          Q.reverse()
+          counter = 0;
+          morethanfour = False
+          for val in Q:
+            for lb in LB[val]:
+              num_evt = round(float(val)*NevtPerLB[int(lb)]*0.01)
+              if isexpress:
+                Partition_NoisyEvents.append(lb)
+                if p == 2: EMECA_lb.append(lb) 
+                if p == 3: EMECC_lb.append(lb) 
+              else:
+                if num_evt > 1.0:
+                  Partition_NoisyEvents.append(lb)
+                  if p == 2: EMECA_lb.append(lb) 
+                  if p == 3: EMECC_lb.append(lb) 
+                else:
+                  Partition_MediumEvents.append(lb)
+                  if p == 2: EMECA_mb.append(lb) 
+                  if p == 3: EMECC_mb.append(lb) 
+              counter = counter+1
+              if counter < 5: out += '%s: %s (%i)<br />' %(lb,val,num_evt)
+              elif counter == 5:
+                #out += '<p  onclick="showit2(this);"> ....<!-- <br />'
+                out += '<p  onclick="showit2(this);"><u style="font-family:times;color:blue;">show</u> <!--f <br />'
+                morethanfour = True
+                out += '%s: %s (%i)<br />' %(lb,val,num_evt)
+              else: out += '%s: %s (%i)<br />' %(lb,val,num_evt)
+          if morethanfour: out +=' f--></p>\n'
+      
+      #HEC/FCAL          
+      elif  not fail:
+        r = p_results[5][N]
+        if p == 4:
+          Check_lb = EMECA_lb
+          if not isexpress: Check_mb = EMECA_mb
+        if p == 5:
+          Check_lb = EMECC_lb
+          if not isexpress: Check_mb = EMECC_mb
+        if p == 6:
+          Check_lb = EMECA_lb
+          if not isexpress: Check_mb = EMECA_mb
+        if p == 7:
+          Check_lb = EMECC_lb
+          if not isexpress: Check_mb = EMECC_mb
+ 
+        K = r.keys()
+        if len(K)>0: K.remove('NBins')
+        LB = {} 
+ 
+        for k in K:
+          m = RE1.search(k).groupdict()
+          lb = int(m['LB'])
+          x = '%5.2f'%(r[k])
+          # store LB per output value
+          if includenotready or (lb in ATLASREADY):
+            if lb in Check_lb:
+              if LB.has_key(x): LB[x].append(lb)
+              else: LB[x] = [lb]
+              
+        #Organize and display LBs
+        if len(LB)>0:
+          LBs = [];LBmap = {}
+          for val in LB.keys():
+            for lb in LB[val]:
+              LBs.append(lb)
+              LBmap[lb]=[val]
+          LBs.sort()
+          NBINS = 0
+          for item in LB: NBINS += len(LB[item])
+          #out += '<pre style="font-family:Arial;"><a href="%s/LAr/%s/Noise/Partition/%s_burst" >%i LBs: </a>\n' % (url,P,P,NBINS)
+          for lb in LBs:
+            num_evt = round(float(val)*NevtPerLB[int(lb)]*0.01)
+            if isexpress: Partition_NoisyEvents.append(lb)
+            else:
+              if num_evt > 1.0:
+                Partition_NoisyEvents.append(lb)
+                Check_tb.append(lb)
+              else:
+                Partition_MediumEvents.append(lb)
+                Check_mb.append(lb)
+
+
+
+
+                
+            #Partition_NoisyEvents.append(lb)
+            #for val in LBmap[lb]:
+              #out += '%s: %s (%i)<br />' %(lb,val,math.ceil(float(val)*NevtPerLB[int(lb)]*0.01))
+
+      else:  out += "Not available"        
+
+    
+      out += '</td>\n'
+
+      #############################################################
+      # Noise Bursts (Energy) per partition
+      # Add thresholds O:N3sig>0 O:N3sigTV>0 1:E>10000 2:NQfactor>1
+      #############################################################
+      MinBias = False
+      if run_spec['stream'] == "physics_MinBias": MinBias = True
+
+      
+      threshold=[0,0,50000,1]
+      out += '<td onclick="showit2(this);">\n'
+      LB = {}
+      for j in range(4):
+        try: p_results[5+j][N]#try: p_results[5][N]
+        except:
+          out += "Not available"
+          continue
+        r = p_results[5+j][N]
+        K = r.keys()
+        for k in K:
+          if 'NBins' in k: continue
+          m = RE1.search(k).groupdict()
+
+          # store only lbs above threshold
+          if int(r[k])>threshold[j]:
+            lb = int(m['LB'])
+            if includenotready or (lb in ATLASREADY):
+              if not LB.has_key(lb): LB[lb] = [0,0,0,0]
+              LB[lb][j] = int(r[k])
+     
+      # now flag noise bursts in LBs
+    
+      if len(LB)>0:
+        LBs = LB.keys()
+        LBs.sort()
+        for i,lb in enumerate(LBs):
+          if LB[lb][0]+LB[lb][1]+LB[lb][2]+LB[lb][3]==0: continue
+          # Flag Red bursts per partition if Y3sigma TimeVeto > 0
+          if LB[lb][1]>0:
+            if NBR.has_key(P): NBR[P].append(lb)
+            else:  NBR[P] = [lb]
+          ## Flag Red bursts per partition if nQfactor > 10
+          ##if LB[lb][3]>10:
+          ##  if NBR.has_key(P): NBR[P].append(lb)
+          ##  else:  NBR[P] = [lb]            
+          # do not flag Yellow burst anymore
+          #elif  LB[lb][2]>=5:
+          #  if NBY.has_key(P): NBY[P].append(lb)
+          #  else:  NBY[P]=[lb]
+          mask = False
+          #if lb in NBR or lb in NBY: mask = False 
+          if mask: out += '<!--\n'
+          burst = '' 
+          for j,strength in enumerate(LB[lb]):
+            if abs(strength)<1: continue         
+            if j==1:burst += '<a class="lb%d" href="%s/LAr/%s/Noise/Partition/%s%s">(%d)</a>&nbsp;' % (j,url,P,P,h_names[j],strength)
+            else: burst += '<a class="lb%d" href="%s/LAr/%s/Noise/Partition/%s%s">%d</a>&nbsp;' % (j,url,P,P,h_names[j],strength)       
+                
+          #if lb in TightNoisy_Events:out += '<font style="font-weight:bold;">%d</font>:%s &nbsp;' % (lb,burst.rstrip('&nbsp;'))
+          if lb in Partition_NoisyEvents:out += '<font style="font-weight:bold;">%d</font>:%s &nbsp;' % (lb,burst.rstrip('&nbsp;'))
+              
+          else:out += '%d:%s &nbsp;' % (lb,burst.rstrip('&nbsp;'))
+          if mask: out += '-->\n'   
+    
+      if run_spec['stream'].split('_')[1] == 'express':
+
+        fail = False
+        p_LB_err = []
+        try: p_results[9][N]
+        except: fail = True
+        try: results[43][N]
+        except: fail = True
+
+        if not fail:
+          r = p_results[9][N]          
+          cells = r['NBins']
+          bins = r.keys()
+          bins.remove('NBins')
+          FEBs=0
+
+          LB_bins = results[43][N]
+          LB_keys = LB_bins.keys()
+          LB_keys.remove('NBins')
+          #if p == 1: print LB_keys,"<br>"
+          if (LB_bins['NBins'] > 0):
+            for x,X in enumerate(LB_keys):
+              if LB_bins[X] > 20.0:
+                #if p==0: print "Value: ", LB_bins[X], "  Key: ", X, "  partition: ", X.split('(')[2].split('.')[0] ,"  LB: ",X.split('(')[1].split('.')[0],"<br>"
+                found_p = X.split('(')[2].split('.')[0]
+                found_LB = X.split('(')[1].split('.')[0]
+                if p == 0 and found_p == '1': p_LB_err.append(found_LB)
+                if p == 1 and found_p == '0': p_LB_err.append(found_LB)
+                if p == 2 and found_p == '3': p_LB_err.append(found_LB)
+                if p == 3 and found_p == '2': p_LB_err.append(found_LB)
+                if p == 4 and found_p == '5': p_LB_err.append(found_LB)
+                if p == 5 and found_p == '4': p_LB_err.append(found_LB)
+                if p == 6 and found_p == '7': p_LB_err.append(found_LB)
+                if p == 7 and found_p == '6': p_LB_err.append(found_LB)
+          
+          out +=  '<td>'
+          #print "Partition: ", p, " LB: ",p_LB_err, "<br>"
+          if cells > 0:
+            for i,I in enumerate(bins):
+              if r[I] > 150.0: FEBs+=1
+              #print r[I],'<br>'
+            if FEBs > 0:    
+              #out +=  '<pre style="font-family:Arial;"><a href="%s/LAr/%s/Data_Integrity/Out_E_FT_vs_SLOT_%s"><font color=red> <br>  %i FEBs with E difference</a><br />\n' % (url,P,_Part[P],FEBs)
+              out +=  '<pre style="font-family:Arial;"><a href="%s/LAr/%s/Data_Integrity/Out_E_FT_vs_SLOT_%s"><font color=red> <br>  %i FEBs with > 150 \n errors in E computation </a>' % (url,P,_Part[P],FEBs)
+
+          if p_LB_err > 0:
+              num_LB = 0
+              for i in p_LB_err: num_LB = num_LB+1
+              if num_LB > 0: out +=  '<pre style="font-family:Arial;"><a href="%s/LAr/LAR_GLOBAL/Data_Integrity/EErrorsPerLB"><font color=red> <br> %d LBs with > 20 \n errors in E computation </font> </a><br>' % (url,num_LB)
+              for i in p_LB_err: out += '%s <br />' %(i)
+              
+          out +=  '</td>'
+          
+        else:    out +=  '<td> Not available </td>\n'
+
+      else: out +=  '<td></td>\n'
+
+      #####timing
+      if CosmicCalo == False and  MinBias == False:
+        
+        fail = False
+        Layers = Part3[P]
+        out += '<td>'
+        for j,J in enumerate(Layers):
+          try: results[13+j][N]
+          except: fail = True
+
+
+          if not fail:
+            if not p==7: r = results[13+j+p*4][N]
+            else:   r = results[13+j+p*4-1][N]
+            mean = r['Mean']
+            if j==1:
+              if mean > 1.0 or mean < -1.0:
+                out +=  '<pre style="font-family:Arial;"><a href="%s/LAr/%s/Signal_Time/Single_Cells/CellEnergyVsTime_%s"><font color=red> %s mean=%.2f </a> \n' % (url,P,J,J,mean)
+            elif mean > 2.0 or mean < -2.0:
+              out +=  '<pre style="font-family:Arial;"><font color=red><a href="%s/LAr/%s/Signal_Time/Single_Cells/CellEnergyVsTime_%s"><font color=red> %s mean=%.2f </a> \n' % (url,P,J,J,mean)
+                    
+          else:  out +=  'Not available'
+            
+        out +=  '</td>\n'  
+
+      else:out +=  '<td></td>\n'
+
+      print out+'</td>\n</tr>\n'
+      #Flagged_LBs += NBR+NBY
+      
+
+      ###############################################print "Noisy: ", NBR,Partition_NoisyEvents, "<br>"
+
+      ##################################
+      # Find noise bursts in partition #
+      ##################################
+      tb = []; mb = []
+      ###if P in NBR: print "DEBUG RED",P,NBR[P],"<br>"
+      ###if P in NBY: print "DEBUG YELLOW",P,NBY[P],"<br>"
+      #for lb in TightNoisy_Events:
+      #print Partition_NoisyEvents
+      for lb in Partition_NoisyEvents:
+        tb.append(lb)  ########################### NEW WAY ######################
+      for lb in Partition_MediumEvents:
+        mb.append(lb) 
+        
+        ###############################
+        ##### OLD WAY #################
+        ###############################
+        ## add red burst always
+        #if P in NBR and lb in NBR[P]:
+        #  tb.append(lb)
+        #  ###print "......DEBUG TIGHT partial tb (from NBR):",P,tb,"<br>" 
+        #  continue
+        ## add yellow bursts only if in more than 1 partition
+        #elif P in NBY and lb in NBY[P]:
+        #  ###print "***",P,lb,"<br>"
+        #  occured = 0
+        #  for part in NBR:
+        #    for item in NBR[part]:
+        #      if item == lb:
+        #        occured+=1
+        #        ###print "------------ found in NBR:",P,part,item,lb,occured,"<br>"
+        #  for part in NBY:
+        #    for item in NBY[part]:
+        #      if item == lb:
+        #        occured+=1
+        #        ###print "------------ found in NBY:",P,part,item,lb,occured,"<br>"
+        #  if occured > 1: tb.append(lb)
+        #  ###print "......DEBUG partial tb (from NBY):",tb,"<br>"
+          
+      #for lb in MediumNoisy_Events:
+      #  if lb in TightNoisy_Events: continue
+      #  # print "DEBUG %s checking MEDIUM lb %i to be assigned <br>"%(P,lb)
+      #  # add red burst always
+      #  if P in NBR and lb in NBR[P]:
+      #    mb.append(lb)
+      #    ###print "......DEBUG MEDIUM partial mb (from NBR):",P,mb,"<br>" 
+      #    continue
+      #  # add yellow bursts only if in more than 1 partition
+      #  elif P in NBY and lb in NBY[P]:
+      #    occured = 0
+      #    for part in NBR:
+      #      for item in NBR[part]:
+      #        if item == lb:
+      #          occured+=1
+      #    for part in NBY:
+      #      for item in NBY[part]:
+      #        if item == lb:
+      #          occured+=1
+      #    if occured > 1: mb.append(lb)
+
+ 
+      ###########################  
+      # Now fill bursts defects #
+      ###########################
+      #print "mb: ",mb," tb: ",tb," Check_mb: ",Check_mb," Check_lb: ",Check_lb, "<br>"
+      
+      if p > 3 and len(Check_lb) > 0:
+        tb = Check_lb
+        #if run_spec['proc_ver']==esproc or run_spec['proc_ver']==cleanesproc or run_spec['proc_ver']==101:
+        if isexpress:  
+          df = "LAR_"+P+"_NOISEBURST <font color=yellow>Y</font> "+listify(tb)+" # Noise burst in the LB spotted in %s - Cleaned by time veto"%(run_spec['stream'])
+          noisedefects.append(df)
+ 
+        # severe noise burst defect for BULK
+        #if run_spec['proc_ver']==bulkproc or run_spec['proc_ver']==cleanbulkproc or run_spec['proc_ver']==102:
+        if not isexpress:  
+          df = "LAR_"+P+"_SEVNOISEBURST <font color=red>R</font> "+listify(tb)+" # noise burst - NOT cleaned with Time Veto (v3)"
+          sevnoisedefects.append(df)
+          df = "LAR_"+P+"_NOISEBURST <font color=green>G</font> "+listify(tb)+" # noise bursts - NOT cleaned  with Time Veto (v3)"
+          noisedefects.append(df)
+      
+      elif len(tb)>0 :
+        # soft noise burst for ES
+        #if run_spec['proc_ver']==esproc or run_spec['proc_ver']==cleanesproc:
+        #if run_spec['proc_ver']==esproc or run_spec['proc_ver']==cleanesproc or run_spec['proc_ver']==101:
+        if isexpress:  
+          #df = "LAR_"+P+"_NOISEBURST <font color=yellow>Y</font> "+listify(tb)+" # noise bursts - Cleaned with Time Veto (v3)"
+          df = "LAR_"+P+"_NOISEBURST <font color=yellow>Y</font> "+listify(tb)+" # Noise burst in the LB spotted in %s - Cleaned by time veto"%(run_spec['stream'])
+          noisedefects.append(df)
+ 
+        # severe noise burst defect for BULK
+        #if run_spec['proc_ver']==bulkproc or run_spec['proc_ver']==cleanbulkproc or run_spec['proc_ver']==102:
+        if not isexpress:  
+          df = "LAR_"+P+"_SEVNOISEBURST <font color=red>R</font> "+listify(tb)+" # noise burst - NOT cleaned with Time Veto (v3)"
+          sevnoisedefects.append(df)
+          df = "LAR_"+P+"_NOISEBURST <font color=green>G</font> "+listify(tb)+" # noise bursts - NOT cleaned  with Time Veto (v3)"
+          noisedefects.append(df)
+
+      if not isexpress:    
+
+        if p > 3 and len(Check_mb) > 0:
+          mb = Check_mb
+          df = "LAR_"+P+"_NOISEBURST <font color=yellow>Y</font> "+listify(mb)+" # single isolated event flagged as LArNoisyRO_Std in JetTauEtmiss"
+          noisedefects.append(df)
+        elif len(mb)>0 :
+          df = "LAR_"+P+"_NOISEBURST <font color=yellow>Y</font> "+listify(mb)+" # single isolated event flagged as LArNoisyRO_Std in JetTauEtmiss"
+          noisedefects.append(df)  
+ 
+      
+    # include partition defects in global defects
+    for item in noisedefects:defects.append(item)
+    for item in sevnoisedefects:defects.append(item)
+      
+    if n<len(runs)-1: print '\n<tr><td colspan="8"><hr/></td></tr>\n'
+
+ 
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/selection.py b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/selection.py
new file mode 100644
index 00000000000..7c72f0cac31
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/prod/selection.py
@@ -0,0 +1,125 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+########################################################################
+def PrintSelection(run_spec,info,cluster_threshold,beambkg,expert,includenotready,ladies,cluster_E):
+
+  out = '<form name="selection" id="selection" method="post" target="_self">\n'
+  out += '<div style="text-align:left" id="queryrow">\n'
+
+  # runs menu
+  out +=  '<br><b>LADIeS Options -- </b>'
+  out += '<br> &nbsp;&nbsp; Run Number:<input type="text" size="6" name="low_run" '
+  if run_spec.has_key('low_run'): out += 'value="'+run_spec['low_run']+'" '
+
+   # job menu
+  out += '/>&nbsp;&nbsp;\n Report Type: '
+  out += '<select name="ladies" style="text-align:left">'
+  for j,job in enumerate(['LADIeS-express','LADIeS-bulk', 'ExpertOptions-express','ExpertOptions-bulk']):
+    out += '<option value="'+str(j)+'"'
+    if j==ladies: out+= ' selected'
+    out += '>'+job+'</option>'
+  out += '</select>\n'
+
+
+  # job menu
+  out += '&nbsp;&nbsp;\n  '
+  out += '<select name="info" style="text-align:left">'
+  for j,job in enumerate(['Run Report','Noisy LAr Cells']):
+    out += '<option value="'+str(j)+'"'
+    if j==info: out+= ' selected'
+    out += '>'+job+'</option>'
+  out += '</select>\n'
+
+  
+  #out += '<br>'
+
+  # buttons
+  out += '&nbsp;<input type="submit" value="Submit"/>\n'
+  out += '<input type="reset" value="Reset" onclick="ResetForm()" />\n'
+  out += '<input type="button" value="Help" onclick="Helper()" />\n'
+  
+
+  # end option section
+  out += '</div>\n'
+  
+  print out+'<br />'
+
+  
+  out = '<div style="text-align:left" id="expertrow">\n'
+
+  # stream menu
+  out += '<b>Expert Options (Stream, source and proc. version are defined by "Report Type" unless "ExpertOptions" is selected) -- <br></b>'
+  #out += '/>&nbsp;&nbsp;Data stream:<select name="stream" value="CosmicCalo" style="text-align:left;">'
+  out += '&nbsp;&nbsp;Data stream:<select name="stream" style="text-align:left;">'
+  ST = run_spec['stream'].split('_')[1]
+  for st in ['CosmicCalo','JetTauEtmiss','Egamma','express','MinBias','HardProbes']:
+    out += '<option value="'+st+'"'
+    if st==ST: out+= ' selected'
+    out += '>'+st+'</option>'
+  out += '</select>&nbsp;&nbsp;\n'
+    
+  # source menu
+  out += 'Source:<select name="source" style="text-align:left;">'
+  for source in ['tier0','reproc','larcomm','test']: 
+    out += '<option value="'+source+'"'      
+    if source==run_spec['source']: out+= ' selected'
+    out += '>'+source+'</option>' 
+  out += '</select>&nbsp;&nbsp;'
+      
+  # proc_ver menu
+  out += 'Processing_version:<input name="proc_ver" size="5" style="text-align:left" value="%d" />&nbsp;&nbsp;' % (run_spec['proc_ver'])
+
+  # end expert section
+  out += '</div>\n'
+  
+  print out+'<br />'
+
+  out = '<div style="text-align:left" id="Advanced">\n'
+
+  # stream menu
+  out += '<b> Advanced options (do not touch unless you know what you do!) -- <br></b>'     
+      
+  # cluster theshold
+  out += 'Clusters [evts]:<input name="cluster_threshold" size="2" style="text-align:left" value="%d" />&nbsp;&nbsp;' % (cluster_threshold)
+
+  # cluster E menu
+  out += 'Cluster E:<select name="cluster_E" style="text-align:left;">'
+  for clus_e in ['Et>10GeV','Et>5GeV','E>10GeV','E>5GeV']: 
+    out += '<option value="'+clus_e+'"'
+    if clus_e==cluster_E: out+= ' selected'
+    out += '>'+clus_e+'</option>' 
+  out += '</select>&nbsp;&nbsp;'
+  
+  # options
+  out += 'BeamBkg:<input type="checkbox" name="beambkg" '
+  if beambkg: out += 'checked="checked" />\n'
+  else:out += '/>\n'
+    
+    
+  #out += '&nbsp;Expert Output:<input type="checkbox" name="expert" '
+  #if expert>10:out += 'checked="checked" />\n'
+  #else:out += '/>\n'
+        
+        
+  # option to include non ATLAS ready LBs  &nbsp;
+  out += '&nbsp;&nbsp;&nbsp;Include ATLAS not ready LBs:<input type="checkbox" name="includenotready" '
+  if includenotready: out += 'checked="checked" />'
+  else:out += '/>\n'
+
+  out += '</div>\n'
+  
+  # end option section
+
+  print out+'<br />'
+
+  
+########################################################################
+def AddReportButton(defects,run_spec,info,beambkg):
+  dbdefects="'"+'<br>'.join(defects)+"'"
+  if not dbdefects:
+    dbdefects="''"
+  #if beambkg: dbdefects +="B"  
+  out = '<hr><input type="button" value="Get Report" onclick="Report(%s,%s,%s,%s,%i)" />\n'%(info,run_spec['low_run'],run_spec['proc_ver'],dbdefects,beambkg)
+  out += '<input type="button" value="Defect DB" onclick="DefectDB(%s)" />\n'%(run_spec['low_run'])
+  out += '<input type="button" value="LAr DB log" onclick="LArDBlog()" />'
+  print out+'<br />'
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/scripts_ref.js b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/scripts_ref.js
new file mode 100644
index 00000000000..ea5da2da34a
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/scripts_ref.js
@@ -0,0 +1,354 @@
+<!--
+
+var FMT = "bec side ft sl ch 0 ProposedFlag # onlid";
+var runnum = 0; var processing = 1;
+var ecal_content; var upd4_content;
+var TotalHN = 0; var TotalHN_PS = 0;
+var TotalSpo = 0;var TotalSpo_PS = 0;
+var nEMBA = 0;var nEMBC = 0;
+var nEMECA = 0;var nEMECC = 0;
+var nHECA = 0;var nHECC = 0;
+var nFCALA = 0;var nFCALC = 0;
+
+
+function Helper() {
+    var help = "<br /><hr />"
+           + "<ul>"
+           + "<li>More information <a href='https://twiki.cern.ch/twiki/bin/view/Atlas/LArIDTranslator'>here</a></li>"
+           + "<li>Use the fields to make your selection and press the Submit button</li>"
+           + "<li>Set ranges using , (e.g. for CH: 15,19 means 15<=CH<=19)</li>"
+           + "<li>Alternatively, fill by hand the top input bar with a sql selection (use =,and,or,like,between,in) and press Enter</li>"
+           + "<li>Double-click on a channel to get the standard format of it printed at the bottom:<br />"+FMT+"</li>"
+           + "<li>DB file generated with tags ATLAS-GEO-16-00-00, COMCOND-ES1PST-004-01 (UPD1) and COMCOND-BLKPST-004-01 (UPD4) for run 0x7fffffff, i.e. IOV to infinity</li>"
+           + "<li>Double-click on the title <LArID translator browser> at the top to perform an extraction of webdisplay info</li>"
+           + "<li>Code available on svn <a href='https://svnweb.cern.ch/trac/atlasusr/browser/mplamond/projects/LArIdtranslator/trunk'>here</a></li>"
+           + "<li>Contact <a href='http://cern.ch/mplamond'>Mathieu.Plamondon@cern.ch</a> for bugs and suggestions</li>"
+           + "</ul>";
+    document.getElementById("help").innerHTML = help;
+}
+
+function ResetForm() {
+  var el = document.forms[0].elements;
+  for (var i=0;i<el.length;i++) {
+    if ( el[i].hasAttribute("value") ) {
+      if ( el[i].getAttribute("value")!="Reset" && el[i].getAttribute("value")!="Submit" && el[i].getAttribute("value")!="Help" && el[i].getAttribute("value")!="Report" ) el[i].setAttribute("value","");
+    }
+    if ( el[i].hasAttribute("selected") ) el[i].removeAttribute("selected");
+    opt = el[i].getElementsByTagName("option");
+    for (var j=0;j<opt.length;j++) {
+      if ( opt[j].hasAttribute("selected") ) opt[j].removeAttribute("selected");
+    }
+  }
+  document.getElementById("help").innerHTML = "";
+}
+
+function ChangeColor(tr) {
+ if (tr.style.backgroundColor!="white") { tr.style.backgroundColor="white"; }
+ else { tr.style.backgroundColor="#DDFFDD"; }
+}
+
+function ToggleFlag(td) {
+ if ( td.innerHTML=="" ) { td.innerHTML="sporadicBurstNoise"; td.style.backgroundColor="#FF6600"; }
+ else if ( td.innerHTML=="sporadicBurstNoise" ) { td.innerHTML="highNoiseHG"; td.style.backgroundColor="#FF0000"; }
+ else if ( td.innerHTML=="highNoiseHG" ) { td.innerHTML="Warning:ECAL"; td.style.backgroundColor="#FFFF00"; }
+ else if ( td.innerHTML=="Warning:ECAL" ) { td.innerHTML="PedShift:ECAL"; td.style.backgroundColor="#FFFFCC"; }
+ else if ( td.innerHTML=="PedShift:ECAL" ) { td.innerHTML="BeamBkg"; td.style.backgroundColor="#009900"; }
+ else if ( td.innerHTML=="BeamBkg" ) { td.innerHTML=""; td.style.backgroundColor=""; }
+ 
+ if ( td.style.fontWeight!="bold" ) td.style.fontWeight="bold";
+}
+
+function showit(td,i) {
+  td.innerHTML = i;
+}
+
+function showit2(td) {
+  var tmp = td.innerHTML;
+  for (i=0;i<1;i++) { 
+    //tmp = tmp.replace("showit2","showit3");
+    //tmp = tmp.replace("show","hide");
+    tmp = tmp.replace("<!--f","<!--b-->");
+    tmp = tmp.replace("f-->","<!--e-->");
+  }
+  td.innerHTML = tmp;
+}
+
+//function showit2(td) {
+//  var tmp = td.innerHTML;
+//  for (i=0;i<1;i++) { 
+//    tmp = tmp.replace("showit2","showit3");
+//    tmp = tmp.replace("show","hide");
+//    tmp = tmp.replace("<!--f","<!--b-->");
+//    tmp = tmp.replace("f-->","<!--e-->");
+//  }
+//  td.innerHTML = tmp;
+//}
+
+function showit3(p) {
+  var tmp = p.innerHTML;
+  for (i=0;i<1;i++) { 
+    tmp = tmp.replace("showit3","showit2");
+    tmp = tmp.replace("hide","show");
+    tmp = tmp.replace("<!--b-->","<!--f");
+    tmp = tmp.replace("<!--e-->","f-->");
+  }
+  p.innerHTML = tmp;
+}
+
+function PrintDBExpertFormat(tr) {
+
+  var td = tr.getElementsByTagName("td");
+  var bec = 1;
+  if ( td[2].innerHTML=="EMB" ) bec = 0;
+  var side = 0;
+  if ( td[3].innerHTML=="A+" ) side = 1;
+  var flag = td[17].innerHTML;
+  var sampling = td[7].innerHTML;
+
+  //document.getElementById("help").innerHTML += "MY TEST "+td[2].innerHTML+td[3].innerHTML+" "+bec+" "+side+" "+td[4].innerHTML+" "+flag+"<br>";
+
+  if ( flag != "highNoiseHG" && flag != "sporadicBurstNoise") return;
+
+  // Check for duplicated cells associated to several clusters
+  var cell_id = td[1].innerHTML;
+  var det = td[2].innerHTML+td[3].innerHTML;
+  check = upd4_content.indexOf(cell_id,0);
+  if (check > 0) return; 
+
+  // Increment counters
+  if ( flag == "highNoiseHG") {
+     TotalHN +=1; 
+     if (sampling==0 && td[2].innerHTML != "HEC") TotalHN_PS +=1; 
+  }
+  if ( flag == "sporadicBurstNoise") {
+     TotalSpo +=1;
+     if (sampling==0 && td[2].innerHTML != "HEC") TotalSpo_PS +=1; 
+  }
+  if ( det == "EMBA+") { nEMBA +=1; }
+  if ( det == "EMBC-") { nEMBC +=1; }
+  if ( det == "EMECA+") { nEMECA +=1; }
+  if ( det == "EMECC-") { nEMECC +=1; }
+  if ( det == "HECA+") { nHECA +=1; }
+  if ( det == "HECC-") { nHECC +=1; }
+  if ( det == "FCALA+") { nFCALA +=1; }
+  if ( det == "FCALA+") { nFCALC +=1; }	
+
+  // store the channel
+  var content = bec+" "+side+" "+td[4].innerHTML+" "+td[5].innerHTML+" "+td[6].innerHTML+" 0 "+flag+" # "+td[1].innerHTML;
+  upd4_content +=content+"%0A";
+  document.getElementById("help").innerHTML += content+"<br />";
+
+}
+
+function PrintInfoECAL(tr) {
+  var td = tr.getElementsByTagName("td");
+  //var flag = td[16].innerHTML;
+  var flag = td[17].innerHTML;
+  var substr = flag.split(":");
+  //document.getElementById("help").innerHTML += "MY TEST ECAL"+td[4].innerHTML+" "+flag+"<br>";
+  if ( substr.length == 1 ) return;
+  var part = td[2].innerHTML+td[3].innerHTML[0]; 
+  var ft = td[4].innerHTML; 
+  var slot = td[5].innerHTML; 
+  var ch = td[6].innerHTML;
+  var sampling = td[7].innerHTML;
+  //////////////////////////////////////////////////////////////////
+  url="https://lar-elec-automatic-validation.web.cern.ch/lar-elec-automatic-validation/cgi-bin/History.sh?";
+  url_html=url+"sub_sub_partition="+part+"&ft="+ft+"&sl="+slot+"&ch="+ch+"&printFormat=Ratio";
+  url_ascii=url+"sub_sub_partition="+part+"%26ft="+ft+"%26sl="+slot+"%26ch="+ch+"%26printFormat=Ratio";
+  var content= part+" "+ft+" "+slot+" "+ch+" "+sampling+" "+flag+" ";
+  ////////////////////////////////////////////////////////////////////
+  document.getElementById("help").innerHTML += content+"<a href="+url_html+">link to ECAL history</a>"+"<br />";
+  ecal_content += " * "+content+" Link to ECAL history: "+url_ascii+"%0A";
+  //ecal_content += " * "+content+" Link to ECAL history:<a href='"+url_ascii+"'>link to ECAL history</a>%0A";
+}
+
+function Report(info,run,proc,defects,beambkg){
+  runnum = run;
+  processing = proc;
+  //var dstring = String(defects);
+  //var dc = dstring.charAt(dstring.length()-1);
+  
+
+  /// start with cleaning the "help" section
+  document.getElementById("help").innerHTML = "";
+
+  /// Title & Infos
+  if (info == 0) {
+      document.getElementById("help").innerHTML += "<hr />Defect DB upload (<font color=green>G</font>=defect absent <font color=yellow>Y</font>=defect present,recoverable <font color=red>R</font>=defect present,unrecoverable)<hr />";
+      document.getElementById("help").innerHTML += defects+'<br>';
+      //if (beambkg == 1) document.getElementById("help").innerHTML += "NB:  This list produced with BB <br>";
+      // Add button to upload defects and launch LCE jobs
+      document.getElementById("help").innerHTML += '<br><input type="button" value="Upload Defects" onclick="UploadDefects()"/>';
+  }
+
+  /// Bad Channels
+  if (info == 1) {
+
+    // reset the global variables used to store channels
+    ecal_content = "";
+    upd4_content = "";
+    TotalHN = 0; TotalHN_PS = 0;
+    TotalSpo = 0; TotalSpo_PS = 0;
+    nEMBA = 0;nEMBC = 0;
+    nEMECA = 0;nEMECC = 0;
+    nHECA = 0;nHECC = 0;
+    nFCALA = 0;nFCALC = 0;
+
+    // Retrieve list of channels
+    var tr = document.getElementsByTagName("tr");
+
+    // First, channels that have to be put in the DB
+    document.getElementById("help").innerHTML += "<hr />"; 
+    document.getElementById("help").innerHTML += "Cells requiring masking: ";
+    document.getElementById("help").innerHTML += "BEC Side FT SL CH CL flag # onlid <hr />";
+    var help = document.getElementById("help").innerHTML;
+
+    // Print cells
+    for (var i=0;i<tr.length;i++) {
+      var td = tr[i].getElementsByTagName("td");
+      if ( td.length<10 ) continue;
+      if ( td[1].innerHTML[1] != "x" ) continue;
+      if ( td[16].innerHTML[1] == "" ) continue; 
+      help += PrintDBExpertFormat(tr[i]); 
+    }
+
+   // Print summary numbers
+    document.getElementById("help").innerHTML += "<br>Total number of sporadicBurstNoise (PS) : "+TotalSpo+" ("+TotalSpo_PS+")<br>";
+    document.getElementById("help").innerHTML += "Total number of highNoiseHG (PS) : "+TotalHN+" ("+TotalHN_PS+")<br>";
+    if (beambkg == 1) {
+      document.getElementById("help").innerHTML += "NB : this list has been produced with BeamBkg option<br>";
+    }
+
+    if (TotalSpo > 700 || TotalHN > 30) document.getElementById("help").innerHTML += "<font color=red>The number of proposed channels seems to be really high. It is perhaps due to beam background. Please contact the DQ coordinators if you have any doubt </font><br>"
+
+    // Add button to email the LAr DB Experts
+      if (beambkg == 1)document.getElementById("help").innerHTML += '<br><input type="button" value="Send Mail to DB Experts" onclick="emailDBExperts(1)"/>';
+      else document.getElementById("help").innerHTML += '<br><input type="button" value="Send Mail to DB Experts" onclick="emailDBExperts(0)"/>';
+
+    // Fill & Print defects // BULK only
+    var defects = "";
+    document.getElementById("help").innerHTML += "<hr />";
+
+    if (processing == 1 || processing == 101 || processing == 111) {
+        document.getElementById("help").innerHTML += "Text file for Defect DB upload (<font color=green>G</font>=defect absent <font color=yellow>Y</font>=defect present,recoverable <font color=red>R</font>=defect present,unrecoverable)<hr />";
+	defects += "@"+runnum+"<br>";
+	defects += "LAR_UNCHECKED <font color=green>G</font> # ES has been checked by LADIeS <br>"
+    }
+
+    if (processing == 2 || processing == 102) {
+
+	defects += "@"+runnum+"<br>";
+	defects += "LAR_BULK_UNCHECKED <font color=green>G</font> # BULK has been checked by LADIeS <br>"
+	if (nEMBA>0) { defects += "LAR_EMBA_NOISYCHANNEL <font color=yellow>Y</font> # "+nEMBA+" Noisy Cells - To be masked after reprocessing<br>"; }
+	if (nEMBC>0) { defects += "LAR_EMBC_NOISYCHANNEL <font color=yellow>Y</font> # "+nEMBC+" Noisy Cells - To be masked after reprocessing<br>"; }
+	if (nEMECA>0) { defects += "LAR_EMECA_NOISYCHANNEL <font color=yellow>Y</font> # "+nEMECA+" Noisy Cells - To be masked after reprocessing<br>"; }
+	if (nEMECC>0) { defects += "LAR_EMECC_NOISYCHANNEL <font color=yellow>Y</font> # "+nEMECC+" Noisy Cells - To be masked after reprocessing<br>"; }
+	if (nHECA>0) { defects += "LAR_HECA_NOISYCHANNEL <font color=yellow>Y</font> # "+nHECA+" Noisy Cells - To be masked after reprocessing<br>"; }
+	if (nHECC>0) { defects += "LAR_HECC_NOISYCHANNEL <font color=yellow>Y</font> # "+nHECC+" Noisy Cells - To be masked after reprocessing<br>"; }
+	if (nFCALA>0) { defects += "LAR_FCALA_NOISYCHANNEL <font color=yellow>Y</font> # "+nFCALA+" Noisy Cells - To be masked after reprocessing<br>"; }
+	if (nFCALC>0) { defects += "LAR_FCALC_NOISYCHANNEL <font color=yellow>Y</font> # "+nFCALC+" Noisy Cells - To be masked after reprocessing<br>"; }
+	
+    }
+    document.getElementById("help").innerHTML += defects;
+
+    // Then, add channels that have to be reported to the ECAL Team - Only for express stream
+    if (processing == 1 || processing == 101 || processing == 111) {
+ 	document.getElementById("help").innerHTML += "<hr />"; 
+    	document.getElementById("help").innerHTML += "Cells to report to the ECAL team: ft sl ch layer flag <hr />";
+    	var help = document.getElementById("help").innerHTML;
+    	for (var i=0;i<tr.length;i++) {
+      		var td = tr[i].getElementsByTagName("td");
+      		if ( td.length<10 ) continue;
+      		if ( td[1].innerHTML[1] != "x" ) continue;
+      		if ( td[16].innerHTML[1] == "" ) continue;
+      		help +=PrintInfoECAL(tr[i]); 
+    	}
+    	// Button to email the ECAL team
+	document.getElementById("help").innerHTML += '<br><input type="button" value="Send Mail to ECAL" onclick="emailECAL()"/>';
+    }
+  }
+}
+
+function emailDBExperts(beambkg){
+  var email = "atlas-lar-db-experts@cern.ch";
+  var DBTAG = "UPD4"; var ADD="";
+  if (processing == 2 || processing == 102){
+      DBTAG = "UPD3";
+      ADD=" they were missed during the Express-Stream "
+  }
+  var subject = "LADIeS Report: cells to be masked in "+DBTAG+" for run "+runnum;
+  var body_message = "Dear LAr DB Experts,%0A%0A the LADIeS inform you that the following channels are inducing clusters,"+ADD+" and need to be added in "+DBTAG+" for run "+runnum+":%0A%0A";
+  // summary numbers
+  body_message += "Total number of sporadicBurstNoise (PS) : "+TotalSpo+" ("+TotalSpo_PS+")%0A";
+  body_message += "Total number of highNoiseHG (PS) : "+TotalHN+" ("+TotalHN_PS+")%0A%0A";
+  if (beambkg) body_message += "NB : the following list has been produced with BeamBkg option%0A%0A";
+  body_message += upd4_content+"%0A%0A"
+  // signature
+  body_message += "Sincerely Yours,%0A%0A --The LADIeS Team";
+  var mailto_link = 'mailto:'+email+'?subject='+subject+'&body='+body_message;
+  win = window.open(mailto_link,'emailWindow');
+  if (win && win.open &&!win.closed) win.close();
+}
+
+function emailECAL(){
+
+  //var email = "hn-atlas-lar-electronic-calibration@cern.ch,Atlas.Larcalibration@cern.ch";
+  var email = "hn-atlas-lar-electronic-calibration@cern.ch;majewski@bnl.gov;benjamin.trocme@cern.ch;larcalib@cern.ch;Atlas.Larcalibration@cern.ch";
+  var subject = "LADIeS Report: suspicious cells in run "+runnum;
+  var body_message = "Dear ECAL Team,%0A%0A the LADIeS inform you that significant deviations are observed for the following channels in run "+runnum+":%0A%0A"+ecal_content+"%0A Although those channels are not creating clusters (yet), could you have a look at them ?%0A%0ASincerely Yours,%0A%0A --The LADIeS Team";
+  var mailto_link = 'mailto:'+email+'?subject='+subject+'&body='+body_message;
+  win = window.open(mailto_link,'emailWindow');
+  if (win && win.open &&!win.closed) win.close();
+
+  //OutputStream outputStream = new FileOutputStream("ECAL/run_"+runnum+".txt"); 
+  //Writer writer = new OutputStreamWriter(outputStream); 
+  //writer.write("Hello World"); writer.close();
+
+  //OutputStream outputStream = new FileOutputStream(); 
+  //Writer writer = new OutputStreamWriter(outputStream); 
+  //writer.write("Hello World"); writer.close();
+
+  // Dump the same info in a text file 
+  //var dir = "/afs/cern.ch/user/l/larmon/public/WebDisplayExtractor/ECAL/";
+  //var dir = "/var/vhost/atlas-larmon/secure/WebDisplayExtractor/ECAL/";
+  //var filename = "ListOfSuspiciousCells_run"+runnum+".txt";
+  //var fh = fopen(dir+filename, 3); // Open the file for writing
+  //if(fh!=-1) { // If the file has been successfully opened
+  //   fwrite(fh,ecal_content); // Write the string to a file
+  //}
+  //fclose(fh); // Close the file 
+
+  //File f;
+  //f=new File("myfile.txt");
+  //if(!f.exists()){
+  //f.createNewFile();
+  //System.out.println("New file \"myfile.txt\" has been created to the current directory");
+
+}
+
+function DefectDB(runnum) {
+    // function to be improve to maybe, to load file automatically someday
+    if (runnum != ""){
+       var url = "https://atlasdqm.cern.ch/defectentry/?run="+runnum+"&filter=LAr";
+       window.open(url);
+    }
+}
+
+function DCSQuery(runnum) {
+    if (runnum != ""){
+       var url = "http://atlas-runquery.cern.ch/query.py?q=find+run+"+runnum+"+%2F+show++dq+lar+DCSOFL";
+       window.open(url);
+    }
+}
+
+function UploadDefects() {
+
+}
+
+function LArDBlog() {
+   var url = "https://atlas-larmon.cern.ch/WebDisplayExtractor/DatabaseChangelog";
+   window.open(url);
+}
+
+-->
diff --git a/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/styles.css b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/styles.css
new file mode 100644
index 00000000000..ad6be57d041
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/python/WebDisplayExtractor/styles.css
@@ -0,0 +1,107 @@
+html,body {
+border-collapse:collapse;
+padding:0px;
+margin:0px;
+text-decoration:none;
+font-family:"Arial";
+font-size:15px;
+height:100%;
+}
+
+/*
+input[type='checkbox'] {
+vertical-align:middle;
+}
+*/
+
+a {
+text-decoration:none;
+}
+
+td,pre {
+padding:0px;
+border-collapse:collapse;
+}
+
+table {
+border-collapse:collapse;
+text-align:center;
+padding:0px;
+font-size:10px;
+}
+
+input,select {
+border-collapse:collapse;
+text-align:center;
+padding:0px;
+margin:0px;
+font-size:10px;
+}
+
+table.list td {
+padding:1px;
+border: 1px solid white;
+}
+
+table.list pre { 
+padding:0px; 
+border-collapse:collapse;
+margin:0px;
+}
+
+table.list {
+font-family:"Arial";
+font-size:10px;
+padding:1px;
+background: #4F81BD;
+}
+
+table.report td { 
+padding:5px;
+border: 1px solid white;
+}
+
+table.report {
+font-family:"Arial";
+font-size:12px;
+/*padding:10px;*/
+background: #4F81BD;        
+}
+
+tr.out0 { background: #E9EDF4; font-size: 90%; }
+tr.out1 { background: #D0D8E8; font-size: 90%; }
+
+
+/*  0:GREEN 1:RED 2:BLUE 3:PINK 4:YELLOW 5:BLACK */
+
+a.det0 { color: #006600; } /* green */
+a.det1 { color: #FF0000; } /* red */
+a.det2 { color: #0000FF; } /* blue */
+a.det3 { color: #FF00FF; }
+a.det4 { color: #FFFF00; } /* yellow */
+a.det5 { color: #000000; }
+
+img.b0 {border:5px solid #006600;} /* green */
+img.b1 {border:5px solid #FF0000;} /* red */
+img.b4 {border:5px solid #FFFF00;} /* yellow */
+
+a.lb0 { color: #FF6600; }
+a.lb1 { color: #FF0000; }
+a.lb2 { color: #0000FF; }
+a.lb3 { color: #006600; }
+
+.wrapper {
+min-height: 100%;
+height: 100%;
+height: auto !important;
+margin: 0px 0px -75px 5px;
+}
+.footer, .push {
+height: 75px;
+margin: auto 5px;
+}
+
+div {
+margin: 0;
+font-size:10px;
+}
diff --git a/LArCalorimeter/LArMonitoring/share/LArNoiseBursts_prodJO.py b/LArCalorimeter/LArMonitoring/share/LArNoiseBursts_prodJO.py
new file mode 100644
index 00000000000..f1540711c53
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/share/LArNoiseBursts_prodJO.py
@@ -0,0 +1,140 @@
+import os
+
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+
+# etse a handle on the ServiceManager which holds all the services
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+# Event selector
+import AthenaPoolCnvSvc.ReadAthenaPool
+
+# Particle Properties
+from PartPropSvc.PartPropSvcConf import PartPropSvc
+
+from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr
+AthenaEventLoopMgr.OutputLevel = WARNING
+
+from RecExConfig.RecFlags import rec
+rec.readRDO.set_Value_and_Lock(False)
+rec.readTAG.set_Value_and_Lock(False)
+rec.readESD.set_Value_and_Lock(True)
+rec.readAOD.set_Value_and_Lock(False)
+rec.doWriteESD.set_Value_and_Lock(False)
+rec.doWriteAOD.set_Value_and_Lock(False)
+rec.doWriteTAG.set_Value_and_Lock(False)
+rec.doHist.set_Value_and_Lock(False)
+rec.doCBNT.set_Value_and_Lock(False)
+rec.doAOD.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(False)
+rec.doPerfMon.set_Value_and_Lock(False)
+rec.doDPD.set_Value_and_Lock(False)
+
+include ("RecExCommon/RecExCommon_topOptions.py")
+
+from LArCellRec.LArNoisyROSummaryGetter import LArNoisyROSummaryGetter
+LArNoisyROSummaryGetter.ignoreExistingDataObject = lambda x: True
+LArNoisyROSummaryGetter()
+#topSequence.LArNoisyROAlg.BadFEBCut = 2000
+#topSequence.LArNoisyROAlg.SaturatedCellQualityCut = 111165535
+
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+#include("LArMonitoring/LArMonCommonHeader_jobOptions.py")
+
+#include("LArMonitoring/LArMonVariables.py")
+#include('LArMonitoring/LArMonManager.py')
+#include('LArMonitoring/LArNoisyROMon_jobOptions.py')
+#include('LArMonitoring/LArNoiseBurst_jobOptions.py')
+
+#Necessary DLL's 
+theApp.Dlls += [ "LArRawUtils","LArROD", "LArTools"]
+theApp.Dlls += [ "LArByteStream"]
+
+# set up trigger configuration service
+from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
+cfg =  TriggerConfigGetter("ReadPool")
+
+## set up trigger decision tool
+from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
+ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" )
+
+# --- CaloNoiseTool configuration ---
+from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault
+theCaloNoiseTool = CaloNoiseToolDefault()
+ToolSvc += theCaloNoiseTool
+
+# --- BunchCrossing Tool configuration ---
+from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool
+theBCTool = BunchCrossingTool()
+ToolSvc += theBCTool
+
+# --- SCTClusteringTool configuration ---
+from SiClusterizationTool.SiClusterizationToolConf import InDet__SCT_ClusteringTool
+InDetSCT_ClusteringTool = InDet__SCT_ClusteringTool()
+ToolSvc += InDetSCT_ClusteringTool
+
+
+include ( "ParticleBuilderOptions/ESD_PoolCnv_jobOptions.py" )
+include ( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py" )
+include ( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py" )
+include ( "EventAthenaPool/EventAthenaPool_joboptions.py" )
+
+# Athena-Aware NTuple making Tools
+CBNTAthenaAware = False
+
+################################ LArTimeAlg###########################################
+#David Cote: added include block to avoid duplication ERROR when TAG_COMM and DESDs are executed in the same job (both including this fragment).
+include.block("LArCellRec/LArCollisionTime_jobOptions.py") 
+
+from LArCellRec.LArCellRecConf import LArCollisionTimeAlg
+topSequence += LArCollisionTimeAlg("LArCollisionTimeAlg")
+topSequence.LArCollisionTimeAlg.NoiseTool = theCaloNoiseTool
+ 
+from AthenaCommon.GlobalFlags import globalflags
+if globalflags.DataSource()=='data' :
+   topSequence.LArCollisionTimeAlg.isMC = False
+else :
+   topSequence.LArCollisionTimeAlg.isMC = True
+ 
+# dont require anymore explicitely that the time iteration converges
+topSequence.LArCollisionTimeAlg.cutIteration = False
+topSequence.LArCollisionTimeAlg.OutputLevel = INFO
+###################################################################
+
+if not 'IS_SIMULATION' in inputFileSummary['evt_type']:
+   
+   from IOVDbSvc.CondDB import conddb
+   
+   if not conddb.folderRequested('/TDAQ/RunCtrl/DataTakingMode'):
+      conddb.addFolder('TDAQ', '/TDAQ/RunCtrl/DataTakingMode')
+   if not conddb.folderRequested('/TDAQ/OLC/LHC/FILLPARAMS'):
+      conddb.addFolder('TDAQ', '/TDAQ/OLC/LHC/FILLPARAMS')
+   if not conddb.folderRequested('/LHC/DCS/FILLSTATE'):
+      conddb.addFolder('DCS_OFL', '/LHC/DCS/FILLSTATE')
+
+
+from SiSpacePointTool.SiSpacePointToolConf import InDet__SiSpacePointMakerTool
+InDetSiSpacePointMakerTool = InDet__SiSpacePointMakerTool(name = "InDetSiSpacePointMakerTool")
+ToolSvc+=InDetSiSpacePointMakerTool
+
+from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiTrackerSpacePointFinder
+InDetSiTrackerSpacePointFinder = InDet__SiTrackerSpacePointFinder(name = "InDetSiTrackerSpacePointFinder")
+topSequence += InDetSiTrackerSpacePointFinder
+
+
+from LArMonitoring.LArMonitoringConf import LArNoiseBursts
+topSequence += LArNoiseBursts( "LArNoiseBursts" )
+topSequence.LArNoiseBursts.ICaloNoiseTool = theCaloNoiseTool
+topSequence.LArNoiseBursts.BCTool = theBCTool
+topSequence.LArNoiseBursts.SCTClusteringTool = InDetSCT_ClusteringTool
+topSequence.LArNoiseBursts.SigmaCut = 3.0
+topSequence.LArNoiseBursts.MBTSCellChargeThreshold = 44./222.
+topSequence.LArNoiseBursts.NumberOfBunchesInFront = 30
+topSequence.LArNoiseBursts.OutputLevel = DEBUG
+
+prodFlags = jobproperties.LArNoiseBurstFlags
+
+from GaudiSvc.GaudiSvcConf import THistSvc
+svcMgr += THistSvc()
+svcMgr.THistSvc.Output = ["TTREE DATAFILE='"+prodFlags.outputFile()+"' OPT='RECREATE'"]
+
diff --git a/LArCalorimeter/LArMonitoring/share/LArNoiseBursts_topOptions.py b/LArCalorimeter/LArMonitoring/share/LArNoiseBursts_topOptions.py
new file mode 100644
index 00000000000..400fac057e5
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/share/LArNoiseBursts_topOptions.py
@@ -0,0 +1,152 @@
+import os
+
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+
+# etse a handle on the ServiceManager which holds all the services
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+# Event selector
+import AthenaPoolCnvSvc.ReadAthenaPool
+
+# Particle Properties
+from PartPropSvc.PartPropSvcConf import PartPropSvc
+
+from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr
+AthenaEventLoopMgr.OutputLevel = WARNING
+
+from PyJobTransformsCore.runargs import RunArguments
+runArgs = RunArguments()
+runArgs.inputESDFile = [
+"rfio:/castor/cern.ch/grid/atlas/tzero/prod1/perm/data11_7TeV/physics_CosmicCalo/00177929/data11_7TeV.00177929.physics_CosmicCalo.recon.ESD.x100/data11_7TeV.00177929.physics_CosmicCalo.recon.ESD.x100._lb0098._SFO-ALL._0001.1"
+#"rfio:/castor/cern.ch/grid/atlas/tzero/prod1/perm/data11_7TeV/physics_CosmicCalo/00177964/data11_7TeV.00177964.physics_CosmicCalo.recon.ESD.x100/data11_7TeV.00177964.physics_CosmicCalo.recon.ESD.x100._lb0003._SFO-ALL._0001.1"
+#"rfio:/castor/cern.ch/grid/atlas/tzero/prod1/perm/data11_7TeV/physics_CosmicCalo/00178109/data11_7TeV.00178109.physics_CosmicCalo.recon.ESD.x103/data11_7TeV.00178109.physics_CosmicCalo.recon.ESD.x103._lb0864._SFO-ALL._0001.1"
+#"rfio:/castor/cern.ch/grid/atlas/tzero/prod1/perm/data10_7TeV/physics_CosmicCalo/0168143/data10_7TeV.00168143.physics_CosmicCalo.recon.ESD.f301/data10_7TeV.00168143.physics_CosmicCalo.recon.ESD.f301._lb0098._SFO-ALL._0001.1"
+#"rfio:/castor/cern.ch/grid/atlas/tzero/prod1/perm/data10_7TeV/physics_CosmicCalo/0167627/data10_7TeV.00167627.physics_CosmicCalo.recon.ESD.x49/data10_7TeV.00167627.physics_CosmicCalo.recon.ESD.x49._lb0002._SFO-ALL._0001.1"
+]
+
+athenaCommonFlags.FilesInput.set_Value_and_Lock( runArgs.inputESDFile )
+
+athenaCommonFlags.EvtMax.set_Value_and_Lock(-1)
+
+from RecExConfig.RecFlags import rec
+rec.readRDO.set_Value_and_Lock(False)
+rec.readTAG.set_Value_and_Lock(False)
+rec.readESD.set_Value_and_Lock(True)
+rec.readAOD.set_Value_and_Lock(False)
+rec.doWriteESD.set_Value_and_Lock(False)
+rec.doWriteAOD.set_Value_and_Lock(False)
+rec.doWriteTAG.set_Value_and_Lock(False)
+rec.doHist.set_Value_and_Lock(False)
+rec.doCBNT.set_Value_and_Lock(False)
+rec.doAOD.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(False)
+rec.doPerfMon.set_Value_and_Lock(False)
+rec.doDPD.set_Value_and_Lock(False)
+
+include ("RecExCommon/RecExCommon_topOptions.py")
+
+from LArCellRec.LArNoisyROSummaryGetter import LArNoisyROSummaryGetter
+LArNoisyROSummaryGetter.ignoreExistingDataObject = lambda x: True
+LArNoisyROSummaryGetter()
+#topSequence.LArNoisyROAlg.BadFEBCut = 2000
+#topSequence.LArNoisyROAlg.SaturatedCellQualityCut = 111165535
+
+from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
+
+#include("LArMonitoring/LArMonCommonHeader_jobOptions.py")
+
+#include("LArMonitoring/LArMonVariables.py")
+#include('LArMonitoring/LArMonManager.py')
+#include('LArMonitoring/LArNoisyROMon_jobOptions.py')
+#include('LArMonitoring/LArNoiseBurst_jobOptions.py')
+
+#Necessary DLL's 
+theApp.Dlls += [ "LArRawUtils","LArROD", "LArTools"]
+theApp.Dlls += [ "LArByteStream"]
+
+# set up trigger configuration service
+from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
+cfg =  TriggerConfigGetter("ReadPool")
+
+## set up trigger decision tool
+from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
+ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" )
+
+# --- CaloNoiseTool configuration ---
+from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault
+theCaloNoiseTool = CaloNoiseToolDefault()
+ToolSvc += theCaloNoiseTool
+
+# --- BunchCrossing Tool configuration ---
+from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool
+theBCTool = BunchCrossingTool()
+ToolSvc += theBCTool
+
+# --- SCTClusteringTool configuration ---
+from SiClusterizationTool.SiClusterizationToolConf import InDet__SCT_ClusteringTool
+InDetSCT_ClusteringTool = InDet__SCT_ClusteringTool()
+ToolSvc += InDetSCT_ClusteringTool
+
+
+include ( "ParticleBuilderOptions/ESD_PoolCnv_jobOptions.py" )
+include ( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py" )
+include ( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py" )
+include ( "EventAthenaPool/EventAthenaPool_joboptions.py" )
+
+# Athena-Aware NTuple making Tools
+CBNTAthenaAware = False
+
+################################ LArTimeAlg###########################################
+#David Cote: added include block to avoid duplication ERROR when TAG_COMM and DESDs are executed in the same job (both including this fragment).
+include.block("LArCellRec/LArCollisionTime_jobOptions.py") 
+
+from LArCellRec.LArCellRecConf import LArCollisionTimeAlg
+topSequence += LArCollisionTimeAlg("LArCollisionTimeAlg")
+topSequence.LArCollisionTimeAlg.NoiseTool = theCaloNoiseTool
+ 
+from AthenaCommon.GlobalFlags import globalflags
+if globalflags.DataSource()=='data' :
+   topSequence.LArCollisionTimeAlg.isMC = False
+else :
+   topSequence.LArCollisionTimeAlg.isMC = True
+ 
+# dont require anymore explicitely that the time iteration converges
+topSequence.LArCollisionTimeAlg.cutIteration = False
+topSequence.LArCollisionTimeAlg.OutputLevel = INFO
+###################################################################
+
+if not 'IS_SIMULATION' in inputFileSummary['evt_type']:
+   
+   from IOVDbSvc.CondDB import conddb
+   
+   if not conddb.folderRequested('/TDAQ/RunCtrl/DataTakingMode'):
+      conddb.addFolder('TDAQ', '/TDAQ/RunCtrl/DataTakingMode')
+   if not conddb.folderRequested('/TDAQ/OLC/LHC/FILLPARAMS'):
+      conddb.addFolder('TDAQ', '/TDAQ/OLC/LHC/FILLPARAMS')
+   if not conddb.folderRequested('/LHC/DCS/FILLSTATE'):
+      conddb.addFolder('DCS_OFL', '/LHC/DCS/FILLSTATE')
+
+
+from SiSpacePointTool.SiSpacePointToolConf import InDet__SiSpacePointMakerTool
+InDetSiSpacePointMakerTool = InDet__SiSpacePointMakerTool(name = "InDetSiSpacePointMakerTool")
+ToolSvc+=InDetSiSpacePointMakerTool
+
+from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiTrackerSpacePointFinder
+InDetSiTrackerSpacePointFinder = InDet__SiTrackerSpacePointFinder(name = "InDetSiTrackerSpacePointFinder")
+topSequence += InDetSiTrackerSpacePointFinder
+
+
+from LArMonitoring.LArMonitoringConf import LArNoiseBursts
+topSequence += LArNoiseBursts( "LArNoiseBursts" )
+topSequence.LArNoiseBursts.ICaloNoiseTool = theCaloNoiseTool
+topSequence.LArNoiseBursts.BCTool = theBCTool
+topSequence.LArNoiseBursts.SCTClusteringTool = InDetSCT_ClusteringTool
+topSequence.LArNoiseBursts.SigmaCut = 3.0
+topSequence.LArNoiseBursts.MBTSCellChargeThreshold = 44./222.
+topSequence.LArNoiseBursts.NumberOfBunchesInFront = 30
+topSequence.LArNoiseBursts.OutputLevel = DEBUG
+
+from GaudiSvc.GaudiSvcConf import THistSvc
+svcMgr += THistSvc()
+svcMgr.THistSvc.Output = ["TTREE DATAFILE='LArNoiseBursts_ESD.root' OPT='RECREATE'"]
+
diff --git a/LArCalorimeter/LArMonitoring/src/LArNoiseBursts.cxx b/LArCalorimeter/LArMonitoring/src/LArNoiseBursts.cxx
new file mode 100644
index 00000000000..aac0698506b
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/src/LArNoiseBursts.cxx
@@ -0,0 +1,1597 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/// LArNoiseBursts
+/// Author: Josu Cantero
+/// UAM, November, 2010
+/// Modified by Hideki Okawa
+/// BNL, June, 2012
+
+#include "GaudiKernel/MsgStream.h"
+#include "GaudiKernel/AlgFactory.h"
+#include "GaudiKernel/IToolSvc.h"
+
+#include "StoreGate/StoreGateSvc.h"
+
+#include "CaloIdentifier/CaloIdManager.h"
+#include "CaloIdentifier/CaloCell_ID.h"
+#include "CaloIdentifier/CaloDM_ID.h"
+#include "CaloIdentifier/CaloLVL1_ID.h"
+#include "CaloIdentifier/LArEM_ID.h"
+#include "CaloIdentifier/LArHEC_ID.h"
+#include "CaloIdentifier/LArFCAL_ID.h"
+#include "CaloIdentifier/LArMiniFCAL_ID.h"
+#include "CaloIdentifier/LArID_Exception.h"
+
+
+#include "CaloInterface/ICaloNoiseTool.h"
+#include "CaloInterface/ICalorimeterNoiseTool.h"
+
+#include "AthenaPoolUtilities/AthenaAttributeList.h"
+
+#include "VxVertex/VxContainer.h"
+#include "VxVertex/VxCandidate.h"
+#include "VxVertex/VxTrackAtVertex.h"
+#include "Particle/TrackParticleContainer.h"
+
+#include "Identifier/Range.h" 
+#include "Identifier/IdentifierHash.h"
+#include "Identifier/HWIdentifier.h"
+
+#include "LArIdentifier/LArOnlineID.h"
+#include "LArIdentifier/LArHVLineID.h"
+#include "LArIdentifier/LArElectrodeID.h"
+
+#include "LArRecEvent/LArEventBitInfo.h"
+#include "LArRawEvent/LArDigit.h"
+#include "LArRawEvent/LArDigitContainer.h"
+#include "LArRecEvent/LArNoisyROSummary.h"
+#include "LArRecEvent/LArCollisionTime.h"
+ 
+#include "NavFourMom/IParticleContainer.h"
+#include "NavFourMom/INavigable4MomentumCollection.h"
+
+// Lar HV
+#include "LArElecCalib/ILArHVTool.h"
+#include "StoreGate/DataHandle.h"
+#include "CaloDetDescr/CaloDetDescrManager.h"
+#include "CaloDetDescr/CaloDetectorElements.h"
+#include "LArReadoutGeometry/EMBCell.h"
+#include "LArHV/EMBHVElectrodeConstLink.h"
+#include "LArHV/EMBHVElectrode.h"
+#include "LArHV/EMBPresamplerHVModuleConstLink.h"
+#include "LArHV/EMBPresamplerHVModule.h"
+#include "LArReadoutGeometry/EMECCell.h"
+#include "LArHV/EMECHVElectrodeConstLink.h"
+#include "LArHV/EMECHVElectrode.h"
+#include "LArHV/EMECPresamplerHVModuleConstLink.h"
+#include "LArHV/EMECPresamplerHVModule.h"
+#include "LArReadoutGeometry/HECCell.h"
+#include "LArHV/HECHVSubgapConstLink.h"
+#include "LArHV/HECHVSubgap.h"
+#include "LArReadoutGeometry/FCALTile.h"
+#include "LArHV/FCALHVLineConstLink.h"
+#include "LArHV/FCALHVLine.h"
+#include "LArHV/LArHVManager.h"
+#include "AthenaPoolUtilities/CondAttrListCollection.h"
+
+#include "LArCondUtils/LArHVToolDB.h"
+///////////////////////////////////////////////////////////////////
+
+#include "GaudiKernel/ITHistSvc.h"
+#include "TTree.h"
+#include "CLHEP/Vector/LorentzVector.h"
+
+/*
+#include "EventInfo/EventIncident.h"
+#include "EventInfo/EventInfo.h"
+#include "EventInfo/EventID.h"
+#include "EventInfo/EventType.h"
+#include "EventInfo/TriggerInfo.h"
+*/
+
+#include "xAODEventInfo/EventInfo.h"
+
+#include "CaloEvent/CaloCellContainer.h"
+
+// Electrons
+#include "egammaEvent/Electron.h"
+#include "egammaEvent/EMShower.h"
+#include "egammaEvent/EMTrackMatch.h"
+#include "egammaEvent/egammaPIDdefs.h"
+#include "egammaEvent/egammaParamDefs.h"
+
+#include "LArMonitoring/LArNoiseBursts.h"
+
+#include <algorithm>
+#include <math.h>
+#include <functional>
+#include <iostream>
+#include "PathResolver/PathResolver.h"
+
+using namespace std;
+using xAOD::EventInfo;
+
+//////////////////////////////////////////////////////////////////////////////////////
+/// Constructor
+
+
+LArNoiseBursts::LArNoiseBursts(const std::string& name,
+			 ISvcLocator* pSvcLocator) 
+  : Algorithm(name, pSvcLocator),
+    m_detectorStore(0),
+    m_thistSvc(0),
+    m_storeGate(0),
+    m_tree(0),
+    m_LArCablingService("LArCablingService"),
+    m_LArHVCablingTool("LArHVCablingTool"),
+    m_calo_noise_tool("CaloNoiseTool/CaloNoiseToolDefault"),
+    m_bc_tool("Trig::TrigConfBunchCrossingTool/BunchCrossingTool"),
+    m_trigDec( "Trig::TrigDecisionTool/TrigDecisionTool" ),
+    m_LArOnlineIDHelper(0),
+    m_LArHVLineIDHelper(0),
+    m_LArElectrodeIDHelper(0),
+    m_LArEM_IDHelper(0),
+    m_LArFCAL_IDHelper(0),
+    m_LArHEC_IDHelper(0),
+    m_caloIdMgr(0),
+    m_calodetdescrmgr(0),
+    m_CosmicCaloStream(false),
+    m_nb_sat(0),
+    m_lowqfactor(0),
+    m_medqfactor(0),
+    m_hiqfactor(0),
+    n_noisycell(0),
+    m_nt_larcellsize(0),
+    m_nt_cellsize(0),
+    m_nt_npv(0),
+    m_nt_npvtracks(0),
+    //m_nt_cellpartition(0),
+    //m_nt_runnumber(0),
+    m_nt_evtId(0),
+    m_nt_evtTime(0),
+    m_nt_evtTime_ns(0),
+    m_nt_lb(0),
+    m_nt_bcid(0),
+    m_nt_ntracks(0),
+    m_nt_isbcidFilled(0),
+    m_nt_isbcidInTrain(0),
+    m_nt_isBunchesInFront(0),
+    m_nt_bunchtype(0),
+    m_nt_bunchtime(0),
+    m_nt_atlasready(0),
+    m_nt_stablebeams(0),
+    m_nt_streamTagName(0),
+    m_nt_streamTagType(0),
+    m_nt_larnoisyro(0),
+    m_nt_larnoisyro_satOne(0),
+    m_nt_larnoisyro_satTwo(0),
+    m_nt_veto_mbts(0),
+    //m_nt_veto_indet(0),
+    m_nt_veto_bcm(0),
+    m_nt_veto_lucid(0),
+    m_nt_veto_pixel(0),
+    m_nt_veto_sct(0),
+    m_nt_veto_mbtstdHalo(0),
+    m_nt_veto_mbtstdCol(0),
+    m_nt_veto_lartdHalo(0),
+    m_nt_veto_lartdCol(0),
+    m_nt_veto_csctdHalo(0),
+    m_nt_veto_csctdCol(0),
+    m_nt_veto_bcmtHalo(0),
+    m_nt_veto_bcmtCol(0),
+    m_nt_veto_muontCol(0),
+    m_nt_veto_muontCosmic(0),
+    m_nt_ECTimeDiff(0),
+    m_nt_ECTimeAvg(0),
+    m_nt_nCellA(0),
+    m_nt_nCellC(0),
+    m_nt_mbtstimediff(0),
+    m_nt_nmbtscellA(0),
+    m_nt_nmbtscellC(0),
+    m_nt_mbtstimeavrg(0),
+    m_nt_energycell(0),
+    m_nt_qfactorcell(0),
+    m_nt_phicell(0),
+    m_nt_etacell(0),
+    m_nt_signifcell(0),
+    m_nt_noisycellpercent(0),
+    m_nt_ft_noisy(0),
+    m_nt_slot_noisy(0),
+    m_nt_channel_noisy(0),
+    m_nt_cellpartlayerindex(0),
+    m_nt_cellIdentifier(0),
+    m_nt_noisycellpart(0),
+    m_nt_nominalhv(0),
+    m_nt_maximalhv(0),
+    m_nt_noisycellHVphi(0),
+    m_nt_noisycellHVeta(0),
+    m_nt_samples(0),
+    m_nt_gain(0),
+    m_nt_isbadcell(0),
+    m_nt_partition(0),
+    m_nt_layer(0),
+    m_nt_isbadcell_sat(0),
+    m_nt_barrelec_sat(0),
+    m_nt_posneg_sat(0),
+    m_nt_ft_sat(0),
+    m_nt_slot_sat(0),
+    m_nt_channel_sat(0),
+    m_nt_partition_sat(0),
+    m_nt_energy_sat(0),
+    m_nt_phicell_sat(0),
+    m_nt_etacell_sat(0),
+    m_nt_layer_sat(0),
+    m_nt_cellIdentifier_sat(0),
+    m_nt_el_E(0),
+    m_nt_el_Et(0),
+    m_nt_el_eta(0),
+    m_nt_el_phi(0),
+    m_nt_el_cl_E(0),
+    m_nt_el_cl_Et(0),
+    m_nt_el_cl_eta(0),
+    m_nt_el_cl_phi(0),
+    m_nt_el_author(0),
+    m_nt_el_loosePP(0),
+    m_nt_el_mediumPP(0),
+    m_nt_el_tightPP(0)  
+ {
+
+   // Trigger
+   declareProperty( "TrigDecisionTool", m_trigDec );
+   
+   /** switches to control the analysis through job options */
+   declareProperty("LArCablingService", m_LArCablingService);
+   declareProperty("LArHVCablingTool",  m_LArHVCablingTool);
+   
+   // NEW
+   declareProperty( "ICaloNoiseTool", m_calo_noise_tool );
+   declareProperty( "BCTool", m_bc_tool );
+   //   declareProperty( "SCTClusteringTool",m_sctclustering_tool);
+   
+   //event cuts
+   declareProperty("SigmaCut", m_sigmacut = 3.0);
+   declareProperty("MBTSCellChargeThreshold", m_MBTSThreshold= 40./222);
+   declareProperty("NumberOfBunchesInFront",m_frontbunches = 36);
+   
+   // Keep cell properties
+   declareProperty("KeepOnlyCellID",          m_keepOnlyCellID = false);
+
+   // Physics objects
+   declareProperty("ElectronContainer", m_elecContainerName = "ElectronCollection");
+
+ }
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// Destructor - check up memory allocation
+/// delete any memory allocation on the heap
+
+LArNoiseBursts::~LArNoiseBursts() {}
+
+////////////////////////////////////////////////////////////////////////////////////
+/// Initialize
+/// initialize StoreGate
+/// get a handle on the analysis tools
+/// book histograms
+/*
+StatusCode LArNoiseBursts::initializeBeforeEventLoop() {
+  MsgStream mLog( messageService(), name() );
+
+  mLog << MSG::DEBUG << "Initializing LArNoiseBursts (before eventloop)" << endreq;
+  
+  // NEW
+  
+
+  // retrieve trigger decision tool
+  // needs to be done before the first run/event since a number of
+  // BeginRun/BeginEvents are registered by dependent services
+  StatusCode sc = StatusCode::SUCCESS;
+
+  return sc;
+} */
+//////////////////////////////////////////////////////////////////////////////////////
+///////////////////          INITIALIZE        ///////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////
+
+StatusCode LArNoiseBursts::initialize() {
+
+  MsgStream mLog( messageService(), name() );
+
+  mLog << MSG::DEBUG << "Initializing LArNoiseBursts" << endreq;
+ 
+
+  /** get a handle of StoreGate for access to the Event Store */
+  StatusCode sc = service("StoreGateSvc", m_storeGate);
+  if (sc.isFailure()) {
+     mLog << MSG::ERROR
+          << "Unable to retrieve pointer to StoreGateSvc"
+          << endreq;
+     return sc;
+  }
+ 
+  // Retrieve detector service
+  sc = service("DetectorStore", m_detectorStore);
+  if (sc.isFailure()) {
+    mLog << MSG::FATAL << "Unable to locate Service DetectorStore" << endreq;
+    return sc;
+  }
+
+  // Trigger Decision Tool
+  if(m_trigDec.retrieve().isFailure()){
+    mLog << MSG::WARNING << "Failed to retrieve trigger decision tool " << m_trigDec << endreq; 
+  }else{
+    mLog << MSG::INFO << "Retrieved tool " << m_trigDec << endreq; 
+  }
+  
+  // Retrieve LArCabling Service
+  sc=m_LArCablingService.retrieve();
+  if (sc.isFailure()) {
+    mLog << MSG::ERROR << "Could not retrieve LArCabling Service " << m_LArCablingService << endreq;
+    return sc;
+  }
+
+
+  // Retrieve online ID helper
+  const DataHandle<LArOnlineID> LArOnlineIDHelper;
+  sc = m_detectorStore->retrieve(LArOnlineIDHelper, "LArOnlineID");
+  if (sc.isFailure()) {
+    mLog<< MSG::FATAL << "Could not get LArOnlineIDHelper" << endreq;
+    return sc;
+  }else{
+    m_LArOnlineIDHelper = LArOnlineIDHelper;
+    mLog<<MSG::DEBUG<< " Found LArOnline Helper"<<endreq;
+  }
+
+  // Retrieve HV line ID helper
+  const DataHandle<LArHVLineID> LArHVLineIDHelper;
+  sc = m_detectorStore->retrieve(LArHVLineIDHelper, "LArHVLineID");
+  if (sc.isFailure()) {
+    mLog<< MSG::FATAL << "Could not get LArOnlineIDHelper" << endreq;
+    return sc;
+  }else{
+    m_LArHVLineIDHelper = LArHVLineIDHelper;
+    mLog<<MSG::DEBUG<< " Found LArOnlineIDHelper Helper"<<endreq;
+  }
+  // Retrieve HV electrode ID helper
+  const DataHandle<LArElectrodeID> LArElectrodeIDHelper;
+  sc = m_detectorStore->retrieve(LArElectrodeIDHelper, "LArElectrodeID");
+  if (sc.isFailure()) {
+    mLog<< MSG::FATAL << "Could not get LArElectrodeIDHelper" << endreq;
+    return sc;
+  }else{
+    m_LArElectrodeIDHelper = LArElectrodeIDHelper;
+    mLog<<MSG::DEBUG<< " Found LArElectrodeIDHelper Helper"<<endreq;
+  }
+
+  // Retrieve ID helpers
+  sc =  m_detectorStore->retrieve(m_caloIdMgr);
+  if (sc.isFailure()) {
+    mLog << MSG::FATAL << "Could not get CaloIdMgr" << endreq;
+    return sc;
+  }
+  m_LArEM_IDHelper   = m_caloIdMgr->getEM_ID();
+  m_LArHEC_IDHelper  = m_caloIdMgr->getHEC_ID();
+  m_LArFCAL_IDHelper = m_caloIdMgr->getFCAL_ID();
+  
+  if ( m_calo_noise_tool.retrieve().isFailure() ) {
+      mLog << MSG::WARNING << "Failed to retrieve tool " << m_calo_noise_tool << endreq; 
+  }else{
+       mLog << MSG::INFO << "Retrieved tool " << m_calo_noise_tool << endreq;
+  }
+ 
+  if(m_bc_tool.retrieve().isFailure()){
+     mLog << MSG::WARNING << "Failed to retrieve tool " << m_bc_tool << endreq; 
+  }else{
+     mLog << MSG::INFO << "Retrieved tool " << m_bc_tool << endreq;
+  }
+
+  /** get a handle on the NTuple and histogramming service */
+  sc = service("THistSvc", m_thistSvc);
+  if (sc.isFailure()) {
+     mLog << MSG::ERROR
+          << "Unable to retrieve pointer to THistSvc"
+          << endreq;
+     return sc;
+  }
+ 
+  /*const AthenaAttributeList* fillparams(0);
+  sc =  m_storeGate->retrieve(fillparams, "/TDAQ/OLC/LHC/FILLPARAMS");
+  if (sc.isFailure()) {
+     mLog << MSG::WARNING <<"Unable to retrieve fillparams information; falling back to" << endreq;
+     return StatusCode::SUCCESS;
+   }
+ 
+  if (fillparams != 0) {
+     mLog << MSG::DEBUG <<"beam 1 #bunches are: " << (*fillparams)["Beam1Bunches"].data<uint32_t>()
+		   <<endreq;
+     mLog << MSG::DEBUG <<"beam 2 #bunches are: " << (*fillparams)["Beam2Bunches"].data<uint32_t>()
+		   <<endreq;
+  }
+*/
+
+  /** Prepare TTree **/
+  m_tree = new TTree( "CollectionTree", "CollectionTree" );
+  std::string treeName =  "/TTREE/CollectionTree" ;
+  sc = m_thistSvc->regTree(treeName, m_tree);
+  if(sc.isFailure()){
+    mLog << MSG::ERROR << "Unable to register TTree : " << treeName << endreq;
+    return sc;
+  }
+
+  /**number of events*/
+// QUESTION by BT : I do not understand this variable : is it really alls cells partition?
+// answer by Josu: yes, i added this variable to calculate #noisy cell/cell per partition (offline).it's Better doing that in this code to minimize the size of the ntuple (i comment it).
+  //addBranch("CellPartition",m_nt_cellpartition); 
+
+  // General properties of events
+  m_tree->Branch("EventId",&m_nt_evtId,"EventId/I");// Event ID
+  m_tree->Branch("EventTime",&m_nt_evtTime,"EventTime/I");// Event time
+  m_tree->Branch("EventTime_ns",&m_nt_evtTime_ns,"EventTime_ns/I");// Event time in nanosecond
+  m_tree->Branch("LumiBlock",&m_nt_lb,"LumiBlock/I"); // LB
+  m_tree->Branch("BCID",&m_nt_bcid,"BCID/I"); // BCID
+  m_tree->Branch("StreamTagName",&m_nt_streamTagName);// stream tag name
+  m_tree->Branch("StreamTagType",&m_nt_streamTagType); // stream tag type 
+  m_tree->Branch("IsBCIDFilled", &m_nt_isbcidFilled,"IsBCIDFilled/I"); // check if bunch is filled
+  m_tree->Branch("IsBCIDInTrain",&m_nt_isbcidInTrain,"ISBCIDInTrain/I"); // check if bunch belong to a train
+  m_tree->Branch("BunchesInFront",&m_nt_isBunchesInFront); // check front bunches
+  m_tree->Branch("BunchType",&m_nt_bunchtype,"BunchType/I");// Empty = 0, FirstEmpty=1,&middleEmpty=2, Single=100,Front=200,&middle=201,Tail=202 
+  m_tree->Branch("TimeAfterBunch",&m_nt_bunchtime,"TimeAfterBunch/F"); //time "distance" between the colliding bunch and the nearest one.
+  m_tree->Branch("ATLASIsReady",&m_nt_atlasready,"AtlasIsReady/I"); //check if atlas is ready for physics 
+  m_tree->Branch("StableBeams",&m_nt_stablebeams,"StableBeams/I");//check stablebeams
+
+
+  m_tree->Branch("nPV", &m_nt_npv,"nPV/I"); // Number of primary vertex
+  m_tree->Branch("nTracksAtPV",&m_nt_npvtracks,"nTracksAtPV/I"); // Number of tracks at primary vertex
+  m_tree->Branch("nTracks",&m_nt_ntracks,"nTracks/I"); //Number of reconstructed tracks
+
+  // Background bits in EventInfo
+  m_tree->Branch("vetoMBTS",&m_nt_veto_mbts,"vetoMBST/S"); //Beam/collision veto based on mbts
+  m_tree->Branch("vetoPixel",&m_nt_veto_pixel,"vetoPixel/S"); //Beam/collision veto based on indet
+  m_tree->Branch("vetoSCT",&m_nt_veto_sct,"vetoSCT/S"); //Beam/collision veto based on indet
+  m_tree->Branch("vetoBcm",&m_nt_veto_bcm,"vetoBcm/S"); //Beam/collision veto based on bcm
+  m_tree->Branch("vetoLucid",&m_nt_veto_lucid,"vetoLucid/S"); //Beam/collision veto based on lucid
+  m_tree->Branch("vetoMBTSDtHalo",&m_nt_veto_mbtstdHalo,"vetoMBTSDtHalo/S");
+  m_tree->Branch("vetoMBTSDtCol",&m_nt_veto_mbtstdCol,"vetoMBTSDtCol/S");
+  m_tree->Branch("vetoLArDtHalo",&m_nt_veto_lartdHalo,"vetoLArDtHalo/S");
+  m_tree->Branch("vetoLArDtCol",&m_nt_veto_lartdCol,"vetoLArDtCol/S");
+  m_tree->Branch("vetoCSCDtHalo",&m_nt_veto_csctdHalo,"vetoCSCDtHalo/S");
+  m_tree->Branch("vetoCSCDtCol",&m_nt_veto_csctdCol,"vetoCSCDtCol/S");
+  m_tree->Branch("vetoBCMDtHalo",&m_nt_veto_bcmtHalo,"vetoBCMDtHalo/S");
+  m_tree->Branch("vetoBCMDtCol",&m_nt_veto_bcmtCol,"vetoBCMDtCol/S");
+  m_tree->Branch("vetoMuonTimmingCol", &m_nt_veto_muontCol,"vetoMuonTimmingCol/S");
+  m_tree->Branch("vetoMuonTimmingCosmic",&m_nt_veto_muontCosmic,"vetoMuonTimmingCosmic/S");
+
+  // LAr event bit info
+  m_tree->Branch("larflag_badFEBs",&m_nt_larflag_badFEBs,"larflag_badFEBs/O");
+  m_tree->Branch("larflag_mediumSaturatedDQ",&m_nt_larflag_mediumSaturatedDQ,"larflag_mediumSaturatedDQ/O");
+  m_tree->Branch("larflag_tightSaturatedDQ",&m_nt_larflag_tightSaturatedDQ,"larflag_tightSaturatedDQ/O");
+  m_tree->Branch("larflag_noiseBurstVeto",&m_nt_larflag_noiseBurstVeto,"larflag_noiseBurstVeto/O");
+  m_tree->Branch("larflag_dataCorrupted",&m_nt_larflag_dataCorrupted,"larflag_dataCorrupted/O");
+  m_tree->Branch("larflag_dataCorruptedVeto",&m_nt_larflag_dataCorruptedVeto,"larflag_dataCorruptedVeto/O");
+
+  // trigger flags
+  m_tree->Branch("L1_J75",&m_nt_L1_J75,"L1_J75/O");
+  m_tree->Branch("L1_J10_EMPTY",&m_nt_L1_J10_EMPTY,"L1_J10_EMPTY/O");
+  m_tree->Branch("L1_J30_FIRSTEMPTY",&m_nt_L1_J30_FIRSTEMPTY,"L1_J30_FIRSTEMPTY/O");
+  m_tree->Branch("L1_J30_EMPTY",&m_nt_L1_J30_EMPTY,"L1_J30_EMPTY/O");
+  m_tree->Branch("L1_XE40",&m_nt_L1_XE40,"L1_XE40/O");
+  m_tree->Branch("L1_XE50",&m_nt_L1_XE50,"L1_XE50/O");
+  m_tree->Branch("L1_XE50_BGRP7",&m_nt_L1_XE50_BGRP7,"L1_XE50_BGRP7/O");
+  m_tree->Branch("L1_XE70",&m_nt_L1_XE70,"L1_XE70/O");
+  
+  m_tree->Branch("EF_j165_u0uchad_LArNoiseBurst",&m_nt_EF_j165_u0uchad_LArNoiseBurst,"EF_j165_u0uchad_LArNoiseBurst/O");
+  m_tree->Branch("EF_j30_u0uchad_empty_LArNoiseBurst",&m_nt_EF_j30_u0uchad_empty_LArNoiseBurst,"EF_j30_u0uchad_empty_LArNoiseBurst/O");
+  m_tree->Branch("EF_j55_u0uchad_firstempty_LArNoiseBurst",&m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurst,"EF_j55_u0uchad_firstempty_LArNoiseBurst/O");
+  m_tree->Branch("EF_j55_u0uchad_empty_LArNoiseBurst",&m_nt_EF_j55_u0uchad_empty_LArNoiseBurst,"EF_j55_u0uchad_empty_LArNoiseBurst/O");
+  m_tree->Branch("EF_xe45_LArNoiseBurst",&m_nt_EF_xe45_LArNoiseBurst,"EF_xe45_LArNoiseBurst/O");
+  m_tree->Branch("EF_xe55_LArNoiseBurst",&m_nt_EF_xe55_LArNoiseBurst,"EF_xe55_LArNoiseBurst/O");
+  m_tree->Branch("EF_xe60_LArNoiseBurst",&m_nt_EF_xe60_LArNoiseBurst,"EF_xe60_LArNoiseBurst/O");
+  m_tree->Branch("EF_j55_u0uchad_firstempty_LArNoiseBurstT",&m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurstT,"EF_j55_u0uchad_firstempty_LArNoiseBurstT/O");
+  m_tree->Branch("EF_j100_u0uchad_LArNoiseBurstT",&m_nt_EF_j100_u0uchad_LArNoiseBurstT,"EF_j100_u0uchad_LArNoiseBurstT/O");
+  m_tree->Branch("EF_j165_u0uchad_LArNoiseBurstT",&m_nt_EF_j165_u0uchad_LArNoiseBurstT,"EF_j165_u0uchad_LArNoiseBurstT/O");
+  m_tree->Branch("EF_j130_u0uchad_LArNoiseBurstT",&m_nt_EF_j130_u0uchad_LArNoiseBurstT,"EF_j130_u0uchad_LArNoiseBurstT/O");
+  m_tree->Branch("EF_j35_u0uchad_empty_LArNoiseBurst",&m_nt_EF_j35_u0uchad_empty_LArNoiseBurst,"EF_j35_u0uchad_empty_LArNoiseBurst/O");
+  m_tree->Branch("EF_j35_u0uchad_firstempty_LArNoiseBurst",&m_nt_EF_j35_u0uchad_firstempty_LArNoiseBurst,"EF_j35_u0uchad_firstempty_LArNoiseBurst/O");
+  m_tree->Branch("EF_j80_u0uchad_LArNoiseBurstT",&m_nt_EF_j80_u0uchad_LArNoiseBurstT,"EF_j80_u0uchad_LArNoiseBurstT/O");
+  
+  // 
+  m_tree->Branch("LArCellSize", &m_nt_larcellsize,"LArCellSize/I"); // NEW number of online conected LAr cells
+  m_tree->Branch("CaloCellSize",&m_nt_cellsize,"CaloCellSize/I");// NEW number of total cells.
+  // LAr time difference as computed by LArCollisionTime info
+  m_tree->Branch("LArTime_Diff",&m_nt_ECTimeDiff,"LArTime_Diff/F"); // time diff between 2 endcaps
+  m_tree->Branch("LArTime_Avg",&m_nt_ECTimeAvg,"LArTime_Avg/F"); // time average of 2 endcaps
+  m_tree->Branch("LArTime_nCellA",&m_nt_nCellA,"LArTime_nCellA/I"); // nb of cells used to compute endcap A time
+  m_tree->Branch("LArTime_nCellC",&m_nt_nCellC,"LArTime_nCellC/I"); // nb of cells used to compute endcap C time
+
+  // Event properties related to yield of channels in 3 sigma tails 
+  m_tree->Branch("PerCentNoisyCell",&m_nt_noisycellpercent,"PerCentNoisyCell/F"); // Yield of channels in 3sigma tails in whole LAr
+  m_tree->Branch("PerCentNoisyCellPartition",&m_nt_noisycellpart); // Yield in each partition:0:embc 1:emba 2:emecc 3:emeca 4:fcalc 5:fcala 6:hecc 7:heca
+
+  // LArNoisyRO output
+  m_tree->Branch("LArNoisyRO_Std", &m_nt_larnoisyro,"LArNoisyRO_Std/S"); // standard flag (>5 FEB with more than 30 cells with q factor > 4000)
+  m_tree->Branch("LArNoisyRO_SatMedium",&m_nt_larnoisyro_satOne,"LArNoisyRO_SatMedium/S"); //  medium flag (> 9 cells with E>500MeV and saturated q factor) 
+  m_tree->Branch("LArNoisyRO_SatTight",&m_nt_larnoisyro_satTwo,"LArNoisyRO_SatTight/S"); // tight flag (> 20 cells with E>1000MeV and saturated q factor) 
+
+  // Properties of cells with fabs(energy/noise)>3
+  m_tree->Branch("NoisyCellPartitionLayerIndex",&m_nt_cellpartlayerindex); /// NEW Identifier of the cell
+  m_tree->Branch("NoisyCellOnlineIdentifier",&m_nt_cellIdentifier); // Identifier of the noisy cell
+  m_tree->Branch("NoisyCellPartition",&m_nt_partition); // Partition in 1 integer: 0:embc 1:emba 2:emecc 3:emeca 4:fcalc 5:fcala 6:hecc 7:heca
+  m_tree->Branch("NoisyCellFT",&m_nt_ft_noisy);                        // FT 
+  m_tree->Branch("NoisyCellSlot",&m_nt_slot_noisy);                    // Slot
+  m_tree->Branch("NoisyCellChannel",&m_nt_channel_noisy);              // Channel
+  m_tree->Branch("NoisyCellADCvalues", &m_nt_samples);                 // ADC values
+  m_tree->Branch("NoisyCellGain",&m_nt_gain);                          // Gain
+  m_tree->Branch("NoisyCellPhi",&m_nt_phicell);                        // Phi
+  m_tree->Branch("NoisyCellEta",&m_nt_etacell);                        // Eta
+  m_tree->Branch("NoisyCellLayer", &m_nt_layer);                       // layer
+  m_tree->Branch("NoisyCellHVphi", &m_nt_noisycellHVphi);              // Phi of HV
+  m_tree->Branch("NoisyCellHVeta", &m_nt_noisycellHVeta);              // Eta of HV
+  m_tree->Branch("NoisyCellEnergy",&m_nt_energycell);                  // Energy
+  m_tree->Branch("NoisyCellSignificance",&m_nt_signifcell);            // Significance (energy/noise)
+  m_tree->Branch("NoisyCellQFactor",&m_nt_qfactorcell);                // Q factor
+  m_tree->Branch("NoisyCellIsBad",&m_nt_isbadcell);                    // Bad channel status
+  // Event properties related to q factor
+  //  m_tree->Branch("nNoisyCell",n_noisycell,"nNoisyCell/i"); // Nb of cells in 3 sigma tails - redundant with PerCentNoisyCell - Removed by BT 5/1/11
+  m_tree->Branch("nbLowQFactor", &m_lowqfactor,"m_lowqfactor/i"); // Nb of cells per event with q factor<1000
+  m_tree->Branch("nbMedQFactor", &m_medqfactor,"m_medqfactor/i"); // Nb of cells per event with 1000<q factor<10000
+  m_tree->Branch("nbHighQFactor", &m_hiqfactor,"m_hiqfactor/i");  // Nb of cells per event with q 10000<factor<65535
+  m_tree->Branch("nbSatQFactor",&m_nb_sat,"nbSat/i"); // Nb of cells per event with saturated q factor (65535) 
+  // Properties of cells with q factor saturated
+  m_tree->Branch("SatCellPartition",&m_nt_partition_sat);
+  m_tree->Branch("SatCellBarrelEc",&m_nt_barrelec_sat);
+  m_tree->Branch("SatCellPosNeg",&m_nt_posneg_sat);
+  m_tree->Branch("SatCellFT",&m_nt_ft_sat);
+  m_tree->Branch("SatCellSlot",&m_nt_slot_sat);
+  m_tree->Branch("SatCellChannel",&m_nt_channel_sat);
+  m_tree->Branch("SatCellEnergy",&m_nt_energy_sat);
+  m_tree->Branch("SatCellPhi", &m_nt_phicell_sat);
+  m_tree->Branch("SatCellEta",&m_nt_etacell_sat);
+  m_tree->Branch("SatCellLayer",&m_nt_layer_sat);
+  m_tree->Branch("SatCellIsBad", &m_nt_isbadcell_sat);
+  m_tree->Branch("SatCellOnlineIdentifier",&m_nt_cellIdentifier_sat);
+
+  //HV information
+  m_tree->Branch("HV_Nominal", &m_nt_nominalhv); //Not yet filled
+  m_tree->Branch("HV_Maximal",&m_nt_maximalhv);  // Not yet filled
+
+  // Electrons
+  m_tree->Branch("el_n",&m_nt_el_n,"el_n/I");
+  m_tree->Branch("el_cl_E",&m_nt_el_cl_E);
+  m_tree->Branch("el_cl_Et",&m_nt_el_cl_Et);
+  m_tree->Branch("el_cl_eta",&m_nt_el_cl_eta);
+  m_tree->Branch("el_cl_phi",&m_nt_el_cl_phi);
+  m_tree->Branch("el_author",&m_nt_el_author);
+  m_tree->Branch("el_loosePP",&m_nt_el_loosePP);
+  m_tree->Branch("el_mediumPP",&m_nt_el_mediumPP);
+  m_tree->Branch("el_tightPP",&m_nt_el_tightPP);
+
+  if (sc.isFailure()) { 
+     mLog << MSG::ERROR << "ROOT Hist registration failed" << endreq; 
+     return sc; 
+  }
+
+  mLog << MSG::DEBUG << "End of Initializing LArNoiseBursts" << endreq;
+ 
+  return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////////////////////
+/// Finalize - delete any memory allocation from the heap
+
+StatusCode LArNoiseBursts::finalize() {
+  MsgStream mLog( messageService(), name() );
+
+  mLog << MSG::DEBUG << "in finalize()" << endreq;
+  return StatusCode::SUCCESS;
+
+}
+
+///////////////////////////////////////////////////////////////////////////////////
+/// Clear - clear CBNT members
+StatusCode LArNoiseBursts::clear() {
+  /// For Athena-Aware NTuple
+
+  MsgStream mLog( messageService(), name() );
+
+  mLog << MSG::DEBUG << "start clearing variables " << endreq;
+  
+  m_nb_sat     = 0;
+  n_noisycell  = 0;
+  m_lowqfactor = 0;
+  m_medqfactor = 0;
+  m_hiqfactor  = 0;
+
+  m_nt_evtId      = 0;
+  m_nt_evtTime    = 0;
+  m_nt_evtTime_ns = 0;
+  m_nt_lb         = 0;
+  m_nt_bcid       = -1;
+ 
+  m_nt_npv       = -1;
+  m_nt_npvtracks = -1;
+  m_nt_ntracks   = -1;
+
+  m_nt_streamTagName.clear();
+  m_nt_streamTagType.clear();
+  m_nt_isbcidFilled     = -1;
+  m_nt_isbcidInTrain    = -1;
+  m_nt_isBunchesInFront.clear();
+  m_nt_bunchtype        = -1;
+  m_nt_bunchtime        = -1.0;
+  m_nt_atlasready       = -1;
+  m_nt_stablebeams      = -1;
+  m_nt_larnoisyro       = -1;
+  m_nt_larnoisyro_satOne= -1;
+  m_nt_larnoisyro_satTwo= -1;
+
+  mLog << MSG::DEBUG << "clearing event info veto variables " << endreq;
+
+  //clearing event info veto variables
+  m_nt_veto_mbts        = -1;
+  m_nt_veto_pixel       = -1;
+  m_nt_veto_sct         = -1;
+  m_nt_veto_bcm         = -1;
+  m_nt_veto_lucid       = -1;
+  m_nt_veto_mbtstdHalo  = -1;
+  m_nt_veto_mbtstdCol   = -1;
+  m_nt_veto_lartdHalo   = -1;
+  m_nt_veto_lartdCol    = -1;
+  m_nt_veto_csctdHalo   = -1;
+  m_nt_veto_csctdCol    = -1;
+  m_nt_veto_bcmtHalo    = -1;
+  m_nt_veto_bcmtCol     = -1;
+  m_nt_veto_muontCol    = -1;
+  m_nt_veto_muontCosmic = -1;
+
+  mLog << MSG::DEBUG << "clearing LAr event flags " << endreq;
+
+  // lar bit event info
+  m_nt_larflag_badFEBs = false;
+  m_nt_larflag_mediumSaturatedDQ = false;
+  m_nt_larflag_tightSaturatedDQ = false;
+  m_nt_larflag_noiseBurstVeto = false;
+  m_nt_larflag_dataCorrupted = false;
+  m_nt_larflag_dataCorruptedVeto = false;
+
+  mLog << MSG::DEBUG << "clearing Pixel variables " << endreq;
+
+  // Trigger flags
+  m_nt_L1_J75 = true; // turned on for tests
+  m_nt_L1_J10_EMPTY = false;
+  m_nt_L1_J30_FIRSTEMPTY = false;
+  m_nt_L1_J30_EMPTY = false;
+  m_nt_L1_XE40 = false;
+  m_nt_L1_XE50 = false;
+  m_nt_L1_XE50_BGRP7 = false;
+  m_nt_L1_XE70 = false;
+  
+  m_nt_EF_j165_u0uchad_LArNoiseBurst = false;
+  m_nt_EF_j30_u0uchad_empty_LArNoiseBurst = false;
+  m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurst = false;
+  m_nt_EF_j55_u0uchad_empty_LArNoiseBurst = false;
+  m_nt_EF_xe45_LArNoiseBurst = false;
+  m_nt_EF_xe55_LArNoiseBurst = false;
+  m_nt_EF_xe60_LArNoiseBurst = false;
+  m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurstT = false;
+  m_nt_EF_j100_u0uchad_LArNoiseBurstT = false;
+  m_nt_EF_j165_u0uchad_LArNoiseBurstT = false;
+  m_nt_EF_j130_u0uchad_LArNoiseBurstT = false;
+  m_nt_EF_j35_u0uchad_empty_LArNoiseBurst = false;
+  m_nt_EF_j35_u0uchad_firstempty_LArNoiseBurst = false;
+  m_nt_EF_j80_u0uchad_LArNoiseBurstT = false;
+   
+  mLog << MSG::DEBUG << "clearing trigger flags " << endreq;
+
+  mLog << MSG::DEBUG << "clearing noisy cells variables " << endreq;
+
+  //Quantities for noisy cells
+  m_nt_energycell.clear();
+  m_nt_qfactorcell.clear();
+  m_nt_phicell.clear();
+  m_nt_etacell.clear();
+  m_nt_signifcell.clear();
+  m_nt_isbadcell.clear();
+  m_nt_partition.clear();
+  m_nt_layer.clear();
+  m_nt_noisycellpercent = -1;
+  m_nt_ft_noisy.clear();
+  m_nt_slot_noisy.clear();
+  m_nt_channel_noisy.clear();
+  m_nt_larcellsize = -1;
+  m_nt_cellsize    = -1;
+  m_nt_cellpartlayerindex.clear();
+  m_nt_cellIdentifier.clear();
+  m_nt_noisycellpart.clear();
+  m_nt_samples.clear();
+  m_nt_gain.clear();
+
+  ///HV branches
+  m_nt_nominalhv.clear();
+  m_nt_maximalhv.clear();
+  m_nt_noisycellHVphi.clear();
+  m_nt_noisycellHVeta.clear();
+
+  mLog << MSG::DEBUG << "clearing saturated cell variables " << endreq;
+
+  //clearing quantities for sat cells
+  m_nt_barrelec_sat.clear();
+  m_nt_posneg_sat.clear();
+  m_nt_ft_sat.clear();
+  m_nt_slot_sat.clear();
+  m_nt_channel_sat.clear();
+  m_nt_partition_sat.clear();
+  m_nt_energy_sat.clear();
+  m_nt_phicell_sat.clear();
+  m_nt_etacell_sat.clear();
+  m_nt_layer_sat.clear();
+  m_nt_cellIdentifier_sat.clear();
+  m_nt_isbadcell_sat.clear();
+
+  mLog << MSG::DEBUG << "clearing LArTimeDiff variables " << endreq;
+  
+  //DiffTime computed with LAR
+  m_nt_ECTimeDiff  = 9999;
+  m_nt_ECTimeAvg   = 9999;
+  m_nt_nCellA      = -1;
+  m_nt_nCellC      = -1;
+
+  mLog << MSG::DEBUG << "clearing electron variables " << endreq;
+  
+  // Electrons
+  m_nt_el_n = 0;
+  m_nt_el_cl_E.clear();
+  m_nt_el_cl_Et.clear();
+  m_nt_el_cl_eta.clear();
+  m_nt_el_cl_phi.clear(); 
+  m_nt_el_author.clear();
+  m_nt_el_loosePP.clear();
+  m_nt_el_mediumPP.clear();
+  m_nt_el_tightPP.clear(); 
+  
+  mLog << MSG::DEBUG << "end of clearing" << endreq;
+
+  return StatusCode::SUCCESS;
+
+
+ 
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+/// Execute - on event by event
+
+StatusCode LArNoiseBursts::execute() {
+  MsgStream mLog( messageService(), name() );
+  
+  mLog << MSG::DEBUG << "in execute()" << endreq;
+  StatusCode sc;
+
+  sc = clear();
+  if(sc.isFailure()) {
+    mLog << MSG::WARNING << "The method clear() failed" << endreq;
+    return StatusCode::SUCCESS;
+  }
+  
+  sc = doTrigger();
+  if(sc.isFailure()) {
+     mLog << MSG::WARNING << "The method doTrigger() failed" << endreq;
+    return StatusCode::SUCCESS;
+  }
+
+  sc = doEventProperties();
+  if(sc.isFailure()) {
+     mLog << MSG::WARNING << "The method doEventProperties() failed" << endreq;
+    return StatusCode::SUCCESS;
+  }
+
+  sc = doLArNoiseBursts();
+  if (sc.isFailure()) {
+      mLog << MSG::WARNING << "The method doLArNoiseBursts() failed" << endreq;
+      return StatusCode::SUCCESS;
+  }
+
+  sc = doPhysicsObjects();
+  if (sc.isFailure()) {
+      mLog << MSG::WARNING << "The method doPhysicsObjects() failed" << endreq;
+      return StatusCode::SUCCESS;
+  }
+  
+  m_tree->Fill();
+
+  return StatusCode::SUCCESS;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////
+///////////////////          doTrigger        ////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////
+StatusCode LArNoiseBursts::doTrigger(){
+  MsgStream mLog(messageService(), name()); 
+  mLog<< MSG::DEBUG <<"in doTrigger "<<endreq;
+  
+  std::string mychain( "L1_J75" );
+  if( ! m_trigDec->getListOfTriggers(mychain).empty() ){
+    m_nt_L1_J75 = m_trigDec->isPassed( mychain );
+  }
+  mychain = "L1_J10_EMPTY";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_L1_J10_EMPTY =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "L1_J30_FIRSTEMPTY";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_L1_J30_FIRSTEMPTY =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "L1_J30_EMPTY";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_L1_J30_EMPTY =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "L1_XE40";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_L1_XE40 =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "L1_XE50";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_L1_XE50 =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "L1_XE50_BGRP7";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_L1_XE50_BGRP7 =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "L1_XE70";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_L1_XE70 =  m_trigDec->isPassed( mychain );
+  }
+
+  // EF
+  mychain = "EF_j165_u0uchad_LArNoiseBurst";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_EF_j165_u0uchad_LArNoiseBurst =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "EF_j30_u0uchad_empty_LArNoiseBurst";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_EF_j30_u0uchad_empty_LArNoiseBurst =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "EF_j55_u0uchad_firstempty_LArNoiseBurst";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurst =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "EF_j55_u0uchad_empty_LArNoiseBurst";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_EF_j55_u0uchad_empty_LArNoiseBurst =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "EF_xe45_LArNoiseBurst";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_EF_xe45_LArNoiseBurst =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "EF_xe55_LArNoiseBurst";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_EF_xe55_LArNoiseBurst =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "EF_xe60_LArNoiseBurst";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_EF_xe60_LArNoiseBurst =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "EF_j55_u0uchad_firstempty_LArNoiseBurstT";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurstT =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "EF_j100_u0uchad_LArNoiseBurstT";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_EF_j100_u0uchad_LArNoiseBurstT =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "EF_j165_u0uchad_LArNoiseBurstT";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_EF_j165_u0uchad_LArNoiseBurstT =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "EF_j130_u0uchad_LArNoiseBurstT";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_EF_j130_u0uchad_LArNoiseBurstT =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "EF_j35_u0uchad_empty_LArNoiseBurst";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_EF_j35_u0uchad_empty_LArNoiseBurst =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "EF_j35_u0uchad_firstempty_LArNoiseBurst";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_EF_j35_u0uchad_firstempty_LArNoiseBurst =  m_trigDec->isPassed( mychain );
+  }
+  mychain = "EF_j80_u0uchad_LArNoiseBurstT";
+  if( ! m_trigDec->getListOfTriggers(mychain).empty()){
+    m_nt_EF_j80_u0uchad_LArNoiseBurstT =  m_trigDec->isPassed( mychain );
+  }
+ 
+  return StatusCode::SUCCESS;
+
+}
+
+//////////////////////////////////////////////////////////////////////////////////////
+///////////////////          doEventProperties        //////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////
+StatusCode LArNoiseBursts::doEventProperties(){
+  MsgStream mLog(messageService(), name()); 
+  mLog<< MSG::DEBUG <<"in doEventProperties "<<endreq;
+
+
+  //////////////////////////////// EventInfo variables /////////////////////////////////////////////////
+  // Retrieve event info
+  const EventInfo* eventInfo;
+  StatusCode sc = m_storeGate->retrieve(eventInfo);
+  if (sc.isFailure()) {
+    mLog << MSG::WARNING << "Event info not found !" << endreq;
+    return StatusCode::SUCCESS;
+  }
+
+  int run = eventInfo->runNumber();
+  m_nt_evtId      = eventInfo->eventNumber();
+  m_nt_evtTime    = eventInfo->timeStamp();
+  m_nt_evtTime_ns = eventInfo->timeStampNSOffset();
+  m_nt_lb         = eventInfo->lumiBlock();
+  m_nt_bcid       = eventInfo->bcid();
+
+  mLog<<MSG::DEBUG<<"Run Number: "<<run<<", event Id "<<m_nt_evtId<<", bcid = "<<m_nt_bcid<<endreq;
+  
+
+  m_nt_isbcidFilled = m_bc_tool->isFilled(m_nt_bcid);
+  m_nt_isbcidInTrain = m_bc_tool->isInTrain(m_nt_bcid);
+  m_nt_bunchtype = m_bc_tool->bcType(m_nt_bcid);
+  mLog<<MSG::DEBUG<<"BCID is Filled: "<<m_nt_isbcidFilled<<endreq;
+  mLog<<MSG::DEBUG<<"BCID is in Train: "<<m_nt_isbcidInTrain<<endreq;
+  mLog<<MSG::DEBUG<<"bunch type "<<m_nt_bunchtype<<endreq;
+
+  std::vector<bool> isBunchesInFront = m_bc_tool->bunchesInFront(m_nt_bcid,m_frontbunches);
+  bool checkfirstbunch = true;
+  for(unsigned int i=0;i<isBunchesInFront.size();i++){
+     mLog<<MSG::DEBUG<<"bunch "<<i<<" is Filled "<<isBunchesInFront[i]<<endreq;
+     m_nt_isBunchesInFront.push_back(isBunchesInFront[i]);
+       if(isBunchesInFront[i]==1){
+         if(i!=0){
+           if(checkfirstbunch){
+             float time = 25.0*i;
+             m_nt_bunchtime = time;
+             mLog<<MSG::DEBUG<<"next bunch time: "<<time<<" ns "<<endreq;
+             checkfirstbunch = false;
+	   }
+	 }
+     }
+  }
+
+  m_CosmicCaloStream = false;
+  //std::vector<TriggerInfo::StreamTag>::const_iterator streamInfoIt=myTriggerInfo->streamTags().begin();
+  //std::vector<TriggerInfo::StreamTag>::const_iterator streamInfoIt_e=myTriggerInfo->streamTags().end();
+  //for (;streamInfoIt!=streamInfoIt_e;streamInfoIt++) { 
+  for (const auto& streamInfo : eventInfo->streamTags()) {
+    const std::string& stream_name = streamInfo.name();
+    const std::string& stream_type = streamInfo.type();
+    m_nt_streamTagName.push_back(stream_name);
+    m_nt_streamTagType.push_back(stream_type);
+    mLog<<MSG::DEBUG<<"event stream tag name "<<streamInfo.name()<<endreq;
+    mLog<<MSG::DEBUG<<"event stream tag type "<<streamInfo.type()<<endreq;
+    if(streamInfo.name()=="CosmicCalo" && streamInfo.type()=="physics"){
+      m_CosmicCaloStream = true;
+    }
+  }
+  
+
+  mLog<<MSG::DEBUG<<"CosmicCalo stream value: "<<m_CosmicCaloStream<<endreq;
+
+  // Retrieve output of LArNoisyRO
+  bool larnoisyro = eventInfo->isEventFlagBitSet(EventInfo::LAr,0);
+  bool larnoisyro_satOne = eventInfo->isEventFlagBitSet(EventInfo::LAr,1);
+  bool larnoisyro_satTwo = eventInfo->isEventFlagBitSet(EventInfo::LAr,2);
+  m_nt_larnoisyro        = larnoisyro ? 1 : 0;
+  m_nt_larnoisyro_satOne = larnoisyro_satOne ? 1 : 0;
+  m_nt_larnoisyro_satTwo = larnoisyro_satTwo ? 1 : 0;
+  
+ // Retrieve output of EventInfo veto
+  mLog << MSG::DEBUG <<"Background: MBTSBeamVeto "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MBTSBeamVeto)<<endreq;
+  mLog << MSG::DEBUG <<"Background: PixSPNonEmpty "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::PixSPNonEmpty)<<endreq;
+  mLog << MSG::DEBUG <<"Background: SCTSPNonEmpty "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::SCTSPNonEmpty)<<endreq;
+  mLog << MSG::DEBUG <<"Background: BCMBeamVeto "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::BCMBeamVeto)<<endreq;
+  mLog << MSG::DEBUG <<"Background: LUCIDBeamVeto "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::LUCIDBeamVeto)<<endreq;
+  mLog << MSG::DEBUG <<"Background: MBTSTimeDiffHalo "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MBTSTimeDiffHalo)<<endreq; 
+  mLog << MSG::DEBUG <<"Background: MBTSTimeDiffCol "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MBTSTimeDiffCol)<<endreq;
+  mLog << MSG::DEBUG <<"Background: LArECTimeDiffHalo "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::LArECTimeDiffHalo)<<endreq;
+  mLog << MSG::DEBUG <<"Background: LArECTimeDiffCol "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::LArECTimeDiffCol)<<endreq;  
+  mLog << MSG::DEBUG <<"Background: CSCTimeDiffHalo "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::CSCTimeDiffHalo)<<endreq;
+  mLog << MSG::DEBUG <<"Background: CSCTimeDiffCol "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::CSCTimeDiffCol)<<endreq;
+  mLog << MSG::DEBUG <<"Background: BCMTimeDiffHalo "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::BCMTimeDiffHalo)<<endreq;
+  mLog << MSG::DEBUG <<"Background: BCMTimeDiffCol "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::BCMTimeDiffCol)<<endreq;
+  mLog << MSG::DEBUG <<"Background: MuonTimmingCol "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MuonTimingCol)<<endreq;
+  mLog << MSG::DEBUG <<"Background: MuonTimmingCosmic "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MuonTimingCosmic)<<endreq;
+
+  m_nt_veto_mbts      = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MBTSBeamVeto);
+  m_nt_veto_pixel     = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::PixSPNonEmpty);
+  m_nt_veto_sct       = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::SCTSPNonEmpty);
+  m_nt_veto_bcm       = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::BCMBeamVeto);
+  m_nt_veto_lucid     = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::LUCIDBeamVeto);
+
+  //more variables
+  m_nt_veto_mbtstdHalo = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MBTSTimeDiffHalo); 
+  m_nt_veto_mbtstdCol  = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MBTSTimeDiffCol);
+  m_nt_veto_lartdHalo  = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::LArECTimeDiffHalo);
+  m_nt_veto_lartdCol   = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::LArECTimeDiffCol);  
+  m_nt_veto_csctdHalo  = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::CSCTimeDiffHalo);
+  m_nt_veto_csctdCol   = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::CSCTimeDiffCol);
+  m_nt_veto_bcmtHalo   = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::BCMTimeDiffHalo);
+  m_nt_veto_bcmtCol    = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::BCMTimeDiffCol);
+  m_nt_veto_muontCol   = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MuonTimingCol);
+  m_nt_veto_muontCosmic= eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MuonTimingCosmic);
+ 
+   // LArEventInfo
+
+  mLog << MSG::DEBUG <<"NOISEBURSTVETO bit " << eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::NOISEBURSTVETO) << endreq;
+  mLog << MSG::DEBUG <<"BADFEBS bit " << eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::BADFEBS)<< endreq;
+  mLog << MSG::DEBUG <<"TIGHTSATURATEDQ bit " << eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::TIGHTSATURATEDQ)<< endreq;
+
+  m_nt_larflag_badFEBs = eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::BADFEBS);
+  m_nt_larflag_mediumSaturatedDQ = eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::MEDIUMSATURATEDQ);
+  m_nt_larflag_tightSaturatedDQ = eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::TIGHTSATURATEDQ);
+  m_nt_larflag_noiseBurstVeto = eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::NOISEBURSTVETO);
+  m_nt_larflag_dataCorrupted = eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::DATACORRUPTED);
+  m_nt_larflag_dataCorruptedVeto = eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::DATACORRUPTEDVETO);
+
+  ///////////////////////////////////////end EventInfo variables/////////////////////////////////////////////////////////////////////////
+
+  const AthenaAttributeList* attrList(0);
+  sc =  m_storeGate->retrieve(attrList, "/TDAQ/RunCtrl/DataTakingMode");
+  if (sc.isFailure()) {
+     mLog << MSG::WARNING <<"Unable to retrieve DataTakingMode information; falling back to" << endreq;
+     return StatusCode::SUCCESS;
+   }
+   if (attrList != 0) {
+     mLog << MSG::DEBUG <<"ReadyForPhysics is: " << (*attrList)["ReadyForPhysics"].data<uint32_t>()<<endreq;
+     //m_valueCache = ((*attrList)["ReadyForPhysics"].data<uint32_t>() != 0);
+     m_nt_atlasready = (*attrList)["ReadyForPhysics"].data<uint32_t>();
+   }
+
+   /*const AthenaAttributeList* fillstate(0);
+  sc =  m_storeGate->retrieve(fillstate, "/LHC/DCS/FILLSTATE");
+  if (sc.isFailure()) {
+     mLog << MSG::WARNING <<"Unable to retrieve fillstate information; falling back to" << endreq;
+     return StatusCode::SUCCESS;
+   }
+   if (fillstate != 0) {
+     mLog << MSG::DEBUG <<"Stable beams is: " << (*fillstate)["StableBeams"].data<uint32_t>()<<endreq;
+     //m_valueCache = ((*attrList)["ReadyForPhysics"].data<uint32_t>() != 0);
+     m_nt_stablebeams.push_back((*fillstate)["StableBeams"].data<uint32_t>());
+     }*/
+
+   //retrieve primary vertex information
+   const VxContainer* vxContainer = NULL;
+  sc = m_storeGate->retrieve(vxContainer,"VxPrimaryCandidate" );
+  if (sc.isFailure()) {
+     mLog << MSG::WARNING << "Could not retrieve primary vertex info: "<<endreq;
+     //return StatusCode::SUCCESS;
+  }
+
+   mLog << MSG::DEBUG << "Found primary vertex info: " << endreq;
+
+
+  if(vxContainer) {
+    m_nt_npv = vxContainer->size();
+    if(m_nt_npv>0){
+    mLog<< MSG::DEBUG<< "vxContainer size = "<<m_nt_npv<<endreq;
+    VxContainer::const_iterator fz = vxContainer->begin();
+    const Trk::VxCandidate* vxcand = (*fz);
+    const std::vector<Trk::VxTrackAtVertex*>* trklist = vxcand->vxTrackAtVertex();
+    mLog<< MSG::DEBUG<< "--- Number of tracks asociated to P.V: "<<trklist->size()<<endreq;
+    m_nt_npvtracks = trklist->size();
+    }
+  }
+
+  //retrieve track particle container information
+   const Rec::TrackParticleContainer* trackTES=0;
+   sc=m_storeGate->retrieve( trackTES, "TrackParticleCandidate");
+   if( sc.isFailure()) {
+     mLog << MSG::WARNING<< "No InDet container found in TDS  "<<endreq;
+   }
+   if(trackTES){
+     mLog << MSG::DEBUG <<"number of reconstructed tracks = "<<trackTES->size()<<endreq;
+     m_nt_ntracks = trackTES->size();
+   }
+  
+  // 29/11/10 : Debug messages removed by BT 
+  //   mLog << MSG::INFO << "Event LAr flags " << std::hex
+  //      << eventInfo->errorState(EventInfo::LAr) << " "
+  //      << std::hex << eventInfo->eventFlags(EventInfo::LAr)
+  //      << ", bit 0: " << eventInfo->isEventFlagBitSet(EventInfo::LAr,0)
+  //      << ", bit 1: " << eventInfo->isEventFlagBitSet(EventInfo::LAr,1)
+  //      << ", bit 2: " << eventInfo->isEventFlagBitSet(EventInfo::LAr,2)
+  //      << endreq;
+
+  // Retrieve LArCollision Timing information
+  const LArCollisionTime *  larTime;
+  sc =  m_storeGate->retrieve(larTime,"LArCollisionTime");
+  if( sc.isFailure()){
+    mLog << MSG::WARNING  << "Unable to retrieve LArCollisionTime event store" << endreq;
+    //return StatusCode::SUCCESS; // Check if failure shd be returned. VB
+  }else {
+    mLog << MSG::DEBUG  << "LArCollisionTime successfully retrieved from event store" << endreq;
+  }
+  
+  if (larTime) {
+      m_nt_nCellA = larTime->ncellA();
+      m_nt_nCellC = larTime->ncellC();
+    if(m_nt_nCellA>0 && m_nt_nCellC>0){
+      // Calculate the time diff between ECC and ECA
+      m_nt_ECTimeDiff = larTime->timeC() - larTime->timeA();
+      m_nt_ECTimeAvg  = (larTime->timeC() + larTime->timeA()) / 2.0;
+      mLog << MSG::DEBUG  << "LAr: Calculated time difference of " << m_nt_ECTimeDiff << " ns" << endreq;
+    }
+  }
+
+  return StatusCode::SUCCESS;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////
+///////////////////          doLArNoiseBursts        ///////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////
+StatusCode LArNoiseBursts::doLArNoiseBursts(){
+ MsgStream mLog( messageService(), name() );
+ mLog << MSG::DEBUG << "in doLarCellInfo " << endreq;
+
+
+ // Retrieve LAr calocells container
+  const CaloCellContainer* caloTES;
+  StatusCode sc = m_storeGate->retrieve( caloTES, "AllCalo");
+  if (sc.isFailure()) {
+    mLog << MSG::WARNING << "CaloCell Container not found!" << endreq;
+    return StatusCode::SUCCESS;
+  }
+
+  m_nb_sat = 0;
+  n_noisycell =0;
+  int nlarcell = 0;
+  CaloCellContainer::const_iterator caloItr;
+  int n_noisy_cell_part[8] = {0,0,0,0,0,0,0,0};
+  int n_cell_part[8] = {0,0,0,0,0,0,0,0};
+  std::vector<short> m_ft_noisy, m_slot_noisy, m_channel_noisy;
+  std::vector<bool> m_isbarrel, m_isendcap, m_isfcal, m_ishec;
+  std::vector<short> m_layer; 
+  std::vector<int> m_partition,m_noisycellHVphi,m_noisycellHVeta;
+  std::vector<float> m_energycell, m_qfactorcell, m_signifcell;
+  std::vector<float> m_phicell, m_etacell;
+  std::vector<bool> m_isbadcell;
+  std::vector<IdentifierHash>  m_IdHash;
+  std::vector<int> m_cellpartlayerindex;
+  std::vector<Identifier> m_cellIdentifier;
+
+  m_ft_noisy.clear();m_slot_noisy.clear();m_channel_noisy.clear();
+  m_isbarrel.clear();m_isendcap.clear();m_isfcal.clear();m_ishec.clear();
+  m_layer.clear();m_partition.clear();m_energycell.clear();m_qfactorcell.clear(); 
+  m_phicell.clear();m_etacell.clear();m_signifcell.clear();m_isbadcell.clear();
+  m_IdHash.clear();m_noisycellHVeta.clear();m_noisycellHVphi.clear();
+  m_cellpartlayerindex.clear();m_cellIdentifier.clear();
+
+  for(caloItr=caloTES->begin();caloItr!=caloTES->end();caloItr++){
+    const CaloDetDescrElement* caloDDE = (*caloItr)->caloDDE();
+    if (caloDDE->is_tile())continue;
+    HWIdentifier onlID;
+    try {onlID = m_LArCablingService->createSignalChannelID((*caloItr)->ID());}
+    catch(LArID_Exception& except) {
+	    mLog << MSG::ERROR  << "LArID_Exception " << m_LArEM_IDHelper->show_to_string((*caloItr)->ID()) << " " << (std::string) except << endreq ;
+	    mLog << MSG::ERROR  << "LArID_Exception " << m_LArHEC_IDHelper->show_to_string((*caloItr)->ID()) << endreq;
+	    mLog << MSG::ERROR  << "LArID_Exception " << m_LArFCAL_IDHelper->show_to_string((*caloItr)->ID()) << endreq;
+            continue;
+    }
+    bool connected = m_LArCablingService->isOnlineConnected(onlID);
+    if(!connected) continue;
+    const Identifier idd = m_LArCablingService->cnvToIdentifier(onlID);
+    nlarcell++;
+    IdentifierHash channelHash = m_LArOnlineIDHelper->channel_Hash(onlID);
+    int layer = caloDDE->getLayer();
+    //    CaloCell_ID::CaloSample sampling = (*caloItr)->caloDDE()->getSampling();
+    float eCalo = (*caloItr)->energy();
+    float qfactor = (*caloItr)->quality();
+    float phi = (*caloItr)->phi();
+    //float noise  = m_calo_noise_tool->getNoise( (*caloItr), ICaloNoiseTool::TOTALNOISE );
+    float noise  = m_calo_noise_tool->totalNoiseRMS( (*caloItr), (*caloItr)->gain());
+    float significance = eCalo / noise ;
+    float eta = (*caloItr)->eta();
+    bool badcell = (*caloItr)->badcell();
+    unsigned int partition = 0;
+    bool is_lar_em_barrel = caloDDE->is_lar_em_barrel();
+    if(is_lar_em_barrel){
+       if(eta<0){
+          partition = 0;
+        }else{
+          partition = 1;
+        }
+    }//barrel
+    bool is_lar_em_endcap = caloDDE->is_lar_em_endcap();
+    if(is_lar_em_endcap){
+        if(eta<0){
+          partition = 2;
+        }else{
+          partition = 3;
+	}
+    }//endcap
+    bool is_lar_fcal   = caloDDE->is_lar_fcal();
+    if(is_lar_fcal){
+        if(eta<0){
+          partition = 4;
+        }else{
+          partition = 5;
+	}
+    }//fcal
+    bool is_lar_hec    = caloDDE->is_lar_hec();
+    if(is_lar_hec){
+      if(eta<0){
+        partition = 6;
+      }else{
+        partition = 7;
+      }
+    }//hec
+    for(unsigned int k=0;k<8;k++){
+       if(partition==k){
+          n_cell_part[k]++;
+       }
+    }
+    if(qfactor <1000)                  {m_lowqfactor++;}
+    if(qfactor>=1000 && qfactor<10000) {m_medqfactor++;}
+    if(qfactor>=10000 && qfactor<65535){m_hiqfactor++;}
+    if(qfactor==65535){
+      mLog << MSG::DEBUG <<"Satured cell at eta: "<<eta<<", phi: "<<phi<<", partition: "<<partition<<endreq;
+       m_nb_sat = m_nb_sat +1;
+       m_nt_partition_sat.push_back(partition);
+       m_nt_energy_sat.push_back(eCalo);
+       m_nt_cellIdentifier_sat.push_back((m_LArCablingService->cnvToIdentifier(onlID)).get_identifier32().get_compact());
+       if(!m_keepOnlyCellID){
+         m_nt_barrelec_sat.push_back(m_LArOnlineIDHelper->barrel_ec(onlID));
+         m_nt_posneg_sat.push_back(m_LArOnlineIDHelper->pos_neg(onlID));
+         m_nt_ft_sat.push_back(m_LArOnlineIDHelper->feedthrough(onlID));
+         m_nt_slot_sat.push_back(m_LArOnlineIDHelper->slot(onlID));
+         m_nt_channel_sat.push_back(m_LArOnlineIDHelper->channel(onlID));
+         m_nt_phicell_sat.push_back(phi);
+         m_nt_etacell_sat.push_back(eta);
+         m_nt_layer_sat.push_back(layer);
+         m_nt_isbadcell_sat.push_back(badcell);
+       }
+    }
+    // Store all cells in positive and negative 3 sigma tails...
+    if(significance > m_sigmacut || qfactor > 4000){
+      m_ft_noisy.push_back(m_LArOnlineIDHelper->feedthrough(onlID));
+      m_slot_noisy.push_back(m_LArOnlineIDHelper->slot(onlID));
+      m_channel_noisy.push_back(m_LArOnlineIDHelper->channel(onlID));
+
+      /*
+      m_isbarrel.push_back(is_lar_em_barrel);
+      m_isendcap.push_back(is_lar_em_endcap);
+      m_isfcal.push_back(is_lar_fcal);
+      m_ishec.push_back(is_lar_hec);
+      */
+
+      m_layer.push_back(layer);
+      m_energycell.push_back(eCalo);
+      m_qfactorcell.push_back(qfactor);
+      m_phicell.push_back(phi);
+      m_etacell.push_back(eta);
+      m_signifcell.push_back(significance);
+      m_isbadcell.push_back(badcell);
+      m_partition.push_back(partition);
+      m_IdHash.push_back(channelHash);
+      m_cellIdentifier.push_back(m_LArCablingService->cnvToIdentifier(onlID));
+    // ...but count only cells in positive 3 sigma tails!
+      if (significance > m_sigmacut){
+	for(unsigned int k=0;k<8;k++){
+	  if(partition==k){
+	    n_noisy_cell_part[k]++;
+	  }
+	}
+      }
+      int caloindex = GetPartitionLayerIndex(idd);
+      m_cellpartlayerindex.push_back(caloindex);
+      //store HV information
+      /*std::vector<int> * hvid = new std::vector<int>;
+      hvid.clear();
+      //hvid = GetHVLines(idd);
+      std::vector<std::pair<LArHVCellID, int> > hv_vector;
+      hv_vector.clear();
+      m_LArHVCablingTool->getLArHVCellID(idd,hv_vector);
+      if(hv_vector.size()>0){
+        for(unsigned int i=0;i<hv_vector.size();i++){
+	  int nominal_HV =  m_LArHVCablingTool->getNominalHV(hv_vector[i].first);//fill the branch but produces lots of warnings. 
+	  int maximal_HV =  m_LArHVCablingTool->getMaximalHV(hv_vector[i].first);//fill the branch but produces lots of warnings.
+	    m_nt_nominalhv.push_back(nominal_HV);
+            m_nt_maximalhv.push_back(maximal_HV);
+	}
+	}*/
+      m_noisycellHVphi.push_back(m_LArElectrodeIDHelper->hv_phi(onlID));
+      m_noisycellHVeta.push_back(m_LArElectrodeIDHelper->hv_eta(onlID));
+      n_noisycell++;
+    }   
+
+  }//loop over cells
+  
+  m_nt_larcellsize = nlarcell;
+  m_nt_cellsize    = caloTES->size();
+  mLog << MSG::DEBUG <<"lar cell size = "<<int(nlarcell)<<endreq;
+  mLog << MSG::DEBUG <<"all cell size = "<<int(caloTES->size())<<endreq;
+
+  m_nt_noisycellpercent = 100.0*double(n_noisycell)/double(nlarcell);
+ 
+  bool checknoise = false;
+  //ratio of noisy cells per partition
+  for(unsigned int i=0;i<8;i++){
+    float noise  =  100.0*(double(n_noisy_cell_part[i])/double(n_cell_part[i]));
+    m_nt_noisycellpart.push_back(noise);
+    if(noise> 1.0){
+      checknoise = true;
+      mLog << MSG::DEBUG <<"noise burst in this  event "<<endreq;
+    }   
+  }
+
+  const LArDigitContainer* LArDigitCont;
+  sc = m_storeGate->retrieve(LArDigitCont, "LArDigitContainer_Thinned");
+  if (sc.isFailure()) {
+    mLog << MSG::WARNING << "LArDigitContainer Container not found!" << endreq;
+    return StatusCode::SUCCESS;
+  }    
+
+  LArDigitContainer::const_iterator it=LArDigitCont->begin();
+  LArDigitContainer::const_iterator it_end=LArDigitCont->end();
+  const LArDigit* pLArDigit;
+  
+  bool store_condition = false;
+  // CosmicCalo stream : Store detailed infos of cells only if Y3Sigma>1% or burst found by LArNoisyRO
+  if(m_CosmicCaloStream){
+    if(checknoise==true || m_nt_larnoisyro==1 || m_nt_larnoisyro_satOne==1 || m_nt_larnoisyro_satTwo==1){
+      store_condition = true;
+    }
+  }
+  // Not cosmicCalo stream : Store detailed infos of cells only if burst found by LArNoisyRO
+  if(!m_CosmicCaloStream){
+    if(m_nt_larnoisyro==1 || m_nt_larnoisyro_satOne==1 || m_nt_larnoisyro_satTwo==1){
+      store_condition = true;
+    }
+  }
+
+  //store the information of the noisy cell only when %noisycells > 1%.
+  if(store_condition){
+    std::vector<short> samples;
+    samples.clear();
+    for(unsigned int k=0;k<m_etacell.size();k++){
+      m_nt_samples.push_back(samples);
+      m_nt_gain.push_back(0);
+    }
+    for (;it!=it_end;it++) {
+         pLArDigit = *it;  
+         HWIdentifier id2 = pLArDigit->hardwareID();
+         IdentifierHash hashid2 = m_LArOnlineIDHelper->channel_Hash(id2);
+          for(unsigned int j=0;j<m_IdHash.size();j++){
+            if (hashid2 == m_IdHash[j] ){
+              mLog<<MSG::DEBUG << "find a IdentifierHash of the noisy cell in LArDigit container " << endreq;
+              samples = pLArDigit->samples();
+              int gain=-1;
+              if (pLArDigit->gain() == CaloGain::LARHIGHGAIN)   gain = 0;
+              if (pLArDigit->gain() == CaloGain::LARMEDIUMGAIN) gain = 1;
+              if (pLArDigit->gain() == CaloGain::LARLOWGAIN)    gain = 2;
+              m_nt_gain.at(j)= gain;
+              m_nt_samples.at(j) = samples;
+              mLog << MSG::DEBUG << "I got the samples!" << endreq;
+              break;
+	    }  
+	 }
+     }
+    for(unsigned int i=0;i<m_etacell.size();i++){
+      m_nt_energycell.push_back( m_energycell[i]);
+      m_nt_qfactorcell.push_back( m_qfactorcell[i]);
+      m_nt_signifcell.push_back( m_signifcell[i]);
+      m_nt_partition.push_back( m_partition[i]);   
+      m_nt_cellIdentifier.push_back(m_cellIdentifier[i].get_identifier32().get_compact());
+      if(!m_keepOnlyCellID){
+        m_nt_ft_noisy.push_back( m_ft_noisy[i]);
+        m_nt_slot_noisy.push_back( m_slot_noisy[i]);
+        m_nt_channel_noisy.push_back( m_channel_noisy[i]);
+   
+        /*
+        m_nt_isbarrel.push_back( m_isbarrel[i]);
+        m_nt_isendcap.push_back( m_isendcap[i]);
+        m_nt_isfcal.push_back( m_isfcal[i]);
+        m_nt_ishec.push_back( m_ishec[i]);
+        */
+   
+        m_nt_layer.push_back( m_layer[i]);
+        m_nt_phicell.push_back( m_phicell[i]);
+        m_nt_etacell.push_back( m_etacell[i]);
+        m_nt_isbadcell.push_back( m_isbadcell[i]);
+        m_nt_noisycellHVphi.push_back(m_noisycellHVphi[i]);     
+        m_nt_noisycellHVeta.push_back(m_noisycellHVeta[i]);
+        m_nt_cellpartlayerindex.push_back(m_cellpartlayerindex[i]);
+      }
+    }		  
+    mLog << MSG::DEBUG <<"leaving if checknoise and larnoisyro"<<endreq;
+
+  }//if(checknoisy==true ..)
+
+  return StatusCode::SUCCESS;
+  
+}
+
+//////////////////////////////////////////////////////////////////////////////////////
+///////////////////          doPhysicsObjects        ////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////
+StatusCode LArNoiseBursts::doPhysicsObjects(){
+  MsgStream mLog(messageService(), name()); 
+  mLog<< MSG::DEBUG <<"in doPhysicsObjects "<<endreq;
+
+  const ElectronContainer* elecTES = 0;
+  StatusCode sc=m_storeGate->retrieve( elecTES, m_elecContainerName);
+  if( sc.isFailure()  ||  !elecTES ) {
+    mLog << MSG::WARNING << "No ESD electron container found in StoreGate" << endreq;
+    return StatusCode::SUCCESS;
+  }
+  mLog << MSG::DEBUG << "ElectronContainer successfully retrieved. Size = " << elecTES->size();
+
+  ElectronContainer::const_iterator elecItr  = elecTES->begin();
+  ElectronContainer::const_iterator elecItrE = elecTES->end();
+  
+  /// Electron
+  m_nt_el_n = 0;
+
+  for (; elecItr != elecItrE; ++elecItr) {
+    m_nt_el_n++;
+    
+    if( (*elecItr)->cluster() ){
+      m_nt_el_cl_E.push_back(float((*elecItr)->cluster()->e()));
+      m_nt_el_cl_Et.push_back(float((*elecItr)->cluster()->et()));
+      m_nt_el_cl_eta.push_back(float((*elecItr)->cluster()->eta()));
+      m_nt_el_cl_phi.push_back(float((*elecItr)->cluster()->phi()));
+    }
+
+    m_nt_el_author.push_back((*elecItr)->author());
+
+    (*elecItr)->isem(egammaPID::ElectronLoosePP) == 0 ? m_nt_el_loosePP.push_back(1) : m_nt_el_loosePP.push_back(0);
+    (*elecItr)->isem(egammaPID::ElectronMediumPP) == 0 ? m_nt_el_mediumPP.push_back(1) : m_nt_el_mediumPP.push_back(0);
+    (*elecItr)->isem(egammaPID::ElectronTightPP) == 0 ? m_nt_el_tightPP.push_back(1) : m_nt_el_tightPP.push_back(0);
+  }
+
+  return StatusCode::SUCCESS;
+}
+
+
+//
+
+int LArNoiseBursts::GetPartitionLayerIndex(const Identifier& id)
+{
+  // O.Simard -- GetPartitionLayer index [0,32]:
+  // Returns a single integer code that corresponds to the
+  // mapping of CaloCells in CaloMonitoring histogram frames.
+
+  int caloindex = -1;
+  int bc = 0;
+  int sampling = 0;
+
+  if(m_LArEM_IDHelper->is_lar_em(id)){ // EMB
+    bc = m_LArEM_IDHelper->barrel_ec(id);
+    sampling = m_LArEM_IDHelper->sampling(id);
+    if(abs(bc)==1){
+      if(bc<0) caloindex = sampling+4;
+      else caloindex = sampling;
+    } else { // EMEC
+      if(bc<0) caloindex = sampling+12;
+      else caloindex = sampling+8;
+    }
+  } else if(m_LArHEC_IDHelper->is_lar_hec(id)) { // LAr HEC
+    bc = m_LArHEC_IDHelper->pos_neg(id);
+    sampling = m_LArHEC_IDHelper->sampling(id);
+    if(bc<0) caloindex = sampling+20;
+    else caloindex = sampling+16;
+  } else if(m_LArFCAL_IDHelper->is_lar_fcal(id)) { // LAr FCAL
+    bc = m_LArFCAL_IDHelper->pos_neg(id);
+    sampling = (int)m_LArFCAL_IDHelper->module(id); // module instead of sampling
+    if(bc<0) caloindex = sampling+26;
+    else caloindex = sampling+23;
+  }
+
+  return caloindex;
+}
+
+std::vector<int>* LArNoiseBursts::GetHVLines(const Identifier& id)
+{
+
+  MsgStream mLog( messageService(), name() );
+  mLog << MSG::DEBUG << "in GetHVLines function " << endreq;
+
+  std::vector<int>  tmplines;
+  unsigned int nelec = 0;
+  //unsigned int ngap = 0;
+  unsigned int nsubgaps = 0;
+  unsigned int nlines = 0;
+  unsigned int i=0,j=0,igap=0;
+
+  // LAr EMB
+  if(m_LArEM_IDHelper->is_lar_em(id) && m_LArEM_IDHelper->sampling(id)>0){
+  mLog << MSG::DEBUG << "LAr EMB"<< endreq;
+    if(abs(m_LArEM_IDHelper->barrel_ec(id))==1) {
+      const EMBDetectorElement* embElement = dynamic_cast<const EMBDetectorElement*>(m_calodetdescrmgr->get_element(id));
+      if (!embElement)
+        return 0;
+      const EMBCellConstLink cell = embElement->getEMBCell();
+      nelec = cell->getNumElectrodes();
+      //ngap = 2*nelec;
+      for(i=0;i<nelec;i++) {
+	      const EMBHVElectrodeConstLink electrode = cell->getElectrode(i);
+	      for(igap=0;igap<2;igap++) tmplines.push_back(electrode->hvLineNo(igap));
+      }        
+    } else { // LAr EMEC
+      mLog << MSG::DEBUG << "LAr EMEC"<< endreq;
+      const EMECDetectorElement* emecElement = dynamic_cast<const EMECDetectorElement*>(m_calodetdescrmgr->get_element(id));
+      if (!emecElement)
+        return 0;
+      const EMECCellConstLink cell = emecElement->getEMECCell();
+      nelec = cell->getNumElectrodes();
+      //ngap = 2*nelec;
+      for(i=0;i<nelec;i++) {
+	      const EMECHVElectrodeConstLink electrode = cell->getElectrode(i);
+	      for(igap=0;igap<2;igap++) tmplines.push_back(electrode->hvLineNo(igap));
+      }      
+    }
+  } else if(m_LArHEC_IDHelper->is_lar_hec(id)) { // LAr HEC
+    mLog << MSG::DEBUG << "LAr HEC"<< endreq;
+    const HECDetectorElement* hecElement = dynamic_cast<const HECDetectorElement*>(m_calodetdescrmgr->get_element(id));
+    if (!hecElement)
+      return 0;
+    const HECCellConstLink cell = hecElement->getHECCell();
+    nsubgaps = cell->getNumSubgaps();
+    for(i=0;i<nsubgaps;i++) {
+      const HECHVSubgapConstLink subgap = cell->getSubgap(i);
+      tmplines.push_back(subgap->hvLineNo());
+    }
+  } else if(m_LArFCAL_IDHelper->is_lar_fcal(id)) { // LAr FCAL
+    mLog << MSG::DEBUG << "LAr HEC"<< endreq;
+    const FCALDetectorElement* fcalElement = dynamic_cast<const FCALDetectorElement*>(m_calodetdescrmgr->get_element(id));
+    if (!fcalElement)
+      return 0;
+    const FCALTile* tile = fcalElement->getFCALTile();
+    nlines = tile->getNumHVLines();
+    for(i=0;i<nlines;i++) {
+      const FCALHVLineConstLink line = tile->getHVLine(i);
+      if(line) tmplines.push_back(line->hvLineNo());
+    }   
+  } else if(m_LArEM_IDHelper->is_lar_em(id) && m_LArEM_IDHelper->sampling(id)==0) { // Presamplers
+    mLog << MSG::DEBUG << "LAr PRESAMPLES"<< endreq;
+    
+    if(abs(m_LArEM_IDHelper->barrel_ec(id))==1){
+      
+      const EMBDetectorElement* embElement = dynamic_cast<const EMBDetectorElement*>(m_calodetdescrmgr->get_element(id));
+      if (!embElement) {
+        return 0;
+      }
+      const EMBCellConstLink cell = embElement->getEMBCell();
+      const EMBPresamplerHVModuleConstLink hvmodule =  cell->getPresamplerHVModule();
+      for(igap=0;igap<2;igap++) tmplines.push_back(hvmodule->hvLineNo(igap));
+
+    } else {
+      
+      const EMECDetectorElement* emecElement = dynamic_cast<const EMECDetectorElement*>(m_calodetdescrmgr->get_element(id));
+      if (!emecElement)
+        return 0;
+      const EMECCellConstLink cell = emecElement->getEMECCell();
+      const EMECPresamplerHVModuleConstLink hvmodule = cell->getPresamplerHVModule();
+      for(igap=0;igap<2;igap++) tmplines.push_back(hvmodule->hvLineNo(igap));
+
+    }
+  } else {
+    mLog << MSG::WARNING << " cell neither in EM nor HEC nor FCAL !!!!!  return empty HV " << endreq;
+    return (vector<int>*)0;
+  }
+
+  // optimization of storage: replace by std:set
+  std::vector<int>* hvlines = new std::vector<int>;
+  bool found = 0;
+  for(i=0;i<tmplines.size();i++){
+    found = 0;
+    for(j=0;j<hvlines->size();j++){
+      if(hvlines->at(j)==tmplines.at(i)){
+        found=1;
+        break;
+      }
+    }
+    if(!found) hvlines->push_back(tmplines.at(i));
+  }
+
+  return hvlines;
+}
+
+
+ 
diff --git a/LArCalorimeter/LArMonitoring/src/LArOddCellsMonTool.cxx b/LArCalorimeter/LArMonitoring/src/LArOddCellsMonTool.cxx
new file mode 100755
index 00000000000..2c1d1fd1ce8
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/src/LArOddCellsMonTool.cxx
@@ -0,0 +1,1564 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// ********************************************************************
+//
+// NAME:     LArOddCellsMonTool.cxx
+// PACKAGE:  LArMonitoring
+//
+// AUTHOR:   Benjamin Trocme
+//
+// Class for monitoring the odd (hot or dead) cells noise
+//
+// ********************************************************************
+
+#include "GaudiKernel/ISvcLocator.h"
+#include "GaudiKernel/ITHistSvc.h"
+#include "GaudiKernel/IToolSvc.h"
+
+#include "Identifier/IdentifierHash.h"
+
+#include "LArIdentifier/LArOnlineID.h"
+#include "CaloIdentifier/CaloCell_ID.h"
+
+#include "LWHists/TProfile2D_LW.h"
+#include "TTree.h"
+
+#include <sstream>
+#include <iomanip>
+#include <cmath>
+
+/*
+#include "EventInfo/EventInfo.h"
+#include "EventInfo/TriggerInfo.h"
+#include "EventInfo/EventID.h"
+*/
+#include "xAODEventInfo/EventInfo.h"
+
+#include "LArRawEvent/LArDigit.h"
+#include "LArRawEvent/LArDigitContainer.h"
+#include "LArRawEvent/LArFebHeaderContainer.h"
+#include "LArRawConditions/LArDSPThresholdsComplete.h"
+
+#include "LArMonitoring/LArOddCellsMonTool.h"
+
+#include "LArRecEvent/LArNoisyROSummary.h"
+
+#include "LWHists/TH1I_LW.h"
+#include "LWHists/TH1D_LW.h"
+#include "LWHists/TH2I_LW.h"
+#include "LWHists/TH2F_LW.h"
+
+#include "CxxUtils/BasicTypes.h"
+
+//A simply specialised histogram for counting floats indexed by
+//integers and with no under/overflow tracking:
+class LArOddCellsMonTool::Simple2DSumHist {
+public:
+  Simple2DSumHist(unsigned nx,unsigned ny) :m_nx(nx),m_ny(ny),m_data(new float[nx*ny]) { assert(nx&&ny); Reset(); }
+  void Reset() { std::memset(m_data,0,sizeof(m_data[0])*m_nx*m_ny); }
+  void Fill(unsigned ix,unsigned iy,float weight) { if(ix>=m_nx||iy>=m_ny) return;assert(ix*m_ny+iy<m_nx*m_ny);m_data[ix*m_ny+iy]+=weight;}
+  double GetBinContent(unsigned ix,unsigned iy) const {if(ix>=m_nx||iy>=m_ny) return 0.0;assert(ix*m_ny+iy<m_nx*m_ny);return m_data[ix*m_ny+iy]; }
+  unsigned GetNbinsX() const { return m_nx; }
+  unsigned GetNbinsY() const { return m_ny; }
+  ~Simple2DSumHist() {delete[] m_data;}
+private:
+  Simple2DSumHist (const Simple2DSumHist&);
+  Simple2DSumHist& operator= (const Simple2DSumHist&);
+
+  unsigned m_nx;
+  unsigned m_ny;
+  float *m_data;
+};
+
+/*---------------------------------------------------------*/
+LArOddCellsMonTool::LArOddCellsMonTool(const std::string& type, 
+                                         const std::string& name,
+                                         const IInterface* parent)
+  : ManagedMonitorToolBase(type, name, parent),
+    m_LArOnlineIDHelper(0),
+    m_LArEM_IDHelper(0),
+    m_strHelper(0),
+    m_LArCablingService("LArCablingService"),
+    m_badChannelMask("BadLArDigitMask"),
+    m_evtTime(0),
+    m_tOdd(0),
+    m_treeNbOfOdd(0),
+    m_treeBarrelEc(),
+    m_treePosNeg(),
+    m_treeFT(),
+    m_treeSlot(),
+    m_treeChannel(),
+    m_treeSample(),
+    m_treeSampling(),
+    m_treeRegion(),
+    m_treeEta(),
+    m_treePhi(),
+    m_treeSignif(),
+    m_treeBurstyPartition(),
+    m_evtId(0),
+    m_eventToBeStored(false),
+    m_skipEvent(false),
+    m_hMonitoredChan(0),
+    m_hTimeDistrib(0),
+    m_hOddEventsYield(0)
+{
+  m_feedthroughNames.clear();
+  declareProperty("feedthroughNames", m_feedthroughNames);
+  declareProperty("LArPedestalKey",m_larPedestalKey="Pedestal",
+		  "SG key of the LArPedestal");
+  declareProperty("LArDigitContainerKey", m_LArDigitContainerKey = "HIGH");
+  declareProperty("gainMonitored", m_gainMonitored);
+  declareProperty("sampleNumber", m_sampleNumber = 0);
+  declareProperty("oddnessThreshold", m_oddnessThreshold = 5);
+  declareProperty("posNeg", m_posNeg = 0);
+  declareProperty("minimumRefNoise", m_minimumRefNoise);
+  declareProperty("maximumRefNoise", m_maximumRefNoise);
+  declareProperty("burstyEventsThreshold", m_burstyThreshold = 1);
+  declareProperty("burstyNoisyROFEB", m_burstyThresholdQ = 2);
+  declareProperty("maskBadChannels", m_maskBadChannels = false);
+  declareProperty("retrieveFromCool", m_coolRetrieval = true);
+  declareProperty("nbEvtsComputePeds", m_computePeds = 1000);
+  declareProperty("useEvtCounter", m_useEvtCounter = true);
+  declareProperty("maxOfTimingHisto",m_maxTimingHisto = 4000);
+  declareProperty("createTree", m_createTree = false);
+  declareProperty("monitorInPhysic", m_monPhys = false);
+  declareProperty("storeRefs", m_storeRefs = false);
+  declareProperty("storePerFT", m_storePerFT = false);
+  declareProperty("DetailEndCap",m_detailEndCap = true);
+  declareProperty("LArBadChannelMask",m_badChannelMask);
+  declareProperty("keyDSPThresholds",m_keyDSPThresholds="LArDSPThresholds");
+  declareProperty( "monitoredStreams",m_noise_streams);
+  
+  m_febPedRetrieved.clear();
+  m_eventsCounter = 0;
+  for (int i = 0; i<10; i++) m_nbMonitoredChan[i] = 0;
+  m_nbMonitoredTotal = 0;
+  m_nbOfSamples = 0;
+  m_skipAlgo = false;
+}
+
+/*---------------------------------------------------------*/
+LArOddCellsMonTool::~LArOddCellsMonTool()
+{
+  delete m_strHelper;
+}
+
+/*---------------------------------------------------------*/
+StatusCode 
+LArOddCellsMonTool::initialize()
+{
+  //if (msgLvl(MSG::DEBUG)) 
+  msg(MSG::WARNING) << "Initialize LArOddCellsMonTool" << endreq;
+  
+  StatusCode sc;
+
+  sc = detStore()->retrieve(m_LArOnlineIDHelper, "LArOnlineID");
+  if (sc.isFailure()) {
+    msg(MSG::FATAL) << "Could not get LArOnlineIDHelper" << endreq;
+    return sc;
+  }
+
+  sc = detStore()->retrieve(m_LArEM_IDHelper, "LArEM_ID");
+  if (sc.isFailure()) {
+    msg(MSG::FATAL) << "Could not get LArEM_IDHelper" << endreq;
+    return sc;
+  }
+  
+  if (m_maskBadChannels){
+    sc=m_badChannelMask.retrieve();
+    if (sc.isFailure()) {
+      msg(MSG::ERROR) << "Could not retrieve BadChannelMask" << m_badChannelMask<< endreq;
+      return StatusCode::FAILURE;
+    }
+  }
+  
+  // Get LAr Cabling Service
+  sc=m_LArCablingService.retrieve();
+  if (sc.isFailure()) {
+    msg(MSG::ERROR) << "Could not retrieve LArCablingService" << endreq;
+    return StatusCode::FAILURE;
+  }
+
+  // LArOnlineIDStrHelper
+  m_strHelper = new LArOnlineIDStrHelper(m_LArOnlineIDHelper);
+  m_strHelper->setDefaultNameType(LArOnlineIDStrHelper::LARONLINEID);
+  if (msgLvl(MSG::DEBUG)) m_strHelper->test();
+
+  // initialize monitoring bookkeeping info
+  sc = this->initMonInfo();
+  if (sc.isFailure()) {
+    msg(MSG::ERROR) << "Could not initialize monitoring bookkeeping info" << endreq;
+  }
+
+  if (m_coolRetrieval) {
+    sc =  detStore()->regHandle(m_larPedestal,m_larPedestalKey);
+    if (sc.isFailure()) {
+      msg(MSG::ERROR) << "could not register handle for pedestal " << endreq;
+    }
+  }
+
+  ManagedMonitorToolBase::initialize().ignore();
+
+  return StatusCode::SUCCESS;
+}
+
+/*---------------------------------------------------------*/
+StatusCode 
+LArOddCellsMonTool::bookHistograms()
+{
+
+  StatusCode sc = StatusCode::SUCCESS;
+  
+  //if(isNewRun){
+    MonGroup generalGroup( this, "LAr/OddCells/General", run, ATTRIB_MANAGED );
+    MonGroup generalGroup_wA( this, "LAr/OddCells/General", run, ATTRIB_MANAGED, "", "weightedAverage" );
+
+    // Book general histos
+    std::string hName = "OddEventsTime";
+    std::string hTitle = "Odd events temporal distribution";
+    m_hTimeDistrib = TH1I_LW::create(hName.c_str(), hTitle.c_str(),m_maxTimingHisto,0,m_maxTimingHisto);
+    if (m_useEvtCounter) m_hTimeDistrib->GetXaxis()->SetTitle("Event Counter");
+    else m_hTimeDistrib->GetXaxis()->SetTitle("Event Id");
+    sc = sc && generalGroup.regHist(m_hTimeDistrib);  
+
+    hName = "OddEventsYield";
+    hTitle = "Odd channels yield per event - " + format("%.0f",m_oddnessThreshold) + " sigma - " + m_gainMonitored[0] + " / " + m_gainMonitored[1];
+//    if (m_oddnessThreshold == 3 && m_posNeg == 0) hTitle = hTitle + " (Gauss : 0.27% exp.)";
+//    if (m_oddnessThreshold == 4 && m_posNeg == 0) hTitle = hTitle + " (Gauss : 0.063% exp.)";
+//    if (m_oddnessThreshold == 3 && m_posNeg != 0) hTitle = hTitle + " (Gauss : 0.14% exp.)";
+//    if (m_oddnessThreshold == 4 && m_posNeg != 0) hTitle = hTitle + " (Gauss : 0.032% exp.)";
+    for (uint i=0;i<m_noise_streams.size();i++) hTitle = hTitle + " - " + m_noise_streams[i];
+    m_hOddEventsYield = TH1D_LW::create(hName.c_str(), hTitle.c_str(),500,-0.2,2.3);
+    m_hOddEventsYield->GetXaxis()->SetTitle("Yield(%)");
+    sc = sc && generalGroup.regHist(m_hOddEventsYield);  
+    
+    hName = "NbOfMonitoredChan";
+    hTitle = "Nb of monitored channels";
+    if (m_coolRetrieval) hTitle = hTitle + " - Pedestals from COOL ";
+    else hTitle = hTitle + " - Pedestals from " + format("%d",m_computePeds) + " first events";
+    if (m_sampleNumber<0) hTitle = hTitle +" - All samples";
+    else hTitle = hTitle +" - Sample " + format("%1d only",m_sampleNumber);
+
+    if (m_detailEndCap){
+      m_hMonitoredChan = TH1I_LW::create(hName.c_str(), hTitle.c_str(),8,0.5,8.5);
+      (m_hMonitoredChan->GetXaxis())->SetBinLabel(4,"Emec A");
+      (m_hMonitoredChan->GetXaxis())->SetBinLabel(3,"Emec C");
+      (m_hMonitoredChan->GetXaxis())->SetBinLabel(6,"Hec A");
+      (m_hMonitoredChan->GetXaxis())->SetBinLabel(5,"Hec C");
+      (m_hMonitoredChan->GetXaxis())->SetBinLabel(8,"Fcal A");
+      (m_hMonitoredChan->GetXaxis())->SetBinLabel(7,"Fcal C");
+    }
+    else{
+      m_hMonitoredChan = TH1I_LW::create(hName.c_str(), hTitle.c_str(),4,0.5,4.5);
+      (m_hMonitoredChan->GetXaxis())->SetBinLabel(4,"Endcap A");
+      (m_hMonitoredChan->GetXaxis())->SetBinLabel(3,"Endcap C");
+    }
+    (m_hMonitoredChan->GetXaxis())->SetBinLabel(2,"Barrel A");
+    (m_hMonitoredChan->GetXaxis())->SetBinLabel(1,"Barrel C");
+
+    sc = sc && generalGroup_wA.regHist(m_hMonitoredChan);
+        
+    if (m_createTree){
+      // Book tree
+      m_tOdd = new TTree("OddEventsTree","OddEventsTree");
+      sc = sc && generalGroup.regTree(m_tOdd);
+      m_tOdd->Branch("EvtCnt",&m_eventsCounter,"m_eventsCounter/I");
+      m_tOdd->Branch("EvtId",&m_evtId,"m_evtId/I");
+      m_tOdd->Branch("EvtTime",&m_evtTime,"m_evtTime/F");
+      m_tOdd->Branch("NbOfOdd",&m_treeNbOfOdd,"m_treeNbOfOdd/I");
+      m_tOdd->Branch("NbOfMonitoredChTotal",&m_nbMonitoredTotal,"m_nbMonitoredTotal/I");
+      m_tOdd->Branch("NbOfMonitoredChPerPart",m_nbMonitoredChan,"m_nbMonitoredChan[10]/I");
+      m_tOdd->Branch("BarrelEc",m_treeBarrelEc,"m_treeBarrelEc[m_treeNbOfOdd]/I");
+      m_tOdd->Branch("PosNeg",m_treePosNeg,"m_treePosNeg[m_treeNbOfOdd]/I");
+      m_tOdd->Branch("FT",m_treeFT,"m_treeFT[m_treeNbOfOdd]/I");
+      m_tOdd->Branch("Slot",m_treeSlot,"m_treeSlot[m_treeNbOfOdd]/I");
+      m_tOdd->Branch("Channel",m_treeChannel,"m_treeChannel[m_treeNbOfOdd]/I");
+      m_tOdd->Branch("Sample",m_treeSample,"m_treeSample[m_treeNbOfOdd]/I");
+      m_tOdd->Branch("Sampling",m_treeSampling,"m_treeSampling[m_treeNbOfOdd]/I");
+      m_tOdd->Branch("Region",m_treeRegion,"m_treeRegion[m_treeNbOfOdd]/I");
+      m_tOdd->Branch("Eta",m_treeEta,"m_treeEta[m_treeNbOfOdd]/I");
+      m_tOdd->Branch("Phi",m_treePhi,"m_treePhi[m_treeNbOfOdd]/I");
+      m_tOdd->Branch("Signif",m_treeSignif,"m_treeSignif[m_treeNbOfOdd]/F");
+      m_tOdd->Branch("BurstyPartition",m_treeBurstyPartition,"m_treeBurstyPartition[10]/I");
+    }
+    
+    bookHistsPartition(m_barrelCSummary,"BarrelC");
+    bookHistsPartition(m_barrelASummary,"BarrelA");
+    bookHistsPartition(m_endcapCSummary,"EndcapC");
+    bookHistsPartition(m_endcapASummary,"EndcapA");
+    if (m_detailEndCap){
+      bookHistsPartition(m_emecCSummary,"EmecC");
+      bookHistsPartition(m_emecASummary,"EmecA");
+      bookHistsPartition(m_hecCSummary,"HecC");
+      bookHistsPartition(m_hecASummary,"HecA");
+      bookHistsPartition(m_fcalCSummary,"FcalC");
+      bookHistsPartition(m_fcalASummary,"FcalA");      
+    }
+    //  }
+
+  if (sc.isFailure()) {
+    msg(MSG::ERROR) << "Bookhistograms failed" << endreq;
+  }
+
+  return sc;
+}
+
+/*---------------------------------------------------------*/
+StatusCode 
+LArOddCellsMonTool::fillHistograms()
+{
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in fillHists()" << endreq;
+
+  StatusCode sc(StatusCode::SUCCESS); 
+
+  // At first event, if required (m_monPhys), check whether the data are in physic mode
+  // with non zero DSP threshold. If so, request to skip the algo.
+  if (!m_monPhys && m_eventsCounter == 0){
+    const LArFebHeaderContainer* hdrCont;
+    sc = evtStore()->retrieve(hdrCont);
+    if (sc.isFailure() || !hdrCont) {
+      msg(MSG::WARNING) << "No LArFEB container found in TDS" << endreq; 
+      return sc;
+    }
+    LArFebHeaderContainer::const_iterator it = hdrCont->begin(); 
+    LArFebHeaderContainer::const_iterator it_e = hdrCont->end(); 
+    for ( ; it!=it_e;++it) {
+      uint32_t eventType = (*it)->DetEventType();
+      // Check if we are in physic mode and not in rawdata+results
+      if (eventType == 4 && (*it)->RodRawDataSize() == 0){
+	const LArDSPThresholdsComplete* dspThresh=NULL;
+	if (m_keyDSPThresholds.size()>0) {
+	  sc=detStore()->retrieve(dspThresh,m_keyDSPThresholds);
+	  if(!sc.isSuccess()){
+	    msg(MSG::WARNING) <<" Failed to retrieve LArDSPThresholds with key " << m_keyDSPThresholds << endreq;
+	    return sc; 
+	  }
+	  HWIdentifier febid=(*it)->FEBId();
+	  int barrel_ec = m_LArOnlineIDHelper->barrel_ec(febid);
+	  int pos_neg   = m_LArOnlineIDHelper->pos_neg(febid);
+	  int ft        = m_LArOnlineIDHelper->feedthrough(febid);
+	  int slot      = m_LArOnlineIDHelper->slot(febid);
+	  for (int ich=0;ich<128;ich++){
+	    HWIdentifier chId = m_LArOnlineIDHelper->channel_Id(barrel_ec,pos_neg,ft,slot,ich);
+	    // If any threshold (samples) is different from zero, skip algorithm
+	    if (dspThresh->samplesThr(chId)) m_skipAlgo = true;
+	  }
+	}
+      }
+    }
+    if (m_skipAlgo){
+      m_hMonitoredChan->SetTitle("Not available : physic mode with non zero DSP threshold");
+      m_hOddEventsYield->SetTitle("Not available : physic mode with non zero DSP threshold");
+      m_hTimeDistrib->SetTitle("Not available : physic mode with non zero DSP threshold");
+    }
+  }
+
+  if (m_skipAlgo){
+    return sc;
+  } 
+
+  // Increment event counter and initialize the global number of odd samples for the tree
+  m_eventsCounter++;
+  // If a yield in any partition is greater m_burstyThreshold, store the event in ntuple (if activated in jO)
+  m_eventToBeStored = false;
+
+  const xAOD::EventInfo* thisEventInfo;
+  sc=evtStore()->retrieve(thisEventInfo);
+  if (sc!=StatusCode::SUCCESS)
+    msg(MSG::WARNING) << "No EventInfo object found! Can't read run number!" << endreq;
+  else{
+    m_evtId = thisEventInfo->eventNumber();
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Event nb " << thisEventInfo->eventNumber() << endreq;
+    int Ofst = thisEventInfo->timeStamp()/(24*3600);
+    m_evtTime = float(thisEventInfo->timeStamp() - (Ofst*24*3600))/60;
+
+    // If stream awareness is enabled, retrieve stream info    
+    if (m_noise_streams.size() != 0){
+      m_skipEvent = true;
+      const std::vector<xAOD::EventInfo::StreamTag>& event_stream_tags = thisEventInfo->streamTags();
+      for (uint i=0;i<event_stream_tags.size();i++){
+	for (uint j=0;j<m_noise_streams.size();j++){
+	  msg(MSG::DEBUG) << "This is Stream Tag: " << event_stream_tags[i].type() << "_" << event_stream_tags[i].name()  << endreq;
+	  if( m_noise_streams[j] == event_stream_tags[i].name()) {
+	    m_skipEvent = false;
+	    break;
+	  }
+	}
+      }// End of double loop on streams
+      if (m_skipEvent){
+	return sc;
+      }  
+    }// End of (if stream awareness)
+  }
+  
+  m_treeNbOfOdd = 0; // Used only in the case of tree filling
+  // The index corresponds to the partitionNb; the 2 last one are related to 
+  // the whole endcap and are filled at the end of the event
+  double oddEventYield[10] = {0,0,0,0,0,0,0,0,0,0};
+  double nbOfBurstyFEB[10] = {0,0,0,0,0,0,0,0,0,0};
+  for(int i=0;i<10;i++) m_treeBurstyPartition[i] = 0;
+    
+  // retrieve LArDigitContainer
+  const LArDigitContainer* pLArDigitContainer;
+  sc = evtStore()->retrieve(pLArDigitContainer, m_LArDigitContainerKey);
+  if (sc.isFailure()) {
+    msg(MSG::WARNING) << "Can\'t retrieve LArDigitContainer with key " 
+        << m_LArDigitContainerKey << endreq;
+    return StatusCode::SUCCESS;
+  }
+
+
+  // loop over LArDigit to retrieve data
+  LArDigitContainer::const_iterator itDig = pLArDigitContainer->begin(); 
+  LArDigitContainer::const_iterator itDig_e= pLArDigitContainer->end(); 
+  const LArDigit* pLArDigit;
+  for ( ; itDig!=itDig_e;++itDig) {
+    pLArDigit = *itDig;
+
+    HWIdentifier id = pLArDigit->hardwareID();
+      
+    HWIdentifier febID = m_LArOnlineIDHelper->feb_Id(id);
+    HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(id);
+    IdentifierHash feedthroughHash = m_LArOnlineIDHelper->feedthrough_Hash(feedthroughID);
+    int channel = m_LArOnlineIDHelper->channel(id);
+    int slot = m_LArOnlineIDHelper->slot(febID);
+    int feedthrough = m_LArOnlineIDHelper->feedthrough(feedthroughID);
+    int barrEc = m_LArOnlineIDHelper->barrel_ec(feedthroughID);
+    int posNeg = m_LArOnlineIDHelper->pos_neg(feedthroughID);
+    int partitionNb = barrEc*2 + posNeg;
+
+    int refNoiseIndex = 0;
+
+    if (barrEc == 1 && (feedthrough == 3 || feedthrough == 10 || feedthrough == 16 || feedthrough == 22) && (slot > 2)){
+      partitionNb = barrEc*2 + posNeg + 2;// This is HEC FEB
+      refNoiseIndex = 1;
+    }
+
+    if (barrEc == 1 && feedthrough == 6) partitionNb = barrEc*2 + posNeg + 4;// This is FCAL FEB
+
+    CaloGain::CaloGain gain = pLArDigit->gain();
+    feedthroughInfo& feedthroughinfo = m_feedthroughInfo[feedthroughHash][gain];
+    
+    // check if corresponding feedthrough is to be monitored
+    if (feedthroughinfo.toBeMonitored) {
+      // check if corresponding feedthrough histos are booked
+      if (!feedthroughinfo.bookedHists) {
+	// if not, book on demand
+	sc = this->bookPerFeedthrough(feedthroughID, gain);
+	if (sc.isFailure()) {
+	  msg(MSG::FATAL) << "Problem booking histos for feedthroughID " << std::hex << feedthroughID << std::dec << endreq;
+	  return StatusCode::FAILURE;
+	}
+      }// End of booking on demand
+
+      // check if corresponding feb pedestals have been retrieved - If not do it
+      if (m_coolRetrieval){
+	HWIdentifier febID = m_LArOnlineIDHelper->feb_Id(id);
+	IdentifierHash febHash = m_LArOnlineIDHelper->feb_Hash(febID);	
+	if (!m_febPedRetrieved[febHash][gain]){
+	  sc = this->retrievePedPerFeb(febID, feedthroughID, gain);	
+	  if (sc.isFailure()) msg(MSG::FATAL) << "Problem when retrieving the pedestals" << endreq;
+	}// End of pedestal retrieving
+      }
+
+      // If the reference pedestal/noise are not retrieved from the cool
+      // they are computed from the first m_computePeds events
+      if (!(m_coolRetrieval) && m_eventsCounter<=m_computePeds){
+	const std::vector < short > samples = pLArDigit->samples();
+	if (samples.size() > 0) feedthroughinfo.hReference->Fill(slot,channel,samples[0]);
+	if (m_eventsCounter == m_computePeds){
+	  double computedNoise = feedthroughinfo.hReference->GetBinError(slot,channel+1);
+	  // Bad channel masking added on 23/4/08
+	  bool bool_badChannel = true;
+	  if (m_maskBadChannels){
+	    if (m_badChannelMask->cellShouldBeMasked(id)) bool_badChannel = false;
+	  }
+	  if (computedNoise>m_minimumRefNoise[refNoiseIndex] && computedNoise<m_maximumRefNoise[refNoiseIndex] && bool_badChannel){
+	    // Add 1 to the number of cells monitored per FEB
+	    fillFeedthroughHistos(feedthroughID,slot,1,true);
+	  }
+	  else{
+	    // The channels is not monitored (noise outside bounds or bad channel masked)
+	    // The error is arbitrary set to 0 to ignore odd events here
+	    feedthroughinfo.hReference->SetBinError(slot,channel+1,0);
+	  }
+	}
+      }
+      else {
+	// Pedestal have been retrieved from COOL or computed from first events - Therefore now look for odd cells
+	// First extract ped/noise from reference histos
+	double refPed;
+	double refNoise;
+	if (m_coolRetrieval){
+	  feedthroughinfo.hReferenceCool->GetBinContentAndError(slot,channel+1,refPed,refNoise);
+	}
+	else{
+	  refPed = feedthroughinfo.hReference->GetBinContent(slot,channel+1);
+	  refNoise = feedthroughinfo.hReference->GetBinError(slot,channel+1);
+	}
+	// The check below is mandatory to treat FEB with less than 128 channels
+	// In this case, the reference pedestal was set to 0
+	if (refPed != 0 && refNoise != 0){
+	  const std::vector < short > samples = pLArDigit->samples();
+	  int nbOfOddSamples = 0;
+	  m_nbOfSamples = (int) samples.size();
+	  // Count the nb of odd samples - Consider only one sample
+	  if (m_sampleNumber >= 0 && m_sampleNumber<m_nbOfSamples) {
+	    double signif = 0;
+	    double signedSignif = (double(samples[m_sampleNumber]) - refPed) / refNoise;
+	    if (m_posNeg == 0 ) signif = fabs(signedSignif);
+	    if (fabs(m_posNeg) == 1 ) signif = m_posNeg * signedSignif;
+	    // Store temporarily ADC-Ped for coherent noise analysis (have to sum whole FEB before looking for odd sums)
+	    feedthroughinfo.hTempSumComput->Fill(slot-1,m_sampleNumber,double(samples[m_sampleNumber]) - refPed);
+	    
+	    if (signif>m_oddnessThreshold) {
+	      nbOfOddSamples++;
+
+	      if (m_createTree && m_treeNbOfOdd<60000){
+		//Retrieve offline ID
+		Identifier offlineId;      
+		try {
+		  offlineId = m_LArCablingService->cnvToIdentifier(id); 
+		}
+		catch(LArID_Exception& except) {
+		  msg(MSG::ERROR) << "LArID_Exception " << (std::string) except << endreq ;
+		}
+
+		m_treeBarrelEc[m_treeNbOfOdd] = barrEc;
+		m_treePosNeg[m_treeNbOfOdd] = posNeg;
+		m_treeFT[m_treeNbOfOdd] = feedthrough;
+		m_treeSlot[m_treeNbOfOdd] = slot;
+		m_treeChannel[m_treeNbOfOdd] = channel;
+		m_treeSample[m_treeNbOfOdd] = m_sampleNumber;
+		m_treeSignif[m_treeNbOfOdd] = signedSignif;
+		m_treeSampling[m_treeNbOfOdd] = m_LArEM_IDHelper->sampling(offlineId);
+		m_treeRegion[m_treeNbOfOdd] = m_LArEM_IDHelper->region(offlineId);
+		m_treeEta[m_treeNbOfOdd] = m_LArEM_IDHelper->eta(offlineId);
+		m_treePhi[m_treeNbOfOdd] = m_LArEM_IDHelper->phi(offlineId);
+		
+		m_treeNbOfOdd++;
+	      }// End of tree treatment
+	    }// End of (if oddevents exist)
+	  } else {// Consider all samples (see joboption) 
+	    for (int j = 0; j <(m_nbOfSamples); ++j) {
+	      double signif = 0;
+	      double signedSignif = (double) ((samples[j] - refPed)/refNoise);
+	      if (m_posNeg == 0) signif = fabs(signedSignif);
+	      if (fabs(m_posNeg) == 1) signif = m_posNeg * (signedSignif);
+	      // Store temporarily ADC-Ped for coherent noise analysis (have to sum whole FEB before looking for odd sums)
+	      feedthroughinfo.hTempSumComput->Fill(slot-1,j,double(samples[j]) - refPed);
+
+	      if (signif>m_oddnessThreshold){
+		nbOfOddSamples++;	    
+
+		if (m_createTree && m_treeNbOfOdd<60000){
+		  //Retrieve offline ID
+		  Identifier offlineId;      
+		  try {
+		    offlineId = m_LArCablingService->cnvToIdentifier(id); 
+		  }
+		  catch(LArID_Exception& except) {
+		    msg(MSG::ERROR) << "LArID_Exception " << (std::string) except << endreq ;
+		  }      
+
+		  m_treeBarrelEc[m_treeNbOfOdd] = barrEc;
+		  m_treePosNeg[m_treeNbOfOdd] = posNeg;
+		  m_treeFT[m_treeNbOfOdd] = feedthrough;
+		  m_treeSlot[m_treeNbOfOdd] = slot;
+		  m_treeChannel[m_treeNbOfOdd] = channel;
+		  m_treeSample[m_treeNbOfOdd] = j;
+		  m_treeSignif[m_treeNbOfOdd] = signedSignif;
+		  m_treeSampling[m_treeNbOfOdd] = m_LArEM_IDHelper->sampling(offlineId);
+		  m_treeRegion[m_treeNbOfOdd] = m_LArEM_IDHelper->region(offlineId);
+		  m_treeEta[m_treeNbOfOdd] = m_LArEM_IDHelper->eta(offlineId);
+		  m_treePhi[m_treeNbOfOdd] = m_LArEM_IDHelper->phi(offlineId);
+		  
+		  m_treeNbOfOdd++;
+		}// End of tree treatment
+	      }// End of (if oddevents exist)
+	    }// End of loop on all samples
+	  }// End of (all samples case)
+
+	  // Some odd samples have been found
+	  if (nbOfOddSamples != 0) {
+	    // Fill base histograms
+	    oddEventYield[partitionNb] = oddEventYield[partitionNb] + ((double) nbOfOddSamples);
+	    // If m_useEvtCounter is true, fill event counter instead for event id
+	    // Useful for cosmics runs where evt id might be huge!
+	    if (m_useEvtCounter) m_hTimeDistrib->Fill(m_eventsCounter,nbOfOddSamples);
+	    else m_hTimeDistrib->Fill(m_evtId,nbOfOddSamples);
+	    feedthroughinfo.NbOddPerChan->Fill(slot,channel,nbOfOddSamples);	  
+	    // Fill summary histogram
+	    fillFeedthroughHistos(feedthroughID,slot,nbOfOddSamples);
+	  }// End of histogram filling
+	}// End of (if refPed != 0)
+      }// End of search of oddcells (cf treatment of m_coolRetrieval)
+    }// End of feedthrough treatment (if is to be monitored)
+  }// End of loop on LArDigit
+
+
+  // If a search for odd cells have been performed, fill the yield, and search for odd sums
+  // and fill the tree, if requested
+  if (!(!(m_coolRetrieval) && m_eventsCounter<=m_computePeds)){
+
+    // Retrieve bursty event based on q factor
+    LArNoisyROSummary* noisyRO;
+    sc = evtStore()->retrieve(noisyRO,"LArNoisyROSummary");
+    if (sc.isFailure())
+      {
+	msg(MSG::WARNING) << "Can't retrieve LArNoisyROSummary " <<endreq;
+	return StatusCode::SUCCESS;
+      }    
+    const std::vector<HWIdentifier>& noisyFEB = noisyRO->get_noisy_febs();    
+
+    for (size_t i = 0; i<noisyFEB.size(); i++){
+	const HWIdentifier& id = noisyFEB[i];
+	int barrEc = m_LArOnlineIDHelper->barrel_ec(id);
+	int posNeg = m_LArOnlineIDHelper->pos_neg(id);
+	int slot = m_LArOnlineIDHelper->slot(id);
+	int feedthrough = m_LArOnlineIDHelper->feedthrough(id);
+	int partitionNb = barrEc*2 + posNeg;
+	if (barrEc == 1 && (feedthrough == 3 || feedthrough == 10 || feedthrough == 16 || feedthrough == 22) && (slot > 2))
+	  partitionNb = barrEc*2 + posNeg + 2;// This is HEC FEB
+	if (barrEc == 1 && feedthrough == 6) partitionNb = barrEc*2 + posNeg + 4;// This is FCAL FEB
+	nbOfBurstyFEB[partitionNb]++;
+    }
+
+    // Yield computation
+    // First count nb of odd events in the endcap by summing different sub partition
+    oddEventYield[8] = oddEventYield[2] + oddEventYield[4] + oddEventYield[6];
+    oddEventYield[9] = oddEventYield[3] + oddEventYield[5] + oddEventYield[7];
+    // Total nb of events
+    double overallYield = oddEventYield[0] + oddEventYield[1] + oddEventYield[8] + oddEventYield[9];
+    // Compute for each partition the nb of odd cells
+    for (int iPart=0; iPart<10; iPart++){
+      // Check that the nb of monitored channels and samples are different from 0
+      if (m_nbMonitoredChan[iPart] != 0 && m_nbOfSamples != 0){
+	// Then renormalize the yield
+	if (m_sampleNumber < 0 || m_sampleNumber >= m_nbOfSamples) oddEventYield[iPart] = 100*oddEventYield[iPart]/((double) (m_nbMonitoredChan[iPart]*m_nbOfSamples));  
+	else oddEventYield[iPart] = 100*oddEventYield[iPart]/((double) m_nbMonitoredChan[iPart]);
+      }
+      if (oddEventYield[iPart] > m_burstyThreshold){
+	m_treeBurstyPartition[iPart] = m_treeBurstyPartition[iPart] + 1;
+      }
+      if (nbOfBurstyFEB[iPart] >= m_burstyThresholdQ){
+	m_treeBurstyPartition[iPart] = m_treeBurstyPartition[iPart] + 2;
+      }
+    }
+
+    // Fill the yield of odd events per partition for all partition
+    fillYieldPerEvent(m_barrelCSummary,oddEventYield[0],m_treeBurstyPartition[0]);
+    fillYieldPerEvent(m_barrelASummary,oddEventYield[1],m_treeBurstyPartition[1]);
+    fillYieldPerEvent(m_endcapCSummary,oddEventYield[8],m_treeBurstyPartition[8]);
+    fillYieldPerEvent(m_endcapASummary,oddEventYield[9],m_treeBurstyPartition[9]);
+    if (m_detailEndCap){
+      fillYieldPerEvent(m_emecCSummary,oddEventYield[2],m_treeBurstyPartition[2]);
+      fillYieldPerEvent(m_emecASummary,oddEventYield[3],m_treeBurstyPartition[3]);
+      fillYieldPerEvent(m_hecCSummary,oddEventYield[4],m_treeBurstyPartition[4]);
+      fillYieldPerEvent(m_hecASummary,oddEventYield[5],m_treeBurstyPartition[5]);
+      fillYieldPerEvent(m_fcalCSummary,oddEventYield[6],m_treeBurstyPartition[6]);
+      fillYieldPerEvent(m_fcalASummary,oddEventYield[7],m_treeBurstyPartition[7]);
+    }
+    // And the total yield
+    if (m_nbMonitoredTotal != 0 && m_nbOfSamples != 0){
+      // Then renormalize the yield
+	if (m_sampleNumber < 0 || m_sampleNumber >= m_nbOfSamples) overallYield = 100*overallYield/((double) (m_nbMonitoredTotal*m_nbOfSamples));  
+	else overallYield = 100*overallYield/((double) m_nbMonitoredTotal);  
+    }    
+    m_hOddEventsYield->Fill(overallYield);
+
+    msg(MSG::DEBUG) << "End of event - Fill coherent noise histos" << endreq;
+
+    std::vector<CaloGain::CaloGain> gains;
+    gains.push_back(CaloGain::LARHIGHGAIN);
+    gains.push_back(CaloGain::LARMEDIUMGAIN);
+    //    gains.push_back(CaloGain::LARLOWGAIN); 
+    
+    for (unsigned int ftHash = 0; ftHash < m_LArOnlineIDHelper->feedthroughHashMax(); ++ftHash) {
+      std::vector<CaloGain::CaloGain>::iterator pGainEnd(gains.end());
+      for (std::vector<CaloGain::CaloGain>::iterator pGain = gains.begin();pGain != pGainEnd; ++pGain) {
+	CaloGain::CaloGain gain = *pGain;
+	feedthroughInfo& ftinfo = m_feedthroughInfo[ftHash][gain];
+	if (ftinfo.bookedHists) {
+	  fillSumPerFEBHistos(ftinfo);
+	  ftinfo.hTempSumComput->Reset();		  
+	}
+      }
+    }
+    
+    // Tree filling
+    if (m_createTree && m_eventToBeStored){
+      m_tOdd->Fill();
+    }
+  }
+
+  return sc;
+}
+ 
+/*---------------------------------------------------------*/
+StatusCode 
+LArOddCellsMonTool::checkHists(bool fromFinalize)
+{
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in checkHists() - " << m_eventsCounter << " events - Finalize ?" << fromFinalize << endreq;
+
+  if (m_eventsCounter == 0) return StatusCode::SUCCESS;
+
+  std::vector<CaloGain::CaloGain> gains;
+  gains.push_back(CaloGain::LARHIGHGAIN);
+  gains.push_back(CaloGain::LARMEDIUMGAIN);
+  //  gains.push_back(CaloGain::LARLOWGAIN); 
+
+  // Loop over all FT to compute yield of odd events per channel and extract nb of odd channels
+  const unsigned hashmax(m_LArOnlineIDHelper->feedthroughHashMax());
+  for (unsigned int ftHash = 0; ftHash < hashmax; ++ftHash) {
+    std::vector<CaloGain::CaloGain>::iterator pGainEnd(gains.end());
+    for (std::vector<CaloGain::CaloGain>::iterator pGain = gains.begin();pGain != pGainEnd; ++pGain) {
+      CaloGain::CaloGain gain = *pGain;
+      feedthroughInfo& ftinfo = m_feedthroughInfo[ftHash][gain];
+
+      if (ftinfo.bookedHists){ 
+	// Compute the yield of odd events
+	fillYieldHistos(ftinfo.NbOddPerChan,ftinfo.YieldPerChan);
+	copyChanYield(ftinfo);
+      }
+    }    
+  }// End of loop on all all FT
+
+  // Fill yield of odd events per FEB
+  fillYieldHistos(m_barrelCSummary.NbOddPerFEB,m_barrelCSummary.YieldPerFEB,m_barrelCSummary.CellNbPerSlot);
+  fillYieldHistos(m_barrelASummary.NbOddPerFEB,m_barrelASummary.YieldPerFEB,m_barrelASummary.CellNbPerSlot);
+  fillYieldHistos(m_endcapCSummary.NbOddPerFEB,m_endcapCSummary.YieldPerFEB,m_endcapCSummary.CellNbPerSlot);
+  fillYieldHistos(m_endcapASummary.NbOddPerFEB,m_endcapASummary.YieldPerFEB,m_endcapASummary.CellNbPerSlot);
+
+  if (m_detailEndCap){
+    fillYieldHistos(m_emecCSummary.NbOddPerFEB,m_emecCSummary.YieldPerFEB,m_emecCSummary.CellNbPerSlot);
+    fillYieldHistos(m_emecASummary.NbOddPerFEB,m_emecASummary.YieldPerFEB,m_emecASummary.CellNbPerSlot);    
+    fillYieldHistos(m_hecCSummary.NbOddPerFEB,m_hecCSummary.YieldPerFEB,m_hecCSummary.CellNbPerSlot);
+    fillYieldHistos(m_hecASummary.NbOddPerFEB,m_hecASummary.YieldPerFEB,m_hecASummary.CellNbPerSlot);    
+    fillYieldHistos(m_fcalCSummary.NbOddPerFEB,m_fcalCSummary.YieldPerFEB,m_fcalCSummary.CellNbPerSlot);
+    fillYieldHistos(m_fcalASummary.NbOddPerFEB,m_fcalASummary.YieldPerFEB,m_fcalASummary.CellNbPerSlot);    
+  }
+
+  // Fill yield of odd sums per FEB
+  fillYieldHistos(m_barrelCSummary.NbOddSumPerFEB,m_barrelCSummary.YieldSumPerFEB);
+  fillYieldHistos(m_barrelASummary.NbOddSumPerFEB,m_barrelASummary.YieldSumPerFEB);
+  fillYieldHistos(m_endcapCSummary.NbOddSumPerFEB,m_endcapCSummary.YieldSumPerFEB);
+  fillYieldHistos(m_endcapASummary.NbOddSumPerFEB,m_endcapASummary.YieldSumPerFEB);
+
+  if (m_detailEndCap){
+    fillYieldHistos(m_emecCSummary.NbOddSumPerFEB,m_emecCSummary.YieldSumPerFEB);
+    fillYieldHistos(m_emecASummary.NbOddSumPerFEB,m_emecASummary.YieldSumPerFEB);    
+    fillYieldHistos(m_hecCSummary.NbOddSumPerFEB,m_hecCSummary.YieldSumPerFEB);
+    fillYieldHistos(m_hecASummary.NbOddSumPerFEB,m_hecASummary.YieldSumPerFEB);    
+    fillYieldHistos(m_fcalCSummary.NbOddSumPerFEB,m_fcalCSummary.YieldSumPerFEB);
+    fillYieldHistos(m_fcalASummary.NbOddSumPerFEB,m_fcalASummary.YieldSumPerFEB);    
+  }
+
+  // At the end of the job,deregister temporary sum computation histos and 
+  // reference histos (according to the job option value)
+  if (fromFinalize){
+    std::vector<CaloGain::CaloGain> gains;
+    gains.push_back(CaloGain::LARHIGHGAIN);
+    gains.push_back(CaloGain::LARMEDIUMGAIN);
+    //    gains.push_back(CaloGain::LARLOWGAIN); 
+    for (unsigned int feedthroughHash = 0; feedthroughHash < m_LArOnlineIDHelper->feedthroughHashMax(); ++feedthroughHash) {
+      std::vector<CaloGain::CaloGain>::iterator pGainEnd(gains.end());
+      for (std::vector<CaloGain::CaloGain>::iterator pGain = gains.begin();pGain != pGainEnd; ++pGain) {      
+	CaloGain::CaloGain gain = *pGain;
+	feedthroughInfo& ftinfo = m_feedthroughInfo[feedthroughHash][gain];
+	delete ftinfo.hTempSumComput;
+	if (!m_storeRefs) {
+	  if ((ftinfo).bookedHists){ 
+	    deregisterHisto(ftinfo.hReference);
+	    deregisterHisto(ftinfo.hReferenceCool);
+	    deregisterHisto(ftinfo.hReferenceCool_sum2);
+	    //deregisterHisto(ftinfo.hTempSumComput);
+	  }
+	}
+	if (!m_storePerFT) {
+	  if ((ftinfo).bookedHists){ 
+	    deregisterHisto(ftinfo.NbOddPerChan);
+	    deregisterHisto(ftinfo.YieldPerChan);
+	  }
+	}
+      }
+    }
+    deregisterHisto(m_barrelCSummary.CellNbPerSlot);
+    deregisterHisto(m_barrelASummary.CellNbPerSlot);
+    deregisterHisto(m_endcapCSummary.CellNbPerSlot);
+    deregisterHisto(m_endcapASummary.CellNbPerSlot);
+    if (m_detailEndCap){
+      deregisterHisto(m_emecCSummary.CellNbPerSlot);
+      deregisterHisto(m_emecASummary.CellNbPerSlot);
+      deregisterHisto(m_hecCSummary.CellNbPerSlot);
+      deregisterHisto(m_hecASummary.CellNbPerSlot);
+      deregisterHisto(m_fcalCSummary.CellNbPerSlot);
+      deregisterHisto(m_fcalASummary.CellNbPerSlot);      
+    }
+  }
+  
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "CheckHists() Over " << endreq;
+  
+  return StatusCode::SUCCESS;
+}
+/*---------------------------------------------------------*/
+StatusCode 
+LArOddCellsMonTool::procHistograms()
+{
+  if (msgLvl(MSG::DEBUG)) {
+    if (m_sampleNumber <0 || m_sampleNumber>=m_nbOfSamples) msg(MSG::DEBUG) << "I have monitored " << m_nbOfSamples << " samples of " << m_nbMonitoredTotal << " channels" ;
+    else msg(MSG::DEBUG) << "I have monitored sample " << m_sampleNumber << " of " << m_nbMonitoredTotal << " channels";
+
+    if (m_coolRetrieval) msg(MSG::DEBUG) << " with pedestal/noise extracted from COOL" << endreq;
+    else msg(MSG::DEBUG) << " with pedestal/noise computed from " << m_computePeds << " first events from this run" << endreq;
+  }
+
+  
+  StatusCode sc = StatusCode::SUCCESS;
+  if (!m_skipAlgo){
+    sc = this->checkHists(false);
+    if(sc.isFailure()) {
+      msg(MSG::ERROR) << "checkHists in finalHists returned failure!" << endreq;
+    }
+  }
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "End of procHistograms " << endreq;
+  
+  return sc;
+}
+
+/*---------------------------------------------------------*/
+StatusCode
+LArOddCellsMonTool::initMonInfo()  
+{
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in initMonInfo()" << endreq;
+  
+  std::vector<CaloGain::CaloGain> gains;
+  gains.push_back(CaloGain::LARHIGHGAIN);
+  gains.push_back(CaloGain::LARMEDIUMGAIN);
+  //  gains.push_back(CaloGain::LARLOWGAIN); 
+
+  // initialize all m_feedthroughInfo objects
+  m_feedthroughInfo.resize(m_LArOnlineIDHelper->feedthroughHashMax());
+  const unsigned hashmax=m_LArOnlineIDHelper->feedthroughHashMax();
+  for (unsigned int ftHash = 0; ftHash < hashmax; ++ftHash) {
+    std::vector<CaloGain::CaloGain>::iterator pGainEnd(gains.end());
+    for (std::vector<CaloGain::CaloGain>::iterator pGain = gains.begin();pGain != pGainEnd; ++pGain) {
+      CaloGain::CaloGain gain = *pGain;
+      feedthroughInfo& ftinfo = m_feedthroughInfo[ftHash][gain];
+      ftinfo.bookedHists = false;
+      ftinfo.toBeMonitored = false;
+      ftinfo.hReference = 0;
+      ftinfo.hReferenceCool = 0;
+      ftinfo.hReferenceCool_sum2 = 0;
+      ftinfo.hTempSumComput = 0;
+      ftinfo.NbOddPerChan = 0;
+      ftinfo.YieldPerChan = 0;
+      ftinfo.hIndivTimeDistrib = 0;
+      HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(ftHash);
+      ftinfo.barrel_ec= m_LArOnlineIDHelper->barrel_ec(feedthroughID);
+      ftinfo.pos_neg  = m_LArOnlineIDHelper->pos_neg(feedthroughID);
+      ftinfo.feedthrough = m_LArOnlineIDHelper->feedthrough(feedthroughID);
+    }
+  }
+
+  // enable appropriate feedthrough for monitoring
+  // enable all gains for now.  Booking is on demand.
+  if ((int)m_feedthroughNames.size() == 0) {
+    // take all feedthroughs
+    const unsigned hashmax=m_LArOnlineIDHelper->feedthroughHashMax();
+    for (unsigned int ftHash = 0; ftHash < hashmax; ++ftHash) {
+      // Monitor only the gain defined in jO
+      if (m_gainMonitored[0].find("H",0) != std::string::npos) m_feedthroughInfo[ftHash][CaloGain::LARHIGHGAIN  ].toBeMonitored = true;
+      if (m_gainMonitored[0].find("M",0) != std::string::npos) m_feedthroughInfo[ftHash][CaloGain::LARMEDIUMGAIN ].toBeMonitored = true;
+      if (m_gainMonitored[0].find("L",0) != std::string::npos) m_feedthroughInfo[ftHash][CaloGain::LARLOWGAIN ].toBeMonitored = true;
+      // This feedthrough also contains HEC FEB - Get the adequate gain to monitor
+      if (m_feedthroughInfo[ftHash][CaloGain::LARHIGHGAIN].barrel_ec == 1 && (m_feedthroughInfo[ftHash][CaloGain::LARHIGHGAIN].feedthrough == 3 || m_feedthroughInfo[ftHash][CaloGain::LARHIGHGAIN].feedthrough == 10 || m_feedthroughInfo[ftHash][CaloGain::LARHIGHGAIN].feedthrough == 16 || m_feedthroughInfo[ftHash][CaloGain::LARHIGHGAIN].feedthrough == 22)){
+	if (m_gainMonitored[1].find("H",0) != std::string::npos) m_feedthroughInfo[ftHash][CaloGain::LARHIGHGAIN  ].toBeMonitored = true;
+	if (m_gainMonitored[1].find("M",0) != std::string::npos) m_feedthroughInfo[ftHash][CaloGain::LARMEDIUMGAIN ].toBeMonitored = true;
+	if (m_gainMonitored[1].find("L",0) != std::string::npos) m_feedthroughInfo[ftHash][CaloGain::LARLOWGAIN ].toBeMonitored = true;
+      }
+    }
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Monitoring enabled for all " 
+        << m_LArOnlineIDHelper->feedthroughHashMax() << " feedthroughs" << endreq;
+  } else {
+    // only take selected feedthroughs
+    std::vector<std::string>::iterator pEnd(m_feedthroughNames.end());
+    for (std::vector<std::string>::iterator p = m_feedthroughNames.begin(); p != pEnd; ++p) {
+      //      HWIdentifier feedthroughID = HWIdentifier(*p);
+      HWIdentifier feedthroughID = m_strHelper->feedthrough_id(*p);
+      IdentifierHash ftHash = m_LArOnlineIDHelper->feedthrough_Hash(feedthroughID);
+      // Monitor only the gain defined in jO
+      if (m_gainMonitored[0].find("H",0) != std::string::npos) m_feedthroughInfo[ftHash][CaloGain::LARHIGHGAIN  ].toBeMonitored = true;
+      if (m_gainMonitored[0].find("M",0) != std::string::npos) m_feedthroughInfo[ftHash][CaloGain::LARMEDIUMGAIN ].toBeMonitored = true;
+      if (m_gainMonitored[0].find("L",0) != std::string::npos) m_feedthroughInfo[ftHash][CaloGain::LARLOWGAIN ].toBeMonitored = true;
+      // This feedthrough also contains HEC FEB - Get the adequate gain to monitor
+      if (m_feedthroughInfo[ftHash][CaloGain::LARHIGHGAIN].barrel_ec == 1 && (m_feedthroughInfo[ftHash][CaloGain::LARHIGHGAIN].feedthrough == 3 || m_feedthroughInfo[ftHash][CaloGain::LARHIGHGAIN].feedthrough == 10 || m_feedthroughInfo[ftHash][CaloGain::LARHIGHGAIN].feedthrough == 16 || m_feedthroughInfo[ftHash][CaloGain::LARHIGHGAIN].feedthrough == 22)){
+	if (m_gainMonitored[1].find("H",0) != std::string::npos) m_feedthroughInfo[ftHash][CaloGain::LARHIGHGAIN  ].toBeMonitored = true;
+	if (m_gainMonitored[1].find("M",0) != std::string::npos) m_feedthroughInfo[ftHash][CaloGain::LARMEDIUMGAIN ].toBeMonitored = true;
+	if (m_gainMonitored[1].find("L",0) != std::string::npos) m_feedthroughInfo[ftHash][CaloGain::LARLOWGAIN ].toBeMonitored = true;
+      }
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Monitoring enabled for feedthrough " <<  m_LArOnlineIDHelper->show_to_string(feedthroughID) << endreq;
+    }
+  }
+  
+// initialize m_febPedRetrieved object
+  m_febPedRetrieved.resize(m_LArOnlineIDHelper->febHashMax());
+  //  const unsigned hashmax = m_LArOnlineIDHelper->febHashMax();
+  for (unsigned int febHash = 0; febHash < hashmax; ++febHash) {
+    std::vector<CaloGain::CaloGain>::iterator pGainEnd(gains.end());
+    for (std::vector<CaloGain::CaloGain>::iterator pGain = gains.begin(); pGain != pGainEnd; ++pGain) {
+      CaloGain::CaloGain gain = *pGain;
+      m_febPedRetrieved[febHash][gain] = false;
+    }
+  }
+  return StatusCode::SUCCESS;
+}
+
+/*---------------------------------------------------------*/
+StatusCode
+LArOddCellsMonTool::bookPerFeedthrough(HWIdentifier feedthroughID, CaloGain::CaloGain gain)
+{
+  StatusCode sc;
+
+  // get feedthrough Hash 
+  IdentifierHash feedthroughHash = m_LArOnlineIDHelper->feedthrough_Hash(feedthroughID);
+
+  feedthroughInfo& feedthroughinfo = m_feedthroughInfo[feedthroughHash][gain];
+
+  // get gain and feb strings
+  std::string gainName = this->gain_str(gain);
+  std::string feedthroughName = m_strHelper->feedthrough_str(feedthroughID,LArOnlineIDStrHelper::EXPERTS);
+  std::string feedthroughTitle = m_strHelper->feedthrough_str(feedthroughID,LArOnlineIDStrHelper::EXPERTS,false);
+
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in bookPerFeedthrough(" << feedthroughName << " - "  << gainName << endreq;
+
+  // histo common quantities
+  std::string hName;
+  std::string hTitle;
+  int nbin = this->feedthroughSlotMax(feedthroughID);
+  float xMin = 0.5;
+  float xMax = nbin + xMin;
+  int nbin2 = 128; // Maximum nb of channels per feb
+  float xMin2 = -0.5;
+  float xMax2 = nbin2 + xMin2;
+  std::string fullPath;
+
+  MonGroup OddChannelsDebug( this, "LAr/OddCells/OddChannels", run, ATTRIB_MANAGED );
+  MonGroup OddChannelsDebugEffic( this, "LAr/OddCells/OddChannels", run, ATTRIB_MANAGED ,"","effAsPerCent");
+
+  hName = "OddChannels" + feedthroughName + gainName;
+  hTitle = "Nb of odd events " + feedthroughTitle + " " + gainName + " - " + format("%.0f",m_oddnessThreshold) + " sigma";
+  feedthroughinfo.NbOddPerChan = TH2I_LW::create(hName.c_str(), hTitle.c_str(), nbin, xMin, xMax, nbin2, xMin2, xMax2);
+  feedthroughinfo.NbOddPerChan->GetXaxis()->SetTitle("Slot number");
+  feedthroughinfo.NbOddPerChan->GetYaxis()->SetTitle("Channel number");
+  sc = sc && OddChannelsDebug.regHist(feedthroughinfo.NbOddPerChan);
+
+  hName = "OddChannelsStatus" + feedthroughName + gainName;
+  hTitle = "Prop. of odd events (" + format("%.0f",m_oddnessThreshold) + " sigma ) - " + feedthroughTitle + " " + gainName;
+  feedthroughinfo.YieldPerChan = TH2F_LW::create(hName.c_str(), hTitle.c_str(), nbin, xMin, xMax, nbin2, xMin2, xMax2);
+  feedthroughinfo.YieldPerChan->GetXaxis()->SetTitle("Slot number");
+  feedthroughinfo.YieldPerChan->GetYaxis()->SetTitle("Channel number");
+  sc = sc && OddChannelsDebugEffic.regHist(feedthroughinfo.YieldPerChan);
+
+  hName = "PedReference" + feedthroughName + gainName;
+  hTitle = "Pedestals (from " + format("%d",m_computePeds) + " first events) - " + feedthroughName + " " + gainName;
+  feedthroughinfo.hReference = TProfile2D_LW::create(hName.c_str(), hTitle.c_str(), nbin, xMin, xMax, nbin2, xMin2, xMax2,"s");
+  sc = sc && OddChannelsDebug.regHist(feedthroughinfo.hReference);
+
+  hName = "PedReferenceCool" + feedthroughName + gainName;
+  hTitle = "Pedestals (from COOL) - " + feedthroughName + " " + gainName;
+  feedthroughinfo.hReferenceCool = TH2F_LW::create(hName.c_str(), hTitle.c_str(), nbin, xMin, xMax, nbin2, xMin2, xMax2);
+  sc = sc && OddChannelsDebug.regHist(feedthroughinfo.hReferenceCool);
+
+  hName = "NoiseReferenceCool_sum2" + feedthroughName + gainName;
+  hTitle = "Quadratic noise per FEB (from COOL) - " + feedthroughName + " " + gainName;
+  feedthroughinfo.hReferenceCool_sum2 = TH1D_LW::create(hName.c_str(), hTitle.c_str(), nbin, xMin, xMax);
+  sc = sc && OddChannelsDebug.regHist(feedthroughinfo.hReferenceCool_sum2);
+
+//   hName = "hTempSumComput" + feedthroughName + gainName;
+//   feedthroughinfo.hTempSumComput = TH2F_LW::create(hName.c_str(), hName.c_str(), nbin, xMin, xMax, 32, -0.5, 31.5);
+//   sc = sc && OddChannelsDebug.regHist(feedthroughinfo.hTempSumComput);
+  feedthroughinfo.hTempSumComput=new Simple2DSumHist(nbin,32);
+
+  // flag booking
+  feedthroughinfo.bookedHists = true;
+
+  if (sc.isFailure()) {
+    msg(MSG::ERROR) << "Registration per feedthrough failed" << endreq;
+    return sc;
+  }
+
+  return StatusCode::SUCCESS;
+}
+
+/*---------------------------------------------------------*/
+StatusCode
+LArOddCellsMonTool::retrievePedPerFeb(HWIdentifier febID, HWIdentifier feedthroughID, CaloGain::CaloGain gain)
+{
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in retrievePedPerFeb(" << std::hex << febID << std::dec << ", " << gain << ")" << endreq;
+
+
+  IdentifierHash febHash = m_LArOnlineIDHelper->feb_Hash(febID);
+  int barrelEc = m_LArOnlineIDHelper->barrel_ec(febID);
+  int feedthrough = m_LArOnlineIDHelper->feedthrough(febID);
+  int slot = m_LArOnlineIDHelper->slot(febID);
+  IdentifierHash feedthroughHash = m_LArOnlineIDHelper->feedthrough_Hash(feedthroughID);  
+  int refNoiseIndex = 0;
+
+  feedthroughInfo& feedthroughinfo = m_feedthroughInfo[feedthroughHash][gain];
+
+  double sum2 = 0;
+  // This is a HEC FEB
+  // Dirty method as IsHECOnlineFEBId is buggy!
+  if ((barrelEc == 1) && (feedthrough == 3 || feedthrough == 10 || feedthrough == 16 || feedthrough == 22) && (slot > 2)) refNoiseIndex = 1;
+  
+  for (int iChannel= 0 ; iChannel<128 ;iChannel++){
+    if (m_larPedestal){
+      HWIdentifier chid = m_LArOnlineIDHelper->channel_Id(febID,iChannel);
+      float pedestal = m_larPedestal->pedestal(chid,gain);	  
+      float pedestalRMS = m_larPedestal->pedestalRMS(chid,gain);
+
+      if (pedestal>= (1.0+LArElecCalib::ERRORCODE) && pedestalRMS>=(1.0+LArElecCalib::ERRORCODE)){
+	feedthroughinfo.hReferenceCool->SetBinContent(slot,iChannel+1,pedestal);
+	// The condition below allows to exclude channels that are not connected 
+	// Some of them have in fact a non zero noise (around 1-1.2) due to the
+	// chips connections in the FEB
+	// It also allows to exclude very noisy channels that may bias measurement
+	// NB : a refnoise equal to 0 leads to a signif equal to 0 (see initialization)
+	// and therefore no odd channels
+	// Bad channel masking added on 23/4/08
+	bool bool_badChannel = true;
+	if (m_maskBadChannels){
+	  if (m_badChannelMask->cellShouldBeMasked(chid)) bool_badChannel = false;
+	}
+	if (pedestalRMS>m_minimumRefNoise[refNoiseIndex] && pedestalRMS<m_maximumRefNoise[refNoiseIndex] && bool_badChannel) {
+	  feedthroughinfo.hReferenceCool->SetBinError(slot,iChannel+1,pedestalRMS);
+	  sum2 = sum2 + pedestalRMS * pedestalRMS;
+	  // Add 1 to the number of cells considered per FEB
+	  fillFeedthroughHistos(feedthroughID,slot,1,true);
+	}
+	else
+	  // Here the noise is outside the allowed bound. It is arbitrary set to 0 to ignore odd events here
+	  feedthroughinfo.hReferenceCool->SetBinError(slot,iChannel+1,0);            
+      }
+      else{
+ 	feedthroughinfo.hReferenceCool->SetBinContentAndError(slot,iChannel+1,0,0);
+      }
+    }      
+  } // End of loop on 128 channels
+
+  if (sum2>=0) feedthroughinfo.hReferenceCool_sum2->SetBinContent(slot,sqrt(sum2));
+
+  m_febPedRetrieved[febHash][gain] = true;
+  
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Leaving retrievePedPerFeb..." << endreq;
+
+  return StatusCode::SUCCESS;
+}
+
+
+/*---------------------------------------------------------*/
+int 
+LArOddCellsMonTool::feedthroughSlotMax(HWIdentifier id) 
+{
+  // get the max slot number in the corresponding feedthrough
+  // Barrel:14  EMECStandard:13  EMECSpecial:15  HEC:10  FCAL:15
+  int slotMax = 0;
+  if (m_LArOnlineIDHelper->isEmBarrelOnline(id)) {
+    slotMax = 14;
+  } else if (m_LArOnlineIDHelper->isEmEndcapStandardOnline(id)) {
+    slotMax = 13;
+  } else if (m_LArOnlineIDHelper->isEmEndcapSpecialOnline(id)) {
+    slotMax = 15;
+  } else if (m_LArOnlineIDHelper->isHecOnlineFebId(id)) {
+    slotMax = 10;
+  } else if (m_LArOnlineIDHelper->isFcalOnline(id)) {
+    slotMax = 15;
+  }
+  
+  return slotMax;
+}
+
+/*---------------------------------------------------------*/
+void LArOddCellsMonTool::fillFeedthroughHistos(HWIdentifier FTId,int slotNumber,int weight,bool cellCnt)
+{
+  int feedthrough = m_LArOnlineIDHelper->feedthrough(FTId);
+
+  // no detailedEndcap : partitionNb = 0 : EMBC / 1 : EMBA / 2 : EndcapC / 3 : EndcapA 
+  // detailedEndcap :    partitionNb = 0 : EMBC / 1 : EMBA / 2 : EMECC / 3 : EMECA / 4 : HECC / 5 : HECA / 6 : FCALC / 7 : FCALA
+  int partitionNb = m_LArOnlineIDHelper->barrel_ec(FTId)*2+m_LArOnlineIDHelper->pos_neg(FTId);
+  if (m_detailEndCap && m_LArOnlineIDHelper->barrel_ec(FTId)  == 1){
+    if ((feedthrough == 3 || feedthrough == 10 || feedthrough == 16 || feedthrough == 22) && (slotNumber > 2)) partitionNb = m_LArOnlineIDHelper->barrel_ec(FTId)*2+m_LArOnlineIDHelper->pos_neg(FTId) + 2; // This is HEC FEB
+    if ( feedthrough == 6) partitionNb = m_LArOnlineIDHelper->barrel_ec(FTId)*2+m_LArOnlineIDHelper->pos_neg(FTId) + 4; // This is FCAL FEB
+  }
+
+  // If cellCnt = true, just count the number of cells to be monitored in the 
+  // considered feb
+  if (cellCnt){
+    m_hMonitoredChan->Fill(partitionNb+1);
+    m_nbMonitoredChan[partitionNb]++;
+//    HWIdentifier febID = m_LArOnlineIDHelper->feb_Id(m_LArOnlineIDHelper->barrel_ec(FTId),m_LArOnlineIDHelper->pos_neg(FTId),m_LArOnlineIDHelper->feedthrough(FTId),slotNumber);
+//    Identifier offlineId;
+//    try {
+//    offlineId = m_LArCablingService->cnvToIdentifier(febID); 
+//    }
+//    catch(LArID_Exception& except) {
+//    msg(MSG::ERROR) << "LArID_Exception " << (std::string) except << endreq ;
+//    }
+//    m_nbMonitoredChanPerPartSampling[partitionNb*4+m_LArEM_IDHelper->sampling(offlineId)]++;
+    m_nbMonitoredTotal++;
+
+    switch (partitionNb){
+    case 0:
+      m_barrelCSummary.CellNbPerSlot->Fill(slotNumber,feedthrough,weight);
+      break;
+    case 1:
+      m_barrelASummary.CellNbPerSlot->Fill(slotNumber,feedthrough,weight);
+      break;
+    case 2:
+    case 4:
+    case 6:
+      m_endcapCSummary.CellNbPerSlot->Fill(slotNumber,feedthrough,weight);
+      if (m_detailEndCap){
+	if (partitionNb == 2) m_emecCSummary.CellNbPerSlot->Fill(slotNumber,feedthrough,weight);
+	if (partitionNb == 4) m_hecCSummary.CellNbPerSlot->Fill(slotNumber,feedthrough,weight);
+	if (partitionNb == 6) m_fcalCSummary.CellNbPerSlot->Fill(slotNumber,feedthrough,weight);
+      }
+      m_nbMonitoredChan[8]++; // Line here to compute the total nb of channels in EndcapC
+      break;
+    case 3:
+    case 5:
+    case 7:
+      m_endcapASummary.CellNbPerSlot->Fill(slotNumber,feedthrough,weight);
+      if (m_detailEndCap){
+	if (partitionNb == 3) m_emecASummary.CellNbPerSlot->Fill(slotNumber,feedthrough,weight);
+	if (partitionNb == 5) m_hecASummary.CellNbPerSlot->Fill(slotNumber,feedthrough,weight);
+	if (partitionNb == 7) m_fcalASummary.CellNbPerSlot->Fill(slotNumber,feedthrough,weight);
+      }
+      m_nbMonitoredChan[9]++; // Line here to compute the total nb of channels in EndcapA
+      break;
+    }
+  }
+  else{
+// Here fill the nb of odd events per FEB
+    switch (partitionNb){
+    case 0:
+      m_barrelCSummary.NbOddPerFEB->Fill(slotNumber,feedthrough,weight);
+      break;
+    case 1:
+      m_barrelASummary.NbOddPerFEB->Fill(slotNumber,feedthrough,weight);
+      break;
+    case 2:
+    case 4:
+    case 6:
+      m_endcapCSummary.NbOddPerFEB->Fill(slotNumber,feedthrough,weight);
+      if (m_detailEndCap){
+	if (partitionNb == 2) m_emecCSummary.NbOddPerFEB->Fill(slotNumber,feedthrough,weight);
+	if (partitionNb == 4) m_hecCSummary.NbOddPerFEB->Fill(slotNumber,feedthrough,weight);
+	if (partitionNb == 6) m_fcalCSummary.NbOddPerFEB->Fill(slotNumber,feedthrough,weight);
+      }
+      break;
+    case 3:
+    case 5:
+    case 7:
+      m_endcapASummary.NbOddPerFEB->Fill(slotNumber,feedthrough,weight);
+      if (m_detailEndCap){
+	if (partitionNb == 3) m_emecASummary.NbOddPerFEB->Fill(slotNumber,feedthrough,weight);
+	if (partitionNb == 5) m_hecASummary.NbOddPerFEB->Fill(slotNumber,feedthrough,weight);
+	if (partitionNb == 7) m_fcalASummary.NbOddPerFEB->Fill(slotNumber,feedthrough,weight);
+      }
+      break;
+    }
+  }
+  return;
+}
+
+/*---------------------------------------------------------*/
+std::string LArOddCellsMonTool::gain_str(CaloGain::CaloGain gain)
+{
+  // return a string for the gain
+  std::string gStr = "";
+  if (gain == CaloGain::LARHIGHGAIN) {
+    gStr = "High";
+  } else if (gain == CaloGain::LARMEDIUMGAIN) {
+    gStr = "Medium";
+  } else if (gain == CaloGain::LARLOWGAIN) {
+    gStr = "Low";
+  } else if (gain == CaloGain::UNKNOWNGAIN) {
+    gStr = "Unknown";  
+  }
+  return gStr;
+}
+
+/*---------------------------------------------------------*/
+void LArOddCellsMonTool::fillYieldHistos(TH2I_LW* summaryHisto,TH2F_LW* statusHisto,TH2I_LW* cellCountingHisto)
+// Compute the yield of odd events per channel or FEB or odd sum
+// The number of odd events is stored in summaryHisto and the yield is stored in statusHisto
+// When normalizing the nb of odd events per FEB, one has to yake into accout the number of monitored cells 
+// (information in cellCountingHisto)
+// Otherwise for a single channel or odd sums, only normalize by NEvents * NSamples
+{
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in fillYieldHistos() - " << m_eventsCounter << endreq;
+
+  if (m_eventsCounter != 0){
+    const unsigned nx(summaryHisto->GetNbinsX());
+    const unsigned ny(summaryHisto->GetNbinsY());
+    for (unsigned ix=1;ix<=nx;++ix){
+      for (unsigned iy=1;iy<=ny;++iy){
+	// Initialize normalization factor
+	float normFactor = (float)m_eventsCounter;
+	if (!m_coolRetrieval) normFactor = m_eventsCounter - m_computePeds;
+	// Take into account the number of samples
+	if ((m_sampleNumber>m_nbOfSamples || m_sampleNumber<0) && (m_nbOfSamples != 0)) {
+	   normFactor = normFactor * m_nbOfSamples;	  
+	}
+	// Take into account the number of channels monitored
+	if (cellCountingHisto != NULL){
+	  const double bincont(cellCountingHisto->GetBinContent(ix,iy));
+	  if (bincont)  normFactor *= bincont;
+	}
+
+	float numer = (float) (summaryHisto->GetBinContent(ix,iy));
+	float propOfOddCells = numer/normFactor*100;
+	float propOfOddCellsError = numer ? sqrt(numer*normFactor*(normFactor-numer))/normFactor/normFactor*100 : 0;
+
+	statusHisto->SetBinContentAndError(ix,iy,propOfOddCells,propOfOddCellsError);
+      }// End of loop on y axis
+    }//End of loop on x axis
+  }//End of test on nb of events
+
+  return;
+}
+
+/*---------------------------------------------------------*/
+void LArOddCellsMonTool::bookHistsPartition(summaryHistos& summary,std::string partitionName)
+// Book histograms related to offline id (FT/Slots...) per partition
+{
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in bookHistsPartition()" << endreq;
+ 
+  StatusCode sc;
+ 
+  MonGroup generalGroup( this, "LAr/OddCells/General", run, ATTRIB_MANAGED );
+  MonGroup OddChannelsGroup( this, "LAr/OddCells/OddChannels", run, ATTRIB_MANAGED, "", "effAsPerCent" );
+  MonGroup OddFEBsDebugGroup( this, "LAr/OddCells/OddFEBs", run, ATTRIB_MANAGED );
+  MonGroup OddFEBsShiftGroup( this, "LAr/OddCells/OddFEBs", run, ATTRIB_MANAGED, "", "effAsPerCent" );
+  MonGroup OddSumFEBsDebugGroup( this, "LAr/OddCells/OddSumFEBs", run, ATTRIB_MANAGED );
+  MonGroup OddSumFEBsShiftGroup( this, "LAr/OddCells/OddSumFEBs", run, ATTRIB_MANAGED, "", "effAsPerCent" );
+  MonGroup cellNumberGroup( this, "LAr/OddCells/cellNumber", run, ATTRIB_MANAGED, "", "weightedAverage" );
+
+  // Extract characteristics of the partition
+  int nbOfSlots = 15;
+  int nbOfFt = 25;
+  int nbOfFtSlots = 375;
+  if (partitionName.find("Barrel",0) != std::string::npos){
+    nbOfSlots = 14;
+    nbOfFt = 32;
+    nbOfFtSlots = 448;
+  }
+  float slotMax = nbOfSlots + 0.5;
+  float ftMax = nbOfFt - 0.5;  
+  float ftSlotsMax = nbOfFtSlots + 0.5;
+
+  int refIndex = 0;
+  if (partitionName.find("Hec",0) != std::string::npos) refIndex = 1;  
+
+  std::string suffix = "(" + format("%.0f",m_oddnessThreshold) + " sigma - ";
+  if (m_sampleNumber<0) suffix = suffix +" - All samples) - ";
+  else suffix = suffix +" - Sample " + format("%1d only) - ",m_sampleNumber);
+  if (partitionName.find("Endcap",0) != std::string::npos) suffix = suffix + m_gainMonitored[0] + " / " + m_gainMonitored[1];
+  else suffix = suffix + m_gainMonitored[refIndex];  
+  for (uint i=0;i<m_noise_streams.size();i++) suffix = suffix + " - " + m_noise_streams[i];
+
+  // Book yield of odd events per channel
+  // Currently, this histo is just a copy of FT yield histo
+  std::string hName = partitionName + "PropOddEventsPerChan";
+  std::string hTitle = partitionName + " : prop. of odd events per channel " + suffix;
+  summary.YieldPerChan = TH2F_LW::create(hName.c_str(), hTitle.c_str(),nbOfFtSlots,0.5,ftSlotsMax,128,-0.5,127.5);
+  defineAxisTitle(summary.YieldPerChan,3);
+  sc= sc && OddChannelsGroup.regHist(summary.YieldPerChan);
+
+  // Book nb of odd events per FEB
+  hName = partitionName + "FeedthroughSummaryOddChannels";
+  hTitle = partitionName + " : nb of odd events per FEB " + suffix ;
+  summary.NbOddPerFEB = TH2I_LW::create(hName.c_str(), hTitle.c_str(),nbOfSlots,0.5,slotMax,nbOfFt,-0.5,ftMax);
+  defineAxisTitle(summary.NbOddPerFEB,0);
+  sc= sc && OddFEBsDebugGroup.regHist(summary.NbOddPerFEB);
+
+  // Book yield of odd events per FEB
+  hName = partitionName + "FeedthroughStatusOddChannels";
+  hTitle = partitionName + " : prop. of odd events per FEB " + suffix;
+  summary.YieldPerFEB = TH2F_LW::create(hName.c_str(), hTitle.c_str(),nbOfSlots,0.5,slotMax,nbOfFt,-0.5,ftMax);
+  defineAxisTitle(summary.YieldPerFEB,0);
+  sc = sc && OddFEBsShiftGroup.regHist(summary.YieldPerFEB);
+
+  // Book the nb of monitored cell per FEB
+  hName = partitionName + "FeedthroughCellCounting";
+  hTitle = partitionName + " : nb of monitored cells (with available pedestal/noise)";
+  summary.CellNbPerSlot = TH2I_LW::create(hName.c_str(), hTitle.c_str(),nbOfSlots,0.5,slotMax,nbOfFt,-0.5,ftMax);
+  defineAxisTitle(summary.CellNbPerSlot,0);
+  sc = sc && cellNumberGroup.regHist(summary.CellNbPerSlot);
+
+  // Book yield of odd channels per events
+  hName = partitionName + "YieldPerEvent";
+  hTitle = partitionName + " : odd channels yield per event " + suffix;
+//  if (m_oddnessThreshold == 3 && m_posNeg == 0) hTitle = hTitle + " (Gauss : 0.27% exp.)";
+//  if (m_oddnessThreshold == 4 && m_posNeg == 0) hTitle = hTitle + " (Gauss : 0.063% exp.)";
+//  if (m_oddnessThreshold == 3 && m_posNeg != 0) hTitle = hTitle + " (Gauss : 0.14% exp.)";
+//  if (m_oddnessThreshold == 4 && m_posNeg != 0) hTitle = hTitle + " (Gauss : 0.032% exp.)";
+  summary.YieldPerEvent = TH1D_LW::create(hName.c_str(), hTitle.c_str(),500,-0.2,2.3);
+  sc = sc && generalGroup.regHist(summary.YieldPerEvent);
+
+  // Book yield of odd channels per events
+  hName = partitionName + "YieldPerEventCleanQ";
+  hTitle = partitionName + " : odd channels yield per event (No Q factor burst)" + suffix;
+//  if (m_oddnessThreshold == 3 && m_posNeg == 0) hTitle = hTitle + " (Gauss : 0.27% exp.)";
+//  if (m_oddnessThreshold == 4 && m_posNeg == 0) hTitle = hTitle + " (Gauss : 0.063% exp.)";
+//  if (m_oddnessThreshold == 3 && m_posNeg != 0) hTitle = hTitle + " (Gauss : 0.14% exp.)";
+//  if (m_oddnessThreshold == 4 && m_posNeg != 0) hTitle = hTitle + " (Gauss : 0.032% exp.)";
+  summary.YieldPerEventCleanQ = TH1D_LW::create(hName.c_str(), hTitle.c_str(),500,-0.2,2.3);
+  sc = sc && generalGroup.regHist(summary.YieldPerEventCleanQ);
+
+  // Book histogram of time of bursty events
+  hName = partitionName + "TimeBurstyEvents";
+  hTitle = partitionName + " : time of bursty events (yield of channels > " + format("%.1f",m_burstyThreshold) + "%) ";
+  summary.TimeBursty = TH1I_LW::create(hName.c_str(), hTitle.c_str(),1440,0,1440);
+  for (int iLab = 1; iLab < 24 ; iLab++){
+    int label = iLab * 60;
+    (summary.TimeBursty->GetXaxis())->SetBinLabel(label,Form("%.0d",iLab));
+    //Not supported in LWHists: (summary.TimeBursty->GetXaxis())->SetTickLength(0);
+    (summary.TimeBursty->GetXaxis())->SetTitle("UTC");
+  }
+  sc = sc && generalGroup.regHist(summary.TimeBursty);
+
+  // Book coh noise per FEB
+  hName = partitionName + "oddSumsNb";
+  hTitle = partitionName + " : nb of odd sums over 128 ch. of  FEB " + suffix;
+  summary.NbOddSumPerFEB = TH2I_LW::create(hName.c_str(), hTitle.c_str(),nbOfSlots,0.5,slotMax,nbOfFt,-0.5,ftMax);
+  defineAxisTitle(summary.NbOddSumPerFEB,0);
+  sc = sc && OddSumFEBsDebugGroup.regHist(summary.NbOddSumPerFEB);
+
+  hName = partitionName + "oddSumsYield";
+  hTitle = partitionName + " : prop. of odd sums over 128 ch. of  FEB " + suffix;
+  summary.YieldSumPerFEB = TH2F_LW::create(hName.c_str(), hTitle.c_str(),nbOfSlots,0.5,slotMax,nbOfFt,-0.5,ftMax);
+  defineAxisTitle(summary.YieldSumPerFEB,0);
+  sc = sc && OddSumFEBsShiftGroup.regHist(summary.YieldSumPerFEB);
+
+  // Book histogram of proportion of bursty events
+  // 0=ok 1=ADC burst 2=LArNoisyRO alg 3=1+2
+  hName = partitionName + "BurstStatus";
+  hTitle = partitionName + " : BurstStatus";
+  summary.BurstStatus = TH1I_LW::create(hName.c_str(), hTitle.c_str(),4,-0.5,3.5);
+  (summary.BurstStatus->GetXaxis())->SetBinLabel(1,"No burst");
+  (summary.BurstStatus->GetXaxis())->SetBinLabel(2,"ADC");
+  (summary.BurstStatus->GetXaxis())->SetBinLabel(3,"Q factor");
+  (summary.BurstStatus->GetXaxis())->SetBinLabel(4,"ADC + q factor");
+  (summary.BurstStatus->GetXaxis())->SetTitle("UTC");
+  sc = sc && generalGroup.regHist(summary.BurstStatus);
+
+  if (sc.isFailure()) {
+    msg(MSG::ERROR) << "BookPerPartition failed" << endreq;
+  }
+
+  return;
+}
+
+//********************************************************************
+void LArOddCellsMonTool::defineAxisTitle(LWHist2D* hist,int typeH)
+{
+  switch (typeH){
+  case 0:  
+    (m_strHelper->definePartitionSummProp(hist)).ignore();
+    break;
+  case 3:  
+    (m_strHelper->definePartitionSummProp2(hist)).ignore();
+    break;
+  }
+  return;
+}
+
+//********************************************************************
+void LArOddCellsMonTool::copyChanYield(feedthroughInfo ftInfo)
+{
+  // partitionNb = 0 : EMBC / 1 : EMBA / 2 : EndcapC / 3 : EndcapA 
+  int partitionNb = ftInfo.barrel_ec*2 + ftInfo.pos_neg;
+  double tmp_cont, tmp_err;
+
+  switch(partitionNb){
+  case 0:
+    for (int iSlot = 1;iSlot < 15; iSlot++){
+      int iSFT = ftInfo.feedthrough*14+iSlot;
+      for (int iCh = 0; iCh<128;iCh++){
+	ftInfo.YieldPerChan->GetBinContentAndError(iSlot,iCh+1,tmp_cont,tmp_err);
+	m_barrelCSummary.YieldPerChan->SetBinContentAndError(iSFT,iCh+1,tmp_cont,tmp_err);
+      }
+    }   
+    break;
+  case 1:
+    for (int iSlot = 1;iSlot < 15; iSlot++){
+      int iSFT = ftInfo.feedthrough*14+iSlot;
+      for (int iCh = 0; iCh<128;iCh++){
+	ftInfo.YieldPerChan->GetBinContentAndError(iSlot,iCh+1,tmp_cont,tmp_err);
+	m_barrelASummary.YieldPerChan->SetBinContentAndError(iSFT,iCh+1,tmp_cont,tmp_err);
+      }
+    }    
+    break;
+  case 2:
+    for (int iSlot = 1;iSlot < 16; iSlot++){
+      int iSFT = ftInfo.feedthrough*15+iSlot;
+      
+      for (int iCh = 0; iCh<128;iCh++){
+	ftInfo.YieldPerChan->GetBinContentAndError(iSlot,iCh+1,tmp_cont,tmp_err);
+	m_endcapCSummary.YieldPerChan->SetBinContentAndError(iSFT,iCh+1,tmp_cont,tmp_err);
+
+	if (m_detailEndCap){
+	  // FCAL
+	  if ( ftInfo.feedthrough == 6 ){
+	    m_fcalCSummary.YieldPerChan->SetBinContentAndError(iSFT,iCh+1,tmp_cont,tmp_err);
+	  }
+	  // HEC
+	  else if ((ftInfo.feedthrough == 3 || ftInfo.feedthrough == 10 || ftInfo.feedthrough == 16 || ftInfo.feedthrough == 22) && (iSlot > 2)){
+	    m_hecCSummary.YieldPerChan->SetBinContentAndError(iSFT,iCh+1,tmp_cont,tmp_err);
+	  } 
+	  //EMEC
+	  else{
+	    m_emecCSummary.YieldPerChan->SetBinContentAndError(iSFT,iCh+1,tmp_cont,tmp_err);
+	  } 
+	}
+      }
+    }
+    break;
+  case 3:
+    for (int iSlot = 1;iSlot < 16; iSlot++){
+      int iSFT = ftInfo.feedthrough*15+iSlot;
+      for (int iCh = 0; iCh<128;iCh++){
+	ftInfo.YieldPerChan->GetBinContentAndError(iSlot,iCh+1,tmp_cont,tmp_err);
+	m_endcapASummary.YieldPerChan->SetBinContentAndError(iSFT,iCh+1,tmp_cont,tmp_err);
+	if (m_detailEndCap){
+	  // FCAL
+	  if ( ftInfo.feedthrough == 6 ){
+	    m_fcalASummary.YieldPerChan->SetBinContentAndError(iSFT,iCh+1,tmp_cont,tmp_err);
+	  }
+	  // HEC
+	  else if ((ftInfo.feedthrough == 3 || ftInfo.feedthrough == 10 || ftInfo.feedthrough == 16 || ftInfo.feedthrough == 22) && (iSlot > 2)){
+	    m_hecASummary.YieldPerChan->SetBinContentAndError(iSFT,iCh+1,tmp_cont,tmp_err);
+	  } 
+	  //EMEC
+	  else{
+	    m_emecASummary.YieldPerChan->SetBinContentAndError(iSFT,iCh+1,tmp_cont,tmp_err);
+	  } 
+	}
+      }
+    }    
+    break;
+  }
+
+  return;
+}
+
+//********************************************************************
+void LArOddCellsMonTool::fillYieldPerEvent(summaryHistos& summaryPart,double yieldEvent,int typeOfBursty)
+{
+  msg(MSG::DEBUG) << "In fillYieldPerEvent " << yieldEvent << endreq ;
+  summaryPart.YieldPerEvent->Fill(yieldEvent);
+  if (typeOfBursty==0 || typeOfBursty==1)summaryPart.YieldPerEventCleanQ->Fill(yieldEvent);
+  if (typeOfBursty != 0) m_eventToBeStored = true;
+  if (typeOfBursty == 1 || typeOfBursty == 3){
+    msg(MSG::DEBUG) << "This is bursty " << endreq ;
+    summaryPart.TimeBursty->Fill(m_evtTime);
+    // Retrieve event info to get event time, event number, trigger type...
+//    EventID *thisEvent;
+//    const EventInfo* thisEventInfo;
+//    StatusCode sc = evtStore()->retrieve(thisEventInfo);    
+//    if (sc!=StatusCode::SUCCESS)
+//      msg(MSG::WARNING) << "No EventInfo object found! Can't read run number!" << endreq;
+//    else{
+//      thisEvent=thisEventInfo->event_ID();
+//      int Offset = thisEvent->time_stamp()/(24*3600); 
+//      float runningTime = float(thisEvent->time_stamp() - (Offset*24*3600))/60;
+//      summaryPart.TimeBursty->Fill(runningTime);
+//    }
+//    msg(MSG::DEBUG) << "This was bursty " << endreq ;
+  }
+  
+  summaryPart.BurstStatus->Fill(typeOfBursty);
+    
+  return;
+}
+
+//********************************************************************
+void LArOddCellsMonTool::fillSumPerFEBHistos(feedthroughInfo& ftInfo)
+{
+  const unsigned nx(ftInfo.hTempSumComput->GetNbinsX());
+  const unsigned ny(ftInfo.hTempSumComput->GetNbinsY());
+  for (unsigned iSlot=1;iSlot<=nx;++iSlot){
+    for (unsigned iSample=1;iSample<=ny;++iSample){
+      if (fabs(ftInfo.hTempSumComput->GetBinContent(iSlot-1,iSample-1))>m_oddnessThreshold*ftInfo.hReferenceCool_sum2->GetBinContent(iSlot)){
+	// no detailedEndcap : partitionNb = 0 : EMBC / 1 : EMBA / 2 : EndcapC / 3 : EndcapA 
+	// detailedEndcap :    partitionNb = 0 : EMBC / 1 : EMBA / 2 : EMECC / 3 : EMECA / 4 : HECC / 5 : HECA / 6 : FCALC / 7 : FCALA
+	int partitionNb = ftInfo.barrel_ec*2+ftInfo.pos_neg;
+	if (m_detailEndCap && ftInfo.barrel_ec  == 1){
+	  if ((ftInfo.feedthrough == 3 || ftInfo.feedthrough == 10 || ftInfo.feedthrough == 16 || ftInfo.feedthrough == 22) && (iSlot > 2)) partitionNb = ftInfo.barrel_ec*2+ftInfo.pos_neg + 2; // This is HEC FEB
+	  if (ftInfo.feedthrough == 6) partitionNb = ftInfo.barrel_ec*2+ftInfo.pos_neg + 4; // This is FCAL FEB
+	}
+	switch (partitionNb){
+	case 0:
+	  m_barrelCSummary.NbOddSumPerFEB->Fill(iSlot,ftInfo.feedthrough,1);
+	  break;
+	case 1:
+	  m_barrelASummary.NbOddSumPerFEB->Fill(iSlot,ftInfo.feedthrough,1);
+	  break;
+	case 2:
+	case 4:
+	case 6:
+	  m_endcapCSummary.NbOddSumPerFEB->Fill(iSlot,ftInfo.feedthrough,1);
+	  if (m_detailEndCap){
+	    if (partitionNb == 2) m_emecCSummary.NbOddSumPerFEB->Fill(iSlot,ftInfo.feedthrough,1);
+	    if (partitionNb == 4) m_hecCSummary.NbOddSumPerFEB->Fill(iSlot,ftInfo.feedthrough,1);
+	    if (partitionNb == 6) m_fcalCSummary.NbOddSumPerFEB->Fill(iSlot,ftInfo.feedthrough,1);
+	  }
+	  break;
+	case 3:
+	case 5:
+	case 7:
+	  m_endcapASummary.NbOddSumPerFEB->Fill(iSlot,ftInfo.feedthrough,1);
+	  if (m_detailEndCap){
+	    if (partitionNb == 3) m_emecASummary.NbOddSumPerFEB->Fill(iSlot,ftInfo.feedthrough,1);
+	    if (partitionNb == 5) m_hecASummary.NbOddSumPerFEB->Fill(iSlot,ftInfo.feedthrough,1);
+	    if (partitionNb == 7) m_fcalASummary.NbOddSumPerFEB->Fill(iSlot,ftInfo.feedthrough,1);
+	  }
+	  break;
+	}
+      }
+    }
+  }
+
+  return;
+}
+
+//********************************************************************
+void LArOddCellsMonTool::deregisterHisto(LWHist* hist)
+{
+  if (hist){
+    (deregHist(hist)).ignore();
+    LWHist::safeDelete(hist);
+  }
+}
+
+
+
+
+LArOddCellsMonTool::summaryHistos::summaryHistos()
+  : YieldPerChan(0),
+    NbOddPerFEB(0),
+    YieldPerFEB(0),
+    NbOddSumPerFEB(0),
+    YieldSumPerFEB(0),
+    YieldPerEvent(0),
+    YieldPerEventCleanQ(0),
+    TimeBursty(0),
+    BurstStatus(0),
+    CellNbPerSlot(0)
+{
+}
diff --git a/LArCalorimeter/LArMonitoring/src/LArOnlineIDStrHelper.cxx b/LArCalorimeter/LArMonitoring/src/LArOnlineIDStrHelper.cxx
new file mode 100755
index 00000000000..ca66e8cf717
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/src/LArOnlineIDStrHelper.cxx
@@ -0,0 +1,751 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// ********************************************************************
+//
+// NAME:     LArOnlineIDStrHelper.cxx
+// PACKAGE:  LArMonitoring
+// AUTHOR:   Michel Lefebvre
+//
+// Simple helper that returns string to describe FT/FEB in different styles
+// and provides uniform ways to label histograms with FT/FEB names
+//
+// ********************************************************************
+
+#include "Identifier/IdentifierHash.h"
+#include "LArIdentifier/LArOnlineID.h"
+
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+#include "boost/io/ios_state.hpp"
+
+#include "LArMonitoring/LArOnlineIDStrHelper.h"
+#include "TAxis.h"
+#include "TH2.h"
+
+#include "boost/io/ios_state.hpp"
+
+/*---------------------------------------------------------*/
+LArOnlineIDStrHelper::LArOnlineIDStrHelper(const LArOnlineID* pLArOnlineIDHelper, 
+                                           NameType defaultNameType)
+{
+  // keep the LArOnlineIDHelper pointer
+  m_LArOnlineIDHelper = pLArOnlineIDHelper;
+
+  // set default name type
+  this->setDefaultNameType(defaultNameType);
+
+  // fill feedthrough experts names vector
+  this->fillFeedthroughExpertsNames();
+
+  // fill feb experts names vectors
+  this->fillFebExpertsNames();
+
+  // fill feedthrough HWId map, keyed by feedthrough names (all upper case)
+  this->fillFeedthroughHWIds();
+
+  // fill feb HWId map, keyed by feb names (all upper case)
+  this->fillFebHWIds();
+}
+
+/*---------------------------------------------------------*/
+LArOnlineIDStrHelper::~LArOnlineIDStrHelper()
+{
+}
+
+/*---------------------------------------------------------*/
+void 
+LArOnlineIDStrHelper::setDefaultNameType(NameType defaultNameType)
+{
+  // set default name type
+  // if not valid, use EXPERT as default of defaults
+  if (defaultNameType <= DEFAULT || defaultNameType >= BEYONDLASTNAMETYPE) {
+    m_defaultNameType = EXPERTS;  // default of defaults!
+  } else {
+    m_defaultNameType = defaultNameType;
+  }
+}
+
+/*---------------------------------------------------------*/
+std::string 
+LArOnlineIDStrHelper::nameType_str(NameType nameType)
+{
+  // get name type string
+  NameType type = (nameType <= DEFAULT || nameType >= BEYONDLASTNAMETYPE) ? m_defaultNameType : nameType;
+  std::string outStr = "";
+  if        (type == EXPERTS) {
+    outStr =        "EXPERTS";
+  } else if (type == EXPERTSCOMPACT) {
+    outStr =        "EXPERTSCOMPACT";
+  } else if (type == LARONLINEID) {
+    outStr =        "LARONLINEID";
+  } else if (type == LARONLINEIDCOMPACT) {
+    outStr        = "LARONLINEIDCOMPACT";
+  }
+  return outStr;
+}
+
+/*---------------------------------------------------------*/
+std::string
+LArOnlineIDStrHelper::cryostatEnd_str(HWIdentifier id,
+                                      NameType nameType)
+{
+  // return a string for the cryostatEnd
+
+  // get the name type
+  NameType type = (nameType <= DEFAULT || nameType >= BEYONDLASTNAMETYPE) ? m_defaultNameType : nameType;
+
+  std::string outStr = "";
+  if (type == EXPERTS || type == LARONLINEID) {
+    bool sideA = (bool)m_LArOnlineIDHelper->pos_neg(id);
+    if (m_LArOnlineIDHelper->isEmBarrelOnline(id)) {
+      outStr = sideA ? "BarrelA" : "BarrelC";
+    } else if (m_LArOnlineIDHelper->isEndcapOnline(id)) {
+      outStr = sideA ? "EndcapA" : "EndcapC";
+    }
+  } else if (type == EXPERTSCOMPACT) {
+    bool sideA = (bool)m_LArOnlineIDHelper->pos_neg(id);
+    if (m_LArOnlineIDHelper->isEmBarrelOnline(id)) {
+      outStr = sideA ? "EMA" : "EMC";
+    } else if (m_LArOnlineIDHelper->isEndcapOnline(id)) {
+      outStr = sideA ? "ECA" : "ECC";
+    }
+  } else if (type == LARONLINEIDCOMPACT) {
+    IdContext cryostatEndC = m_LArOnlineIDHelper->cryostatEndContext();
+    outStr = m_LArOnlineIDHelper->show_to_string(id, &cryostatEndC);
+  }
+
+  return outStr;
+}
+
+/*---------------------------------------------------------*/
+std::string
+LArOnlineIDStrHelper::feedthrough_str(HWIdentifier id, 
+                                      NameType nameType,
+                                      bool noSpaces) 
+{
+  // return a string for a feedthrough
+
+  // get the name type
+  NameType type = (nameType <= DEFAULT || nameType >= BEYONDLASTNAMETYPE) ? m_defaultNameType : nameType;
+
+  if (type == LARONLINEIDCOMPACT) {
+    IdContext feedthroughC = m_LArOnlineIDHelper->feedthroughContext();
+    return m_LArOnlineIDHelper->show_to_string(id, &feedthroughC);
+  }
+
+  // get the cryostatEnd part
+  std::string outStr = this->cryostatEnd_str(id, nameType);
+
+  if (type == EXPERTS) {
+    HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(id);
+    IdentifierHash feedthroughHash = m_LArOnlineIDHelper->feedthrough_Hash(feedthroughID);
+    std::string s = (noSpaces) ? "" : " ";
+    outStr += s + "FT" + m_feedthroughExpertsNames[feedthroughHash];
+  } else if (type == EXPERTSCOMPACT) {
+    HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(id);
+    IdentifierHash feedthroughHash = m_LArOnlineIDHelper->feedthrough_Hash(feedthroughID);
+    outStr += m_feedthroughExpertsNames[feedthroughHash];
+  } else if (type == LARONLINEID) {
+    std::string s = (noSpaces) ? "" : " ";
+    outStr += s + "FT" + this->int_to_str(m_LArOnlineIDHelper->feedthrough(id), 2, true);
+  }
+
+  return outStr;
+}
+
+/*---------------------------------------------------------*/
+std::string
+LArOnlineIDStrHelper::feedthroughOnly_str(HWIdentifier id, 
+                                          NameType nameType)
+{
+  // return a string for a feedthrough only
+
+  // get the name type
+  NameType type = (nameType <= DEFAULT || nameType >= BEYONDLASTNAMETYPE) ? m_defaultNameType : nameType;
+
+  std::string outStr = "";
+
+  if (type == EXPERTS || type == EXPERTSCOMPACT) {
+    HWIdentifier feedthroughID = m_LArOnlineIDHelper->feedthrough_Id(id);
+    IdentifierHash feedthroughHash = m_LArOnlineIDHelper->feedthrough_Hash(feedthroughID);
+    outStr = m_feedthroughExpertsNames[feedthroughHash];
+  } else if (type == LARONLINEID || type == LARONLINEIDCOMPACT) {
+    outStr = this->int_to_str(m_LArOnlineIDHelper->feedthrough(id), 2, true);
+  }
+
+  return outStr;
+}
+
+/*---------------------------------------------------------*/
+std::string
+LArOnlineIDStrHelper::feb_str(HWIdentifier id,
+                              NameType nameType,
+                              bool noSpaces) 
+{
+  // return a string for a feb
+
+  // get the name type
+  NameType type = (nameType <= DEFAULT || nameType >= BEYONDLASTNAMETYPE) ? m_defaultNameType : nameType;
+
+  if (type == LARONLINEIDCOMPACT) {
+    IdContext febC = m_LArOnlineIDHelper->febContext();
+    return m_LArOnlineIDHelper->show_to_string(id, &febC);
+  }
+
+  // get the cryostatEnd and feedthrough part
+  std::string outStr = this->feedthrough_str(id, nameType, noSpaces);
+
+  if (type == EXPERTS) {
+    HWIdentifier febID = m_LArOnlineIDHelper->feb_Id(id);
+    IdentifierHash febHash = m_LArOnlineIDHelper->feb_Hash(febID);
+    std::string s = (noSpaces) ? "" : " ";
+    outStr += s + m_febExpertsNames[febHash];
+  } else if (type == EXPERTSCOMPACT) {
+    HWIdentifier febID = m_LArOnlineIDHelper->feb_Id(id);
+    IdentifierHash febHash = m_LArOnlineIDHelper->feb_Hash(febID);
+    outStr += m_febExpertsCompactNames[febHash];
+  } else if (type == LARONLINEID) {
+    std::string s = (noSpaces) ? "" : " ";
+    outStr += s + "Slot" + this->int_to_str(m_LArOnlineIDHelper->slot(id), 2, true);
+  }
+ 
+  return outStr;
+}
+
+/*---------------------------------------------------------*/
+std::string
+LArOnlineIDStrHelper::febOnly_str(HWIdentifier id,
+                                  NameType nameType)
+{
+  // return a string for a feb only
+
+  // get the name type
+  NameType type = (nameType <= DEFAULT || nameType >= BEYONDLASTNAMETYPE) ? m_defaultNameType : nameType;
+
+  std::string outStr = "";
+
+  if (type == EXPERTS) {
+    HWIdentifier febID = m_LArOnlineIDHelper->feb_Id(id);
+    IdentifierHash febHash = m_LArOnlineIDHelper->feb_Hash(febID);
+    outStr = m_febExpertsNames[febHash];
+  } else if (type == EXPERTSCOMPACT) {
+    HWIdentifier febID = m_LArOnlineIDHelper->feb_Id(id);
+    IdentifierHash febHash = m_LArOnlineIDHelper->feb_Hash(febID);
+    outStr = m_febExpertsCompactNames[febHash];
+  } else if (type == LARONLINEID || type == LARONLINEIDCOMPACT) {
+    outStr = this->int_to_str(m_LArOnlineIDHelper->slot(id), 2, true);
+  }
+ 
+  return outStr;
+}
+
+/*---------------------------------------------------------*/
+std::string
+LArOnlineIDStrHelper::channel_str(HWIdentifier id,
+                                  NameType nameType,
+                                  bool noSpaces) 
+{
+  // return a string for a channel
+
+  // get the name type
+  NameType type = (nameType <= DEFAULT || nameType >= BEYONDLASTNAMETYPE) ? m_defaultNameType : nameType;
+
+  if (type == LARONLINEIDCOMPACT) {
+    IdContext channelC = m_LArOnlineIDHelper->channelContext();
+    return m_LArOnlineIDHelper->show_to_string(id, &channelC);
+  }
+
+  // get the cryostatEnd, feedthrough and feb part
+  std::string outStr = this->feb_str(id, nameType, noSpaces);
+
+  if (type == EXPERTS || type == LARONLINEID) {
+    std::string s = (noSpaces) ? "" : " ";
+    outStr += s + "Channel" + this->int_to_str(m_LArOnlineIDHelper->channel(id), 3, true);
+  } else if (type == EXPERTSCOMPACT) {
+    outStr += "Ch" + this->int_to_str(m_LArOnlineIDHelper->channel(id), 3, true);
+  }
+
+  return outStr;
+}
+
+/*---------------------------------------------------------*/
+HWIdentifier
+LArOnlineIDStrHelper::feedthrough_id(const std::string& feedthroughName)
+{
+  // get feedthrough HWId from feedthrough name (case insensitive)
+  std::map<std::string, HWIdentifier>::iterator iFeed = m_feedthroughHWIds.find(this->str_to_upper(feedthroughName));
+  if (iFeed != m_feedthroughHWIds.end()) return iFeed->second;
+  // invalid name, returns an invalid id
+  HWIdentifier idInvalid;
+  idInvalid.clear();
+  return idInvalid;
+}
+
+/*---------------------------------------------------------*/
+HWIdentifier
+LArOnlineIDStrHelper::feb_id(const std::string& febName)
+{
+  // get feb HWId from feb name (case insensitive)
+  std::map<std::string, HWIdentifier>::iterator iFeb = m_febHWIds.find(this->str_to_upper(febName));
+  if (iFeb != m_febHWIds.end()) return iFeb->second;
+  // invalid name, returns an invalid id
+  HWIdentifier idInvalid;
+  idInvalid.clear();
+  return idInvalid;
+}
+
+/*---------------------------------------------------------*/
+void
+LArOnlineIDStrHelper::fillFeedthroughExpertsNames()
+{
+  // feedthrough experts names (based on baseplane numbers) vector
+  // From ATL-AP-IN-0003, Numberings for the Barrel Feedthroughs
+
+  // Barrel A and C feedthrough experts names
+  // indexed by feedthrough number (which starts at 0)
+  std::vector<std::string> ftBarrelA, ftBarrelC;
+  ftBarrelA.resize(32);     ftBarrelC.resize(32); 
+  ftBarrelA[0]  = "01L";    ftBarrelC[0]  = "09L";
+  ftBarrelA[1]  = "02R";    ftBarrelC[1]  = "08R";
+  ftBarrelA[2]  = "02L";    ftBarrelC[2]  = "08L";
+  ftBarrelA[3]  = "03R";    ftBarrelC[3]  = "07R";
+  ftBarrelA[4]  = "03L";    ftBarrelC[4]  = "07L";
+  ftBarrelA[5]  = "04R";    ftBarrelC[5]  = "06R";
+  ftBarrelA[6]  = "04L";    ftBarrelC[6]  = "06L";
+  ftBarrelA[7]  = "05R";    ftBarrelC[7]  = "05R";
+  ftBarrelA[8]  = "05L";    ftBarrelC[8]  = "05L";
+  ftBarrelA[9]  = "06R";    ftBarrelC[9]  = "04R";
+  ftBarrelA[10] = "06L";    ftBarrelC[10] = "04L";
+  ftBarrelA[11] = "07R";    ftBarrelC[11] = "03R";
+  ftBarrelA[12] = "07L";    ftBarrelC[12] = "03L";
+  ftBarrelA[13] = "08R";    ftBarrelC[13] = "02R";
+  ftBarrelA[14] = "08L";    ftBarrelC[14] = "02L";
+  ftBarrelA[15] = "09R";    ftBarrelC[15] = "01R";
+  ftBarrelA[16] = "09L";    ftBarrelC[16] = "01L";
+  ftBarrelA[17] = "10R";    ftBarrelC[17] = "16R";
+  ftBarrelA[18] = "10L";    ftBarrelC[18] = "16L";
+  ftBarrelA[19] = "11R";    ftBarrelC[19] = "15R";
+  ftBarrelA[20] = "11L";    ftBarrelC[20] = "15L";
+  ftBarrelA[21] = "12R";    ftBarrelC[21] = "14R";
+  ftBarrelA[22] = "12L";    ftBarrelC[22] = "14L";
+  ftBarrelA[23] = "13R";    ftBarrelC[23] = "13R";
+  ftBarrelA[24] = "13L";    ftBarrelC[24] = "13L";
+  ftBarrelA[25] = "14R";    ftBarrelC[25] = "12R";
+  ftBarrelA[26] = "14L";    ftBarrelC[26] = "12L";
+  ftBarrelA[27] = "15R";    ftBarrelC[27] = "11R";
+  ftBarrelA[28] = "15L";    ftBarrelC[28] = "11L";
+  ftBarrelA[29] = "16R";    ftBarrelC[29] = "10R";
+  ftBarrelA[30] = "16L";    ftBarrelC[30] = "10L";
+  ftBarrelA[31] = "01R";    ftBarrelC[31] = "09R";
+  
+  // Endcap A and C feedthrough experts names, indexed by feedthrough number
+  std::vector<std::string> ftEndcapA, ftEndcapC;
+  ftEndcapA.resize(25);     ftEndcapC.resize(25); 
+  ftEndcapA[0]  = "01R";    ftEndcapC[0]  = "07R";
+  ftEndcapA[1]  = "01L";    ftEndcapC[1]  = "07L";
+  ftEndcapA[2]  = "02R";    ftEndcapC[2]  = "06R";
+  ftEndcapA[3]  = "02L";    ftEndcapC[3]  = "06L";
+  ftEndcapA[4]  = "03R";    ftEndcapC[4]  = "05R";
+  ftEndcapA[5]  = "03L";    ftEndcapC[5]  = "05L";
+  ftEndcapA[6]  = "04R";    ftEndcapC[6]  = "04L";  // the FCAL baseplane
+  ftEndcapA[7]  = "05R";    ftEndcapC[7]  = "03R";
+  ftEndcapA[8]  = "05L";    ftEndcapC[8]  = "03L";
+  ftEndcapA[9]  = "06R";    ftEndcapC[9]  = "02R";
+  ftEndcapA[10] = "06L";    ftEndcapC[10] = "02L";
+  ftEndcapA[11] = "07R";    ftEndcapC[11] = "01R";
+  ftEndcapA[12] = "07L";    ftEndcapC[12] = "01L";
+  ftEndcapA[13] = "08R";    ftEndcapC[13] = "13R";
+  ftEndcapA[14] = "08L";    ftEndcapC[14] = "13L";
+  ftEndcapA[15] = "09R";    ftEndcapC[15] = "12R";
+  ftEndcapA[16] = "09L";    ftEndcapC[16] = "12L";
+  ftEndcapA[17] = "10R";    ftEndcapC[17] = "11R";
+  ftEndcapA[18] = "10L";    ftEndcapC[18] = "11L";
+  ftEndcapA[19] = "11R";    ftEndcapC[19] = "10R";
+  ftEndcapA[20] = "11L";    ftEndcapC[20] = "10L";
+  ftEndcapA[21] = "12R";    ftEndcapC[21] = "09R";
+  ftEndcapA[22] = "12L";    ftEndcapC[22] = "09L";
+  ftEndcapA[23] = "13R";    ftEndcapC[23] = "08R";
+  ftEndcapA[24] = "13L";    ftEndcapC[24] = "08L";
+
+  // fill the feedthrough_hash indexed vector of feedthrough experts names
+  m_feedthroughExpertsNames.resize(m_LArOnlineIDHelper->feedthroughHashMax());
+  for (std::vector<HWIdentifier>::const_iterator p = m_LArOnlineIDHelper->feedthrough_begin();
+       p != m_LArOnlineIDHelper->feedthrough_end(); ++p) {
+    HWIdentifier feedthroughID = HWIdentifier(*p);
+    IdentifierHash feedthroughHash = m_LArOnlineIDHelper->feedthrough_Hash(feedthroughID);
+    int feedthrough = m_LArOnlineIDHelper->feedthrough(feedthroughID);
+    bool sideA = (bool)m_LArOnlineIDHelper->pos_neg(feedthroughID);
+    if (m_LArOnlineIDHelper->isEmBarrelOnline(feedthroughID)) {
+      m_feedthroughExpertsNames[feedthroughHash] = 
+        (sideA) ? ftBarrelA[feedthrough] : ftBarrelC[feedthrough];
+    } else if (m_LArOnlineIDHelper->isEndcapOnline(feedthroughID)) {
+      m_feedthroughExpertsNames[feedthroughHash] = 
+        (sideA) ? ftEndcapA[feedthrough] : ftEndcapC[feedthrough];
+    }
+  }
+}
+
+/*---------------------------------------------------------*/
+void
+LArOnlineIDStrHelper::fillFebExpertsNames()
+{
+  // feb experts names vectors
+  // inspired from ATL-A-EN-0001, Cabling of the ATLAS liquid argon calorimeters
+
+  // feb experts names for Barrel feedthroughs
+  // indexed using slotIndex = slot number - 1 (which starts at 0)
+  std::vector<std::string> febBarrel, febBarrelCompact;
+  febBarrel.resize(14);            febBarrelCompact.resize(14);            
+  febBarrel[0]  = "Presampler";    febBarrelCompact[0]  = "Ps"; // slot 1
+  febBarrel[1]  = "Front0";        febBarrelCompact[1]  = "F0";      
+  febBarrel[2]  = "Front1";        febBarrelCompact[2]  = "F1";      
+  febBarrel[3]  = "Front2";        febBarrelCompact[3]  = "F2";      
+  febBarrel[4]  = "Front3";        febBarrelCompact[4]  = "F3";      
+  febBarrel[5]  = "Front4";        febBarrelCompact[5]  = "F4";      
+  febBarrel[6]  = "Front5";        febBarrelCompact[6]  = "F5";      
+  febBarrel[7]  = "Front6";        febBarrelCompact[7]  = "F6";      
+  febBarrel[8]  = "Back0";         febBarrelCompact[8]  = "B0";       
+  febBarrel[9]  = "Back1";         febBarrelCompact[9]  = "B1";       
+  febBarrel[10] = "Middle0";       febBarrelCompact[10] = "M0";     
+  febBarrel[11] = "Middle1";       febBarrelCompact[11] = "M1";     
+  febBarrel[12] = "Middle2";       febBarrelCompact[12] = "M2";     
+  febBarrel[13] = "Middle3";       febBarrelCompact[13] = "M3";     
+
+  // feb experts names for Endcap EM Standard feedthroughs
+  // indexed using slotIndex = slot number - 1 (which starts at 0)
+  std::vector<std::string> febStd, febStdCompact;
+  febStd.resize(13);               febStdCompact.resize(13);            
+  febStd[0]  = "StdPresampler";    febStdCompact[0]  = "StdPs"; // slot 1
+  febStd[1]  = "StdFront0";        febStdCompact[1]  = "StdF0";           
+  febStd[2]  = "StdFront1";        febStdCompact[2]  = "StdF1";           
+  febStd[3]  = "StdFront2";        febStdCompact[3]  = "StdF2";           
+  febStd[4]  = "StdFront3";        febStdCompact[4]  = "StdF3";           
+  febStd[5]  = "StdFront4";        febStdCompact[5]  = "StdF4";           
+  febStd[6]  = "StdFront5";        febStdCompact[6]  = "StdF5";           
+  febStd[7]  = "StdBack0";         febStdCompact[7]  = "StdB0";            
+  febStd[8]  = "StdBack1";         febStdCompact[8]  = "StdB1";             
+  febStd[9]  = "StdMiddle0";       febStdCompact[9]  = "StdM0";           
+  febStd[10] = "StdMiddle1";       febStdCompact[10] = "StdM1";         
+  febStd[11] = "StdMiddle2";       febStdCompact[11] = "StdM2";         
+  febStd[12] = "StdMiddle3";       febStdCompact[12] = "StdM3";         
+
+  // feb experts names for Endcap EM Special feedthroughs
+  // indexed using slotIndex = slot number - 1 (which starts at 0)
+  std::vector<std::string> febSpe, febSpeCompact;
+  febSpe.resize(15);               febSpeCompact.resize(15);            
+  febSpe[0]  = "SpePresampler";    febSpeCompact[0]  = "SpePs"; // slot 1
+  febSpe[1]  = "SpeFront0";        febSpeCompact[1]  = "SpeF0";               
+  febSpe[2]  = "SpeMiddle0";       febSpeCompact[2]  = "SpeM0";              
+  febSpe[3]  = "SpeMiddle1";       febSpeCompact[3]  = "SpeM1";              
+  febSpe[4]  = "SpeFront1";        febSpeCompact[4]  = "SpeF1";               
+  febSpe[5]  = "SpeFront2";        febSpeCompact[5]  = "SpeF2";               
+  febSpe[6]  = "SpeFront3";        febSpeCompact[6]  = "SpeF3";               
+  febSpe[7]  = "SpeFront4";        febSpeCompact[7]  = "SpeF4";                
+  febSpe[8]  = "SpeBack0";         febSpeCompact[8]  = "SpeB0";                  
+  febSpe[9]  = "SpeMiddle2";       febSpeCompact[9]  = "SpeM2";              
+  febSpe[10] = "SpeMiddle3";       febSpeCompact[10] = "SpeM3";            
+  febSpe[11] = "SpeFront5";        febSpeCompact[11] = "SpeF5";             
+  febSpe[12] = "SpeBack1";         febSpeCompact[12] = "SpeB1";              
+  febSpe[13] = "SpeMiddle4";       febSpeCompact[13] = "SpeM4";   
+  febSpe[14] = "SpeMiddle5";       febSpeCompact[14] = "SpeM5"; 
+
+  // feb experts names for Endcap HEC feedthroughs
+  // indexed using slotIndex = slot number - 1 (which starts at 0)
+  std::vector<std::string> febHEC, febHECCompact;
+  febHEC.resize(10);         febHECCompact.resize(10);      
+  febHEC[0]  = "EMInner1";   febHECCompact[0]  = "EMI1";    // slot 1
+  febHEC[1]  = "EMInner2";   febHECCompact[1]  = "EMI2";    // note: slot 3 and 4 not used
+  febHEC[4]  = "HECL1";      febHECCompact[4]  = "HECL1";            
+  febHEC[5]  = "HECL2";      febHECCompact[5]  = "HECL2";             
+  febHEC[6]  = "HECM1";      febHECCompact[6]  = "HECM1";             
+  febHEC[7]  = "HECM2";      febHECCompact[7]  = "HECM2";              
+  febHEC[8]  = "HECH1";      febHECCompact[8]  = "HECH1";               
+  febHEC[9]  = "HECH2";      febHECCompact[9]  = "HECH2"; 
+             
+  // feb experts names for Endcap FCAL feedthroughs
+  // indexed using slotIndex = slot number - 1 (which starts at 0)
+  std::vector<std::string> febFCal;
+  febFCal.resize(15);
+  febFCal[0]  = "FCal100"; // slot 1              
+  febFCal[1]  = "FCal101";               
+  febFCal[2]  = "FCal102";             
+  febFCal[3]  = "FCal103";             
+  febFCal[4]  = "FCal104";               
+  febFCal[5]  = "FCal105";               
+  febFCal[6]  = "FCal106"; 
+  febFCal[7]  = "Slot08";  // note: slot 8 not used, but valid feb number!
+  febFCal[8]  = "FCal107"; 
+  febFCal[9]  = "FCal200";             
+  febFCal[10] = "FCal201";           
+  febFCal[11] = "FCal202";             
+  febFCal[12] = "FCal203";               
+  febFCal[13] = "FCal300";  
+  febFCal[14] = "FCal301";
+
+  // fill the feb_hash indexed vector of feb experts names
+  m_febExpertsNames.resize(m_LArOnlineIDHelper->febHashMax());
+  m_febExpertsCompactNames.resize(m_LArOnlineIDHelper->febHashMax());
+  for (std::vector<HWIdentifier>::const_iterator p = m_LArOnlineIDHelper->feb_begin(); 
+       p != m_LArOnlineIDHelper->feb_end(); ++p) {
+    HWIdentifier febID = HWIdentifier(*p);
+    IdentifierHash febHash = m_LArOnlineIDHelper->feb_Hash(febID);
+    int slot = m_LArOnlineIDHelper->slot(febID);  // starts at 1
+    int slotIndex = slot - 1;                     // starts at 0
+    if (m_LArOnlineIDHelper->isEmBarrelOnline(febID)) {
+      m_febExpertsNames[febHash]        = febBarrel[slotIndex];
+      m_febExpertsCompactNames[febHash] = febBarrelCompact[slotIndex];
+    } else if (m_LArOnlineIDHelper->isEmEndcapStandardOnline(febID)) {
+      m_febExpertsNames[febHash]        = febStd[slotIndex];
+      m_febExpertsCompactNames[febHash] = febStdCompact[slotIndex];
+    } else if (m_LArOnlineIDHelper->isEmEndcapSpecialOnline(febID)) {
+      m_febExpertsNames[febHash]        = febSpe[slotIndex];
+      m_febExpertsCompactNames[febHash] = febSpeCompact[slotIndex];
+    } else if (m_LArOnlineIDHelper->isHecOnlineFebId(febID)) {
+      m_febExpertsNames[febHash]        = febHEC[slotIndex];
+      m_febExpertsCompactNames[febHash] = febHECCompact[slotIndex];
+    } else if (m_LArOnlineIDHelper->isFcalOnline(febID)) {
+      m_febExpertsNames[febHash]        = febFCal[slotIndex];
+      m_febExpertsCompactNames[febHash] = febFCal[slotIndex];
+    }
+  }
+}
+
+/*---------------------------------------------------------*/
+void
+LArOnlineIDStrHelper::fillFeedthroughHWIds()
+{
+  // fill feedthrough HWId map, keyed by feedthrough names (all upper case)
+
+  for (std::vector<HWIdentifier>::const_iterator p = m_LArOnlineIDHelper->feedthrough_begin();
+       p != m_LArOnlineIDHelper->feedthrough_end(); ++p) {
+    HWIdentifier feedthroughID = HWIdentifier(*p);
+    std::string feedthroughNameUpper;
+    feedthroughNameUpper = str_to_upper(this->feedthrough_str(feedthroughID, EXPERTS));
+    m_feedthroughHWIds[feedthroughNameUpper] = feedthroughID;
+    // std::cout << this->feedthrough_str(feedthroughID, EXPERTS) << "  " << feedthroughNameUpper << std::endl;
+    feedthroughNameUpper = str_to_upper(this->feedthrough_str(feedthroughID, EXPERTSCOMPACT));
+    m_feedthroughHWIds[feedthroughNameUpper] = feedthroughID;
+    feedthroughNameUpper = str_to_upper(this->feedthrough_str(feedthroughID, LARONLINEID));
+    m_feedthroughHWIds[feedthroughNameUpper] = feedthroughID;
+    feedthroughNameUpper = str_to_upper(this->feedthrough_str(feedthroughID, LARONLINEIDCOMPACT));
+    m_feedthroughHWIds[feedthroughNameUpper] = feedthroughID;
+  }
+}
+
+/*---------------------------------------------------------*/
+void
+LArOnlineIDStrHelper::fillFebHWIds()
+{
+  // fill feb HWId map, keyed by feb names (all upper case)
+  for (std::vector<HWIdentifier>::const_iterator p = m_LArOnlineIDHelper->feb_begin(); 
+       p != m_LArOnlineIDHelper->feb_end(); ++p) {
+    HWIdentifier febID = HWIdentifier(*p);
+    std::string febNameUpper;
+    febNameUpper = str_to_upper(this->feb_str(febID, EXPERTS));
+    m_febHWIds[febNameUpper] = febID;
+    // std::cout << this->feb_str(febID, EXPERTS) << "  " << febNameUpper << std::endl;
+    febNameUpper = str_to_upper(this->feb_str(febID, EXPERTSCOMPACT));
+    m_febHWIds[febNameUpper] = febID;
+    febNameUpper = str_to_upper(this->feb_str(febID, LARONLINEID));
+    m_febHWIds[febNameUpper] = febID;
+    febNameUpper = str_to_upper(this->feb_str(febID, LARONLINEIDCOMPACT));
+    m_febHWIds[febNameUpper] = febID;
+  }
+}
+
+/*---------------------------------------------------------*/
+std::string
+LArOnlineIDStrHelper::int_to_str(int n, int width, bool leadingZeros)
+{
+  // integer to string converter
+  // width <= 0 means no setw used and no leading zeros
+
+  std::ostringstream o;
+  if (width <= 0) {
+    o << n;
+  } else {
+    if (leadingZeros) {      
+      o << std::setfill('0') << std::setw(width) << n;
+    } else {
+      o << std::setw(width) << n;
+    }
+  }
+
+  return o.str();
+}
+
+/*---------------------------------------------------------*/
+std::string
+LArOnlineIDStrHelper::str_to_upper(std::string stringToConvert)
+{
+  // convert a string to an all upper case string
+  for (unsigned int i = 0; i < stringToConvert.size(); i++) {
+    stringToConvert[i] = toupper(stringToConvert[i]);
+  }
+  return stringToConvert;
+}
+
+/*---------------------------------------------------------*/
+void
+LArOnlineIDStrHelper::setAxisBinLabelsFeedthroughs(TAxis* axis, const std::string& detector)
+{
+  // set the axis bin labels for a feedthrough axis
+  // see setAxisBinLabelsFeedthroughNames
+
+  this->setAxisBinLabelsFeedthroughNames(axis, detector, false);
+}
+
+/*---------------------------------------------------------*/
+void
+LArOnlineIDStrHelper::test()
+{
+  std::cout << "LArOnlineIDStrHelper: Default name type = "
+            << this->nameType_str(m_defaultNameType) << std::endl;
+
+  std::cout << "Feedthroughs" << std::endl;
+  std::cout << "HWId       EXPERTS  EXPERTSCOMPACT LARONLINEID   LARONLINEIDCOMPACT" << std::endl;
+  for (std::vector<HWIdentifier>::const_iterator p = m_LArOnlineIDHelper->feedthrough_begin();
+       p != m_LArOnlineIDHelper->feedthrough_end(); ++p) {
+    HWIdentifier feedthroughID = HWIdentifier(*p);
+    std::string nameEXPERTS            = this->feedthrough_str(feedthroughID, EXPERTS);
+    std::string nameEXPERTSCOMPACT     = this->feedthrough_str(feedthroughID, EXPERTSCOMPACT);
+    std::string nameLARONLINEID        = this->feedthrough_str(feedthroughID, LARONLINEID);
+    std::string nameLARONLINEIDCOMPACT = this->feedthrough_str(feedthroughID, LARONLINEIDCOMPACT);
+    std::string nameOnlyEXPERTS        = this->feedthroughOnly_str(feedthroughID, EXPERTS);
+    std::string nameOnlyLARONLINEID    = this->feedthroughOnly_str(feedthroughID, LARONLINEID);
+    HWIdentifier idEXPERTS            = this->feedthrough_id(nameEXPERTS);
+    HWIdentifier idEXPERTSCOMPACT     = this->feedthrough_id(nameEXPERTSCOMPACT);
+    HWIdentifier idLARONLINEID        = this->feedthrough_id(nameLARONLINEID);
+    HWIdentifier idLARONLINEIDCOMPACT = this->feedthrough_id(nameLARONLINEIDCOMPACT);
+    if (idEXPERTS == feedthroughID
+        && idEXPERTSCOMPACT == feedthroughID
+        && idLARONLINEID == feedthroughID
+        && idLARONLINEIDCOMPACT == feedthroughID)
+      {
+        boost::io::ios_base_all_saver coutsave (std::cout);
+      std::cout << std::setw(11) << std::left << std::hex << feedthroughID << std::dec
+                << std::setw(15) << nameEXPERTS
+                << std::setw(9)  << nameEXPERTSCOMPACT
+                << std::setw(14) << nameLARONLINEID 
+                << std::setw(13) << nameLARONLINEIDCOMPACT
+                << std::setw(4)  << nameOnlyEXPERTS 
+                << std::setw(3)  << nameOnlyLARONLINEID 
+                << std::endl;
+    } else {
+      std::cout << "Bad HWId extraction for " << nameEXPERTS << ", " << idEXPERTS << std::endl;
+    }
+  }
+
+  std::cout << "Febs" << std::endl;
+  std::cout << "HWId       EXPERTS                     EXPERTSCOMPACT   LARONLINEID           LARONLINEIDCOMPACT" << std::endl;
+  for (std::vector<HWIdentifier>::const_iterator p = m_LArOnlineIDHelper->feb_begin(); 
+       p != m_LArOnlineIDHelper->feb_end(); ++p) {
+    HWIdentifier febID = HWIdentifier(*p);
+    std::string nameEXPERTS            = this->feb_str(febID, EXPERTS);
+    std::string nameEXPERTSCOMPACT     = this->feb_str(febID, EXPERTSCOMPACT);
+    std::string nameLARONLINEID        = this->feb_str(febID, LARONLINEID);
+    std::string nameLARONLINEIDCOMPACT = this->feb_str(febID, LARONLINEIDCOMPACT);
+    std::string nameOnlyEXPERTS        = this->febOnly_str(febID, EXPERTS);
+    std::string nameOnlyEXPERTSCOMPACT = this->febOnly_str(febID, EXPERTSCOMPACT);
+    std::string nameOnlyLARONLINEID    = this->febOnly_str(febID, LARONLINEID);
+    HWIdentifier idEXPERTS            = this->feb_id(nameEXPERTS);
+    HWIdentifier idEXPERTSCOMPACT     = this->feb_id(nameEXPERTSCOMPACT);
+    HWIdentifier idLARONLINEID        = this->feb_id(nameLARONLINEID);
+    HWIdentifier idLARONLINEIDCOMPACT = this->feb_id(nameLARONLINEIDCOMPACT);
+    boost::io::ios_base_all_saver foutsave (std::cout);
+
+    if (idEXPERTS == febID
+        && idEXPERTSCOMPACT == febID
+        && idLARONLINEID == febID
+        && idLARONLINEIDCOMPACT == febID)
+      {
+        std::cout << std::setw(11) << std::left << std::hex << febID << std::dec
+                  << std::setw(28) << nameEXPERTS           
+                  << std::setw(17) << nameEXPERTSCOMPACT    
+                  << std::setw(22) << nameLARONLINEID       
+                  << std::setw(16) << nameLARONLINEIDCOMPACT
+                  << std::setw(15) << nameOnlyEXPERTS    
+                  << std::setw(8)  << nameOnlyEXPERTSCOMPACT
+                  << std::setw(3)  << nameOnlyLARONLINEID
+                  << std::endl;
+    } else {
+      std::cout << "Bad HWId extraction for " << nameEXPERTS << ", " << idEXPERTS << std::endl;
+    }
+  }
+
+  std::cout << "A few channels" << std::endl;
+//   int barrel_ec = 1;    // endcap
+//   int pos_neg = 1;      // A side
+//   int feedthrough = 6;  // start at 0; 6 is FCal
+//   int slot = 14;        // start at 1; 15 is where the FCal ID bug is
+  int barrel_ec = 0;    // barrel
+  int pos_neg = 0;      // C side
+  int feedthrough = 4;  // start at 0
+  int slot = 1;         // start at 1
+  std::vector<int> channels;
+  channels.push_back(5);
+  channels.push_back(10);
+  channels.push_back(105);
+  std::cout << "HWId       EXPERTS" << std::endl;
+  boost::io::ios_base_all_saver coutsave (std::cout); 
+ for (int j = 0; j < (int)channels.size(); ++j) {
+    HWIdentifier id = m_LArOnlineIDHelper->channel_Id(barrel_ec, pos_neg, feedthrough, slot, channels[j]);
+    std::cout << std::setw(11) << std::left << std::hex << id << std::dec
+              << this->channel_str(id, EXPERTS)         << "   "
+              << this->feb_str(id, EXPERTS)             << "   "
+              << this->feedthrough_str(id, EXPERTS)     << "   "
+              << this->cryostatEnd_str(id, EXPERTS)     << "   "
+              << "   febHash = " << m_LArOnlineIDHelper->feb_Hash(id)
+              << std::endl;
+  }
+  std::cout << "HWId       EXPERTSCOMPACT" << std::endl;
+  for (int j = 0; j < (int)channels.size(); ++j) {
+    HWIdentifier id = m_LArOnlineIDHelper->channel_Id(barrel_ec, pos_neg, feedthrough, slot, channels[j]);
+    std::cout << std::setw(11) << std::left << std::hex << id << std::dec
+              << this->channel_str(id, EXPERTSCOMPACT)         << "   "
+              << this->feb_str(id, EXPERTSCOMPACT)             << "   "
+              << this->feedthrough_str(id, EXPERTSCOMPACT)     << "   "
+              << this->cryostatEnd_str(id, EXPERTSCOMPACT)
+              << std::endl;
+  }
+  std::cout << "HWId       LARONLINEID" << std::endl;
+  for (int j = 0; j < (int)channels.size(); ++j) {
+    HWIdentifier id = m_LArOnlineIDHelper->channel_Id(barrel_ec, pos_neg, feedthrough, slot, channels[j]);
+    std::cout << std::setw(11) << std::left << std::hex << id << std::dec
+              << this->channel_str(id, LARONLINEID)         << "   "
+              << this->feb_str(id, LARONLINEID)             << "   "
+              << this->feedthrough_str(id, LARONLINEID)     << "   "
+              << this->cryostatEnd_str(id, LARONLINEID)
+              << std::endl;
+  }
+  std::cout << "HWId       LARONLINEIDCOMPACT" << std::endl;
+  for (int j = 0; j < (int)channels.size(); ++j) {
+    HWIdentifier id = m_LArOnlineIDHelper->channel_Id(barrel_ec, pos_neg, feedthrough, slot, channels[j]);
+    std::cout << std::setw(11) << std::left << std::hex << id << std::dec
+              << this->channel_str(id, LARONLINEIDCOMPACT)         << "   "
+              << this->feb_str(id, LARONLINEIDCOMPACT)             << "   "
+              << this->feedthrough_str(id, LARONLINEIDCOMPACT)     << "   "
+              << this->cryostatEnd_str(id, LARONLINEIDCOMPACT)
+              << std::endl;
+  }
+
+  std::cout << "Id searches" << std::endl;
+  std::vector<std::string> febNames;
+  febNames.push_back("banana");
+  febNames.push_back("BarrelCFT09LMiddle3");
+  febNames.push_back("BarrelCfT09Lmiddle3");
+  for (std::vector<std::string>::iterator it = febNames.begin(); it != febNames.end(); ++it) {
+    std::string febName = *it;
+    HWIdentifier febID = this->feb_id(febName);
+    if (febID.is_valid()) {
+      std::cout << febName << " has valid feb id = "   << std::hex << febID << std::dec << std::endl;
+    } else {
+      std::cout << febName << " has invalid feb id = " << std::hex << febID << std::dec << std::endl;
+    }
+  }
+
+}
+
diff --git a/LArCalorimeter/LArMonitoring/src/components/LArMonitoring_entries.cxx b/LArCalorimeter/LArMonitoring/src/components/LArMonitoring_entries.cxx
new file mode 100755
index 00000000000..51be398aede
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/src/components/LArMonitoring_entries.cxx
@@ -0,0 +1,11 @@
+#include "LArMonitoring/LArNoiseBursts.h"
+#include "LArMonitoring/LArOddCellsMonTool.h"
+#include "GaudiKernel/DeclareFactoryEntries.h"
+
+DECLARE_ALGORITHM_FACTORY(LArNoiseBursts)
+DECLARE_TOOL_FACTORY(LArOddCellsMonTool)
+
+DECLARE_FACTORY_ENTRIES(LArMonitoring) {
+  DECLARE_ALGORITHM(LArNoiseBursts)
+  DECLARE_ALGTOOL(LArOddCellsMonTool)
+}
diff --git a/LArCalorimeter/LArMonitoring/src/components/LArMonitoring_load.cxx b/LArCalorimeter/LArMonitoring/src/components/LArMonitoring_load.cxx
new file mode 100755
index 00000000000..0d5f2b8d987
--- /dev/null
+++ b/LArCalorimeter/LArMonitoring/src/components/LArMonitoring_load.cxx
@@ -0,0 +1,4 @@
+
+#include "GaudiKernel/LoadFactoryEntries.h"
+
+LOAD_FACTORY_ENTRIES(LArMonitoring)
-- 
GitLab