From 10f9f60d9366e9eea2cce0cf71d705a82dd19903 Mon Sep 17 00:00:00 2001
From: John Kenneth Anders <john.kenneth.anders@cern.ch>
Date: Wed, 30 Oct 2019 10:52:33 +0000
Subject: [PATCH] Manual sweep of !27248 from 21.0 to master.

Adds Wiener Filter weights for luminosity <mu>=90.
---
 TileCalorimeter/TileConditions/CMakeLists.txt |   2 +-
 .../TileConditions/TileConditions/TileInfo.h  |   6 +
 .../TileConditions/TileInfoLoader.h           |   6 +
 .../TileConditions/TileWienerFilterWeights.h  |  40 ++++
 .../share/wiener_General_mu40.dat             | 194 ++++++++++++++++++
 .../share/wiener_General_mu90.dat             | 194 ++++++++++++++++++
 .../share/wiener_Optimal_mu40.dat             |   9 +
 .../share/wiener_Optimal_mu90.dat             |   9 +
 .../TileConditions/src/TileInfo.cxx           |  13 ++
 .../TileConditions/src/TileInfoLoader.cxx     |  15 +-
 .../src/TileWienerFilterWeights.cxx           | 104 ++++++++++
 .../share/jobOptions_TileCalibRec.py          |   1 -
 .../TileRawChannelBuilderWienerFilter.h       |   5 +-
 .../python/TileRawChannelGetter.py            |   2 +
 .../src/TileRawChannelBuilderWienerFilter.cxx |  45 ++--
 15 files changed, 609 insertions(+), 36 deletions(-)
 create mode 100644 TileCalorimeter/TileConditions/TileConditions/TileWienerFilterWeights.h
 create mode 100644 TileCalorimeter/TileConditions/share/wiener_General_mu40.dat
 create mode 100644 TileCalorimeter/TileConditions/share/wiener_General_mu90.dat
 create mode 100644 TileCalorimeter/TileConditions/share/wiener_Optimal_mu40.dat
 create mode 100644 TileCalorimeter/TileConditions/share/wiener_Optimal_mu90.dat
 create mode 100644 TileCalorimeter/TileConditions/src/TileWienerFilterWeights.cxx

