From 722114b8c44ba27f947e4cb1f0df18dcd5f31c01 Mon Sep 17 00:00:00 2001
From: Michael Duehrssen <michael.duehrssen@cern.ch>
Date: Tue, 20 Feb 2018 17:55:53 +0100
Subject: [PATCH] Changes in response to code review for merge request
 https://gitlab.cern.ch/atlas/athena/merge_requests/8919 Major change in
 TFCSParametrizationBase to use the Gaudi MsgService for the logging output in
 Athena

Former-commit-id: 550788d6e466bef501ef3c13554e6eb513619324
---
 .../ISF_FastCaloSimEvent/DoubleArray.h        |  7 +-
 .../ISF_FastCaloSimEvent/ICaloGeometry.h      |  4 +-
 .../ISF_FastCaloSimEvent/IntArray.h           |  7 +-
 .../ISF_FastCaloSimEvent/TFCS1DFunction.h     |  4 +-
 .../TFCS1DFunctionHistogram.h                 |  4 +-
 .../TFCS1DFunctionRegression.h                |  4 +-
 .../TFCSEnergyParametrization.h               |  8 +-
 .../TFCSExtrapolationState.h                  |  4 +-
 .../TFCSHistoLateralShapeParametrization.h    | 19 ++--
 .../ISF_FastCaloSimEvent/TFCSHitCellMapping.h | 12 +--
 .../TFCSHitCellMappingWiggleEMB.h             | 13 ++-
 .../TFCSLateralShapeParametrization.h         | 11 +--
 .../TFCSLateralShapeParametrizationHitBase.h  | 22 ++---
 .../TFCSLateralShapeParametrizationHitChain.h | 20 ++--
 ...ateralShapeParametrizationHitNumberFromE.h | 18 +++-
 .../TFCSPCAEnergyParametrization.h            | 20 ++--
 .../TFCSParametrization.h                     |  6 +-
 .../TFCSParametrizationBase.h                 | 93 ++++++++++++++++++-
 .../TFCSParametrizationChain.h                | 15 +--
 .../TFCSSimulationState.h                     | 12 +--
 .../ISF_FastCaloSimEvent/TFCSTruthState.h     |  4 +-
 .../ISF_FastCaloSimEvent/src/DoubleArray.cxx  |  7 +-
 .../ISF_FastCaloSimEvent/src/IntArray.cxx     |  7 +-
 .../src/TFCS1DFunctionHistogram.cxx           | 23 +----
 .../src/TFCSEnergyParametrization.cxx         |  2 +-
 .../TFCSHistoLateralShapeParametrization.cxx  | 64 ++++++-------
 .../src/TFCSHitCellMapping.cxx                | 15 +--
 .../src/TFCSHitCellMappingWiggleEMB.cxx       | 11 +--
 .../src/TFCSLateralShapeParametrization.cxx   | 24 +----
 ...TFCSLateralShapeParametrizationHitBase.cxx | 18 +---
 ...FCSLateralShapeParametrizationHitChain.cxx | 21 ++---
 ...eralShapeParametrizationHitNumberFromE.cxx | 33 +------
 .../src/TFCSPCAEnergyParametrization.cxx      | 65 +++++++++----
 .../src/TFCSParametrization.cxx               |  8 +-
 .../src/TFCSParametrizationBase.cxx           | 39 +++++---
 .../src/TFCSParametrizationChain.cxx          |  9 +-
 .../TFCSNNLateralShapeParametrization.h       |  8 +-
 .../TFCSSimpleLateralShapeParametrization.h   |  9 +-
 .../TreeReader.h                              |  4 +-
 .../TFCSNNLateralShapeParametrization.cxx     | 13 +--
 .../TFCSSimpleLateralShapeParametrization.cxx | 25 ++---
 .../src/FastCaloSimSvcV2.cxx                  |  8 +-
 .../src/FastCaloSimSvcV2.h                    |  6 +-
 43 files changed, 357 insertions(+), 369 deletions(-)

diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/DoubleArray.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/DoubleArray.h
index e92e228c78029..f7f57b72170b3 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/DoubleArray.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/DoubleArray.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ISF_FASTCALOSIMEVENT_DoubleArray_h
@@ -16,9 +16,12 @@ public:
    ~DoubleArray();
 
 private:
-//   TArrayD* m_array;
 
    ClassDef( DoubleArray, 1 )
 };
 
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
+#pragma link C++ class DoubleArray+;
+#endif
+
 #endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/ICaloGeometry.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/ICaloGeometry.h
index d302c71e1de73..f2cadeff67e08 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/ICaloGeometry.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/ICaloGeometry.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ICaloGeometry_h
@@ -18,8 +18,6 @@ public :
 
    virtual const CaloDetDescrElement* getDDE(Identifier identify) = 0;
    virtual const CaloDetDescrElement* getDDE(int sampling,float eta,float phi,float* distance=0,int* steps=0) = 0;
-//   virtual const CaloGeoDetDescrElement* getDDE(Identifier identify) = 0;
-//   virtual const CaloGeoDetDescrElement* getDDE(int sampling,float eta,float phi,float* distance=0,int* steps=0) = 0;
    
    virtual double deta(int sample,double eta) const = 0;
    virtual void   minmaxeta(int sample,double eta,double& mineta,double& maxeta) const = 0;
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/IntArray.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/IntArray.h
index 0a37d36963152..795d0e8c5d60a 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/IntArray.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/IntArray.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ISF_FASTCALOSIMEVENT_IntArray_h
@@ -16,9 +16,12 @@ public:
    ~IntArray();
 
 private:
