From 74448d1ac3abb2a29a6fe51a4fd56886fe2e044c Mon Sep 17 00:00:00 2001
From: Jordi Garra Tico <jordi.garra.tico@cern.ch>
Date: Wed, 15 Jun 2011 16:12:54 +0000
Subject: [PATCH] Panoptes release v3r4.

This tag contains the result of the command

   getpack --no-config --protocol anonymous --project --recursive --batch Panoptes v3r4

The Panoptes project was tagged as PANOPTES_v3r4 at svn release 124858.

The svn path for this commit was

   svn+ssh://svn.cern.ch/reps/lhcb/Panoptes/tags/PANOPTES/PANOPTES_v3r4

The latest comment on svn was the following:

   Panoptes release v3r4.
---
 PanoptesSys/cmt/requirements                  |  12 +-
 PanoptesSys/cmt/version.cmt                   |   2 +-
 PanoptesSys/doc/release.notes                 |   9 +-
 Rich/Panoptes/cmt/requirements                |   2 +-
 Rich/Panoptes/cmt/version.cmt                 |   2 +-
 Rich/Panoptes/doc/release.notes               |  11 +
 Rich/Panoptes/options/RichCalibMon-Common.py  |  57 ++
 Rich/Panoptes/options/RichCalibMon.py         |  90 +-
 Rich/Panoptes/options/RichCalibMon_Offline.py |  31 +
 Rich/Panoptes/options/RichDAQMon-Common.py    |  35 +-
 Rich/Panoptes/options/RichDAQMon_Offline.py   |   5 +-
 Rich/Panoptes/options/RichRingMon-Common.py   |  13 +-
 .../Panoptes/python/Panoptes/Configuration.py |  15 +-
 .../RichMirrorAlignmentGanga/cmt/requirements |   2 +-
 Rich/RichMirrorAlignmentGanga/cmt/version.cmt |   2 +-
 .../doc/release_notes.html                    |  59 +-
 ...ed-MagDownRealData91000000DST_Selv10_R1.py |  91 ++
 ...ed-MagDownRealData91000000DST_Selv10_R2.py |  93 ++
 ...2MirrCombinList_48m48c_p12p43s09s30fix.txt |  46 +
 .../job/RichMirrorAlignmentGanga.py           | 423 +++++----
 ...rrorAlignmentGanga_Collision10_settings.py |  41 +-
 ...rrorAlignmentGanga_Collision11_settings.py |   4 +-
 .../RichMirrorAlignmentGanga_MC10_settings.py |  46 +-
 .../Brunel_RichAlignMoni_Collision11-DST.py   |  51 +-
 .../Brunel_RichAlignMoni_Collision11-RAW.py   | 108 +++
 Rich/RichMonitoringSys/cmt/requirements       |   2 +-
 Rich/RichMonitoringSys/cmt/version.cmt        |   2 +-
 Rich/RichMonitoringSys/doc/release.notes      |  11 +
 .../python/RichMonitoringSys/Configuration.py | 136 +--
 .../python/RichMonitoringSys/EventSnapshot.py |   2 +-
 Rich/RichMonitoringTools/cmt/requirements     |   2 +-
 Rich/RichMonitoringTools/cmt/version.cmt      |   2 +-
 Rich/RichMonitoringTools/doc/release.notes    |  13 +
 .../src/HpdUkL1DisableTool.cpp                | 682 +++++++-------
 .../src/HpdUkL1DisableTool.h                  |  10 +-
 Rich/RichOnlineMonitors/cmt/requirements      |   4 +-
 Rich/RichOnlineMonitors/cmt/version.cmt       |   2 +-
 Rich/RichOnlineMonitors/doc/release.notes     |  32 +-
 .../src/RichCalibMonitor.cpp                  | 201 ++--
 .../RichOnlineMonitors/src/RichCalibMonitor.h |   5 +-
 .../RichOnlineMonitors/src/RichDAQMonitor.cpp | 856 +++++++++---------
 Rich/RichOnlineMonitors/src/RichDAQMonitor.h  |  15 +-
 .../src/RichHPDNHitMonitor.cpp                | 434 ++++-----
 .../src/RichHPDNHitMonitor.h                  |  33 +-
 .../src/RichSingleEventSnapshot.cpp           | 240 ++---
 .../src/RichSingleEventSnapshot.h             |  31 +-
 .../src/RichTestPatternMon.cpp                | 160 ++--
 .../src/RichTestPatternMon.h                  |   2 +
 cmt/project.cmt                               |   2 +-
 49 files changed, 2425 insertions(+), 1704 deletions(-)
 create mode 100644 Rich/Panoptes/options/RichCalibMon-Common.py
 create mode 100644 Rich/Panoptes/options/RichCalibMon_Offline.py
 create mode 100644 Rich/RichMirrorAlignmentGanga/files/LHCbCollision11Beam3500GeV-VeloClosed-MagDownRealData91000000DST_Selv10_R1.py
 create mode 100644 Rich/RichMirrorAlignmentGanga/files/LHCbCollision11Beam3500GeV-VeloClosed-MagDownRealData91000000DST_Selv10_R2.py
 create mode 100644 Rich/RichMirrorAlignmentGanga/files/Rich2MirrCombinList_48m48c_p12p43s09s30fix.txt
 create mode 100644 Rich/RichMirrorAlignmentGanga/options/Brunel_RichAlignMoni_Collision11-RAW.py

diff --git a/PanoptesSys/cmt/requirements b/PanoptesSys/cmt/requirements
index db714d86..cd3b1919 100755
--- a/PanoptesSys/cmt/requirements
+++ b/PanoptesSys/cmt/requirements
@@ -1,27 +1,27 @@
 package PanoptesSys
-version v3r3
+version v3r4
 
 branches cmt doc
 
 #
 # Panoptes application
 #
-use Panoptes            v3r2  Rich
+use Panoptes            v3r4  Rich
 
 #
 # RICH online monitoring packages
 #
-use RichMonitoringSys   v2r13 Rich
-use RichMonitoringTools v2r15 Rich
-use RichOnlineMonitors  v2r15 Rich
+use RichMonitoringSys   v2r15 Rich
+use RichMonitoringTools v2r17 Rich
+use RichOnlineMonitors  v2r17 Rich
 use RichDataMerge       v2r2  Rich
 
 #
 # RICH semi-online mirror monitoring packages
 #
-use RichMirrorAlignmentGanga v8r4  Rich
 use RichMirrCombinFit        v10r5 Rich
 use RichMirrAlign            v14r4 Rich
+use RichMirrorAlignmentGanga v8r7  Rich
 
 # Declare this as a container package
 apply_pattern container_package
diff --git a/PanoptesSys/cmt/version.cmt b/PanoptesSys/cmt/version.cmt
index 09242f0c..86b3f095 100644
--- a/PanoptesSys/cmt/version.cmt
+++ b/PanoptesSys/cmt/version.cmt
@@ -1 +1 @@
-v3r3
+v3r4
diff --git a/PanoptesSys/doc/release.notes b/PanoptesSys/doc/release.notes
index f9b2957f..2d7eb4e8 100755
--- a/PanoptesSys/doc/release.notes
+++ b/PanoptesSys/doc/release.notes
@@ -3,13 +3,16 @@ Package             : PanoptesSys
 Package Coordinator : Ulrich Kerzel
 Purpose             : LHCb RICH online monitor application
 
-</PRE><H1><A NAME=v3r0>2011-03-16 Panoptes v3r2</A></H1><PRE>
+</PRE><H1><A NAME=v3r4>2011-06-14 Panoptes v3r4</A></H1><PRE>
+This version uses  projects :  Gaudi v22r2, LHCb v32r3, Online v4r56
+
+</PRE><H1><A NAME=v3r3>2011-03-16 Panoptes v3r3</A></H1><PRE>
 This version uses  projects :  Gaudi v22r2, LHCb v32r3, Online v4r55
 
-</PRE><H1><A NAME=v3r0>2011-03-16 Panoptes v3r2</A></H1><PRE>
+</PRE><H1><A NAME=v3r2>2011-03-16 Panoptes v3r2</A></H1><PRE>
 This version uses  projects :  Gaudi v22r1, LHCb v32r1p1, Online v4r53
 
-</PRE><H1><A NAME=v3r0>2011-03-16 Panoptes v3r1</A></H1><PRE>
+</PRE><H1><A NAME=v3r1>2011-03-16 Panoptes v3r1</A></H1><PRE>
 This version uses  projects :  Gaudi v22r1, LHCb v32r1p1, Online v4r51
 
 </PRE><H1><A NAME=v3r0>2011-02-09 Panoptes v3r0</A></H1><PRE>
diff --git a/Rich/Panoptes/cmt/requirements b/Rich/Panoptes/cmt/requirements
index 6e3e4be2..95da5fb7 100755
--- a/Rich/Panoptes/cmt/requirements
+++ b/Rich/Panoptes/cmt/requirements
@@ -1,5 +1,5 @@
 package Panoptes
-version v3r2
+version v3r4
 
 branches doc cmt options
 
diff --git a/Rich/Panoptes/cmt/version.cmt b/Rich/Panoptes/cmt/version.cmt
index 1b46b7c8..86b3f095 100644
--- a/Rich/Panoptes/cmt/version.cmt
+++ b/Rich/Panoptes/cmt/version.cmt
@@ -1 +1 @@
-v3r2
+v3r4
diff --git a/Rich/Panoptes/doc/release.notes b/Rich/Panoptes/doc/release.notes
index 76fbf6c8..a46a4567 100755
--- a/Rich/Panoptes/doc/release.notes
+++ b/Rich/Panoptes/doc/release.notes
@@ -4,6 +4,17 @@
 ! Purpose : LHCb RICH online monitor application
 !----------------------------------------------------------------------------
 
+====================== v3r4 ================================================
+! 2011-05-11 - Chris Jones
+ - Remove the options disabling warnings and errors from the raw decoding.
+
+====================== v3r3 ================================================
+2011-04-05 - Jordi Garra Tic�.
+ - Removed RichMonitoringSysConf().HitMapsMon_MonFreq and
+	RichMonitoringSysConf().NHitMon_MonFreq, since they are no longer
+	allowed in the monitoring software.
+ - Changed the range of the number of hits up to 10000.
+ - Updated DB tags to something a bit more recent.
 
 ====================== v3r2 ================================================
 ! 2011-03-29 - Jordi Garra Tic�
diff --git a/Rich/Panoptes/options/RichCalibMon-Common.py b/Rich/Panoptes/options/RichCalibMon-Common.py
new file mode 100644
index 00000000..3a97a2cb
--- /dev/null
+++ b/Rich/Panoptes/options/RichCalibMon-Common.py
@@ -0,0 +1,57 @@
+
+from Panoptes.Configuration   import *
+from RichRecSys.Configuration import RichPixelCreatorConfig
+from Configurables            import Rich__HPDOccupancyTool
+
+## Reconstruction options
+RichMonitoringSysConf().RichRecCheckProcStatus          = False 
+RichMonitoringSysConf().RichRecInitPixels               = False    # RichRecPixel objects
+RichMonitoringSysConf().RichRecInitTracks               = False   # RichRecTrack objects (requires Tracking)
+RichMonitoringSysConf().RichRecInitPhotons              = False   # RichRecPixel objects (requires Tracking)
+RichMonitoringSysConf().RichRecTracklessRingAlgs        = [""]
+RichMonitoringSysConf().RichRecPidConfig                = "None"
+
+# Disable pixel cleaning when creating RichRecPixels
+RichPixelCreatorConfig().PixelCleaning = "None"
+
+# Tracking. Run our own tracking sequence
+Panoptes().UsePrivateTracking = False
+
+  # High level reconstruction (from RichRecQC)
+RichMonitoringSysConf().MonitorReconstruction = False
+RichMonitoringSysConf().MonitorPixels         = False  # Monitor reconstructed pixels
+RichMonitoringSysConf().MonitorPhoton         = False # Track based photon resolution
+RichMonitoringSysConf().MonitorPID            = False # Disable PID monitoring
+RichMonitoringSysConf().MonitorTracklessRing  = False  # Monitor the trackless ring finding
+RichMonitoringSysConf().MonitorMirrorAlign    = False # The mirror alignment monitoring
+
+# Low level DAQ monitors
+RichMonitoringSysConf().MonitorNhits            = False
+RichMonitoringSysConf().MonitorDAQ              = False
+RichMonitoringSysConf().MonitorHitMaps          = True
+RichMonitoringSysConf().MonitorIFB              = False
+
+# Hitmaps
+RichMonitoringSysConf().HitMapsMon_LowResHitMaps   = True
+RichMonitoringSysConf().HitMapsMon_HotPixEnabled   = False
+RichMonitoringSysConf().HitMapsMon_HPDCountEnabled = False
+
+# Calibration Farm monitoring
+RichMonitoringSysConf().MonitorCalibration      = True
+RichMonitoringSysConf().OutputLevelCalibration  = 1
+RichMonitoringSysConf().TestPattern             = "CornerPixels"
+
+# Event 'snapshots' sent to CAMERA
+RichMonitoringSysConf().SendEventSnapshots       = False
+#RichMonitoringSysConf().SendNHitEventSnapshots   = False # for #hit monitor
+#RichMonitoringSysConf().SendDaqEventSnapshots    = False # for DAQ monitor
+
+# TAE events
+Panoptes().RawEventLocations = [
+  # Primary event
+  ""
+  #    # Previous events (extend as needed)
+  #    ,"Prev1"
+  #    # Successive events (extend as needed)
+  #    ,"Next1"
+  ]
diff --git a/Rich/Panoptes/options/RichCalibMon.py b/Rich/Panoptes/options/RichCalibMon.py
index 32537e10..53b1e519 100644
--- a/Rich/Panoptes/options/RichCalibMon.py
+++ b/Rich/Panoptes/options/RichCalibMon.py
@@ -9,7 +9,7 @@ __author__  = "Markus Frank <Markus.Frank@cern.ch>"
 import os
 import Gaudi.Configuration as Gaudi
 import Configurables as Configs
-
+from Panoptes.Configuration import *
 
 def start(mode='Online'):
   """
@@ -17,9 +17,11 @@ def start(mode='Online'):
 
         @author M.Frank
   """
+
+  importOptions( "$PANOPTESROOT/options/RichCalibMon-Common.py" )
+
   ## Import modules
   import OnlineEnv as Online
-  from Panoptes.Configuration import *
   from RichRecSys.Configuration import RichPixelCreatorConfig
 
   #
@@ -28,9 +30,15 @@ def start(mode='Online'):
   mode            = 'Calibration'
   Panoptes().Mode = mode
 
-  #Panoptes().DDDBtag    = "head-20090731"
-  #Panoptes().CondDBtag  = "head-20091112"
-    
+  Panoptes().DDDBtag    = "head-20110302"
+  Panoptes().CondDBtag  = "head-20110512"
+
+  # Custom DB slices
+  from Configurables import CondDB, CondDBAccessSvc
+  #CondDB().addLayer( CondDBAccessSvc("NewL1Mapping",
+  #                                 ConnectionString="sqlite_file:/group/rich/DetectorNumbers20110511.db/LHCBCOND",
+  #                                 DefaultTAG="HEAD") )
+
   # override CondDBTag with the one provided by the Online environment?
   # -> n.b. only works in "online" or "calibration" mode, setting ignored otherwise
   Panoptes().UseOnlineCondDBtag              = False
@@ -38,76 +46,14 @@ def start(mode='Online'):
   # connect to ORACLE conditionsDB
   Panoptes().UseOracle                       = True
   
-  ## override with local DB slice 
-  #from Configurables import CondDB
-  #CondDB().PartitionConnectionString["LHCBCOND"] = "sqlite_file:/group/rich/sw/cmtuser/LHCBCOND-20090909.db/LHCBCOND"
-
-  partition = os.getenv('PARTITION','')
+  # partition = os.getenv('PARTITION','')
 
   # override default settings for FEST
-  if partition.upper() == 'FEST':
-    Panoptes().DDDBtag                              = "MC09-20090602"
-    Panoptes().CondDBtag                            = "sim-20090402-vc-md100"
-    Panoptes().Simulation                           = True
-
-
-  ## Reconstruction options
-  RichMonitoringSysConf().RichRecCheckProcStatus          = False 
-  RichMonitoringSysConf().RichRecInitPixels               = False    # RichRecPixel objects
-  RichMonitoringSysConf().RichRecInitTracks               = False   # RichRecTrack objects (requires Tracking)
-  RichMonitoringSysConf().RichRecInitPhotons              = False   # RichRecPixel objects (requires Tracking)
-  RichMonitoringSysConf().RichRecTracklessRingAlgs        = [""]
-  RichMonitoringSysConf().RichRecPidConfig                = "None"
-  
-  # Disable pixel cleaning when creating RichRecPixels
-  RichPixelCreatorConfig().PixelCleaning = "None"
-
-  # Tracking. Run our own tracking sequence
-  Panoptes().UsePrivateTracking = False
+#   if partition.upper() == 'FEST':
+#     Panoptes().DDDBtag                              = "MC09-20090602"
+#     Panoptes().CondDBtag                            = "sim-20090402-vc-md100"
+#     Panoptes().Simulation                           = True
 
-    # High level reconstruction (from RichRecQC)
-  RichMonitoringSysConf().MonitorReconstruction = False
-  RichMonitoringSysConf().MonitorPixels         = False  # Monitor reconstructed pixels
-  RichMonitoringSysConf().MonitorPhoton         = False # Track based photon resolution
-  RichMonitoringSysConf().MonitorPID            = False # Disable PID monitoring
-  RichMonitoringSysConf().MonitorTracklessRing  = False  # Monitor the trackless ring finding
-  RichMonitoringSysConf().MonitorMirrorAlign    = False # The mirror alignment monitoring
-
-  # Low level DAQ monitors
-  RichMonitoringSysConf().MonitorNhits            = False
-  RichMonitoringSysConf().MonitorDAQ              = False
-  RichMonitoringSysConf().MonitorHitMaps          = True
-  RichMonitoringSysConf().MonitorIFB              = False
-
-  # Hitmaps
-  RichMonitoringSysConf().HitMapsMon_LowResHitMaps   = True
-  RichMonitoringSysConf().HitMapsMon_MonFreq         = 1
-  RichMonitoringSysConf().HitMapsMon_HotPixEnabled   = False
-  RichMonitoringSysConf().HitMapsMon_HPDCountEnabled = False
-
-  # Calibration Farm monitoring
-  RichMonitoringSysConf().MonitorCalibration      = True
-  RichMonitoringSysConf().OutputLevelCalibration  = 1
-  RichMonitoringSysConf().TestPattern             = "CornerPixels"
-
-  # Event 'snapshots' sent to CAMERA
-  RichMonitoringSysConf().SendEventSnapshots       = False
-  #RichMonitoringSysConf().SendNHitEventSnapshots   = False # for #hit monitor
-  #RichMonitoringSysConf().SendDaqEventSnapshots    = False # for DAQ monitor
-
-
-
-  # TAE events
-  Panoptes().RawEventLocations = [
-    # Primary event
-    ""
-    #    # Previous events (extend as needed)
-    #    ,"Prev1"
-    #    # Successive events (extend as needed)
-    #    ,"Next1"
-    ]
-
-  
   if mode == 'Online' or mode == 'Calibration':
     Online.end_config(False)
   else:
diff --git a/Rich/Panoptes/options/RichCalibMon_Offline.py b/Rich/Panoptes/options/RichCalibMon_Offline.py
new file mode 100644
index 00000000..da36ca0c
--- /dev/null
+++ b/Rich/Panoptes/options/RichCalibMon_Offline.py
@@ -0,0 +1,31 @@
+
+from Gaudi.Configuration import *
+from Configurables import Panoptes
+from Panoptes.Configuration import *
+
+importOptions( "$PANOPTESROOT/options/RichCalibMon-Common.py" )
+
+Panoptes()     .Mode      = 'Offline'
+Panoptes()     .EvtMax    = 5000
+EventSelector().PrintFreq = 100
+
+Panoptes().SaverCycle = 6000000
+
+# # make one snapshot per second to test
+# RichMonitoringSysConf().SnapshotUpdateInterval = 1
+
+# from Configurables import RichTools
+# RichTools().rawDecoder().HotPixelsToMask = [ 4237672320, 4237914344, 4228645792, 4228722368, 4229220928 ]
+
+# TAE events - should be set automatically
+#Panoptes().RawEventLocations = [
+#    # Primary event
+#  ""
+#      # Previous events (extend as needed)
+#      ,"Prev1"
+#      # Successive events (extend as needed)
+#      ,"Next1"
+#  ]
+
+# CAMERA
+Camera().CameraServers = []
diff --git a/Rich/Panoptes/options/RichDAQMon-Common.py b/Rich/Panoptes/options/RichDAQMon-Common.py
index 4477fea0..f0e79cf6 100644
--- a/Rich/Panoptes/options/RichDAQMon-Common.py
+++ b/Rich/Panoptes/options/RichDAQMon-Common.py
@@ -3,12 +3,14 @@ from RichRecSys.Configuration import RichPixelCreatorConfig
 from Configurables            import Rich__HPDOccupancyTool
 
 #db_tag                = "default"
-Panoptes().DDDBtag    = "head-20101206"
-Panoptes().CondDBtag  = "head-20110308"
+Panoptes().DDDBtag    = "head-20110302"
+Panoptes().CondDBtag  = "head-20110524"
 
-## override with local DB slice 
-#from Configurables import CondDB
-#CondDB().PartitionConnectionString["LHCBCOND"] = "sqlite_file:/group/rich/sw/cmtuser/LHCBCOND-20090909.db/LHCBCOND"
+# Custom DB slices
+from Configurables import CondDB, CondDBAccessSvc
+#CondDB().addLayer( CondDBAccessSvc("NewL1Mapping",
+#                                   ConnectionString="sqlite_file:/group/rich/DetectorNumbers20110511.db/LHCBCOND",
+#                                   DefaultTAG="HEAD") )
 
 #
 # Reconstruction options
@@ -44,6 +46,7 @@ RichMonitoringSysConf().MonitorRaw            = False #
 #
 # Low level DAQ monitors
 #
+RichMonitoringSysConf().RawDataDBCheck          = True
 RichMonitoringSysConf().MonitorNhits            = True
 RichMonitoringSysConf().MonitorDAQ              = True 
 RichMonitoringSysConf().MonitorHitMaps          = True
@@ -60,7 +63,6 @@ RichMonitoringSysConf().DaqMon_PrintMessages    = False
 # Hitmaps
 #
 RichMonitoringSysConf().HitMapsMon_LowResHitMaps   = True
-RichMonitoringSysConf().HitMapsMon_MonFreq         = 20
 RichMonitoringSysConf().HitMapsMon_HotPixEnabled   = False
 RichMonitoringSysConf().HitMapsMon_HPDCountEnabled = False
 #
@@ -69,23 +71,22 @@ RichMonitoringSysConf().HitMapsMon_HPDCountEnabled = False
 # Tool to compute expected average occupancy per HPD
 FastAverage                                =  20
 SlowAverage                                = 500
-HPDOccupancyToolFast = Rich__HPDOccupancyTool("HPDOccupancyFast")
+HPDOccupancyToolFast = Rich__HPDOccupancyTool("ToolSvc.HPDOccupancyFast")
 HPDOccupancyToolFast.PrintXML              = False
 HPDOccupancyToolFast.UseRunningOccupancies = True
 HPDOccupancyToolFast.MemoryFactor          = FastAverage
-#HPDOccupancyToolFast.OutputLevel           = 2
+#HPDOccupancyToolFast.OutputLevel           = 1
 
-HPDOccupancyToolSlow = Rich__HPDOccupancyTool("HPDOccupancySlow")
+HPDOccupancyToolSlow = Rich__HPDOccupancyTool("ToolSvc.HPDOccupancySlow")
 HPDOccupancyToolSlow.PrintXML              = False
 HPDOccupancyToolSlow.UseRunningOccupancies = True
 HPDOccupancyToolSlow.MemoryFactor          = SlowAverage
-#HPDOccupancyToolSlow.OutputLevel           = 2
+#HPDOccupancyToolSlow.OutputLevel           = 1
 
 
-RichMonitoringSysConf().NHitMon_MonFreq            =     1
 RichMonitoringSysConf().NHitMon_RemoveFaultyHPD    = False
 RichMonitoringSysConf().NHitMon_HitThreshold       =    50  # #hits above which send disable command to UKL1
-RichMonitoringSysConf().NHitMon_HistoNHitMax       =  1000
+RichMonitoringSysConf().NHitMon_HistoNHitMax       =  10000
 RichMonitoringSysConf().NHitMon_TriggerTypes       =  [0,1,2,3,4,5,6]
 RichMonitoringSysConf().NHitMon_MovingAverageFast  = FastAverage
 RichMonitoringSysConf().NHitMon_MovingAverageSlow  = SlowAverage
@@ -94,9 +95,9 @@ RichMonitoringSysConf().NHitMon_MovingAverageSlow  = SlowAverage
 # Event 'snapshots' sent to CAMERA
 #
 RichMonitoringSysConf().SendEventSnapshots         = True
-RichMonitoringSysConf().SendNHitEventSnapshots     = False # for #hit monitor
-RichMonitoringSysConf().SendDaqEventSnapshots      = False # for DAQ monitor
-RichMonitoringSysConf().SnapshotUpdateInterval     =  99999
+RichMonitoringSysConf().SendNHitEventSnapshots     = True  # for #hit monitor
+RichMonitoringSysConf().SendDaqEventSnapshots      = True  # for DAQ monitor
+RichMonitoringSysConf().SnapshotUpdateInterval     = 99999
 RichMonitoringSysConf().SnapshotNBins              = 200
 RichMonitoringSysConf().SnapshotRingType           = "Isolated"
 
@@ -114,3 +115,7 @@ RichMonitoringSysConf().HPDDisable_2DHisto         = True
 #  # Successive events (extend as needed)
 #  ,"Next1", "Next2", "Next3"
 #  ]
+
+#from Configurables import UpdateManagerSvc
+#UpdateManagerSvc().ConditionsOverride += [ "Conditions/ReadoutConf/Rich1/DetectorNumbers := int_v InactiveHPDs = ;"]
+#UpdateManagerSvc().ConditionsOverride += [ "Conditions/ReadoutConf/Rich2/DetectorNumbers := int_v InactiveHPDs = ;"]
diff --git a/Rich/Panoptes/options/RichDAQMon_Offline.py b/Rich/Panoptes/options/RichDAQMon_Offline.py
index b2f8ebe8..ffb72a32 100644
--- a/Rich/Panoptes/options/RichDAQMon_Offline.py
+++ b/Rich/Panoptes/options/RichDAQMon_Offline.py
@@ -5,7 +5,7 @@ from Panoptes.Configuration import *
 importOptions( '$PANOPTESROOT/options/RichDAQMon-Common.py' )
 
 Panoptes().Mode       = 'Offline'
-Panoptes().EvtMax     = 5000
+Panoptes().EvtMax     = 10000
 EventSelector().PrintFreq = 100
 
 # override CondDBTag with the one provided by the Online environment?
@@ -14,8 +14,7 @@ Panoptes().UseOnlineCondDBtag              = False
 
 #Panoptes().UseMonitorSvc = True
 
-RichMonitoringSysConf().HitMapsMon_MonFreq       = 1
-Panoptes().SaverCycle                            = 6000000
+Panoptes().SaverCycle                      = 6000000
 
 # TAE events - should be set automatically
 #Panoptes().RawEventLocations = [
diff --git a/Rich/Panoptes/options/RichRingMon-Common.py b/Rich/Panoptes/options/RichRingMon-Common.py
index cd877bb0..eb43d994 100644
--- a/Rich/Panoptes/options/RichRingMon-Common.py
+++ b/Rich/Panoptes/options/RichRingMon-Common.py
@@ -2,12 +2,13 @@ from Panoptes.Configuration import *
 from RichRecSys.Configuration import RichPixelCreatorConfig
 
 #db_tag                = "default"
-#Panoptes().DDDBtag    = "head-20101206"
-#Panoptes().CondDBtag  = "head-20110308"
-
-## override with local DB slice 
-#from Configurables import CondDB
-#CondDB().PartitionConnectionString["LHCBCOND"] = "sqlite_file:/group/rich/sw/cmtuser/LHCBCOND-20090909.db/LHCBCOND"
+Panoptes().DDDBtag    = "head-20110302"
+Panoptes().CondDBtag  = "head-20110512"
+# Custom DB slices
+from Configurables import CondDB, CondDBAccessSvc
+#CondDB().addLayer( CondDBAccessSvc("NewL1Mapping",
+#                                   ConnectionString="sqlite_file:/group/rich/DetectorNumbers20110511.db/LHCBCOND",
+#                                   DefaultTAG="HEAD") )
 
 ## mask off hot pixels
 #from Configurables import RichTools
diff --git a/Rich/Panoptes/python/Panoptes/Configuration.py b/Rich/Panoptes/python/Panoptes/Configuration.py
index c99b7841..8dea42cd 100755
--- a/Rich/Panoptes/python/Panoptes/Configuration.py
+++ b/Rich/Panoptes/python/Panoptes/Configuration.py
@@ -18,7 +18,7 @@ from Configurables import ( CondDBCnvSvc, MagneticFieldSvc, OutputStream,
                             DDDBConf,
                             UpdateAndReset,
                             MessageSvc,
-                            CondDB, COOLConfSvc)
+                            CondDB, COOLConfSvc )
 
 def disableLFC():
     COOLConfSvc(UseLFCReplicaSvc = False)
@@ -178,6 +178,8 @@ class Panoptes(LHCbConfigurableUser):
     def commonConfig(self):
 
         from os import getenv
+
+        from Configurables import (ApplicationMgr,AuditorSvc,SequencerTimerTool)
                     
         mode        = self.getProp("Mode")
         partition   = self.getProp("Partition")
@@ -245,10 +247,6 @@ class Panoptes(LHCbConfigurableUser):
                 ApplicationMgr().Runable             = Online.evtRunable(mepMgr)
                 ApplicationMgr().ExtSvc.append(mepMgr)
 
-
-            
-            
-
             
         # Additional services
         ApplicationMgr().ExtSvc += [ "ToolSvc", "AuditorSvc" ]
@@ -271,9 +269,6 @@ class Panoptes(LHCbConfigurableUser):
         if len(eventLocs) > 0 :
             RichTools().smartIDTool().RawEventLocations = eventLocs
 
-        # Disable all warnings/errors from raw decoder (fatals only)
-        RichTools().rawDecoder().OutputLevel = 6
-
         # MDF data
         importOptions( "$STDOPTS/RawDataIO.opts" )
 
@@ -304,6 +299,10 @@ class Panoptes(LHCbConfigurableUser):
         else:
             ApplicationMgr().HistogramPersistency = "NONE"
 
+        # Use TimingAuditor for timing, suppress printout from SequencerTimerTool
+        ApplicationMgr().AuditAlgorithms = True
+        AuditorSvc().Auditors += [ 'TimingAuditor' ] 
+        SequencerTimerTool().OutputLevel = 4
         
     def defineGeometry(self):
         # check if CondDB tag should be taken from online environment
diff --git a/Rich/RichMirrorAlignmentGanga/cmt/requirements b/Rich/RichMirrorAlignmentGanga/cmt/requirements
index 73f2647a..6576c4a0 100644
--- a/Rich/RichMirrorAlignmentGanga/cmt/requirements
+++ b/Rich/RichMirrorAlignmentGanga/cmt/requirements
@@ -3,7 +3,7 @@
 # Maintainer : Anatoly Solomin
 #============================================================================
 package           RichMirrorAlignmentGanga
-version           v8r4
+version           v8r7
 
 #============================================================================
 # Structure, i.e. directories to process. 
diff --git a/Rich/RichMirrorAlignmentGanga/cmt/version.cmt b/Rich/RichMirrorAlignmentGanga/cmt/version.cmt
index 75ce650a..1ba20864 100644
--- a/Rich/RichMirrorAlignmentGanga/cmt/version.cmt
+++ b/Rich/RichMirrorAlignmentGanga/cmt/version.cmt
@@ -1 +1 @@
-v8r4
+v8r7
diff --git a/Rich/RichMirrorAlignmentGanga/doc/release_notes.html b/Rich/RichMirrorAlignmentGanga/doc/release_notes.html
index 1786c88b..86834f97 100644
--- a/Rich/RichMirrorAlignmentGanga/doc/release_notes.html
+++ b/Rich/RichMirrorAlignmentGanga/doc/release_notes.html
@@ -1,22 +1,61 @@
 <pre>
 Package              : Rich/RichMirrorAlignmentGanga
-Package Coordinator  : Anatoly Solomin
+Package Coordinators : Matt Coombes, Anatoly Solomin
 Purpose              : RICH mirror alignment program
 </pre>
 
-<h2><a name="v8r4">2010-12-08 RichMirrorAlignmentGanga v8r4</a></h2>
-<h3><a name="Note">This version released in PANOPTES v2r14. Adapted
-                   to the "Completely new approach"; migrated from
-                   pyxml to lxml.</a></h3>
+<h2><a name="v8r7">2011-05-20 RichMirrorAlignmentGanga v8r7</a></h2>
+<h3><a name="Note">This version released in PANOPTES v3r4.
+                   Minor fixes.</a></h3>
 <pre>
-
 2011-02-09 - Matt Coombes
-- Added files for 2011 data running
-- Popen now uses bash shell due to tcsh word limit
+- Incremented version number v8r7
+- For testing reasons added lines to make adding DB slices. This
+  is very useful when running alignment tests over lot of different
+  databases, (MDMS, HPD images, etc)
+- Changed 2011 data files name
+
+2011-05-26 - Matt Coombes
+- Added files for 2011 running
+- Inc new 2011 selected events for R1 and R2
+- New mirror combi list for RICH2
+
+
+2011-05-25 - Matt Coombes
+- Increment version v8r6.
+- Added options file to run over 2011 RAW data
+- 2011 data includes new list of RICH2 mirrors
+- 2011 data options include mom cut for RICH1
+- Added thisCase to job name designed to help with
+  running several simultaneous alignment jobs
+
+2011-05-20 - Anatoly Solomin
+- Increment version v8r5.
+- Corrected these release notes: fixed the header of the
+  previous release, to address the fact that in PANOPTES
+  v3r0, v3r1 and v3r2 these packages were temporarily
+  excluded, because xqilla was not yet available in the
+  officially released LHCb environment.
+- Finally, migrated to lxml, which became officially avalable,
+  from the obsolete pyxml (NB! SetupProject Ganga pytools).
+- In all "Popen" calls replaced tcsh with bash: was previously
+  discovered and partly replaced by Matt, due to tcsh word limit.
+</pre>
 
-2011-02-09 - Matt Coombes
+<h2><a name="v8r4">2011-03-30 RichMirrorAlignmentGanga v8r4</a></h2>
+<h3><a name="Note">This version released in PANOPTES v3r3. Adapted to
+                   the "Completely new approach"; migrated from pyxml
+                   to lxml. Several improvements, including 2011 data
+                   running adaptation</a></h3>
+<pre>
+
+2011-03-30 - Matt Coombes
+- Added files for 2011 data running.
+- Popen now uses bash shell due to tcsh word limit.
+
+2011-02-09 - Matt Coombes, Anatoly Solomin
 - Removed: dependency on user asolomin.
-- LSF mode altered and may not be fully supported
+- LSF mode altered and may not be fully supported.
 
 2010-12-08 - Anatoly Solomin
 - Fixed: xml files are now pretty formatted.
diff --git a/Rich/RichMirrorAlignmentGanga/files/LHCbCollision11Beam3500GeV-VeloClosed-MagDownRealData91000000DST_Selv10_R1.py b/Rich/RichMirrorAlignmentGanga/files/LHCbCollision11Beam3500GeV-VeloClosed-MagDownRealData91000000DST_Selv10_R1.py
new file mode 100644
index 00000000..7e246dc8
--- /dev/null
+++ b/Rich/RichMirrorAlignmentGanga/files/LHCbCollision11Beam3500GeV-VeloClosed-MagDownRealData91000000DST_Selv10_R1.py
@@ -0,0 +1,91 @@
+
+from Gaudi.Configuration import * 
+EventSelector().Input = [
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065498/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065507/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065515/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065532/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065539/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065594/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065601/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065608/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065614/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065620/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065628/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065635/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065644/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065652/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065660/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20095/20095015/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065678/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065694/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065702/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065711/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065717/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065726/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065733/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065748/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065755/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065764/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065772/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065779/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065785/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065790/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065796/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065801/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065806/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065812/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065818/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065823/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065829/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065835/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065841/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065847/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065852/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065857/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065862/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065868/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065874/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065879/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065887/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065892/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065897/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065902/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20095/20095019/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065914/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065918/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065922/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065936/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065941/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065964/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065968/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065974/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065976/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065984/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20095/20095022/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065987/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065996/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20065/20065998/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066002/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066004/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20095/20095027/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20095/20095030/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066021/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066024/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066026/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066031/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066042/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066044/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066053/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066058/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066063/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066067/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066081/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066085/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066095/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066100/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066105/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066114/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066118/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20066/20066128/AlignEventsRich1.dst' TYP='POOL_ROOTTREE' OPT='READ'"
+]
\ No newline at end of file
diff --git a/Rich/RichMirrorAlignmentGanga/files/LHCbCollision11Beam3500GeV-VeloClosed-MagDownRealData91000000DST_Selv10_R2.py b/Rich/RichMirrorAlignmentGanga/files/LHCbCollision11Beam3500GeV-VeloClosed-MagDownRealData91000000DST_Selv10_R2.py
new file mode 100644
index 00000000..e4390f7c
--- /dev/null
+++ b/Rich/RichMirrorAlignmentGanga/files/LHCbCollision11Beam3500GeV-VeloClosed-MagDownRealData91000000DST_Selv10_R2.py
@@ -0,0 +1,93 @@
+
+from Gaudi.Configuration import * 
+EventSelector().Input = [
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068113/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068118/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068127/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068138/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068143/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068182/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068188/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068194/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068197/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068203/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068209/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068215/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068219/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068226/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068233/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068238/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068244/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068249/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068252/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068257/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068261/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068267/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068273/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068278/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068283/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068288/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068292/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068297/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068302/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068307/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068312/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068317/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068322/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068328/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068333/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068338/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068344/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068349/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068355/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20094/20094806/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068365/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068370/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068374/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068378/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068382/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068385/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068388/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068391/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20094/20094809/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20094/20094812/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068406/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068411/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068417/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068426/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068431/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068446/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068451/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068473/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068479/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068484/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068494/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20094/20094816/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068520/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068525/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068549/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068567/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068573/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068605/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068615/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068624/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068629/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068639/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068657/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068662/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068672/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068679/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068683/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068687/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068692/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068697/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068708/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068713/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20094/20094818/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068723/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068729/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068734/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068745/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068750/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'",
+ "DATAFILE='LFN:/lhcb/user/t/thampson/2011_05/20068/20068761/AlignEventsRich2.dst' TYP='POOL_ROOTTREE' OPT='READ'"
+]
\ No newline at end of file
diff --git a/Rich/RichMirrorAlignmentGanga/files/Rich2MirrCombinList_48m48c_p12p43s09s30fix.txt b/Rich/RichMirrorAlignmentGanga/files/Rich2MirrCombinList_48m48c_p12p43s09s30fix.txt
new file mode 100644
index 00000000..b1d72875
--- /dev/null
+++ b/Rich/RichMirrorAlignmentGanga/files/Rich2MirrCombinList_48m48c_p12p43s09s30fix.txt
@@ -0,0 +1,46 @@
+ 2719                   2618                   2517                   2416     5539                   5438                   5337                   5236 
+
+
+                 2219   2218                   2117                   2016     5139                   5038                   4937   4936                 
+ 2315                   2214                   2113                   2012     5135                   5034                   4933                   4832 
+
+
+ 1915                   1814                   1713                   1612     4735                   4634                   4533                   4432 
+ 1911                   1810                   1709                   1608     4731                   4630                   4529                   4428 
+
+
+ 1511            1411   1410            1310   1309            1209   1208  +  4331   4330            4230   4229            4129   4128            4028 
+
+
+ 1111                   1010                   0909                   0808     3931                   3830                   3729                   3628 
+ 1107                   1006                   0905                   0804     3927                   3826                   3725                   3624 
+
+
+ 0707                   0606                   0505                   0404     3527                   3426                   3325                   3224 
+                 0603   0602                   0501                   0400     3523                   3422                   3321   3320                 
+
+
+ 0303                   0202                   0101                   0000     3123                   3022                   2921                   2820 
+mirrors
+-----------------------------------------------------
+       Mirror segments under alignment monitoring    
+             (12) and (43) are fixed at 0.0          
+     (09) and (30) are calculated at 0-th iteration  
+              and remain fixed afterwards            
+-----------------------------------------------------
+                         Primary                     
+    27    26    25    24         55    54    53    52
+    23    22    21    20         51    50    49    48
+    19    18    17    16         47    46    45    44
+    15    14    13   (12)   +   (43)   42    41    40
+    11    10    09    08         39    38    37    36
+    07    06    05    04         35    34    33    32
+    03    02    01    00         31    30    29    28
+-----------------------------------------------------
+                        Secondary                    
+    19    18    17    16         39    38    37    36
+    15    14    13    12         35    34    33    32
+    11    10   (09)   08    +    31   (30)   29    28
+    07    06    05    04         27    26    25    24
+    03    02    01    00         23    22    21    20
+-----------------------------------------------------
diff --git a/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga.py b/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga.py
index be32acbe..55d4560e 100644
--- a/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga.py
+++ b/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga.py
@@ -99,17 +99,157 @@ def rm_subjobs_except_0_last( j, rootFile, brunelVer, backEnd='dirac', timeout=1
             else :
                sj.peek('../output/'+rootFile, 'rm  -f')
 #===============================================================================
+#def create_coeff_calibration_xml_files( inputFile=None, coeffCalibrTilt=0.5 ) :
+#   import sys
+#   import re
+#   import fpformat
+#
+#   from   pyxml.dom.ext       import PrettyPrint
+#   from   pyxml.dom.minidom   import parse
+#   from   pyxml               import xpath
+#
+#   from   array               import array
+#
+#   # using most recent Mirrors files, manufacture from them modified Mirrors files
+#   # for evaluation of current magnification cefficients
+#
+#   # first cut inputFile int two parts: inputFileLeftPart and inputFileRightPart
+#   # and separate them
+#   inputFilePartsRE   = re.compile(r'([a-zA-Z0-9_]+)(_[0-9\.]+mr_[0-9]+\.xml)')
+#   inputFileParts     = inputFilePartsRE.match( inputFile )
+#   inputFileLeftPart  = inputFileParts.group(1)
+#   inputFileRightPart = inputFileParts.group(2)
+#   """
+#   print "inputFileLeftPart  "+inputFileLeftPart
+#   print "inputFileRightPart "+inputFileRightPart
+#   """
+#   #
+#   # prepare dictionary of sign names
+#   signName       = dict({  '-': 'neg'            ,    '+': 'pos'            })
+#
+#   # prepare dictionary of sign-to-shift
+#   signToShift    = dict({  '-': -coeffCalibrTilt ,    '+':  coeffCalibrTilt })
+#
+#   # prepare dictionary of mirror type names
+#   mirrTypeName   = dict({'pri': 'Sph',  'sec': 'Sec'})
+#   
+#   if richDetector == 2 :
+#   # prepare dictionary of total mirror numbers
+#       totMirrNum = dict({'pri':   56 ,  'sec':   40 })
+#        
+#   if richDetector == 1 :
+#       totMirrNum = dict({'pri':    4 ,  'sec':   16 })
+#
+#   # prepare dictionary of rotation vector's term sequence number depending on axis
+#   seqNum         = dict({  'Y':    1 ,    'Z':    2 })
+#
+#   # prepare regular expression
+#   rotRE  = re.compile(r'[\-|\+]?[0-9]+\.?[0-9]*|[\-|\+]?\.[0-9]+')
+#   # such an expression matches e.g. all of the following:  -000  +20.  2.000  +0005.9000  .0  -.98  +.30000
+#   """
+#   for f in [-000,  +20.,  2.000,  +0005.9000,  .0,  -.98,  +.30000] :
+#       print str( float( str( f ) ) )
+#   """
+#   #
+#   """
+#   0.0
+#   20.0
+#   2.0
+#   5.9
+#   0.0
+#   -0.98
+#   0.3
+#   """
+#   # array for matches in strings
+#   rotValues = []
+#
+#  ## parse the tree and create DOM of it
+#  #docOriginal = parse( inputFile )
+#
+#   # loop over types of mirrors
+#   for mirrType in ['pri', 'sec'] :
+#
+#      # loop over axes
+#      for axis in ['Y', 'Z'] :
+#
+#         # loop over signs
+#         for sign in ['-', '+'] :
+#
+#           ## make a working copy in order not to parse each anew
+#           #doc = docOriginal
+#            doc = parse( inputFile )
+#
+#            # loop over all mirrors of current type (primary/secondary)
+#            # total numbers of primary (spheric) and secondary (flat) mirrors are different
+#            for mirrNum in range ( totMirrNum[ mirrType ] ) :
+#
+#               # array for matches in float
+#               floatRotValues  = array('f')
+#        
+#               # Different xml alignment names for the two Rich detectors
+#               if ( richDetector == 2 ) :
+#               # store the whole element in dRotXYZ
+#                 dRotXYZ = xpath.Evaluate("//condition[@name='Rich"+str(richDetector)+mirrTypeName[ mirrType ]+"Mirror"+str(mirrNum)+"_Align']/paramVector[@name='dRotXYZ']", doc)
+#                 
+#               if ( richDetector == 1 ) :
+#               # store the whole element in dRotXYZ
+#                 dRotXYZ = xpath.Evaluate("//condition[@name='"+mirrTypeName[ mirrType ]+"Mirror"+str(mirrNum)+"_Align']/paramVector[@name='dRotXYZ']", doc)
+#               """
+#               print dRotXYZ[0].toxml()
+#               print dRotXYZ[0].firstChild.toxml()
+#               print dRotXYZ[0].firstChild.data
+#
+#               print dRotXYZ[0].firstChild.nodeValue
+#               """
+#               #
+#               # store all three rotation correction values in the floatRotValues (float) array
+#               rotValues = rotRE.findall( dRotXYZ[0].firstChild.nodeValue )
+#               """
+#               for i in range (3) :
+#                  print rotValues[i]
+#               """
+#               #
+#               for i in range (3) :
+#                  floatRotValues.append( float( rotValues[i] ) )
+#               """
+#               for i in range (3) :
+#                  print str( floatRotValues[i] )
+#               """
+#               #
+#               # re-write the body of the vector of rotation corrections
+#               # with the value of one of them shifted by +/- coeffCalibrTilt mrad
+#               floatRotValues[ seqNum[ axis ] ] +=  signToShift[ sign ]
+#
+#               dRotXYZ[0].firstChild.nodeValue = fpformat.fix(floatRotValues[0], 5)+'*mrad '+fpformat.fix(floatRotValues[1], 5)+'*mrad '+fpformat.fix(floatRotValues[2], 5)+'*mrad'
+#               """
+#               print dRotXYZ[0].firstChild.nodeValue
+#               """
+#               #
+#            """
+#            print doc.toxml()
+#            """
+#            #
+#            if axis == 'Y' :
+#                signCombinName =        signName[ sign ]+'YzerZ'
+#            else           :
+#                signCombinName = 'zerY'+signName[ sign ]+'Z'
+#            PrettyPrint (doc, open( inputFileLeftPart+'_'+mirrType+'_'+signCombinName+inputFileRightPart, 'w'), indent='  ', encoding='ISO-8859-1')
+#===============================================================================
+#def just_pretty_print( inputFile=None) :
+#   from   pyxml.dom.ext       import PrettyPrint
+#   from   pyxml.dom.minidom   import parse
+#   doc = parse( inputFile )
+#   PrettyPrint (doc, open( inputFile, 'w'), indent='  ', encoding='ISO-8859-1')
+#===============================================================================
+#===============================================================================
 def create_coeff_calibration_xml_files( inputFile=None, coeffCalibrTilt=0.5 ) :
    import sys
    import re
    import fpformat
-
-   from   pyxml.dom.ext       import PrettyPrint
-   from   pyxml.dom.minidom   import parse
-   from   pyxml               import xpath
-
    from   array               import array
 
+   from   lxml         import etree
+
    # using most recent Mirrors files, manufacture from them modified Mirrors files
    # for evaluation of current magnification cefficients
 
@@ -177,7 +317,8 @@ def create_coeff_calibration_xml_files( inputFile=None, coeffCalibrTilt=0.5 ) :
 
            ## make a working copy in order not to parse each anew
            #doc = docOriginal
-            doc = parse( inputFile )
+            RichAlignmentConditions = etree.parse( inputFile )
+            print(etree.tostring( RichAlignmentConditions, xml_declaration=True, pretty_print=True, encoding='iso-8859-1'))
 
             # loop over all mirrors of current type (primary/secondary)
             # total numbers of primary (spheric) and secondary (flat) mirrors are different
@@ -187,28 +328,25 @@ def create_coeff_calibration_xml_files( inputFile=None, coeffCalibrTilt=0.5 ) :
                floatRotValues  = array('f')
         
                # Different xml alignment names for the two Rich detectors
-               if ( richDetector == 2 ) :
+               if ( richDetector == 1 ) :
                # store the whole element in dRotXYZ
-                 dRotXYZ = xpath.Evaluate("//condition[@name='Rich"+str(richDetector)+mirrTypeName[ mirrType ]+"Mirror"+str(mirrNum)+"_Align']/paramVector[@name='dRotXYZ']", doc)
+                 dRotXYZ = RichAlignmentConditions.xpath("//condition[@name='"+mirrTypeName[ mirrType ]+"Mirror"+str(mirrNum)+"_Align']/paramVector[@name='dRotXYZ']")
                  
-               if ( richDetector == 1 ) :
+               if ( richDetector == 2 ) :
                # store the whole element in dRotXYZ
-                 dRotXYZ = xpath.Evaluate("//condition[@name='"+mirrTypeName[ mirrType ]+"Mirror"+str(mirrNum)+"_Align']/paramVector[@name='dRotXYZ']", doc)
+                 dRotXYZ = RichAlignmentConditions.xpath("//condition[@name='Rich"+str(richDetector)+mirrTypeName[ mirrType ]+"Mirror"+str(mirrNum)+"_Align']/paramVector[@name='dRotXYZ']")
                """
-               print dRotXYZ[0].toxml()
-               print dRotXYZ[0].firstChild.toxml()
-               print dRotXYZ[0].firstChild.data
-
-               print dRotXYZ[0].firstChild.nodeValue
+               print(etree.tostring(dRotXYZ[0], pretty_print=True))
+               print(etree.tostring(dRotXYZ[0], pretty_print=True, method="text"))
                """
                #
                # store all three rotation correction values in the floatRotValues (float) array
-               rotValues = rotRE.findall( dRotXYZ[0].firstChild.nodeValue )
+               rotValues = rotRE.findall( etree.tostring(dRotXYZ[0], pretty_print=True, method="text") )
                """
                for i in range (3) :
                   print rotValues[i]
-               """
                #
+               """
                for i in range (3) :
                   floatRotValues.append( float( rotValues[i] ) )
                """
@@ -220,177 +358,40 @@ def create_coeff_calibration_xml_files( inputFile=None, coeffCalibrTilt=0.5 ) :
                # with the value of one of them shifted by +/- coeffCalibrTilt mrad
                floatRotValues[ seqNum[ axis ] ] +=  signToShift[ sign ]
 
-               dRotXYZ[0].firstChild.nodeValue = fpformat.fix(floatRotValues[0], 5)+'*mrad '+fpformat.fix(floatRotValues[1], 5)+'*mrad '+fpformat.fix(floatRotValues[2], 5)+'*mrad'
+               dRotXYZ[0].text = fpformat.fix(floatRotValues[0], 5)+'*mrad '+fpformat.fix(floatRotValues[1], 5)+'*mrad '+fpformat.fix(floatRotValues[2], 5)+'*mrad'
                """
-               print dRotXYZ[0].firstChild.nodeValue
+               print(etree.tostring(dRotXYZ[0], pretty_print=True, encoding='iso-8859-1'))
                """
                #
-            """
-            print doc.toxml()
-            """
-            #
             if axis == 'Y' :
                 signCombinName =        signName[ sign ]+'YzerZ'
             else           :
                 signCombinName = 'zerY'+signName[ sign ]+'Z'
-            PrettyPrint (doc, open( inputFileLeftPart+'_'+mirrType+'_'+signCombinName+inputFileRightPart, 'w'), indent='  ', encoding='ISO-8859-1')
+
+            newXML_File = open( inputFileLeftPart+'_'+mirrType+'_'+signCombinName+inputFileRightPart, 'w')
+            newXML_File.write(etree.tostring( RichAlignmentConditions, xml_declaration=True, pretty_print=True, encoding='iso-8859-1'))
+            newXML_File.close()
 #===============================================================================
 def just_pretty_print( inputFile=None) :
-   from   pyxml.dom.ext       import PrettyPrint
-   from   pyxml.dom.minidom   import parse
-   doc = parse( inputFile )
-   PrettyPrint (doc, open( inputFile, 'w'), indent='  ', encoding='ISO-8859-1')
+   from   lxml         import etree
+   RichAlignmentConditions = etree.parse( inputFile )
+   newXML_File = open( inputFile, 'w')
+   newXML_File.write(etree.tostring( RichAlignmentConditions, xml_declaration=True, pretty_print=True, encoding='iso-8859-1'))
+   newXML_File.close()
+#===============================================================================
 #===============================================================================
-##===============================================================================
-#def create_coeff_calibration_xml_files( inputFile=None, coeffCalibrTilt=0.5 ) :
-#   import sys
-#   import re
-#   import fpformat
-#   from   array               import array
-#
-#   from   lxml         import etree
-#
-#   # using most recent Mirrors files, manufacture from them modified Mirrors files
-#   # for evaluation of current magnification cefficients
-#
-#   # first cut inputFile int two parts: inputFileLeftPart and inputFileRightPart
-#   # and separate them
-#   inputFilePartsRE   = re.compile(r'([a-zA-Z0-9_]+)(_[0-9\.]+mr_[0-9]+\.xml)')
-#   inputFileParts     = inputFilePartsRE.match( inputFile )
-#   inputFileLeftPart  = inputFileParts.group(1)
-#   inputFileRightPart = inputFileParts.group(2)
-#   """
-#   print "inputFileLeftPart  "+inputFileLeftPart
-#   print "inputFileRightPart "+inputFileRightPart
-#   """
-#   #
-#   # prepare dictionary of sign names
-#   signName       = dict({  '-': 'neg'            ,    '+': 'pos'            })
-#
-#   # prepare dictionary of sign-to-shift
-#   signToShift    = dict({  '-': -coeffCalibrTilt ,    '+':  coeffCalibrTilt })
-#
-#   # prepare dictionary of mirror type names
-#   mirrTypeName   = dict({'pri': 'Sph',  'sec': 'Sec'})
-#   
-#   if richDetector == 2 :
-#   # prepare dictionary of total mirror numbers
-#       totMirrNum = dict({'pri':   56 ,  'sec':   40 })
-#        
-#   if richDetector == 1 :
-#       totMirrNum = dict({'pri':    4 ,  'sec':   16 })
-#
-#   # prepare dictionary of rotation vector's term sequence number depending on axis
-#   seqNum         = dict({  'Y':    1 ,    'Z':    2 })
-#
-#   # prepare regular expression
-#   rotRE  = re.compile(r'[\-|\+]?[0-9]+\.?[0-9]*|[\-|\+]?\.[0-9]+')
-#   # such an expression matches e.g. all of the following:  -000  +20.  2.000  +0005.9000  .0  -.98  +.30000
-#   """
-#   for f in [-000,  +20.,  2.000,  +0005.9000,  .0,  -.98,  +.30000] :
-#       print str( float( str( f ) ) )
-#   """
-#   #
-#   """
-#   0.0
-#   20.0
-#   2.0
-#   5.9
-#   0.0
-#   -0.98
-#   0.3
-#   """
-#   # array for matches in strings
-#   rotValues = []
-#
-#  ## parse the tree and create DOM of it
-#  #docOriginal = parse( inputFile )
-#
-#   # loop over types of mirrors
-#   for mirrType in ['pri', 'sec'] :
-#
-#      # loop over axes
-#      for axis in ['Y', 'Z'] :
-#
-#         # loop over signs
-#         for sign in ['-', '+'] :
-#
-#           ## make a working copy in order not to parse each anew
-#           #doc = docOriginal
-#            RichAlignmentConditions = etree.parse( inputFile )
-#            print(etree.tostring( RichAlignmentConditions, xml_declaration=True, pretty_print=True, encoding='iso-8859-1'))
-#
-#            # loop over all mirrors of current type (primary/secondary)
-#            # total numbers of primary (spheric) and secondary (flat) mirrors are different
-#            for mirrNum in range ( totMirrNum[ mirrType ] ) :
-#
-#               # array for matches in float
-#               floatRotValues  = array('f')
-#        
-#               # Different xml alignment names for the two Rich detectors
-#               if ( richDetector == 1 ) :
-#               # store the whole element in dRotXYZ
-#                 dRotXYZ = RichAlignmentConditions.xpath("//condition[@name='"+mirrTypeName[ mirrType ]+"Mirror"+str(mirrNum)+"_Align']/paramVector[@name='dRotXYZ']")
-#                 
-#               if ( richDetector == 2 ) :
-#               # store the whole element in dRotXYZ
-#                 dRotXYZ = RichAlignmentConditions.xpath("//condition[@name='Rich"+str(richDetector)+mirrTypeName[ mirrType ]+"Mirror"+str(mirrNum)+"_Align']/paramVector[@name='dRotXYZ']")
-#               """
-#               print(etree.tostring(dRotXYZ[0], pretty_print=True))
-#               print(etree.tostring(dRotXYZ[0], pretty_print=True, method="text"))
-#               """
-#               #
-#               # store all three rotation correction values in the floatRotValues (float) array
-#               rotValues = rotRE.findall( etree.tostring(dRotXYZ[0], pretty_print=True, method="text") )
-#               """
-#               for i in range (3) :
-#                  print rotValues[i]
-#               #
-#               """
-#               for i in range (3) :
-#                  floatRotValues.append( float( rotValues[i] ) )
-#               """
-#               for i in range (3) :
-#                  print str( floatRotValues[i] )
-#               """
-#               #
-#               # re-write the body of the vector of rotation corrections
-#               # with the value of one of them shifted by +/- coeffCalibrTilt mrad
-#               floatRotValues[ seqNum[ axis ] ] +=  signToShift[ sign ]
-#
-#               dRotXYZ[0].text = fpformat.fix(floatRotValues[0], 5)+'*mrad '+fpformat.fix(floatRotValues[1], 5)+'*mrad '+fpformat.fix(floatRotValues[2], 5)+'*mrad'
-#               """
-#               print(etree.tostring(dRotXYZ[0], pretty_print=True, encoding='iso-8859-1'))
-#               """
-#               #
-#            if axis == 'Y' :
-#                signCombinName =        signName[ sign ]+'YzerZ'
-#            else           :
-#                signCombinName = 'zerY'+signName[ sign ]+'Z'
-#
-#            newXML_File = open( inputFileLeftPart+'_'+mirrType+'_'+signCombinName+inputFileRightPart, 'w')
-#            newXML_File.write(etree.tostring( RichAlignmentConditions, xml_declaration=True, pretty_print=True, encoding='iso-8859-1'))
-#            newXML_File.close()
-##===============================================================================
-#def just_pretty_print( inputFile=None) :
-#   from   lxml         import etree
-#   RichAlignmentConditions = etree.parse( inputFile )
-#   newXML_File = open( inputFile, 'w')
-#   newXML_File.write(etree.tostring( RichAlignmentConditions, xml_declaration=True, pretty_print=True, encoding='iso-8859-1'))
-#   newXML_File.close()
-##===============================================================================
 # retrieve necessary environment variables:
 
-p = Popen("setenv HOME                               "+home+";"
-         +"source "+pathToScripts+"/LbLogin.csh;"
-         +"setenv User_release_area                  "+userReleaseArea+";"
-         +"source `which SetupProject.csh`           Panoptes "+setupProjectPanoptesVersion+" "+setupProjectPanoptesOptions+";"
+p = Popen("set HOME =                                "+home+";"
+         +"source "+pathToScripts+"/LbLogin.sh;"
+         +"set User_release_area =                   "+userReleaseArea+";"
+         +"source `which SetupProject.sh`            Panoptes "+setupProjectPanoptesVersion+" "+setupProjectPanoptesOptions+";"
          +"rm                                     -f env_var_settings.txt;"
          +"echo   $CMTCONFIG                       > env_var_settings.txt;"
          +"echo   $RICHMIRRCOMBINFITROOT          >> env_var_settings.txt;"
          +"echo   $RICHMIRRALIGNROOT              >> env_var_settings.txt ",
            shell=True,
-           executable="/bin/tcsh"
+           executable="/bin/bash"
          )
 sts = os.waitpid(p.pid, 0)
 
@@ -516,6 +517,9 @@ if ( locals().has_key('magnifCoeffMode')           ==  0  or  magnifCoeffMode ==
 
 if ( locals().has_key('solutionMethod')            ==  0  or  solutionMethod == "") :
                        solutionMethod               =  0
+            
+if ( locals().has_key('AddedDB')                  ==  0 ) :
+                       AddedDB                     = [""]           
 
 brunelEvtMax                         =   str(brunelEvtMax)
 brunelPrintFreq                      =   str(brunelPrintFreq)
@@ -562,6 +566,7 @@ print "### coeffCalibrTilt           = "+str(coeffCalibrTilt)
 print "### useTruth                  = "+useTruth
 
 print "### useOffsetsFromMC          = "+useOffsetsFromMC
+print "### AddedDB                   = "+str(len(AddedDB))
 useOffsets = ( useOffsetsFromMC.lower()=="true" or useOffsetsFromMC.lower()=="yes")
 if ( useOffsets ) :
    useOffsetsFromMC = "true"
@@ -616,13 +621,13 @@ CondDB_tag = condDB_tag
 # if no particular name of APPCONFIGOPTS was defined, find out the default one
 # for the particular version of Brunel we are using:
 if ( APPCONFIGOPTS == '') :
-   p = Popen("setenv HOME                                "+home+";"
-            +"source "+pathToScripts+"/LbLogin.csh;"
-            +"source `which SetupProject.csh`            Brunel "+setupProjectBrunelOpts+";"
+   p = Popen("set HOME =                                 "+home+";"
+            +"source "+pathToScripts+"/LbLogin.sh;"
+            +"source `which SetupProject.sh`             Brunel "+setupProjectBrunelOpts+";"
             +"rm                                      -f env_var_settings.txt;"
             +"echo   $APPCONFIGOPTS                    > env_var_settings.txt ",
               shell=True,
-              executable="/bin/tcsh"
+              executable="/bin/bash"
             )
    sts = os.waitpid(p.pid, 0)
 
@@ -789,13 +794,13 @@ if ( iterationCount == 0 ) :
 
             print     "dump_db_to_files.py  -v  -c CondDB/"+CONDDB+     "  -t `date +\"%s000000000\"`  -T \'"+     CondDB_tag+"\'  -s /Conditions/Rich"+RichDetectorStr+"/Alignment/Mirrors.xml  -d Mirrors_"+thisName
 
-            p = Popen("setenv HOME  "+home+";"
-                     +"source "+pathToScripts+"/LbLogin.csh;"
+            p = Popen("set HOME =   "+home+";"
+                     +"source "+pathToScripts+"/LbLogin.sh;"
                     #+"source `which lhcb-proxy-init`  -g lhcb_calibration  -p < $HOME/private/g;"
-                     +"source `which SetupProject.csh` LHCb --use-grid;"
+                     +"source `which SetupProject.sh` LHCb --use-grid;"
                      +"dump_db_to_files.py  -v  -c CondDB/"+CONDDB+     "  -t `date +\"%s000000000\"`  -T \'"+     CondDB_tag+"\'  -s /Conditions/Rich"+RichDetectorStr+"/Alignment/Mirrors.xml  -d Mirrors_"+thisName,
                        shell=True,
-                       executable="/bin/tcsh"
+                       executable="/bin/bash"
                      )
             sts = os.waitpid(p.pid, 0)
 
@@ -803,7 +808,7 @@ if ( iterationCount == 0 ) :
 
             print     "dump_db_to_files.py  -v  -c sqlite_file:$SQLITEDBPATH/"+CONDDB+".db/"+CONDDB+"  -T \'"+     CondDB_tag+"\'  -s /Conditions/Rich"+RichDetectorStr+"/Alignment/Mirrors.xml  -d Mirrors_"+thisName
 
-            p = Popen("setenv HOME  "+home+";"
+            p = Popen("set HOME =   "+home+";"
                      +"source "+pathToScripts+"/LbLogin.sh;"
                    # +"source `which lhcb-proxy-init`  -g lhcb_calibration  -p < $HOME/private/g;"
                      +"source `which SetupProject.sh` LHCb;"
@@ -817,7 +822,7 @@ if ( iterationCount == 0 ) :
 
          print        "dump_db_to_files.py  -v  -c sqlite_file:$SQLITEDBPATH/"+CONDDB+".db/"+CONDDB+"  -T \'"+LocalCondDB_tag+"\'  -s /Conditions/Rich"+RichDetectorStr+"/Alignment/Mirrors.xml  -d Mirrors_"+thisName
 
-         p    = Popen("setenv HOME  "+home+";"
+         p    = Popen("set HOME =   "+home+";"
                      +"source "+pathToScripts+"/LbLogin.sh;"
                     #+"source `which lhcb-proxy-init`  -g lhcb_calibration  -p < $HOME/private/g;"
                      +"source `which SetupProject.sh` LHCb;"
@@ -952,7 +957,7 @@ while  iterationCount < maximumNumberOfIterations :
       # directories' and dbs' names do not
       #-------------------------------------------------------------------------------
       os .system("ln -sf ../../../../Mirrors_rich"+RichDetectorStr+"_"+thisNames[tilt]+"_"+str(iterationCount)+".xml  Mirrors_"+thisNames[tilt]+"/Conditions/Rich"+RichDetectorStr+"/Alignment/Mirrors.xml")
-      os .system("rm -rf                                                                            Mirrors_"+thisNames[tilt]+".db")
+      os .system("rm -rf                                                             Mirrors_"+thisNames[tilt]+".db")
 
       # create local [replaceable] working copy of the conditions database slice
       # containing only Mirrors.xml branch
@@ -962,14 +967,14 @@ while  iterationCount < maximumNumberOfIterations :
       # prepare CondDB sqlite_file for this tilt, which will be additional layer to the main database
       print     "copy_files_to_db.py  -s Mirrors_"+thisNames[tilt]+"  -c sqlite_file:Mirrors_"+thisNames[tilt]+".db/"+CONDDB
 
-      p = Popen("setenv HOME  "+home+";"
-               +"source "+pathToScripts+"/LbLogin.csh;"
+      p = Popen("set HOME =   "+home+";"
+               +"source "+pathToScripts+"/LbLogin.sh;"
               #+"source `which lhcb-proxy-init`  -g lhcb_calibration  -p < $HOME/private/g;"
-               +"source `which SetupProject.csh` LHCb;"
+               +"source `which SetupProject.sh` LHCb;"
                +"copy_files_to_db.py  -s Mirrors_"+thisNames[tilt]+"  -c sqlite_file:Mirrors_"+thisNames[tilt]+".db/"+CONDDB+";"
                +"python  "+PanoptesJobPath+"/tagger.py  "+CondDB_tag+" "+thisNames[tilt]+" "+CONDDB,
                  shell=True,
-                 executable="/bin/tcsh"
+                 executable="/bin/bash"
                )
       sts = os.waitpid(p.pid, 0)
       """
@@ -993,8 +998,8 @@ while  iterationCount < maximumNumberOfIterations :
       # the job configuration
       #-------------------------------------------------------------------------------
      # jAppBrunel  = Brunel( version = 'v37r8p5')
-      jAppBrunel  = Brunel( version = 'v39r0p2')
-      #jAppBrunel  = Brunel()
+     # jAppBrunel  = Brunel( version = 'v39r0p2')
+      jAppBrunel  = Brunel()
       jAppBrunel .setupProjectOptions = setupProjectBrunelOpts
      #if ( backEnd == 'dirac') :
      #   jAppBrunel .platform = 'slc4_ia32_gcc34'
@@ -1011,7 +1016,31 @@ while  iterationCount < maximumNumberOfIterations :
       jAppBrunel .optsfile = [File( BrunelOptsPath+"/Brunel_RichAlignMoni_"+dataVariant+"-"+brunelInitialInputType+".py"),
                               File(eventSelectorInputFile)]
       print "#########"+BrunelOptsPath+"/Brunel_RichAlignMoni_"+dataVariant+"-"+brunelInitialInputType+".py ##############"
-
+      
+      DBSlices = []
+      DBSlicesNames = []
+      BrunelOptionsString = ""
+      ThereAreAddedDBSlices = False
+      LFNDBs = True
+      if len(AddedDB) > 0 and len(AddedDB[0])>1 and backEnd == 'dirac':     #note can not use databases outside of dirac
+          ThereAreAddedDBSlices = True
+          for i in range(0,len(AddedDB)):
+              if not AddedDB2.startswith('LFN'):
+                  LFNDBs = False # databases are local
+              AddedDB2 = AddedDB[i].split("/")
+              for j in AddedDB2:
+                        if (j.endswith(".db")):
+                            DBSlices.append(j)
+                            print j
+                            AddedDBName = j.split(".")
+                            for k in AddedDBName:
+                                if not k.endswith("db"):
+                                    DBSlicesNames.append(k)
+              BrunelOptionsString = BrunelOptionsString+ """CondDB().addLayer(CondDBAccessSvc(\""""+DBSlicesNames[i]+"""\",ConnectionString=\"sqlite_file:"""+DBSlices[i]+"""/LHCBCOND\",DefaultTAG=\"HEAD\"))\n"""
+                        
+      print BrunelOptionsString 
+          
+      #      CondDB().addLayer(CondDBAccessSvc("NewMDMSCondDB-28022011",ConnectionString="sqlite_file:NewMDMSCondDB-28022011.db/LHCBCOND",DefaultTAG="HEAD"))
       if ( dataVariant == "Collision09"  or  dataVariant == "Collision10" or dataVariant == "Collision11") :
 
          jAppBrunel.extraopts    = """
@@ -1023,7 +1052,8 @@ RichAlignmentConf ("OfflineRichMoni_RichAlignmentConf").setProp("Radiators", [\'
 MessageSvc().OutputLevel      =   """+messageSvcOutputLevel+"""
 CondDB().addLayer( CondDBAccessSvc(\'Rich"""+RichDetectorStr+"""AlignMirr\', ConnectionString = \'sqlite_file:Mirrors_"""+thisNames[tilt]+""".db/"""+CONDDB+"""\', DefaultTAG = \'"""+CondDB_tag+"""\') )
 HistogramPersistencySvc().setProp(\'OutputFile\', \'RichRecQCHistos_rich"""+RichDetectorStr+"""_"""+thisNames[tilt]+"""_"""+str(iterationCount)+""".root\')
-         """
+""" + BrunelOptionsString + """
+    """
       else:
          jAppBrunel.extraopts    = """
 Brunel().DDDBtag              = \'"""+DDDB_tag+"""\'
@@ -1048,7 +1078,7 @@ HistogramPersistencySvc().setProp(\'OutputFile\', \'RichRecQCHistos_rich"""+Rich
 
       jMerger = SmartMerger( files = ["RichRecQCHistos_rich"+RichDetectorStr+"_"+thisNames[tilt]+"_"+str(iterationCount)+".root"], ignorefailed = True )
 
-      jName = tiltInJobnameDict[ tilt ]+str(iterationCount)+'_R'+RichDetectorStr;
+      jName = tiltInJobnameDict[ tilt ]+str(iterationCount)+'_'+thisCase;
 
       j = Job (
         name          = jName,
@@ -1073,6 +1103,13 @@ HistogramPersistencySvc().setProp(\'OutputFile\', \'RichRecQCHistos_rich"""+Rich
 
       j.inputsandbox += [workDir+"/Mirrors_"+thisNames[tilt]+".db"]
       
+      if ThereAreAddedDBSlices == True and LFNDBs == True:
+          j.backend.inputSandboxLFNs = AddedDB
+          
+      if ThereAreAddedDBSlices == True and LFNDBs == False:
+          j.inputsandbox += AddedDB
+
+      
 #      j.backend.inputSandboxLFNs = ['LFN:/lhcb/user/j/jonrob/DBs/RefInCalib-2011-V1_BR-v39r0p2-24032011.db',
 #                                    'LFN:/lhcb/user/j/jonrob/DBs/NewMDMSCondDB-28022011.db',
 #                                    'LFN:/lhcb/user/j/jonrob/DBs/MDMS-RootFiles-RunAligned-Sobel-Smoothed3hours-08032011.db']
@@ -1267,7 +1304,7 @@ HistogramPersistencySvc().setProp(\'OutputFile\', \'RichRecQCHistos_rich"""+Rich
                                   setupProjectOptions=setupProjectPanoptesOptions,
                                   script=RICHMIRRCOMBINFITROOT+'/python/Rich'+RichDetectorStr+'MirrCombinFitWrapper.py')
    jInputsandbox   = [RICHMIRRCOMBINFITROOT+'/'+CMTCONFIG+'/RichMirrCombinFit.exe', 'Rich'+RichDetectorStr+'MirrCombinFit.conf']
-   j = Job( application=jAppGaudiPython, inputsandbox=jInputsandbox, name='CombinFit_R'+RichDetectorStr)
+   j = Job( application=jAppGaudiPython, inputsandbox=jInputsandbox, name='CombinFit_'+thisCase)
    print "### ----------------------------------------------------------------------------"
    print "### running fitting program that yields total tilts being produced by each pair"
    print "### of primary and secondary mirror segments out of a set of combinations chosen"
@@ -1441,7 +1478,7 @@ HistogramPersistencySvc().setProp(\'OutputFile\', \'RichRecQCHistos_rich"""+Rich
   #j.name = "MirrAlign"
    jAppGaudiPython = GaudiPython( user_release_area=userReleaseArea, project='Panoptes', version=setupProjectPanoptesVersion, setupProjectOptions=setupProjectPanoptesOptions, script=RICHMIRRALIGNROOT+'/python/Rich'+RichDetectorStr+'MirrAlignWrapper.py')
    jInputsandbox   = [RICHMIRRALIGNROOT+'/'+CMTCONFIG+'/RichMirrAlign.exe', 'Rich'+RichDetectorStr+'MirrAlign.conf']
-   j = Job( application=jAppGaudiPython, inputsandbox=jInputsandbox, name='MirrAlign_R'+RichDetectorStr)
+   j = Job( application=jAppGaudiPython, inputsandbox=jInputsandbox, name='MirrAlign_'+thisCase)
 
    print "### ----------------------------------------------------------------------------"
    print "### now running program that does the following:"
diff --git a/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga_Collision10_settings.py b/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga_Collision10_settings.py
index 9be4a5f6..6fbdcbc3 100644
--- a/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga_Collision10_settings.py
+++ b/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga_Collision10_settings.py
@@ -3,22 +3,22 @@ from   subprocess import *
 
 reactivate()
 
-userReleaseArea              =  os.getenv("User_release_area")
-home                         =  "/afs/cern.ch/user/a/asolomin"
+userReleaseArea              = os.getenv("User_release_area")
+home                         = "/afs/cern.ch/user/a/asolomin"
 setupProjectPanoptesVersion  = "HEAD"
-#setupProjectPanoptesOptions = "--nightly lhcb-prerelease"
-setupProjectPanoptesOptions  = "--nightly lhcb-prerelease Mon"
+setupProjectPanoptesOptions  = "--nightly lhcb-prerelease"
+#setupProjectPanoptesOptions = "--nightly lhcb-prerelease Wed"
 
 pathToScripts                = "/afs/cern.ch/lhcb/software/releases/LBSCRIPTS/prod/InstallArea/scripts"
 
-p = Popen("setenv HOME                               "+home+";"
-         +"source "+pathToScripts+"/LbLogin.csh;"
-         +"setenv User_release_area                  "+userReleaseArea+";"
-         +"source `which SetupProject.csh`           Panoptes "+setupProjectPanoptesVersion+" "+setupProjectPanoptesOptions+";"
+p = Popen("set HOME =                                "+home+";"
+         +"source "+pathToScripts+"/LbLogin.sh;"
+         +"set User_release_area =                   "+userReleaseArea+";"
+         +"source `which SetupProject.sh`            Panoptes "+setupProjectPanoptesVersion+" "+setupProjectPanoptesOptions+";"
          +"rm                                     -f env_var_settings.txt;"
          +"echo   $RICHMIRRORALIGNMENTGANGAROOT    > env_var_settings.txt ",
            shell=True,
-           executable="/bin/tcsh"
+           executable="/bin/bash"
          )
 sts = os.waitpid(p.pid, 0)
 
@@ -43,7 +43,6 @@ dDDB_tag                          = "head-20101026" # EventSelectorInput_R2Sel19
 #condDB_tag                       = "head-20101106" # EventSelectorInput_R2md198f_Collision10.py
 condDB_tag                        = "head-20101106" # EventSelectorInput_R2Sel199f_Collision10.py
 
-
 #setupProjectBrunelOpts           = "--use-grid"
 setupProjectBrunelOpts            = ""
 
@@ -100,8 +99,10 @@ deltaThetaWindow                  =  4
 
 coeffCalibrTilt                   =  0.3
 
+
 useTruth                          = ""
 
+
 useOffsetsFromMC                  = "false"
 #useOffsetsFromMC                 = "true"
 
@@ -110,13 +111,27 @@ verOffsetsFromMC                  = ""
 
 usePremisaligned                  = "false"
 
+
+verPremisaligned                  = ""
+
+
+
+
+
+
+
+
+
 #combinFitVariant                 = "slices"
 combinFitVariant                  = "surfaceB"
 
-startFromIteration                =  0
-
+#maximumNumberOfIterations        =  1
+#maximumNumberOfIterations        =  3
 maximumNumberOfIterations         =  5
 
+startFromIteration                =  0
+#startFromIteration               =  1
+
 richDetector                      =  2 # 1: RICH1, 2: RICH2
 
                                        # 0: universal magnification coefficients for all pairs
@@ -131,3 +146,5 @@ magnifCoeffMode                   =  2 # 2: individual for each pair
 
                                        # 0: Minuit
 solutionMethod                    =  1 # 1: algebraic
+
+AddedDB                           = [""]
diff --git a/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga_Collision11_settings.py b/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga_Collision11_settings.py
index b11cff32..8b4e1b71 100644
--- a/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga_Collision11_settings.py
+++ b/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga_Collision11_settings.py
@@ -61,7 +61,7 @@ setupProjectBrunelOpts            = ""
 #eventSelectorInputFile           =  RICHMIRRORALIGNMENTGANGAROOT+"/options/EventSelectorInput_R2SelEnh_Collision10.py"
 #eventSelectorInputFile           = "EventSelectorInput_R2SelEnh_Collision10.py"
 #eventSelectorInputFile           = "EventSelectorInput_R2md198f_Collision10.py"
-eventSelectorInputFile            = "LHCbCollision11Beam3500GeV-VeloClosed-MagDownRealData91000000RAW.py"
+eventSelectorInputFile            = "LHCbCollision11Beam3500GeV-VeloClosed-MagDownRealData91000000DST_Selv10_R2.py"
 
 #brunelEvtMax                     =  10
 #brunelPrintFreq                  =  1
@@ -142,3 +142,5 @@ magnifCoeffMode                   =  0 # 2: individual for each pair
 
                                        # 0: Minuit
 solutionMethod                    =  1 # 1: algebraic
+
+AddedDB                           = [""]
diff --git a/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga_MC10_settings.py b/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga_MC10_settings.py
index 63d982e8..6fb44dd0 100644
--- a/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga_MC10_settings.py
+++ b/Rich/RichMirrorAlignmentGanga/job/RichMirrorAlignmentGanga_MC10_settings.py
@@ -3,21 +3,22 @@ from   subprocess import *
 
 reactivate()
 
-userReleaseArea              =  os.getenv("User_release_area")
+userReleaseArea              = os.getenv("User_release_area")
+home                         = "/afs/cern.ch/user/a/asolomin"
 setupProjectPanoptesVersion  = "HEAD"
-#setupProjectPanoptesOptions = "--nightly lhcb-prerelease"
-setupProjectPanoptesOptions  = "--nightly lhcb-prerelease Wed"
-
-p = Popen("setenv HOME /afs/cern.ch/user/a/asolomin;"
-         +"source /afs/cern.ch/lhcb/software/releases/LBSCRIPTS/prod/InstallArea/scripts/LbLogin.csh;"
-         +"setenv User_release_area                                                                        "+userReleaseArea+";"
-        #+"source \`which SetupProject.csh\`                                                               Panoptes "+setupProjectPanoptesVersion+" "+setupProjectPanoptesOptions+";"
-        #+"source SetupProject.csh                                                                         Panoptes "+setupProjectPanoptesVersion+" "+setupProjectPanoptesOptions+";"
-         +"source /afs/cern.ch/lhcb/software/releases/LBSCRIPTS/prod/InstallArea/scripts/SetupProject.csh  Panoptes "+setupProjectPanoptesVersion+" "+setupProjectPanoptesOptions+";"
-         +"rm                                 -f                                                           env_var_settings.txt;"
-         +"echo  $RICHMIRRORALIGNMENTGANGAROOT >                                                           env_var_settings.txt ",
+setupProjectPanoptesOptions  = "--nightly lhcb-prerelease"
+#setupProjectPanoptesOptions = "--nightly lhcb-prerelease Wed"
+
+pathToScripts                = "/afs/cern.ch/lhcb/software/releases/LBSCRIPTS/prod/InstallArea/scripts"
+
+p = Popen("set HOME =                                "+home+";"
+         +"source "+pathToScripts+"/LbLogin.sh;"
+         +"set User_release_area =                   "+userReleaseArea+";"
+         +"source `which SetupProject.sh`            Panoptes "+setupProjectPanoptesVersion+" "+setupProjectPanoptesOptions+";"
+         +"rm                                     -f env_var_settings.txt;"
+         +"echo   $RICHMIRRORALIGNMENTGANGAROOT    > env_var_settings.txt ",
            shell=True,
-           executable="/bin/csh"
+           executable="/bin/bash"
          )
 sts = os.waitpid(p.pid, 0)
 
@@ -38,11 +39,18 @@ dDDB_tag                          = "head-20100407"
 condDB_tag                        = "sim-20100412-vc-md100"
 #condDB_tag                       = "sim-20100831-vc-md100"
 
+
+
+
+
+#setupProjectBrunelOpts           = "--use-grid"
 setupProjectBrunelOpts            = ""
 
 #eventSelectorInputFile           =  RICHMIRRORALIGNMENTGANGAROOT+"/options/EventSelectorInput_R2Sel100f7TeV_MC10.py"
 eventSelectorInputFile            = "EventSelectorInput_R2Sel100f7TeV_MC10.py"
 
+
+
 #brunelEvtMax                     =  10
 #brunelPrintFreq                  =  1
 #splitMaxFiles                    =  1
@@ -77,6 +85,9 @@ mirrCombinSubset                  = "48m48c_p12p43s09s30fix"
 
 thisCase                          = "100fSurB"
 
+
+
+
 dataVariant                       = "MC10"
 
 groupSlices                       =  1
@@ -88,6 +99,7 @@ deltaThetaWindow                  =  4
 
 coeffCalibrTilt                   =  0.3
 
+
 #useTruth                         = "MCTruP"
 useTruth                          = ""
 
@@ -97,13 +109,13 @@ useOffsetsFromMC                  = "false"
 verOffsetsFromMC                  = ""
 #verOffsetsFromMC                 = "100fSurBMC10"
 
-#usePremisaligned                 = "false"
-usePremisaligned                  = "true"
+usePremisaligned                  = "false"
+#usePremisaligned                 = "true"
 
-#verPremisaligned                 = ""
+verPremisaligned                  = ""
 #verPremisaligned                 = "Pre" # premisaligned but fixed mirrors are
                                           # zeros
-verPremisaligned                  = "Prf" # premisaligned and fixed mirrors'
+#verPremisaligned                 = "Prf" # premisaligned and fixed mirrors'
                                           # tilts at iteration 0 are equal to
                                           # initial tilts
 #verPremisaligned                 = "Pri" # premisaligned and all initial values
diff --git a/Rich/RichMirrorAlignmentGanga/options/Brunel_RichAlignMoni_Collision11-DST.py b/Rich/RichMirrorAlignmentGanga/options/Brunel_RichAlignMoni_Collision11-DST.py
index 0a7a7eb3..143356e8 100644
--- a/Rich/RichMirrorAlignmentGanga/options/Brunel_RichAlignMoni_Collision11-DST.py
+++ b/Rich/RichMirrorAlignmentGanga/options/Brunel_RichAlignMoni_Collision11-DST.py
@@ -16,16 +16,13 @@ Brunel ().EvtMax      =  1000
 Brunel ().PrintFreq   =  10
 Brunel ().OutputType  = "None"
 
-#--Again the Database problem...
-from Configurables import CondDB, LHCbApp
-CondDB(UseOracle = True)
+
 #LHCbApp().DDDBtag ="head-20110302"
 #LHCbApp().CondDBtag="head-20110318"
 # reconstruct RICH only
-#Brunel ().InitSequence      = ["Brunel"]
-Brunel().RecoSequence = ["Decoding","VELO","TT","IT","OT","Tr","Vertex","RICH"]
+Brunel ().InitSequence      = ["Brunel"]
 
-#Brunel ().RecoSequence      = ["RICH"]
+Brunel ().RecoSequence      = ["RICH"]
 #Brunel().MCCheckSequence   = ["RICH"]          # only when WithTruth
 Brunel ().Histograms        =  "OfflineExpress" # propagates down to Alignment
 #Brunel ().Histograms        =  "None"
@@ -88,14 +85,17 @@ from Configurables import RichAlignmentConf
 
 RichAlignmentConf ("OfflineRichMoni_RichAlignmentConf").setProp("Radiators", ["Rich1Gas", "Rich2Gas"])
 
+#For new selection sets min momentum to 20GeV in RICH1
+RichAlignmentConf ("OfflineRichMoni_RichAlignmentConf").setProp("MinTrackMomentum" , [-1,20,-1])
+                                                      
 # activate long list of segment combination histos to be prebooked for RICH2
 # this may propagate from the Brunel Cofiguration, though
-#RichAlignmentConf("OfflineRichMoni_RichAlignmentConf").setProp("Histograms", "OfflineExpress")
+RichAlignmentConf("OfflineRichMoni_RichAlignmentConf").setProp("Histograms", "OfflineExpress")
 ##############################################################################
-#from Configurables import DstConf
+from Configurables import DstConf
 ## enable DST unpacking: needed to get tracks
-#ApplicationMgr ().ExtSvc += ["DataOnDemandSvc"]
-#DstConf ().EnableUnpack = True
+ApplicationMgr ().ExtSvc += ["DataOnDemandSvc"]
+DstConf ().EnableUnpack = True
 ##############################################################################
 from Configurables import LHCbApp
 # db tags
@@ -106,3 +106,34 @@ from Configurables import CondDB
 from Configurables import CondDBAccessSvc
 
 
+# Prebooked Histograms
+from Configurables import Rich__Rec__MC__AlignmentMonitor
+R2Conf = Rich__Rec__MC__AlignmentMonitor("RichAlignMoniR2Gas")
+
+R2Conf.PreBookHistos = [
+"2719",                "2618",                "2517",               "2416",  "5539",                "5438",                "5337",                 "5236",
+
+
+                "2219","2218",                "2117",               "2016",  "5139",                "5038",                "4937", "4936",                 
+ "2315",               "2214",                "2113",               "2012",  "5135",                "5034",                "4933",                 "4832", 
+
+
+ "1915",               "1814",                "1713",               "1612",  "4735",                "4634",                "4533",                 "4432", 
+ "1911",               "1810",                "1709",               "1608",  "4731",                "4630",                "4529",                 "4428",
+
+
+ "1511",      "1411",  "1410",                "1310",  "1309",      "1209",  "1208",              "4331",  "4330",      "4230",  "4229",      "4129",  "4128",        "4028",
+
+
+ "1111",                "1010",               "0909",               "0808", "3931",               "3830",               "3729",               "3628",
+ "1107",                "1006",               "0905",               "0804", "3927",               "3826",               "3725",               "3624",
+
+
+ "0707",                "0606",               "0505",               "0404", "3527",               "3426",               "3325",               "3224",
+              "0603",  "0602",               "0501",                "0400", "3523",               "3422",               "3321",  "3320",                
+
+
+ "0303",                "0202",               "0101",               "0000", "3123",               "3022",               "2921",               "2820"
+]
+
+
diff --git a/Rich/RichMirrorAlignmentGanga/options/Brunel_RichAlignMoni_Collision11-RAW.py b/Rich/RichMirrorAlignmentGanga/options/Brunel_RichAlignMoni_Collision11-RAW.py
new file mode 100644
index 00000000..0a7a7eb3
--- /dev/null
+++ b/Rich/RichMirrorAlignmentGanga/options/Brunel_RichAlignMoni_Collision11-RAW.py
@@ -0,0 +1,108 @@
+from Brunel.Configuration import  *
+###############################################################################
+from GaudiKernel.ProcessJobOptions import importOptions
+#importOptions ("$APPCONFIGOPTS/Brunel/earlyData.py")
+
+#importOptions ("$APPCONFIGOPTS/Brunel/DataType-2011.py")
+#importOptions("$APPCONFIGOPTS/UseOracle.py")
+#importOptions("$APPCONFIGOPTS/DisableLFC.py")
+###############################################################################
+from Configurables import MessageSvc
+MessageSvc().Format = "% F%30W%S%7W%R%T %0W%M"
+#MessageSvc().OutputLevel = 7
+
+from Configurables import Brunel
+Brunel ().EvtMax      =  1000
+Brunel ().PrintFreq   =  10
+Brunel ().OutputType  = "None"
+
+#--Again the Database problem...
+from Configurables import CondDB, LHCbApp
+CondDB(UseOracle = True)
+#LHCbApp().DDDBtag ="head-20110302"
+#LHCbApp().CondDBtag="head-20110318"
+# reconstruct RICH only
+#Brunel ().InitSequence      = ["Brunel"]
+Brunel().RecoSequence = ["Decoding","VELO","TT","IT","OT","Tr","Vertex","RICH"]
+
+#Brunel ().RecoSequence      = ["RICH"]
+#Brunel().MCCheckSequence   = ["RICH"]          # only when WithTruth
+Brunel ().Histograms        =  "OfflineExpress" # propagates down to Alignment
+#Brunel ().Histograms        =  "None"
+Brunel().DataType           = "2011"
+
+
+from Configurables import RecMoniConf
+# RecMoniConf is defined in REC/REC_vXrY/RecSys/python/RecSys/Configuration.py
+RecMoniConf ().MoniSequence = ["RICH"]
+##############################################################################
+from Configurables import RichRecSysConf
+rConf  = RichRecSysConf("RichOfflineRec")
+# disable PID
+rConf .setProp("PidConfig", "None")
+# loose cuts
+# Date: 2010-04-15 09:47              By: Christopher R Jones <jonrob>
+# note that as long as you are using the "earlyData" switch (which you
+# should be for the moment) the Loose photon selection is the default
+# in Brunel
+rConf .photonConfig().SelectionMode = "Loose"
+
+from Configurables import RichRecQCConf
+# disable monitors that are enabled by default in "OfflineFull" mode,
+# except "AlignmentMonitoring"
+RichRecQCConf ("OfflineRichMoni").removeMonitor("L1SizeMonitoring"       )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("DBConsistencyCheck"     )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("HotPixelFinder"         )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("PidMonitoring"          )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("PixelMonitoring"        )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("TrackMonitoring"        )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("PhotonMonitoring"       )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("TracklessRingAngles"    )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("TracklessRingPeakSearch")
+RichRecQCConf ("OfflineRichMoni").removeMonitor("HPDImageShifts"         )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("DataDecodingErrors"     )
+#RichRecQCConf ("OfflineRichMoni").removeMonitor("AlignmentMonitoring"    )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("HPDIFBMonitoring"       )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("RichPixelPositions"     )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("HPDHitPlots"            )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("RichTrackGeometry"      )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("RichGhostTracks"        )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("RichCKThetaResolution"  )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("RichTrackResolution"    )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("RichPhotonSignal"       )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("RichTrackCKResolutions" )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("RichPhotonGeometry"     )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("PhotonRecoEfficiency"   )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("RichPhotonTrajectory"   )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("RichStereoFitterTests"  )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("RichRayTracingTests"    )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("RichDataObjectChecks"   )
+RichRecQCConf ("OfflineRichMoni").removeMonitor("RichRecoTiming"         )
+
+# disable producing NTuple
+RichRecQCConf ("OfflineRichMoni").setProp("NTupleProduce", False )
+
+from Configurables import RichAlignmentConf
+# choose RICH you want
+#RichAlignmentConf("OfflineRichMoni_RichAlignmentConf").setProp("Radiators", ["Rich1Gas"])
+
+RichAlignmentConf ("OfflineRichMoni_RichAlignmentConf").setProp("Radiators", ["Rich1Gas", "Rich2Gas"])
+
+# activate long list of segment combination histos to be prebooked for RICH2
+# this may propagate from the Brunel Cofiguration, though
+#RichAlignmentConf("OfflineRichMoni_RichAlignmentConf").setProp("Histograms", "OfflineExpress")
+##############################################################################
+#from Configurables import DstConf
+## enable DST unpacking: needed to get tracks
+#ApplicationMgr ().ExtSvc += ["DataOnDemandSvc"]
+#DstConf ().EnableUnpack = True
+##############################################################################
+from Configurables import LHCbApp
+# db tags
+#LHCbApp().DDDBtag   = "head-20100407"
+#LHCbApp().CondDBtag = "head-20100408"
+##############################################################################
+from Configurables import CondDB
+from Configurables import CondDBAccessSvc
+
+
diff --git a/Rich/RichMonitoringSys/cmt/requirements b/Rich/RichMonitoringSys/cmt/requirements
index 1f2fcdd8..6fb07571 100755
--- a/Rich/RichMonitoringSys/cmt/requirements
+++ b/Rich/RichMonitoringSys/cmt/requirements
@@ -4,7 +4,7 @@
 #============================================================================
 
 package           RichMonitoringSys
-version           v2r13
+version           v2r15
 
 #============================================================================
 # Structure, i.e. directories to process. 
diff --git a/Rich/RichMonitoringSys/cmt/version.cmt b/Rich/RichMonitoringSys/cmt/version.cmt
index 21bc6b40..919a7d30 100644
--- a/Rich/RichMonitoringSys/cmt/version.cmt
+++ b/Rich/RichMonitoringSys/cmt/version.cmt
@@ -1 +1 @@
-v2r13
+v2r15
diff --git a/Rich/RichMonitoringSys/doc/release.notes b/Rich/RichMonitoringSys/doc/release.notes
index 55f2d0e2..61b6fdba 100755
--- a/Rich/RichMonitoringSys/doc/release.notes
+++ b/Rich/RichMonitoringSys/doc/release.notes
@@ -4,6 +4,17 @@
 ! Purpose     : Coordinates Rich (online) monitoring packages
 !-----------------------------------------------------------------------------
 
+====================== v2r15 ==============================================
+! 2011-05-31 - Chris Jones
+ - Various tweeks to the options, to enable event snapshots for DAQ and NHit
+   events.
+
+! 2011-03-16 - Jordi Garra Tic�
+ - Removed the MonitorRate configuration variable, since it has never been used.
+
+! 2010-11-18 - Ulrich Kerzel
+- fix compiler warnings in EventSnapshot.py
+
 ====================== v2r13 ==============================================
 
 ====================== v2r12 ==============================================
diff --git a/Rich/RichMonitoringSys/python/RichMonitoringSys/Configuration.py b/Rich/RichMonitoringSys/python/RichMonitoringSys/Configuration.py
index c718dd8e..3fc44bb8 100755
--- a/Rich/RichMonitoringSys/python/RichMonitoringSys/Configuration.py
+++ b/Rich/RichMonitoringSys/python/RichMonitoringSys/Configuration.py
@@ -68,11 +68,11 @@ class RichMonitoringSysConf(RichConfigurableUser):
        ,"SendEventSnapshots"                      :   True      # Send event snapshots when event errors are detected
        ,"SendNHitEventSnapshots"                  :   True      # Send event snapshots when event errors are detected
        ,"SendDaqEventSnapshots"                   :   True  
-       ,"SnapshotUpdateInterval"                  :    60       # time after which to send another snapshot (in seconds)
+       ,"SnapshotUpdateInterval"                  :   300       # time after which to send another snapshot (in seconds)
        ,"SnapshotNBins"                           :   200
        ,"SnapshotRingType"                        : "Isolated" 
        ,"Context"                                 : "Offline"   # The mode (online, offline, calibration)
-       ,"RawEventLocations"                       : ["" ]         # The RawEvent TES locations to use ( empty means defaults)
+       ,"RawEventLocations"                       : [""]        # The RawEvent TES locations to use ( empty means defaults)
        ,"OutputLevelNhits"                        :      3
        ,"OutputLevelDAQMon"                       :      3
        ,"OutputLevelHitmaps"                      :      3
@@ -83,7 +83,8 @@ class RichMonitoringSysConf(RichConfigurableUser):
        ,"OutputLevelDisable"                      :      3
        ,"OutputLevelHPDImageMovement"             :      3
        ,"DaqMon_MonitorBXID"                      :   True
-       ,"DaqMon_MaxErrorMessages"                 :    500
+       ,"DaqMon_UpdateTimerInterval"              :   300
+       ,"DaqMon_MaxErrorMessages"                 :   500
        ,"DaqMon_PrintMessages"                    :   False
        ,"DaqMon_RemoveFaultyHPD"                  :   True # send disable commands to UKL1
        ,"DaqMon_Plot2DHisto"                      :   False
@@ -93,10 +94,8 @@ class RichMonitoringSysConf(RichConfigurableUser):
        ,"HitMapsMon_HighResHitMaps"               : False # True to enable the production of the 2D histogram showing the hits per RICH panel with 1 HPD pixel per bin.
        ,"HitMapsMon_IndividualMaps"               : False # True to produce a 2D histogram with pixel per bin for each individual histogram seen in the data.
        ,"HitMapsMon_ScaleFactor"                  : -1 # The number of pixels to place per bin in the low resolution hit map. Affects the x and y axis simultaneously. -1 to take algorithm default.
-       ,"HitMapsMon_MonFreq"                      :  1     # Monitor every nth event
        ,"HitMapsMon_HotPixEnabled"                : True  # If True then on every monitored event we will update the hot pixel mask.
        ,"HitMapsMon_HPDCountEnabled"              : True  # Look for Hot/Cold HPDs in every monitored event if True        
-       ,"NHitMon_MonFreq"                         :  1
        ,"NHitMon_RemoveFaultyHPD"                 :  False # send disable commands to UKL1
        ,"NHitMon_HitThreshold"                    : 50     # Threshold for too many hits before sending disable command to UKL1  
        ,"NHitMon_FillHistograms"                  :  True  # fill histograms (inclusive / trend) 
@@ -117,7 +116,8 @@ class RichMonitoringSysConf(RichConfigurableUser):
        ,"HPDImageMovement_HistoUpdateFrequency"   : 1000   #
        ,"HPDImageMovement_DisplaySmartIDWarnings" : False  #
        ,"HPDImageMovement_UseCutBasedMethod"      : False  #
-       ,"HPDImageMovement_CutThreshold"           : 0.1 
+       ,"HPDImageMovement_CutThreshold"           : 0.1
+       ,"CalibMon_UpdateTimerInterval"            : 300
         }
 
     def _addOrRemoveMonitor(self,histo,flag):
@@ -140,7 +140,6 @@ class RichMonitoringSysConf(RichConfigurableUser):
             physFilter       = HltRoutingBitsFilter ("PhysicsFilter", RequireMask = [0x0, 0x4, 0x0])
             MonSeq.Members  += [ physFilter ]
         
-        
         self.configureSequences(MonSeq)
 
     def configureSequences(self,sequence):
@@ -289,10 +288,9 @@ class RichMonitoringSysConf(RichConfigurableUser):
             RichEventSnapshotConf().SnapshotSequencer     = RichEventSnapShotSeq
 
     ## Config an instance of the NHit monitor
-    def nHitMonitor(self,name,taeLocs, TriggerTypes):
+    def nHitMonitor(self,name,taeLocs,TriggerTypes):
         RichNHitMon                           = Rich__Mon__HPDNHitMonitor(name)
         RichNHitMon.RawEventLocations         = taeLocs
-        RichNHitMon.MonitorRate               = self.getProp("NHitMon_MonFreq")
         RichNHitMon.FillHistos                = self.getProp("NHitMon_FillHistograms")
         RichNHitMon.ExtendedVerbose           = self.getProp("NHitMon_ExtendedVerbose")
         RichNHitMon.HistoNHitMin              = self.getProp("NHitMon_HistoNHitMin")
@@ -314,6 +312,9 @@ class RichMonitoringSysConf(RichConfigurableUser):
 
         # Want all sub-sequence to run in all cases
         sequence.IgnoreFilterPassed = True
+
+        taeLocs                 = self.getProp("RawEventLocations")
+        triggerTypes            = self.getProp("NHitMon_TriggerTypes")
                             
         # monitor HPD image movement
         if self.getProp("MonitorImageMovements"):
@@ -322,68 +323,34 @@ class RichMonitoringSysConf(RichConfigurableUser):
             seq.IgnoreFilterPassed  = True
             seq.Members            += [self.imageMovementMonitor("RichHPDImgMove")]
             sequence.Members       += [seq]
-            
-        # monitor number of hits
-        if self.getProp("MonitorNhits") :
-            seq                     = GaudiSequencer("NHitSeq")
-            seq.MeasureTime         = True
-            seq.IgnoreFilterPassed  = True
-            sequence.Members       += [seq]
-            # Monitor for all locations combined
-            taeLocs                 = self.getProp("RawEventLocations")
-            triggerTypes            = self.getProp("NHitMon_TriggerTypes")
-            taeseq                  = GaudiSequencer("NHitCombinedEventSeq")
-            taeseq.MeasureTime      = True
-            seq.Members            += [taeseq]
-            taeseq.Members         += [ self.nHitMonitor("CombinedNHitMonitor",taeLocs, triggerTypes) ]
-            # SnapShots
-            snapShots               = self.getProp("SendNHitEventSnapshots")
-            if snapShots :
-                snap                   = Rich__Mon__SingleEventSnapshot("CombinedNHitEventSnapshot")
-                snap.Message           = "HPD Disabled in this event :("
-                snap.RawEventLocations = taeLocs
-                taeseq.Members        += [snap]
-            # Loop over configured Trigger Types    
-            for triggerType in triggerTypes:
-                # Loop over configured TAE locations and make one sequence per location
-                for taeLoc in taeLocs :
-                    taeLocName = taeLoc
-                    if taeLocName == "" : taeLocName = "Central"
-                    taeseq             = GaudiSequencer("NHit"+taeLocName+"Trigger"+str(triggerType)+"EventSeq")
-                    taeseq.MeasureTime = True
-                    seq.Members       += [taeseq]
-                    taeseq.Members    += [ self.nHitMonitor(taeLocName+"Trigger"+str(triggerType)+"NHitMonitor",[taeLoc],[triggerType]) ]
-                    if snapShots :
-                        snap                   = Rich__Mon__SingleEventSnapshot(taeLoc+"Trigger"+str(triggerType)+"NHitEventSnapshot")
-                        snap.Message           = "HPD Disabled in this event :("
-                        snap.RawEventLocations = [taeLoc]
-                        taeseq.Members        += [snap]
 
         if self.getProp("MonitorDAQ") :
+
             seq = GaudiSequencer("DAQSeq")
             seq.MeasureTime                 = True
             sequence.Members               += [seq]
+            
             # CRJ : Add Data and DB consistency check
             # WIll be run in Brunel online, so eventually not needed here ...
             if self.getProp("RawDataDBCheck"):
                 from Configurables import Rich__DAQ__DataDBCheck
                 seq.Members += [Rich__DAQ__DataDBCheck("RichRawDataDBCheck")]
-                
+                            
             # Online DAQ monitor - loop over configured TAE locations and make one sequence per location
             for taeLoc in taeLocs :
                 taeLocName = taeLoc
                 if taeLocName == "" : taeLocName = "Central"
                 taeseq             = GaudiSequencer("DAQMonitor"+taeLocName+"EventSeq")
                 taeseq.MeasureTime = True
-                seq.Members       += [taeseq]                
-                RichDAQMon                      = Rich__Mon__DAQMonitor("DAQMonitor"+taeLocName)
-                RichDAQMon.UpdateTimerInterval  =     10
-                RichDAQMon.MonitorRate          =      1
-                RichDAQMon.SendAlertMessages    =   True
+                seq.Members       += [taeseq]
+                daqMonName                      = "DAQMonitor"+taeLocName
+                RichDAQMon                      =  Rich__Mon__DAQMonitor(daqMonName)
+                RichDAQMon.UpdateTimerInterval  =  self.getProp("DaqMon_UpdateTimerInterval") 
+                RichDAQMon.SendAlertMessages    =  True
                 RichDAQMon.SendAlertDirect      =  False
-                RichDAQMon.OdinMinGpsTime       =      1
-                RichDAQMon.AlertLevelBxID       =      3
-                RichDAQMon.CheckOdin            =   True
+                RichDAQMon.OdinMinGpsTime       =  1
+                RichDAQMon.AlertLevelBxID       =  3
+                RichDAQMon.CheckOdin            =  True
                 RichDAQMon.RemoveFaultyHpdUKL1  =  self.getProp("DaqMon_RemoveFaultyHPD") 
                 RichDAQMon.OutputLevel          =  self.getProp("OutputLevelDAQMon")
                 RichDAQMon.MonitorBxID          =  self.getProp("DaqMon_MonitorBXID")
@@ -392,12 +359,51 @@ class RichMonitoringSysConf(RichConfigurableUser):
                 RichDAQMon.PrintMessages        =  self.getProp("DaqMon_PrintMessages")
                 RichDAQMon.TAELocation          =  taeLoc
                 taeseq.Members                 +=  [RichDAQMon]
-                snapShots                       =  self.getProp("SendDaqEventSnapshots")
-                if snapShots :
-                    snap = Rich__Mon__SingleEventSnapshot(taeLoc+"DAQErrSnapshots")
+                if taeLoc == "" and self.getProp("SendDaqEventSnapshots") :
+                    snap = Rich__Mon__SingleEventSnapshot(daqMonName+"EvtSnapshot")
                     snap.Message           = "DAQ Error in this event."
-                    snap.RawEventLocatons  = [taeLoc]
-                    seq.Members           += [snap]
+                    snap.RawEventLocations = [taeLoc]
+                    snap.RingLocation      = "" # No rings to show
+                    snap.MinHitRich        = 0
+                    snap.MaxHitRich        = 999999
+                    snap.UpdateInterval    = 60
+                    snap.MinRings          = 0
+                    taeseq.Members        += [snap]
+
+        # monitor number of hits
+        if self.getProp("MonitorNhits") :
+
+            snapShots               = self.getProp("SendNHitEventSnapshots")                 
+            seq                     = GaudiSequencer("NHitSeq")
+            seq.MeasureTime         = True
+            seq.IgnoreFilterPassed  = True
+            sequence.Members       += [seq]
+            moniname                = "CombinedNHitMonitor"
+            taeseq                  = GaudiSequencer(moniname+"Seq")
+            taeseq.MeasureTime      = True
+            seq.Members            += [taeseq]
+            taeseq.Members         += [ self.nHitMonitor(moniname,taeLocs,triggerTypes) ]
+            if snapShots :
+                snap                   = Rich__Mon__SingleEventSnapshot(moniname+"EvtSnapshot")
+                snap.Message           = moniname + " event snapshot"
+                snap.RingLocation      = "" # No rings to show
+                snap.RawEventLocations = taeLocs
+                snap.MinHitRich        = 0
+                snap.MaxHitRich        = 999999
+                snap.UpdateInterval    = 60
+                snap.MinRings          = 0
+                taeseq.Members        += [snap]
+            # Loop over configured Trigger Types    
+            for triggerType in triggerTypes:
+                # Loop over configured TAE locations and make one sequence per location
+                for taeLoc in taeLocs :
+                    taeLocName = taeLoc
+                    if taeLocName == "" : taeLocName = "Central"
+                    moniname           = taeLocName+"Trigger"+str(triggerType)+"NHitMonitor"
+                    taeseq             = GaudiSequencer(moniname+"Seq")
+                    taeseq.MeasureTime = True
+                    seq.Members       += [taeseq]
+                    taeseq.Members    += [ self.nHitMonitor(moniname,[taeLoc],[triggerType]) ]
 
         if self.getProp("MonitorHitMaps") :
             RichHitMapMonitorConf().HitMapMonSequencer = sequence
@@ -405,7 +411,6 @@ class RichMonitoringSysConf(RichConfigurableUser):
                                                          "HitMapsMon_LowResHitMaps",
                                                          "HitMapsMon_HighResHitMaps",
                                                          "HitMapsMon_IndividualMaps",
-                                                         "HitMapsMon_MonFreq",
                                                          "OutputLevelHitmaps",
                                                          "HitMapsMon_HotPixEnabled",
                                                          "HitMapsMon_HPDCountEnabled"])
@@ -437,19 +442,17 @@ class RichMonitoringSysConf(RichConfigurableUser):
                                                          "HitMapsMon_LowResHitMaps",
                                                          "HitMapsMon_HighResHitMaps",
                                                          "HitMapsMon_IndividualMaps",
-                                                         "HitMapsMon_MonFreq",
                                                          "OutputLevelHitmaps",
                                                          "HitMapsMon_HotPixEnabled",
                                                          "HitMapsMon_HPDCountEnabled"])
 
         if self.getProp("MonitorCalibration") :
             RichCalibMon = Rich__Mon__CalibMonitor("RichCalibMon")
-            RichCalibMon.UpdateTimerInterval    =     60
-            RichCalibMon.MonitorRate            =      1
-            RichCalibMon.FillHistos             =   True
+            RichCalibMon.UpdateTimerInterval    =  self.getProp("CalibMon_UpdateTimerInterval") 
+            RichCalibMon.FillHistos             =  True
             RichCalibMon.RemoveFaultyHpdUKL1    =  False
             RichCalibMon.ExtendedVerbose        =  False
-            RichCalibMon.OutputLevel            = self.getProp("OutputLevelCalibration")
+            RichCalibMon.OutputLevel            =  self.getProp("OutputLevelCalibration")
             sequence.Members += [RichCalibMon]
 
 
@@ -487,15 +490,14 @@ class RichMonitoringSysConf(RichConfigurableUser):
             from Configurables import Rich__Mon__TestPatternMonitor
             testPatternMon              = Rich__Mon__TestPatternMonitor("RichTestPatternMon")
             testPatternMon.OutputLevel  = self.getProp("OutputLevelTestPattern")
+            testPatternMon.UpdateTimerInterval = self.getProp("CalibMon_UpdateTimerInterval") 
             sequence.Members += [testPatternMon]
-    # def testPatternMonitor()
 
     def ionfeedbackMonitor(self, sequence):
         from Configurables import Rich__Mon__HPDIonFeedbackMoni
         RichIFBMon                       = Rich__Mon__HPDIonFeedbackMoni("RichHPDIFBMoni")
         RichIFBMon.OutputLevel           = self.getProp("OutputLevelIFB")
         RichIFBMon.IsDark                = True
-        RichIFBMon.MonitorRate           = 1
         RichIFBMon.EventSize             = 3000000
         RichIFBMon.IonFeedbackALICE      = 5
         RichIFBMon.IonFeedbackLHCB       = 5
diff --git a/Rich/RichMonitoringSys/python/RichMonitoringSys/EventSnapshot.py b/Rich/RichMonitoringSys/python/RichMonitoringSys/EventSnapshot.py
index d48ccdd4..9e386472 100755
--- a/Rich/RichMonitoringSys/python/RichMonitoringSys/EventSnapshot.py
+++ b/Rich/RichMonitoringSys/python/RichMonitoringSys/EventSnapshot.py
@@ -8,7 +8,7 @@ from Configurables import ( GaudiSequencer,
 #  Event 'snapshot' configuration
 #  @author Chris Jones  (Christopher.Rob.Jones@cern.ch)
 #  @date   15/08/2008
-class RichEventSnapshotConf(RichConfigurableUser):
+class RichEventSnapshotConf( RichConfigurableUser ):
 
     __used_configurables__ = [ GaudiSequencer ]
 
diff --git a/Rich/RichMonitoringTools/cmt/requirements b/Rich/RichMonitoringTools/cmt/requirements
index c03e6749..65df8aa2 100755
--- a/Rich/RichMonitoringTools/cmt/requirements
+++ b/Rich/RichMonitoringTools/cmt/requirements
@@ -3,7 +3,7 @@
 # Maintainer : Ulrich Kerzel
 #============================================================================
 package           RichMonitoringTools
-version           v2r15
+version           v2r17
 
 #============================================================================
 # Structure, i.e. directories to process. 
diff --git a/Rich/RichMonitoringTools/cmt/version.cmt b/Rich/RichMonitoringTools/cmt/version.cmt
index 919a7d30..d5a1aea9 100644
--- a/Rich/RichMonitoringTools/cmt/version.cmt
+++ b/Rich/RichMonitoringTools/cmt/version.cmt
@@ -1 +1 @@
-v2r15
+v2r17
diff --git a/Rich/RichMonitoringTools/doc/release.notes b/Rich/RichMonitoringTools/doc/release.notes
index abaa3b52..08bb90af 100755
--- a/Rich/RichMonitoringTools/doc/release.notes
+++ b/Rich/RichMonitoringTools/doc/release.notes
@@ -4,6 +4,19 @@
 ! Purpose     : Tools for Rich (online) Monitoring
 !-----------------------------------------------------------------------------
 
+====================== v2r17 =============================================
+! 2011-05-31 - Chris Jones
+ - Don't send Warnings/Errors when an HPD DB look up fails, as this might 
+   upset the central shifters, and is expected if fake HPDs are enabled.
+   Instead send an info message.
+ - Fix a few potential problems when methods that fail due to DB look up errors
+   return invalid data.
+
+! 2011-04-05 - Chris Jones
+ - Some minor cleaning up of HpdUkL1DisableTool
+
+! 2011-03-31 - Chris Jones
+ - Clear m_disableCandidates on run change in HpdUkL1DisableTool
 
 ====================== v2r15 =============================================
 ! 2011-03-16 - Jordi Garra Tico
diff --git a/Rich/RichMonitoringTools/src/HpdUkL1DisableTool.cpp b/Rich/RichMonitoringTools/src/HpdUkL1DisableTool.cpp
index 83a95e7c..e0782048 100755
--- a/Rich/RichMonitoringTools/src/HpdUkL1DisableTool.cpp
+++ b/Rich/RichMonitoringTools/src/HpdUkL1DisableTool.cpp
@@ -40,14 +40,13 @@ DECLARE_TOOL_FACTORY( HpdUkL1DisableTool )
   declareProperty( "FailureRateThreshold", m_failureRateThreshold = .01 );
   declareProperty( "Plot2DHisto"         , m_Plot2DHisto         = false);
   declareProperty( "SendDisableCommands" , m_SendDisableCommands = true );
-  declareProperty( "HistoryTime"         , m_HistoryTime         = 10*60); // 10minutes * seconds
+  declareProperty( "HistoryTime"         , m_HistoryTime         = 10*60); // 10mins * seconds
   declareProperty( "KeepDisabledHPDs"    , m_KeepDisabledHPDs    = true );
   declareProperty( "ClearListAtNewRun"   , m_ClearListAtNewRun   = true );
   declareProperty( "UpdateTimerInterval" , m_UpdateTimerInterval =    30);
 
   ++s_HpdUkL1DisableTool_InstanceCounter;
-
-} // constructor
+} 
 
 //=============================================================================
 // Destructor
@@ -55,38 +54,36 @@ DECLARE_TOOL_FACTORY( HpdUkL1DisableTool )
 Rich::Mon::HpdUkL1DisableTool::~HpdUkL1DisableTool() {}
 
 //=============================================================================
-StatusCode Rich::Mon::HpdUkL1DisableTool::initialize() {
-
-  StatusCode sc = Rich::HistoToolBase::initialize();
+StatusCode Rich::Mon::HpdUkL1DisableTool::initialize() 
+{
+  const StatusCode sc = Rich::HistoToolBase::initialize();
   if (sc.isFailure()) return sc;
 
   //
   // check instances
   //
-  info() << "There are now " << s_HpdUkL1DisableTool_InstanceCounter 
+  info() << "There are now " << s_HpdUkL1DisableTool_InstanceCounter
          << " instances of Rich::Mon::HpdUkL1DisableTool" << endmsg;
-  if (s_HpdUkL1DisableTool_InstanceCounter > 1) {
-    Error("Only one instance of Rich::Mon::HpdUkL1DisableTool allowed");
-    return StatusCode::FAILURE;
-  } //if
+  if (s_HpdUkL1DisableTool_InstanceCounter > 1)
+  {
+    return Error("Only one instance of Rich::Mon::HpdUkL1DisableTool allowed");
+  }
 
   //
   // Partition
   //
-  char* partitionName = getenv("PARTITION");
-
-  if (partitionName) {
+  const char * partitionName = getenv("PARTITION");
+  m_Name = name();
+  if ( partitionName ) 
+  {
     info() << "running in partition " << std::string(partitionName) << endmsg;
-    m_Name = name() + std::string(partitionName);
-  } else {
-    m_Name = name();
+    m_Name += std::string(partitionName);
   }
 
   //
   // private DIM Services
   //
 
-
   if ( getenv("DIM_DNS_NODE") )
   {
     const std::string& utgid   = RTL::processName();
@@ -130,8 +127,7 @@ StatusCode Rich::Mon::HpdUkL1DisableTool::initialize() {
   // subscribe to incidents
   //
 
-  // incSvc()->addListener( this, IncidentType::BeginEvent );
-  incSvc()->addListener( this, IncidentType::BeginRun   );
+  //incSvc()->addListener( this, IncidentType::BeginRun   ); // CRJ : Not listened to any more
   incSvc()->addListener( this, IncidentType::BeginEvent );
   incSvc()->addListener( this, IncidentType::EndEvent   );
   incSvc()->addListener( this, IncidentType::RunChange  );
@@ -147,8 +143,7 @@ StatusCode Rich::Mon::HpdUkL1DisableTool::initialize() {
   m_CamTool = tool<ICameraTool>("CameraTool");
   verbose() << "send message to CAMERA" << endmsg;
   m_CamTool->Append        ("TEXT",m_Name.c_str());
-  m_CamTool->SendAndClearTS(ICameraTool::INFO, m_Name, "Initialized");
-
+  m_CamTool->SendAndClearTS(ICameraTool::INFO, m_Name, "Initialised");
 
   //
   // print configuration
@@ -164,22 +159,20 @@ StatusCode Rich::Mon::HpdUkL1DisableTool::initialize() {
   // book histograms
   //
 
-  if (m_Plot2DHisto) {
+  if (m_Plot2DHisto) 
+  {
     verbose() << "book histograms with disabled HPDs" << endmsg;
     Book2DHisto (Rich::Rich1, Rich::top);
     Book2DHisto (Rich::Rich1, Rich::bottom);
     Book2DHisto (Rich::Rich2, Rich::left );
     Book2DHisto (Rich::Rich2, Rich::right );
-  } //if
-
+  }
 
   //
   // get Time of startup
   //
-  m_TimeStart      = time(NULL);
   m_TimeLastUpdate = time(NULL);
 
-
   ClearHPDList();
 
   return sc;
@@ -189,6 +182,7 @@ StatusCode Rich::Mon::HpdUkL1DisableTool::initialize() {
 StatusCode Rich::Mon::HpdUkL1DisableTool::finalize()
 {
   delete m_DimService;
+  m_DimService = NULL;
   return Rich::HistoToolBase::finalize();
 } // finalize
 //=============================================================================
@@ -203,26 +197,28 @@ void Rich::Mon::HpdUkL1DisableTool::SetDisableThreshold(const int threshold)
 //=============================================================================
 void Rich::Mon::HpdUkL1DisableTool::DisableHPD (const LHCb::RichSmartID &smartID) {
 
-  if (smartID.isValid()) {
+  if (smartID.isValid()) 
+  {
 
     // get current time - seconds since 1st Jan. 1970
-    time_t currentTime = time(NULL);
+    const time_t currentTime = time(NULL);
 
     m_HpdMap.insert(std::pair<LHCb::RichSmartID, time_t>(smartID, currentTime));
 
-    if ( msgLevel(MSG::VERBOSE) ) {
-      struct tm * timeinfo;
-      timeinfo = localtime ( &currentTime );
-      std::string timeString =
-        boost::lexical_cast<std::string>(timeinfo->tm_hour-1) + " h " +
-        boost::lexical_cast<std::string>(timeinfo->tm_min)    + " min " +
-        boost::lexical_cast<std::string>(timeinfo->tm_sec)    +  " s";
-
-      verbose() << "HPD " << smartID << " is asked to be removed from data at time " << timeString  << endmsg;
-    } //if verbose
+    if ( msgLevel(MSG::VERBOSE) )
+    {
+      struct tm * timeinfo = localtime ( &currentTime );
+      verbose() << smartID << " is asked to be removed from data at time " 
+                << timeinfo->tm_hour-1 << " h "
+                << timeinfo->tm_min   << " min "
+                << timeinfo->tm_sec   <<  " s"     
+                << endmsg;
+    }
 
-  } else {
-    Error("Cannot suppress an HPD with an invalid RichSmartID identifier");
+  }
+  else 
+  {
+    Error("Cannot suppress an HPD with an invalid RichSmartID identifier").ignore();
   } // if isValid
 
 } // void DisableHPD
@@ -271,10 +267,11 @@ void Rich::Mon::HpdUkL1DisableTool::DisableHPD (const LHCb::RichSmartID &smartID
 // } // void DisableHPD
 //
 
-const LHCb::RichSmartID Rich::Mon::HpdUkL1DisableTool::smartId( const Rich::DAQ::Level1LogicalID&      l1LogicalID,
-                                                                const Rich::DAQ::L1InputWithinIngress& l1InputIngress,
-                                                                const Rich::DAQ::L1IngressID&          ingressID,
-                                                                const Rich::DetectorType&              richDetector )
+const LHCb::RichSmartID 
+Rich::Mon::HpdUkL1DisableTool::smartId( const Rich::DAQ::Level1LogicalID&      l1LogicalID,
+                                        const Rich::DAQ::L1InputWithinIngress& l1InputIngress,
+                                        const Rich::DAQ::L1IngressID&          ingressID,
+                                        const Rich::DetectorType&              richDetector )
 {
   LHCb::RichSmartID smartID;
 
@@ -288,11 +285,13 @@ const LHCb::RichSmartID Rich::Mon::HpdUkL1DisableTool::smartId( const Rich::DAQ:
   }
   catch ( const GaudiException & excpt )
   {
-    Warning( excpt.message() + " " + excpt.tag() ).ignore();
+    if (msgLevel(MSG::DEBUG)) debug() << excpt.message() << " " << excpt.tag() << endmsg;
+    //Warning( excpt.message() + " " + excpt.tag() ).ignore();
   }
   catch ( const std::exception & excpt )
   {
-    Warning( excpt.what() ).ignore();
+    if (msgLevel(MSG::DEBUG)) debug() << excpt.what() << endmsg;
+    //Warning( excpt.what() ).ignore();
   }
 
   return smartID;
@@ -315,7 +314,6 @@ void  Rich::Mon::HpdUkL1DisableTool::DisableHPD (const Rich::DAQ::Level1LogicalI
 
   // Build smartID.
   const LHCb::RichSmartID smartID = smartId( l1LogicalID, l1InputIngress, ingressID, richDetector );
-
   if ( smartID.isValid() )
   {
     // Allocate memory for the buffer of the indices of the events for a HPD candidate for disabling.
@@ -327,35 +325,39 @@ void  Rich::Mon::HpdUkL1DisableTool::DisableHPD (const Rich::DAQ::Level1LogicalI
   }
   else
   {
-    Error( "Cannot suppress an HPD with an invalid RichSmartID identifier" );
+    if (msgLevel(MSG::DEBUG)) debug() << "Cannot suppress an HPD with an invalid RichSmartID identifier" << endmsg;
+    //Error( "Cannot suppress an HPD with an invalid RichSmartID identifier" );
   }
 }
 
 
 //=============================================================================
 //=============================================================================
-void Rich::Mon::HpdUkL1DisableTool::ReportHPD (const LHCb::RichSmartID &smartID) {
+void Rich::Mon::HpdUkL1DisableTool::ReportHPD (const LHCb::RichSmartID &smartID) 
+{
 
-  if (smartID.isValid()) {
+  if ( smartID.isValid() ) 
+  {
 
     // get current time - seconds since 1st Jan. 1970
-    time_t currentTime = time(NULL);
+    const time_t currentTime = time(NULL);
 
     m_HpdErrorReportMap.insert(std::pair<LHCb::RichSmartID, time_t>(smartID, currentTime));
 
-    if ( msgLevel(MSG::VERBOSE) ) {
-      struct tm * timeinfo;
-      timeinfo = localtime ( &currentTime );
-      std::string timeString =
-        boost::lexical_cast<std::string>(timeinfo->tm_hour-1) + " h " +
-        boost::lexical_cast<std::string>(timeinfo->tm_min)    + " min " +
-        boost::lexical_cast<std::string>(timeinfo->tm_sec)    +  " s";
-
-      verbose() << "HPD " << smartID << " is reported with eror at time " << timeString  << endmsg;
+    if ( msgLevel(MSG::VERBOSE) ) 
+    {
+      struct tm * timeinfo = localtime ( &currentTime );
+      verbose() << smartID << " is reported with eror at time "
+                << timeinfo->tm_hour-1 << " h "
+                << timeinfo->tm_min   << " min "
+                << timeinfo->tm_sec   <<  " s"     
+                << endmsg;
     } //if verbose
 
-  } else {
-    Error("Cannot suppress an HPD with an invalid RichSmartID identifier");
+  } 
+  else
+  {
+    Error("Cannot suppress an HPD with an invalid RichSmartID identifier").ignore();
   } // if isValid
 
 } // void DisableHPD
@@ -365,8 +367,8 @@ void Rich::Mon::HpdUkL1DisableTool::ReportHPD (const LHCb::RichSmartID &smartID)
 void  Rich::Mon::HpdUkL1DisableTool::ReportHPD (const Rich::DAQ::Level1LogicalID      &l1LogicalID,
                                                 const Rich::DAQ::L1InputWithinIngress &l1InputIngress,
                                                 const Rich::DAQ::L1IngressID          &ingressID,
-                                                const Rich::DetectorType              &richDetector) {
-
+                                                const Rich::DetectorType              &richDetector) 
+{
 
   //
   //build SmartID
@@ -394,37 +396,43 @@ void  Rich::Mon::HpdUkL1DisableTool::ReportHPD (const Rich::DAQ::Level1LogicalID
   }
   catch ( const GaudiException & excpt )
   {
-    Warning( excpt.message() + " " + excpt.tag() ).ignore();
+    if (msgLevel(MSG::DEBUG)) debug() << excpt.message() << " " << excpt.tag() << endmsg;
+    //Warning( excpt.message() + " " + excpt.tag() ).ignore();
   }
   catch ( const std::exception & excpt )
   {
-    Warning( excpt.what() ).ignore();
+    if (msgLevel(MSG::DEBUG)) debug() << excpt.what() << endmsg;
+    //Warning( excpt.what() ).ignore();
   }
 
 } // void DisableHPD
 //=============================================================================
 //=============================================================================
 
-void Rich::Mon::HpdUkL1DisableTool::ClearHPDList () {
+void Rich::Mon::HpdUkL1DisableTool::ClearHPDList ()
+{
+  info() << "Reset HPDs to remove from UKL1 data stream" << endmsg;
 
-  info() << "Reset HPDs to remove from UIKL1 data stream" << endmsg;
   m_HpdMap.clear();
   m_HpdErrorReportMap.clear();
   m_DisabledHpdMap.clear();
   m_DisabledHpdString.clear();
+  m_disableCandidates.clear();
 
-  if (m_Plot2DHisto) {
-    verbose() << "clear histograms " << endmsg;
-    std::string R1TopDisable    = GetRichPanelHistName(Rich::Rich1, Rich::top);
-    std::string R1BottomDisable = GetRichPanelHistName(Rich::Rich1, Rich::bottom);
-    std::string R2LeftDisable   = GetRichPanelHistName(Rich::Rich2, Rich::left);
-    std::string R2RightDisable  = GetRichPanelHistName(Rich::Rich2, Rich::right);
+  if (m_Plot2DHisto) 
+  {
+    if ( msgLevel(MSG::VERBOSE) )
+      verbose() << "clear histograms " << endmsg;
 
-    std::string R1TopError      = GetRichPanelHistName(Rich::Rich1, Rich::top   , "HPDs with errors in ");
-    std::string R1BottomError   = GetRichPanelHistName(Rich::Rich1, Rich::bottom, "HPDs with errors in ");
-    std::string R2LeftError     = GetRichPanelHistName(Rich::Rich2, Rich::left  , "HPDs with errors in ");
-    std::string R2RightError    = GetRichPanelHistName(Rich::Rich2, Rich::right , "HPDs with errors in ");
+    const std::string R1TopDisable    = GetRichPanelHistName(Rich::Rich1, Rich::top);
+    const std::string R1BottomDisable = GetRichPanelHistName(Rich::Rich1, Rich::bottom);
+    const std::string R2LeftDisable   = GetRichPanelHistName(Rich::Rich2, Rich::left);
+    const std::string R2RightDisable  = GetRichPanelHistName(Rich::Rich2, Rich::right);
 
+    const std::string R1TopError      = GetRichPanelHistName(Rich::Rich1, Rich::top   , "HPDs with errors in ");
+    const std::string R1BottomError   = GetRichPanelHistName(Rich::Rich1, Rich::bottom, "HPDs with errors in ");
+    const std::string R2LeftError     = GetRichPanelHistName(Rich::Rich2, Rich::left  , "HPDs with errors in ");
+    const std::string R2RightError    = GetRichPanelHistName(Rich::Rich2, Rich::right , "HPDs with errors in ");
 
     AIDA::IHistogram2D *histo1  = histo2D(R1TopDisable);    histo1->reset();
     AIDA::IHistogram2D *histo2  = histo2D(R1BottomDisable); histo2->reset();
@@ -442,7 +450,8 @@ void Rich::Mon::HpdUkL1DisableTool::ClearHPDList () {
 
 //=============================================================================
 //=============================================================================
-void Rich::Mon::HpdUkL1DisableTool::PublishInfo() {
+void Rich::Mon::HpdUkL1DisableTool::PublishInfo()
+{
 
   if ( msgLevel(MSG::VERBOSE) )
     verbose() << "Beginning of PublishInfo " << endmsg;
@@ -454,86 +463,97 @@ void Rich::Mon::HpdUkL1DisableTool::PublishInfo() {
   //
   // publish info for disabled HPDs
   //
-  if (m_SendDisableCommands) {
+  if (m_SendDisableCommands)
+  {
     iMapBegin = m_HpdMap.begin();
     iMapEnd   = m_HpdMap.end();
-    for (iMap = iMapBegin; iMap != iMapEnd; ++iMap) {
+    for (iMap = iMapBegin; iMap != iMapEnd; ++iMap)
+    {
 
       const LHCb::RichSmartID smartID          = iMap->first;
       const time_t            requestTime      = iMap->second;
       const int               nDisableRequests = m_HpdMap.count(smartID);
 
-      struct tm * timeinfo;
-      timeinfo = localtime ( &requestTime );
-      std::string timeString =
-        boost::lexical_cast<std::string>(timeinfo->tm_hour-1) + " h " +
-        boost::lexical_cast<std::string>(timeinfo->tm_min)    + " min " +
-        boost::lexical_cast<std::string>(timeinfo->tm_sec)    +  " s";
+      struct tm * timeinfo = localtime ( &requestTime );
 
       if ( msgLevel(MSG::VERBOSE) )
         verbose() << "HPD " << smartID << " requested to disable " << nDisableRequests
-                  << " times. This request at " << timeString<< endmsg;
-
-      std::string hpdIDString = GetDisableString(smartID);
-
-      std::string hpdVerboseString =  hpdIDString + " = (Rich (0: Rich1, 1: Rich2), L1 logicalID, L1 InputIngress, IngressID)";
-
-      if ( msgLevel(MSG::VERBOSE) )
-        verbose() << "Asked " << nDisableRequests << " times to disable HPD " << hpdVerboseString << endmsg;
-
-      if (nDisableRequests >= m_Threshold ) {
+                  << " times. This request at " 
+                  << timeinfo->tm_hour-1 << " h "
+                  << timeinfo->tm_min   << " min "
+                  << timeinfo->tm_sec   <<  " s"   
+                  << endmsg;
+
+      const std::string hpdIDString = GetDisableString(smartID);
+      if ( !hpdIDString.empty() )
+      {
+        
+        const std::string hpdVerboseString = 
+          ( hpdIDString + " = (Rich (0: Rich1, 1: Rich2), L1 logicalID, L1 InputIngress, IngressID)" );
+        
         if ( msgLevel(MSG::VERBOSE) )
-          verbose() << "Disable HPD " << hpdVerboseString << endmsg;
-
-        m_DisabledHpdMap[smartID]++;
-
-        // new HPD to disable - send message to CAMERA
-        if (m_DisabledHpdMap[smartID] == 1 ) {
-
-          if ( msgLevel(MSG::VERBOSE) )
-            verbose() << "add to string " << hpdIDString << endmsg;
-
-          m_DisabledHpdString.append(hpdIDString);
-
-          Error( "New HPD to disable in UKL1 data stream " + hpdVerboseString);
-          std::string s1 = "New HPD to disable "    + hpdVerboseString;
-          std::string s2 = "All disabled HPDs now " + m_DisabledHpdString;
-          m_CamTool->Append("TEXT", s1.c_str());
-          m_CamTool->Append("TEXT", s2.c_str());
-          //m_CamTool->SendAndClearTS(ICameraTool::ERROR,m_Name,"New HPD to disable in UKL1 data stream");
-          m_CamTool->SendAndClearTS(ICameraTool::ERROR     ,m_Name,"New HPD to disable in UKL1 data stream",
-                                    ICameraTool::ERROR_PVSS,m_Name,"HPD automatically disabled - call RICH Piquet");
-
+          verbose() << "Asked " << nDisableRequests << " times to disable HPD " 
+                    << hpdVerboseString << endmsg;
+        
+        if (nDisableRequests >= m_Threshold )
+        {
           if ( msgLevel(MSG::VERBOSE) )
-            verbose() << "update DIM service with " << m_DisabledHpdString.c_str() << endmsg;
-
-          if (m_DimService)
-            m_DimService->updateService((char*)m_DisabledHpdString.c_str());
-
-
-          // add to overview histogram
-          if (m_Plot2DHisto) {
-
-            if (smartID.isValid()                        &&
-                smartID.rich()  != Rich::InvalidDetector &&
-                smartID.panel() != Rich::InvalidSide) {
-
-              Rich::SmartIDGlobalOrdering globOrdering(smartID);
-              const int x  = globOrdering.globalHpdX();
-              const int y  = globOrdering.globalHpdY();
-
-              std::string idString    = GetRichPanelHistId  (smartID.rich(), smartID.panel());
-              std::string NameString  = GetRichPanelHistName(smartID.rich(), smartID.panel());
-              if ( msgLevel(MSG::VERBOSE) )
-                verbose() << "Fill histogram with title " << NameString << endmsg;
-              plot2D( x , y , idString, NameString, 0,0,0, 0,0,0);
-            } //if m_Plot2DHisto
-
-          } // if not invalid Rich, Panel
-
-        } // if nDisableRequests ==
-
-      } // if nDisableRequests >=
+            verbose() << "Disable HPD " << hpdVerboseString << endmsg;
+          
+          ++m_DisabledHpdMap[smartID];
+          
+          // new HPD to disable - send message to CAMERA
+          if ( m_DisabledHpdMap[smartID] == 1 )
+          {
+            
+            if ( msgLevel(MSG::VERBOSE) )
+              verbose() << "add to string " << hpdIDString << endmsg;
+            
+            m_DisabledHpdString.append(hpdIDString);
+            
+            Error( "New HPD to disable in UKL1 data stream " + hpdVerboseString);
+            std::string s1 = "New HPD to disable "    + hpdVerboseString;
+            std::string s2 = "All disabled HPDs now " + m_DisabledHpdString;
+            m_CamTool->Append("TEXT", s1.c_str());
+            m_CamTool->Append("TEXT", s2.c_str());
+            //m_CamTool->SendAndClearTS(ICameraTool::ERROR,m_Name,"New HPD to disable in UKL1 data stream");
+            m_CamTool->SendAndClearTS(ICameraTool::ERROR     ,m_Name,"New HPD to disable in UKL1 data stream",
+                                      ICameraTool::ERROR_PVSS,m_Name,"HPD automatically disabled - call RICH Piquet");
+            
+            if ( msgLevel(MSG::VERBOSE) )
+              verbose() << "update DIM service with " << m_DisabledHpdString.c_str() << endmsg;
+            
+            if (m_DimService)
+              m_DimService->updateService((char*)m_DisabledHpdString.c_str());
+            
+            
+            // add to overview histogram
+            if (m_Plot2DHisto) 
+            {
+              
+              if (smartID.isValid()                        &&
+                  smartID.rich()  != Rich::InvalidDetector &&
+                  smartID.panel() != Rich::InvalidSide) 
+              {
+                
+                const Rich::SmartIDGlobalOrdering globOrdering(smartID);
+                const int x  = globOrdering.globalHpdX();
+                const int y  = globOrdering.globalHpdY();
+                
+                const std::string idString    = GetRichPanelHistId  (smartID.rich(), smartID.panel());
+                const std::string NameString  = GetRichPanelHistName(smartID.rich(), smartID.panel());
+                if ( msgLevel(MSG::VERBOSE) )
+                  verbose() << "Fill histogram with title " << NameString << endmsg;
+                plot2D( x , y , idString, NameString, 0,0,0, 0,0,0);
+              } //if m_Plot2DHisto
+              
+            } // if not invalid Rich, Panel
+            
+          } // if nDisableRequests ==
+          
+        } // if nDisableRequests >=
+      }
+      
     } // for iMap
 
     if ( msgLevel(MSG::VERBOSE) )
@@ -543,24 +563,27 @@ void Rich::Mon::HpdUkL1DisableTool::PublishInfo() {
   //
   // update histograms for HPDs with errors
   //
-  if (m_Plot2DHisto) {
+  if (m_Plot2DHisto) 
+  {
     iMapBegin = m_HpdErrorReportMap.begin();
     iMapEnd   = m_HpdErrorReportMap.end();
-    for (iMap = iMapBegin; iMap != iMapEnd; ++iMap) {
+    for (iMap = iMapBegin; iMap != iMapEnd; ++iMap)
+    {
 
       const LHCb::RichSmartID smartID          = iMap->first;
       //  const time_t            requestTime      = iMap->second;
 
       if (smartID.isValid()                        &&
           smartID.rich()  != Rich::InvalidDetector &&
-          smartID.panel() != Rich::InvalidSide) {
+          smartID.panel() != Rich::InvalidSide) 
+      {
 
-        Rich::SmartIDGlobalOrdering globOrdering(smartID);
+        const Rich::SmartIDGlobalOrdering globOrdering(smartID);
         const int x  = globOrdering.globalHpdX();
         const int y  = globOrdering.globalHpdY();
 
-        std::string idString    = GetRichPanelHistId  (smartID.rich(), smartID.panel(), "Error_");
-        std::string NameString  = GetRichPanelHistName(smartID.rich(), smartID.panel(), "HPDs with errors in ");
+        const std::string idString    = GetRichPanelHistId  (smartID.rich(), smartID.panel(), "Error_");
+        const std::string NameString  = GetRichPanelHistName(smartID.rich(), smartID.panel(), "HPDs with errors in ");
 
         if ( msgLevel(MSG::VERBOSE) )
           verbose() << "Fill histogram with title " << NameString << endmsg;
@@ -581,79 +604,83 @@ void Rich::Mon::HpdUkL1DisableTool::DisableAndPublish()
   if ( m_SendDisableCommands )
   {
     typedef std::map< LHCb::RichSmartID, boost::circular_buffer< unsigned long > >::const_iterator cMapIter;
-    for ( cMapIter cand = m_disableCandidates.begin(); 
+    for ( cMapIter cand = m_disableCandidates.begin();
           cand != m_disableCandidates.end(); ++cand )
     {
       const LHCb::RichSmartID& smartID                = cand->first;
       boost::circular_buffer< unsigned long > indices = cand->second;
-
+      
       const unsigned long min = *std::min_element( indices.begin(), indices.end() );
       const unsigned long max = *std::max_element( indices.begin(), indices.end() );
-
+      
       double failureRate = 0;
       if ( indices.size() == indices.capacity() )
         failureRate = indices.size() / double( max - min );
-
+      
       if ( msgLevel( MSG::VERBOSE ) )
         verbose() << "HPD " << smartID << " has received "
                   << 100. * failureRate << "% of disable requests." << endmsg;
-
-      std::string hpdIDString      = GetDisableString(smartID);
-      std::string hpdVerboseString = hpdIDString + " = (Rich (0: Rich1, 1: Rich2), L1 logicalID, L1 InputIngress, IngressID)";
-
-      if ( failureRate > m_failureRateThreshold )
+      
+      std::string hpdIDString = GetDisableString(smartID);
+      if ( !hpdIDString.empty() )
       {
-        if ( msgLevel(MSG::VERBOSE) )
-          verbose() << "Disable HPD " << hpdVerboseString << endmsg;
-
-        m_DisabledHpdMap[smartID]++;
-
-        // new HPD to disable - send message to CAMERA
-        if ( m_DisabledHpdMap[smartID] == 1 )
+        std::string hpdVerboseString = hpdIDString + " = (Rich (0: Rich1, 1: Rich2), L1 logicalID, L1 InputIngress, IngressID)";
+        
+        if ( failureRate > m_failureRateThreshold )
         {
           if ( msgLevel(MSG::VERBOSE) )
-            verbose() << "add to string " << hpdIDString << endmsg;
-
-          m_DisabledHpdString.append( hpdIDString );
-
-          Error( "New HPD to disable in UKL1 data stream " + hpdVerboseString );
-          std::string s1 = "New HPD to disable "    + hpdVerboseString;
-          std::string s2 = "All disabled HPDs now " + m_DisabledHpdString;
-          m_CamTool->Append( "TEXT", s1.c_str() );
-          m_CamTool->Append( "TEXT", s2.c_str() );
-          m_CamTool->SendAndClearTS( ICameraTool::ERROR     , m_Name, "New HPD to disable in UKL1 data stream",
-                                     ICameraTool::ERROR_PVSS, m_Name, "HPD automatically disabled - call RICH Piquet" );
-
-          if ( msgLevel( MSG::VERBOSE ) )
-            verbose() << "Update DIM service with " << m_DisabledHpdString.c_str() << endmsg;
-
-          std::cout << "Disabling HPD " << m_DisabledHpdString << "with min = " << min << " and max = " << max << std::endl;
-
-          if ( m_DimService )
-            m_DimService->updateService( (char*) m_DisabledHpdString.c_str() );
-
-          // add to overview histogram
-          if ( m_Plot2DHisto )
+            verbose() << "Disable HPD " << hpdVerboseString << endmsg;
+          
+          ++m_DisabledHpdMap[smartID];
+          
+          // new HPD to disable - send message to CAMERA
+          if ( m_DisabledHpdMap[smartID] == 1 )
           {
-            if (smartID.isValid()                        &&
-                smartID.rich()  != Rich::InvalidDetector &&
-                smartID.panel() != Rich::InvalidSide) {
-
-              Rich::SmartIDGlobalOrdering globOrdering(smartID);
-              const int x  = globOrdering.globalHpdX();
-              const int y  = globOrdering.globalHpdY();
-
-              std::string idString    = GetRichPanelHistId  (smartID.rich(), smartID.panel());
-              std::string NameString  = GetRichPanelHistName(smartID.rich(), smartID.panel());
-              if ( msgLevel(MSG::VERBOSE) )
-                verbose() << "Fill histogram with title " << NameString << endmsg;
-              plot2D( x , y , idString, NameString, 0,0,0, 0,0,0);
+            if ( msgLevel(MSG::VERBOSE) )
+              verbose() << "add to string " << hpdIDString << endmsg;
+            
+            m_DisabledHpdString.append( hpdIDString );
+            
+            Error( "New HPD to disable in UKL1 data stream " + hpdVerboseString ).ignore();
+            const std::string s1 = "New HPD to disable "    + hpdVerboseString;
+            const std::string s2 = "All disabled HPDs now " + m_DisabledHpdString;
+            m_CamTool->Append( "TEXT", s1.c_str() );
+            m_CamTool->Append( "TEXT", s2.c_str() );
+            m_CamTool->SendAndClearTS( ICameraTool::ERROR     , m_Name, "New HPD to disable in UKL1 data stream",
+                                       ICameraTool::ERROR_PVSS, m_Name, "HPD automatically disabled - call RICH Piquet" );
+            
+            if ( msgLevel( MSG::VERBOSE ) )
+              verbose() << "Update DIM service with " << m_DisabledHpdString << endmsg;
+            
+            //std::cout << "Disabling HPD " << m_DisabledHpdString << "with min = " << min << " and max = " << max << std::endl;
+            
+            if ( m_DimService )
+              m_DimService->updateService( (char*) m_DisabledHpdString.c_str() );
+            
+            // add to overview histogram
+            if ( m_Plot2DHisto )
+            {
+              if (smartID.isValid()                        &&
+                  smartID.rich()  != Rich::InvalidDetector &&
+                  smartID.panel() != Rich::InvalidSide) 
+              {
+                
+                const Rich::SmartIDGlobalOrdering globOrdering(smartID);
+                const int x  = globOrdering.globalHpdX();
+                const int y  = globOrdering.globalHpdY();
+                
+                const std::string idString    = GetRichPanelHistId  (smartID.rich(), smartID.panel());
+                const std::string NameString  = GetRichPanelHistName(smartID.rich(), smartID.panel());
+                if ( msgLevel(MSG::VERBOSE) )
+                  verbose() << "Fill histogram with title " << NameString << endmsg;
+                plot2D( x , y , idString, NameString, 0,0,0, 0,0,0);
+              }
             }
-          }
-        } // if m_DisableHpdMap[smartID]==1
-      } // if failureRate > threshold.
+          } // if m_DisableHpdMap[smartID]==1
+        } // if failureRate > threshold.
+      }    
     } // for each candidate for disabling.
-
+    
     if ( msgLevel(MSG::VERBOSE) )
       verbose() << "HPDs to disable " << m_DisabledHpdString << endmsg;
   } // if disable HPDs
@@ -662,23 +689,26 @@ void Rich::Mon::HpdUkL1DisableTool::DisableAndPublish()
   std::multimap<LHCb::RichSmartID, time_t>::const_iterator iMap;
   std::multimap<LHCb::RichSmartID, time_t>::const_iterator iMapBegin;
   std::multimap<LHCb::RichSmartID, time_t>::const_iterator iMapEnd;
-  if (m_Plot2DHisto) {
+  if (m_Plot2DHisto)
+  {
     iMapBegin = m_HpdErrorReportMap.begin();
     iMapEnd   = m_HpdErrorReportMap.end();
-    for (iMap = iMapBegin; iMap != iMapEnd; ++iMap) {
+    for (iMap = iMapBegin; iMap != iMapEnd; ++iMap) 
+    {
 
       const LHCb::RichSmartID smartID          = iMap->first;
 
       if (smartID.isValid()                        &&
           smartID.rich()  != Rich::InvalidDetector &&
-          smartID.panel() != Rich::InvalidSide) {
+          smartID.panel() != Rich::InvalidSide) 
+      {
 
-        Rich::SmartIDGlobalOrdering globOrdering(smartID);
+        const Rich::SmartIDGlobalOrdering globOrdering(smartID);
         const int x  = globOrdering.globalHpdX();
         const int y  = globOrdering.globalHpdY();
 
-        std::string idString   = GetRichPanelHistId  (smartID.rich(), smartID.panel(), "Error_");
-        std::string NameString = GetRichPanelHistName(smartID.rich(), smartID.panel(), "HPDs with errors in ");
+        const std::string idString   = GetRichPanelHistId  (smartID.rich(), smartID.panel(), "Error_");
+        const std::string NameString = GetRichPanelHistName(smartID.rich(), smartID.panel(), "HPDs with errors in ");
 
         if ( msgLevel(MSG::VERBOSE) )
           verbose() << "Fill histogram with title " << NameString << endmsg;
@@ -693,47 +723,46 @@ void Rich::Mon::HpdUkL1DisableTool::DisableAndPublish()
 
 //=============================================================================
 //=============================================================================
-void Rich::Mon::HpdUkL1DisableTool::handle(const Incident &incident) {
+void Rich::Mon::HpdUkL1DisableTool::handle(const Incident &incident)
+{
 
   if ( msgLevel(MSG::VERBOSE) )
     verbose() << "Beginning of handle " << endmsg;
 
-  time_t currentTime  = time(NULL);
+  const time_t currentTime  = time(NULL);
   bool   refreshHisto = false;
 
-  if ((m_UpdateTimerInterval >0) && 
-      ((currentTime - m_TimeLastUpdate) > m_UpdateTimerInterval) ){
+  if ((m_UpdateTimerInterval >0) &&
+      ((currentTime - m_TimeLastUpdate) > m_UpdateTimerInterval) )
+  {
     refreshHisto = true;
     m_TimeLastUpdate = currentTime;
-  } //if
+  }
 
-  if ( incident.type() == IncidentType::BeginEvent )
+  if      ( IncidentType::BeginEvent == incident.type() )
   {
     ++m_nMonitoredEvents;
   }
-
-  else if (IncidentType::EndEvent == incident.type() )
+  else if ( IncidentType::EndEvent   == incident.type() )
   {
     CheckErrorTime();
-    //     PublishInfo();
     DisableAndPublish();
-    if (refreshHisto && m_Plot2DHisto)
-      RefreshHistogram();
-  } //if incidentType
-
-  else if (IncidentType::RunChange == incident.type() )
+    if ( refreshHisto && m_Plot2DHisto ) RefreshHistogram();
+  }
+  else if ( IncidentType::RunChange  == incident.type() )
   {
-    m_CamTool->SendAndClearTS(ICameraTool::INFO, m_Name, "New Run - clear list of disabled HPDs");
-    info() << "New run: clear list of disabled HPDs" << endmsg;
+    const std::string m = "New Run - Clear list of disabled HPDs";
+    m_CamTool->SendAndClearTS(ICameraTool::INFO, m_Name, m);
+    info() << m << endmsg;
     ClearHPDList();
-  } // if incidentType
+  }
 
 } // void handle
 //=============================================================================
 //=============================================================================
 std::string Rich::Mon::HpdUkL1DisableTool::GetDisableString(const LHCb::RichSmartID &smartID)
 {
-  std::string hpdIDString("(UNDEFINED)");
+  std::string hpdIDString("");
 
   // Use try block to prevent exceptions going any further
   try
@@ -757,11 +786,13 @@ std::string Rich::Mon::HpdUkL1DisableTool::GetDisableString(const LHCb::RichSmar
   }
   catch ( const GaudiException & excpt )
   {
-    Warning( excpt.message() + " " + excpt.tag() ).ignore();
+    if (msgLevel(MSG::DEBUG)) debug() << excpt.message() << " " << excpt.tag() << endmsg;
+    // Warning( excpt.message() + " " + excpt.tag() ).ignore();
   }
   catch ( const std::exception & excpt )
   {
-    Warning( excpt.what() ).ignore();
+    if (msgLevel(MSG::DEBUG)) debug() << excpt.what() << endmsg;
+    //Warning( excpt.what() ).ignore();
   }
 
   return hpdIDString;
@@ -770,13 +801,15 @@ std::string Rich::Mon::HpdUkL1DisableTool::GetDisableString(const LHCb::RichSmar
 
 //=============================================================================
 //=============================================================================
-void Rich::Mon::HpdUkL1DisableTool::CheckErrorTime() {
+void Rich::Mon::HpdUkL1DisableTool::CheckErrorTime() 
+{
 
   if ( msgLevel(MSG::VERBOSE) )
     verbose() << "Beginning of CheckErrorTime " << endmsg;
 
-  if (m_HistoryTime <= 0) {
-    Warning("Do not remove old disable requests");
+  if (m_HistoryTime <= 0) 
+  {
+    Warning("Do not remove old disable requests").ignore();
     return;
   } // if
 
@@ -787,14 +820,14 @@ void Rich::Mon::HpdUkL1DisableTool::CheckErrorTime() {
   std::multimap<LHCb::RichSmartID, time_t>::iterator iMapBegin = m_HpdMap.begin();
   std::multimap<LHCb::RichSmartID, time_t>::iterator iMapEnd   = m_HpdMap.end();
 
-  for (iMap = iMapBegin; iMap != iMapEnd; ++iMap)  {
+  for (iMap = iMapBegin; iMap != iMapEnd; ++iMap)  
+  {
 
     const LHCb::RichSmartID smartID          = iMap->first;
     const time_t            requestTime      = iMap->second;
     const int               nDisableRequests = m_HpdMap.count(smartID);
 
-    struct tm * timeinfo;
-    timeinfo = localtime ( &requestTime );
+    struct tm * timeinfo = localtime ( &requestTime );
     std::string timeString =
       boost::lexical_cast<std::string>(timeinfo->tm_hour-1) + " h " +
       boost::lexical_cast<std::string>(timeinfo->tm_min)    + " min " +
@@ -807,7 +840,8 @@ void Rich::Mon::HpdUkL1DisableTool::CheckErrorTime() {
     //
     // check if disable request was made too long ago.
     //
-    if ((currentTime - requestTime) > m_HistoryTime) {
+    if ((currentTime - requestTime) > m_HistoryTime) 
+    {
 
       if ( msgLevel(MSG::VERBOSE) )
         verbose() << "HPD removal request too old - remove from list request at " << timeString << endmsg;
@@ -820,21 +854,26 @@ void Rich::Mon::HpdUkL1DisableTool::CheckErrorTime() {
 
       m_HpdMap.erase(iMap);
 
-      if ( (m_HpdMap.count(smartID) == 0)  && (!m_KeepDisabledHPDs)) {
+      if ( (m_HpdMap.count(smartID) == 0) && (!m_KeepDisabledHPDs)) 
+      {
         // also remove from list of already disabled HPDs -> re-enable
         m_DisabledHpdMap[smartID] = 0;
-        std::string hpdIDString = GetDisableString(smartID);
-        size_t pos = m_DisabledHpdString.find(hpdIDString);
-        if (pos != std::string::npos) {
-          m_DisabledHpdString.erase(pos,hpdIDString.size());
-          if ( msgLevel(MSG::VERBOSE) )
-            verbose() << "updated string published to DIM " << m_DisabledHpdString << endmsg;
-          std::string s3 = "Remove HPD " + hpdIDString + " from list of disabled HPD published to DIM/PVSS";
-          std::string s4 = "DIM string is now " +  m_DisabledHpdString;
-          m_CamTool->Append("TEXT", s3.c_str());
-          m_CamTool->Append("TEXT", s4.c_str());
-          m_CamTool->SendAndClearTS(ICameraTool::INFO,m_Name,"Forget old HPD removal request in DIM service");
-        }//if pos
+        const std::string hpdIDString = GetDisableString(smartID);
+        if ( !hpdIDString.empty() )
+        {
+          const size_t pos = m_DisabledHpdString.find(hpdIDString);
+          if (pos != std::string::npos) 
+          {
+            m_DisabledHpdString.erase(pos,hpdIDString.size());
+            if ( msgLevel(MSG::VERBOSE) )
+              verbose() << "updated string published to DIM " << m_DisabledHpdString << endmsg;
+            const std::string s3 = "Remove HPD " + hpdIDString + " from list of disabled HPD published to DIM/PVSS";
+            const std::string s4 = "DIM string is now " +  m_DisabledHpdString;
+            m_CamTool->Append("TEXT", s3.c_str());
+            m_CamTool->Append("TEXT", s4.c_str());
+            m_CamTool->SendAndClearTS(ICameraTool::INFO,m_Name,"Forget old HPD removal request in DIM service");
+          }//if pos
+        }
       } // if !m_KeepDisabledHPDs
     } // if m_HistoryTime;
   } // for iMap
@@ -843,12 +882,14 @@ void Rich::Mon::HpdUkL1DisableTool::CheckErrorTime() {
   // verify map
   //
 
-  if ( msgLevel(MSG::DEBUG) ) {
+  if ( msgLevel(MSG::VERBOSE) ) 
+  {
 
     std::multimap<LHCb::RichSmartID, time_t>::const_iterator iMapTest;
     std::multimap<LHCb::RichSmartID, time_t>::const_iterator iMapBeginTest = m_HpdMap.begin();
     std::multimap<LHCb::RichSmartID, time_t>::const_iterator iMapEndTest   = m_HpdMap.end();
-    for (iMapTest = iMapBeginTest; iMapTest != iMapEndTest; ++iMapTest) {
+    for ( iMapTest = iMapBeginTest; iMapTest != iMapEndTest; ++iMapTest) 
+    {
 
       const LHCb::RichSmartID smartID          = iMapTest->first;
       const time_t            requestTime      = iMapTest->second;
@@ -861,47 +902,46 @@ void Rich::Mon::HpdUkL1DisableTool::CheckErrorTime() {
         boost::lexical_cast<std::string>(timeinfo->tm_min)    + " min " +
         boost::lexical_cast<std::string>(timeinfo->tm_sec)    +  " s";
 
-
       verbose() << "CheckErrorTime Verify Map: HPD " << smartID << " requested to disable " << nDisableRequests
                 << " times. This request at " << timeString<< endmsg;
-    } //for iMap
-  } // if debug
+    } 
+  } 
 
 } // void CheckErrorTime
 
 
 //=============================================================================
 //=============================================================================
-std::string 
-Rich::Mon::HpdUkL1DisableTool::GetRichPanelHistId(const Rich::DetectorType rich, 
+std::string
+Rich::Mon::HpdUkL1DisableTool::GetRichPanelHistId(const Rich::DetectorType rich,
                                                   const Rich::Side panel,
-                                                  const std::string & prefix ) 
+                                                  const std::string & prefix )
 {
   // Now create the name.
   std::ostringstream id;
   id << prefix
      << Rich::text(rich)
-     << Rich::text(rich, panel);
+     << Rich::text(rich,panel);
   return id.str();
-}// getRichPanelHistId()
+}
 
 //=============================================================================
-std::string 
-Rich::Mon::HpdUkL1DisableTool::GetRichPanelHistName(const Rich::DetectorType rich, 
-                                                    const Rich::Side panel, 
-                                                    const std::string & prefix) 
+std::string
+Rich::Mon::HpdUkL1DisableTool::GetRichPanelHistName(const Rich::DetectorType rich,
+                                                    const Rich::Side panel,
+                                                    const std::string & prefix)
 {
   // Now create the name.
   std::ostringstream id;
   id << prefix
      << Rich::text(rich)
-     << Rich::text(rich, panel);
+     << " "
+     << Rich::text(rich,panel);
   return id.str();
-}// getRichPanelHistId()
-
+}
 
 //=============================================================================
-StatusCode Rich::Mon::HpdUkL1DisableTool::Book2DHisto (const Rich::DetectorType rich, 
+StatusCode Rich::Mon::HpdUkL1DisableTool::Book2DHisto (const Rich::DetectorType rich,
                                                        const Rich::Side panel)
 {
   LHCb::RichSmartID smartID(rich, panel);
@@ -913,9 +953,6 @@ StatusCode Rich::Mon::HpdUkL1DisableTool::Book2DHisto (const Rich::DetectorType
   double hxmin(-0.5);
   double hxmax(Rich::Rich2==rich ? 8.5:13.5);
   int    hxnbins(static_cast<int>(hxmax-hxmin));
-  //   double hxmin(gOrdering.minHPDX()-0.5);
-  //   double hxmax(gOrdering.maxHPDX()-0.5);
-  //   int hxnbins(gOrdering.totalHPDX());
   if ((Rich::Rich2==rich) && (Rich::left==panel))
   {
     hxmin += (hxmax + 0.5);
@@ -925,10 +962,7 @@ StatusCode Rich::Mon::HpdUkL1DisableTool::Book2DHisto (const Rich::DetectorType
   double hymin(-0.5);
   double hymax(Rich::Rich2==rich ? 15.5:6.5);
   int    hynbins(static_cast<int>(hymax-hymin));
-  //   double hymin(gOrdering.minHPDY()-0.5);
-  //   double hymax(gOrdering.maxHPDY()-0.5);
-  //   int hynbins(gOrdering.totalHPDY());
-  if ((Rich::Rich1==rich) && (Rich::top==panel)) 
+  if ((Rich::Rich1==rich) && (Rich::top==panel))
   {
     hymin += (hymax + 0.5);
     hymax += (hymax + 0.5);
@@ -941,23 +975,23 @@ StatusCode Rich::Mon::HpdUkL1DisableTool::Book2DHisto (const Rich::DetectorType
   // for disabled HPDs
   const std::string idString    = GetRichPanelHistId  (rich, panel);
   const std::string NameString  = GetRichPanelHistName(rich, panel);
-  book2D(  idString   , NameString  , hxmin, hxmax, hxnbins, hymin, hymax, hynbins);
+  book2D( idString, NameString, hxmin, hxmax, hxnbins, hymin, hymax, hynbins);
 
-  // for HPDs with erros
+  // for HPDs with errors
   const std::string idString2    = GetRichPanelHistId  (rich, panel, "Error_");
   const std::string NameString2  = GetRichPanelHistName(rich, panel, "HPDs with errors in ");
-  book2D(  idString2   , NameString2  , hxmin, hxmax, hxnbins, hymin, hymax, hynbins);
+  book2D( idString2, NameString2, hxmin, hxmax, hxnbins, hymin, hymax, hynbins);
 
   return StatusCode::SUCCESS;
 } // Book2DHisto
 //=============================================================================
-void Rich::Mon::HpdUkL1DisableTool::RefreshHistogram() 
+void Rich::Mon::HpdUkL1DisableTool::RefreshHistogram()
 {
 
   if ( msgLevel(MSG::VERBOSE) )
     verbose() << "Refresh histogram of disabled HPDs" << endmsg;
 
-  if (!m_Plot2DHisto) 
+  if (!m_Plot2DHisto)
   {
     if ( msgLevel(MSG::VERBOSE) )
       verbose() << "2D histograms switched off, return" << endmsg;
@@ -972,7 +1006,8 @@ void Rich::Mon::HpdUkL1DisableTool::RefreshHistogram()
               << " HPDs with errors "        << nHPDError
               << endmsg;
 
-  if ((nDisabledHPDs == 0) && (nHPDError) ) {
+  if ((nDisabledHPDs == 0) && (nHPDError) ) 
+  {
     if ( msgLevel(MSG::VERBOSE) )
       verbose() << "All HPDs OK, return" << endmsg;
     return;
@@ -1002,9 +1037,6 @@ void Rich::Mon::HpdUkL1DisableTool::RefreshHistogram()
   AIDA::IHistogram2D *histo7  = histo2D(R2LeftError);     histo7->reset();
   AIDA::IHistogram2D *histo8  = histo2D(R2RightError);    histo8->reset();
 
-
-
-
   //
   // fill histograms again
   //
@@ -1013,45 +1045,52 @@ void Rich::Mon::HpdUkL1DisableTool::RefreshHistogram()
   if ( msgLevel(MSG::VERBOSE) )
     verbose() << "Now update histograms of disabled HPDs" << endmsg;
 
-  std::ostringstream s1; s1 << "Update histograms for " << nDisabledHPDs << " disabled HPDs";
+  std::ostringstream s1; 
+  s1 << "Update histograms for " << nDisabledHPDs << " disabled HPDs";
   std::string        s2;
 
   if ( msgLevel(MSG::DEBUG) )
     debug() << "Update histograms for " << nDisabledHPDs << " disabled HPDs" << endmsg;
+
   std::map<LHCb::RichSmartID, int>::const_iterator iMap;
   std::map<LHCb::RichSmartID, int>::const_iterator iMapBegin = m_DisabledHpdMap.begin();
   std::map<LHCb::RichSmartID, int>::const_iterator iMapEnd   = m_DisabledHpdMap.end();
-
-  for (iMap = iMapBegin; iMap != iMapEnd; iMap++) {
-    LHCb::RichSmartID smartID = iMap->first;
+  for (iMap = iMapBegin; iMap != iMapEnd; ++iMap) 
+  {
+    const LHCb::RichSmartID& smartID = iMap->first;
 
     if (smartID.isValid()                        &&
         smartID.rich()  != Rich::InvalidDetector &&
-        smartID.panel() != Rich::InvalidSide) {
+        smartID.panel() != Rich::InvalidSide) 
+    {
 
       if ( msgLevel(MSG::VERBOSE) )
         verbose() << "refresh histo for HPD " << smartID << endmsg;
 
       std::string disabledHPDString = GetDisableString(smartID);
-      s2.append(disabledHPDString);
-
-      Rich::SmartIDGlobalOrdering globOrdering(smartID);
-      const int x  = globOrdering.globalHpdX();
-      const int y  = globOrdering.globalHpdY();
-
-      std::string histoID   = GetRichPanelHistId(smartID.rich(), smartID.panel());
-      std::string histoName = GetRichPanelHistName(smartID.rich(), smartID.panel());
-      if ( msgLevel(MSG::VERBOSE) )
-        verbose() << "Fill histogram with title " << histoName << endmsg;
-
-      plot2D( x , y , histoID, histoName, 0,0,0, 0,0,0);
+      if ( !disabledHPDString.empty() )
+      {
+        s2.append(disabledHPDString);
+
+        const Rich::SmartIDGlobalOrdering globOrdering(smartID);
+        const int x = globOrdering.globalHpdX();
+        const int y = globOrdering.globalHpdY();
+        
+        const std::string histoID   = GetRichPanelHistId(smartID.rich(), smartID.panel());
+        const std::string histoName = GetRichPanelHistName(smartID.rich(), smartID.panel());
+        if ( msgLevel(MSG::VERBOSE) )
+          verbose() << "Fill histogram with title " << histoName << endmsg;
+        
+        plot2D( x , y , histoID, histoName, 0,0,0, 0,0,0);
+      }
     } //if valid SmartRef
   } //for iMap
 
   m_CamTool->Append("TEXT", s2.c_str());
   m_CamTool->SendAndClearTS(ICameraTool::INFO,m_Name, s1.str().c_str());
 
-  if ( msgLevel(MSG::VERBOSE) ) {
+  if ( msgLevel(MSG::VERBOSE) ) 
+  {
     verbose() << s1.str() << s2 << endmsg;
     verbose() << "#entries h1: " <<  histo1->allEntries() << " h2: " << histo2->allEntries()
               << " h3: "         <<  histo3->allEntries() << " h4: " << histo4->allEntries()
@@ -1059,33 +1098,35 @@ void Rich::Mon::HpdUkL1DisableTool::RefreshHistogram()
   } // if verbose
 
 
-
   // for HPDs with Error
   if ( msgLevel(MSG::VERBOSE) )
     verbose() << "Now update histograms of  HPDs with errors" << endmsg;
 
-  std::ostringstream s3; s3 << "Update histograms for " << nHPDError << " HPDs with errors";
+  std::ostringstream s3;
+  s3 << "Update histograms for " << nHPDError << " HPDs with errors";
 
   info() << s3.str() << endmsg;
-  m_HpdErrorReportMap.begin();
-  m_HpdErrorReportMap.end();
+  //iMapBegin = m_HpdErrorReportMap.begin();
+  //iMapEnd   = m_HpdErrorReportMap.end();
 
-  for (iMap = iMapBegin; iMap != iMapEnd; iMap++) {
-    LHCb::RichSmartID smartID = iMap->first;
+  for (iMap = iMapBegin; iMap != iMapEnd; ++iMap) 
+  {
+    const LHCb::RichSmartID& smartID = iMap->first;
 
     if (smartID.isValid()                        &&
         smartID.rich()  != Rich::InvalidDetector &&
-        smartID.panel() != Rich::InvalidSide) {
+        smartID.panel() != Rich::InvalidSide) 
+    {
 
       if ( msgLevel(MSG::VERBOSE) )
         verbose() << "refresh histo for HPD " << smartID << endmsg;
 
-      Rich::SmartIDGlobalOrdering globOrdering(smartID);
-      const int x  = globOrdering.globalHpdX();
-      const int y  = globOrdering.globalHpdY();
+      const Rich::SmartIDGlobalOrdering globOrdering(smartID);
+      const int x = globOrdering.globalHpdX();
+      const int y = globOrdering.globalHpdY();
 
-      std::string histoID   = GetRichPanelHistId  (smartID.rich(), smartID.panel(), "Error_");
-      std::string histoName = GetRichPanelHistName(smartID.rich(), smartID.panel(), "HPDs with errors in " );
+      const std::string histoID   = GetRichPanelHistId  (smartID.rich(), smartID.panel(), "Error_");
+      const std::string histoName = GetRichPanelHistName(smartID.rich(), smartID.panel(), "HPDs with errors in ");
       if ( msgLevel(MSG::VERBOSE) )
         verbose() << "Fill histogram with title " << histoName << endmsg;
 
@@ -1096,7 +1137,8 @@ void Rich::Mon::HpdUkL1DisableTool::RefreshHistogram()
 
   m_CamTool->SendAndClearTS(ICameraTool::INFO,m_Name, s1.str().c_str());
 
-  if ( msgLevel(MSG::VERBOSE) ) {
+  if ( msgLevel(MSG::VERBOSE) ) 
+  {
     verbose() << s3.str() << endmsg;
     verbose() << "#entries h5: " <<  histo5->allEntries() << " h6: " << histo6->allEntries()
               << " h7: "         <<  histo7->allEntries() << " h8: " << histo8->allEntries()
diff --git a/Rich/RichMonitoringTools/src/HpdUkL1DisableTool.h b/Rich/RichMonitoringTools/src/HpdUkL1DisableTool.h
index 0780e3d9..3554ca32 100755
--- a/Rich/RichMonitoringTools/src/HpdUkL1DisableTool.h
+++ b/Rich/RichMonitoringTools/src/HpdUkL1DisableTool.h
@@ -95,8 +95,12 @@ namespace Rich
       void                   DisableAndPublish   ();
       std::string            GetDisableString    (const LHCb::RichSmartID &smartID); ///< convert SmartID into disable string sent to DIM
       void                   CheckErrorTime      ();       ///< check time-stamps of removal requests, remove if older than m_HistoryTime;
-      std::string            GetRichPanelHistId  (const Rich::DetectorType rich, const Rich::Side panel, const std::string & prefix = "");
-      std::string            GetRichPanelHistName(const Rich::DetectorType rich, const Rich::Side panel, const std::string & prefix = "Disabled HPDs in");
+      std::string            GetRichPanelHistId  (const Rich::DetectorType rich, 
+                                                  const Rich::Side panel, 
+                                                  const std::string & prefix = "");
+      std::string            GetRichPanelHistName(const Rich::DetectorType rich, 
+                                                  const Rich::Side panel, 
+                                                  const std::string & prefix = "Disabled HPDs in ");
       StatusCode             Book2DHisto         (const Rich::DetectorType rich, const Rich::Side panel);
 
       const LHCb::RichSmartID smartId( const Rich::DAQ::Level1LogicalID&      l1LogicalID,
@@ -125,7 +129,7 @@ namespace Rich
       int                                       m_HistoryTime;           ///< how long to keep record of a given incident (in seconds)
       int                                       m_KeepDisabledHPDs;      ///< do not remove HPDs from the list of HPDs to disable once they have been disabled
       bool                                      m_ClearListAtNewRun;     ///< Clear list of disabled HPDs at beginnign of new run
-      time_t                                    m_TimeStart;
+
       time_t                                    m_TimeLastUpdate;
       int                                       m_UpdateTimerInterval;   ///< Interval at which to send error messages (in seconds)
 
diff --git a/Rich/RichOnlineMonitors/cmt/requirements b/Rich/RichOnlineMonitors/cmt/requirements
index 05836d29..49700377 100755
--- a/Rich/RichOnlineMonitors/cmt/requirements
+++ b/Rich/RichOnlineMonitors/cmt/requirements
@@ -3,7 +3,7 @@
 # Maintainer : Ulrich Kerzel
 #============================================================================
 package           RichOnlineMonitors
-version           v2r15
+version           v2r17
 
 #============================================================================
 # Structure, i.e. directories to process. 
@@ -19,7 +19,7 @@ use RichKernel          v*    Rich
 use RichDet             v*    Det
 
 # CAMERA
-use Camera             v* Online
+use Camera              v* Online
 
 # occupancy tool
 use RichTools           v* Rich
diff --git a/Rich/RichOnlineMonitors/cmt/version.cmt b/Rich/RichOnlineMonitors/cmt/version.cmt
index 919a7d30..d5a1aea9 100644
--- a/Rich/RichOnlineMonitors/cmt/version.cmt
+++ b/Rich/RichOnlineMonitors/cmt/version.cmt
@@ -1 +1 @@
-v2r15
+v2r17
diff --git a/Rich/RichOnlineMonitors/doc/release.notes b/Rich/RichOnlineMonitors/doc/release.notes
index 292d7440..2dae4478 100755
--- a/Rich/RichOnlineMonitors/doc/release.notes
+++ b/Rich/RichOnlineMonitors/doc/release.notes
@@ -1,11 +1,39 @@
-!-----------------------------------------------------------------------------
+-----------------------------------------------------------------------------
 ! Package     : Rich/RichOnlineMonitors
 ! Responsible : Ulrich Kerzel
 ! Purpose     : Online monitoring for the LHCb RICH detector
 !-----------------------------------------------------------------------------
 
+====================== v2r17 ================================================
+! 2011-05-31 - Chris Jones
+ - Update the DAQ and NHit algs to send messages to camera prior to requesting
+   event snapshots, that include more information on why the snapshot was
+   requested.
+
+! 2011-05-26 - Chris Jones
+ - Various improvments to the event snapshot alg.
+
+! 2011-05-23 - Chris Jones
+ - Fix bug in HPDNHitMonitor that caused messages map to not be cleared after
+   messages were sent to camera, whening they were then repeatidly sent.
+ - Various other minor improvements to HPDNHitMonitor
+
+2011-04-05 - Jordi Garra Tic�
+ - Create the histograms of number of hits.
+ - Only print empty HPD messages when not running in Alice mode.
+
+! 2011-04-05 - Chris Jones
+ - Various minor changes to DAQ monitor.
+
+! 2011-03-30 - Chris Jones
+ - Always create hpd Disabling tool during the DAQ monitor initialize() call.
+   Needed to make sure histograms are readyb for the presenter online.
+
+! 2011-03-16 - Jordi Garra Tic�
+ - Removed the MonitorRate configuration variable, since it has never been used.
+
 ====================== v2r15 ================================================
-! 2011-03-16 - Jordi Garra Tico
+! 2011-03-16 - Jordi Garra Tic�
  - Updated disabling tool to handle disabling requests based on index of
    the monitored event, rather than on time.
 
diff --git a/Rich/RichOnlineMonitors/src/RichCalibMonitor.cpp b/Rich/RichOnlineMonitors/src/RichCalibMonitor.cpp
index da534fbb..71915cca 100755
--- a/Rich/RichOnlineMonitors/src/RichCalibMonitor.cpp
+++ b/Rich/RichOnlineMonitors/src/RichCalibMonitor.cpp
@@ -31,24 +31,19 @@ DECLARE_ALGORITHM_FACTORY( CalibMonitor )
 //=============================================================================
 // Standard constructor, initializes variables
 //=============================================================================
-CalibMonitor::CalibMonitor( const std::string& name,
-                                ISvcLocator* pSvcLocator)
-  : Rich::HistoAlgBase      ( name , pSvcLocator ),
-    m_nEvts                 (     0              ),
-    m_nMonitoredEvents      (     0              ), 
-    m_MonitorRate           (     1              ),
-    m_FillHistos            (     true           ),
-    m_ExtendedVerbose       (     false          ),
-    m_RemoveFaultyHpdUKL1   (     false          )
+  CalibMonitor::CalibMonitor( const std::string& name,
+                              ISvcLocator* pSvcLocator)
+    : Rich::HistoAlgBase      ( name , pSvcLocator ),
+      m_nEvts                 (     0              ),
+      m_nEvtsLastUpdate       (     0              ),
+      m_FillHistos            (     true           ),
+      m_ExtendedVerbose       (     false          ),
+      m_RemoveFaultyHpdUKL1   (     false          )
 {
-
-
-  declareProperty( "MonitorRate"         , m_MonitorRate         =     1);
   declareProperty( "FillHistos"          , m_FillHistos          =  true);
   declareProperty( "ExtendedVerbose"     , m_ExtendedVerbose     = false);
   declareProperty( "RemoveFaultyHpdUKL1" , m_RemoveFaultyHpdUKL1 = false);
-  declareProperty( "UpdateTimerInterval" , m_UpdateTimerInterval =    60);  
-
+  declareProperty( "UpdateTimerInterval" , m_UpdateTimerInterval =    60);
 } // constructor
 //=============================================================================
 // Destructor
@@ -58,7 +53,8 @@ CalibMonitor::~CalibMonitor() {}
 //=============================================================================
 // Initialization
 //=============================================================================
-StatusCode CalibMonitor::initialize() {
+StatusCode CalibMonitor::initialize()
+{
   const StatusCode sc = Rich::HistoAlgBase::initialize();
   if ( sc.isFailure() ) return sc;
 
@@ -67,7 +63,6 @@ StatusCode CalibMonitor::initialize() {
   //
   // print information about steering options
   //
-  info() << "Monitor each                " << m_MonitorRate << "th event" << endmsg;
   info() << "Fill histograms             " << m_FillHistos                << endmsg;
   info() << "Send diable command to UKL1 " << m_RemoveFaultyHpdUKL1       << endmsg;
   //
@@ -83,16 +78,14 @@ StatusCode CalibMonitor::initialize() {
   m_CamTool = tool<ICameraTool>("CameraTool");
 
   // Disable HPDs in UKL1 data-stream
-  m_HpdUKL1DisableTool = 
+  m_HpdUKL1DisableTool =
     tool<Rich::Mon::IHpdUkL1DisableTool>("Rich::Mon::HpdUkL1DisableTool","RichUKL1Disable");
 
-
   //
   // pre-book histograms
   //
   book1D("TriggerType", "TriggerType-" + name(),  -0.5, 7.5, 8);
 
-
   //
   // get Time of startup
   //
@@ -118,15 +111,18 @@ StatusCode CalibMonitor::initialize() {
 //=============================================================================
 // Main execution
 //=============================================================================
-StatusCode CalibMonitor::execute() {
+StatusCode CalibMonitor::execute()
+{
 
-  if (m_nEvts == 0) {
+  if ( 0 == m_nEvts ) 
+  {
+    const std::string m = "First event seen";
+    info() << m << endmsg;
     m_CamTool->Append("TEXT",name().c_str());
-    m_CamTool->SendAndClearTS(ICameraTool::INFO,name(),"First event seen");
-  } //if
+    m_CamTool->SendAndClearTS(ICameraTool::INFO,name(),m);
+  }
 
-
-  m_nEvts++;
+  ++m_nEvts;
 
   if ( msgLevel(MSG::DEBUG) )
     debug() << "==> Execute for event " << m_nEvts << endmsg;
@@ -134,76 +130,81 @@ StatusCode CalibMonitor::execute() {
   //
   // local variables
   //
-  int  nAllHits        = 0;
-  bool sendErrorReport = false;
-
-  //
-  // check if event should be monitored
-  //
-  if ( m_nEvts%m_MonitorRate != 0) {
-    if ( msgLevel(MSG::VERBOSE) )
-      verbose() << "do not monitor event number " << m_nEvts << endmsg;
-    return StatusCode::SUCCESS;
-  } // if monRate
-
-  m_nMonitoredEvents++;
 
   time_t currentTime  = time(NULL);
-
-  if ((m_UpdateTimerInterval>0) && ((currentTime - m_TimeLastUpdate) > m_UpdateTimerInterval) ){
-
-    time_t deltaT = (currentTime - m_TimeStart);
-    struct tm * timeinfo;
-    timeinfo = localtime ( &deltaT );
-
-    std::string messageString = "Seen " +  boost::lexical_cast<std::string>(m_nMonitoredEvents) +
-      " events in past " +
-      boost::lexical_cast<std::string>(timeinfo->tm_hour-1) + " h " +
-      boost::lexical_cast<std::string>(timeinfo->tm_min)    + " min " +
-      boost::lexical_cast<std::string>(timeinfo->tm_sec)    +  " s";
-    debug() << messageString << endmsg;
-    m_CamTool->SendAndClearTS(ICameraTool::INFO,name(), messageString);
-
-    m_TimeLastUpdate = currentTime;
-    sendErrorReport  = true;
+  if ( (m_UpdateTimerInterval>0) &&
+       ((currentTime - m_TimeLastUpdate) > m_UpdateTimerInterval) )
+  {
+
+    const time_t deltaT = (currentTime - m_TimeLastUpdate);
+    struct tm * timeinfo = localtime ( &deltaT );
+    std::ostringstream messageString;
+    messageString << "Seen " << m_nEvts-m_nEvtsLastUpdate << " events in past "
+                  << timeinfo->tm_hour-1 << " h "
+                  << timeinfo->tm_min << " min "
+                  << timeinfo->tm_sec << " s";
+    // add number of each trigger type
+    if ( !m_TriggerTypeMap.empty() )
+    {
+      messageString << " : Triggers";
+      for ( std::map<int,int>::const_iterator iMap = m_TriggerTypeMap.begin();
+            iMap != m_TriggerTypeMap.end(); ++iMap)
+      {
+        messageString << " [ type=" << iMap->first << " #=" << iMap->second << " ]";
+      }
+    }
+    // clear for next set of messages
+    m_TriggerTypeMap.clear();
+
+    debug() << messageString.str() << endmsg;
+    m_CamTool->SendAndClearTS(ICameraTool::INFO,name(), messageString.str());
+
+    m_TimeLastUpdate  = currentTime;
+    m_nEvtsLastUpdate = m_nEvts;
   } // if updateInterval
 
   //
   // check if ODIN information is available
   //
   LHCb::ODIN * odin = NULL;
-  if (exist<LHCb::ODIN>( LHCb::ODINLocation::Default )) {
-    odin = get<LHCb::ODIN>( LHCb::ODINLocation::Default );
+  if ( exist<LHCb::ODIN>(LHCb::ODINLocation::Default) )
+  {
+    odin = get<LHCb::ODIN>(LHCb::ODINLocation::Default);
 
-    if (msgLevel(MSG::VERBOSE) ) {
+    if (msgLevel(MSG::VERBOSE) )
+    {
       verbose() << " ODIN event time " << odin->eventTime()
                 << " GPS time "        << odin->gpsTime ()
                 << " runNr "           << odin->runNumber ()
                 << " orbit Nr "        << odin->orbitNumber()
                 << " event type "      << odin->eventType()
-                << " triger type "     << odin->triggerType()   
+                << " triger type "     << odin->triggerType()
                 << " event number "    << odin->eventNumber()
                 << " bunch ID "        << odin->bunchId()
                 << " detector status " << odin->detectorStatus ()
                 << endmsg;
     }// if verbose
-  } else {
-    warning() << "ODIN bank missing" << endmsg;
-    return StatusCode::SUCCESS;
+  }
+  else
+  {
+    return Warning( "ODIN bank missing", StatusCode::SUCCESS );
   } //if exist
 
 
-  if (m_FillHistos) {
+  if (m_FillHistos)
+  {
     plot1D(odin->triggerType(), "TriggerType", "TriggerType-" + name(),  0,0,0);
-  } //if fillHistos 
-  
+  } //if fillHistos
+
 
   // count which triggers have been sent
-  m_TriggerTypeMap[odin->triggerType()]++;
+  ++m_TriggerTypeMap[odin->triggerType()];
 
   //
   // main loop - get all RICH SmartIDs corresponding to HPDs/hits
   //
+  // CRJ - Currently not doing anything so comment out
+  /*
   const Rich::DAQ::L1Map &l1Map = m_SmartIDDecoder->allRichSmartIDs();
   if  ( msgLevel(MSG::VERBOSE) )
     verbose() << "L1 map has size " << l1Map.size() << endmsg;
@@ -211,7 +212,8 @@ StatusCode CalibMonitor::execute() {
   Rich::DAQ::L1Map::const_iterator iL1Map;
   Rich::DAQ::L1Map::const_iterator iL1MapBegin = l1Map.begin();
   Rich::DAQ::L1Map::const_iterator iL1MapEnd   = l1Map.end();
-  for (iL1Map = iL1MapBegin; iL1Map != iL1MapEnd; iL1Map++) {
+  for (iL1Map = iL1MapBegin; iL1Map != iL1MapEnd; ++iL1Map)
+  {
 
     const Rich::DAQ::Level1HardwareID   l1HardID    = iL1Map->first;
     const Rich::DAQ::Level1LogicalID    l1LogicalID = m_RichSys->level1LogicalID(l1HardID);
@@ -222,8 +224,8 @@ StatusCode CalibMonitor::execute() {
     Rich::DAQ::IngressMap::const_iterator iIngressMap;
     Rich::DAQ::IngressMap::const_iterator iIngressMapBegin = ingressMap.begin();
     Rich::DAQ::IngressMap::const_iterator iIngressMapEnd   = ingressMap.end();
-
-    for (iIngressMap = iIngressMapBegin; iIngressMap != iIngressMapEnd; iIngressMap++){
+    for (iIngressMap = iIngressMapBegin; iIngressMap != iIngressMapEnd; ++iIngressMap)
+    {
 
       //const Rich::DAQ::L1IngressID & l1IngressID = iIngressMap->first;
       const Rich::DAQ::IngressInfo & ingressInfo = iIngressMap->second;
@@ -236,7 +238,8 @@ StatusCode CalibMonitor::execute() {
       Rich::DAQ::HPDMap::const_iterator iHPDMapBegin = hpdMap.begin();
       Rich::DAQ::HPDMap::const_iterator iHPDMapEnd   = hpdMap.end();
 
-      for (iHPDMap = iHPDMapBegin; iHPDMap != iHPDMapEnd; iHPDMap++) {
+      for (iHPDMap = iHPDMapBegin; iHPDMap != iHPDMapEnd; ++iHPDMap)
+      {
 
         const Rich::DAQ::Level1Input           l1Input          = iHPDMap->first;                    // SmartID of HPD with hits
         const Rich::DAQ::L1InputWithinIngress  l1InputIngress   = l1Input.l1InputWithinIngress();
@@ -244,11 +247,13 @@ StatusCode CalibMonitor::execute() {
         const LHCb::RichSmartID &              smartIDHPD       = hpdInfo.hpdID();
 
         // check for valid HPD
-        if (!smartIDHPD.isValid() ) {
+        if (!smartIDHPD.isValid() )
+        {
           verbose() << "HPD SmartID is not valid, continue." << endmsg;
           continue;
         } //SmartID valid
-        if (hpdInfo.header().inhibit()) {
+        if (hpdInfo.header().inhibit())
+        {
           verbose() << "HPD is inhibited, continue " << endmsg;
           continue;
         } // inhibit
@@ -256,45 +261,12 @@ StatusCode CalibMonitor::execute() {
         const Rich::DAQ::HPDHardwareID   hardID       = m_RichSys->hardwareID(smartIDHPD); // corresponding hardware ID
         const Rich::DAQ::Level0ID        l0ID         = m_RichSys->level0ID(smartIDHPD);   //               L0
         const LHCb::RichSmartID::Vector &hitSmartIDs  = hpdInfo.smartIDs();                // vector of SmartIDs with hits
-	//        const Rich::DetectorType         richDetector = smartIDHPD.rich();
-        
-        nAllHits          += hitSmartIDs.size();
-        
+        //        const Rich::DetectorType         richDetector = smartIDHPD.rich();
+
       }//for iHPDMap
     } //for iIngressMap
   }//for iL1Map
-
-  if  ( msgLevel(MSG::VERBOSE) )
-    verbose() << "number of hits in this event " << nAllHits << endmsg;
-  
-
-  //
-  // send status report to CAMERA
-  //
-  if (sendErrorReport) {
-    if  ( msgLevel(MSG::VERBOSE) )
-      verbose() << "Send status report to CAMERA" << endmsg;
-
-    std::map<int,int>::const_iterator iMap;
-    std::map<int,int>::const_iterator iMapBegin = m_TriggerTypeMap.begin();
-    std::map<int,int>::const_iterator iMapEnd   = m_TriggerTypeMap.end();
-
-    std::ostringstream errStream;
-
-    for (iMap = iMapBegin; iMap != iMapEnd; iMap++){
-      errStream << " #triggers of type " << iMap->first << " seen so far: " << iMap->second;
-      if ( msgLevel(MSG::VERBOSE) )
-        verbose() << errStream.str() << endmsg;
-    } //for iMap
-    m_CamTool->Append("TEXT",errStream.str().c_str());
-    errStream.str().clear();
-
-    errStream << "#events in past " << m_UpdateTimerInterval
-              << " seconds: "       << m_nMonitoredEvents;
-    m_CamTool->SendAndClearTS(ICameraTool::INFO,name(),errStream.str());
-    errStream.str().clear();
-
-  } // if sendErrorReport
+  */
 
   return StatusCode::SUCCESS;
 } // execute
@@ -302,15 +274,10 @@ StatusCode CalibMonitor::execute() {
 //=============================================================================
 //  Finalize
 //=============================================================================
-StatusCode CalibMonitor::finalize() {
-
-  debug() << "==> Finalize" << endmsg;
-
-
-  m_CamTool->Append("TEXT",name().c_str());
-  m_CamTool->SendAndClearTS(ICameraTool::INFO,name(),"End of Finalize");
-
-  return Rich::HistoAlgBase::finalize();  // must be called after all other actions
+StatusCode CalibMonitor::finalize()
+{
+  m_CamTool->SendAndClearTS(ICameraTool::INFO,name(),"Finalize");
+  return Rich::HistoAlgBase::finalize();
 }
 
 //=============================================================================
diff --git a/Rich/RichOnlineMonitors/src/RichCalibMonitor.h b/Rich/RichOnlineMonitors/src/RichCalibMonitor.h
index 7a2ece6b..701fc909 100755
--- a/Rich/RichOnlineMonitors/src/RichCalibMonitor.h
+++ b/Rich/RichOnlineMonitors/src/RichCalibMonitor.h
@@ -6,6 +6,8 @@
 // Include files
 //
 
+#include <sstream>
+
 // base class
 #include "RichKernel/RichHistoAlgBase.h"
 
@@ -72,8 +74,7 @@ namespace Rich
       ICameraTool                               * m_CamTool;             ///< CAMERA error reporting tool
 
       unsigned long     m_nEvts;               ///< Event count
-      unsigned long     m_nMonitoredEvents;    ///< Event count
-      int               m_MonitorRate;         ///< monitor only each Nth event
+      unsigned long m_nEvtsLastUpdate;         ///< Event count for last message
       bool              m_FillHistos;          ///< determine if histograms should be filled (or just counter)
       bool              m_ExtendedVerbose;     ///< even more output
       bool              m_RemoveFaultyHpdUKL1; ///< use tool to send disable command to UKL1
diff --git a/Rich/RichOnlineMonitors/src/RichDAQMonitor.cpp b/Rich/RichOnlineMonitors/src/RichDAQMonitor.cpp
index a69f99bf..44c55606 100755
--- a/Rich/RichOnlineMonitors/src/RichDAQMonitor.cpp
+++ b/Rich/RichOnlineMonitors/src/RichDAQMonitor.cpp
@@ -40,26 +40,14 @@ DECLARE_ALGORITHM_FACTORY( DAQMonitor )
       m_HpdUKL1DisableTool               ( NULL               ),
       m_CamTool                          ( NULL               ),
       m_nEvts                            (     0              ),
-      m_nMonitoredEvents                 (     0              ),
-      m_MonitorRate                      (     1              ),
-      m_ExtendedVerbose                  (     false          ),
-      m_OdinMinGpsTime                   (     0              ),
-      m_NL1Boards                        (     0              ),
-      m_CheckOdin                        (     false          ),
-      m_RemoveFaultyHpdUKL1              (     false          ),
+      m_nEvtsLastUpdate                  (     0              ),
       m_TimeStart                        (     0              ),
       m_TimeLastUpdate                   (     0              ),
-      m_UpdateTimerInterval              (   100              ),
-      m_CheckEmptyHPD                    (     true           ),
-      m_MonitorBxID                      (     true           ),
-      m_MaxErrorMessages                 (   500              ),
       m_Name                             (     "RichDaqMon"   ),
-      m_PrintMessages                    (     false          ),
-      m_TaeLocation                      (     ""             ),
       m_AlertEmptyEvent                  (     0              ),
       m_AlertActiveHPDs                  (     0              ),
       m_AlertEmptyHPD                    (     0              ),
-      m_AlertDublicateHPDL0              (     0              ),
+      m_AlertDuplicateHPDL0              (     0              ),
       m_AlertEventID                     (     0              ),
       m_AlertBxID                        (     0              ),
       m_AlertL0ID                        (     0              ),
@@ -72,10 +60,8 @@ DECLARE_ALGORITHM_FACTORY( DAQMonitor )
       m_AlertHPDSuppressed               (     0              ),
       m_SendAlertMessages                (     false          ),
       m_SendAlertDirect                  (     false          ),
-      m_AlertLevelBxID                   (     3              ),
-      m_Plot2DHisto                      (     false          )
+      m_AlertLevelBxID                   (     3              )
 {
-  declareProperty( "MonitorRate"         , m_MonitorRate         =     1);
   declareProperty( "ExtendedVerbose"     , m_ExtendedVerbose     = false);
   declareProperty( "OdinMinGpsTime"      , m_OdinMinGpsTime      =     0);
   declareProperty( "NL1Boards"           , m_NL1Boards           =    30);
@@ -84,7 +70,7 @@ DECLARE_ALGORITHM_FACTORY( DAQMonitor )
   declareProperty( "SendAlertDirect"     , m_SendAlertDirect     = false);
   declareProperty( "AlertLevelBxID"      , m_AlertLevelBxID      =     3);
   declareProperty( "RemoveFaultyHpdUKL1" , m_RemoveFaultyHpdUKL1 = false);
-  declareProperty( "UpdateTimerInterval" , m_UpdateTimerInterval =    10);
+  declareProperty( "UpdateTimerInterval" , m_UpdateTimerInterval =   300);
   declareProperty( "CheckEmptyHPD"       , m_CheckEmptyHPD       =  true);
   declareProperty( "MonitorBxID"         , m_MonitorBxID         =  true);
   declareProperty( "MaxErrorMessages"    , m_MaxErrorMessages    =   500);
@@ -106,9 +92,7 @@ StatusCode DAQMonitor::initialize()
   const StatusCode sc = Rich::HistoAlgBase::initialize();
   if ( sc.isFailure() ) return sc;
 
-  //
   // Partition
-  //
   const char* partitionName = getenv("PARTITION");
   m_Name = name();
   if (partitionName) { m_Name += std::string(partitionName); }
@@ -123,13 +107,13 @@ StatusCode DAQMonitor::initialize()
   // Get SmartIDs of all active HPDs which should be monitored
   // The list is obtained from DeRichSystem which gets it from the
   // ConditionDB for a given run period
-  const LHCb::RichSmartID::Vector &activeHPDs = deRichSys()->activeHPDRichSmartIDs();
+  const LHCb::RichSmartID::Vector & activeHPDs = deRichSys()->activeHPDRichSmartIDs();
 
   // vector<int> of hardwareIDs of all monitored HPDs for histogram showing which HPD has hits
   std::vector<int> hardIDVec;
   hardIDVec.reserve(activeHPDs.size());
-  for ( LHCb::RichSmartID::Vector::const_iterator iHPD = activeHPDs.begin(); 
-        iHPD != activeHPDs.end(); ++iHPD ) 
+  for ( LHCb::RichSmartID::Vector::const_iterator iHPD = activeHPDs.begin();
+        iHPD != activeHPDs.end(); ++iHPD )
   {
     hardIDVec.push_back( (deRichSys()->hardwareID(*iHPD)).data() );
   }// for iHPD
@@ -171,7 +155,8 @@ StatusCode DAQMonitor::initialize()
   book1D("TruncatedEventUKL1", "TruncatedEventUKL1-" + m_Name,
          -0.5, m_NL1Boards+0.5, m_NL1Boards+1);
 
-  if (m_Plot2DHisto) {
+  if (m_Plot2DHisto)
+  {
     book2D( "DAQErrorRich1Side0" , "DAQErrorRich1Side0" , 0, 9, 9, 0, 16, 16);
     book2D( "DAQErrorRich1Side1" , "DAQErrorRich1Side1" , 0, 9, 9, 0, 16, 16);
 
@@ -205,8 +190,6 @@ StatusCode DAQMonitor::initialize()
     if (partitionName)
       info() << "Running in partition " << std::string(partitionName) << endmsg;
 
-    info() << "monitor each " << m_MonitorRate << "th event" << endmsg;
-
     info() << "sent alerts at " << m_UpdateTimerInterval << " seconds interval "
            << "or when " << m_MaxErrorMessages << "are reached" << endmsg;
 
@@ -220,12 +203,13 @@ StatusCode DAQMonitor::initialize()
 
     info() << "TAE location ("" = central)   " << m_TaeLocation    << endmsg;
 
-    info() << "number of currently active HPDs (from ConditionDB) " 
+    info() << "number of currently active HPDs (from ConditionDB) "
            << activeHPDs.size() << endmsg;
   }
 
 
-  if (m_ExtendedVerbose) {
+  if (m_ExtendedVerbose)
+  {
     verbose() << "alert counters" << endmsg;
     verbose() << alertA.print() << endmsg;
     verbose() << alertB.print() << endmsg;
@@ -247,6 +231,10 @@ StatusCode DAQMonitor::initialize()
   m_TimeStart      = time(NULL);
   m_TimeLastUpdate = time(NULL);
 
+  // create disabling tool
+  // must do this to make sure histograms it creates are ready for the presenter
+  hpdDisableTool();
+
   //
   // let user know we're here
   //
@@ -261,10 +249,9 @@ StatusCode DAQMonitor::initialize()
 //=============================================================================
 StatusCode DAQMonitor::finalize()
 {
-  cameraTool()->SendAndClearTS(ICameraTool::INFO,m_Name,
-                               "finalize: Send last error report for this run");
+  cameraTool()->SendAndClearTS(ICameraTool::INFO,m_Name,"Finalize");
 
-  const StatusCode sc = DAQMonitor::SendErrorSummary();
+  const StatusCode sc = SendErrorSummary();
   if (sc.isFailure()) {
     return Warning("Error sending StatusReport",sc);
   }// if sc
@@ -274,80 +261,77 @@ StatusCode DAQMonitor::finalize()
 //=============================================================================
 // Main execution
 //=============================================================================
-StatusCode DAQMonitor::execute() {
+StatusCode DAQMonitor::execute()
+{
 
   // by default no events are 'selected'
   // only bad events should be selected
   setFilterPassed(false);
 
-  verbose() << "==> Execute for event " << m_nEvts << endmsg;
+  if ( msgLevel(MSG::VERBOSE) )
+    verbose() << "==> Execute for event " << m_nEvts << endmsg;
+
+  // cached messages to add to camera, for inclusion in a possible event snapshot
+  std::vector<std::string> m_snapshotMessages;
 
   //
   // local variables
   //
-  std::string idStringUKL1 = "";
-  std::string idStringL0   = "";
+  //std::string idStringL0 = "";
   std::map<Rich::DAQ::Level0ID,int> l0MapHPD;  // map all L0IDs encountered, check for occasions with >1 entry
 
-
   bool sendErrorReport = false;
 
-  if (m_nEvts == 0) {
-    info() << "RichDAQMon first event seen" << endmsg;
-    cameraTool()->SendAndClearTS(ICameraTool::INFO,m_Name,"RichDAQMon first event seen");
-  } // if
-
-  m_nEvts++;
-
-  //
-  // check if event should be monitored
-  //
-  if ( m_nEvts%m_MonitorRate != 0) {
-    if ( msgLevel(MSG::VERBOSE) )
-      verbose() << "do not monitor event number " << m_nEvts << endmsg;
-    return StatusCode::SUCCESS;
-  } // if monRate
-
-
-  m_nMonitoredEvents++;
+  if ( 0 == m_nEvts ) 
+  {
+    const std::string m = "First event seen";
+    info() << m << endmsg;
+    cameraTool()->Append("TEXT",m_Name.c_str());
+    cameraTool()->SendAndClearTS(ICameraTool::INFO,m_Name,m);
+  }
 
+  ++m_nEvts;
+  
   //
   // check if an error report should be sent
   // -> elapsed time
   //
-  time_t currentTime  = time(NULL);
-
-  if ((m_UpdateTimerInterval >0) && ((currentTime - m_TimeLastUpdate) > m_UpdateTimerInterval) ){
+  time_t currentTime = time(NULL);
 
-    time_t deltaT = (currentTime - m_TimeStart);
-    struct tm * timeinfo;
-    timeinfo = localtime ( &deltaT );
-
-    std::string messageString = "Seen " +  boost::lexical_cast<std::string>(m_nMonitoredEvents) +
-      " events in past " +
-      boost::lexical_cast<std::string>(timeinfo->tm_hour-1) + " h " +
-      boost::lexical_cast<std::string>(timeinfo->tm_min)    + " min " +
-      boost::lexical_cast<std::string>(timeinfo->tm_sec)    +  " s";
-    debug() << messageString << endmsg;
-    cameraTool()->SendAndClearTS(ICameraTool::INFO,m_Name, messageString);
+  if ((m_UpdateTimerInterval >0) && ((currentTime - m_TimeLastUpdate) > m_UpdateTimerInterval) )
+  {
+    const time_t deltaT = (currentTime - m_TimeLastUpdate);
+    struct tm * timeinfo = localtime ( &deltaT );
+    std::ostringstream messageString;
+    messageString << "Seen " << m_nEvts-m_nEvtsLastUpdate << " events in past " 
+                  << timeinfo->tm_hour-1 << " h "
+                  << timeinfo->tm_min << " min " 
+                  << timeinfo->tm_sec << " s";
+    if ( msgLevel(MSG::DEBUG) )
+      debug() << messageString.str() << endmsg;
+    cameraTool()->SendAndClearTS(ICameraTool::INFO, m_Name, messageString.str());
+
+    m_TimeLastUpdate  = currentTime;
+    sendErrorReport   = true;
+    m_nEvtsLastUpdate = m_nEvts;
 
-    m_TimeLastUpdate = currentTime;
-    sendErrorReport  = true;
   } // if time
 
   // -> too many messages, send error report now
-  if (m_AlertMessagesActiveHPD.size()                    >= m_MaxErrorMessages ||
-      m_AlertMessagesEventID.size()                      >= m_MaxErrorMessages ||
-      m_AlertMessagesBxID.size()                         >= m_MaxErrorMessages ||
-      m_AlertMessagesL0ID.size()                         >= m_MaxErrorMessages ||
-      m_AlertMessagesHPDInhibit.size()                   >= m_MaxErrorMessages ||
-      m_AlertMessagesParityFooter.size()                 >= m_MaxErrorMessages ||
-      m_AlertMessagesHPDNotInhibitInvalidSmartRef.size() >= m_MaxErrorMessages ||
-      m_AlertMessagesExtendedHeader.size()               >= m_MaxErrorMessages ||
-      m_AlertMessagesHPDSuppressed.size()                >= m_MaxErrorMessages ||
-      m_AlertMessagesEmptyHPD.size()                     >= m_MaxErrorMessages) {
-
-    if  ( msgLevel(MSG::VERBOSE) ){
+  if ( m_AlertMessagesActiveHPD.size()                    >= m_MaxErrorMessages ||
+       m_AlertMessagesEventID.size()                      >= m_MaxErrorMessages ||
+       m_AlertMessagesBxID.size()                         >= m_MaxErrorMessages ||
+       m_AlertMessagesL0ID.size()                         >= m_MaxErrorMessages ||
+       m_AlertMessagesHPDInhibit.size()                   >= m_MaxErrorMessages ||
+       m_AlertMessagesParityFooter.size()                 >= m_MaxErrorMessages ||
+       m_AlertMessagesHPDNotInhibitInvalidSmartRef.size() >= m_MaxErrorMessages ||
+       m_AlertMessagesExtendedHeader.size()               >= m_MaxErrorMessages ||
+       m_AlertMessagesHPDSuppressed.size()                >= m_MaxErrorMessages ||
+       m_AlertMessagesEmptyHPD.size()                     >= m_MaxErrorMessages )
+  {
+
+    if  ( msgLevel(MSG::VERBOSE) )
+    {
       verbose() << "Number of messages so far " << endmsg;
       verbose() << "#Messages ActiveHPD       " <<   m_AlertMessagesActiveHPD.size()                     << endmsg;
       verbose() << "#Messages EventID         " <<   m_AlertMessagesEventID.size()                       << endmsg;
@@ -361,20 +345,19 @@ StatusCode DAQMonitor::execute() {
       verbose() << "#Messages Empty HPD       " <<   m_AlertMessagesEmptyHPD.size()                      << endmsg;
     } // if msglevel
 
+    const time_t deltaT = (currentTime - m_TimeLastUpdate);
+    struct tm * timeinfo = localtime ( &deltaT );
+    std::ostringstream messageString;
+    messageString << "Too many errors in past "
+                  << timeinfo->tm_hour-1 << " h " 
+                  << timeinfo->tm_min    << " min " 
+                  << timeinfo->tm_sec    << " s";
+    info() << messageString.str() << endmsg;
+    cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name, messageString.str());
 
-    time_t deltaT = (currentTime - m_TimeStart);
-    struct tm * timeinfo;
-    timeinfo = localtime ( &deltaT );
-
-    std::string messageString = "Too many errors in past " +
-      boost::lexical_cast<std::string>(timeinfo->tm_hour-1) + " h " +
-      boost::lexical_cast<std::string>(timeinfo->tm_min)    + " min " +
-      boost::lexical_cast<std::string>(timeinfo->tm_sec)    +  " s";
-    info() << messageString << endmsg;
-    cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name, messageString);
-
-    m_TimeLastUpdate = currentTime;
-    sendErrorReport  = true;
+    m_TimeLastUpdate  = currentTime;
+    sendErrorReport   = true;
+    m_nEvtsLastUpdate = m_nEvts;
 
   } //if size
 
@@ -384,18 +367,13 @@ StatusCode DAQMonitor::execute() {
   //
 
   LHCb::ODIN * odin = NULL;
-  std::string odinInfo = "";
-  if (exist<LHCb::ODIN>( LHCb::ODINLocation::Default )) {
+  std::ostringstream odinInfo;
+  if (exist<LHCb::ODIN>( LHCb::ODINLocation::Default ))
+  {
     odin = get<LHCb::ODIN>( LHCb::ODINLocation::Default );
 
-    if (!odin) {
-      Error("Error retrieving ODIN bank");
-      return StatusCode::SUCCESS;
-    }// if
-
-    Gaudi::Time eventTime = odin->eventTime();
-
-    if (msgLevel(MSG::VERBOSE) ) {
+    if (msgLevel(MSG::VERBOSE) )
+    {
       verbose() << " ODIN event time " << odin->eventTime()
                 << " GPS time "        << odin->gpsTime ()
                 << " runNr "           << odin->runNumber ()
@@ -406,55 +384,56 @@ StatusCode DAQMonitor::execute() {
                 << " detector status " << odin->detectorStatus ()
                 << endmsg;
       verbose() << "EventTime "
-                << eventTime.year(true)    << "-"
-                << eventTime.month(true)+1 << "-"
-                << eventTime.day(true)     << " "
-                << eventTime.hour(true)    << "h"
-                << eventTime.minute(true)  << "m"
-                << eventTime.second(true)  << "s"
-                << eventTime.nsecond()     << endmsg;
+                << odin->eventTime().year(true)    << "-"
+                << odin->eventTime().month(true)+1 << "-"
+                << odin->eventTime().day(true)     << " "
+                << odin->eventTime().hour(true)    << "h"
+                << odin->eventTime().minute(true)  << "m"
+                << odin->eventTime().second(true)  << "s"
+                << odin->eventTime().nsecond()     << endmsg;
     }// if verbose
 
-    std::string eventTimeString = eventTime.format(true,"%X");
-
     // summarise ODIN information for CAMERA error reports
-    odinInfo =
-      " ODIN runNr " + boost::lexical_cast<std::string>( odin->runNumber())   +
-      " eventNr "    + boost::lexical_cast<std::string>( odin->eventNumber()) +
-      " bunchID "    + boost::lexical_cast<std::string>( odin->bunchId())     +
-      " orbitNr "    + boost::lexical_cast<std::string>( odin->orbitNumber()) +
-      " trigger "    + boost::lexical_cast<std::string>( odin->triggerType()) +
-      " event time " + eventTimeString;
+    odinInfo << "ODIN runNr "  << odin->runNumber()
+             << " eventNr "    << odin->eventNumber()
+             << " bunchID "    << odin->bunchId()
+             << " orbitNr "    << odin->orbitNumber()
+             << " trigger "    << odin->triggerType()
+             << " event time " << odin->eventTime().format(true,"%X");
 
     if (msgLevel(MSG::VERBOSE) )
-      verbose() << "ODIN info string " << odinInfo << endmsg;
+      verbose() << "ODIN info string " << odinInfo.str() << endmsg;
 
     plot1D(odin->triggerType(), "TriggerType", "TriggerType-" + m_Name,  0,0,0);
 
-
-  } else {
-    counter("MissingOdin")++;
-    m_AlertMissingOdin++;
+  } 
+  else
+  {
+    ++counter("MissingOdin");
+    ++m_AlertMissingOdin;
     cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,"ODIN bank missing");
     if (m_PrintMessages)
       info() << "ODIN bank missing" << endmsg;
     return StatusCode::SUCCESS;
   } //if exist
 
-  if (odin->gpsTime() < m_OdinMinGpsTime) {
+  if (odin->gpsTime() < m_OdinMinGpsTime)
+  {
     info() << "invalid ODIN GPS time " << odin->gpsTime() << " min. time accepted " << m_OdinMinGpsTime
            << " -> skip event " << endmsg;
-    counter("AlertInvalidOdinTime")++;
-    m_AlertInvalidOdinTime++;
-    if (m_SendAlertDirect) {
+    ++counter("AlertInvalidOdinTime");
+    ++m_AlertInvalidOdinTime;
+    if (m_SendAlertDirect)
+    {
       cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,"Invalid ODIN time");
     }// sendAlert
     // return StatusCode::SUCCESS;
   }//if gpsTime
 
-  if (m_nEvts == 1 ) {
+  if (m_nEvts == 1 )
+  {
     info() << "ODIN info for first event" << endmsg;
-    cameraTool()->Append("TEXT",odinInfo.c_str());
+    cameraTool()->Append("TEXT",odinInfo.str().c_str());
     cameraTool()->SendAndClearTS(ICameraTool::INFO,m_Name,"ODIN info for first event");
   } // if
 
@@ -480,7 +459,7 @@ StatusCode DAQMonitor::execute() {
   if  ( msgLevel(MSG::VERBOSE) )
     verbose() << "now get all Rich SmartIDs" << endmsg;
 
-  const Rich::DAQ::L1Map &l1Map = smartIDDecoder()->allRichSmartIDs(m_TaeLocation);
+  const Rich::DAQ::L1Map & l1Map = smartIDDecoder()->allRichSmartIDs(m_TaeLocation);
   if  ( msgLevel(MSG::VERBOSE) )
     verbose() << "L1 map has size " << l1Map.size() << endmsg;
 
@@ -494,7 +473,8 @@ StatusCode DAQMonitor::execute() {
   Rich::DAQ::L1Map::const_iterator iL1Map;
   Rich::DAQ::L1Map::const_iterator iL1MapBegin = l1Map.begin();
   Rich::DAQ::L1Map::const_iterator iL1MapEnd   = l1Map.end();
-  for (iL1Map = iL1MapBegin; iL1Map != iL1MapEnd; iL1Map++) {
+  for (iL1Map = iL1MapBegin; iL1Map != iL1MapEnd; ++iL1Map)
+  {
 
     const Rich::DAQ::Level1HardwareID     l1HardID        = iL1Map->first;
     const Rich::DAQ::Level1LogicalID      l1LogicalID     = deRichSys()->level1LogicalID(l1HardID);
@@ -512,7 +492,8 @@ StatusCode DAQMonitor::execute() {
     Rich::DAQ::IngressMap::const_iterator iIngressMap;
     Rich::DAQ::IngressMap::const_iterator iIngressMapBegin = ingressMap.begin();
     Rich::DAQ::IngressMap::const_iterator iIngressMapEnd   = ingressMap.end();
-    for (iIngressMap = iIngressMapBegin; iIngressMap != iIngressMapEnd; iIngressMap++){
+    for (iIngressMap = iIngressMapBegin; iIngressMap != iIngressMapEnd; ++iIngressMap)
+    {
 
       const Rich::DAQ::L1IngressID & l1IngressID = iIngressMap->first;
       const Rich::DAQ::IngressInfo & ingressInfo = iIngressMap->second;
@@ -521,7 +502,8 @@ StatusCode DAQMonitor::execute() {
       // check Ingress Header information
       //
       const Rich::DAQ::L1IngressHeader &ingressHeader = ingressInfo.ingressHeader();
-      if  ( msgLevel(MSG::VERBOSE) ){
+      if  ( msgLevel(MSG::VERBOSE) )
+      {
         verbose() << "IngressHeader Event ID " << ingressHeader.eventID()
                   << " BX ID "                 << ingressHeader.bxID()
                   << " IngressID "             << l1IngressID
@@ -535,28 +517,29 @@ StatusCode DAQMonitor::execute() {
                   << endmsg;
       } // if msgLevel
 
-      if (ingressHeader.hpdsSuppressed()) {
+      if (ingressHeader.hpdsSuppressed()) 
+      {
         // HPD data (i.e. hits) are suppressed in the UKL1 for this ingress
         // in this (multi-) event packet. The header information is still there,
         // contining the HPD information which would have sent data had the UKL1
         // not removed the hits
         UKL1HasSuppressedIngress = true;
         errStream.str(emptyString);
-        errStream << " L1["+
-          boost::lexical_cast<std::string>(l1LogicalID) + " , " +
-          boost::lexical_cast<std::string>(l1IngressID) +  "] "
-                  << richDetector;
+        errStream << " L1[" << l1LogicalID << " , " << l1IngressID << "] " << richDetector;
 
         if (m_PrintMessages)
           info() << "HPD suppressed (truncated flag set) "  << errStream.str() << endmsg;
-        counter("AlertHPDSuppressed")++;
-        m_AlertHPDSuppressed++;
-        m_AlertMessagesHPDSuppressed[errStream.str()]++;
-        if (m_SendAlertDirect) {
+        ++counter("AlertHPDSuppressed");
+        ++m_AlertHPDSuppressed;
+        ++m_AlertMessagesHPDSuppressed[errStream.str()];
+        if (m_SendAlertDirect)
+        {
           cameraTool()->Append("TEXT",errStream.str().c_str());
-          cameraTool()->Append("TEXT",odinInfo.c_str());
+          cameraTool()->Append("TEXT",odinInfo.str().c_str());
           cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name,"HPD Suppressed");
           setFilterPassed(true);
+          // Save messages for snapshots
+          m_snapshotMessages.push_back( errStream.str() );
         }// sendAlert
 
         // no futher HPD hits for this ingress if HPDs are suppresed in the UKL1
@@ -565,7 +548,8 @@ StatusCode DAQMonitor::execute() {
 
 
       // check ODIN information - EventID
-      if (m_CheckOdin) {
+      if (m_CheckOdin)
+      {
 
         if  ( msgLevel(MSG::VERBOSE) )
           verbose()  <<
@@ -574,14 +558,15 @@ StatusCode DAQMonitor::execute() {
             " ODIN: "               << odinBxID              <<
             endmsg;
 
-
         // check ODIN information - bunch crossing ID
-        if (m_MonitorBxID ) {
+        if (m_MonitorBxID )
+        {
 
           if  ( msgLevel(MSG::VERBOSE) )
             verbose()  << "check BX ID" << endmsg;
 
-          if (ingressHeader.bxID() != odinBxID) {
+          if (ingressHeader.bxID() != odinBxID) 
+          {
 
             errStream.str(emptyString);
             errStream <<
@@ -594,20 +579,23 @@ StatusCode DAQMonitor::execute() {
 
             if (m_PrintMessages)
               info() << "BunchID mis-match " << errStream.str() << endmsg;
-            counter("AlertBxID")++;
+            ++counter("AlertBxID");
             plot1D(l1HardID.data(),"ErrorPerUKL1Board", "ErrPerUKL1Board-" + m_Name, 0,1,1);
 
-            m_AlertBxID++;
-            counter("AlertBxID")++;
-            m_AlertMessagesBxID[errStream.str()]++;
+            ++m_AlertBxID;
+            ++counter("AlertBxID");
+            ++m_AlertMessagesBxID[errStream.str()];
 
-            if (m_SendAlertDirect) {
+            if (m_SendAlertDirect) 
+            {
               cameraTool()->Append("TEXT",errStream.str().c_str());
-              cameraTool()->Append("TEXT",odinInfo.c_str());
+              cameraTool()->Append("TEXT",odinInfo.str().c_str());
               cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name,"BxID mismatch");
             }// sendAlert
-          } else {
-            if  ( msgLevel(MSG::VERBOSE) )
+          } 
+          else
+          {
+            if ( msgLevel(MSG::VERBOSE) )
               verbose() << "BunchID OK " << endmsg;
           }// if BxID
         } // if MonitorBxID
@@ -615,15 +603,16 @@ StatusCode DAQMonitor::execute() {
 
 
       const Rich::DAQ::HPDMap &hpdMap = ingressInfo.hpdData();
-      if  ( msgLevel(MSG::VERBOSE) )
+      if ( msgLevel(MSG::VERBOSE) )
         verbose() << "HPD map has size " << hpdMap.size() << endmsg;
 
       Rich::DAQ::HPDMap::const_iterator iHPDMap;
       Rich::DAQ::HPDMap::const_iterator iHPDMapBegin = hpdMap.begin();
       Rich::DAQ::HPDMap::const_iterator iHPDMapEnd   = hpdMap.end();
-      int                               nInhibitedHPDs = 0;
+      int                             nInhibitedHPDs = 0;
 
-      for (iHPDMap = iHPDMapBegin; iHPDMap != iHPDMapEnd; iHPDMap++) {
+      for (iHPDMap = iHPDMapBegin; iHPDMap != iHPDMapEnd; ++iHPDMap)
+      {
 
         const Rich::DAQ::Level1Input          l1Input        = iHPDMap->first;
         const Rich::DAQ::HPDInfo&             hpdInfo        = iHPDMap->second;
@@ -631,33 +620,30 @@ StatusCode DAQMonitor::execute() {
         const Rich::DAQ::L1InputWithinIngress l1InputIngress = l1Input.l1InputWithinIngress();
         const LHCb::RichSmartID&              smartIDHPD     = hpdInfo.hpdID();
 
-        idStringUKL1.clear();
-        idStringUKL1 = " L1["+boost::lexical_cast<std::string>(l1LogicalID) +
-          " , " + boost::lexical_cast<std::string>(l1IngressID) +
-          " , " + boost::lexical_cast<std::string>(l1InputIngress) +
-          "] ";
+        std::ostringstream idStringUKL1;
+        idStringUKL1 << " L1[" << l1LogicalID << " , " << l1IngressID << " , " << l1InputIngress << "] ";
 
-        if (hpdInfo.header().inhibit()) {
+        if (hpdInfo.header().inhibit())
+        {
           errStream.str(emptyString);
-          errStream << "HPD is inhibited, "
-            // << " logical L1 ID  "   << l1LogicalID
-            // << " L1 Input Ingress " << l1InputIngress
-            // << " L1 Ingress ID "    << l1IngressID
-            // << " detector "         << Rich::text(richDetector)
-                    << idStringUKL1;
-          if  ( msgLevel(MSG::VERBOSE) ) {
+          errStream << "HPD is inhibited "
+                    << idStringUKL1.str();
+          if  ( msgLevel(MSG::VERBOSE) )
+          {
             verbose() << errStream.str() << endmsg;
           } //verbose
-          m_AlertMessagesHPDInhibit[errStream.str()]++;
-          counter("AlertHPDInhibit")++;
+          ++m_AlertMessagesHPDInhibit[errStream.str()];
+          ++counter("AlertHPDInhibit");
           //hpdDisableTool() -> ReportHPD(smartIDHPD);
           hpdDisableTool() -> ReportHPD(l1LogicalID, l1InputIngress, l1IngressID, richDetector);
           plot1D(l1HardID.data()   , "ErrorPerUKL1Board", "ErrPerUKL1Board-"  + m_Name, 0,1,1);
         } //inhibited HPD
 
         // normal: invalid SmartID but inhibited HPD:
-        if ( !smartIDHPD.isValid() && hpdInfo.header().inhibit() ) {
-          if  ( msgLevel(MSG::VERBOSE) ) {
+        if ( !smartIDHPD.isValid() && hpdInfo.header().inhibit() )
+        {
+          if  ( msgLevel(MSG::VERBOSE) )
+          {
             verbose() << "HPD SmartID invalid but HPD inhibited"
                       << " logical L1 ID  "   << l1LogicalID
                       << " L1 Input Ingress " << l1InputIngress
@@ -668,59 +654,60 @@ StatusCode DAQMonitor::execute() {
         } //if invalid SmartID
 
         // not OK: invalid SmartID but not inhibited HPD
-        if ( !smartIDHPD.isValid() && !hpdInfo.header().inhibit() ) {
+        if ( !smartIDHPD.isValid() && !hpdInfo.header().inhibit() )
+        {
           // Create a stream to use to build up the message which is sent to the error stream and CAMERA.
           errStream.str(emptyString);
           errStream << "HPD SmartID invalid AND HPD NOT inhibited"
-            //<< " logical L1 ID  "   << l1LogicalID
-            //<< " L1 Input Ingress " << l1InputIngress
-            //<< " L1 Ingress ID "    << l1IngressID
-            //<< " detector "         << Rich::text(richDetector)
-                    << idStringUKL1;
+                    << idStringUKL1.str();
           if (m_PrintMessages)
             Error(errStream.str());
           if (msgLevel(MSG::DEBUG) )
-            debug() << "ODIN info string " << odinInfo << endmsg;
+            debug() << "ODIN info string " << odinInfo.str() << endmsg;
 
           //hpdDisableTool() -> ReportHPD(smartIDHPD);
           hpdDisableTool() -> ReportHPD(l1LogicalID, l1InputIngress, l1IngressID, richDetector);
 
-          m_AlertHPDNotInhibitInvalidSmartRef++;
-          counter("AlertHPDNotInhibitInvalidSmartRef")++;
-          m_AlertMessagesHPDNotInhibitInvalidSmartRef[errStream.str()]++;
-          if (m_SendAlertDirect) {
+          ++m_AlertHPDNotInhibitInvalidSmartRef;
+          ++counter("AlertHPDNotInhibitInvalidSmartRef");
+          ++m_AlertMessagesHPDNotInhibitInvalidSmartRef[errStream.str()];
+          if (m_SendAlertDirect) 
+          {
             cameraTool()->Append("TEXT",errStream.str().c_str());
-            cameraTool()->Append("TEXT",odinInfo.c_str());
+            cameraTool()->Append("TEXT",odinInfo.str().c_str());
             cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,"HPD SmartRef invalid, HPD not inhibited");
           }// sendAlert
           setFilterPassed(true);
+          // Save messages for snapshots
+          m_snapshotMessages.push_back( errStream.str() );
 
           // disable this HPD in the UKL1 stream
-          if (m_RemoveFaultyHpdUKL1) {
+          if (m_RemoveFaultyHpdUKL1)
+          {
             errStream.str(emptyString);
             errStream << "Request HPD to be disabled, invalid SmartID not inhibited "
-              //<< " logical L1 ID  "   << l1LogicalID
-              //<< " L1 Input Ingress " << l1InputIngress
-              //<< " L1 Ingress ID "    << l1IngressID
-              //<< " detector "         << Rich::text(richDetector)
-                      << idStringUKL1;
+                      << idStringUKL1.str();
             if (m_PrintMessages)
               info() << errStream.str() << endmsg;// << endmsg;
-            if (m_SendAlertDirect) {
+            if (m_SendAlertDirect) 
+            {
               cameraTool()->Append("TEXT",errStream.str().c_str());
-              cameraTool()->Append("TEXT",odinInfo.c_str());
+              cameraTool()->Append("TEXT",odinInfo.str().c_str());
               cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name.c_str(),
-					   "Request HPD disable: HPD SmartRef invalid, HPD not inhibited");
+                                           "Request HPD disable: HPD SmartRef invalid, HPD not inhibited");
             } //sendAlert
             setFilterPassed(true);
             hpdDisableTool() -> DisableHPD( l1LogicalID, l1InputIngress, l1IngressID, richDetector );
+            // Save messages for snapshots
+            m_snapshotMessages.push_back( errStream.str() );
           } //if m_RemoveFaultyHpdUKL1
 
         } //if invalid SmartID
 
 
         // skip if issue detected
-        if (!smartIDHPD.isValid() || hpdInfo.header().inhibit()) {
+        if (!smartIDHPD.isValid() || hpdInfo.header().inhibit())
+        {
           verbose() << "skip this HPD" << endmsg;
           continue;
         } // valid or inhibited
@@ -730,9 +717,9 @@ StatusCode DAQMonitor::execute() {
         const LHCb::RichSmartID::Vector &hitSmartIDs = hpdInfo.smartIDs();                // vector of SmartIDs with hits
         const int                        nHits       = hpdInfo.smartIDs().size();
 
-        idStringL0.clear();
-        idStringL0  = " L0ID[" + boost::lexical_cast<std::string>(l0ID) + "]";
-        l0MapHPD[l0ID]++;
+        std::ostringstream idStringL0;
+        idStringL0 << " L0ID[" << l0ID << "]";
+        ++l0MapHPD[l0ID];
 
         plot1D(hardID.data(), "HitPerHardID", "HitPerHardwareID-" + m_Name, 0,1,1);
 
@@ -742,7 +729,8 @@ StatusCode DAQMonitor::execute() {
         const Rich::DAQ::HPDInfo::Header &hpdHeader = hpdInfo.header();
         const Rich::DAQ::HPDInfo::Footer &hpdFooter = hpdInfo.footer();
 
-        if  ( msgLevel(MSG::VERBOSE) ) {
+        if  ( msgLevel(MSG::VERBOSE) )
+        {
           verbose() << "HPD with SmartID " << smartIDHPD  << " L0 ID "      << hpdHeader.l0ID()
                     << " eventID " << hpdHeader.eventID() << " ALICE mode " << hpdHeader.aliceMode()
                     << " inhibit " << hpdHeader.inhibit() << " zero-supp. " << hpdHeader.zeroSuppressed()
@@ -751,31 +739,33 @@ StatusCode DAQMonitor::execute() {
         }//if verbose
 
         // check if HPD is inhibited
-        if (hpdHeader.inhibit()) {
+        if (hpdHeader.inhibit())
+        {
           if (m_PrintMessages)
             info() << "HPD inhibited, possible L0ID " << hpdHeader.l0ID() << endmsg;
-          counter("AlertHPDInhibit")++;
-          nInhibitedHPDs++;
-          m_AlertHPDInhibit++;
-          counter("AlertHPDInhibit")++;
+
+          ++counter("AlertHPDInhibit");
+          ++nInhibitedHPDs;
+          ++m_AlertHPDInhibit;
+          ++counter("AlertHPDInhibit");
           errStream.str(emptyString);
           errStream << "HPD inhibited, possible L0ID " << hpdHeader.l0ID();
-          // hpdDisableTool() -> ReportHPD(smartIDHPD);
           hpdDisableTool() -> ReportHPD(l1LogicalID, l1InputIngress, l1IngressID, richDetector);
           plot1D(hardID.data()     , "ErrorPerHardID"   , "ErrPerHardwareID-" + m_Name, 0,1,1);
           plot1D(l1HardID.data()   , "ErrorPerUKL1Board", "ErrPerUKL1Board-"  + m_Name, 0,1,1);
 
-          m_AlertMessagesHPDInhibit[errStream.str()]++;
-          if (m_SendAlertDirect) {
+          ++m_AlertMessagesHPDInhibit[errStream.str()];
+          if (m_SendAlertDirect)
+          {
             cameraTool()->Append("TEXT",errStream.str().c_str());
-            cameraTool()->Append("TEXT",odinInfo.c_str());
+            cameraTool()->Append("TEXT",odinInfo.str().c_str());
             cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,"HPD inhibit");
             setFilterPassed(true);
+            // Save messages for snapshots
+            m_snapshotMessages.push_back( errStream.str() );
           }// sendAlert
 
-          if (m_Plot2DHisto)
-            DAQMonitor::PlotErrorHPD(smartIDHPD);
-
+          if (m_Plot2DHisto) PlotErrorHPD(smartIDHPD);
 
         } // if inhibit
 
@@ -786,17 +776,18 @@ StatusCode DAQMonitor::execute() {
         // check if extended information is available - if yes,
         // likely to be an error as this is added by the UKL1
         // if it detects inconsistencies
-        if (hpdHeader.extendedFormat()) {
-          m_AlertExtendedHeader++;
-          counter("AlertExtendedHeader")++;
-          Rich::DAQ::L0Header l0Header       = hpdHeader.l0Header();
-          Rich::DAQ::L0Header::Word0 l0Word0 = l0Header.word0();
-          Rich::DAQ::L0Header::Word1 l0Word1 = l0Header.word1();
+        if (hpdHeader.extendedFormat())
+        {
+          ++m_AlertExtendedHeader;
+          ++counter("AlertExtendedHeader");
+          const Rich::DAQ::L0Header l0Header       = hpdHeader.l0Header();
+          const Rich::DAQ::L0Header::Word0 l0Word0 = l0Header.word0();
+          const Rich::DAQ::L0Header::Word1 l0Word1 = l0Header.word1();
 
           if (m_PrintMessages)
             Error("HPD with extended information, L0ID " + boost::lexical_cast<std::string>( hpdHeader.l0ID()));
           if (msgLevel(MSG::DEBUG) )
-            debug() << "ODIN info string " << odinInfo << endmsg;
+            debug() << "ODIN info string " << odinInfo.str() << endmsg;
 
           errStream.str(emptyString);
           errStream << "HPD with extended information, "
@@ -806,41 +797,42 @@ StatusCode DAQMonitor::execute() {
                     << boost::format(" L0 header word 0 %x ")  % l0Word0.data()
                     << boost::format(" L0 header word 1 %x ")  % l0Word1.data()
                     << " L0 header " << l0Header
-                    << idStringUKL1 << ":" << idStringL0;
+                    << idStringUKL1.str() << ":" << idStringL0.str();
 
-          m_AlertMessagesExtendedHeader[errStream.str()] ++ ;
-          //hpdDisableTool() -> ReportHPD(smartIDHPD);
+          ++m_AlertMessagesExtendedHeader[errStream.str()];
           hpdDisableTool() -> ReportHPD(l1LogicalID, l1InputIngress, l1IngressID, richDetector);
           plot1D(hardID.data()     , "ErrorPerHardID"   , "ErrPerHardwareID-" + m_Name, 0,1,1);
           plot1D(l1HardID.data()   , "ErrorPerUKL1Board", "ErrPerUKL1Board-"  + m_Name, 0,1,1);
-          if (m_SendAlertDirect) {
+          if (m_SendAlertDirect)
+          {
             cameraTool()->Append("TEXT",errStream.str().c_str());
-            cameraTool()->Append("TEXT",odinInfo.c_str());
+            cameraTool()->Append("TEXT",odinInfo.str().c_str());
             cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,"HPD with extended info");
             setFilterPassed(true);
+            // Save messages for snapshots
+            m_snapshotMessages.push_back( errStream.str() );
           }// sendAlert
           if (m_ExtendedVerbose)
             Error(errStream.str());
 
           // disable this HPD in the UKL1 stream
-          if (m_RemoveFaultyHpdUKL1) {
+          if (m_RemoveFaultyHpdUKL1)
+          {
             errStream.str(emptyString);
             errStream << "Request HPD to be disabled, Extended Header "
-              //<< " logical L1 ID  "   << l1LogicalID
-              //<< " L1 Input Ingress " << l1InputIngress
-              //<< " L1 Ingress ID "    << l1IngressID
-              //<< " detector "         << Rich::text(richDetector)
                       << " SmartID "          << smartIDHPD
-                      << idStringUKL1 << ":" << idStringL0;
+                      << idStringUKL1.str() << ":" << idStringL0.str();
             if (m_PrintMessages)
               info()    << errStream.str() << endmsg;
-            if (m_SendAlertDirect) {
+            if (m_SendAlertDirect)
+            {
               cameraTool()->Append("TEXT",errStream.str().c_str());
-              cameraTool()->Append("TEXT",odinInfo.c_str());
+              cameraTool()->Append("TEXT",odinInfo.str().c_str());
               cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name,"Request HPD disable: Extended Header");
             } //sendAlert
             setFilterPassed(true);
-            //hpdDisableTool() -> DisableHPD(smartIDHPD);
+            // Save messages for snapshots
+            m_snapshotMessages.push_back( errStream.str() );
             hpdDisableTool() -> DisableHPD( l1LogicalID, l1InputIngress, l1IngressID, richDetector );
           } //if m_RemoveFaultyHpdUKL1
 
@@ -849,34 +841,33 @@ StatusCode DAQMonitor::execute() {
         }//if extendedHeader
 
         // check for empty HPD
-        if (nHits == 0                  &&
-            !hpdHeader.inhibit()        &&
-            !hpdHeader.extendedFormat()   ) {
-
-          m_AlertEmptyHPD++;
-          counter("AlertEmptyHPD")++;
+        if (nHits == 0                   &&
+            ! hpdHeader.inhibit()        &&
+            ! hpdHeader.extendedFormat() &&
+            ! hpdHeader.aliceMode() )
+        {
+          ++m_AlertEmptyHPD;
+          ++counter("AlertEmptyHPD");
           errStream.str(emptyString);
           errStream << "Empty HPD w/o extended header found "
-            //<< " logical L1 ID  "   << l1LogicalID
-            //<< " L1 Input Ingress " << l1InputIngress
-            //<< " L1 Ingress ID "    << l1IngressID
-            //<< " detector "         << Rich::text(richDetector)
                     << " SmartID "          << smartIDHPD
-                    << idStringUKL1 << ":" << idStringL0;
+                    << idStringUKL1.str() << ":" << idStringL0.str();
           if (m_PrintMessages)
             info() << errStream.str() << endmsg;
 
-          m_AlertMessagesEmptyHPD[errStream.str()] ++ ;
-          //hpdDisableTool() -> ReportHPD(smartIDHPD);
+          ++m_AlertMessagesEmptyHPD[errStream.str()];
           hpdDisableTool() -> ReportHPD(l1LogicalID, l1InputIngress, l1IngressID, richDetector);
           plot1D(hardID.data()     , "ErrorPerHardID"   , "ErrPerHardwareID-" + m_Name, 0,1,1);
           plot1D(l1HardID.data()   , "ErrorPerUKL1Board", "ErrPerUKL1Board-"  + m_Name, 0,1,1);
-          if (m_SendAlertDirect) {
+          if (m_SendAlertDirect) 
+          {
             cameraTool()->Append("TEXT",errStream.str().c_str());
-            cameraTool()->Append("TEXT",odinInfo.c_str());
+            cameraTool()->Append("TEXT",odinInfo.str().c_str());
             cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name,"Empty HPD");
           }// sendAlert
           setFilterPassed(true);
+          // Save messages for snapshots
+          m_snapshotMessages.push_back( errStream.str() );
         } //if nHits
 
         if  ( msgLevel(MSG::VERBOSE) )
@@ -886,57 +877,51 @@ StatusCode DAQMonitor::execute() {
                     << endmsg;
 
 
-        if (hpdHeader.eventID() != ingressHeader.eventID()) {
+        if (hpdHeader.eventID() != ingressHeader.eventID())
+        {
           errStream.str(emptyString);
-          errStream <<
-            //" HPD L0ID: "          << l0ID                    <<
-            //" , L1 logical ID "    << l1LogicalID             <<
-            //" , L1 Input Ingress " << l1InputIngress          <<
-            //" , L1 Ingress ID "    << l1IngressID             <<
-            " , HPD EventID: "     << hpdHeader.eventID()     <<
-            " , Ingress EventID: " << ingressHeader.eventID() << idStringUKL1 << ":" << idStringL0;
+          errStream
+            << "HPD EventID: "     << hpdHeader.eventID() 
+            << " , Ingress EventID: " << ingressHeader.eventID() << idStringUKL1.str() << ":" << idStringL0.str();
 
           if (m_PrintMessages)
             info() << "EventID mis-match "  << errStream.str()  << endmsg;
-          m_AlertEventID++;
-          counter("AlertEventID")++;
-          m_AlertMessagesEventID[errStream.str()]++;
-          //hpdDisableTool() -> ReportHPD(smartIDHPD);
+          ++m_AlertEventID;
+          ++counter("AlertEventID");
+          ++m_AlertMessagesEventID[errStream.str()];
           hpdDisableTool() -> ReportHPD(l1LogicalID, l1InputIngress, l1IngressID, richDetector);
           plot1D(hardID.data()     , "ErrorPerHardID"   , "ErrPerHardwareID-" + m_Name, 0,1,1);
           plot1D(l1HardID.data()   , "ErrorPerUKL1Board", "ErrPerUKL1Board-"  + m_Name, 0,1,1);
-          if (m_SendAlertDirect) {
+          if (m_SendAlertDirect) 
+          {
             cameraTool()->Append("TEXT",errStream.str().c_str());
-            cameraTool()->Append("TEXT",odinInfo.c_str());
+            cameraTool()->Append("TEXT",odinInfo.str().c_str());
             cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,"EventID mismatch");
           }// sendAlert
 
-          if (m_Plot2DHisto)
-            DAQMonitor::PlotErrorHPD(smartIDHPD);
+          if (m_Plot2DHisto) PlotErrorHPD(smartIDHPD);
 
           // disable this HPD in the UKL1 stream
-          if (m_RemoveFaultyHpdUKL1) {
+          if (m_RemoveFaultyHpdUKL1) 
+          {
             errStream.str(emptyString);
             errStream << "Request HPD to be disabled, EventID mis-match "
-              //<< " logical L1 ID  "   << l1LogicalID
-              //<< " L1 Input Ingress " << l1InputIngress
-              //<< " L1 Ingress ID "    << l1IngressID
-              //<< " detector "         << Rich::text(richDetector)
                       << " SmartID "          << smartIDHPD
-                      << idStringUKL1 << ":" << idStringL0;
+                      << idStringUKL1.str() << ":" << idStringL0.str();
             if (m_PrintMessages)
               info()    << errStream.str() << endmsg;
-            if (m_SendAlertDirect) {
+            if (m_SendAlertDirect)
+            {
               cameraTool()->Append("TEXT",errStream.str().c_str());
-              cameraTool()->Append("TEXT",odinInfo.c_str());
+              cameraTool()->Append("TEXT",odinInfo.str().c_str());
               cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name,"Request HPD disable: EventID mis-match");
             } //sendAlert
-            //hpdDisableTool() -> DisableHPD(smartIDHPD);
             hpdDisableTool() -> DisableHPD( l1LogicalID, l1InputIngress, l1IngressID, richDetector );
           } //if m_RemoveFaultyHpdUKL1
         }//if eventID
 
-        if (hpdHeader.l0ID() != l0ID) {
+        if (hpdHeader.l0ID() != l0ID)
+        {
           errStream.str(emptyString);
           errStream <<
             "L0 ID (SmartID): " << l0ID             <<
@@ -944,105 +929,109 @@ StatusCode DAQMonitor::execute() {
           if (m_PrintMessages)
             info() << "L0 ID mis-match " << errStream.str()  << endmsg;
 
-          m_AlertL0ID++;
-          m_AlertMessagesL0ID[errStream.str()]++;
-          //hpdDisableTool() -> ReportHPD(smartIDHPD);
+          ++m_AlertL0ID;
+          ++m_AlertMessagesL0ID[errStream.str()];
           hpdDisableTool() -> ReportHPD(l1LogicalID, l1InputIngress, l1IngressID, richDetector);
           plot1D(hardID.data()     , "ErrorPerHardID"   , "ErrPerHardwareID-" + m_Name, 0,1,1);
           plot1D(l1HardID.data()   , "ErrorPerUKL1Board", "ErrPerUKL1Board-"  + m_Name, 0,1,1);
-          if (m_SendAlertDirect) {
+          if (m_SendAlertDirect)
+          {
             cameraTool()->Append("TEXT",errStream.str().c_str());
-            cameraTool()->Append("TEXT",odinInfo.c_str());
+            cameraTool()->Append("TEXT",odinInfo.str().c_str());
             cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,"L0ID mismatch");
           }// sendAlert
           setFilterPassed(true);
+          // Save messages for snapshots
+          m_snapshotMessages.push_back( errStream.str() );
 
           // disable this HPD in the UKL1 stream
-          if (m_RemoveFaultyHpdUKL1) {
+          if (m_RemoveFaultyHpdUKL1)
+          {
             errStream.str(emptyString);
             errStream << "Request HPD to be disabled, L0ID mis-match "
-              //<< " logical L1 ID  "   << l1LogicalID
-              //<< " L1 Input Ingress " << l1InputIngress
-              //<< " L1 Ingress ID "    << l1IngressID
-              //<< " detector "         << Rich::text(richDetector)
                       << " SmartID "          << smartIDHPD
-                      << idStringUKL1 << ":" << idStringL0;
+                      << idStringUKL1.str() << ":" << idStringL0.str();
             if (m_PrintMessages)
-              info()    << errStream.str() << endmsg;
-            if (m_SendAlertDirect) {
+              info() << errStream.str() << endmsg;
+            if (m_SendAlertDirect) 
+            {
               cameraTool()->Append("TEXT",errStream.str().c_str());
-              cameraTool()->Append("TEXT",odinInfo.c_str());
+              cameraTool()->Append("TEXT",odinInfo.str().c_str());
               cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name.c_str(),"Request HPD disable: L0ID mis-match");
             } //sendAlert
-            //hpdDisableTool() -> DisableHPD(smartIDHPD);
             hpdDisableTool() -> DisableHPD( l1LogicalID, l1InputIngress, l1IngressID, richDetector );
             setFilterPassed(true);
+            // Save messages for snapshots
+            m_snapshotMessages.push_back( errStream.str() );
           } //if m_RemoveFaultyHpdUKL1
 
-          counter("AlertL0ID")++;
+          ++counter("AlertL0ID");
           plot1D(hardID.data()     , "ErrorPerHardID"   , "ErrPerHardwareID-" + m_Name, 0,1,1);
           plot1D(l1HardID.data()   , "ErrorPerUKL1Board", "ErrPerUKL1Board-"  + m_Name, 0,1,1);
 
-          if (m_Plot2DHisto)
-            DAQMonitor::PlotErrorHPD(smartIDHPD);
+          if (m_Plot2DHisto) PlotErrorHPD(smartIDHPD);
         }// if L0ID
 
         // check footer
         if  ( msgLevel(MSG::VERBOSE) )
           verbose() << "HPD footer has parity word " << hpdFooter.hasParityWord () << endmsg;
-        if (hpdFooter.hasParityWord()) {
+        if (hpdFooter.hasParityWord()) 
+        {
           const Rich::DAQ::LongType parityWord = hpdFooter.parityWord();
           bool  parityOK = hpdFooter.testParityWord(parityWord);
           if  ( msgLevel(MSG::VERBOSE) )
             verbose() << "   parity word " << parityWord << " is OK " << parityOK << endmsg;
-          if (!parityOK) {
+          if (!parityOK) 
+          {
             errStream.str(emptyString);
             errStream <<
               " HPD L0ID: "        << l0ID                     <<
               " IngressID "        << l1IngressID              <<
-              " HPD EventID "      << hpdHeader.eventID()      << idStringUKL1 << ":" << idStringL0;
+              " HPD EventID "      << hpdHeader.eventID()      << idStringUKL1.str() << ":" << idStringL0.str();
             if (m_PrintMessages)
               info() << "Footer parity word not OK " << errStream.str()  << endmsg;
 
-            counter("AlertParityFooter")++;
+            ++counter("AlertParityFooter");
             plot1D(hardID.data()    , "ErrorPerHardID"   , "ErrPerHardwareID-" + m_Name, 0,1,1);
             plot1D(l1HardID.data()  , "ErrorPerUKL1Board", "ErrPerUKL1Board-"  + m_Name, 0,1,1);
             //hpdDisableTool() -> ReportHPD(smartIDHPD);
             hpdDisableTool() -> ReportHPD(l1LogicalID, l1InputIngress, l1IngressID, richDetector);
 
-            m_AlertParityFooter++;
-            m_AlertMessagesParityFooter[errStream.str()]++;
-            if (m_SendAlertDirect) {
+            ++m_AlertParityFooter;
+            ++m_AlertMessagesParityFooter[errStream.str()];
+            if (m_SendAlertDirect)
+            {
               cameraTool()->Append("TEXT",errStream.str().c_str());
-              cameraTool()->Append("TEXT",odinInfo.c_str());
+              cameraTool()->Append("TEXT",odinInfo.str().c_str());
               cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,"Parity footer error");
             }// sendAlert
             setFilterPassed(true);
+            // Save messages for snapshots
+            m_snapshotMessages.push_back( errStream.str() );
 
             // disable this HPD in the UKL1 stream
-            if (m_RemoveFaultyHpdUKL1) {
+            if (m_RemoveFaultyHpdUKL1)
+            {
               errStream.str(emptyString);
               errStream << "Request HPD to be disabled, Parity footer mis-match "
-                //<< " logical L1 ID  "   << l1LogicalID
-                //<< " L1 Input Ingress " << l1InputIngress
-                //<< " L1 Ingress ID "    << l1IngressID
-                //<< " detector "         << Rich::text(richDetector)
                         << " SmartID "          << smartIDHPD
-                        << idStringUKL1 << ":" << idStringL0;
+                        << idStringUKL1.str() << ":" << idStringL0.str();
               if (m_PrintMessages)
                 info()    << errStream.str() << endmsg;
-              if (m_SendAlertDirect) {
+              if (m_SendAlertDirect)
+              {
                 cameraTool()->Append("TEXT",errStream.str().c_str());
-                cameraTool()->Append("TEXT",odinInfo.c_str());
+                cameraTool()->Append("TEXT",odinInfo.str().c_str());
                 cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name,"Request HPD disable: parity footer mis-match");
               } //sendAlert
               setFilterPassed(true);
+              // Save messages for snapshots
+              m_snapshotMessages.push_back( errStream.str() );
               //hpdDisableTool() -> DisableHPD(smartIDHPD);
               hpdDisableTool() -> DisableHPD( l1LogicalID, l1InputIngress, l1IngressID, richDetector );
             } //if m_RemoveFaultyHpdUKL1
 
-            if (m_Plot2DHisto)
-              DAQMonitor::PlotErrorHPD(smartIDHPD);
+            if (m_Plot2DHisto) PlotErrorHPD(smartIDHPD);
           }// if !parityOK
         }// if parityWord
 
@@ -1054,13 +1043,14 @@ StatusCode DAQMonitor::execute() {
       // check number of active HPDs
       // N.B. dynamically inhibited HPDs should not be reported
       //
-      if (hpdMap.size() != ingressHeader.numActiveHPDs() - nInhibitedHPDs) {
+      if (hpdMap.size() != ingressHeader.numActiveHPDs() - nInhibitedHPDs) 
+      {
         if  ( msgLevel(MSG::VERBOSE) )
           verbose() << "HPD map size "     << hpdMap.size()
                     << " from ingress "    << ingressHeader.numActiveHPDs()
                     << " #inhibited HPDs " << nInhibitedHPDs
                     << endmsg;
-        counter("AlertActiveHPDs")++;
+        ++counter("AlertActiveHPDs");
         plot1D(l1HardID.data(),"ErrorPerUKL1Board", "ErrPerUKL1Board-" + m_Name, 0,1,1);
         errStream.str(emptyString);
         errStream << "size of HPDMap "    << hpdMap.size()
@@ -1070,20 +1060,24 @@ StatusCode DAQMonitor::execute() {
                   << " L1 ID (hardware) " << l1HardID
                   << " L1 ID (logical) "  << l1LogicalID
                   << " RICH "             << richDetector;
-        m_AlertActiveHPDs++;
-        counter("AlertActiveHPDs")++;
-        m_AlertMessagesActiveHPD[errStream.str()]++;
-        if (m_SendAlertDirect) {
+        ++m_AlertActiveHPDs;
+        ++counter("AlertActiveHPDs");
+        ++m_AlertMessagesActiveHPD[errStream.str()];
+        if (m_SendAlertDirect) 
+        {
           cameraTool()->Append("TEXT",errStream.str().c_str());
-          cameraTool()->Append("TEXT",odinInfo.c_str());
+          cameraTool()->Append("TEXT",odinInfo.str().c_str());
           cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,"#active HPDs mismatch");
           setFilterPassed(true);
+          // Save messages for snapshots
+          m_snapshotMessages.push_back( errStream.str() );
         }//if sendDirect
       } // if hpdMap.size()
     } //for iIngressMap
 
-    if (UKL1HasSuppressedIngress) {
-      plot1D(l1HardID.data(),"TruncatedEventUKL1", "TruncatedEventUKL1-" + m_Name, 0,1,1);
+    if (UKL1HasSuppressedIngress)
+    {
+      plot1D( l1HardID.data(), "TruncatedEventUKL1", "TruncatedEventUKL1-" + m_Name, 0,1,1 );
     } // if hasSuppressed
 
   }//for iL1Map
@@ -1093,63 +1087,82 @@ StatusCode DAQMonitor::execute() {
   // check if there are any LO IDs reported multiple times
   //
   std::map<Rich::DAQ::Level0ID,int>::const_iterator iL0Map;
-  std::map<Rich::DAQ::Level0ID,int>::const_iterator iL0MapBegin =  l0MapHPD.begin();
-  std::map<Rich::DAQ::Level0ID,int>::const_iterator iL0MapEnd =  l0MapHPD.end();
-  for (iL0Map = iL0MapBegin; iL0Map != iL0MapEnd; iL0Map++) {
-    int nL0 = iL0Map->second;
-    if (nL0 >1) {
+  std::map<Rich::DAQ::Level0ID,int>::const_iterator iL0MapBegin = l0MapHPD.begin();
+  std::map<Rich::DAQ::Level0ID,int>::const_iterator iL0MapEnd   = l0MapHPD.end();
+  for (iL0Map = iL0MapBegin; iL0Map != iL0MapEnd; ++iL0Map)
+  {
+    const int nL0 = iL0Map->second;
+    if (nL0 >1)
+    {
       errStream.str(emptyString);
-      errStream << "!! Dublicate L0IDs in RICH!! L0ID " << iL0Map->first << " occoured " << nL0 << " times ";
+      errStream << "!! Duplicate L0IDs in RICH!! L0ID " << iL0Map->first << " occurred " << nL0 << " times ";
       error() << errStream.str() << endmsg;
 
-      m_AlertDublicateHPDL0++;
-      counter("AlertDublicateHPDL0")++;
-      m_AlertMessagesDublicateHPDL0[errStream.str()]++;
-      if (m_SendAlertDirect) {
+      ++m_AlertDuplicateHPDL0;
+      ++counter("AlertDuplicateHPDL0");
+      ++m_AlertMessagesDuplicateHPDL0[errStream.str()];
+      if (m_SendAlertDirect)
+      {
         cameraTool()->Append("TEXT",errStream.str().c_str());
-        cameraTool()->Append("TEXT",odinInfo.c_str());
-        cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,"Dublicate L0 IDs");
-
+        cameraTool()->Append("TEXT",odinInfo.str().c_str());
+        cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,"Duplicate L0 IDs");
         setFilterPassed(true);
+        // Save messages for snapshots
+        m_snapshotMessages.push_back( errStream.str() );
       }//if sendDirect
     } //if
   } //for
 
-  if (nAllHits <= 0) {
-    counter("AlertEmptyEvent")++; // send alarm to PVSS
+  if (nAllHits <= 0)
+  {
+    ++counter("AlertEmptyEvent"); // send alarm to PVSS
     if  ( msgLevel(MSG::VERBOSE) )
       verbose() << "No hits found in event " << m_nEvts << ", number of empty events now "
                 << counter("AlertEmptyEvent").nEntries() << endmsg;
     errStream.str(emptyString);
     errStream << "#empty events now:" << counter("AlertEmptyEvent").nEntries();
-    m_AlertEmptyEvent++;
-    if (m_SendAlertDirect && m_TaeLocation != "") {
+    ++m_AlertEmptyEvent;
+    if (m_SendAlertDirect && !m_TaeLocation.empty()) 
+    {
       // don't report this as error for other than central bin
       cameraTool()->Append("TEXT",errStream.str().c_str());
-      cameraTool()->Append("TEXT",odinInfo.c_str());
+      cameraTool()->Append("TEXT",odinInfo.str().c_str());
       cameraTool()->SendAndClearTS(ICameraTool::INFO,m_Name,"Empty event");
-    }// sendAlert
-  } //if
+    }
+  }
 
   //
-  // send alerts to CAMERA every nth event
+  // send alerts to CAMERA every n'th event
   //
-  if ( sendErrorReport) {
-    debug() << " ======= Now send error report " << odinInfo << endmsg;
-    StatusCode sc = DAQMonitor::SendErrorSummary(odinInfo);
-    if (sc != StatusCode::SUCCESS) {
-      Warning("Error sending StatusReport");
-      return sc;
+  if ( sendErrorReport ) 
+  {
+    debug() << "Now send error report " << odinInfo.str() << endmsg;
+    const StatusCode sc = SendErrorSummary(odinInfo.str());
+    if ( sc.isFailure() ) 
+    {
+      return Warning("Error sending StatusReport",sc);
     }// if sc
     debug() << " ======= End of error report" << endmsg;
   } // if sendErrorReport
 
+  // Send cached messages to camera for inclusion in snapshots
+  if ( !m_snapshotMessages.empty() )
+  {
+    cameraTool()->Append("TEXT",odinInfo.str().c_str());
+    for ( std::vector<std::string>::const_iterator iM = m_snapshotMessages.begin();
+          iM != m_snapshotMessages.end(); ++iM )
+    {
+      cameraTool()->Append("TEXT",(*iM).c_str());
+    }
+  }
+
   return StatusCode::SUCCESS;
 } // execute
 
 //=============================================================================
 //=============================================================================
-StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
+StatusCode DAQMonitor::SendErrorSummary(const std::string& odinInfo)
+{
 
   // Use this ostringstream to create error messages that are sent to CAMERA and the message streams if the level is appropriate.
   std::ostringstream errStream;
@@ -1162,7 +1175,8 @@ StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
     verbose() << "send alerts to CAMERA" << endmsg;
   // cameraTool()->SendAndClearTS(ICameraTool::IFNO,m_Name,"now send error summary");
 
-  if (m_AlertEmptyEvent > 0 && m_TaeLocation != "") {
+  if (m_AlertEmptyEvent > 0 && !m_TaeLocation.empty())
+  {
     // don't report this as error for other than central bins in TAE mode
     errStream.str(emptyString);
     errStream <<  "total #empty events " << counter("AlertEmptyEvent").nEntries();
@@ -1178,11 +1192,14 @@ StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
   std::map<std::string,int>::const_iterator iAlertBegin;
   std::map<std::string,int>::const_iterator iAlertEnd;
 
-  if (m_AlertActiveHPDs > 0) {
-    if (m_SendAlertMessages) {
+  if (m_AlertActiveHPDs > 0)
+  {
+    if (m_SendAlertMessages) 
+    {
       iAlertBegin = m_AlertMessagesActiveHPD.begin();
       iAlertEnd   = m_AlertMessagesActiveHPD.end();
-      for (iAlert = iAlertBegin; iAlert != iAlertEnd; iAlert++) {
+      for (iAlert = iAlertBegin; iAlert != iAlertEnd; ++iAlert)
+      {
         errStream.str(emptyString);
         errStream << (*iAlert).first
                   << " #incidents "  << (*iAlert).second;
@@ -1202,11 +1219,14 @@ StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
     cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,errStream.str());
   }//if
 
-  if (m_AlertEventID > 0) {
-    if (m_SendAlertMessages) {
+  if (m_AlertEventID > 0)
+  {
+    if (m_SendAlertMessages) 
+    {
       iAlertBegin = m_AlertMessagesEventID.begin();
       iAlertEnd   = m_AlertMessagesEventID.end();
-      for (iAlert = iAlertBegin; iAlert != iAlertEnd; iAlert++) {
+      for (iAlert = iAlertBegin; iAlert != iAlertEnd; ++iAlert)
+      {
         errStream.str(emptyString);
         errStream << (*iAlert).first
                   << " #incidents " << (*iAlert).second;
@@ -1225,11 +1245,14 @@ StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
     cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,errStream.str());
   }//if
 
-  if (m_AlertBxID >0){
-    if (m_SendAlertMessages) {
+  if (m_AlertBxID >0)
+  {
+    if (m_SendAlertMessages) 
+    {
       iAlertBegin = m_AlertMessagesBxID.begin();
       iAlertEnd   = m_AlertMessagesBxID.end();
-      for (iAlert = iAlertBegin; iAlert != iAlertEnd; iAlert++) {
+      for (iAlert = iAlertBegin; iAlert != iAlertEnd; ++iAlert)
+      {
         errStream.str(emptyString);
         errStream << (*iAlert).first
                   << " #incidents "  << (*iAlert).second;
@@ -1248,11 +1271,14 @@ StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
     cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,errStream.str());
   }//if
 
-  if (m_AlertL0ID > 0) {
-    if (m_SendAlertMessages) {
+  if (m_AlertL0ID > 0) 
+  {
+    if (m_SendAlertMessages) 
+    {
       iAlertBegin = m_AlertMessagesL0ID.begin();
       iAlertEnd   = m_AlertMessagesL0ID.end();
-      for (iAlert = iAlertBegin; iAlert != iAlertEnd; iAlert++) {
+      for (iAlert = iAlertBegin; iAlert != iAlertEnd; ++iAlert) 
+      {
         errStream.str(emptyString);
         errStream << (*iAlert).first
                   << " #incidents "  << (*iAlert).second;
@@ -1271,7 +1297,8 @@ StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
     cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,errStream.str());
   }//if
 
-  if (m_AlertInvalidOdinTime > 0) {
+  if (m_AlertInvalidOdinTime > 0) 
+  {
     errStream.str(emptyString);
     errStream << "#invalid ODIN times in past " << m_UpdateTimerInterval
               << " seconds: "                   << m_AlertInvalidOdinTime;
@@ -1279,7 +1306,8 @@ StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
     warning() << errStream.str() << endmsg;
   }//if
 
-  if ( m_AlertMissingOdin > 0) {
+  if ( m_AlertMissingOdin > 0) 
+  {
     errStream.str(emptyString);
     errStream << "#missing ODIN bank in past " << m_UpdateTimerInterval
               << " seconds: "                  << m_AlertMissingOdin;
@@ -1287,11 +1315,14 @@ StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
     warning() << errStream.str() << endmsg;
   }//if
 
-  if (m_AlertParityFooter > 0) {
-    if (m_SendAlertMessages) {
+  if (m_AlertParityFooter > 0) 
+  {
+    if (m_SendAlertMessages)
+    {
       iAlertBegin = m_AlertMessagesParityFooter.begin();
       iAlertEnd   = m_AlertMessagesParityFooter.end();
-      for (iAlert = iAlertBegin; iAlert != iAlertEnd; iAlert++) {
+      for (iAlert = iAlertBegin; iAlert != iAlertEnd; ++iAlert) 
+      {
         errStream.str(emptyString);
         errStream << (*iAlert).first
                   << " #incidents "  << (*iAlert).second;
@@ -1310,11 +1341,14 @@ StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
     cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,errStream.str());
   }//if parityFooter
 
-  if (m_AlertHPDNotInhibitInvalidSmartRef > 0) {
-    if (m_SendAlertMessages) {
+  if (m_AlertHPDNotInhibitInvalidSmartRef > 0) 
+  {
+    if (m_SendAlertMessages)
+    {
       iAlertBegin = m_AlertMessagesHPDNotInhibitInvalidSmartRef.begin();
       iAlertEnd   = m_AlertMessagesHPDNotInhibitInvalidSmartRef.end();
-      for (iAlert = iAlertBegin; iAlert != iAlertEnd; iAlert++) {
+      for (iAlert = iAlertBegin; iAlert != iAlertEnd; ++iAlert)
+      {
         errStream.str(emptyString);
         errStream << (*iAlert).first
                   << " #incidents "  << (*iAlert).second;
@@ -1334,11 +1368,14 @@ StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
   }//if parityFooter
 
 
-  if (m_AlertExtendedHeader) {
-    if (m_SendAlertMessages) {
+  if (m_AlertExtendedHeader>0) 
+  {
+    if (m_SendAlertMessages) 
+    {
       iAlertBegin = m_AlertMessagesExtendedHeader.begin();
       iAlertEnd   = m_AlertMessagesExtendedHeader.end();
-      for (iAlert = iAlertBegin; iAlert != iAlertEnd; iAlert++) {
+      for (iAlert = iAlertBegin; iAlert != iAlertEnd; ++iAlert)
+      {
         errStream.str(emptyString);
         errStream << (*iAlert).first
                   << " #incidents "  << (*iAlert).second;
@@ -1358,11 +1395,14 @@ StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
     cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,errStream.str());
   } //if extended Header
 
-  if (m_AlertHPDSuppressed) {
-    if (m_SendAlertMessages) {
+  if (m_AlertHPDSuppressed>0) 
+  {
+    if (m_SendAlertMessages) 
+    {
       iAlertBegin = m_AlertMessagesHPDSuppressed.begin();
       iAlertEnd   = m_AlertMessagesHPDSuppressed.end();
-      for (iAlert = iAlertBegin; iAlert != iAlertEnd; iAlert++) {
+      for (iAlert = iAlertBegin; iAlert != iAlertEnd; ++iAlert)
+      {
         errStream.str(emptyString);
         errStream << (*iAlert).first
                   << " #incidents "  << (*iAlert).second;
@@ -1382,11 +1422,14 @@ StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
     cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name,errStream.str());
   }
 
-  if (m_AlertEmptyHPD) {
-    if (m_SendAlertMessages) {
+  if (m_AlertEmptyHPD>0)
+  {
+    if (m_SendAlertMessages) 
+    {
       iAlertBegin = m_AlertMessagesEmptyHPD.begin();
       iAlertEnd   = m_AlertMessagesEmptyHPD.end();
-      for (iAlert = iAlertBegin; iAlert != iAlertEnd; iAlert++) {
+      for (iAlert = iAlertBegin; iAlert != iAlertEnd; ++iAlert) 
+      {
         errStream.str(emptyString);
         errStream << (*iAlert).first
                   << " #incidents "  << (*iAlert).second;
@@ -1407,11 +1450,14 @@ StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
   } //if EmptyHPD
 
   //
-  if (m_AlertDublicateHPDL0) {
-    if (m_SendAlertMessages) {
-      iAlertBegin = m_AlertMessagesDublicateHPDL0.begin();
-      iAlertEnd   = m_AlertMessagesDublicateHPDL0.end();
-      for (iAlert = iAlertBegin; iAlert != iAlertEnd; iAlert++) {
+  if (m_AlertDuplicateHPDL0>0) 
+  {
+    if (m_SendAlertMessages)
+    {
+      iAlertBegin = m_AlertMessagesDuplicateHPDL0.begin();
+      iAlertEnd   = m_AlertMessagesDuplicateHPDL0.end();
+      for (iAlert = iAlertBegin; iAlert != iAlertEnd; ++iAlert) 
+      {
         errStream.str(emptyString);
         errStream << (*iAlert).first
                   << " #incidents "  << (*iAlert).second;
@@ -1425,20 +1471,21 @@ StatusCode DAQMonitor::SendErrorSummary(std::string odinInfo) {
       } //for
     } //if sendAlert
     errStream.str(emptyString);
-    errStream << "#dublicate L0 IDs   " << m_UpdateTimerInterval
-              << " seconds: "           << m_AlertDublicateHPDL0;
+    errStream << "#duplicate L0 IDs   " << m_UpdateTimerInterval
+              << " seconds: "           << m_AlertDuplicateHPDL0;
 
     cameraTool()->SendAndClearTS(ICameraTool::ERROR,m_Name,errStream.str());
   } //if EmptyHPD
 
-  DAQMonitor::ResetCounters();
+  ResetCounters();
 
   return StatusCode::SUCCESS;
 } // DAQMonitor::SendErrorSummary
 //=============================================================================
 //=============================================================================
 
-StatusCode DAQMonitor::ResetCounters() {
+void DAQMonitor::ResetCounters()
+{
   //
   // reset
   //
@@ -1455,7 +1502,7 @@ StatusCode DAQMonitor::ResetCounters() {
   m_AlertExtendedHeader                = 0;
   m_AlertHPDSuppressed                 = 0;
   m_AlertEmptyHPD                      = 0;
-  m_AlertDublicateHPDL0                = 0;
+  m_AlertDuplicateHPDL0                = 0;
 
   m_AlertMessagesActiveHPD.clear();
   m_AlertMessagesEventID.clear();
@@ -1467,17 +1514,16 @@ StatusCode DAQMonitor::ResetCounters() {
   m_AlertMessagesExtendedHeader.clear();
   m_AlertMessagesHPDSuppressed.clear();
   m_AlertMessagesEmptyHPD.clear();
-  m_AlertMessagesDublicateHPDL0.clear();
-
+  m_AlertMessagesDuplicateHPDL0.clear();
 
-  return StatusCode::SUCCESS;
 } // DAQMonitor::ResetCounters
 //=============================================================================
 //=============================================================================
-StatusCode DAQMonitor::PlotErrorHPD(const LHCb::RichSmartID &smartID) {
-
+StatusCode DAQMonitor::PlotErrorHPD(const LHCb::RichSmartID &smartID)
+{
 
-  if (!m_Plot2DHisto) {
+  if (!m_Plot2DHisto) 
+  {
     verbose() << " DAQMonitor::PlotErrorHPD should not have been called" << endmsg;
     return StatusCode::SUCCESS;
   } //if
@@ -1490,21 +1536,23 @@ StatusCode DAQMonitor::PlotErrorHPD(const LHCb::RichSmartID &smartID) {
   StatusCode sc = StatusCode::SUCCESS;
 
   if (smartID.rich()  != Rich::InvalidDetector &&
-      smartID.panel() != Rich::InvalidSide) {
+      smartID.panel() != Rich::InvalidSide)
+  {
     iRich     = (int) smartID.rich();
     iPanel    = (int) smartID.panel();
     iCol      = (int) smartID.hpdCol();
     iHpdInCol = (int) smartID.hpdNumInCol();
 
-    std::string histoName = "DAQErrorRich" + boost::lexical_cast<std::string>(iRich+1) +
-      "Side" + boost::lexical_cast<std::string>(iPanel);
-
+    std::ostringstream histoName;
+    histoName << "DAQErrorRich" << iRich+1 << "Side" << iPanel;
 
     if ( msgLevel(MSG::VERBOSE) )
-      verbose() << "Fill histogram with title " << histoName << endmsg;
-    plot2D( iCol , iHpdInCol, histoName, histoName, 0,0,0, 0,0,0);
+      verbose() << "Fill histogram with title " << histoName.str() << endmsg;
+    plot2D( iCol ,iHpdInCol, histoName.str(), histoName.str(), 0,0,0, 0,0,0);
 
-  } else {
+  }
+  else 
+  {
     sc = StatusCode::FAILURE;
   }// if not invalid Rich, Panel
 
diff --git a/Rich/RichOnlineMonitors/src/RichDAQMonitor.h b/Rich/RichOnlineMonitors/src/RichDAQMonitor.h
index 10485faa..f14cfd4f 100755
--- a/Rich/RichOnlineMonitors/src/RichDAQMonitor.h
+++ b/Rich/RichOnlineMonitors/src/RichDAQMonitor.h
@@ -102,9 +102,9 @@ namespace Rich
 
     private:
 
-      StatusCode SendErrorSummary(std::string odinInfo="");
+      StatusCode SendErrorSummary(const std::string& odinInfo="");
       StatusCode PlotErrorHPD(const LHCb::RichSmartID &smartID);
-      StatusCode ResetCounters();
+      void ResetCounters();
 
     private:
 
@@ -120,8 +120,7 @@ namespace Rich
       mutable ICameraTool * m_CamTool;               ///< CAMERA error reporting tool
 
       unsigned long m_nEvts;                 ///< Event count
-      unsigned long m_nMonitoredEvents;      ///< monitored events count
-      int           m_MonitorRate;           ///< monitor only each Nth event
+      unsigned long m_nEvtsLastUpdate;       ///< Event count for last message
       bool          m_ExtendedVerbose;       ///< even more output
       ulonglong     m_OdinMinGpsTime;        ///< Time at which data is considered to be valid
       int           m_NL1Boards;             ///< Number of UKL1 boards used
@@ -141,7 +140,7 @@ namespace Rich
       int   m_AlertEmptyEvent;
       int   m_AlertActiveHPDs;
       int   m_AlertEmptyHPD;
-      int   m_AlertDublicateHPDL0;
+      int   m_AlertDuplicateHPDL0;
       int   m_AlertEventID;
       int   m_AlertBxID;
       int   m_AlertL0ID;
@@ -155,9 +154,7 @@ namespace Rich
       bool  m_SendAlertMessages;           ///< send text in addition to number of occourrance
       bool  m_SendAlertDirect;             ///< send alerts as they arise to CAMERA (or just every nth event as summary)
       int   m_AlertLevelBxID;              ///< level with which BsID errors are sent to CAMERA
-      bool  m_Plot2DHisto;
-
-      
+      bool  m_Plot2DHisto;      
 
 
       std::map<std::string,int>  m_AlertMessagesEventID; ///< messages sent to CAMERA
@@ -170,7 +167,7 @@ namespace Rich
       std::map<std::string,int>  m_AlertMessagesExtendedHeader;
       std::map<std::string,int>  m_AlertMessagesHPDSuppressed;
       std::map<std::string,int>  m_AlertMessagesEmptyHPD;
-      std::map<std::string,int>  m_AlertMessagesDublicateHPDL0;
+      std::map<std::string,int>  m_AlertMessagesDuplicateHPDL0;
 
     };
 
diff --git a/Rich/RichOnlineMonitors/src/RichHPDNHitMonitor.cpp b/Rich/RichOnlineMonitors/src/RichHPDNHitMonitor.cpp
index a0793888..5a297734 100755
--- a/Rich/RichOnlineMonitors/src/RichHPDNHitMonitor.cpp
+++ b/Rich/RichOnlineMonitors/src/RichHPDNHitMonitor.cpp
@@ -58,27 +58,25 @@ DECLARE_ALGORITHM_FACTORY( HPDNHitMonitor )
       m_TimeStart               (     0              ),
       m_TimeLastUpdate          (     0              )
 {
+  declareProperty( "FillHistos"              , m_FillHistos          =  true );
+  declareProperty( "ExtendedVerbose"         , m_ExtendedVerbose     = false );
 
-  declareProperty( "MonitorRate"             , m_MonitorRate         =     1);
-  declareProperty( "FillHistos"              , m_FillHistos          =  true);
-  declareProperty( "ExtendedVerbose"         , m_ExtendedVerbose     = false);
+  declareProperty( "HistoNHitMin"            , m_HistoNHitMin        =     0 );
+  declareProperty( "HistoNHitMax"            , m_HistoNHitMax        =   100 );
 
-  declareProperty( "HistoNHitMin"            , m_HistoNHitMin        =     0);
-  declareProperty( "HistoNHitMax"            , m_HistoNHitMax        =   100);
+  declareProperty( "RemoveFaultyHpdUKL1"     , m_RemoveFaultyHpdUKL1 = false );
+  declareProperty( "HitThreshold"            , m_HitThreshold        =    50 );
 
-  declareProperty( "RemoveFaultyHpdUKL1"     , m_RemoveFaultyHpdUKL1 = false);
-  declareProperty( "HitThreshold"            , m_HitThreshold        =    50);
+  declareProperty( "RawEventLocations"       , m_taeEvents                   );
 
-  declareProperty( "RawEventLocations"       , m_taeEvents                  );
+  declareProperty( "MovingAverageEventsFast" , m_MovingAverageEventsFast = 50 );
+  declareProperty( "MovingAverageEventsSlow" , m_MovingAverageEventsSlow = 500);
 
-  declareProperty( "MovingAverageEventsFast" , m_MovingAverageEventsFast =   50);
-  declareProperty( "MovingAverageEventsSlow" , m_MovingAverageEventsSlow =   500);
+  declareProperty( "PullThreshold"           , m_PullThreshold       =     5 );
 
-  declareProperty( "PullThreshold"           , m_PullThreshold       =     5);
+  declareProperty( "UpdateTimerInterval"     , m_UpdateTimerInterval =   300 );
 
-  declareProperty( "UpdateTimerInterval"     , m_UpdateTimerInterval =    10);
-
-  declareProperty( "TriggerTypes"            , m_TriggerTypes               );
+  declareProperty( "TriggerTypes"            , m_TriggerTypes                );
 }
 //=============================================================================
 // Destructor
@@ -107,7 +105,6 @@ StatusCode HPDNHitMonitor::initialize()
   {
     if (partitionName)
       info() << "running in partition " << std::string(partitionName) << endmsg;
-    info() << "Monitor each                " << m_MonitorRate << "th event"        << endmsg;
     info() << "Fill histograms             " << m_FillHistos                       << endmsg;
     info() << "Threshold for too many hits " << m_HitThreshold                     << endmsg;
     info() << "Send diable command to UKL1 " << m_RemoveFaultyHpdUKL1              << endmsg;
@@ -127,14 +124,6 @@ StatusCode HPDNHitMonitor::initialize()
     } // if
   }
 
-  //
-  // Get SmartIDs of all active HPDs which should be monitored
-  // The list is obtained from DeRichSystem which gets it from the
-  // ConditionDB for a given run period
-  //
-  const LHCb::RichSmartID::Vector & m_activeHPDs = deRichSys()->activeHPDRichSmartIDs();
-  info() << "Number of currently active HPDs to monitor " << m_activeHPDs.size() << endmsg;
-
   std::string taeEventList;
   for ( std::vector<std::string>::const_iterator taeIter = m_taeEvents.begin();
         taeIter != m_taeEvents.end(); ++taeIter )
@@ -147,11 +136,11 @@ StatusCode HPDNHitMonitor::initialize()
   if ( m_FillHistos )
   {
     book1D("NHitInclusive"     , "Number of hits in RICH " + taeEventList  ,
-           m_HistoNHitMin - 0.5, m_HistoNHitMax+0.5, 100); // m_HistoNHitMax - m_HistoNHitMin +1);
+           m_HistoNHitMin - 0.5, m_HistoNHitMax + 0.5, 100); // m_HistoNHitMax - m_HistoNHitMin +1);
     book1D("NHitInclusiveRich1", "Number of hits in RICH 1 " + taeEventList ,
-           m_HistoNHitMin - 0.5, m_HistoNHitMax+0.5, 100); // m_HistoNHitMax - m_HistoNHitMin +1);
+           m_HistoNHitMin - 0.5, m_HistoNHitMax + 0.5, 100); // m_HistoNHitMax - m_HistoNHitMin +1);
     book1D("NHitInclusiveRich2", "Number of hits in RICH 2 " + taeEventList,
-           m_HistoNHitMin - 0.5, m_HistoNHitMax+0.5, 100); //m_HistoNHitMax - m_HistoNHitMin +1);
+           m_HistoNHitMin - 0.5, m_HistoNHitMax + 0.5, 100); //m_HistoNHitMax - m_HistoNHitMin +1);
     Book2DHisto (Rich::Rich1, Rich::top   ,  taeEventList);
     Book2DHisto (Rich::Rich1, Rich::bottom,  taeEventList);
     Book2DHisto (Rich::Rich2, Rich::left  ,  taeEventList);
@@ -182,6 +171,10 @@ StatusCode HPDNHitMonitor::initialize()
   cameraTool()->Append("TEXT",m_Name.c_str());
   cameraTool()->SendAndClearTS(ICameraTool::INFO,m_Name,"Initialized");
 
+  // load occupancy tools (for testing)
+  //fastHPDOcc();
+  //slowHPDOcc();
+
   return sc;
 }
 
@@ -193,17 +186,24 @@ StatusCode HPDNHitMonitor::execute()
   StatusCode sc = StatusCode::SUCCESS;
 
   // by default no events are 'selected'
-  // only bad events should be selected
+  // only bad events should be selected (sent to the event snapshot alg)
   setFilterPassed(false);
 
-  m_nEvts++;
-  if (m_nEvts ==1) {
-    info()  << "==> First event seen  " << endmsg;
+  // cached messages to add to camera, for inclusion in a possible event snapshot
+  std::vector<std::string> m_snapshotMessages;
+
+  if ( 0 == m_nEvts )
+  {
+    const std::string m = "First event seen";
+    info() << m << endmsg;
     cameraTool()->Append("TEXT",m_Name.c_str());
-    cameraTool()->SendAndClearTS(ICameraTool::INFO,m_Name,"First event seen");
-  }//if
+    cameraTool()->SendAndClearTS(ICameraTool::INFO,m_Name,m);
+  }
 
-  debug() << "==> Execute for event " << m_nEvts << endmsg;
+  ++m_nEvts;
+
+  if ( msgLevel(MSG::DEBUG) )
+    debug() << "==> Execute for event " << m_nEvts << endmsg;
 
   //
   // local variables
@@ -214,22 +214,8 @@ StatusCode HPDNHitMonitor::execute()
 
   int nHits         = 0;  //                for this HPD
 
-  if ( msgLevel(MSG::VERBOSE) )
-    verbose() << "clear hit map" << endmsg;
   m_NHitMap.clear();
 
-  if ( msgLevel(MSG::VERBOSE) )
-    verbose() << "size of hit map " << m_NHitMap.size() << endmsg;
-
-  //
-  // check if event should be monitored
-  //
-  if ( m_nEvts%m_MonitorRate != 0) {
-    if ( msgLevel(MSG::VERBOSE) )
-      verbose() << "do not monitor event number " << m_nEvts << endmsg;
-    return StatusCode::SUCCESS;
-  } // if monRate
-
   //
   // check if we should send messages to Camera
   //
@@ -237,32 +223,22 @@ StatusCode HPDNHitMonitor::execute()
   time_t currentTime  = time(NULL);
 
   if ((m_UpdateTimerInterval >0) &&
-      ((currentTime - m_TimeLastUpdate) > m_UpdateTimerInterval) ){
-    //time_t deltaT = (currentTime - m_TimeStart);
-    //struct tm * timeinfo;
-    //timeinfo = localtime ( &deltaT );
+      ((currentTime - m_TimeLastUpdate) > m_UpdateTimerInterval) )
+  {
     m_TimeLastUpdate = currentTime;
     sendErrorReport  = true;
   } // if time
 
-
-
   //
   // check ODIN information
   //
   LHCb::ODIN * odin = NULL;
-  std::string odinInfo = "";
-  if (exist<LHCb::ODIN>( LHCb::ODINLocation::Default )) {
+  if (exist<LHCb::ODIN>( LHCb::ODINLocation::Default ))
+  {
     odin = get<LHCb::ODIN>( LHCb::ODINLocation::Default );
 
-    if (!odin) {
-      Error("Error retrieving ODIN bank");
-      return StatusCode::SUCCESS;
-    }// if
-
-    Gaudi::Time eventTime = odin->eventTime();
-
-    if (msgLevel(MSG::VERBOSE) ) {
+    if (msgLevel(MSG::VERBOSE) )
+    {
       verbose() << " ODIN event time " << odin->eventTime()
                 << " GPS time "        << odin->gpsTime ()
                 << " runNr "           << odin->runNumber ()
@@ -272,6 +248,7 @@ StatusCode HPDNHitMonitor::execute()
                 << " bunch ID "        << odin->bunchId()
                 << " detector status " << odin->detectorStatus ()
                 << endmsg;
+      const Gaudi::Time eventTime = odin->eventTime();
       verbose() << "EventTime "
                 << eventTime.year(true)    << "-"
                 << eventTime.month(true)+1 << "-"
@@ -282,45 +259,33 @@ StatusCode HPDNHitMonitor::execute()
                 << eventTime.nsecond()     << endmsg;
     }// if verbose
 
-    const std::string eventTimeString = eventTime.format(true,"%X");
-
-    // summarise ODIN information for CAMERA error reports
-    odinInfo =
-      " ODIN runNr " + boost::lexical_cast<std::string>( odin->runNumber())   +
-      " eventNr "    + boost::lexical_cast<std::string>( odin->eventNumber()) +
-      " bunchID "    + boost::lexical_cast<std::string>( odin->bunchId())     +
-      " orbitNr "    + boost::lexical_cast<std::string>( odin->orbitNumber()) +
-      " trigger "    + boost::lexical_cast<std::string>( odin->triggerType()) +
-      " event time " + eventTimeString;
-
-
-    if (msgLevel(MSG::VERBOSE) )
-      verbose() << "ODIN info string " << odinInfo << endmsg;
-
     //
     // check trigger type
     //
     bool monitorEvent = false;
-    std::vector<int>::const_iterator iTrig;
-    std::vector<int>::const_iterator iTrigBegin = m_TriggerTypes.begin();
-    std::vector<int>::const_iterator iTrigEnd   = m_TriggerTypes.end();
-    for (iTrig = iTrigBegin; iTrig != iTrigEnd; iTrig++) {
-      if (odin->triggerType() == (*iTrig)) {
+    for ( std::vector<int>::const_iterator iTrig = m_TriggerTypes.begin(); 
+          iTrig != m_TriggerTypes.end(); ++iTrig )
+    {
+      if (odin->triggerType() == (*iTrig))
+      {
         monitorEvent = true;
         if (msgLevel(MSG::VERBOSE) )
           verbose() << "Monitor event with Trigger type " << odin->triggerType() << endmsg;
-      }//if
-      else {
+      }
+      else
+      {
         if (msgLevel(MSG::VERBOSE) )
           verbose() << "Do NOT monitor event with Trigger type " << odin->triggerType() << endmsg;
-      } //if
-    } // for
+      }
+    }
 
     if (!monitorEvent)
       return StatusCode::SUCCESS;
 
-  } else {
-    info() << "No ODIN information - don't continue" << endmsg;
+  }
+  else
+  {
+    info() << "No ODIN information -> don't continue" << endmsg;
     return StatusCode::SUCCESS;
   }
 
@@ -329,13 +294,12 @@ StatusCode HPDNHitMonitor::execute()
   // main loop - get all RICH SmartIDs corresponding to HPDs/hits
   //
   const Rich::DAQ::L1Map &l1Map = smartIDDecoder()->allRichSmartIDs(m_taeEvents);
-  if  ( msgLevel(MSG::VERBOSE) )
+  if ( msgLevel(MSG::VERBOSE) )
     verbose() << "L1 map has size " << l1Map.size() << endmsg;
 
-  Rich::DAQ::L1Map::const_iterator iL1Map;
-  Rich::DAQ::L1Map::const_iterator iL1MapBegin = l1Map.begin();
-  Rich::DAQ::L1Map::const_iterator iL1MapEnd   = l1Map.end();
-  for (iL1Map = iL1MapBegin; iL1Map != iL1MapEnd; ++iL1Map) {
+  for ( Rich::DAQ::L1Map::const_iterator iL1Map = l1Map.begin(); 
+        iL1Map != l1Map.end(); ++iL1Map )
+  {
 
     const Rich::DAQ::Level1HardwareID   l1HardID    = iL1Map->first;
     const Rich::DAQ::Level1LogicalID    l1LogicalID = deRichSys()->level1LogicalID(l1HardID);
@@ -343,39 +307,37 @@ StatusCode HPDNHitMonitor::execute()
     if  ( msgLevel(MSG::VERBOSE) )
       verbose() << "IngressMap has size " << ingressMap.size() << endmsg;
 
-    Rich::DAQ::IngressMap::const_iterator iIngressMap;
-    Rich::DAQ::IngressMap::const_iterator iIngressMapBegin = ingressMap.begin();
-    Rich::DAQ::IngressMap::const_iterator iIngressMapEnd   = ingressMap.end();
-
-    for (iIngressMap = iIngressMapBegin; iIngressMap != iIngressMapEnd; ++iIngressMap){
+    for ( Rich::DAQ::IngressMap::const_iterator iIngressMap = ingressMap.begin();
+          iIngressMap != ingressMap.end(); ++iIngressMap )
+    {
 
       const Rich::DAQ::L1IngressID & l1IngressID = iIngressMap->first;
       const Rich::DAQ::IngressInfo & ingressInfo = iIngressMap->second;
 
-      const Rich::DAQ::HPDMap &hpdMap = ingressInfo.hpdData();
+      const Rich::DAQ::HPDMap & hpdMap = ingressInfo.hpdData();
       if  ( msgLevel(MSG::VERBOSE) )
         verbose() << "HPD map has size " << hpdMap.size() << endmsg;
 
-      Rich::DAQ::HPDMap::const_iterator iHPDMap;
-      Rich::DAQ::HPDMap::const_iterator iHPDMapBegin = hpdMap.begin();
-      Rich::DAQ::HPDMap::const_iterator iHPDMapEnd   = hpdMap.end();
-
-      for (iHPDMap = iHPDMapBegin; iHPDMap != iHPDMapEnd; ++iHPDMap) {
+      for ( Rich::DAQ::HPDMap::const_iterator iHPDMap = hpdMap.begin(); 
+            iHPDMap != hpdMap.end(); ++iHPDMap )
+      {
 
-        const Rich::DAQ::Level1Input           l1Input          = iHPDMap->first;                    // SmartID of HPD with hits
+        const Rich::DAQ::Level1Input           l1Input          = iHPDMap->first; // SmartID of HPD with hits
         const Rich::DAQ::L1InputWithinIngress  l1InputIngress   = l1Input.l1InputWithinIngress();
         const Rich::DAQ::HPDInfo               &hpdInfo         = iHPDMap->second;
         const LHCb::RichSmartID &              smartIDHPD       = hpdInfo.hpdID();
 
         // check for valid HPD
-        if (!smartIDHPD.isValid() ) {
-          if  ( msgLevel(MSG::VERBOSE) )
+        if (!smartIDHPD.isValid() )
+        {
+          if ( msgLevel(MSG::VERBOSE) )
             verbose() << "HPD SmartID is not valid, continue." << endmsg;
           continue;
         } //SmartID valid
 
-        if (hpdInfo.header().inhibit()) {
-          if  ( msgLevel(MSG::VERBOSE) )
+        if (hpdInfo.header().inhibit())
+        {
+          if ( msgLevel(MSG::VERBOSE) )
             verbose() << "HPD is inhibited, continue " << endmsg;
           continue;
         } //if inhibit
@@ -389,31 +351,34 @@ StatusCode HPDNHitMonitor::execute()
         nHits              = hitSmartIDs.size();
         m_NHitMap[hardID] += nHits;
 
-        if  ( msgLevel(MSG::VERBOSE) ) {
+        if ( msgLevel(MSG::VERBOSE) )
+        {
           verbose() << "now monitor HPD with SmartID " << smartIDHPD
                     << " hardware ID " << hardID << " L0 ID " << l0ID
                     << " #hits " << nHits
                     << " #hits so far " << m_NHitMap[hardID]
                     << endmsg;
-          LHCb::RichSmartID::Vector::const_iterator iHit;
-          LHCb::RichSmartID::Vector::const_iterator iHitBegin = hitSmartIDs.begin();
-          LHCb::RichSmartID::Vector::const_iterator iHitEnd   = hitSmartIDs.end();
-          for (iHit = iHitBegin; iHit != iHitEnd; ++iHit) {
+          for ( LHCb::RichSmartID::Vector::const_iterator iHit = hitSmartIDs.begin();
+                iHit != hitSmartIDs.end(); ++iHit )
+          {
             verbose() << "Next hit at" << (*iHit) << endmsg;
           } //for iHit
         } // if verbose
 
 
-        if (richDetector == Rich::Rich1) {
+        if (richDetector == Rich::Rich1)
+        {
           nAllHitsRich1   += hitSmartIDs.size();
         } //if Rich1
 
-        if (richDetector == Rich::Rich2) {
+        if (richDetector == Rich::Rich2)
+        {
           nAllHitsRich2   += hitSmartIDs.size();
         } //if Rich2
 
         if  ( m_NHitMap[hardID] >= m_HitThreshold &&
-              m_RemoveFaultyHpdUKL1 ) {
+              m_RemoveFaultyHpdUKL1 )
+        {
           std::ostringstream errStream;
           errStream << "Request HPD to be disabled, Too many hits " << m_NHitMap[hardID]
                     << " logical L1 ID  "   << l1LogicalID
@@ -422,14 +387,14 @@ StatusCode HPDNHitMonitor::execute()
                     << " RICH "             << richDetector
                     << " SmartID "          << smartIDHPD
                     << " HardID "           << hardID;
-          info()    << errStream.str() << endmsg;
+          info() << errStream.str() << endmsg;
           std::string shortMsg = "Request HPD disable: too many hits";
-          m_CameraMessgeWarning.insert(std::make_pair(shortMsg,errStream.str()));
-          //cameraTool()->Append("TEXT",errStream.str().c_str());
-          //cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name,"Request HPD disable: too many hits");
+          m_CameraMessageWarning.insert(std::make_pair(shortMsg,errStream.str()));
           hpdDisableTool() -> DisableHPD(smartIDHPD);
           setFilterPassed(true);
-        } // if #hit > threshold and disable
+          m_snapshotMessages.push_back(shortMsg);
+          m_snapshotMessages.push_back(errStream.str());
+        }
 
         //
         // get expected occupancy for that HPD and compare to actual #hits
@@ -441,59 +406,63 @@ StatusCode HPDNHitMonitor::execute()
 
         // if pull deviates too much send a warning
         // but wait for the first events to allow the moving average to update
-        if ( m_nEvts > (unsigned long) m_MovingAverageEventsSlow) {
-          if (pull > m_PullThreshold ) {
+        if ( m_nEvts > (unsigned long) m_MovingAverageEventsSlow)
+        {
+          if ( pull > m_PullThreshold )
+          {
             std::ostringstream message;
-            message << "HPD "  << smartIDHPD << " deviates strongly from expected number of hits seen: "
-                    << actualHit << " expected " << expectedOccupancy << " pull " << pull;
+            message << smartIDHPD << " saw " << actualHit << " hits. Deviates from expected "
+                    << expectedOccupancy << " pull " << pull;
             if ( msgLevel(MSG::VERBOSE) )
               verbose() << message.str() << endmsg;
-            std::string shortMsg = "Unusual hit occupancy";
-            m_CameraMessgeWarning.insert(std::make_pair(shortMsg,message.str()));
-            //cameraTool()->Append("TEXT",message.str().c_str());
-            //cameraTool()->Append("TEXT",odinInfo.c_str());
-            //cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name,"Unusual hit occupancy");
-          } //if pull
-
+            const std::string shortMsg = "Unusual hit occupancy";
+            m_CameraMessageWarning.insert(std::make_pair(shortMsg,message.str()));
+            setFilterPassed(true);
+            m_snapshotMessages.push_back(shortMsg);
+            m_snapshotMessages.push_back(message.str());
+          } 
 
           if ( msgLevel(MSG::VERBOSE) )
             verbose() << "HPD " << smartIDHPD << " expected occupancy " << expectedOccupancy
                       << " actual " << actualHit << " pull " <<  pull << endmsg;
-        } // if #events
-
+        }
 
         //
         // Fill number of hits into histograms
         //
-        if (m_FillHistos) {
+        if (m_FillHistos)
+        {
           if (smartIDHPD.isValid()                        &&
               smartIDHPD.rich()  != Rich::InvalidDetector &&
-              smartIDHPD.panel() != Rich::InvalidSide) {
+              smartIDHPD.panel() != Rich::InvalidSide)
+          {
 
-            Rich::SmartIDGlobalOrdering globOrdering(smartIDHPD);
+            const Rich::SmartIDGlobalOrdering globOrdering(smartIDHPD);
             const int x  = globOrdering.globalHpdX();
             const int y  = globOrdering.globalHpdY();
 
             const int nX = globOrdering.totalHPDX();
             //const int nY = globOrdering.totalHPDY();
 
-            std::string histoNameBase = HPDNHitMonitor::GetRichPanelHistId(smartIDHPD.rich(), smartIDHPD.panel());
-            std::string histoNameNHit = histoNameBase +  "_NHit";
-            plot2D( x , y, histoNameNHit, histoNameNHit, 0,0,0, 0,0,0, actualHit);
+            const std::string histoNameBase = GetRichPanelHistId(smartIDHPD.rich(), smartIDHPD.panel());
+            const std::string histoNameNHit = histoNameBase +  "_NHit";
+            plot2D( x, y, histoNameNHit, histoNameNHit, 0,0,0, 0,0,0, actualHit );
 
-            std::string histoNamePull = histoNameBase +  "_Pull";
+            const std::string histoNamePull = histoNameBase +  "_Pull";
             AIDA::IHistogram2D *histo = histo2D(histoNamePull);
             const double binContent = histo->binHeight(x, y);
-            double newWT            = (binContent + pull)/2.0;
+            const double newWT      = (binContent + pull)/2.0;
             TH2D* rootHisto = Gaudi::Utils::Aida2ROOT::aida2root(histo);
             rootHisto->SetBinContent(x, y, newWT);
             rootHisto->SetMinimum(-fabs(m_PullThreshold));
             rootHisto->SetMaximum(+fabs(m_PullThreshold));
 
-            std::string histoName1D   =  histoNameBase +  "_HPDHits";
+            const std::string histoName1D = histoNameBase + "_HPDHits";
             //int bin = 1+ iCol*nCol + iHpdInCol;                   // bin 0: underflow
-            int bin = 1 + x*nX + y;
-            plot1D(bin, histoName1D , histoName1D, 0, 0 , 0, actualHit);
+            const int bin = 1 + x*nX + y;
+
+            plot1D( bin, histoName1D, histoName1D, 0, 0, 0, actualHit );
+
           } // if valid
         } // fillHisto
 
@@ -506,41 +475,48 @@ StatusCode HPDNHitMonitor::execute()
   //
   // update & publish histograms
   //
-  //   if (m_FillHistos) {
-
-  //     // update histogram showing #hit distribution
-  //     if (nAllHits>0)
-  //       //AIDA::IHistogram1D *histo      = plot1D(nAllHits     , "NHitInclusive"     , "Number of hits in RICH",
-  //       //m_HistoNHitMin-0.5, m_HistoNHitMax+0.5, 100);
-  //     //m_HistoNHitMax - m_HistoNHitMin + 1);
-
-  //     if (nAllHitsRich1>0)
-  //       //AIDA::IHistogram1D *histoRich1 = plot1D(nAllHitsRich1, "NHitInclusiveRich1", "Number of hits in RICH 1",
-  //       //                                      m_HistoNHitMin-0.5, m_HistoNHitMax+0.5,100);
-  //     //m_HistoNHitMax - m_HistoNHitMin + 1);
-
-  //     if (nAllHitsRich2>0)
-  //       //AIDA::IHistogram1D *histoRich2 = plot1D(nAllHitsRich2, "NHitInclusiveRich2", "Number of hits in RICH 2",
-  //       //                                      m_HistoNHitMin-0.5, m_HistoNHitMax+0.5,100);
-  //     //m_HistoNHitMax - m_HistoNHitMin + 1);
-
-  //   } // if fillHist
-
-
+  if (m_FillHistos)
+  {
+    // update histogram showing #hit distribution
+    if (nAllHits>0)
+    {
+      plot1D(nAllHits     ,
+             "NHitInclusive"     , "Number of hits in RICH",
+             m_HistoNHitMin-0.5, m_HistoNHitMax+0.5, 100);
+    }
+    if (nAllHitsRich1>0)
+    {
+      plot1D(nAllHitsRich1,
+             "NHitInclusiveRich1", "Number of hits in RICH 1",
+             m_HistoNHitMin-0.5, m_HistoNHitMax+0.5, 100);
+    }
+    if (nAllHitsRich2>0)
+    {
+      plot1D(nAllHitsRich2,
+             "NHitInclusiveRich2", "Number of hits in RICH 2",
+             m_HistoNHitMin-0.5, m_HistoNHitMax+0.5, 100);
+    }
+  } // if fillHist
 
   // publish counter
-  m_counterAll    = nAllHits      +0.1;
-  m_counterRich1  = nAllHitsRich1 +0.1;
-  m_counterRich2  = nAllHitsRich2 +0.1;
+  m_counterAll    = nAllHits      + 0.1;
+  m_counterRich1  = nAllHitsRich1 + 0.1;
+  m_counterRich2  = nAllHitsRich2 + 0.1;
 
-  if (sendErrorReport){
-    if ( msgLevel(MSG::VERBOSE) ) {
-      verbose() << "send error report" << endmsg;
-    }
-    sc = sc && HPDNHitMonitor::SendErrorReport(ICameraTool::INFO   ,m_CameraMessgeInfo   ,odinInfo);
-    sc = sc && HPDNHitMonitor::SendErrorReport(ICameraTool::WARNING,m_CameraMessgeWarning,odinInfo);
-    sc = sc && HPDNHitMonitor::SendErrorReport(ICameraTool::ERROR  ,m_CameraMessgeError  ,odinInfo);
-  } //if
+  if (sendErrorReport)
+  {
+    if ( msgLevel(MSG::VERBOSE) ) { verbose() << "send error report" << endmsg; }
+    sc = sc && SendErrorReport(ICameraTool::INFO   ,m_CameraMessageInfo   ,odin);
+    sc = sc && SendErrorReport(ICameraTool::WARNING,m_CameraMessageWarning,odin);
+    sc = sc && SendErrorReport(ICameraTool::ERROR  ,m_CameraMessageError  ,odin);
+  }
+
+  // Send cached messages to camera for inclusion in snapshots
+  for ( std::vector<std::string>::const_iterator iM = m_snapshotMessages.begin();
+        iM != m_snapshotMessages.end(); ++iM )
+  {
+    cameraTool()->Append("TEXT",(*iM).c_str());
+  }
 
   return sc;
 } // execute
@@ -548,11 +524,11 @@ StatusCode HPDNHitMonitor::execute()
 //=============================================================================
 //  Finalize
 //=============================================================================
-StatusCode HPDNHitMonitor::finalize() {
-
+StatusCode HPDNHitMonitor::finalize()
+{
   info() << "#empty events encountered " << m_EmptyEvents << endmsg;
-
-  return Rich::HistoAlgBase::finalize();  // must be called after all other actions
+  cameraTool()->SendAndClearTS(ICameraTool::INFO,m_Name,"Finalize");
+  return Rich::HistoAlgBase::finalize();  
 }
 
 //=============================================================================
@@ -569,49 +545,70 @@ HPDNHitMonitor::GetRichPanelHistId(const Rich::DetectorType rich,
 }// getRichPanelHistId()
 //=============================================================================
 StatusCode
-HPDNHitMonitor::SendErrorReport(int                                    cameraLevel,
-                                std::multimap<std::string,std::string> errMap,
-                                const std::string & odinInfo)
+HPDNHitMonitor::SendErrorReport( const int                               cameraLevel,
+                                 std::multimap<std::string,std::string>& errMap,
+                                 const LHCb::ODIN *                      odin )
 {
-  if ( msgLevel(MSG::VERBOSE) )
-    verbose() << "send " << errMap.size() << " alerts to CAMERA with level " << cameraLevel << endmsg;
-
-  std::multimap<std::string,std::string>::const_iterator iErr;
 
-  while (errMap.size() > 0) {
-    // get the error message (key) of the first entry
-    std::string errKey = (*errMap.begin()).first;
+  if ( !errMap.empty() )
+  {
 
-    // get all elements with that key
-    std::multimap<std::string,std::string>::const_iterator iErrBegin = errMap.equal_range(errKey).first;
-    std::multimap<std::string,std::string>::const_iterator iErrEnd   = errMap.equal_range(errKey).second;
-    for (iErr = iErrBegin; iErr != iErrEnd; iErr++) {
-      std::string errMsg = (*iErr).second;
-      if ( msgLevel(MSG::VERBOSE) )
-        verbose() << "Retrieved message " << errKey << " " << errMsg << endmsg;
-      // send to Camera
-      cameraTool()->Append("TEXT",errMsg.c_str());
-    } // for
-    cameraTool()->Append("TEXT",odinInfo.c_str());
-    cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name,errKey);
+    if ( msgLevel(MSG::VERBOSE) )
+      verbose() << "send " << errMap.size()
+                << " alerts to CAMERA with level " << cameraLevel << endmsg;
 
-    //remove this message from the map
-    errMap.erase(errKey);
+    std::ostringstream odinInfo;
+    if ( odin )
+    {
+      // summarise ODIN information for CAMERA error reports
+      odinInfo  << " ODIN runNr " << odin->runNumber()
+                << " eventNr "    << odin->eventNumber()
+                << " bunchID "    << odin->bunchId()
+                << " orbitNr "    << odin->orbitNumber()
+                << " trigger "    << odin->triggerType()
+                << " event time " << odin->eventTime().format(true,"%X");
+    }
 
-  } // while size
+    while ( !errMap.empty() )
+    {
+      // get the error message (key) of the first entry
+      const std::string errKey = (*errMap.begin()).first;
+
+      // get all elements with that key
+      std::multimap<std::string,std::string>::const_iterator iErrBegin = errMap.equal_range(errKey).first;
+      std::multimap<std::string,std::string>::const_iterator iErrEnd   = errMap.equal_range(errKey).second;
+      for ( std::multimap<std::string,std::string>::const_iterator iErr = iErrBegin;
+            iErr != iErrEnd; ++iErr )
+      {
+        const std::string errMsg = (*iErr).second;
+        if ( msgLevel(MSG::VERBOSE) )
+          verbose() << "Retrieved message " << errKey << " " << errMsg << endmsg;
+        // send to Camera
+        cameraTool()->Append("TEXT",errMsg.c_str());
+      } // for
+      cameraTool()->Append("TEXT",odinInfo.str().c_str());
+      cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name,errKey);
+
+      // remove this message from the map
+      errMap.erase(errKey);
+
+    } // while not empty
+
+    if ( !errMap.empty() )
+    {
+      info() << "Error map not cleared properly - size of map " << errMap.size() << endmsg;
+    } //
 
-  if (errMap.size()  >0) {
-    info() << "Error map not cleared properly - size of map " << errMap.size() << endmsg;
-  } //
+  } // have something to send
 
   return StatusCode::SUCCESS;
 } // SendErrorReport
 
 //=============================================================================
 
-StatusCode HPDNHitMonitor::Book2DHisto (const Rich::DetectorType rich,
-                                        const Rich::Side panel,
-                                        const std::string& taeEventList)
+StatusCode HPDNHitMonitor::Book2DHisto ( const Rich::DetectorType rich,
+                                         const Rich::Side panel,
+                                         const std::string& taeEventList )
 {
 
   const std::string idString = GetRichPanelHistId(rich, panel);
@@ -651,9 +648,12 @@ StatusCode HPDNHitMonitor::Book2DHisto (const Rich::DetectorType rich,
   //
   // book histograms
   //
-  book2D(  idString + "_Pull"    , idString + "_Pull"    + taeEventList, hxmin, hxmax, hxnbins, hymin, hymax, hynbins);
-  book2D(  idString + "_NHit"    , idString + "_NHit"    + taeEventList, hxmin, hxmax, hxnbins, hymin, hymax, hynbins);
-  book1D(  idString + "_HPDHits" , idString + "_HPDHits" + taeEventList, 0, nX*nY, nX*nY);
+  book2D( idString + "_Pull"    , idString + "_Pull"    + taeEventList, 
+          hxmin, hxmax, hxnbins, hymin, hymax, hynbins );
+  book2D( idString + "_NHit"    , idString + "_NHit"    + taeEventList, 
+          hxmin, hxmax, hxnbins, hymin, hymax, hynbins );
+  book1D( idString + "_HPDHits" , idString + "_HPDHits" + taeEventList, 
+          0, nX*nY, nX*nY );
 
   return StatusCode::SUCCESS;
 } // Book2DHisto
diff --git a/Rich/RichOnlineMonitors/src/RichHPDNHitMonitor.h b/Rich/RichOnlineMonitors/src/RichHPDNHitMonitor.h
index 6e9d9235..1eb7758f 100755
--- a/Rich/RichOnlineMonitors/src/RichHPDNHitMonitor.h
+++ b/Rich/RichOnlineMonitors/src/RichHPDNHitMonitor.h
@@ -9,13 +9,11 @@
 // base class
 #include "RichKernel/RichHistoAlgBase.h"
 
-// boost
-#include "boost/lexical_cast.hpp"
-
 // std
 #include <deque>
 #include <string>
 #include <map>
+#include <sstream>
 
 // Interfaces
 #include "RichKernel/IRichRawBufferToSmartIDsTool.h"
@@ -30,10 +28,10 @@
 // time
 #include <time.h>
 
-
 // forward declarations
 class ICameraTool;
-namespace AIDA{
+namespace AIDA
+{
   class IHistogram;
 }
 
@@ -80,17 +78,17 @@ namespace Rich
       // ---------------------------------------------------------------------------
     private:
 
-      std::string GetRichPanelHistId(const Rich::DetectorType rich, 
-                                     const Rich::Side panel);
-      StatusCode  SendErrorReport(int                                    cameraLevel,
-                                  std::multimap<std::string,std::string> errMap,
-                                  const std::string&                     odinInfo ="");
+      std::string GetRichPanelHistId( const Rich::DetectorType rich, 
+                                      const Rich::Side panel );
+      
+      StatusCode  SendErrorReport( const int                               cameraLevel,
+                                   std::multimap<std::string,std::string>& errMap,
+                                   const LHCb::ODIN *                      odin = NULL );
+      
       StatusCode  Book2DHisto    ( const Rich::DetectorType rich, 
                                    const Rich::Side panel, 
-                                   const std::string& taeEventList);
-
-    private:
-
+                                   const std::string& taeEventList );
+      
       /// Load on demand DeRichSystem
       const DeRichSystem * deRichSys() const
       {
@@ -172,7 +170,6 @@ namespace Rich
       mutable ICameraTool                       * m_CamTool;             ///< CAMERA error reporting tool
 
       unsigned long                           m_nEvts;               ///< Event count
-      int                                     m_MonitorRate;         ///< monitor only each Nth event
 /*       int                                     m_PurgeRate;           ///< purge histos after each Nth event, if rate > 0 */
       ///< don't purge if rate <= 0
       int                                     m_EmptyEvents;         ///< keep track of empty events
@@ -203,9 +200,9 @@ namespace Rich
       int                                     m_UpdateTimerInterval; ///< Send alerts after N seconds
       time_t                                  m_TimeStart;
       time_t                                  m_TimeLastUpdate;
-      std::multimap<std::string,std::string>  m_CameraMessgeInfo;
-      std::multimap<std::string,std::string>  m_CameraMessgeWarning;
-      std::multimap<std::string,std::string>  m_CameraMessgeError;
+      std::multimap<std::string,std::string>  m_CameraMessageInfo;
+      std::multimap<std::string,std::string>  m_CameraMessageWarning;
+      std::multimap<std::string,std::string>  m_CameraMessageError;
     };
 
   }
diff --git a/Rich/RichOnlineMonitors/src/RichSingleEventSnapshot.cpp b/Rich/RichOnlineMonitors/src/RichSingleEventSnapshot.cpp
index dc6dd99c..d6e5467e 100755
--- a/Rich/RichOnlineMonitors/src/RichSingleEventSnapshot.cpp
+++ b/Rich/RichOnlineMonitors/src/RichSingleEventSnapshot.cpp
@@ -41,19 +41,22 @@ SingleEventSnapshot::SingleEventSnapshot( const std::string& name,
     m_MinHitRich          ( 1    ) ,
     m_MaxHitRich          ( 300  ) ,
     m_UpdateInterval      (  60  ) ,
-    m_sendSnapshot        ( false) ,
+    m_nSnapShots          (   0  ) ,
     m_TimeStart           (   0  ) ,
     m_TimeLastUpdate      (   0  )
 {
-  declareProperty( "NBins"            , m_nBins          = 100 );
+  declareProperty( "NBins"            , m_nBins          = 200 );
   declareProperty( "UpdateInterval"   , m_UpdateInterval =  60 );
   declareProperty( "RingLocation"     , m_ringLoc        = LHCb::RichRecRingLocation::MarkovRings+"Isolated" );
   declareProperty( "Message"          , m_message        = "No Message !!!" );
-  declareProperty( "RawEventLocations", m_taeEvents );
-  declareProperty( "MinRingPixels"    , m_MinRingPixels  =   1);
-  declareProperty( "MinHitRich"       , m_MinHitRich     =   1);
-  declareProperty( "MaxHitRich"       , m_MaxHitRich     = 300);
+  declareProperty( "RawEventLocations", m_taeEvents             );
+  declareProperty( "MinRingPixels"    , m_MinRingPixels  =   1  );
+  declareProperty( "MinRings"         , m_MinRings       =   1  );
+  declareProperty( "MinHitRich"       , m_MinHitRich     =   1  );
+  declareProperty( "MaxHitRich"       , m_MaxHitRich     = 300  );
+  declareProperty( "MaxSnapshots"     , m_maxSnapshots   = 5000 );
 }
+
 //=============================================================================
 // Destructor
 //=============================================================================
@@ -70,16 +73,14 @@ StatusCode SingleEventSnapshot::initialize()
   //
   // partition name
   //
-  char* partitionName = getenv("PARTITION");
-  if (partitionName) {
+  const char * partitionName = getenv("PARTITION");
+  m_Name = name();
+  if ( partitionName ) 
+  {
     info() << "running in partition " << partitionName << endmsg;
-    m_Name = name() + boost::lexical_cast<std::string>(partitionName);
-  } else {
-    m_Name = name();
-  }
+    m_Name += boost::lexical_cast<std::string>(partitionName);
+  } 
 
-  // CAMERA error reporting tool
-  m_CamTool = tool<ICameraTool>("CameraTool");
   // data decoder
   acquireTool( "RichSmartIDDecoder", m_SmartIDDecoder, 0, true );
   // smartid tool
@@ -92,20 +93,19 @@ StatusCode SingleEventSnapshot::initialize()
   info() << "Message           " << m_message        << endmsg;
   info() << "RawEventLocations " << m_taeEvents      << endmsg;
   info() << "MinRingPixels     " << m_MinRingPixels  << endmsg;
+  info() << "MinRings          " << m_MinRings       << endmsg;
   info() << "MinHitRich        " << m_MinHitRich     << endmsg;
   info() << "MaxHitRich        " << m_MaxHitRich     << endmsg;
 
   //
   // get time of Start-Up
   //
-  m_TimeStart      = time(NULL);
-  m_TimeLastUpdate = time(NULL);
-
+  m_TimeLastUpdate = m_TimeStart = time(NULL);
 
   // let user know we're here
   verbose() << "Send message to CAMERA" << endmsg;
-  m_CamTool->Append("TEXT",m_Name.c_str());
-  m_CamTool->SendAndClearTS(ICameraTool::INFO,m_Name,"Initialized");
+  cameraTool()->Append("TEXT",m_Name.c_str());
+  cameraTool()->SendAndClearTS(ICameraTool::INFO,m_Name,"Initialized");
 
   return sc;
 }
@@ -116,14 +116,13 @@ StatusCode SingleEventSnapshot::initialize()
 StatusCode SingleEventSnapshot::execute()
 {
 
-  if (m_nEvt == 0) {
-    info() << m_Name << " first event seen" << endmsg;
-    m_CamTool->SendAndClearTS(ICameraTool::INFO, m_Name.c_str() ,"Snapshot: first event seen");
-  } // if
-
-  //
+  if ( 0 == m_nEvt )
+  {
+    const std::string m = "First event seen";
+    info() << m << endmsg;
+    cameraTool()->SendAndClearTS(ICameraTool::INFO,m_Name.c_str(),m);
+  } 
   // count events
-  //
   ++m_nEvt;
 
   PD_LOCAL_POSITIONS_X;
@@ -133,52 +132,44 @@ StatusCode SingleEventSnapshot::execute()
   //
   // get the ODIN
   //
-  unsigned int runNumber(0);
-  ulonglong    evtNumber(0);
-  if ( exist<LHCb::ODIN>(LHCb::ODINLocation::Default) )   {
-    const LHCb::ODIN * odin = get<LHCb::ODIN> ( LHCb::ODINLocation::Default );
-    runNumber = odin->runNumber();
-    evtNumber = odin->eventNumber();
-  }   else   {
-    Warning( "No ODIN : Event and Run numbers unknown ..." ).ignore();
-    return StatusCode::SUCCESS;
+  if ( !exist<LHCb::ODIN>(LHCb::ODINLocation::Default) )   
+  {
+    cameraTool()->Clear();
+    const std::string m = "No ODIN : Event and Run numbers unknown ...";
+    cameraTool()->SendAndClearTS( ICameraTool::WARNING, m_Name.c_str(), m );
+    return Warning( m, StatusCode::SUCCESS );
   } // if ODIN
-
-  // make sure the pixelshave been formed
-  const StatusCode sc = pixelCreator()->newPixels();
-  if ( sc.isFailure() )
-  { return Error( "Problem creating RichRecPixels", sc ); }
-
+  const LHCb::ODIN * odin = get<LHCb::ODIN> ( LHCb::ODINLocation::Default );
+  const unsigned int runNumber = odin->runNumber();
+  const ulonglong    evtNumber = odin->eventNumber();
 
   //
   // get time and check if we should send an update
   //
-  time_t currentTime  = time(NULL);
-
-  if ((m_UpdateInterval>0) && ((unsigned int) (currentTime - m_TimeLastUpdate) > m_UpdateInterval) ){
-    debug() << "Time elapsed - send next available snapshot" << endmsg;
+  const time_t currentTime = time(NULL);
+  if ( m_UpdateInterval < 0 ||
+       ((currentTime - m_TimeLastUpdate) > m_UpdateInterval) )
+  {
+    debug() << "Time elapsed - sending snapshots" << endmsg;
     m_TimeLastUpdate = currentTime;
-    m_sendSnapshot     = true;
-  } // if time
-
-  if (!m_sendSnapshot) {
-    debug() << "Don't send snapshot now" << endmsg;
+  }
+  else
+  {
+    const std::string m = "Snapshot suppressed -> Too close in time to last";
+    debug() << m << endmsg;
+    cameraTool()->Clear();
     return StatusCode::SUCCESS;
-  } // if !sendSnapshot
-
+  } 
 
   //
   // if we got here we should send a snapshot to Camera
   //
+ 
+  unsigned int nRingsRich1(0),nRingsRich2(0),nHitsRich1(0),nHitsRich2(0);
 
   //
   // rings
   //
-  int nRingsRich1 = 0;
-  int nRingsRich2 = 0;
-  int nHitsRich1  = 0;
-  int nHitsRich2  = 0;
-
   typedef std::vector<float> RingParm;
   typedef std::vector< RingParm > RingParms;
   Rich::Map<Rich::DetectorType,RingParms> ringParams;
@@ -196,15 +187,20 @@ StatusCode SingleEventSnapshot::execute()
       const LHCb::RichRecPixelOnRing::Vector& ringPixels = (*iR)->richRecPixels();
 
       // check if sufficient pixels are on the ring
-      if (ringPixels.size()> m_MinRingPixels) {
+      if ( ringPixels.size() > m_MinRingPixels )
+      {
         // only add ring to list if sufficient hits
-        if (ringRich == Rich::Rich1)
-          nRingsRich1++;
-        if (ringRich == Rich::Rich2)
-          nRingsRich2++;
-      } //if #hits per ring
+        if      ( ringRich == Rich::Rich1 )
+        {
+          ++nRingsRich1;
+        }
+        else if ( ringRich == Rich::Rich2 )
+        {
+          ++nRingsRich2;
+        }
+      }
 
-        // fit the ring
+      // fit the ring
       Rich::Rec::FastRingFitter fitter;
       // data points (ultimately will be done by fitter itself..)
       for ( LHCb::RichRecPixelOnRing::Vector::iterator iP = (*iR)->richRecPixels().begin();
@@ -228,13 +224,26 @@ StatusCode SingleEventSnapshot::execute()
         ringParams[(*iR)->rich()].push_back(ringP);
       }
     }
+
+    // check if we have enough rings passing the cuts
+    if ( nRingsRich1 < m_MinRings || nRingsRich2 < m_MinRings ) 
+    {
+      std::ostringstream m;
+      m << "Too few good rings, Rich1 " << nRingsRich1 << " Rich2 " << nRingsRich2;
+      debug() << m.str() << endmsg;
+      cameraTool()->Clear();
+      return StatusCode::SUCCESS;
+    } 
+
   }
 
-  // check if we have enough rings passing the cuts
-  if (nRingsRich1 < 1 || nRingsRich2 < 1) {
-    debug() << "Too few good rings,  Rich1 " << nRingsRich1 << " Rich2 " << nRingsRich2 << endmsg;
+  if ( ++m_nSnapShots > m_maxSnapshots )
+  {
+    const std::string m = "Max snapshot limit reached. No more will be sent.";
+    debug() << m << endmsg;
+    cameraTool()->Clear();
     return StatusCode::SUCCESS;
-  } //if nRings
+  }
 
   const std::string title =
     ( std::string("Event Snapshot :") +
@@ -247,21 +256,26 @@ StatusCode SingleEventSnapshot::execute()
   std::map<Rich::DetectorType,AIDA::IHistogram2D *> hitmap;
   const Rich::DAQ::L1Map & l1Map = m_SmartIDDecoder->allRichSmartIDs(m_taeEvents);
   for ( Rich::DAQ::L1Map::const_iterator iL1Map = l1Map.begin();
-        iL1Map != l1Map.end(); ++iL1Map ) {
+        iL1Map != l1Map.end(); ++iL1Map )
+  {
     const Rich::DAQ::IngressMap & ingressMap = iL1Map->second;
     for ( Rich::DAQ::IngressMap::const_iterator iIngressMap = ingressMap.begin();
-          iIngressMap != ingressMap.end(); ++iIngressMap ) {
+          iIngressMap != ingressMap.end(); ++iIngressMap )
+    {
       const Rich::DAQ::HPDMap &hpdMap = iIngressMap->second.hpdData();
       for ( Rich::DAQ::HPDMap::const_iterator iHPDMap = hpdMap.begin();
-            iHPDMap != hpdMap.end(); ++iHPDMap ) {
+            iHPDMap != hpdMap.end(); ++iHPDMap ) 
+      {
         const LHCb::RichSmartID::Vector &hitSmartIDs = iHPDMap->second.smartIDs();
 
         for ( LHCb::RichSmartID::Vector::const_iterator iHit = hitSmartIDs.begin();
-              iHit != hitSmartIDs.end(); ++iHit )  {
+              iHit != hitSmartIDs.end(); ++iHit ) 
+        {
           // pixel hit coord in global coordinates
           Gaudi::XYZPoint gPos;
           const StatusCode scc = m_idTool->globalPosition( *iHit, gPos );
-          if ( scc.isSuccess() )  {
+          if ( scc.isSuccess() ) 
+          {
             // pos in local coords
             const Gaudi::XYZPoint lPos = m_idTool->globalToPDPanel(gPos);
             // RICH info
@@ -272,11 +286,17 @@ StatusCode SingleEventSnapshot::execute()
                                    RICH+" "+title,
                                    xMinPDLoc[rich],xMaxPDLoc[rich],yMinPDLoc[rich],yMaxPDLoc[rich],
                                    m_nBins, m_nBins );
-            if (rich == Rich::Rich1)
-              nHitsRich1++;
-            if (rich == Rich::Rich2)
-              nHitsRich2++;
-          } else {
+            if ( rich == Rich::Rich1 )
+            {
+              ++nHitsRich1;
+            }
+            else if (rich == Rich::Rich2)
+            {
+              ++nHitsRich2;
+            }
+          }
+          else
+          {
             debug() <<  "Problem with SmartID -> global position conversion" << endmsg;
           } // if success
         } // for iHit
@@ -284,50 +304,56 @@ StatusCode SingleEventSnapshot::execute()
     } // for iIngressMap
   } // for L1Map
 
-
-    // now check if we have sufficient (and not too many) hits in each RICH
-  if (  (nHitsRich1 < m_MinHitRich  || nHitsRich1 > m_MaxHitRich) ||
-        (nHitsRich2 < m_MinHitRich  || nHitsRich2 > m_MaxHitRich)) {
-    debug() << "Event failed #hit cuts, min : " << m_MinHitRich
-            << " max " << m_MaxHitRich
-            << " Rich1 " << nHitsRich1 << " Rich2 " << nHitsRich2
-            << endmsg;
+  // now check if we have sufficient (and not too many) hits in each RICH
+  if ( ( nHitsRich1 < m_MinHitRich || nHitsRich1 > m_MaxHitRich ) ||
+       ( nHitsRich2 < m_MinHitRich || nHitsRich2 > m_MaxHitRich ) ) 
+  {
+    std::ostringstream m;
+    m << "Event failed #hit cuts, min : " << m_MinHitRich
+      << " max " << m_MaxHitRich
+      << " Rich1 " << nHitsRich1 << " Rich2 " << nHitsRich2;
+    debug() << m.str() << endmsg;  
+    cameraTool()->Clear();
     return StatusCode::SUCCESS;
-  } // if nhits
+  }
 
-    // send to camera
-  if ( hitmap[Rich::Rich1] )  {
+  // send to camera
+  if ( hitmap[Rich::Rich1] )  
+  {
     verbose() << "Send RICH1 hit map to CAMERA" << endmsg;
-    m_CamTool->Append( Gaudi::Utils::Aida2ROOT::aida2root(hitmap[Rich::Rich1]) );
+    cameraTool()->Append( Gaudi::Utils::Aida2ROOT::aida2root(hitmap[Rich::Rich1]) );
     // add RICH1 rings
     for ( RingParms::iterator iR = ringParams[Rich::Rich1].begin();
-          iR != ringParams[Rich::Rich1].end(); ++iR )     {
+          iR != ringParams[Rich::Rich1].end(); ++iR )     
+    {
       debug() << "Adding RICH1 ring " << *iR << endreq;
-      m_CamTool->Append( "TELLIPSE", &*(*iR).begin(), 4*sizeof(float) );
-    } //for
-  } //if
+      cameraTool()->Append( "TELLIPSE", &*(*iR).begin(), 4*sizeof(float) );
+    }
+  }
 
-  if ( hitmap[Rich::Rich2] )  {
+  if ( hitmap[Rich::Rich2] ) 
+  {
     verbose() << "Send RICH2 hit map to CAMERA" << endmsg;
-    m_CamTool->Append( Gaudi::Utils::Aida2ROOT::aida2root(hitmap[Rich::Rich2]) );
+    cameraTool()->Append( Gaudi::Utils::Aida2ROOT::aida2root(hitmap[Rich::Rich2]) );
     // add RICH2 rings
     for ( RingParms::iterator iR = ringParams[Rich::Rich2].begin();
-          iR != ringParams[Rich::Rich2].end(); ++iR )    {
+          iR != ringParams[Rich::Rich2].end(); ++iR )    
+    {
       debug() << "Adding RICH2 ring " << *iR << endreq;
-      m_CamTool->Append( "TELLIPSE", &*(*iR).begin(), 4*sizeof(float) );
-    } //for
-  } //if
+      cameraTool()->Append( "TELLIPSE", &*(*iR).begin(), 4*sizeof(float) );
+    }
+  }
 
-  if ( hitmap[Rich::Rich1] || hitmap[Rich::Rich2] ) {
+  if ( hitmap[Rich::Rich1] || hitmap[Rich::Rich2] ) 
+  {
     debug() << "Send event snapshot" << endmsg;
-    m_CamTool->Append("TEXT",m_message.c_str());
+    cameraTool()->Append("TEXT",title.c_str());
+    cameraTool()->Append("TEXT",m_message.c_str());
     std::ostringstream message;
     message << "TAE Events " << m_taeEvents;
-    m_CamTool->Append("TEXT",message.str().c_str());
-    m_CamTool->SendAndClearTS(ICameraTool::INFO,m_Name,title.c_str());
-    m_sendSnapshot = false;
-  } //if
-
+    cameraTool()->Append("TEXT",message.str().c_str());
+    cameraTool()->SendAndClearTS(ICameraTool::WARNING,m_Name,title.c_str());
+  }
 
   return StatusCode::SUCCESS;
 }
diff --git a/Rich/RichOnlineMonitors/src/RichSingleEventSnapshot.h b/Rich/RichOnlineMonitors/src/RichSingleEventSnapshot.h
index 0c2d218b..73fb5d8c 100755
--- a/Rich/RichOnlineMonitors/src/RichSingleEventSnapshot.h
+++ b/Rich/RichOnlineMonitors/src/RichSingleEventSnapshot.h
@@ -71,6 +71,18 @@ namespace Rich
       // ---------------------------------------------------------------------------
       //                                PRIVATE
       // ---------------------------------------------------------------------------
+    private:
+
+      /// Load camera tool on demand
+      ICameraTool * cameraTool() const
+      {
+        if ( !m_CamTool )
+        {
+          m_CamTool = tool<ICameraTool>("CameraTool");
+        }
+        return m_CamTool;
+      }
+
     private:
 
       /// Raw Buffer Decoding tool
@@ -80,7 +92,7 @@ namespace Rich
       const Rich::ISmartIDTool * m_idTool;
 
       /// CAMERA error reporting tool
-      ICameraTool * m_CamTool;
+      mutable ICameraTool * m_CamTool;
 
       unsigned long m_nEvt; ///< Event number count
 
@@ -103,17 +115,24 @@ namespace Rich
       unsigned int m_MinRingPixels;
 
       /// min. / max. number of hits in RICH1 or RICH2
-      int m_MinHitRich;
-      int m_MaxHitRich;
+      unsigned int m_MinHitRich;
+      unsigned int m_MaxHitRich;
+
+      /// Min number of rings
+      unsigned int m_MinRings;
 
       /// send a snapshot each N seconds
-      unsigned int m_UpdateInterval;
+      int m_UpdateInterval;
+
+      /// maximum number of snapshots
+      unsigned int m_maxSnapshots;
 
-      /// send next snapshot
-      bool m_sendSnapshot;
+      /// Number of snapshots sent
+      unsigned int m_nSnapShots;
 
       time_t        m_TimeStart;
       time_t        m_TimeLastUpdate;
+
     };
 
   }
diff --git a/Rich/RichOnlineMonitors/src/RichTestPatternMon.cpp b/Rich/RichOnlineMonitors/src/RichTestPatternMon.cpp
index 2cd9271e..332520cf 100755
--- a/Rich/RichOnlineMonitors/src/RichTestPatternMon.cpp
+++ b/Rich/RichOnlineMonitors/src/RichTestPatternMon.cpp
@@ -42,10 +42,12 @@
 
 //-----------------------------------------------------------------------------
 // Declaration of the Algorithm Factory
-namespace Rich {
-  namespace Mon {
+namespace Rich
+{
+  namespace Mon 
+  {
     DECLARE_ALGORITHM_FACTORY(TestPatternMonitor)
-      }// namespace Mon
+  }// namespace Mon
 }// namespace Rich
 
 //-----------------------------------------------------------------------------
@@ -72,6 +74,7 @@ Rich::Mon::TestPatternMonitor::TestPatternMonitor(const std::string &name,
   , m_deadHPDCounter("DeadHPDCounter")
   , m_deadHPDHistogram("DeadHPDHistogram")
   , m_nEventsSeen(0)
+  , m_nEvtsLastUpdate(0)
   , m_DeadPanelAverage(0)
   , m_deadRICHesFlag(false)
   , m_wrongTriggerFlag(false)
@@ -99,7 +102,7 @@ Rich::Mon::TestPatternMonitor::TestPatternMonitor(const std::string &name,
   declareProperty("TAELocation", m_taeLocation="");
   declareProperty("CheckTriggerType", m_checkTriggerTypeFlag=true);
   declareProperty("DeadPanelThreshold", m_DeadPanelThreshold=75.0);
-  declareProperty("UpdateTimerInterval" ,m_UpdateTimerInterval=60);
+  declareProperty("UpdateTimerInterval" ,m_UpdateTimerInterval=300);
   // Done.
 }// Rich::Mon::TestPatternMonitor::TestPatternMonitor(const std::string &name, ISvcLocator *pSvcLocator)
 
@@ -112,10 +115,8 @@ Rich::Mon::TestPatternMonitor::~TestPatternMonitor() {
 
 // ----------------------------------------------------------------------
 //  Initialize
-StatusCode Rich::Mon::TestPatternMonitor::initialize() {
-  if (msgLevel(MSG::DEBUG))
-    debug() << "Start of initialize() method." << endmsg;
-
+StatusCode Rich::Mon::TestPatternMonitor::initialize()
+{
   // Init base class.
   StatusCode sc(Rich::HistoAlgBase::initialize());
   if (sc.isFailure())
@@ -126,8 +127,10 @@ StatusCode Rich::Mon::TestPatternMonitor::initialize() {
   // We've already initialised it with the algorithm name so only append anything
   // if that PARTITION is defined. In Offline running it won't be.
   char *partitionName = getenv("PARTITION");
-  if (NULL!=partitionName) {
-    if (msgLevel(MSG::INFO)) {
+  if (NULL!=partitionName)
+  {
+    if (msgLevel(MSG::INFO)) 
+    {
       info() << "Running in partition " << partitionName << endmsg;
     }// if(msgLevel(MSG::INFO))
     m_name += boost::lexical_cast<std::string>(partitionName);
@@ -163,8 +166,7 @@ StatusCode Rich::Mon::TestPatternMonitor::initialize() {
   bookRichPanelHistograms(Rich::Rich2, Rich::right);
 
   // get Time of startup
-  m_TimeStart      = time(NULL);
-  m_TimeLastUpdate = time(NULL);
+  m_TimeStart = m_TimeLastUpdate = time(NULL);
 
   // Done.
   if (msgLevel(MSG::DEBUG))
@@ -179,19 +181,22 @@ StatusCode Rich::Mon::TestPatternMonitor::initialize() {
 
 // ----------------------------------------------------------------------
 // Main execution
-StatusCode Rich::Mon::TestPatternMonitor::execute() {
+StatusCode Rich::Mon::TestPatternMonitor::execute() 
+{
   if (msgLevel(MSG::DEBUG))
     debug() << "Start of execute() method." << endmsg;
   StatusCode status(StatusCode::SUCCESS);
 
   // Check all the 4 panels are dead (on average) and always drop the execute status.
-  if(m_deadRICHesFlag){
-    if (msgLevel(MSG::DEBUG)) {
+  if(m_deadRICHesFlag)
+  {
+    if (msgLevel(MSG::DEBUG))
+    {
       debug() << "End of execute() method." << endmsg;
       debug() << endmsg;
       // Send error message only once.
       // Since m_deadRICHesFlag = true a SendAndClearTS is automatically sent by appendErrorMessages
-      if(0==m_nEventsSeen%m_DeadPanelReportRate)appendErrorMessages(false,true,false);
+      if(0==m_nEventsSeen%m_DeadPanelReportRate) appendErrorMessages(false,true,false);
     }// if(msgLevel(MSG::DEBUG))
     return status;
   }
@@ -202,10 +207,13 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
   // on anyway. Probably it is some kind of fake event where
   // the test pattern has been forced. Should always have an ODIN.
   LHCb::ODIN *odin(NULL);
-  if (exist<LHCb::ODIN>(LHCb::ODINLocation::Default)) {
+  if (exist<LHCb::ODIN>(LHCb::ODINLocation::Default))
+  {
     odin = get<LHCb::ODIN>(LHCb::ODINLocation::Default);
     if ( m_checkTriggerTypeFlag &&
-         !((LHCb::ODIN::CalibrationTrigger==odin->triggerType()) && (LHCb::ODIN::A==odin->calibrationType()))) {
+         !((LHCb::ODIN::CalibrationTrigger==odin->triggerType()) && 
+           (LHCb::ODIN::A==odin->calibrationType())))
+    {
       // Set the flag m_wrongTriggerFlag, useful for the final report in the finalize method
       m_wrongTriggerFlag = true;
 
@@ -217,7 +225,8 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
               <<" (must be 7 = CalibrationTrigger). Current Calibration Type: "
               <<odin->calibrationType()<<" (must be A). No test pattern will be checked.";
       // Check that it's the first event
-      if(m_nEventsSeen == 0){
+      if(m_nEventsSeen == 0)
+      {
         // Send the message to the log file
         Info(msgTrig.str());
         // Send message to camera file:
@@ -235,8 +244,11 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
   // to ensure we can normalise properly to the number of events seen.
   ++m_nEventsSeen;
 
-  if (1==m_nEventsSeen) {
-    mp_camera->SendAndClearTS(ICameraTool::INFO, m_name, std::string("First event seen."));
+  if (1==m_nEventsSeen) 
+  {
+    const std::string m = "First event seen";
+    info() << m << endmsg;
+    mp_camera->SendAndClearTS(ICameraTool::INFO,m_name,m);
   }// if first event.
 
   //These are the maps containing the coordinates of the checked HPDs
@@ -247,7 +259,8 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
   std::map<int , std::vector<int> > m_checkedHPD_Rich2_right;
 
   // Only monitor limited number of events to minimise CPU impact, etc..
-  if (0 == m_nEventsSeen%m_monitorRate) {
+  if (0 == m_nEventsSeen%m_monitorRate)
+  {
     if (msgLevel(MSG::DEBUG))
       debug() << "Monitoring event " << m_nEventsSeen << endmsg;
 
@@ -269,7 +282,8 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
     const Rich::DAQ::L1Map::const_iterator iL1MapEnd(l1Map.end());
     // Holds the L1 ID of the current L1 board in the loop.
 
-    for (iL1Map=iL1MapBegin; iL1Map!=iL1MapEnd; ++iL1Map) {
+    for (iL1Map=iL1MapBegin; iL1Map!=iL1MapEnd; ++iL1Map)
+    {
       // We must search through the HPDs on a per Ingress FPGA basis.
       // const Rich::DAQ::Level1ID &l1ID(iL1Map->first); // could be useful one day, but commented out to suppress warning about unused variables.
       const Rich::DAQ::IngressMap &ingressMap(iL1Map->second);
@@ -283,7 +297,8 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
       const Rich::DAQ::IngressMap::const_iterator iIngressMapBegin(ingressMap.begin());
       const Rich::DAQ::IngressMap::const_iterator iIngressMapEnd(ingressMap.end());
 
-      for (iIngressMap=iIngressMapBegin; iIngressMap!=iIngressMapEnd; ++iIngressMap) {
+      for (iIngressMap=iIngressMapBegin; iIngressMap!=iIngressMapEnd; ++iIngressMap)
+      {
         // Get a list of all the HPDs on this Ingress FPGA.
         const Rich::DAQ::L1IngressID &l1IngressID = iIngressMap->first;
         const Rich::DAQ::IngressInfo &ingressInfo(iIngressMap->second);
@@ -294,7 +309,8 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
         const Rich::DAQ::HPDMap::const_iterator iHPDMapBegin(hpdMap.begin());
         const Rich::DAQ::HPDMap::const_iterator iHPDMapEnd(hpdMap.end());
 
-        for (iHPDMap=iHPDMapBegin; iHPDMap!=iHPDMapEnd; iHPDMap++) {
+        for (iHPDMap=iHPDMapBegin; iHPDMap!=iHPDMapEnd; iHPDMap++)
+        {
           // Smart and hardware ID of the current HPD under observation.
           const Rich::DAQ::Level1Input l1Input(iHPDMap->first);
           const Rich::DAQ::HPDInfo &hpdInfo(iHPDMap->second);
@@ -302,7 +318,8 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
           const LHCb::RichSmartID &hpdSmartID(hpdInfo.hpdID());
 
           // Check for error conditions on the smart ID that would prevent us analysing the data.
-          if (!hpdSmartID.isValid()) {
+          if (!hpdSmartID.isValid()) 
+          {
             if (msgLevel(MSG::DEBUG))
               debug() << "HPD SmartID is not valid, ignoring HPD on RICH " << richDetector
                       << ", UKL1 " << l1LogicalID
@@ -311,7 +328,8 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
                       << "." << endmsg;
             continue;
           }// SmartID valid
-          if (hpdInfo.header().inhibit()) {
+          if (hpdInfo.header().inhibit())
+          {
             if (msgLevel(MSG::DEBUG))
               debug() << "HPD is inhibited, ignoring HPD on RICH " << richDetector
                       << ", UKL1 " << l1LogicalID
@@ -329,10 +347,12 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
           // variable and then change it later. As the variables are declared inside
           // the if they can only be used in this scope. This results in some duplicate
           // code, but it is hopefully kept to a minimum.
-          if (!m_fakeTestPattern) {
+          if (!m_fakeTestPattern)
+          {
             // Get the real hits from the smart ID.
             const LHCb::RichSmartID::Vector &hitSmartIDs(hpdInfo.smartIDs());
-            if (msgLevel(MSG::VERBOSE)) {
+            if (msgLevel(MSG::VERBOSE)) 
+            {
               verbose() << "Loop over " << hitSmartIDs.size() << " smart ID hits." << endmsg;
               if (m_extendedVerbose)
                 verbose() << hitSmartIDs << endmsg;
@@ -343,38 +363,48 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
               nHits = find(hitSmartIDs);
             //Use the pattern finder tool to determine if this HPD contains the necessary hits.
             StatusCode sc = updateHPDStats(hpdSmartID, nHits);
-            if ((StatusCode::FAILURE==sc) && msgLevel(MSG::WARNING)) {
+            if ((StatusCode::FAILURE==sc) && msgLevel(MSG::WARNING))
+            {
               std::ostringstream msg;
-              msg << "Failed to create an entry for the HPD " << hpdSmartID.hpdID() << ". Error checking cannot be performed for this panel.";
+              msg << "Failed to create an entry for the HPD " << hpdSmartID.hpdID() 
+                  << ". Error checking cannot be performed for this panel.";
               mp_camera->Append(msg.str());
               mp_camera->SendAndClearTS(ICameraTool::INFO,m_name,"Algorithm debugging info");
               debug() << msg.str() <<endmsg;
             }// if failed to update this HPDs stats.
             //Now fill the map with the checked HPDs
-            else {
+            else
+            {
               // Create a global ordering object to ensure we plot things correctly.
               Rich::SmartIDGlobalOrdering globOrdering(hpdSmartID);
-              if(hpdSmartID.rich() == Rich::Rich1 && hpdSmartID.panel() == Rich::top){
+              if(hpdSmartID.rich() == Rich::Rich1 && hpdSmartID.panel() == Rich::top)
+              {
                 m_checkedHPD_Rich1_top[globOrdering.globalHpdX()].push_back(globOrdering.globalHpdY());}
-              else if(hpdSmartID.rich() == Rich::Rich1 && hpdSmartID.panel() == Rich::bottom){
+              else if(hpdSmartID.rich() == Rich::Rich1 && hpdSmartID.panel() == Rich::bottom)
+              {
                 m_checkedHPD_Rich1_bottom[globOrdering.globalHpdX()].push_back(globOrdering.globalHpdY());
               }
-              else if(hpdSmartID.rich() == Rich::Rich2 && hpdSmartID.panel() == Rich::left){
+              else if(hpdSmartID.rich() == Rich::Rich2 && hpdSmartID.panel() == Rich::left)
+              {
                 m_checkedHPD_Rich2_left[globOrdering.globalHpdX()].push_back(globOrdering.globalHpdY());
               }
-              else if(hpdSmartID.rich() == Rich::Rich2 && hpdSmartID.panel() == Rich::right){
+              else if(hpdSmartID.rich() == Rich::Rich2 && hpdSmartID.panel() == Rich::right)
+              {
                 m_checkedHPD_Rich2_right[globOrdering.globalHpdX()].push_back(globOrdering.globalHpdY());
               }
-              else  {
+              else  
+              {
                 debug()<<"Invalid RICH type or RICH panel (must be: either RICH1(top or bottom) or RICH2(left or right))"
                        << endmsg;
               }
             }//Checked HPDs map filled.
             //HPD stats updated
           }//if(!m_fakeTestPattern)
-          else {
+          else 
+          {
             // We only need to be warned a few times about this. It won't change later.
-            if (msgLevel(MSG::INFO)){
+            if (msgLevel(MSG::INFO))
+            {
               info() <<"Using fake test pattern."<<endmsg;
             }
             if(m_nEventsSeen == 1)mp_camera->SendAndClearTS(ICameraTool::INFO,m_name,std::string("Using fake test pattern."));
@@ -390,7 +420,8 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
             nHits = find(hitSmartIDs);
             //Use the pattern finder tool to determine if this HPD contains the necessary hits.
             StatusCode sc = updateHPDStats(hpdSmartID, nHits);
-            if ((StatusCode::FAILURE==sc) && msgLevel(MSG::WARNING)) {
+            if ((StatusCode::FAILURE==sc) && msgLevel(MSG::WARNING)) 
+            {
               std::ostringstream msg;
               msg << "Failed to create an entry for the HPD " << hpdSmartID.hpdID() << ". Error checking cannot be performed for this panel.";
               mp_camera->Append(msg.str());
@@ -451,7 +482,8 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
         mp_camera->SendAndClearTS(ICameraTool::INFO,m_name,"Algorithm debugging info");
       }
     }// if failed to update RICH panel stats.
-    else {
+    else 
+    {
       std::map<LHCb::RichSmartID, RichPanelTestPatternInfo>::iterator panelInfoIt(m_panelInfoMap.find(panelID.panelID()));
       if(panelInfoIt->second.m_panelDead == true) deadPanelsCounter++;
     }// check to see if the panel is dead
@@ -483,7 +515,8 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
       }
       m_DeadPanelAverage = 0;
     }
-    else {
+    else 
+    {
       m_DeadPanelAverage += deadPanelsCounter;
     }
 
@@ -493,30 +526,30 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
     // The option " If the dead efficiency or the fluctuating efficiency is larger than 0,
     // and if the number of messages sent to Camera is 0 or a multiple of 10 then
     // the message is sent with WARNING type. " won't be used anymore. All the messages are INFO.
-    time_t currentTime  = time(NULL);
-    bool timePassed = false;
-    if((m_UpdateTimerInterval>0) && ((currentTime - m_TimeLastUpdate) > m_UpdateTimerInterval)) timePassed = true;
+    const time_t currentTime = time(NULL);
+    const bool timePassed = ( (m_UpdateTimerInterval>0) && 
+                              ((currentTime - m_TimeLastUpdate) > m_UpdateTimerInterval)) ;
 
     // Send the error message even if m_errorReportRate haven't been processed.
     // errMsgPresent == true is any message have been appended before.
     // I recently eliminated all the instances that do that.
-    if (timePassed || errMsgPresent){
-      time_t deltaT = (currentTime - m_TimeStart);
-      struct tm * timeinfo;
-      timeinfo = localtime ( &deltaT );
+    if ( timePassed || errMsgPresent )
+    {
+      const time_t deltaT = (currentTime - m_TimeLastUpdate);
+      struct tm * timeinfo = localtime ( &deltaT );
 
       if (msgLevel(MSG::DEBUG))
         debug() << "CAMERA -> SendAndClearTS." << endmsg;
 
-      std::string messageString = " Seen " +  boost::lexical_cast<std::string>(m_nEventsSeen) +
+      std::string messageString = " Seen " +  
+        boost::lexical_cast<std::string>(m_nEventsSeen-m_nEvtsLastUpdate) +
         " events in past " +
         boost::lexical_cast<std::string>(timeinfo->tm_hour-1) + " h " +
         boost::lexical_cast<std::string>(timeinfo->tm_min)    + " min " +
         boost::lexical_cast<std::string>(timeinfo->tm_sec)    +  " s";
       std::ostringstream errMsg;
-      errMsg << "Test pattern monitor summary."
-             << messageString;
-      bool HPDmisbehaving = appendErrorMessages(true,true);
+      errMsg << "Summary :" << messageString;
+      const bool HPDmisbehaving = appendErrorMessages(true,true);
       verbose() <<"HPDmisbehaving flag: "<<HPDmisbehaving << endmsg;
 
       // Add Odin Info:
@@ -538,8 +571,9 @@ StatusCode Rich::Mon::TestPatternMonitor::execute() {
       //       else
       mp_camera->SendAndClearTS(ICameraTool::INFO, m_name, errMsg.str().c_str());
 
-      m_MessagesCounter++;
+      ++m_MessagesCounter;
       m_TimeLastUpdate = currentTime;
+      m_nEvtsLastUpdate = m_nEventsSeen;
 
     }//if (timePassed || errMsgPresent)
   }//if(0==m_nEventsSeen%m_monitorRate) N.B. m_monitorRate == 1
@@ -578,7 +612,7 @@ StatusCode Rich::Mon::TestPatternMonitor::finalize() {
       msgHistory << "The algorithm has been stopped after "
                  <<m_DeadPanelReportRate<<" events "
                  <<"since all the RICH panels show a percentage of HPDs with no hits > "
-                 <<m_DeadPanelThreshold<< "\\% ";
+                 <<m_DeadPanelThreshold<< "p.c. ";
       mp_camera->Append("TEXT",msgHistory.str().c_str());
     }
     else if(m_wrongTriggerFlag){
@@ -1184,7 +1218,7 @@ Rich::Mon::TestPatternMonitor::updateRichPanelStats(const LHCb::RichSmartID &pan
     panelInfoIt->second.m_panelDead = true;
     if(1==m_nEventsSeen){
       std::ostringstream msg1;
-      msg1 <<noHitHPDs_percentage << "\\% of HPDs in " <<panelID << " have no hits";
+      msg1 <<noHitHPDs_percentage << "p.c. of HPDs in " <<panelID << " have no hits";
       std::ostringstream msg2;
       msg2 << "It's likely that either "<<panelID<<" isn't running, or no test pattern have been sent.";
       mp_camera->Append(msg2.str());
@@ -1248,7 +1282,7 @@ bool Rich::Mon::TestPatternMonitor::appendErrorMessages(bool ForceSummary, bool
     msg3 << "All RICH panel with no hits => RichTestPatternMon execute() will be skipped.";
     std::ostringstream msg4;
     msg4<< "After " <<m_nEventsSeen << " events, all the RICH panels show "
-        << "a percentage of HPDs with no hits > "<<m_DeadPanelThreshold<< "\\% "
+        << "a percentage of HPDs with no hits > "<<m_DeadPanelThreshold<< "p.c. "
         << "It's likely that either the RICHes aren't running, or no test pattern have been sent. "
         << "RichTestPatternMon algorithm have been interrupted after "<<m_DeadPanelReportRate<<" events";
     if(!noAppend)mp_camera->Append(msg4.str());
@@ -1265,16 +1299,18 @@ bool Rich::Mon::TestPatternMonitor::appendErrorMessages(bool ForceSummary, bool
   // Loop through the RICH panel map and check for errors and append them to CAMERA if a sufficient amount have accumulated.
   const std::map<LHCb::RichSmartID, RichPanelTestPatternInfo>::iterator panelMapBeginIt(m_panelInfoMap.begin());
   const std::map<LHCb::RichSmartID, RichPanelTestPatternInfo>::iterator panelMapEndIt(m_panelInfoMap.end());
-  for (std::map<LHCb::RichSmartID, RichPanelTestPatternInfo>::iterator panelInfoIt(panelMapBeginIt); panelInfoIt!=panelMapEndIt; ++panelInfoIt) {
+  for (std::map<LHCb::RichSmartID, RichPanelTestPatternInfo>::iterator panelInfoIt(panelMapBeginIt); panelInfoIt!=panelMapEndIt; ++panelInfoIt) 
+  {
     // Do we need to add a summary message for HPD error counts (if there is at least an error).
-    if (0 < panelInfoIt->second.m_errorCount || ForceSummary) {
+    if (0 < panelInfoIt->second.m_errorCount || ForceSummary)
+    {
       errMsg.str( "" );   //empty the string
       // Send message to Camera.
       errMsg << panelInfoIt->first
              << " -- Event " << m_nEventsSeen
              << " -- Have seen "
              << panelInfoIt->second.m_errorCount
-             << "\\% of HPDs with a fluctuating test pattern efficiency.";
+             << "p.c. of HPDs with a fluctuating test pattern efficiency.";
       m_finalMsg << errMsg.str();
       if (NULL != mp_camera)
         if(!noAppend)mp_camera->Append("TEXT", errMsg.str().c_str());
@@ -1300,11 +1336,11 @@ bool Rich::Mon::TestPatternMonitor::appendErrorMessages(bool ForceSummary, bool
       errMsg << panelInfoIt->first
              << " -- Have seen "
              << panelInfoIt->second.m_deadCount
-             << "\\% of HPDs have no hits.";
+             << "p.c. of HPDs have no hits.";
       m_finalMsg  << panelInfoIt->first
                   << " -- Have seen "
                   << panelInfoIt->second.m_deadCount
-                  << "\\% of HPDs have no hits.";
+                  << "p.c. of HPDs have no hits.";
       if (NULL != mp_camera)
         if(!noAppend)mp_camera->Append("TEXT", errMsg.str().c_str());
       // Send massage to the log file (N.B. avoid "\n" and avoid "%" with std::ostringstream)
diff --git a/Rich/RichOnlineMonitors/src/RichTestPatternMon.h b/Rich/RichOnlineMonitors/src/RichTestPatternMon.h
index 4b9bc5d2..58060db2 100755
--- a/Rich/RichOnlineMonitors/src/RichTestPatternMon.h
+++ b/Rich/RichOnlineMonitors/src/RichTestPatternMon.h
@@ -452,6 +452,8 @@ namespace Rich {
 
       unsigned long m_nEventsSeen;
       //!< Keep track of the number of events we have been given.
+      unsigned long m_nEvtsLastUpdate;       
+      //!< Event count for last message
       int m_monitorRate;
       //!< Check only every nth event. A property.
       double m_DeadPanelThreshold;
diff --git a/cmt/project.cmt b/cmt/project.cmt
index 515d787e..136d14f7 100755
--- a/cmt/project.cmt
+++ b/cmt/project.cmt
@@ -2,7 +2,7 @@ project PANOPTES
 
 use LBCOM  LBCOM_v10r3
 use REC    REC_v11r4
-use ONLINE ONLINE_v4r55
+use ONLINE ONLINE_v4r56
 
 build_strategy with_installarea
 setup_strategy root
-- 
GitLab