diff --git a/TileCalorimeter/TileConditions/CMakeLists.txt b/TileCalorimeter/TileConditions/CMakeLists.txt
index ffb9b5e277d..d4a60773c20 100644
--- a/TileCalorimeter/TileConditions/CMakeLists.txt
+++ b/TileCalorimeter/TileConditions/CMakeLists.txt
@@ -92,7 +92,7 @@ atlas_add_test( TileDCSComponents_test
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
 atlas_install_joboptions( share/*.py )
-atlas_install_runtime( share/*.txt share/Tile2003.* share/Tile2004.* share/TileDefault.* share/TileNo*.* share/dleak*.dat share/dsleak*.dat share/leak*.dat share/dpulse*.dat share/pulse*.dat share/noise*.dat share/ai_lo*.dat share/ai_hi*.dat share/bi_lo*.dat share/bi_hi*.dat share/ci_lo*.dat share/ci_hi*.dat share/DCS*.dat share/BadHVChannels.dat )
+atlas_install_runtime( share/*.txt share/Tile2003.* share/Tile2004.* share/TileDefault.* share/TileNo*.* share/dleak*.dat share/dsleak*.dat share/leak*.dat share/dpulse*.dat share/pulse*.dat share/noise*.dat share/ai_lo*.dat share/ai_hi*.dat share/bi_lo*.dat share/bi_hi*.dat share/ci_lo*.dat share/ci_hi*.dat share/DCS*.dat share/BadHVChannels.dat share/wiener*.dat)
 
 if( NOT SIMULATIONBASE )
     # Configuration tests
diff --git a/TileCalorimeter/TileConditions/TileConditions/TileInfo.h b/TileCalorimeter/TileConditions/TileConditions/TileInfo.h
index 9bca8af5d52..98564a97e01 100644
--- a/TileCalorimeter/TileConditions/TileConditions/TileInfo.h
+++ b/TileCalorimeter/TileConditions/TileConditions/TileInfo.h
@@ -21,6 +21,7 @@
 //***************************************************************************
 
 #include "TileConditions/TilePulseShapes.h"
+#include "TileConditions/TileWienerFilterWeights.h"
 #include "TileConditions/TileCablingSvc.h"
 #include "Identifier/Identifier.h"
 #include "CaloIdentifier/CaloGain.h"
@@ -258,6 +259,9 @@ class ATLAS_CHECK_THREAD_SAFETY TileInfo {
   /** Return pointer to TilePulseShapes*/
   TilePulseShapesStruct * getPulseShapes() const {return m_pulseShapes->TilePSstruct();}
 
+  /** Return pointer to TileWienerFilterWeights */
+  TileWienerFilterWeightsStruct * getWienerFilterWeights() const {return m_WienerFilterWeights->TileWFstruct();}
+
   //==================================================================
   //==
   //== Temporary backwards compatible functions
@@ -387,6 +391,8 @@ class ATLAS_CHECK_THREAD_SAFETY TileInfo {
 
   TilePulseShapes *m_pulseShapes;
 
+  TileWienerFilterWeights *m_WienerFilterWeights;
+
   double m_emscaleTB[32];
   double m_mev2adcTB[32];
 
diff --git a/TileCalorimeter/TileConditions/TileConditions/TileInfoLoader.h b/TileCalorimeter/TileConditions/TileConditions/TileInfoLoader.h
index cfa641f6ef8..d64b7331079 100644
--- a/TileCalorimeter/TileConditions/TileConditions/TileInfoLoader.h
+++ b/TileCalorimeter/TileConditions/TileConditions/TileInfoLoader.h
@@ -42,6 +42,7 @@
 #include <string>
 
 class TilePulseShapes;
+class TileWienerFilterWeights;
 class StoreGateSvc;
 class TileCablingSvc;
 template<class TYPE> class SvcFactory;
@@ -117,6 +118,9 @@ private:
     int    m_nPhElecVec[7];
 
 
+    /** Pointer to Wiener Filtering weights*/
+    TileWienerFilterWeights* m_WFWeights;
+
     /** Filenames of input files */
     std::string m_digitsShapeFileHi;
     std::string m_digitsShapeFileLo;
@@ -125,6 +129,8 @@ private:
     std::string m_MuL1ShapeFile;
     std::string m_DecoCovaFilePrefix;
 
+    bool m_loadWienerFilterWeights;
+
     // name of TileCalibContainer in detector store
     std::string m_calibCntName;
 
diff --git a/TileCalorimeter/TileConditions/TileConditions/TileWienerFilterWeights.h b/TileCalorimeter/TileConditions/TileConditions/TileWienerFilterWeights.h
new file mode 100644
index 00000000000..1567485741e
--- /dev/null
+++ b/TileCalorimeter/TileConditions/TileConditions/TileWienerFilterWeights.h
@@ -0,0 +1,40 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TILECONDITIONS_TILEWIENERFILTERWEIGHTS_H
+#define TILECONDITIONS_TILEWIENERFILTERWEIGHTS_H
+
+#include "GaudiKernel/MsgStream.h"
+
+typedef struct
+{
+  int luminosity;
+  double generalWeights[4][48][8]; // one set of weights for each TileCall cell
+  double optimalWeights[7][8]; // weights for E3 and E4 only
+} TileWienerFilterWeightsStruct;
+
+class  TileWienerFilterWeights {
+
+  friend class TileInfoLoader;
+
+ public:
+
+  TileWienerFilterWeights();
+  ~TileWienerFilterWeights();
+
+  void loadWeights(MsgStream &log);
+  TileWienerFilterWeightsStruct * TileWFstruct() { return m_weights; }
+  bool loaded()    { return m_loaded; }
+
+ private:
+
+  //variables
+  int  m_Luminosity;
+  int  m_NSamples_Phys;
+  bool m_loaded;
+  TileWienerFilterWeightsStruct * m_weights;
+
+};
+
+#endif // TILECONDITIONS_TILEWIENERFILTERWEIGHTS_H
diff --git a/TileCalorimeter/TileConditions/share/wiener_General_mu40.dat b/TileCalorimeter/TileConditions/share/wiener_General_mu40.dat
new file mode 100644
index 00000000000..759257a906e
--- /dev/null
+++ b/TileCalorimeter/TileConditions/share/wiener_General_mu40.dat
@@ -0,0 +1,194 @@
+# WienerFilter General Weights for luminosity <mu>=40
+# partition channel w0 w1 w2 w3 w4 w5 w6 bias
+0 0 -0.252202 -0.414785 0.0799916 0.898931 0.218044 -0.271645 -0.242421 -0.673856
+0 1 -0.0526363 -0.24168 -0.444125 1.44263 -0.390138 -0.086727 -0.121797 -4.6287
+0 2 -0.0525738 -0.387037 -0.246146 1.25487 -0.173098 -0.233637 -0.109027 -2.41224
+0 3 -0.0554175 -0.373866 -0.259807 1.26628 -0.184614 -0.226227 -0.110707 -2.39963
+0 4 -0.0457492 -0.238111 -0.444874 1.44309 -0.391061 -0.0862056 -0.115096 -5.31862
+0 5 -0.0546931 -0.23164 -0.45288 1.45686 -0.412567 -0.0712933 -0.124094 -4.93978
+0 6 -0.0533814 -0.359899 -0.271408 1.27631 -0.195211 -0.219332 -0.112598 -2.80181
+0 7 -0.0614849 -0.353274 -0.280797 1.28261 -0.199025 -0.218266 -0.117029 -2.26379
+0 8 -0.0708713 -0.216191 -0.481575 1.48595 -0.445983 -0.0499172 -0.141608 -3.56674
+0 9 -0.0625409 -0.193189 -0.509774 1.51096 -0.474359 -0.0294878 -0.135128 -4.81964
+0 10 -0.0720027 -0.181834 -0.52271 1.52318 -0.489159 -0.0150173 -0.144313 -4.43169
+0 11 -0.0735675 -0.345234 -0.296315 1.3049 -0.234205 -0.184626 -0.131309 -1.67529
+0 12 -0.0784788 -0.331371 -0.294845 1.30055 -0.228765 -0.18187 -0.132097 -2.33424
+0 13 -0.271159 -0.394834 0.0869576 0.903518 0.200342 -0.25364 -0.261393 -0.438935
+0 14 -0.271526 -0.387516 0.0808033 0.90352 0.203106 -0.247351 -0.257591 -1.0397
+0 15 -0.0723225 -0.193347 -0.498531 1.50131 -0.467231 -0.0242289 -0.140612 -4.75216
+0 16 -0.073331 -0.332223 -0.302488 1.30799 -0.2338 -0.190515 -0.128815 -2.05117
+0 17 -0.0650899 -0.330364 -0.310601 1.31299 -0.239459 -0.178704 -0.126948 -2.72924
+0 18 -0.06951 -0.197026 -0.483151 1.48706 -0.453299 -0.02731 -0.141372 -5.1828
+0 19 -0.0692379 -0.189552 -0.506682 1.50919 -0.474932 -0.0240076 -0.140192 -4.76555
+0 20 -0.0594051 -0.211331 -0.481929 1.48552 -0.446618 -0.0477513 -0.129313 -4.96557
+0 21 -0.0698949 -0.339498 -0.291691 1.29906 -0.230175 -0.178281 -0.121379 -2.89591
+0 22 -0.0707921 -0.350216 -0.280452 1.28791 -0.217328 -0.184379 -0.122738 -2.72049
+0 23 -0.0676126 -0.177953 -0.520696 1.5142 -0.473736 -0.0211919 -0.139235 -4.74062
+0 24 -0.274251 -0.390336 0.0820441 0.893242 0.222821 -0.254046 -0.265581 -0.635121
+0 25 -0.271282 -0.398541 0.0808258 0.894733 0.220977 -0.254412 -0.258692 -0.602617
+0 26 -0.0655691 -0.192027 -0.504596 1.49848 -0.454083 -0.0385889 -0.134746 -4.7457
+0 27 -0.0733231 -0.357126 -0.259959 1.27482 -0.20566 -0.201337 -0.125553 -2.25441
+0 28 -0.0613927 -0.35473 -0.272426 1.27694 -0.200415 -0.199923 -0.118149 -3.18696
+0 29 -0.0726636 -0.186443 -0.517505 1.51487 -0.474832 -0.0290093 -0.144454 -4.06482
+0 30 -0.366415 -0.361751 0.15427 0.82095 0.284438 -0.208283 -0.321868 -0.0584551
+0 31 -0.360982 -0.364324 0.153634 0.823883 0.28083 -0.212915 -0.318956 -0.0510368
+0 32 -0.0614968 -0.183053 -0.509002 1.51028 -0.477306 -0.017279 -0.136707 -5.66147
+0 33 -0.0618837 -0.341941 -0.292146 1.30301 -0.235655 -0.182028 -0.123098 -2.7626
+0 34 -0.0715176 -0.346657 -0.283558 1.29218 -0.219467 -0.194486 -0.128413 -2.0764
+0 35 -0.0653627 -0.155981 -0.541249 1.53973 -0.511733 0.0111716 -0.141084 -5.9668
+0 36 -0.090892 -0.105417 -0.612131 1.60311 -0.580001 0.0584574 -0.161398 -4.97528
+0 37 -0.0992414 -0.094244 -0.631799 1.6224 -0.600194 0.0666409 -0.171137 -4.01582
+0 38 -0.0806057 -0.155341 -0.55767 1.55713 -0.52988 0.0174272 -0.15748 -4.01385
+0 39 -0.0680649 -0.318152 -0.323886 1.34078 -0.285881 -0.150932 -0.127634 -2.89806
+0 40 -0.0751628 -0.302248 -0.353022 1.36413 -0.307668 -0.137586 -0.132108 -2.42984
+0 41 -0.153682 -0.40877 -0.0704366 1.07215 0.0223212 -0.255696 -0.181988 -1.0684
+0 42 -0.0832732 -0.361595 -0.237576 1.25166 -0.182152 -0.19936 -0.135802 -2.26664
+0 43 -0.363222 -0.3631 0.152733 0.823415 0.281804 -0.210568 -0.320008 -0.0442855
+0 44 -0.158805 -0.411472 -0.0460358 1.0601 0.0256814 -0.260338 -0.185633 -1.04169
+0 45 -0.00580319 -0.342876 -0.324351 1.3372 -0.275071 -0.181091 -0.0710134 -5.57141
+0 46 -0.0667085 -0.203476 -0.497946 1.49564 -0.455124 -0.0332761 -0.140668 -3.99991
+0 47 -0.0446059 -0.446056 -0.141425 1.16001 -0.0723877 -0.29357 -0.0921527 -3.03626
+1 0 -0.255556 -0.403714 0.0754085 0.902016 0.215943 -0.269937 -0.249144 -0.637275
+1 1 -0.0637271 -0.22735 -0.46568 1.46371 -0.41483 -0.068454 -0.131182 -4.16187
+1 2 -0.0522454 -0.361491 -0.26946 1.27649 -0.198584 -0.215773 -0.105409 -3.21439
+1 3 -0.0596161 -0.362957 -0.275654 1.2808 -0.199321 -0.219676 -0.116473 -2.10014
+1 4 -0.0607457 -0.225747 -0.468378 1.46484 -0.414434 -0.070569 -0.126968 -4.4807
+1 5 -0.0605516 -0.212122 -0.473832 1.47912 -0.441823 -0.0463122 -0.133601 -4.98937
+1 6 -0.0625873 -0.362179 -0.268467 1.28561 -0.218081 -0.201506 -0.121655 -2.18355
+1 7 -0.0654307 -0.345106 -0.295169 1.30682 -0.238175 -0.187477 -0.126462 -2.16002
+1 8 -0.0666144 -0.19581 -0.498093 1.50056 -0.465569 -0.0269842 -0.139058 -4.75048
+1 9 -0.0729241 -0.176854 -0.527196 1.52154 -0.481597 -0.0199203 -0.14362 -4.54666
+1 10 -0.0883132 -0.126493 -0.598004 1.58744 -0.554878 0.0276394 -0.157668 -4.20288
+1 11 -0.06311 -0.326794 -0.316163 1.31938 -0.246288 -0.181984 -0.117316 -3.17608
+1 12 -0.0707992 -0.335039 -0.309741 1.31971 -0.252985 -0.173999 -0.129646 -2.03375
+1 13 -0.266822 -0.397075 0.0676631 0.912096 0.198699 -0.249651 -0.248991 -0.711046
+1 14 -0.271883 -0.40252 0.070741 0.907115 0.204133 -0.244789 -0.251446 -0.526069
+1 15 -0.0710913 -0.178508 -0.512696 1.51054 -0.474509 -0.0162453 -0.144335 -5.15282
+1 16 -0.0712625 -0.336504 -0.298045 1.30231 -0.229901 -0.179384 -0.131258 -2.42712
+1 17 -0.0684867 -0.333287 -0.300274 1.30637 -0.234243 -0.185899 -0.123847 -2.77065
+1 18 -0.0565743 -0.216631 -0.471419 1.47288 -0.431525 -0.0503877 -0.132337 -4.89368
+1 19 -0.0553129 -0.196732 -0.502744 1.49648 -0.451858 -0.0396443 -0.131068 -5.3809
+1 20 -0.0264319 -0.296553 -0.442821 1.44959 -0.389067 -0.141508 -0.100706 -2.28638
+1 21 -0.0674671 -0.343357 -0.292159 1.29398 -0.216174 -0.192845 -0.129614 -2.46472
+1 22 -0.0681715 -0.347233 -0.28094 1.28629 -0.209325 -0.20106 -0.128512 -2.40772
+1 23 -0.0728099 -0.193284 -0.492679 1.48441 -0.436936 -0.0435312 -0.139852 -4.91008
+1 24 -0.269411 -0.401674 0.0911316 0.890973 0.221857 -0.264418 -0.255123 -0.595291
+1 25 -0.259099 -0.400189 0.0974053 0.891696 0.217485 -0.269605 -0.263353 -0.62653
+1 26 -0.0493699 -0.23944 -0.445624 1.44549 -0.396259 -0.078852 -0.121041 -5.13951
+1 27 -0.0680671 -0.355762 -0.266429 1.27649 -0.203587 -0.198722 -0.133128 -2.15959
+1 28 -0.0620306 -0.364299 -0.255611 1.26997 -0.198404 -0.207656 -0.128841 -2.38811
+1 29 -0.0515258 -0.209824 -0.48962 1.4919 -0.454258 -0.0397714 -0.125486 -5.64195
+1 30 -0.363585 -0.362635 0.15494 0.822182 0.282419 -0.21102 -0.32125 -0.0478369
+1 31 -0.367606 -0.362233 0.156444 0.818092 0.2878 -0.208059 -0.322917 -0.0654095
+1 32 -0.0641096 -0.204928 -0.49627 1.50044 -0.464511 -0.0346227 -0.139419 -4.33187
+1 33 -0.0762201 -0.344776 -0.283101 1.28688 -0.210641 -0.19486 -0.124445 -2.29595
+1 34 -0.0697951 -0.339714 -0.285551 1.28812 -0.211515 -0.194626 -0.119122 -2.96609
+1 35 -0.0678246 -0.173898 -0.52459 1.51704 -0.478204 -0.0121627 -0.14043 -5.55935
+1 36 -0.0779523 -0.124926 -0.598044 1.58748 -0.559407 0.0431445 -0.154439 -5.28869
+1 37 -0.0932904 -0.107161 -0.634445 1.62191 -0.595174 0.060066 -0.169537 -3.65218
+1 38 -0.0798084 -0.135321 -0.577814 1.56622 -0.533123 0.0259832 -0.153122 -5.11035
+1 39 -0.0866803 -0.320198 -0.347867 1.35861 -0.294861 -0.157082 -0.150282 0.00356904
+1 40 -0.0715309 -0.295499 -0.358191 1.36204 -0.299182 -0.13917 -0.136975 -2.6825
+1 41 -0.160895 -0.403919 -0.0618779 1.06354 0.0301686 -0.253049 -0.185732 -1.2766
+1 42 -0.088319 -0.352023 -0.245755 1.25464 -0.179821 -0.203984 -0.137528 -2.07559
+1 43 -0.364001 -0.366038 0.15614 0.819299 0.286686 -0.211476 -0.319752 -0.0372474
+1 44 -0.161301 -0.402492 -0.0482051 1.0512 0.041817 -0.256446 -0.184322 -1.75341
+1 45 -0.0107746 -0.327917 -0.349728 1.36175 -0.304436 -0.157598 -0.0781672 -5.7657
+1 46 -0.0666388 -0.192039 -0.497907 1.49531 -0.456981 -0.0271648 -0.134085 -5.40865
+1 47 -0.0502908 -0.438968 -0.157012 1.17954 -0.0943154 -0.294936 -0.09342 -2.38335
+2 0 -0.191002 0.507328 -1.2781 2.19238 -1.27413 0.652577 -0.26292 -13.9786
+2 1 -0.194001 0.467425 -1.25861 2.18556 -1.26515 0.633456 -0.276491 -14.1588
+2 2 -0.0500103 -0.32101 -0.331937 1.3393 -0.275136 -0.16136 -0.112993 -3.93115
+2 3 -0.0636144 -0.333519 -0.295402 1.30388 -0.236797 -0.175708 -0.121213 -3.49372
+2 4 -0.0509967 -0.325897 -0.321294 1.32842 -0.262599 -0.165088 -0.120509 -3.64164
+2 5 -0.0802882 -0.0521982 -0.701563 1.69221 -0.68399 0.11784 -0.159804 -5.60201
+2 6 -0.0823171 -0.122542 -0.577255 1.57035 -0.546756 0.0470142 -0.155197 -5.9053
+2 7 -0.0969583 -0.111975 -0.611039 1.59906 -0.571404 0.0534191 -0.171677 -3.87807
+2 8 -0.0606437 -0.155027 -0.557166 1.54939 -0.513498 -0.000926501 -0.134175 -5.77875
+2 9 -0.0707862 -0.137796 -0.584891 1.57846 -0.548937 0.0233227 -0.145315 -5.05179
+2 10 -0.0920692 0.0690828 -0.807235 1.78048 -0.790419 0.235322 -0.171264 -10.1177
+2 11 -0.119716 0.0841668 -0.84007 1.81172 -0.822764 0.254485 -0.201732 -7.16286
+2 12 -0.254321 0.520355 -1.39919 2.32134 -1.40426 0.68223 -0.336893 -3.63408
+2 13 -0.159163 0.474323 -1.24538 2.16163 -1.24854 0.62308 -0.233729 -11.8067
+2 14 -0.0536996 -0.225762 -0.462003 1.46485 -0.424047 -0.0542001 -0.124778 -5.46827
+2 15 -0.0381913 -0.273475 -0.511702 1.51922 -0.466196 -0.105139 -0.118957 -0.129024
+2 16 -0.0724856 -0.225498 -0.49093 1.49339 -0.447501 -0.0656893 -0.137647 -2.17906
+2 17 -0.0570111 -0.214024 -0.501413 1.49497 -0.444616 -0.059924 -0.126409 -3.93317
+2 18 -0.112258 -0.300568 -0.343368 1.35632 -0.302375 -0.12421 -0.163844 -0.412206
+2 19 -0.16807 0.108155 -0.901942 1.8619 -0.86075 0.265242 -0.24966 -2.36669
+2 20 -0.0516209 -0.101816 -0.628409 1.62323 -0.608923 0.0710472 -0.131874 -7.68748
+2 21 -0.0692571 -0.0214312 -0.716908 1.70356 -0.702934 0.152456 -0.152344 -8.84859
+2 22 -0.0580445 -0.367876 -0.253328 1.25911 -0.180905 -0.21283 -0.111234 -3.3654
+2 23 -0.051158 -0.349521 -0.30602 1.31281 -0.239504 -0.194549 -0.108319 -2.82038
+2 24 0 0 0 0 0 0 0 0
+2 25 0 0 0 0 0 0 0 0
+2 26 0 0 0 0 0 0 0 0
+2 27 0 0 0 0 0 0 0 0
+2 28 0 0 0 0 0 0 0 0
+2 29 0 0 0 0 0 0 0 0
+2 30 -0.0758456 -0.400995 -0.181745 1.20316 -0.126447 -0.252264 -0.124644 -1.8075
+2 31 -0.0458238 -0.178775 -0.544928 1.54682 -0.516831 -0.00960716 -0.121501 -5.56915
+2 32 -0.0540513 -0.157882 -0.565661 1.5619 -0.530657 0.00268718 -0.124299 -5.7597
+2 33 -0.365571 -0.361334 0.153747 0.821544 0.284152 -0.209725 -0.321611 -0.0536833
+2 34 -0.373225 -0.357791 0.159183 0.815904 0.288454 -0.203335 -0.327671 -0.0698076
+2 35 -0.0759686 -0.390471 -0.194845 1.21084 -0.130146 -0.251085 -0.125261 -1.96045
+2 36 -0.12432 -0.469727 -0.0156344 1.03315 0.0638882 -0.322646 -0.139077 -1.06512
+2 37 -0.162186 -0.418578 -0.0337394 1.03567 0.0647632 -0.280697 -0.184804 -0.878102
+2 38 -0.1657 -0.422353 -0.0279006 1.02958 0.0712193 -0.283007 -0.179734 -0.927465
+2 39 -0.120434 -0.443792 -0.0439415 1.05562 0.0414705 -0.303757 -0.146119 -1.60026
+2 40 -0.0212472 -0.354683 -0.33093 1.34752 -0.283363 -0.188713 -0.0988157 -2.8811
+2 41 -0.0225428 -0.324333 -0.362326 1.37316 -0.311726 -0.160292 -0.104694 -3.76165
+2 42 0 0 0 0 0 0 0 0
+2 43 0 0 0 0 0 0 0 0
+2 44 0 0 0 0 0 0 0 0
+2 45 0 0 0 0 0 0 0 0
+2 46 0 0 0 0 0 0 0 0
+2 47 0 0 0 0 0 0 0 0
+3 0 -0.194637 0.509142 -1.29582 2.20875 -1.28685 0.652752 -0.266739 -12.6062
+3 1 -0.205492 0.486274 -1.28292 2.20305 -1.27778 0.641863 -0.284833 -13.6666
+3 2 -0.0499676 -0.31629 -0.332553 1.34663 -0.290022 -0.153054 -0.112482 -3.93113
+3 3 -0.0630774 -0.30558 -0.363717 1.36747 -0.302614 -0.147972 -0.125957 -2.5998
+3 4 -0.0630755 -0.327432 -0.328645 1.33728 -0.271457 -0.16549 -0.131065 -2.26408
+3 5 -0.080661 -0.0331138 -0.731174 1.71613 -0.708884 0.137578 -0.155377 -6.06468
+3 6 -0.0775578 -0.120585 -0.593326 1.58309 -0.556167 0.0451771 -0.153792 -5.78766
+3 7 -0.0850693 -0.108225 -0.610462 1.601 -0.578785 0.0638752 -0.164369 -5.19207
+3 8 -0.051912 -0.145994 -0.556625 1.5516 -0.524479 0.0206981 -0.126073 -7.55256
+3 9 -0.0786105 -0.139999 -0.591672 1.58582 -0.556517 0.025795 -0.154037 -3.94269
+3 10 -0.123273 0.0877068 -0.850158 1.81977 -0.828225 0.251614 -0.20222 -7.06034
+3 11 -0.126526 0.0842088 -0.844918 1.81461 -0.822461 0.249447 -0.205095 -6.52157
+3 12 -0.215668 0.509486 -1.33598 2.25373 -1.33127 0.655675 -0.290155 -9.50825
+3 13 -0.161815 0.47376 -1.24532 2.16546 -1.25767 0.629373 -0.23783 -11.2286
+3 14 -0.0609858 -0.213461 -0.477933 1.46937 -0.41724 -0.0623464 -0.128227 -4.8204
+3 15 -0.0676298 -0.214548 -0.478546 1.47259 -0.423207 -0.0564944 -0.138261 -4.2805
+3 16 -0.0608258 -0.232106 -0.483243 1.49276 -0.456329 -0.0522993 -0.131969 -3.36723
+3 17 -0.0570582 -0.236786 -0.480434 1.4906 -0.453098 -0.0583573 -0.130336 -3.31868
+3 18 -0.112538 -0.375511 -0.222395 1.19717 -0.0911934 -0.208965 -0.177853 -0.365669
+3 19 -0.105929 -0.254235 -0.412696 1.41396 -0.359154 -0.0874266 -0.178028 -0.714498
+3 20 -0.0542186 -0.0792885 -0.65079 1.64433 -0.634707 0.0929795 -0.13511 -8.26443
+3 21 -0.0710117 -0.0148223 -0.718006 1.70103 -0.696927 0.148756 -0.149026 -9.25004
+3 22 -0.0603361 -0.343739 -0.316606 1.31951 -0.246326 -0.17812 -0.122982 -2.29129
+3 23 -0.053835 -0.347899 -0.304168 1.31015 -0.240336 -0.176913 -0.117453 -3.01892
+3 24 0 0 0 0 0 0 0 0
+3 25 0 0 0 0 0 0 0 0
+3 26 0 0 0 0 0 0 0 0
+3 27 0 0 0 0 0 0 0 0
+3 28 0 0 0 0 0 0 0 0
+3 29 0 0 0 0 0 0 0 0
+3 30 -0.0749304 -0.396155 -0.177775 1.18272 -0.0920592 -0.257715 -0.124574 -2.67461
+3 31 -0.0547931 -0.159503 -0.559139 1.56081 -0.534464 0.00618779 -0.128848 -5.86844
+3 32 -0.0367092 -0.17603 -0.530123 1.5322 -0.503508 -0.00996583 -0.111908 -7.55143
+3 33 -0.388597 -0.382282 0.208361 0.758103 0.354834 -0.209725 -0.338688 -0.0831629
+3 34 -0.371005 -0.366897 0.16649 0.805217 0.303132 -0.208642 -0.326221 -0.091239
+3 35 -0.0931362 -0.382243 -0.178791 1.18498 -0.0962068 -0.252402 -0.136274 -2.13209
+3 36 -0.108277 -0.468245 -0.0216599 1.03234 0.0708156 -0.323968 -0.143936 -1.60964
+3 37 -0.156586 -0.414856 -0.0341219 1.03319 0.0710989 -0.286715 -0.186896 -1.11412
+3 38 -0.155705 -0.416595 -0.0354412 1.03533 0.0673266 -0.283275 -0.184804 -1.18063
+3 39 -0.10906 -0.439898 -0.0668416 1.07828 0.0177975 -0.296353 -0.149632 -1.43425
+3 40 -0.0225114 -0.35402 -0.335216 1.34075 -0.269082 -0.189277 -0.0817468 -3.81994
+3 41 -0.0366403 -0.320914 -0.363137 1.37204 -0.312007 -0.152334 -0.0951477 -4.02549
+3 42 0 0 0 0 0 0 0 0
+3 43 0 0 0 0 0 0 0 0
+3 44 0 0 0 0 0 0 0 0
+3 45 0 0 0 0 0 0 0 0
+3 46 0 0 0 0 0 0 0 0
+3 47 0 0 0 0 0 0 0 0
diff --git a/TileCalorimeter/TileConditions/share/wiener_General_mu90.dat b/TileCalorimeter/TileConditions/share/wiener_General_mu90.dat
new file mode 100644
index 00000000000..87aaefbb105
--- /dev/null
+++ b/TileCalorimeter/TileConditions/share/wiener_General_mu90.dat
@@ -0,0 +1,194 @@
+# WienerFilter General Weights for luminosity <mu>=90
+# partition channel w0 w1 w2 w3 w4 w5 w6 bias
+0 0 -0.239256 -0.420402 0.0754974 0.952088 0.125168 -0.276114 -0.196736 -0.867826
+0 1 -0.072312 -0.127604 -0.58689 1.60443 -0.611107 0.0883131 -0.147561 -7.08055
+0 2 -0.067421 -0.2886 -0.38354 1.41206 -0.381753 -0.0930146 -0.117202 -3.80942
+0 3 -0.0679086 -0.277294 -0.395237 1.42979 -0.409478 -0.0704985 -0.126005 -3.76843
+0 4 -0.0638546 -0.120994 -0.589007 1.6049 -0.611197 0.0899741 -0.143028 -7.9293
+0 5 -0.0610611 -0.133535 -0.585896 1.61369 -0.632089 0.104739 -0.152904 -7.52382
+0 6 -0.0535911 -0.275258 -0.415298 1.44197 -0.417125 -0.0643949 -0.120399 -4.3493
+0 7 -0.0652904 -0.277515 -0.421597 1.44965 -0.429607 -0.0456747 -0.132478 -3.52104
+0 8 -0.0903856 -0.106815 -0.621895 1.64582 -0.665506 0.128376 -0.17669 -5.59143
+0 9 -0.0732806 -0.102964 -0.633167 1.65615 -0.678658 0.138517 -0.163176 -7.13773
+0 10 -0.0856031 -0.0805633 -0.658979 1.67273 -0.689639 0.145356 -0.166728 -6.79365
+0 11 -0.0749503 -0.248305 -0.452998 1.47983 -0.461104 -0.0330558 -0.146359 -2.85504
+0 12 -0.0688187 -0.248152 -0.448984 1.48042 -0.469578 -0.0179793 -0.145001 -3.77974
+0 13 -0.245742 -0.404116 0.0173147 0.974763 0.125657 -0.254371 -0.200311 -0.603058
+0 14 -0.24045 -0.395468 0.0349481 0.961455 0.135071 -0.250533 -0.216401 -1.29023
+0 15 -0.0866621 -0.0768629 -0.650548 1.66275 -0.678614 0.146198 -0.170818 -7.24686
+0 16 -0.0810295 -0.255537 -0.431034 1.47121 -0.466765 -0.0190879 -0.149088 -3.23821
+0 17 -0.070435 -0.256329 -0.429337 1.47074 -0.470028 -0.00994086 -0.14551 -4.14572
+0 18 -0.07936 -0.0864647 -0.635227 1.64863 -0.66421 0.139268 -0.164941 -7.77555
+0 19 -0.0838089 -0.083961 -0.652833 1.66259 -0.675913 0.142699 -0.165137 -7.25799
+0 20 -0.0726403 -0.106547 -0.621562 1.63847 -0.652657 0.121792 -0.156354 -7.5567
+0 21 -0.0675252 -0.256902 -0.428148 1.46337 -0.455785 -0.0209357 -0.134236 -4.46786
+0 22 -0.0681783 -0.258312 -0.426412 1.45631 -0.439024 -0.043229 -0.129708 -4.22302
+0 23 -0.0745921 -0.0799583 -0.662549 1.6695 -0.683357 0.15431 -0.168388 -7.20891
+0 24 -0.225919 -0.401147 0.0322546 0.952451 0.160189 -0.273022 -0.227848 -0.786356
+0 25 -0.23085 -0.413648 0.0345644 0.951827 0.158389 -0.272426 -0.21067 -0.778222
+0 26 -0.0713284 -0.0944915 -0.641585 1.64915 -0.657094 0.1281 -0.161459 -7.37747
+0 27 -0.0445621 -0.309881 -0.38738 1.43584 -0.42854 -0.058445 -0.129142 -3.57949
+0 28 -0.0328407 -0.301894 -0.397081 1.44062 -0.432003 -0.0506981 -0.122741 -4.93695
+0 29 -0.0801917 -0.102615 -0.643163 1.66317 -0.684166 0.145089 -0.174129 -6.31822
+0 30 -0.368807 -0.36 0.153649 0.820663 0.285649 -0.209751 -0.320076 -0.0581903
+0 31 -0.363643 -0.363502 0.153243 0.822837 0.282747 -0.212193 -0.318424 -0.0471713
+0 32 -0.066992 -0.0939153 -0.635341 1.65355 -0.677098 0.155851 -0.165311 -8.58694
+0 33 -0.0536252 -0.259599 -0.444126 1.48051 -0.475253 -0.0133808 -0.135473 -4.39649
+0 34 -0.0668674 -0.267972 -0.433946 1.4605 -0.439624 -0.0431161 -0.137283 -3.33435
+0 35 -0.0702362 -0.0605686 -0.673043 1.68783 -0.715247 0.181871 -0.171464 -8.85636
+0 36 -0.101356 -0.0135847 -0.734815 1.74289 -0.774171 0.221666 -0.190035 -7.72824
+0 37 -0.115933 0.010348 -0.771462 1.77474 -0.806066 0.241977 -0.206762 -6.45974
+0 38 -0.100968 -0.0395761 -0.709684 1.71748 -0.74049 0.193564 -0.192279 -6.33745
+0 39 -0.0687582 -0.235326 -0.480254 1.50751 -0.500272 0.00752878 -0.138119 -4.39476
+0 40 -0.0822917 -0.210023 -0.508268 1.53494 -0.532656 0.0317866 -0.15191 -3.87972
+0 41 -0.146572 -0.402851 -0.132263 1.16266 -0.104021 -0.212519 -0.133815 -1.43727
+0 42 -0.0758046 -0.304325 -0.369432 1.39658 -0.365406 -0.0903464 -0.12197 -3.29249
+0 43 -0.360033 -0.364318 0.15141 0.824337 0.281593 -0.211433 -0.321299 -0.00940394
+0 44 -0.154891 -0.414303 -0.111662 1.14945 -0.0964656 -0.215709 -0.126684 -1.39529
+0 45 0.00457839 -0.281576 -0.427656 1.46656 -0.463023 -0.03058 -0.0855757 -8.45699
+0 46 -0.075435 -0.111486 -0.626509 1.65408 -0.681376 0.144259 -0.169841 -6.33248
+0 47 -0.0261134 -0.419533 -0.231041 1.27287 -0.226683 -0.206325 -0.0690193 -4.38451
+1 0 -0.244977 -0.409081 0.0805494 0.947794 0.129478 -0.277003 -0.208353 -0.794705
+1 1 -0.0720588 -0.135941 -0.591332 1.61133 -0.620423 0.0934171 -0.154285 -6.45377
+1 2 -0.0524304 -0.283533 -0.385583 1.41757 -0.394807 -0.0747182 -0.118979 -4.89474
+1 3 -0.0724655 -0.281888 -0.39295 1.42375 -0.397294 -0.0824006 -0.126065 -3.33879
+1 4 -0.068427 -0.133995 -0.591905 1.60971 -0.616155 0.0890551 -0.151472 -6.81861
+1 5 -0.0720257 -0.0980044 -0.628897 1.63918 -0.647183 0.118424 -0.157954 -7.57027
+1 6 -0.0652119 -0.271905 -0.433109 1.45317 -0.426935 -0.0447556 -0.133298 -3.52652
+1 7 -0.0710321 -0.251719 -0.454044 1.47357 -0.448876 -0.0370444 -0.135582 -3.50592
+1 8 -0.0709212 -0.0962412 -0.637124 1.64906 -0.66043 0.127927 -0.161994 -7.21119
+1 9 -0.0851791 -0.0751215 -0.660331 1.67354 -0.69195 0.155177 -0.177133 -7.01841
+1 10 -0.111288 -0.0110634 -0.74011 1.74039 -0.760368 0.203616 -0.193815 -6.57234
+1 11 -0.0789747 -0.22984 -0.456267 1.47767 -0.460099 -0.0181119 -0.135498 -4.83183
+1 12 -0.0973713 -0.214573 -0.466588 1.4852 -0.461931 -0.0294548 -0.144477 -3.21232
+1 13 -0.222005 -0.413494 0.0266355 0.974534 0.121555 -0.263055 -0.205513 -0.841034
+1 14 -0.230043 -0.417028 0.0364622 0.970083 0.121167 -0.261196 -0.205308 -0.665738
+1 15 -0.0889815 -0.0539175 -0.673276 1.67492 -0.684671 0.153835 -0.172635 -7.71009
+1 16 -0.0789933 -0.246712 -0.440498 1.469 -0.453552 -0.0303322 -0.135895 -3.79322
+1 17 -0.0793362 -0.242168 -0.439269 1.46557 -0.448514 -0.03139 -0.13408 -4.35983
+1 18 -0.0734333 -0.106001 -0.611105 1.62475 -0.634117 0.113044 -0.158216 -7.33924
+1 19 -0.0711645 -0.0952164 -0.62915 1.64239 -0.654792 0.125571 -0.156386 -8.05178
+1 20 -0.0580131 -0.188957 -0.568476 1.59337 -0.591361 0.0378308 -0.146571 -3.93849
+1 21 -0.0711657 -0.260196 -0.430354 1.4581 -0.438065 -0.0448387 -0.136444 -3.82538
+1 22 -0.0758281 -0.255698 -0.427084 1.45189 -0.42743 -0.0538985 -0.13545 -3.81133
+1 23 -0.0726797 -0.120544 -0.593882 1.6129 -0.62487 0.10792 -0.162286 -7.57388
+1 24 -0.21906 -0.425255 0.0160018 0.956132 0.164574 -0.267524 -0.208846 -0.729078
+1 25 -0.21772 -0.425192 0.0372261 0.953174 0.153933 -0.270634 -0.213545 -0.761683
+1 26 -0.0568909 -0.151895 -0.560994 1.58858 -0.60128 0.0806234 -0.145591 -7.53458
+1 27 -0.065179 -0.28331 -0.394881 1.44273 -0.434982 -0.0601588 -0.129849 -3.38949
+1 28 -0.058988 -0.292403 -0.395234 1.43515 -0.418988 -0.0703624 -0.120809 -3.73359
+1 29 -0.064478 -0.104361 -0.622636 1.64745 -0.672722 0.140761 -0.158482 -8.48043
+1 30 -0.359401 -0.365052 0.15308 0.823744 0.28184 -0.213989 -0.319175 -0.0463472
+1 31 -0.369688 -0.360713 0.15646 0.818266 0.287086 -0.206673 -0.323253 -0.0639692
+1 32 -0.0821669 -0.090678 -0.644888 1.6574 -0.671281 0.137245 -0.168376 -6.85358
+1 33 -0.0790854 -0.260984 -0.422036 1.45389 -0.438596 -0.0398363 -0.135696 -3.61529
+1 34 -0.0683474 -0.266201 -0.410754 1.44654 -0.434716 -0.0411533 -0.129012 -4.44187
+1 35 -0.0818785 -0.0771259 -0.649969 1.6636 -0.684817 0.163077 -0.177321 -8.13216
+1 36 -0.0970858 -0.0156478 -0.730042 1.7349 -0.762612 0.217942 -0.190772 -8.15962
+1 37 -0.118804 0.00561132 -0.770937 1.77005 -0.796565 0.238108 -0.213673 -5.87472
+1 38 -0.0885015 -0.0343533 -0.709817 1.71588 -0.739114 0.195927 -0.183879 -8.0152
+1 39 -0.116829 -0.219146 -0.510195 1.52529 -0.501851 -0.00903647 -0.16532 -0.227769
+1 40 -0.0923352 -0.192498 -0.511538 1.52116 -0.500746 0.0101627 -0.14731 -4.11487
+1 41 -0.145756 -0.396974 -0.122669 1.15732 -0.101906 -0.212237 -0.141739 -1.69969
+1 42 -0.0871916 -0.292038 -0.371219 1.39857 -0.370066 -0.0781391 -0.135839 -3.09489
+1 43 -0.364317 -0.362562 0.153956 0.821129 0.284803 -0.209688 -0.322297 -0.0452887
+1 44 -0.14334 -0.405871 -0.104649 1.15197 -0.109325 -0.204778 -0.131696 -2.37815
+1 45 -0.00507292 -0.252901 -0.46107 1.49509 -0.492423 -0.00883668 -0.0991463 -8.63414
+1 46 -0.0753433 -0.0903882 -0.632514 1.64576 -0.661262 0.138514 -0.164553 -8.14448
+1 47 -0.0377943 -0.408919 -0.25143 1.29071 -0.244194 -0.195826 -0.0809084 -3.64771
+2 0 -0.240063 0.568559 -1.38914 2.3024 -1.4229 0.769669 -0.338873 -18.5236
+2 1 -0.26821 0.5791 -1.50366 2.42449 -1.54316 0.809411 -0.41711 -10.569
+2 2 -0.0572689 -0.23043 -0.476057 1.50144 -0.490973 -0.00351442 -0.127729 -5.64044
+2 3 -0.0610727 -0.248153 -0.442752 1.47367 -0.464388 -0.0161847 -0.130587 -5.42726
+2 4 -0.0346553 -0.266445 -0.456833 1.50014 -0.498981 -0.0142019 -0.143783 -4.30696
+2 5 -0.115152 0.101703 -0.904747 1.90613 -0.96292 0.346301 -0.211062 -7.2697
+2 6 -0.0885914 -0.0254165 -0.702295 1.71118 -0.74262 0.218973 -0.195305 -9.31323
+2 7 -0.116323 -0.0249254 -0.705355 1.71999 -0.755501 0.224388 -0.219109 -6.59343
+2 8 -0.0835556 -0.0321293 -0.70864 1.71026 -0.730433 0.192974 -0.171985 -9
+2 9 -0.0967535 -0.0076117 -0.750576 1.74846 -0.768698 0.208553 -0.180564 -7.68463
+2 10 -0.0946397 0.145899 -0.904268 1.89148 -0.947202 0.373585 -0.205012 -14.9952
+2 11 -0.123018 0.165177 -0.936082 1.9237 -0.983699 0.396855 -0.23324 -11.8863
+2 12 -0.292579 0.590418 -1.52071 2.44864 -1.57406 0.816792 -0.41802 0.00727828
+2 13 -0.163957 0.461573 -1.24375 2.18727 -1.33464 0.707542 -0.281732 -15.1078
+2 14 -0.0658963 -0.11117 -0.611352 1.63428 -0.651894 0.114554 -0.146857 -8.02051
+2 15 -0.0867531 -0.149271 -0.657134 1.68068 -0.68424 0.0741884 -0.168175 -0.530951
+2 16 -0.0861575 -0.111034 -0.658043 1.67768 -0.691721 0.122801 -0.172965 -3.61573
+2 17 -0.0765378 -0.0906556 -0.66872 1.6833 -0.699675 0.140895 -0.159109 -5.99456
+2 18 -0.113238 -0.194306 -0.49979 1.57774 -0.624757 0.0865034 -0.22016 -0.530118
+2 19 -0.149301 0.176774 -1.07322 2.07426 -1.14406 0.452116 -0.35629 0.88531
+2 20 -0.0676506 0.0169361 -0.764564 1.76657 -0.799775 0.235382 -0.166114 -11.988
+2 21 -0.0898873 0.092022 -0.840386 1.83084 -0.870833 0.298629 -0.181229 -13.1939
+2 22 -0.055791 -0.26807 -0.401085 1.42975 -0.405808 -0.0692295 -0.122317 -5.17847
+2 23 -0.0598675 -0.243897 -0.452942 1.47951 -0.460623 -0.0388886 -0.13026 -4.44158
+2 24 0 0 0 0 0 0 0 0
+2 25 0 0 0 0 0 0 0 0
+2 26 0 0 0 0 0 0 0 0
+2 27 0 0 0 0 0 0 0 0
+2 28 0 0 0 0 0 0 0 0
+2 29 0 0 0 0 0 0 0 0
+2 30 -0.0748838 -0.304558 -0.355657 1.3579 -0.291894 -0.152529 -0.113873 -2.99016
+2 31 -0.0555368 -0.0639342 -0.684429 1.69882 -0.721952 0.160304 -0.149472 -8.8109
+2 32 -0.0594378 -0.0439691 -0.706152 1.71189 -0.731103 0.171703 -0.153225 -9.24684
+2 33 -0.362826 -0.360338 0.152112 0.82352 0.282828 -0.213398 -0.320648 -0.0556058
+2 34 -0.373403 -0.357886 0.158243 0.815789 0.289406 -0.203419 -0.327201 -0.0711682
+2 35 -0.0783471 -0.303604 -0.352426 1.36269 -0.305828 -0.141477 -0.115387 -3.13567
+2 36 -0.086041 -0.47009 -0.100143 1.12412 -0.0412417 -0.291304 -0.0981828 -1.58646
+2 37 -0.116357 -0.422525 -0.108216 1.14993 -0.0877092 -0.261544 -0.126941 -1.16052
+2 38 -0.109103 -0.424578 -0.110565 1.14755 -0.079115 -0.272069 -0.121797 -1.30225
+2 39 -0.083993 -0.435034 -0.138153 1.16091 -0.0833683 -0.267061 -0.100273 -2.22539
+2 40 -0.0479318 -0.246935 -0.473628 1.50082 -0.483872 -0.0378108 -0.110101 -4.38417
+2 41 -0.0443698 -0.219498 -0.508029 1.53594 -0.529254 -0.00148281 -0.107161 -5.72619
+2 42 0 0 0 0 0 0 0 0
+2 43 0 0 0 0 0 0 0 0
+2 44 0 0 0 0 0 0 0 0
+2 45 0 0 0 0 0 0 0 0
+2 46 0 0 0 0 0 0 0 0
+2 47 0 0 0 0 0 0 0 0
+3 0 -0.229455 0.551028 -1.38599 2.31505 -1.44335 0.772741 -0.334551 -18.3127
+3 1 -0.252835 0.569191 -1.46093 2.3704 -1.47393 0.788075 -0.392161 -18.5798
+3 2 -0.0526942 -0.228407 -0.472563 1.50628 -0.507916 0.0166308 -0.127043 -6.16388
+3 3 -0.090375 -0.0223418 -0.781668 1.78786 -0.812295 0.208269 -0.192028 -4.66415
+3 4 -0.0437355 -0.182017 -0.611776 1.64135 -0.648089 0.0763882 -0.194418 -2.08201
+3 5 -0.118641 0.0812 -0.858023 1.85867 -0.909209 0.322002 -0.206974 -7.6365
+3 6 -0.0909085 -0.0188237 -0.715516 1.72527 -0.75737 0.218868 -0.193002 -9.20427
+3 7 -0.0941262 -0.0115541 -0.728964 1.73686 -0.769614 0.229429 -0.200886 -8.57529
+3 8 -0.0611919 -0.0315682 -0.701734 1.70889 -0.735913 0.198223 -0.157373 -11.0601
+3 9 -0.104606 -0.0114463 -0.749657 1.75049 -0.771986 0.208677 -0.19405 -6.39105
+3 10 -0.125685 0.156983 -0.933722 1.9243 -0.984892 0.392817 -0.237614 -11.4555
+3 11 -0.125062 0.148067 -0.91923 1.91235 -0.974708 0.391286 -0.238344 -11.3392
+3 12 -0.294569 0.593176 -1.53486 2.46641 -1.5965 0.821607 -0.424409 1.03652
+3 13 -0.176639 0.489211 -1.27436 2.20448 -1.34302 0.708949 -0.28063 -14.857
+3 14 -0.0685623 -0.106033 -0.624945 1.64008 -0.650999 0.11561 -0.155661 -7.25479
+3 15 -0.0985308 0.00521911 -0.756017 1.76787 -0.813377 0.267223 -0.198747 -8.5672
+3 16 -0.131091 0.156277 -0.959279 1.94439 -0.994521 0.370526 -0.223619 -7.54651
+3 17 -0.082099 -0.106113 -0.658217 1.67779 -0.695609 0.135069 -0.166659 -4.98729
+3 18 -0.0758366 -0.330613 -0.331754 1.38922 -0.378539 -0.0835252 -0.182933 -0.275688
+3 19 -0.0257583 -0.212228 -0.585259 1.62374 -0.622963 0.0304876 -0.21234 0.167087
+3 20 -0.0563783 0.0172083 -0.771818 1.77756 -0.817666 0.250591 -0.165567 -12.7956
+3 21 -0.074188 0.0746171 -0.826908 1.82484 -0.871089 0.300941 -0.181133 -13.7109
+3 22 -0.0616632 -0.243158 -0.465852 1.49075 -0.472383 -0.0283353 -0.138937 -3.92447
+3 23 -0.0487065 -0.249353 -0.456055 1.48931 -0.480733 -0.0180371 -0.132345 -4.90925
+3 24 0 0 0 0 0 0 0 0
+3 25 0 0 0 0 0 0 0 0
+3 26 0 0 0 0 0 0 0 0
+3 27 0 0 0 0 0 0 0 0
+3 28 0 0 0 0 0 0 0 0
+3 29 0 0 0 0 0 0 0 0
+3 30 -0.0393948 -0.363658 -0.292558 1.32653 -0.286142 -0.150107 -0.107951 -4.05073
+3 31 -0.0601124 -0.0605634 -0.69228 1.70643 -0.733181 0.178894 -0.160737 -8.91785
+3 32 -0.0474205 -0.0608706 -0.674519 1.68358 -0.702838 0.157256 -0.139536 -10.939
+3 33 -0.382934 -0.378634 0.197711 0.76937 0.343336 -0.210671 -0.336142 -0.0859021
+3 34 -0.374076 -0.368001 0.173182 0.79991 0.307277 -0.208536 -0.327453 -0.100676
+3 35 -0.0587822 -0.352818 -0.302683 1.3336 -0.293432 -0.136927 -0.12082 -3.31117
+3 36 -0.0675425 -0.468058 -0.111982 1.12343 -0.0264957 -0.308371 -0.092228 -2.18255
+3 37 -0.12071 -0.415775 -0.105352 1.1286 -0.0508142 -0.26373 -0.139252 -1.49814
+3 38 -0.12115 -0.420563 -0.100142 1.13175 -0.0619581 -0.259933 -0.13219 -1.62222
+3 39 -0.0798924 -0.418341 -0.176206 1.18575 -0.0993383 -0.257377 -0.108847 -1.97207
+3 40 -0.00615637 -0.282522 -0.464587 1.49099 -0.47337 -0.0378839 -0.098834 -5.78599
+3 41 -0.0347484 -0.221168 -0.519738 1.53344 -0.515873 0.00279724 -0.114806 -6.01165
+3 42 0 0 0 0 0 0 0 0
+3 43 0 0 0 0 0 0 0 0
+3 44 0 0 0 0 0 0 0 0
+3 45 0 0 0 0 0 0 0 0
+3 46 0 0 0 0 0 0 0 0
+3 47 0 0 0 0 0 0 0 0
diff --git a/TileCalorimeter/TileConditions/share/wiener_Optimal_mu40.dat b/TileCalorimeter/TileConditions/share/wiener_Optimal_mu40.dat
new file mode 100644
index 00000000000..e98ba4cae32
--- /dev/null
+++ b/TileCalorimeter/TileConditions/share/wiener_Optimal_mu40.dat
@@ -0,0 +1,9 @@
+# WienerFilter Optimal Weights for luminosity <mu>=40 for E3 and E4 cells
+# w0 w1 w2 w3 w4 w5 w6 bias
+0.04382 -0.999 0.5212 1.179 -0.8052 0.4123 -0.1756 -5.393
+0.1806 0.02539 -1.253 2.187 -1.254 0.6214 -0.2732 -14.53
+-0.3267 0.6014 -1.346 2.224 -1.258 0.6043 -0.276 -14.41
+-0.1914 0.4693 -1.246 2.169 -1.243 0.6191 -0.2633 -15.15
+-0.1831 0.4734 -1.253 2.241 -1.424 0.9173 -0.5364 -15.43
+-0.2245 0.5627 -1.398 2.433 -1.722 1.204 -0.5617 -15.26
+-0.2367 0.617 -1.502 2.539 -1.729 0.7092 -0.1435 -14.15
diff --git a/TileCalorimeter/TileConditions/share/wiener_Optimal_mu90.dat b/TileCalorimeter/TileConditions/share/wiener_Optimal_mu90.dat
new file mode 100644
index 00000000000..00113ee792a
--- /dev/null
+++ b/TileCalorimeter/TileConditions/share/wiener_Optimal_mu90.dat
@@ -0,0 +1,9 @@
+# WienerFilter Optimal Weights for luminosity <mu>=90 for E3 and E4 cells
+# w0 w1 w2 w3 w4 w5 w6 bias
+-1.636 -1.046 3.098 -0.404 0.03112 0.01587 -0.008498 -4.553
+4.285 -4.777 -0.4661 1.946 -1.333 0.6926 -0.3889 -2.969
+-0.1298 0.8341 -1.705 2.527 -1.56 0.7667 -0.4249 -22.36
+-0.3355 0.6098 -1.477 2.374 -1.464 0.7465 -0.3921 -7.779
+-0.3412 0.6794 -1.612 2.654 -1.999 1.502 -1.061 1.083
+-0.3647 0.7639 -1.781 2.911 -2.416 1.842 -0.9426 -6.571
+-0.3766 0.8367 -1.841 2.901 -2.075 0.5155 0.03466 -7.34
diff --git a/TileCalorimeter/TileConditions/src/TileInfo.cxx b/TileCalorimeter/TileConditions/src/TileInfo.cxx
index d77bf09f521..5dc6f187bfb 100644
--- a/TileCalorimeter/TileConditions/src/TileInfo.cxx
+++ b/TileCalorimeter/TileConditions/src/TileInfo.cxx
@@ -25,6 +25,7 @@
 #include "TileConditions/TileInfo.h"
 #include "TileConditions/TileCablingService.h"
 #include "TileConditions/TilePulseShapes.h"
+#include "TileConditions/TileWienerFilterWeights.h"
 
 #include "TileCalibBlobObjs/TileCalibDrawerFlt.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
@@ -102,6 +103,7 @@ TileInfo::TileInfo(ISvcLocator *svcLocator)
   , m_MuL1Time0Bin(0)
   , m_MuL1BinsPerX(0)
   , m_pulseShapes(0)
+  , m_WienerFilterWeights(0)
   , m_tileCablingSvc("TileCablingSvc","TileInfo")
   , m_nPhElec(0)
   , m_nPhElecVec()
@@ -192,6 +194,17 @@ TileInfo::initialize()
   if (m_pulseShapes)
     m_pulseShapes->load(log);
   
+  //=== Read WienerFilter Weights in TileInfoLoader.cxx
+  if (m_WienerFilterWeights) {
+    m_WienerFilterWeights->loadWeights(log);
+
+    if (!m_WienerFilterWeights->loaded()) {
+      log << MSG::ERROR
+        << "Unable to load WienerFilter weights"<<endmsg;
+      return StatusCode::FAILURE;
+    }
+  }
+
   if(debug) log << MSG::DEBUG << " TileInfo initialization completed. " << endmsg;  
   return StatusCode::SUCCESS;
 }
diff --git a/TileCalorimeter/TileConditions/src/TileInfoLoader.cxx b/TileCalorimeter/TileConditions/src/TileInfoLoader.cxx
index 1c5927337c7..d01ec37e76f 100644
--- a/TileCalorimeter/TileConditions/src/TileInfoLoader.cxx
+++ b/TileCalorimeter/TileConditions/src/TileInfoLoader.cxx
@@ -24,6 +24,7 @@
 #include "TileConditions/TileCablingSvc.h"
 #include "TileConditions/TileCablingService.h"
 #include "TileConditions/TilePulseShapes.h"
+#include "TileConditions/TileWienerFilterWeights.h"
 
 // Calo includes
 #include "CaloIdentifier/TileID.h"
@@ -55,6 +56,7 @@ TileInfoLoader::TileInfoLoader(const std::string& name,
   : AthService(name, pSvcLocator)
   , m_detStore("DetectorStore", name)
   , m_pulsevar(new TilePulseShapes())
+  , m_WFWeights(new TileWienerFilterWeights())
 {
 
   //==========================================================
@@ -187,12 +189,19 @@ TileInfoLoader::TileInfoLoader(const std::string& name,
   //==========================================================
   declareProperty("filename_DecoCovaFilePrefix" ,m_DecoCovaFilePrefix  = "DecoCovaMatrix");
 
+  //==========================================================
+  //=== TileWienerFilterWeights configuration
+  //==========================================================
+  declareProperty("LoadWienerFilterWeights"    ,m_loadWienerFilterWeights    = false);
+  declareProperty("WienerFilterPhysicsNSamples",m_WFWeights->m_NSamples_Phys = 7);
+  declareProperty("WienerFilterLuminosity"     ,m_WFWeights->m_Luminosity    = 40);
 }
 
 //*****************************************************************************
 TileInfoLoader::~TileInfoLoader() {
 //*****************************************************************************
   delete m_pulsevar;
+  delete m_WFWeights;
 }
 
 //*****************************************************************************
@@ -240,7 +249,8 @@ StatusCode TileInfoLoader::initialize() {
   std::copy (std::begin(m_emscaleMBTS), std::end(m_emscaleMBTS), std::begin(info->m_emscaleMBTS));
   std::copy (std::begin(m_nPhElecVec), std::end(m_nPhElecVec), std::begin(info->m_nPhElecVec));
 
-  
+  m_WFWeights->m_NSamples_Phys = info->m_nSamples; // to make sure that everything is consistent
+
   //=== Find the detector store service.
   CHECK( m_detStore.retrieve() );
 
@@ -376,6 +386,9 @@ StatusCode TileInfoLoader::initialize() {
   // only if we want to use them (i.e. when we also read all calib files)
   info->m_pulseShapes = m_pulsevar;
 
+  // point to WienerFilterWeights
+  if (m_loadWienerFilterWeights) info->m_WienerFilterWeights=m_WFWeights;
+
   //=== Initialize and register TileInfo object
   CHECK( info->initialize() );
 
diff --git a/TileCalorimeter/TileConditions/src/TileWienerFilterWeights.cxx b/TileCalorimeter/TileConditions/src/TileWienerFilterWeights.cxx
new file mode 100644
index 00000000000..78201298b0f
--- /dev/null
+++ b/TileCalorimeter/TileConditions/src/TileWienerFilterWeights.cxx
@@ -0,0 +1,104 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "TileConditions/TileWienerFilterWeights.h"
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <cstring>
+#include "PathResolver/PathResolver.h"
+
+using std::memset;
+
+TileWienerFilterWeights::TileWienerFilterWeights()
+  : m_Luminosity(40)
+  , m_loaded(false)
+  , m_weights(nullptr)
+{
+}
+
+TileWienerFilterWeights::~TileWienerFilterWeights()
+{
+  if (m_weights) delete m_weights;
+}
+
+void TileWienerFilterWeights::loadWeights(MsgStream &log)
+{
+  log<<MSG::DEBUG<<"TileWienerFilterWeights::loadWeights"<<endmsg;
+
+  m_weights = new TileWienerFilterWeightsStruct;
+  memset(m_weights,0,sizeof(TileWienerFilterWeightsStruct));
+
+  // set luminosity
+  m_weights->luminosity = m_Luminosity;
+  log<<MSG::DEBUG<<" Luminosity="<<m_Luminosity<<endmsg;
+
+  /////////////////////////////////////////////////////////////////////////////
+  // GENERAL WEIGHTS
+  std::string file_name_gn = "wiener_General_mu"+std::to_string(m_Luminosity)+".dat";
+  std::string file_path_gn = PathResolver::find_file(file_name_gn, "DATAPATH");
+  std::ifstream file_gn(file_path_gn.c_str());
+  std::string line_gn;
+
+  if (file_gn.is_open()) {
+    log<<MSG::DEBUG<<file_name_gn<<" opened"<<endmsg;
+
+    int partition, channel;
+
+    while (std::getline(file_gn, line_gn)) {
+      // skip empty or comment lines
+      if (line_gn.size() == 0 || line_gn[0] == '#') continue;
+
+      // read values
+      std::istringstream iss(line_gn);
+      iss>>partition;
+      iss>>channel;
+      if (partition > -1 && partition < 4 && channel > -1 && channel < 48) {
+        for (int i=0; i<8; i++) {
+          iss>>m_weights->generalWeights[partition][channel][i];
+        }
+      }
+    }
+
+    file_gn.close();
+  } else {
+    log<<MSG::FATAL<<file_name_gn<<" not found"<<endmsg;
+    return;
+  }
+  /////////////////////////////////////////////////////////////////////////////
+
+  /////////////////////////////////////////////////////////////////////////////
+  // OPTIMAL WEIGHTS
+  std::string file_name_op = "wiener_Optimal_mu"+std::to_string(m_Luminosity)+".dat";
+  std::string file_path_op = PathResolver::find_file(file_name_op, "DATAPATH");
+  std::ifstream file_op(file_path_op.c_str());
+  std::string line_op;
+
+  if (file_op.is_open()) {
+    log<<MSG::DEBUG<<file_name_op<<" opened"<<endmsg;
+
+    int bcidIndex = 0;
+
+    while (std::getline(file_op, line_op)) {
+      // skip empty or comment lines
+      if (line_op.size() == 0 || line_op[0] == '#') continue;
+
+      // read values
+      std::istringstream iss(line_op);
+      for (int i=0; i<8; i++) {
+        iss>>m_weights->optimalWeights[bcidIndex][i];
+      }
+      bcidIndex++;
+    }
+
+    file_op.close();
+  } else {
+    log<<MSG::FATAL<<file_name_op<<" not found"<<endmsg;
+    return;
+  }
+  /////////////////////////////////////////////////////////////////////////////
+
+  m_loaded = true;
+  log<<MSG::DEBUG<<" WienerFilter Weights loaded"<<endmsg;
+}
diff --git a/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileCalibRec.py b/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileCalibRec.py
index e3d0b26b81f..96d6607a99f 100644
--- a/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileCalibRec.py
+++ b/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileCalibRec.py
@@ -958,7 +958,6 @@ if doTileWiener and tileRawChannelBuilderWienerFilter:
         if TileCompareMode or TileEmulateDSP:
             tileRawChannelBuilderWienerFilter.EmulateDSP = True # use dsp emulation
     tileRawChannelBuilderWienerFilter.UseDSPCorrection = not TileBiGainRun
-    tileRawChannelBuilderWienerFilter.OutputLevel = 1
 
     print tileRawChannelBuilderWienerFilter
 
diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelBuilderWienerFilter.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelBuilderWienerFilter.h
index 51f66af48bb..050c511ab65 100644
--- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelBuilderWienerFilter.h
+++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelBuilderWienerFilter.h
@@ -24,6 +24,7 @@
 #include "TileConditions/TileCondToolNoiseSample.h"
 
 // Atlas includes
+#include "TileConditions/TileWienerFilterWeights.h"
 #include "TrigAnalysisInterfaces/IBunchCrossingTool.h"
 
 #include <vector>
@@ -101,11 +102,9 @@ class TileRawChannelBuilderWienerFilter: public TileRawChannelBuilder {
     double m_maxTime; //!< max allowed time = 25*(m_nSamples-1)/2
     double m_minTime; //!< min allowed time = -25*(m_nSamples-1)/2
 
+    TileWienerFilterWeightsStruct *m_weights; //!< structure for Wiener Filter weights
 
     std::vector<float> m_digits;
-
-    static const float m_gfcWiener[8]; //!< Wiener General weights
-    static const float m_ofcWiener[7][8]; //!< Wiener Optimal weights
 };
 
 #endif
diff --git a/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter.py b/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter.py
index 016cec5e9d7..1696fda3474 100644
--- a/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter.py
+++ b/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter.py
@@ -509,6 +509,8 @@ class TileRawChannelGetter ( Configured)  :
                 theTileRawChannelBuilderWienerFilter.TimeCorrection          = False # don't need correction after iterations
                 theTileRawChannelBuilderWienerFilter.DSPContainer            = TileRawChannelContainerDSP
 
+                ServiceMgr.TileInfoLoader.LoadWienerFilterWeights            = True
+
                 mlog.info(" adding now TileRawChannelBuilderWienerFilter to the algorithm: %s", theTileRawChannelMaker.name())
 
                 theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderWienerFilter]
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderWienerFilter.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderWienerFilter.cxx
index 1d67b4a1b20..6ec1792a13a 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderWienerFilter.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilderWienerFilter.cxx
@@ -39,27 +39,6 @@ const InterfaceID& TileRawChannelBuilderWienerFilter::interfaceID() {
 
 #define TILE_WienerFilterBUILDERVERBOSE false
 
-// initialize Wiener coefficients ( ZeroBias <mu>=40 )
-const float TileRawChannelBuilderWienerFilter::m_gfcWiener[8] = {
-  -0.194081,
-  0.467562,
-  -1.25846,
-  2.18528,
-  -1.2648,
-  0.63341,
-  -0.276375,
-  -14.2093
-};
-const float TileRawChannelBuilderWienerFilter::m_ofcWiener[7][8] = {
-  {0.04382, -0.999, 0.5212, 1.179, -0.8052, 0.4123, -0.1756, -5.393},
-  {0.1806, 0.02539, -1.253, 2.187, -1.254, 0.6214, -0.2732, -14.53},
-  {-0.3267, 0.6014, -1.346, 2.224, -1.258, 0.6043, -0.276, -14.41},
-  {-0.1914, 0.4693, -1.246, 2.169, -1.243, 0.6191, -0.2633, -15.15},
-  {-0.1831, 0.4734, -1.253, 2.241, -1.424, 0.9173, -0.5364, -15.43},
-  {-0.2245, 0.5627, -1.398, 2.433, -1.722, 1.204, -0.5617, -15.26},
-  {-0.2367, 0.617, -1.502, 2.539, -1.729, 0.7092, -0.1435, -14.15}
-};
-
 TileRawChannelBuilderWienerFilter::TileRawChannelBuilderWienerFilter(const std::string& type,
     const std::string& name, const IInterface *parent)
   : TileRawChannelBuilder(type, name, parent)
@@ -72,6 +51,7 @@ TileRawChannelBuilderWienerFilter::TileRawChannelBuilderWienerFilter(const std::
   , m_t0SamplePosition(0)
   , m_maxTime(0.0)
   , m_minTime(0.0)
+  , m_weights(0)
 {
   //declare interfaces
   declareInterface< TileRawChannelBuilder >( this );
@@ -97,7 +77,6 @@ TileRawChannelBuilderWienerFilter::TileRawChannelBuilderWienerFilter(const std::
 TileRawChannelBuilderWienerFilter::~TileRawChannelBuilderWienerFilter() {
 }
 
-
 StatusCode TileRawChannelBuilderWienerFilter::initialize() {
 
   ATH_MSG_INFO( "initialize()" );
@@ -107,6 +86,10 @@ StatusCode TileRawChannelBuilderWienerFilter::initialize() {
   // init in superclass
   ATH_CHECK( TileRawChannelBuilder::initialize() );
 
+  // get pointer to weights (loaded by the InfoLoader in TileInfo, from TileWienerFilterWeights)
+  m_weights = m_tileInfo->getWienerFilterWeights();
+  ATH_MSG_DEBUG( "Weights loaded" );
+
   if (m_maxIterations != 1) m_correctTimeNI = false;
 
   // bits 12-15 - various options
@@ -391,23 +374,25 @@ double TileRawChannelBuilderWienerFilter::filter(int ros, int drawer, int channe
     m_nConst++;
 
   } else {
-    float weights[8];
+    double weights[8];
     memset(weights, 0, sizeof(weights));
 
     int bcidIndex = getBCIDIndex();
 
-    if (ros > 1 && channel == 1 && bcidIndex >= 0) {
-      ATH_MSG_VERBOSE( "Switch to optimal mode");
-      for (int wi = 0; wi < 8; wi++) {
-        weights[wi] = m_ofcWiener[bcidIndex][wi];
+    // check if it is E3 or E4 cells and if the BCID is available
+    if (ros > 2 && (channel == 0 || channel == 1) && bcidIndex > -1) {
+      ATH_MSG_VERBOSE( "Switch to optimal weights");
+      for (unsigned int i = 0; i < 8; i++) {
+        weights[i] = m_weights->optimalWeights[bcidIndex][i];
       }
     } else {
-      ATH_MSG_VERBOSE( "Switch to general mode");
-      for (int wi = 0; wi < 8; wi++) {
-        weights[wi] = m_gfcWiener[wi];
+      ATH_MSG_VERBOSE( "Switch to general weights");
+      for (unsigned int i = 0; i < 8; i++) {
+        weights[i] = m_weights->generalWeights[ros-1][channel][i];
       }
     }
 
+    // apply filter
     for (unsigned int i = 0; i < m_digits.size(); i++) {
       amplitude += weights[i] * m_digits[i]; // Wiener coefs
     }
-- 
GitLab