-//   TArrayI* m_array;
 
    ClassDef( IntArray, 1 )
 };
 
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
+#pragma link C++ class IntArray+;
+#endif
+
 #endif
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCS1DFunction.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCS1DFunction.h
index db61c8a67e209..aea6fa9cfe8bc 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCS1DFunction.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCS1DFunction.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ISF_FASTCALOSIMEVENT_TFCS1DFunction_h
@@ -26,7 +26,7 @@ class TFCS1DFunction:public TObject
 
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCS1DFunction+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCS1DFunctionHistogram.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCS1DFunctionHistogram.h
index 841b269586f0d..8f40ead1189d5 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCS1DFunctionHistogram.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCS1DFunctionHistogram.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ISF_FASTCALOSIMEVENT_TFCS1DFunctionHistogram_h
@@ -42,7 +42,7 @@ class TFCS1DFunctionHistogram:public TFCS1DFunction
 
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCS1DFunctionHistogram+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCS1DFunctionRegression.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCS1DFunctionRegression.h
index e34cb81ad5725..b36b899f71d23 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCS1DFunctionRegression.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCS1DFunctionRegression.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ISF_FASTCALOSIMEVENT_TFCS1DFunctionRegression_h
@@ -34,7 +34,7 @@ class TFCS1DFunctionRegression:public TFCS1DFunction
 
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCS1DFunctionRegression+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSEnergyParametrization.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSEnergyParametrization.h
index 1412c36b58b2e..265a4fe64236b 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSEnergyParametrization.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSEnergyParametrization.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ISF_FASTCALOSIMEVENT_TFCSEnergyParametrization_h
@@ -9,20 +9,20 @@
 
 class TFCSEnergyParametrization:public TFCSParametrization {
 public:
-  TFCSEnergyParametrization(const char* name=0, const char* title=0);
+  TFCSEnergyParametrization(const char* name=nullptr, const char* title=nullptr);
 
   virtual bool is_match_Ekin_bin(int /*Ekin_bin*/) const {return true;};
   virtual bool is_match_calosample(int /*calosample*/) const {return true;};
 
   // return number of energy parametrization bins
-  virtual int n_bins() {return 0;};
+  virtual int n_bins() const {return 0;};
 
 private:
 
   ClassDef(TFCSEnergyParametrization,1)  //TFCSEnergyParametrization
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSEnergyParametrization+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSExtrapolationState.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSExtrapolationState.h
index 7775c27c9aeee..6d3358508c5c2 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSExtrapolationState.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSExtrapolationState.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ISF_FASTCALOSIMEVENT_TFCSExtrapolationState_h
@@ -89,7 +89,7 @@ class TFCSExtrapolationState:public TObject {
   ClassDef(TFCSExtrapolationState,1)  //TFCSExtrapolationState
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSExtrapolationState+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrization.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrization.h
index 236b90b7da580..4ef111a634a9e 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrization.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrization.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TFCSHistoLateralShapeParametrization_h
@@ -13,15 +13,16 @@
 
 class TFCSHistoLateralShapeParametrization:public TFCSLateralShapeParametrizationHitBase {
 public:
-  TFCSHistoLateralShapeParametrization(const char* name=0, const char* title=0);
+  TFCSHistoLateralShapeParametrization(const char* name=nullptr, const char* title=nullptr);
+  ~TFCSHistoLateralShapeParametrization();
 
   int get_number_of_hits(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) const;
-  // simulated one hit position with weight that should be put into simulstate
-  // sometime later all hit weights should be resacled such that their final sum is simulstate->E(sample)
-  // someone also needs to map all hits into cells
-  virtual void simulate_hit(t_hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
+  /// simulated one hit position with weight that should be put into simulstate
+  /// sometime later all hit weights should be resacled such that their final sum is simulstate->E(sample)
+  /// someone also needs to map all hits into cells
+  virtual void simulate_hit(Hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
 
-  // Init and fill sigma
+  /// Init from histogram
   bool Initialize(TH2* hist);
   bool Initialize(const char* filepath, const char* histname);
 
@@ -31,12 +32,10 @@ private:
 
   TH2* m_hist;
 
-  TRandom3 *m_rnd;
-
   ClassDef(TFCSHistoLateralShapeParametrization,1)  //TFCSHistoLateralShapeParametrization
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSHistoLateralShapeParametrization+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHitCellMapping.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHitCellMapping.h
index bb65dbc067eb3..301d8d22c738b 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHitCellMapping.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHitCellMapping.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TFCSHitCellMapping_h
@@ -11,15 +11,13 @@ class ICaloGeometry;
 
 class TFCSHitCellMapping:public TFCSLateralShapeParametrizationHitBase {
 public:
-  TFCSHitCellMapping(const char* name=0, const char* title=0, ICaloGeometry* geo=0);
+  TFCSHitCellMapping(const char* name=nullptr, const char* title=nullptr, ICaloGeometry* geo=nullptr);
   
   void set_geometry(ICaloGeometry* geo) {m_geo=geo;};
   ICaloGeometry* get_geometry() {return m_geo;};
 
-  // simulated one hit position with weight that should be put into simulstate
-  // sometime later all hit weights should be resacled such that their final sum is simulstate->E(sample)
-  // someone also needs to map all hits into cells
-  virtual void simulate_hit(t_hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
+  /// fills all hits into calorimeter cells
+  virtual void simulate_hit(Hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
 
   void Print(Option_t *option) const;
 
@@ -29,7 +27,7 @@ private:
   ClassDef(TFCSHitCellMapping,1)  //TFCSHitCellMapping
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSHitCellMapping+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHitCellMappingWiggleEMB.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHitCellMappingWiggleEMB.h
index 52d0c9cce7776..70e4d56c1ff03 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHitCellMappingWiggleEMB.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHitCellMappingWiggleEMB.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TFCSHitCellMappingWiggleEMB_h
@@ -9,12 +9,11 @@
 
 class TFCSHitCellMappingWiggleEMB:public TFCSHitCellMapping {
 public:
-  TFCSHitCellMappingWiggleEMB(const char* name=0, const char* title=0, ICaloGeometry* geo=0);
+  TFCSHitCellMappingWiggleEMB(const char* name=nullptr, const char* title=nullptr, ICaloGeometry* geo=nullptr);
 
-  // simulated one hit position with weight that should be put into simulstate
-  // sometime later all hit weights should be resacled such that their final sum is simulstate->E(sample)
-  // someone also needs to map all hits into cells
-  virtual void simulate_hit(t_hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
+  /// modify one hit position to emulate the LAr accordeon shape
+  /// and then fills all hits into calorimeter cells
+  virtual void simulate_hit(Hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
 private:
   //** Array for the hit-to-cell assignment accordion structure fix (wiggle)  **//
   //** To be moved to the conditions database at some point **//
@@ -27,7 +26,7 @@ private:
   ClassDef(TFCSHitCellMappingWiggleEMB,1)  //TFCSHitCellMappingWiggleEMB
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSHitCellMappingWiggleEMB+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrization.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrization.h
index f5f0c16b8ae00..86be81f47bf52 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrization.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrization.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TFCSLateralShapeParametrization_h
@@ -9,7 +9,7 @@
 
 class TFCSLateralShapeParametrization:public TFCSParametrization {
 public:
-  TFCSLateralShapeParametrization(const char* name=0, const char* title=0);
+  TFCSLateralShapeParametrization(const char* name=nullptr, const char* title=nullptr);
 
   bool is_match_Ekin_bin(int Ekin_bin) const {return Ekin_bin==m_Ekin_bin;};
   bool is_match_calosample(int calosample) const {return calosample==m_calosample;};
@@ -20,11 +20,6 @@ public:
   int calosample() const {return m_calosample;};
   void set_calosample(int cs);
 
-  // simulated one hit position with weight that should be put into simulstate
-  // sometime later all hit weights should be resacled such that their final sum is simulstate->E(sample)
-  // someone also needs to map all hits into cells
-  virtual void simulate(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
-
   void Print(Option_t *option = "") const;
 private:
   int m_Ekin_bin;
@@ -33,7 +28,7 @@ private:
   ClassDef(TFCSLateralShapeParametrization,1)  //TFCSLateralShapeParametrization
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSLateralShapeParametrization+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitBase.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitBase.h
index 48a752fd2a41d..0c37c2cfdc7ed 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitBase.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitBase.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TFCSLateralShapeParametrizationHitBase_h
@@ -11,7 +11,7 @@ class CaloGeometry;
 
 class TFCSLateralShapeParametrizationHitBase:public TFCSParametrization {
 public:
-  TFCSLateralShapeParametrizationHitBase(const char* name=0, const char* title=0);
+  TFCSLateralShapeParametrizationHitBase(const char* name=nullptr, const char* title=nullptr);
 
   bool is_match_Ekin_bin(int Ekin_bin) const {return Ekin_bin==m_Ekin_bin;};
   bool is_match_calosample(int calosample) const {return calosample==m_calosample;};
@@ -22,14 +22,14 @@ public:
   int calosample() const {return m_calosample;};
   void set_calosample(int cs);
 
-  // Call get_number_of_hits() only once per shower simulation, as it could be build with random numbers and give different results each time
+  /// Call get_number_of_hits() only once per shower simulation, as it could be build with random numbers and give different results each time
   virtual int get_number_of_hits(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) const;
 
-  class t_hit
+  class Hit
   {
     public:
-    t_hit():m_eta(0),m_phi(0),m_E(0) {}; // for hits with the same energy, m_E should normalized to E(layer)/nhit
-    t_hit(float eta, float phi, float E):m_eta(eta),m_phi(phi),m_E(E) {};
+    Hit():m_eta(0),m_phi(0),m_E(0) {}; // for hits with the same energy, m_E should normalized to E(layer)/nhit
+    Hit(float eta, float phi, float E):m_eta(eta),m_phi(phi),m_E(E) {};
 
     float& eta() {return m_eta;};
     float& phi() {return m_phi;};
@@ -39,10 +39,10 @@ public:
     float m_eta,m_phi,m_E;
   };
 
-  // simulated one hit position with some energy. As last step in TFCSLateralShapeParametrizationHitChain::simulate, 
-  // the hit should be mapped into a cell and this cell recorded in simulstate. 
-  // All hits/cells should be resacled such that their final sum is simulstate->E(sample)
-  virtual void simulate_hit(t_hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
+  /// simulated one hit position with some energy. As last step in TFCSLateralShapeParametrizationHitChain::simulate, 
+  /// the hit should be mapped into a cell and this cell recorded in simulstate. 
+  /// All hits/cells should be resacled such that their final sum is simulstate->E(sample)
+  virtual void simulate_hit(Hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
 
   void Print(Option_t *option = "") const;
 private:
@@ -52,7 +52,7 @@ private:
   ClassDef(TFCSLateralShapeParametrizationHitBase,1)  //TFCSLateralShapeParametrizationHitBase
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSLateralShapeParametrizationHitBase+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitChain.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitChain.h
index bbbf547e23fbb..99e5a059e4f08 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitChain.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitChain.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TFCSLateralShapeParametrizationHitChain_h
@@ -11,32 +11,32 @@
 
 class TFCSLateralShapeParametrizationHitChain:public TFCSLateralShapeParametrization {
 public:
-  TFCSLateralShapeParametrizationHitChain(const char* name=0, const char* title=0);
+  TFCSLateralShapeParametrizationHitChain(const char* name=nullptr, const char* title=nullptr);
   TFCSLateralShapeParametrizationHitChain(TFCSLateralShapeParametrizationHitBase* hitsim);
 
   virtual void simulate(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
 
   virtual void set_geometry(ICaloGeometry* geo);
   
-  typedef std::vector< TFCSLateralShapeParametrizationHitBase* > t_chain;
-  t_chain::size_type size() {return m_chain.size();};
-  t_chain& chain() {return m_chain;};
-  t_chain::reference operator[](t_chain::size_type i) {return m_chain[i];};
-  t_chain::const_reference operator[](t_chain::size_type i) const {return m_chain[i];};
-  void push_back( const t_chain::value_type& value ) {m_chain.push_back(value);};
+  typedef std::vector< TFCSLateralShapeParametrizationHitBase* > Chain_t;
+  Chain_t::size_type size() const {return m_chain.size();};
+  const Chain_t& chain() const {return m_chain;};
+  Chain_t& chain() {return m_chain;};
+  void push_back( const Chain_t::value_type& value ) {m_chain.push_back(value);};
   
   virtual void set_number_of_hits_simul(TFCSLateralShapeParametrizationHitBase* sim) {m_number_of_hits_simul=sim;};
   
+  /// Call get_number_of_hits() only once, as it could contain a random number
   virtual int get_number_of_hits(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) const;
 
   void Print(Option_t *option = "") const;
 private:
-  t_chain m_chain;
+  Chain_t m_chain;
   TFCSLateralShapeParametrizationHitBase* m_number_of_hits_simul;
   ClassDef(TFCSLateralShapeParametrizationHitChain,1)  //TFCSLateralShapeParametrizationHitChain
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSLateralShapeParametrizationHitChain+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitNumberFromE.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitNumberFromE.h
index 69a76948a9d8f..1a43b16085753 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitNumberFromE.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitNumberFromE.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TFCSLateralShapeParametrizationHitNumberFromE_h
@@ -13,7 +13,19 @@
 
 class TFCSLateralShapeParametrizationHitNumberFromE:public TFCSLateralShapeParametrizationHitBase {
 public:
-  TFCSLateralShapeParametrizationHitNumberFromE(const char* name=0, const char* title=0,double stochastic=0.1,double constant=0);
+  /// LAr: 10.1%/sqrt(E)
+  ///    stochastic=0.101;
+  ///    constant=0.002;
+  /// HadEC: 21.4%/sqrt(E)
+  ///    stochastic=0.214;
+  ///    constant=0.0;
+  /// TileCal: 56.4%/sqrt(E)
+  ///    stochastic=0.564;
+  ///    constant=0.055;
+  /// FCAL:    28.5%/sqrt(E)
+  ///    stochastic=0.285;
+  ///    constant=0.035;
+  TFCSLateralShapeParametrizationHitNumberFromE(const char* name=nullptr, const char* title=nullptr,double stochastic=0.1,double constant=0);
 
   int get_number_of_hits(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) const;
 
@@ -26,7 +38,7 @@ private:
   ClassDef(TFCSLateralShapeParametrizationHitNumberFromE,1)  //TFCSLateralShapeParametrizationHitNumberFromE
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSLateralShapeParametrizationHitNumberFromE+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSPCAEnergyParametrization.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSPCAEnergyParametrization.h
index 13e0f42bd0661..99ae7c731f8df 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSPCAEnergyParametrization.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSPCAEnergyParametrization.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ISF_FASTCALOSIMEVENT_TFCSPCAEnergyParametrization_h
@@ -7,8 +7,8 @@
 
 
 #include "ISF_FastCaloSimEvent/TFCSEnergyParametrization.h"
-#include "ISF_FastCaloSimEvent/IntArray.h"
 #include "ISF_FastCaloSimEvent/TFCS1DFunction.h"
+#include "ISF_FastCaloSimEvent/IntArray.h"
 #include "TMatrixF.h"
 #include "TMatrixDSym.h"
 #include "TVectorF.h"
@@ -17,21 +17,25 @@
 class TFCSPCAEnergyParametrization:public TFCSEnergyParametrization
 {
  public:
-  TFCSPCAEnergyParametrization(const char* name=0, const char* title=0);
+  TFCSPCAEnergyParametrization(const char* name=nullptr, const char* title=nullptr);
 
   virtual void simulate(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
   
-  int n_pcabins()        { return m_numberpcabins; };
-  virtual int n_bins() {return m_numberpcabins;};
-  IntArray* get_layers() { return m_RelevantLayers; };
+  int n_pcabins() const { return m_numberpcabins; };
+  virtual int n_bins() const {return m_numberpcabins;};
+  const std::vector<int>& get_layers() const { return m_RelevantLayers; };
+
+  virtual bool is_match_Ekin_bin(int Ekin_bin) const;
+  virtual bool is_match_calosample(int calosample) const;
   
   void P2X(TVectorD*, TVectorD* , TMatrixD* , int, double* , double* , int);
   void loadInputs(TFile* file);
   void loadInputs(TFile* file,std::string);
   
+  void Print(Option_t *option = "") const;
  private:
   
-  IntArray* m_RelevantLayers;
+  std::vector<int>          m_RelevantLayers;
 
   std::vector<TMatrixDSym*> m_symCov;
   std::vector<TVectorD*>    m_MeanValues;
@@ -47,7 +51,7 @@ class TFCSPCAEnergyParametrization:public TFCSEnergyParametrization
  
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSPCAEnergyParametrization+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSParametrization.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSParametrization.h
index fb67af5bfc4f6..44b62a39180b7 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSParametrization.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSParametrization.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ISF_FASTCALOSIMEVENT_TFCSParametrization_h
@@ -9,7 +9,7 @@
 
 class TFCSParametrization:public ::TFCSParametrizationBase {
 public:
-  TFCSParametrization(const char* name=0, const char* title=0);
+  TFCSParametrization(const char* name=nullptr, const char* title=nullptr);
   void clear();
 
   virtual bool is_match_pdgid(int id) const {return m_pdgid.find(id)!=m_pdgid.end();};
@@ -44,7 +44,7 @@ private:
   ClassDef(TFCSParametrization,1)  //TFCSParametrization
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSParametrization+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSParametrizationBase.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSParametrizationBase.h
index 7b44e71a156a2..afb8d7106c4e3 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSParametrizationBase.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSParametrizationBase.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ISF_FASTCALOSIMEVENT_TFCSParametrizationBase_h
@@ -13,9 +13,58 @@ class TFCSSimulationState;
 class TFCSTruthState;
 class TFCSExtrapolationState;
 
+// Define Athena like message macro's such that they work stand alone and inside athena
+#if defined(__FastCaloSimStandAlone__)
+  #include <iostream>
+  #include <iomanip>
+  typedef std::ostream MsgStream;
+  #define endmsg std::endl
+  
+  namespace MSG {
+    enum Level {
+      NIL = 0,
+      VERBOSE,
+      DEBUG,
+      INFO,
+      WARNING,
+      ERROR,
+      FATAL,
+      ALWAYS,
+      NUM_LEVELS
+    }; // enum Level
+    const char* LevelNames[NUM_LEVELS]={"NIL","VERBOSE","DEBUG","INFO","WARNING","ERROR","FATAL","ALWAYS"};
+  }  // end namespace MSG  
+  // Needs a check despite the name, as stand alone mode is not using MsgStream, but just cout internally
+  #define ATH_MSG_LVL_NOCHK(lvl, x)               \
+    do {                                          \
+      if(this->msgLvl(lvl)) this->msg(lvl)<<setw(45)<<std::left<<this->GetName()<<" "<<MSG::LevelNames[lvl]<<" "<< x << endmsg; \
+    } while (0)
+
+  #define ATH_MSG_LVL(lvl, x)                     \
+    do {                                          \
+      if (this->msgLvl(lvl)) ATH_MSG_LVL_NOCHK(lvl, x);                \
+    } while (0)
+
+  #define ATH_MSG_VERBOSE(x) ATH_MSG_LVL(MSG::VERBOSE, x)
+  #define ATH_MSG_DEBUG(x)   ATH_MSG_LVL(MSG::DEBUG, x)
+  // note that we are using the _NOCHK variant here
+  #define ATH_MSG_INFO(x)    ATH_MSG_LVL_NOCHK(MSG::INFO, x)
+  #define ATH_MSG_WARNING(x) ATH_MSG_LVL_NOCHK(MSG::WARNING, x)
+  #define ATH_MSG_ERROR(x)   ATH_MSG_LVL_NOCHK(MSG::ERROR,  x)
+  #define ATH_MSG_FATAL(x)   ATH_MSG_LVL_NOCHK(MSG::FATAL,  x)
+
+  // can be used like so: ATH_MSG(INFO) << "hello" << endmsg;
+  #define ATH_MSG(lvl) \
+    if (this->msgLvl(MSG::lvl)) this->msg(MSG::lvl)<<setw(45)<<std::left<<this->GetName()<<" "<<MSG::LevelNames[MSG::lvl]<<" " 
+
+#else
+  #include "AthenaKernel/MsgStreamMember.h"
+  #include "AthenaBaseComps/AthMsgStreamMacros.h"
+#endif
+
 class TFCSParametrizationBase:public TNamed {
 public:
-  TFCSParametrizationBase(const char* name=0, const char* title=0);
+  TFCSParametrizationBase(const char* name=nullptr, const char* title=nullptr);
 
   virtual bool is_match_pdgid(int /*id*/) const {return false;};
   virtual bool is_match_Ekin(float /*Ekin*/) const {return false;};
@@ -40,13 +89,51 @@ public:
   virtual void simulate(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
 
   void Print(Option_t *option = "") const;
+  
+#if defined(__FastCaloSimStandAlone__)
+public:
+  /// Update outputlevel
+  void setLevel(int level) {
+    level = (level >= MSG::NUM_LEVELS) ?
+      MSG::ALWAYS : (level<MSG::NIL) ? MSG::NIL : level;
+    m_level = MSG::Level(level);
+  }
+  /// Retrieve output level
+  MSG::Level level() const {return m_level;}
+
+  /// Log a message using cout; a check of MSG::Level lvl is not possible!
+  MsgStream& msg() const {return *m_msg;}
+  MsgStream& msg( const MSG::Level lvl ) const {return *m_msg;}  
+  /// Check whether the logging system is active at the provided verbosity level
+  bool msgLvl( const MSG::Level lvl ) const {return m_level<=lvl;}
+private:
+  MSG::Level m_level;//! Do not persistify!
+  
+  MsgStream* m_msg;//! Do not persistify!
+#else
+public:
+  /// Update outputlevel
+  void setLevel(int level) {s_msg->get().setLevel(level);}
+  /// Retrieve output level
+  MSG::Level level() const {return s_msg->get().level();}
+  /// Log a message using the Athena controlled logging system
+  MsgStream& msg() const { return s_msg->get(); }
+  MsgStream& msg( MSG::Level lvl ) const { return *s_msg << lvl; }
+  /// Check whether the logging system is active at the provided verbosity level
+  bool msgLvl( MSG::Level lvl ) const { return s_msg->get().level() <= lvl; }
+  
+private:
+  /// Static private message stream member. We don't want this to take memory for every instance of this object created
+  static Athena::MsgStreamMember* s_msg;//! Do not persistify!
+#endif  
+  
 private:
   static std::set< int > m_no_pdgid;
 
   ClassDef(TFCSParametrizationBase,1)  //TFCSParametrizationBase
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSParametrizationBase+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSParametrizationChain.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSParametrizationChain.h
index 3e1f9cf0eebd5..9f3be0dcb7a73 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSParametrizationChain.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSParametrizationChain.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ISF_FASTCALOSIMEVENT_TFCSParametrizationChain_h
@@ -9,11 +9,14 @@
 
 class TFCSParametrizationChain:public TFCSParametrization {
 public:
-  TFCSParametrizationChain(const char* name=0, const char* title=0):TFCSParametrization(name,title) {};
+  TFCSParametrizationChain(const char* name=nullptr, const char* title=nullptr):TFCSParametrization(name,title) {};
   TFCSParametrizationChain(const TFCSParametrizationChain& ref):TFCSParametrization(ref.GetName(),ref.GetTitle()),m_chain(ref.chain()) {};
 
-  const std::vector< TFCSParametrizationBase* >& chain() const {return m_chain;};
-  void push_back(TFCSParametrizationBase* param) {m_chain.push_back(param);recalc();};
+  typedef std::vector< TFCSParametrizationBase* > Chain_t;
+  Chain_t::size_type size() const {return m_chain.size();};
+  const Chain_t& chain() const {return m_chain;};
+  Chain_t& chain() {return m_chain;};
+  void push_back(const Chain_t::value_type& param) {m_chain.push_back(param);recalc();};
 
   virtual void set_geometry(ICaloGeometry* geo);
   
@@ -24,14 +27,14 @@ public:
 
   void Print(Option_t *option = "") const;
 private:
-  std::vector< TFCSParametrizationBase* > m_chain;
+  Chain_t m_chain;
   
   void recalc();
 
   ClassDef(TFCSParametrizationChain,1)  //TFCSParametrizationChain
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSParametrizationChain+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSSimulationState.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSSimulationState.h
index c1a7ac93fe301..2aabffd5d981d 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSSimulationState.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSSimulationState.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ISF_FASTCALOSIMEVENT_TFCSSimulationState_h
@@ -29,10 +29,10 @@ class TFCSSimulationState:public TObject
     void set_E(double E) { m_Etot=E; } ;
     void add_E(int sample,double Esample) { m_E[sample]+=Esample;m_Etot+=Esample; };
 
-    typedef std::map<const CaloDetDescrElement*,float> t_cellmap;
+    typedef std::map<const CaloDetDescrElement*,float> Cellmap_t;
 
-    t_cellmap& cells() {return m_cells;};
-    const t_cellmap& cells() const {return m_cells;};
+    Cellmap_t& cells() {return m_cells;};
+    const Cellmap_t& cells() const {return m_cells;};
     void deposit(const CaloDetDescrElement* cellele, float E);
     
     void Print(Option_t *option="") const;
@@ -45,12 +45,12 @@ class TFCSSimulationState:public TObject
     double m_E[CaloCell_ID_FCS::MaxSample];
     double m_Efrac[CaloCell_ID_FCS::MaxSample];
     
-    t_cellmap m_cells;
+    Cellmap_t m_cells;
     
   ClassDef(TFCSSimulationState,1)  //TFCSSimulationState
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSSimulationState+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSTruthState.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSTruthState.h
index 66ff2f5f6dedb..eab5baa999d96 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSTruthState.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSTruthState.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ISF_FASTCALOSIMEVENT_TFCSTruthState_h
@@ -28,7 +28,7 @@ class TFCSTruthState:public TLorentzVector {
   ClassDef(TFCSTruthState,1)  //TFCSTruthState
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSTruthState+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/DoubleArray.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/DoubleArray.cxx
index 1453da730cfd8..52081fd0f7c18 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/DoubleArray.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/DoubleArray.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimEvent/DoubleArray.h"
@@ -12,18 +12,13 @@
 
 DoubleArray::DoubleArray(int n):TArrayD(n)
 {
-//  m_array=new TArrayD(n);
 }
 
 DoubleArray::DoubleArray()
 {
-//  m_array=new TArrayD();
 }
 
 DoubleArray::~DoubleArray()
 {
-//   if( m_array ) {
-//      delete m_array;
-//   }
 }
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/IntArray.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/IntArray.cxx
index 2caabec135929..503c77ee3565e 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/IntArray.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/IntArray.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimEvent/IntArray.h"
@@ -12,18 +12,13 @@
 
 IntArray::IntArray(int n):TArrayI(n)
 {
-//  m_array=new TArrayI(n);
 }
 
 IntArray::IntArray()
 {
-//  m_array=new TArrayI();
 }
 
 IntArray::~IntArray() 
 {
-//   if( m_array ) {
-//      delete m_array;
-//   }
 }
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCS1DFunctionHistogram.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCS1DFunctionHistogram.cxx
index 993dc4a4cdcb5..f4d4f2c78a97b 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCS1DFunctionHistogram.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCS1DFunctionHistogram.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 using namespace std;
@@ -18,28 +18,7 @@ TFCS1DFunctionHistogram::TFCS1DFunctionHistogram(TH1* hist, int verbose, double
 
 void TFCS1DFunctionHistogram::Initialize(TH1* hist, int verbose,double cut_maxdev)
 {
-
   smart_rebin_loop(hist, verbose,cut_maxdev);
-
-  //test the sampling
-  /*
-     TH1D* h_test=new TH1D("h_test","h_test",5000,m_histo->GetXaxis()->GetXmin(),m_histo->GetXaxis()->GetXmax());
-     for(int i=0;i<10000;i++)
-     {
-     double random=myRandom->Uniform(1);
-     double *histoVals=histo_to_array();
-     double value=sample_from_histo(random,histoVals);
-     h_test->Fill(value);
-     }
-     TH1* h_cum=get_cumul(h_test);
-     TFile* testfile=new TFile("samplingtest.root","RECREATE");
-     testfile->Add(h_test);
-     testfile->Add(h_cum);
-     testfile->Add(m_histo);
-     testfile->Write();
-     */
-
-
 }
 
 double* TFCS1DFunctionHistogram::histo_to_array(TH1* hist)
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyParametrization.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyParametrization.cxx
index ff94bade48a21..e83d9cfcb45fa 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyParametrization.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyParametrization.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimEvent/TFCSEnergyParametrization.h"
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrization.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrization.cxx
index a74da9c870ce7..903c219873b66 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrization.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrization.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrization.h"
@@ -10,16 +10,19 @@
 #include "TFile.h"
 #include "TMath.h"
 
-#include <iostream>
-
 //=============================================
 //======= TFCSHistoLateralShapeParametrization =========
 //=============================================
 
 TFCSHistoLateralShapeParametrization::TFCSHistoLateralShapeParametrization(const char* name, const char* title) :
   TFCSLateralShapeParametrizationHitBase(name,title),
-  m_hist(0),m_rnd(0)
+  m_hist(0)
+{
+}
+
+TFCSHistoLateralShapeParametrization::~TFCSHistoLateralShapeParametrization()
 {
+  if(m_hist) delete m_hist;
 }
 
 int TFCSHistoLateralShapeParametrization::get_number_of_hits(TFCSSimulationState& /*simulstate*/,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* /*extrapol*/) const
@@ -27,32 +30,28 @@ int TFCSHistoLateralShapeParametrization::get_number_of_hits(TFCSSimulationState
   return gRandom->Poisson(m_hist->Integral());
 }
 
-void TFCSHistoLateralShapeParametrization::simulate_hit(t_hit& hit,TFCSSimulationState& /*simulstate*/,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* extrapol)
+void TFCSHistoLateralShapeParametrization::simulate_hit(Hit& hit,TFCSSimulationState& /*simulstate*/,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* extrapol)
 {
-  int cs=calosample();
-  double center_eta=0.5*( extrapol->eta(cs, CaloSubPos::SUBPOS_ENT) + extrapol->eta(cs, CaloSubPos::SUBPOS_EXT) );
-  double center_phi=0.5*( extrapol->phi(cs, CaloSubPos::SUBPOS_ENT) + extrapol->phi(cs, CaloSubPos::SUBPOS_EXT) );
-  double center_r=0.5*( extrapol->r(cs, CaloSubPos::SUBPOS_ENT) + extrapol->r(cs, CaloSubPos::SUBPOS_EXT) );
-  double center_z=0.5*( extrapol->z(cs, CaloSubPos::SUBPOS_ENT) + extrapol->z(cs, CaloSubPos::SUBPOS_EXT) );
-  hit.E()*=1;
+  const int cs=calosample();
+  const double center_eta=0.5*( extrapol->eta(cs, CaloSubPos::SUBPOS_ENT) + extrapol->eta(cs, CaloSubPos::SUBPOS_EXT) );
+  const double center_phi=0.5*( extrapol->phi(cs, CaloSubPos::SUBPOS_ENT) + extrapol->phi(cs, CaloSubPos::SUBPOS_EXT) );
+  const double center_r=0.5*( extrapol->r(cs, CaloSubPos::SUBPOS_ENT) + extrapol->r(cs, CaloSubPos::SUBPOS_EXT) );
+  const double center_z=0.5*( extrapol->z(cs, CaloSubPos::SUBPOS_ENT) + extrapol->z(cs, CaloSubPos::SUBPOS_EXT) );
 
   double alpha, r;
   
   m_hist->GetRandom2(r,alpha);
-  double delta_eta_mm = r * cos(alpha);
-  double delta_phi_mm = r * sin(alpha);
+  const double delta_eta_mm = r * cos(alpha);
+  const double delta_phi_mm = r * sin(alpha);
+
+  const float dist000    = TMath::Sqrt(center_r * center_r + center_z * center_z);
+  const float eta_jakobi = TMath::Abs(2.0 * TMath::Exp(-center_eta) / (1.0 + TMath::Exp(-2 * center_eta)));
 
-  float dist000    = TMath::Sqrt(center_r * center_r + center_z * center_z);
-  float eta_jakobi = TMath::Abs(2.0 * TMath::Exp(-center_eta) / (1.0 + TMath::Exp(-2 * center_eta)));
-//	d_eta_mm = d_eta * eta_jakobi * dist000;
-//	d_phi_mm = d_phi * cell_r * phi_dist2r;
-  double delta_eta = delta_eta_mm / eta_jakobi / dist000;
-  double delta_phi = delta_phi_mm / center_r;
+  const double delta_eta = delta_eta_mm / eta_jakobi / dist000;
+  const double delta_phi = delta_phi_mm / center_r;
 
   hit.eta() = center_eta + delta_eta;
   hit.phi() = center_phi + delta_phi;
-  //simulstate.deposit_HIT(cs,hit_eta,hit_phi,hit_weight);
-  //std::cout<<"TFCSHistoLateralShapeParametrization::simulate_hit: E="<<hit.E()<<" cs="<<cs<<" eta="<<hit.eta()<<" phi="<<hit.phi()<<" r="<<r<<" alpha="<<alpha<<" delta_eta_mm="<<delta_eta_mm<<" delta_phi_mm="<<delta_phi_mm<<std::endl;
 }
 
 
@@ -63,7 +62,7 @@ bool TFCSHistoLateralShapeParametrization::Initialize(TH2* hist)
 	for(int ix=1;ix<=m_hist->GetNbinsX();++ix) {
   	for(int iy=1;iy<=m_hist->GetNbinsY();++iy) {
   	  if(m_hist->GetBinContent(ix,iy)<0) {
-        std::cout << "WARNING: Histo: "<<m_hist->GetName()<<" : "<<m_hist->GetTitle()<<" : bin("<<ix<<","<<iy<<")="<<m_hist->GetBinContent(ix,ix)<<" is negative. Fixing to 0!"<<std::endl;
+        ATH_MSG_WARNING("Histo: "<<m_hist->GetName()<<" : "<<m_hist->GetTitle()<<" : bin("<<ix<<","<<iy<<")="<<m_hist->GetBinContent(ix,ix)<<" is negative. Fixing to 0!");
   	    m_hist->SetBinContent(ix,iy,0);
   	  }
   	}
@@ -72,24 +71,19 @@ bool TFCSHistoLateralShapeParametrization::Initialize(TH2* hist)
   return true;
 }
 
-
 bool TFCSHistoLateralShapeParametrization::Initialize(const char* filepath, const char* histname)
 {
-    // Setup random numbers
-    m_rnd = new TRandom3();
-    m_rnd->SetSeed(0);
-
     // input file with histogram to fit
-    TFile *f = new TFile(filepath);
-    if (f == NULL) return false;
+    std::unique_ptr<TFile> inputfile(TFile::Open( filepath, "READ" ));
+    if (inputfile == NULL) return false;
 
     // histogram with hit pattern
-    TH2 *inputShape = (TH2*)f->Get(histname);
+    TH2 *inputShape = (TH2*)inputfile->Get(histname);
     if (inputShape == NULL) return false;
 
     bool OK=Initialize(inputShape);
 
-    f->Close();
+    inputfile->Close();
 
     return OK;
 }
@@ -100,11 +94,5 @@ void TFCSHistoLateralShapeParametrization::Print(Option_t *option) const
   if(!opt.IsWhitespace()) opt="";
   TFCSLateralShapeParametrizationHitBase::Print(option);
 
-  std::cout << opt <<"  Histo: "<<m_hist->GetName()<<" : "<<m_hist->GetTitle()<<" ptr="<<m_hist<<std::endl;
+  ATH_MSG_INFO(opt <<"  Histo: "<<m_hist->GetName()<<" : "<<m_hist->GetTitle()<<" ptr="<<m_hist);
 }
-
-//=============================================
-//========== ROOT persistency stuff ===========
-//=============================================
-
-ClassImp(TFCSHistoLateralShapeParametrization)
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHitCellMapping.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHitCellMapping.cxx
index 71b74fdaf80c8..316e0390f6208 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHitCellMapping.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHitCellMapping.cxx
@@ -1,11 +1,10 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimEvent/TFCSHitCellMapping.h"
 #include "ISF_FastCaloSimEvent/ICaloGeometry.h"
 #include "ISF_FastCaloSimEvent/TFCSSimulationState.h"
-#include <iostream>
 
 //=============================================
 //======= TFCSHitCellMapping =========
@@ -17,14 +16,14 @@ TFCSHitCellMapping::TFCSHitCellMapping(const char* name, const char* title, ICal
 {
 }
 
-void TFCSHitCellMapping::simulate_hit(t_hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* /*extrapol*/)
+void TFCSHitCellMapping::simulate_hit(Hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* /*extrapol*/)
 {
   int cs=calosample();
   const CaloDetDescrElement* cellele=m_geo->getDDE(cs,hit.eta(),hit.phi());
   if(cellele) {
     simulstate.deposit(cellele,hit.E());
   } else {
-    std::cout<<"WARNING: TFCSLateralShapeParametrizationHitCellMapping::simulate_hit: cellele="<<cellele<<" E="<<hit.E()<<" cs="<<cs<<" eta="<<hit.eta()<<" phi="<<hit.phi()<<std::endl;
+    ATH_MSG_ERROR("TFCSLateralShapeParametrizationHitCellMapping::simulate_hit: cellele="<<cellele<<" E="<<hit.E()<<" cs="<<cs<<" eta="<<hit.eta()<<" phi="<<hit.phi());
   }
 }
 
@@ -34,11 +33,5 @@ void TFCSHitCellMapping::Print(Option_t *option) const
   if(!opt.IsWhitespace()) opt="";
   TFCSLateralShapeParametrizationHitBase::Print(option);
 
-  std::cout << opt <<"  geo="<<m_geo<<std::endl;
+  ATH_MSG_INFO(opt <<"  geo="<<m_geo);
 }
-
-//=============================================
-//========== ROOT persistency stuff ===========
-//=============================================
-
-ClassImp(TFCSHitCellMapping)
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHitCellMappingWiggleEMB.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHitCellMappingWiggleEMB.cxx
index 5b7e5f4810dc4..92fcdb3e7a79a 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHitCellMappingWiggleEMB.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHitCellMappingWiggleEMB.cxx
@@ -1,10 +1,9 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimEvent/TFCSHitCellMappingWiggleEMB.h"
 #include "ISF_FastCaloSimEvent/TFCSSimulationState.h"
-#include <iostream>
 #include "TRandom3.h"
 #include "TVector2.h"
 #include "TMath.h"
@@ -74,7 +73,7 @@ double TFCSHitCellMappingWiggleEMB::doWiggle()
  return wiggle;
 }
 
-void TFCSHitCellMappingWiggleEMB::simulate_hit(t_hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol)
+void TFCSHitCellMappingWiggleEMB::simulate_hit(Hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol)
 {
   int cs=calosample();
 
@@ -86,9 +85,3 @@ void TFCSHitCellMappingWiggleEMB::simulate_hit(t_hit& hit,TFCSSimulationState& s
   
   TFCSHitCellMapping::simulate_hit(hit,simulstate,truth,extrapol);
 }
-
-//=============================================
-//========== ROOT persistency stuff ===========
-//=============================================
-
-ClassImp(TFCSHitCellMappingWiggleEMB)
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrization.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrization.cxx
index 8bcab661964ec..6bf9af6aca4a4 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrization.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrization.cxx
@@ -1,10 +1,9 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimEvent/TFCSLateralShapeParametrization.h"
 #include "ISF_FastCaloSimEvent/FastCaloSim_CaloCell_ID.h"
-#include <iostream>
 
 //=============================================
 //======= TFCSLateralShapeParametrization =========
@@ -24,28 +23,11 @@ void TFCSLateralShapeParametrization::set_calosample(int cs)
   m_calosample=cs;
 }
 
-void TFCSLateralShapeParametrization::simulate(TFCSSimulationState& /*simulstate*/,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* /*extrapol*/)
-{
-//  int cs=calosample();
-//  double hit_eta=0.5*( extrapol->eta(cs, CaloSubPos::SUBPOS_ENT) + extrapol->eta(cs, CaloSubPos::SUBPOS_EXT) );
-//  double hit_phi=0.5*( extrapol->phi(cs, CaloSubPos::SUBPOS_ENT) + extrapol->phi(cs, CaloSubPos::SUBPOS_EXT) );
-//  double hit_weight=1;
-
-//  simulstate.deposit_HIT(cs,hit_eta,hit_phi,hit_weight);
-}
-
 void TFCSLateralShapeParametrization::Print(Option_t *option) const
 {
   TString opt(option);
   if(!opt.IsWhitespace()) opt="";
   TFCSParametrization::Print(option);
-  std::cout << opt <<"  Ekin_bin="<<Ekin_bin()<<std::endl;
-  std::cout << opt <<"  calosample="<<calosample()<<std::endl;
+  ATH_MSG_INFO(opt <<"  Ekin_bin="<<Ekin_bin());
+  ATH_MSG_INFO(opt <<"  calosample="<<calosample());
 }
-
-//=============================================
-//========== ROOT persistency stuff ===========
-//=============================================
-
-ClassImp(TFCSLateralShapeParametrization)
-
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrizationHitBase.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrizationHitBase.cxx
index acb8331d871ab..7807b113bddde 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrizationHitBase.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrizationHitBase.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitBase.h"
@@ -8,8 +8,6 @@
 #include "ISF_FastCaloSimEvent/TFCSSimulationState.h"
 #include "ISF_FastCaloSimEvent/TFCSExtrapolationState.h"
 
-#include <iostream>
-
 //=============================================
 //======= TFCSLateralShapeParametrization =========
 //=============================================
@@ -33,12 +31,11 @@ int TFCSLateralShapeParametrizationHitBase::get_number_of_hits(TFCSSimulationSta
   return -1;
 }
 
-void TFCSLateralShapeParametrizationHitBase::simulate_hit(t_hit& hit,TFCSSimulationState& /*simulstate*/,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* extrapol)
+void TFCSLateralShapeParametrizationHitBase::simulate_hit(Hit& hit,TFCSSimulationState& /*simulstate*/,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* extrapol)
 {
   int cs=calosample();
   hit.eta()=0.5*( extrapol->eta(cs, CaloSubPos::SUBPOS_ENT) + extrapol->eta(cs, CaloSubPos::SUBPOS_EXT) );
   hit.phi()=0.5*( extrapol->phi(cs, CaloSubPos::SUBPOS_ENT) + extrapol->phi(cs, CaloSubPos::SUBPOS_EXT) );
-  hit.E()*=1;
 }
 
 void TFCSLateralShapeParametrizationHitBase::Print(Option_t *option) const
@@ -47,13 +44,6 @@ void TFCSLateralShapeParametrizationHitBase::Print(Option_t *option) const
   if(!opt.IsWhitespace()) opt="";
   TFCSParametrization::Print(option);
 
-  std::cout << opt <<"  Ekin_bin="<<Ekin_bin()<<std::endl;
-  std::cout << opt <<"  calosample="<<calosample()<<std::endl;
+  ATH_MSG_INFO(opt <<"  Ekin_bin="<<Ekin_bin());
+  ATH_MSG_INFO(opt <<"  calosample="<<calosample());
 }
-
-//=============================================
-//========== ROOT persistency stuff ===========
-//=============================================
-
-ClassImp(TFCSLateralShapeParametrizationHitBase)
-
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrizationHitChain.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrizationHitChain.cxx
index 8a51be6a67bff..fb16c5681851c 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrizationHitChain.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrizationHitChain.cxx
@@ -1,10 +1,9 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitChain.h"
 #include "ISF_FastCaloSimEvent/FastCaloSim_CaloCell_ID.h"
-#include <iostream>
 
 #include "ISF_FastCaloSimEvent/TFCSSimulationState.h"
 
@@ -12,11 +11,11 @@
 //======= TFCSLateralShapeParametrization =========
 //=============================================
 
-TFCSLateralShapeParametrizationHitChain::TFCSLateralShapeParametrizationHitChain(const char* name, const char* title):TFCSLateralShapeParametrization(name,title),m_number_of_hits_simul(NULL)
+TFCSLateralShapeParametrizationHitChain::TFCSLateralShapeParametrizationHitChain(const char* name, const char* title):TFCSLateralShapeParametrization(name,title),m_number_of_hits_simul(nullptr)
 {
 }
 
-TFCSLateralShapeParametrizationHitChain::TFCSLateralShapeParametrizationHitChain(TFCSLateralShapeParametrizationHitBase* hitsim):TFCSLateralShapeParametrization(TString("hit_chain_")+hitsim->GetName(),TString("hit chain for ")+hitsim->GetTitle()),m_number_of_hits_simul(NULL)
+TFCSLateralShapeParametrizationHitChain::TFCSLateralShapeParametrizationHitChain(TFCSLateralShapeParametrizationHitBase* hitsim):TFCSLateralShapeParametrization(TString("hit_chain_")+hitsim->GetName(),TString("hit chain for ")+hitsim->GetTitle()),m_number_of_hits_simul(nullptr)
 {
   set_calosample(hitsim->calosample());
   
@@ -39,8 +38,6 @@ void TFCSLateralShapeParametrizationHitChain::set_geometry(ICaloGeometry* geo)
   for(TFCSLateralShapeParametrizationHitBase* hitsim : m_chain) hitsim->set_geometry(geo);
 }
 
-
-
 int TFCSLateralShapeParametrizationHitChain::get_number_of_hits(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) const
 {
   if(m_number_of_hits_simul) {
@@ -62,7 +59,7 @@ void TFCSLateralShapeParametrizationHitChain::simulate(TFCSSimulationState& simu
 
   float Ehit=simulstate.E(calosample())/nhit;
   for(int i=0;i<nhit;++i) {
-    TFCSLateralShapeParametrizationHitBase::t_hit hit; 
+    TFCSLateralShapeParametrizationHitBase::Hit hit; 
     hit.E()=Ehit;
     for(TFCSLateralShapeParametrizationHitBase* hitsim : m_chain) {
       //std::cout<<"  do "<<hitsim->ClassName()<<":"<<hitsim->GetName()<<" hit="<<i<<std::endl;
@@ -77,17 +74,11 @@ void TFCSLateralShapeParametrizationHitChain::Print(Option_t *option) const
   TString opt(option);
   if(!opt.IsWhitespace()) opt=option; else opt=opt+"  ";
   if(m_number_of_hits_simul) {
-    std::cout << opt <<"#hits";
+    ATH_MSG_INFO(opt <<"#hits simulation:");
     m_number_of_hits_simul->Print(opt);
   }
+  ATH_MSG_INFO(opt <<"Simulation chain:");
   for(TFCSLateralShapeParametrizationHitBase* hitsim : m_chain) {
     hitsim->Print(opt);
   } 
 }
-
-//=============================================
-//========== ROOT persistency stuff ===========
-//=============================================
-
-ClassImp(TFCSLateralShapeParametrizationHitChain)
-
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrizationHitNumberFromE.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrizationHitNumberFromE.cxx
index 0e8e23b9fdd81..8f7385502f9fa 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrizationHitNumberFromE.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSLateralShapeParametrizationHitNumberFromE.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitNumberFromE.h"
@@ -7,8 +7,6 @@
 
 #include "TMath.h"
 
-#include <iostream>
-
 //=============================================
 //======= TFCSHistoLateralShapeParametrization =========
 //=============================================
@@ -22,27 +20,6 @@ int TFCSLateralShapeParametrizationHitNumberFromE::get_number_of_hits(TFCSSimula
 {
   int cs=calosample();
   double energy=simulstate.E(cs);
-  /*
-  if(cs >= 0 && cs<= 7) {
-    stochastic=0.101;     //LAr      10.1%/sqrt(E)
-    constant=0.002;
-  }
-
-  if(cs >= 8 && cs <= 11) {
-    stochastic=0.214;     //HadEC 21.4%/sqrt(E)
-    constant=0.0;
-  }
-
-  if(cs >= 12 && cs <= 20) {
-    stochastic=0.564;     //TileCal 56.4%/sqrt(E)
-    constant=0.055;
-  }
-
-  if(cs >= 21 && cs <= 23) {
-    stochastic=0.285;     //FCAL    28.5%/sqrt(E)
-    constant=0.035;
-  }
-  */
 
   double sigma_stochastic=m_stochastic/sqrt(energy/1000.0);
   int hits = 1.0 / (sigma_stochastic*sigma_stochastic + m_constant*m_constant);
@@ -56,11 +33,5 @@ void TFCSLateralShapeParametrizationHitNumberFromE::Print(Option_t *option) cons
   if(!opt.IsWhitespace()) opt="";
   TFCSLateralShapeParametrizationHitBase::Print(option);
 
-  std::cout << opt <<"  stochastic="<<m_stochastic<<" constant="<<m_constant<<std::endl;
+  ATH_MSG_INFO(opt <<"  stochastic="<<m_stochastic<<" constant="<<m_constant);
 }
-
-//=============================================
-//========== ROOT persistency stuff ===========
-//=============================================
-
-ClassImp(TFCSLateralShapeParametrizationHitNumberFromE)
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSPCAEnergyParametrization.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSPCAEnergyParametrization.cxx
index 5ef293a98156d..aeea4844e6055 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSPCAEnergyParametrization.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSPCAEnergyParametrization.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimEvent/TFCSPCAEnergyParametrization.h"
@@ -9,7 +9,6 @@
 #include "ISF_FastCaloSimEvent/TFCSExtrapolationState.h"
 
 #include "TFile.h"
-#include <iostream>
 #include "TKey.h"
 #include "TClass.h"
 #include "TRandom3.h"
@@ -26,6 +25,35 @@ TFCSPCAEnergyParametrization::TFCSPCAEnergyParametrization(const char* name, con
   m_numberpcabins=1;
 }
 
+bool TFCSPCAEnergyParametrization::is_match_Ekin_bin(int Ekin_bin) const 
+{
+  if(Ekin_bin>=1 && Ekin_bin<=n_bins()) return true;
+  return false;
+}
+  
+bool TFCSPCAEnergyParametrization::is_match_calosample(int calosample) const 
+{
+  for(unsigned int i=0;i<m_RelevantLayers.size();i++) {
+    if(m_RelevantLayers[i]==calosample) return true;
+  }  
+  return false;
+}
+
+void TFCSPCAEnergyParametrization::Print(Option_t *option) const
+{
+  TString opt(option);
+  if(!opt.IsWhitespace()) opt="";
+  TFCSEnergyParametrization::Print(option);
+  
+  if(msgLvl(MSG::INFO)) {
+    ATH_MSG(INFO) << opt <<"  #bins="<<m_numberpcabins<<", layers=";
+    for(unsigned int i=0;i<m_RelevantLayers.size();i++) {
+      if(i>0) msg()<<", ";
+      msg()<<m_RelevantLayers[i];
+    }  
+    msg()<<endmsg;
+  }  
+}
 
 void TFCSPCAEnergyParametrization::simulate(TFCSSimulationState& simulstate,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* /*extrapol*/)
 {
@@ -49,8 +77,8 @@ void TFCSPCAEnergyParametrization::simulate(TFCSSimulationState& simulstate,cons
 
   std::vector<std::string> layer;
   std::vector<int> layerNr;
-  for(int i=0;i<m_RelevantLayers->GetSize();i++)
-    layerNr.push_back(m_RelevantLayers->GetAt(i));
+  for(unsigned int i=0;i<m_RelevantLayers.size();i++)
+    layerNr.push_back(m_RelevantLayers[i]);
   for(unsigned int i=0;i<layerNr.size();i++)
     {
       std::string thislayer=Form("layer%i",layerNr[i]);
@@ -159,8 +187,8 @@ void TFCSPCAEnergyParametrization::loadInputs(TFile* file, std::string folder)
 
   int trynext=1;
   TString x;
-  if(folder=="")x="bin";
-  else x="folder/bin";
+  if(folder=="") x="bin";
+   else x=folder+"/bin";
   while(trynext)
     {
       IntArray* test  =(IntArray*)file->Get(x+Form("%i/pca/RelevantLayers",m_numberpcabins));
@@ -175,8 +203,13 @@ void TFCSPCAEnergyParametrization::loadInputs(TFile* file, std::string folder)
   m_numberpcabins-=1;
 
   file->cd(x+"1/pca");
-  m_RelevantLayers=(IntArray*)gDirectory->Get("RelevantLayers");
-  if(m_RelevantLayers == NULL) std::cout << "TFCSPCAEnergyParametrization::m_RelevantLayers in first pcabin is null!" << std::endl;
+  IntArray* RelevantLayers=(IntArray*)gDirectory->Get("RelevantLayers");
+  if(RelevantLayers == NULL) {
+    ATH_MSG_ERROR("TFCSPCAEnergyParametrization::m_RelevantLayers in first pcabin is null!");
+  } else {
+    m_RelevantLayers.reserve(RelevantLayers->GetSize());
+    for(int i=0;i<RelevantLayers->GetSize();i++) m_RelevantLayers.push_back(RelevantLayers->GetAt(i));
+  }
 
   for(int bin=1;bin<=m_numberpcabins;bin++)
     {
@@ -190,12 +223,12 @@ void TFCSPCAEnergyParametrization::loadInputs(TFile* file, std::string folder)
       TVectorD* Gauss_rms     =(TVectorD*)gDirectory->Get("Gauss_rms");
       TVectorD* LowerBounds   =(TVectorD*)gDirectory->Get("LowerBounds");
 
-      if(symCov == NULL)         std::cout << "TFCSPCAEnergyParametrization::m_symCov in pcabin "<<bin<<" is null!" << std::endl;
-      if(MeanValues == NULL)     std::cout << "TFCSPCAEnergyParametrization::m_MeanValues in pcabin "<<bin<<" is null!" << std::endl;
-      if(SigmaValues == NULL)    std::cout << "TFCSPCAEnergyParametrization::m_SigmaValues in pcabin "<<bin<<" is null!" << std::endl;
-      if(Gauss_means == NULL)    std::cout << "TFCSPCAEnergyParametrization::m_Gauss_means in pcabin "<<bin<<" is null!" << std::endl;
-      if(Gauss_rms == NULL)      std::cout << "TFCSPCAEnergyParametrization::m_Gause_rms in pcabin "<<bin<<" is null!" << std::endl;
-      if(LowerBounds == NULL)    std::cout << "TFCSPCAEnergyParametrization::m_LowerBounds in pcabin "<<bin<<" is null!" << std::endl;
+      if(symCov == NULL)         ATH_MSG_WARNING("TFCSPCAEnergyParametrization::m_symCov in pcabin "<<bin<<" is null!");
+      if(MeanValues == NULL)     ATH_MSG_WARNING("TFCSPCAEnergyParametrization::m_MeanValues in pcabin "<<bin<<" is null!");
+      if(SigmaValues == NULL)    ATH_MSG_WARNING("TFCSPCAEnergyParametrization::m_SigmaValues in pcabin "<<bin<<" is null!");
+      if(Gauss_means == NULL)    ATH_MSG_WARNING("TFCSPCAEnergyParametrization::m_Gauss_means in pcabin "<<bin<<" is null!");
+      if(Gauss_rms == NULL)      ATH_MSG_WARNING("TFCSPCAEnergyParametrization::m_Gause_rms in pcabin "<<bin<<" is null!");
+      if(LowerBounds == NULL)    ATH_MSG_WARNING("TFCSPCAEnergyParametrization::m_LowerBounds in pcabin "<<bin<<" is null!");
 
       m_symCov.push_back(symCov);
       m_MeanValues.push_back(MeanValues);
@@ -207,8 +240,8 @@ void TFCSPCAEnergyParametrization::loadInputs(TFile* file, std::string folder)
       std::vector<std::string> layer;
       std::vector<int> layerNr;
 
-      for(int i=0;i<m_RelevantLayers->GetSize();i++)
-        layerNr.push_back(m_RelevantLayers->GetAt(i));
+      for(unsigned int i=0;i<m_RelevantLayers.size();i++)
+        layerNr.push_back(m_RelevantLayers[i]);
 
       for(unsigned int i=0;i<layerNr.size();i++)
         {
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrization.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrization.cxx
index 08443bd167187..0f004682d0a58 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrization.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrization.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimEvent/TFCSParametrization.h"
@@ -74,9 +74,3 @@ void TFCSParametrization::set_eta_max(double max)
 {
   m_eta_max=max;
 }
-
-//=============================================
-//========== ROOT persistency stuff ===========
-//=============================================
-
-//ClassImp(TFCSParametrization)
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrizationBase.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrizationBase.cxx
index e072aee091c66..365b96d19b9f2 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrizationBase.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrizationBase.cxx
@@ -1,9 +1,8 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimEvent/TFCSParametrizationBase.h"
-#include <iostream>
 #include "TClass.h"
 
 //=============================================
@@ -12,9 +11,21 @@
 
 std::set< int > TFCSParametrizationBase::m_no_pdgid;
 
+#ifndef __FastCaloSimStandAlone__
+//Initialize only in constructor to make sure the needed services are ready
+Athena::MsgStreamMember* TFCSParametrizationBase::s_msg(nullptr); 
+#endif
+
+#if defined(__FastCaloSimStandAlone__)
+TFCSParametrizationBase::TFCSParametrizationBase(const char* name, const char* title):TNamed(name,title),m_msg(&std::cout),m_level(MSG::INFO)
+{
+}
+#else
 TFCSParametrizationBase::TFCSParametrizationBase(const char* name, const char* title):TNamed(name,title)
 {
+  if(s_msg==nullptr) s_msg=new Athena::MsgStreamMember("FastCaloSimParametrization");
 }
+#endif
 
 void TFCSParametrizationBase::simulate(TFCSSimulationState& /*simulstate*/,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* /*extrapol*/)
 {
@@ -24,18 +35,18 @@ void TFCSParametrizationBase::Print(Option_t *option) const
 {
   TString opt(option);
   if(!opt.IsWhitespace()) opt="";
-  std::cout << opt<<"OBJ " << IsA()->GetName() << " : " << GetName() << " "<<'"'<< GetTitle() <<'"'<<" ("<<this<<")"<< std::endl;
-
-  std::cout << opt <<"  PDGID: ";
-  for (std::set<int>::iterator it=pdgid().begin(); it!=pdgid().end(); ++it) std::cout << *it << ", ";
-  std::cout << std::endl;
+  ATH_MSG_INFO(opt<<'"'<< GetTitle() <<'"'<<" ("<<IsA()->GetName()<<"*)"<<this);
   
-  std::cout << opt <<"  Ekin="<<Ekin_nominal()<<" MeV, range "<<Ekin_min()<<" MeV < Ekin < "<<Ekin_max()<<" MeV"<<std::endl;
-  std::cout << opt <<"  eta="<<eta_nominal()<<", range "<<eta_min()<<" < eta < "<<eta_max()<<std::endl;
+  if(msgLvl(MSG::INFO)) {
+    ATH_MSG(INFO) << opt <<"  PDGID: ";
+    for (std::set<int>::iterator it=pdgid().begin(); it!=pdgid().end(); ++it) {
+      if(it!=pdgid().begin()) msg() << ", ";
+      msg() << *it;
+    }  
+    msg() << endmsg;
+  }
+  
+  ATH_MSG_INFO(opt <<"  Ekin="<<Ekin_nominal()<<" MeV, range "<<Ekin_min()<<" MeV < Ekin < "<<Ekin_max()<<" MeV");
+  ATH_MSG_INFO(opt <<"  eta="<<eta_nominal()<<", range "<<eta_min()<<" < eta < "<<eta_max());
 }
 
-//=============================================
-//========== ROOT persistency stuff ===========
-//=============================================
-
-//ClassImp(TFCSParametrizationBase)
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrizationChain.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrizationChain.cxx
index d853ef1a2d68b..6f31be4023f93 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrizationChain.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrizationChain.cxx
@@ -1,9 +1,8 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimEvent/TFCSParametrizationChain.h"
-#include <iostream>
 #include <algorithm>
 #include <iterator>
 
@@ -73,9 +72,3 @@ void TFCSParametrizationChain::Print(Option_t *option) const
     param->Print(opt);
   }
 }
-
-//=============================================
-//========== ROOT persistency stuff ===========
-//=============================================
-
-//ClassImp(TFCSParametrizationChain)
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/TFCSNNLateralShapeParametrization.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/TFCSNNLateralShapeParametrization.h
index 8036a7a603738..172791c4b47a8 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/TFCSNNLateralShapeParametrization.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/TFCSNNLateralShapeParametrization.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TFCSNNLateralShapeParametrization_h
@@ -9,19 +9,19 @@
 
 class TFCSNNLateralShapeParametrization:public TFCSLateralShapeParametrizationHitBase {
 public:
-  TFCSNNLateralShapeParametrization(const char* name=0, const char* title=0);
+  TFCSNNLateralShapeParametrization(const char* name=nullptr, const char* title=nullptr);
 
   // simulated one hit position with weight that should be put into simulstate
   // sometime later all hit weights should be resacled such that their final sum is simulstate->E(sample)
   // someone also needs to map all hits into cells
-  virtual void simulate_hit(t_hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
+  virtual void simulate_hit(Hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
 private:
   // NN shape information should be stored as private member variables here
 
   ClassDef(TFCSNNLateralShapeParametrization,1)  //TFCSNNLateralShapeParametrization
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSNNLateralShapeParametrization+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/TFCSSimpleLateralShapeParametrization.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/TFCSSimpleLateralShapeParametrization.h
index 96232fec52e58..ba5e692006167 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/TFCSSimpleLateralShapeParametrization.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/TFCSSimpleLateralShapeParametrization.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TFCSSimpleLateralShapeParametrization_h
@@ -14,12 +14,13 @@
 
 class TFCSSimpleLateralShapeParametrization:public TFCSLateralShapeParametrizationHitBase {
 public:
-  TFCSSimpleLateralShapeParametrization(const char* name=0, const char* title=0);
+  TFCSSimpleLateralShapeParametrization(const char* name=nullptr, const char* title=nullptr);
+  ~TFCSSimpleLateralShapeParametrization();
 
   // simulated one hit position with weight that should be put into simulstate
   // sometime later all hit weights should be resacled such that their final sum is simulstate->E(sample)
   // someone also needs to map all hits into cells
-  virtual void simulate_hit(t_hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
+  virtual void simulate_hit(Hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol);
 
   // Init and fill sigma
   bool Initialize(const char* filepath, const char* histname);
@@ -47,7 +48,7 @@ private:
   ClassDef(TFCSSimpleLateralShapeParametrization,1)  //TFCSSimpleLateralShapeParametrization
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TFCSSimpleLateralShapeParametrization+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/TreeReader.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/TreeReader.h
index 7978be4aef204..e431af9dae7a6 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/TreeReader.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/TreeReader.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TreeReader_h
@@ -55,7 +55,7 @@ class TreeReader //: public TTreeFormulaManager
   
 };
 
-#if defined(__MAKECINT__) && defined(__FastCaloSimStandAlone__)
+#if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
 #pragma link C++ class TreeReader+;
 #endif
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/Root/TFCSNNLateralShapeParametrization.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/Root/TFCSNNLateralShapeParametrization.cxx
index da4ddd0707db9..eb3959990df0f 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/Root/TFCSNNLateralShapeParametrization.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/Root/TFCSNNLateralShapeParametrization.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimParametrization/TFCSNNLateralShapeParametrization.h"
@@ -14,19 +14,10 @@ TFCSNNLateralShapeParametrization::TFCSNNLateralShapeParametrization(const char*
 {
 }
 
-void TFCSNNLateralShapeParametrization::simulate_hit(t_hit& hit,TFCSSimulationState& /*simulstate*/,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* extrapol)
+void TFCSNNLateralShapeParametrization::simulate_hit(Hit& hit,TFCSSimulationState& /*simulstate*/,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* extrapol)
 {
   int cs=calosample();
   hit.eta()=0.5*( extrapol->eta(cs, CaloSubPos::SUBPOS_ENT) + extrapol->eta(cs, CaloSubPos::SUBPOS_EXT) );
   hit.phi()=0.5*( extrapol->phi(cs, CaloSubPos::SUBPOS_ENT) + extrapol->phi(cs, CaloSubPos::SUBPOS_EXT) );
-  hit.E()*=1;
-
-  //simulstate.deposit_HIT(cs,hit_eta,hit_phi,hit_weight);
 }
 
-//=============================================
-//========== ROOT persistency stuff ===========
-//=============================================
-
-ClassImp(TFCSNNLateralShapeParametrization)
-
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/Root/TFCSSimpleLateralShapeParametrization.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/Root/TFCSSimpleLateralShapeParametrization.cxx
index 2cfd9172e9afd..f3524186d16a8 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/Root/TFCSSimpleLateralShapeParametrization.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/Root/TFCSSimpleLateralShapeParametrization.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimParametrization/TFCSSimpleLateralShapeParametrization.h"
@@ -18,13 +18,15 @@ TFCSSimpleLateralShapeParametrization::TFCSSimpleLateralShapeParametrization(con
 {
     m_sigmaX = 0;
     m_sigmaY = 0;
+}
 
-    //sigma2_x = 0;
-    //sigma2_y = 0;
+TFCSSimpleLateralShapeParametrization::~TFCSSimpleLateralShapeParametrization()
+{
+  if(m_rnd) delete m_rnd;
 }
 
 
-void TFCSSimpleLateralShapeParametrization::simulate_hit(t_hit& hit,TFCSSimulationState& /*simulstate*/,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* extrapol)
+void TFCSSimpleLateralShapeParametrization::simulate_hit(Hit& hit,TFCSSimulationState& /*simulstate*/,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* extrapol)
 {
   int cs=calosample();
   hit.eta()=0.5*( extrapol->eta(cs, CaloSubPos::SUBPOS_ENT) + extrapol->eta(cs, CaloSubPos::SUBPOS_EXT) );
@@ -40,7 +42,6 @@ void TFCSSimpleLateralShapeParametrization::simulate_hit(t_hit& hit,TFCSSimulati
 
   hit.eta() += delta_eta;
   hit.phi() += delta_phi;
-  //simulstate.deposit_HIT(cs,hit_eta,hit_phi,hit_weight);
 }
 
 
@@ -72,14 +73,9 @@ bool TFCSSimpleLateralShapeParametrization::Initialize(const char* filepath, con
 
     // Function to fit with
     double hiEdge  = inputShape->GetYaxis()->GetBinLowEdge( inputShape->GetNbinsY() );
-    //TF1 *x_func = new TF1("dlbgx","gaus(0)+gaus(3)",-hiEdge,hiEdge);
-    //TF1 *y_func = new TF1("dlbgy","gaus(0)+gaus(3)",-hiEdge,hiEdge);
     TF1 *x_func = new TF1("fx","gaus",-hiEdge,hiEdge);
     TF1 *y_func = new TF1("fy","gaus",-hiEdge,hiEdge);
 
-    //test
-    //TFile *out = new TFile("out.root","recreate");
-
     // Project into x and y histograms
     TH1F *h_xrms = new TH1F("h_xrms","h_xrms",100,-hiEdge,hiEdge);
     TH1F *h_yrms = new TH1F("h_yrms","h_yrms",100,-hiEdge,hiEdge);
@@ -118,10 +114,6 @@ bool TFCSSimpleLateralShapeParametrization::Initialize(const char* filepath, con
     TF1 *fity = h_yrms->GetFunction("fy");
     // posibly center
 
-    //test
-    //out->Write();
-    //out->Close();
-
     // Finally set sigma
     m_sigmaX = fitx->GetParameter(2);
     m_sigmaY = fity->GetParameter(2);
@@ -147,8 +139,3 @@ void TFCSSimpleLateralShapeParametrization::getHitXY(double &x, double &y)
 
 }
 
-//=============================================
-//========== ROOT persistency stuff ===========
-//=============================================
-
-ClassImp(TFCSSimpleLateralShapeParametrization)
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/src/FastCaloSimSvcV2.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/src/FastCaloSimSvcV2.cxx
index c02960a062df1..798e37e9347c2 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/src/FastCaloSimSvcV2.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/src/FastCaloSimSvcV2.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -369,10 +369,10 @@ StatusCode ISF::FastCaloSimSvcV2::simulate(const ISF::ISFParticle& isfp)
  nCells=0;
  nCells_Tile=0;
  
- for ( ilayer = 0;  ilayer < m_layers->GetSize(); ilayer++)
+ for ( ilayer = 0;  ilayer < m_layers.size(); ilayer++)
  {  
   /** get the layer ID and associated energy */
-  layer =  m_layers->GetAt(ilayer);
+  layer =  m_layers[ilayer];
   layerE = simulstate.E(layer);
   
   // get eta and phi from extrapolator or isfp
@@ -625,7 +625,7 @@ void ISF::FastCaloSimSvcV2::TestCell()
  }
  
  double sum_epara=0.0;
- for(int a=0;a<=ilayer;a++) sum_epara+=simulstate.E(m_layers->GetAt(a));
+ for(unsigned int a=0;a<=ilayer;a++) sum_epara+=simulstate.E(m_layers[a]);
  
  ATH_MSG_DEBUG("ECHECK layer "<<layer<<" esum "<<esum<<" epara "<<sum_epara<<" (this layer: "<<simulstate.E(layer)<<") nCells "<<nCells<<" nCells_Tile "<<nCells_Tile);
 }
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/src/FastCaloSimSvcV2.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/src/FastCaloSimSvcV2.h
index 6266e5f45a95c..9f0a6ca09bf28 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/src/FastCaloSimSvcV2.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/src/FastCaloSimSvcV2.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 //////////////////////////////////////////////////////////////////
@@ -149,7 +149,7 @@ namespace ISF {
       double phi_isfp;
       double R;
       
-      IntArray *m_layers;
+      std::vector<int> m_layers;
       double r_layer;
       double z_particle;
       int layer;
@@ -164,7 +164,7 @@ namespace ISF {
       
       TFCSSimulationState simulstate;
       // iterator over layers
-      int ilayer;
+      unsigned int ilayer;
 
       //** Array for the hit-to-cell assignment accordion structure fix (wiggle)  **//
       //** To be moved to the conditions database at some point **// 
-- 
GitLab