From 64723e3d85728b5f6871260fe2274bbed39e73b2 Mon Sep 17 00:00:00 2001
From: Scott Snyder <scott.snyder@cern.ch>
Date: Fri, 8 Jun 2012 01:43:00 +0200
Subject: [PATCH] Fix checkreq warnings. (CaloTTDetDescr-00-01-08)

---
 .../CaloTTDetDescr/CaloTTDescrManager.h       | 147 ++++++++++++
 .../CaloTTDetDescr/CaloTTDescrRegion.h        | 221 ++++++++++++++++++
 .../CaloTTDetDescr/CaloTTDescriptor.h         | 185 +++++++++++++++
 Calorimeter/CaloTTDetDescr/cmt/requirements   |  16 ++
 Calorimeter/CaloTTDetDescr/doc/mainpage.h     |  16 ++
 .../CaloTTDetDescr/src/CaloTTDescrManager.cxx | 160 +++++++++++++
 .../CaloTTDetDescr/src/CaloTTDescrRegion.cxx  | 148 ++++++++++++
 .../CaloTTDetDescr/src/CaloTTDescriptor.cxx   | 105 +++++++++
 8 files changed, 998 insertions(+)
 create mode 100755 Calorimeter/CaloTTDetDescr/CaloTTDetDescr/CaloTTDescrManager.h
 create mode 100755 Calorimeter/CaloTTDetDescr/CaloTTDetDescr/CaloTTDescrRegion.h
 create mode 100755 Calorimeter/CaloTTDetDescr/CaloTTDetDescr/CaloTTDescriptor.h
 create mode 100755 Calorimeter/CaloTTDetDescr/cmt/requirements
 create mode 100644 Calorimeter/CaloTTDetDescr/doc/mainpage.h
 create mode 100755 Calorimeter/CaloTTDetDescr/src/CaloTTDescrManager.cxx
 create mode 100755 Calorimeter/CaloTTDetDescr/src/CaloTTDescrRegion.cxx
 create mode 100755 Calorimeter/CaloTTDetDescr/src/CaloTTDescriptor.cxx

diff --git a/Calorimeter/CaloTTDetDescr/CaloTTDetDescr/CaloTTDescrManager.h b/Calorimeter/CaloTTDetDescr/CaloTTDetDescr/CaloTTDescrManager.h
new file mode 100755
index 000000000000..434cbb30af51
--- /dev/null
+++ b/Calorimeter/CaloTTDetDescr/CaloTTDetDescr/CaloTTDescrManager.h
@@ -0,0 +1,147 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/***************************************************************************
+ Calorimeter LVL1 TT description package
+ -----------------------------------------
+ ***************************************************************************/
+
+//<doc><file>	$Id: CaloTTDescrManager.h,v 1.9 2007-06-19 12:58:56 fledroit Exp $
+//<version>	$Name: not supported by cvs2svn $
+
+#ifndef CALODETDESCR_CALOTTDESCRMANAGER_H
+#define CALODETDESCR_CALOTTDESCRMANAGER_H
+
+#include "Identifier/Identifier.h"
+#include "CLIDSvc/CLASS_DEF.h"
+#include <vector>
+#include <map>
+
+// Forward declarations
+class CaloTTDescrRegion;
+class CaloTTDescriptor;
+class CaloLVL1_ID;
+
+/**
+*  @brief This class is used to build the CaloTTDescriptors and CaloTTDetDescrRegions
+*  carrying the geometry information of the Calorimeter Trigger Towers. 
+*
+*  It is initialized by the CaloTTMgrDetDescrCnv converter from package CaloCnv/CaloDetMgrDetDescrCnv
+*  
+*  @warning The hadronic part of the FCAL calorimeter calorimeter is constructed
+*   with 4 channels in eta. These 4 channels actually correspond to 2 channels in eta
+*   FOR EACH of the hadronic samplings, i.e. FCAL2 and FCAL3. Therefore the geometry
+*   of these channels is wrong.
+*
+*  Access to the DetDescrElements: <br>
+*  ------------------------------- <br>
+*<br>
+*    Access is either individually using identifiers and a find
+*    method, or one can iterate over the whole set. <p>
+* <br>
+*  The information provided: <br>
+*  ------------------------- <br>
+*<br>
+*    Each DetDescrElement provides 
+*    access to a detector descriptor object. <p>
+*<br>
+*  Access to CaloTTDescrManager: <br>
+*  ----------------------------- <br>
+*  <br>
+*    This is NOT a singleton class anymore
+*    one now has to access the manager from the detector store <p>
+*<br>
+*  Initialization of DetDescrElements: <br>
+*  ----------------------------------- <br>
+* <br>
+*    Once an initialization has been performed, subsequent calls are
+*    ignored. Also, the method: <p>
+*<pre>
+*      bool is_initialized() 
+*
+*    returns true. 
+*</pre>
+*
+*
+*/
+
+class CaloTTDescrManager
+{
+  public:
+    
+    typedef std::vector <CaloTTDescrRegion*>		calo_region_vec;
+    typedef calo_region_vec::size_type		        calo_region_vec_size;
+    typedef calo_region_vec::const_iterator		calo_region_const_iterator;
+
+    typedef std::vector <CaloTTDescriptor*>		calo_descr_vec;
+    typedef calo_descr_vec::size_type		        calo_descr_size;
+    typedef calo_descr_vec::const_iterator		calo_descr_const_iterator;
+
+    CaloTTDescrManager(void);
+    
+    ~CaloTTDescrManager();
+    
+
+    /**  Access to the Det Descr region (==Trigger Tower) corresponding to a TT identifier */
+    CaloTTDescrRegion*			find_calo_region     (const Identifier& tower_id) const;
+    /**  Begin iterator on Det Descr regions (== Trigger Towers) */
+    calo_region_const_iterator 		calo_region_begin    (void) const;
+    /**  End iterator on Det Descr regions (== Trigger Towers) */
+    calo_region_const_iterator 		calo_region_end	     (void) const;
+    /**  Total number of Det Descr regions (i.e. Trigger Towers) */
+    calo_region_vec_size                calo_region_size     (void) const;
+
+    /**  Begin iterator on descriptors */
+    calo_descr_const_iterator 		calo_descriptors_begin	(void) const;
+    /**  End iterator on descriptors */
+    calo_descr_const_iterator 		calo_descriptors_end 	(void) const;
+    /**  Total number of descriptors */
+    calo_descr_size 			calo_descriptors_size	(void) const;
+
+    /**  access to the offline identifier helper */
+    const CaloLVL1_ID*			get_lvl1_id		(void) const;
+
+    void				print			(void) const;
+    
+    /** dummy. only sets is_initialized. actual initialization performed in CaloTTMgrDetDescrCnv */
+    void                                initialize              (void);
+    bool                                is_initialized          (void);
+
+    /**  Insertion in the vector of Det Descr regions (== Trigger Towers) */
+    void				add        	        (CaloTTDescrRegion*    region);
+    /**  Insertion in the vector of descriptors */
+    void				add          	        (CaloTTDescriptor*     descriptor);
+
+    /** set the helper used to decode the TT offline identifiers*/
+    void		      	set_helper (const CaloLVL1_ID* id_helper);
+
+    
+  private:
+    
+    
+    /** undefined semantics */
+    CaloTTDescrManager (const CaloTTDescrManager &);
+    CaloTTDescrManager &operator= (const CaloTTDescrManager &);
+
+    /** Delete towers and descriptors */
+    void		clear(void);
+
+    typedef std::map <Identifier, CaloTTDescrRegion* >	calo_region_map;
+
+    bool		m_is_initialized;
+    /** Helper used to decode the TT offline identifiers */
+    const CaloLVL1_ID*	m_calo_lvl1_id;
+    /** vector of Det Descr regions (== Trigger Towers) */
+    calo_region_vec 	m_calo_region_vec;
+    calo_region_map 	m_calo_region_map;
+    /** vector of descriptors */
+    calo_descr_vec 	m_calo_descr_vec;
+
+};
+
+//using the macros below we can assign an identifier (and a version)
+//This is required and checked at compile time when you try to record/retrieve
+CLASS_DEF( CaloTTDescrManager , 117659265 , 1 )
+
+#endif // CALODETDESCR_CALOTTDESCRMANAGER_H
diff --git a/Calorimeter/CaloTTDetDescr/CaloTTDetDescr/CaloTTDescrRegion.h b/Calorimeter/CaloTTDetDescr/CaloTTDetDescr/CaloTTDescrRegion.h
new file mode 100755
index 000000000000..eaf53e0775ba
--- /dev/null
+++ b/Calorimeter/CaloTTDetDescr/CaloTTDetDescr/CaloTTDescrRegion.h
@@ -0,0 +1,221 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/***************************************************************************
+ Calorimeter LVL1 TT  description package
+ -----------------------------------------
+ ***************************************************************************/
+
+//<doc><file>	$Id: CaloTTDescrRegion.h,v 1.5 2008-12-13 07:25:15 ssnyder Exp $
+//<version>	$Name: not supported by cvs2svn $
+
+#ifndef CALODETDESCR_CALOTTDESCRREGION_H
+#define CALODETDESCR_CALOTTDESCRREGION_H
+
+//<<<<<< INCLUDES                                                       >>>>>>
+
+#include "Identifier/Identifiable.h"
+#include "Identifier/Identifier.h"
+#include "CaloTTDetDescr/CaloTTDescriptor.h"
+
+//<<<<<< PUBLIC DEFINES                                                 >>>>>>
+//<<<<<< PUBLIC CONSTANTS                                               >>>>>>
+//<<<<<< PUBLIC TYPES                                                   >>>>>>
+//<<<<<< PUBLIC VARIABLES                                               >>>>>>
+//<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
+//<<<<<< CLASS DECLARATIONS                                             >>>>>>
+
+/**
+*
+*  @brief This class provides an interface to the geometrical description of the Calorimeter Trigger Towers
+
+*  Each instance of a CaloTTDescrRegion corresponds to the description of a Trigger Tower. <p>
+*  It is an interface, the real geometrical information is held by the CaloTTDescriptors.
+*
+*  Information available: <br>
+*  ---------------------- <br>
+*<br>
+*    Identifier: Each CaloTTDescrRegion has an Identifier which
+*    uniquely identifies to which region it corresponds, i.e. which
+*    positive/negative half, sampling, and region number (see
+*    class Calo_LVL1ID in package CaloIdentifier for more info.). <br>
+*<br>
+*    Print: A general print method is available. <p>
+*
+*/
+class CaloTTDescrRegion : public Identifiable
+{
+public:
+    
+    typedef CaloTTDescriptor		descriptor_type;
+
+    /** default constructor */
+    CaloTTDescrRegion(void);
+    /** constructor */
+    CaloTTDescrRegion(const Identifier& id, 
+		      const descriptor_type* descriptor);
+    
+    /**  */
+    virtual Identifier		identify	() const;
+    
+    const descriptor_type* 	descriptor	() const;
+
+    /** set coordinates of the Det Descr region -- pseudo spherical system; eta is signed, rho is unsigned */
+    void set_spherical ( double     eta, 
+			 double     phi, 
+			 double     rho );
+
+    /** set size of the Det Descr region -- pseudo spherical system; eta is signed, rho is unsigned */
+    void set_spherical_size ( double     deta, 
+			      double     dphi,  
+			      double     drho  );
+
+    /** set coordinates of the Det Descr region -- pseudo cylindrical system; eta is signed, z as well (same sign) */
+    void set_cylindric ( double     eta, 
+			 double     phi, 
+			 double     z );
+
+    /** set size of the Det Descr region -- pseudo cylindrical system; eta is signed, z as well (same sign) */
+    void set_cylindric_size ( double     deta, 
+			      double     dphi,  
+			      double     dz  );
+
+    /** set coordinates of the Det Descr region -- cartesian system; all signed */
+    void set_cartesian ( double     x, 
+			 double     y, 
+			 double     z );
+
+    /** set size of the Det Descr region -- cartesian system; all signed */
+    void set_cartesian_size ( double     dx, 
+			      double     dy,
+			      double     dz );
+
+
+    /** return coordinateof the Det Descr Region: eta (signed) */
+    double eta ()    const ;
+    /** return coordinateof the Det Descr Region: phi */
+    double phi ()    const ;
+    /** return coordinateof the Det Descr Region: rho (unsigned) */
+    double rho ()    const ;
+    /** return size in eta (unsigned)*/
+    double dphi ()    const ;
+    /** return size in phi (unsigned)*/
+    double deta ()    const ;
+    /** return size in rho (unsigned)*/
+    double drho ()    const ;
+
+    /** return coordinateof the Det Descr Region: x (signed) */
+    double x()       const ;
+    /** return coordinateof the Det Descr Region: y (signed) */
+    double y()       const ;
+    /** return coordinateof the Det Descr Region: z (signed) */
+    double z()       const ;
+    /** return size in x (unsigned)*/
+    double dx()       const ;
+    /** return size in y (unsigned)*/
+    double dy()       const ;
+    /** return size in z (unsigned)*/
+    double dz()       const ;
+
+    void 			print		() const;
+
+private:
+    
+    Identifier			m_id;
+    
+    const descriptor_type* 	m_descriptor;
+    
+    // spherical coordinates :
+    double      m_eta       ;
+    double      m_phi       ;
+    double      m_rho       ;
+    double      m_deta      ;
+    double      m_dphi      ;
+    double      m_drho      ;
+
+    // cartesian coordinates :
+    double      m_x         ;
+    double      m_y         ;
+    double      m_z         ;
+    double      m_dx        ;
+    double      m_dy        ;
+    double      m_dz        ;
+
+    
+};
+
+
+
+inline
+CaloTTDescrRegion::CaloTTDescrRegion(void)
+    :
+  m_descriptor(0),
+  m_eta(0.),
+  m_phi(0.),
+  m_rho(0.),
+  m_deta(0.),
+  m_dphi(0.),
+  m_drho(0.),
+  m_x(0.),
+  m_y(0.),
+  m_z(0.),
+  m_dx(0.),
+  m_dy(0.),
+  m_dz(0.)
+
+{}
+
+inline
+CaloTTDescrRegion::CaloTTDescrRegion(const Identifier& id, 
+	     const descriptor_type* descriptor)
+    : m_id(id),
+      m_descriptor(descriptor),
+      m_eta(0.),
+      m_phi(0.),
+      m_rho(0.),
+      m_deta(0.),
+      m_dphi(0.),
+      m_drho(0.),
+      m_x(0.),
+      m_y(0.),
+      m_z(0.),
+      m_dx(0.),
+      m_dy(0.),
+      m_dz(0.)
+{}
+
+inline const CaloTTDescrRegion::descriptor_type* 	
+CaloTTDescrRegion::descriptor	() const
+{
+    return m_descriptor;
+}
+
+
+inline double CaloTTDescrRegion::eta() const
+{ return m_eta;}
+inline double CaloTTDescrRegion::phi() const
+{ return m_phi;}
+inline double CaloTTDescrRegion::rho() const
+{ return m_rho;}
+inline double CaloTTDescrRegion::deta() const
+{ return m_deta;}
+inline double CaloTTDescrRegion::dphi() const
+{ return m_dphi;}
+inline double CaloTTDescrRegion::drho() const
+{ return m_drho;}
+
+inline double CaloTTDescrRegion::x() const
+{ return m_x;}
+inline double CaloTTDescrRegion::y() const
+{ return m_y;}
+inline double CaloTTDescrRegion::z() const
+{ return m_z;}
+inline double CaloTTDescrRegion::dx() const
+{ return m_dx;}
+inline double CaloTTDescrRegion::dy() const
+{ return m_dy;}
+inline double CaloTTDescrRegion::dz() const
+{ return m_dz;}
+
+#endif // CALODETDESCR_CALOTTDESCRREGION_H
diff --git a/Calorimeter/CaloTTDetDescr/CaloTTDetDescr/CaloTTDescriptor.h b/Calorimeter/CaloTTDetDescr/CaloTTDetDescr/CaloTTDescriptor.h
new file mode 100755
index 000000000000..6b0d03ac0363
--- /dev/null
+++ b/Calorimeter/CaloTTDetDescr/CaloTTDetDescr/CaloTTDescriptor.h
@@ -0,0 +1,185 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/***************************************************************************
+ Calorimeter LVL1 Trigger Towers description package
+ -----------------------------------------
+ ***************************************************************************/
+
+//<doc><file>	$Id: CaloTTDescriptor.h,v 1.5 2007-06-19 11:12:58 fledroit Exp $
+//<version>	$Name: not supported by cvs2svn $
+
+#ifndef CALODETDESCR_CALOTTDESCRIPTOR_H
+#define CALODETDESCR_CALOTTDESCRIPTOR_H
+
+#include <Identifier/Identifier.h>
+
+#include <math.h>
+
+
+
+/**  @brief This class holds the Calorimeter TriggerTower geometrical description  
+
+     There are four regions of different granularities in the Trigger Tower system: <br>
+     0.1x0.1, 0.2x0.2, 0.1x0.2, 0.4x0.4 <br>
+     There is 1 Descriptor per such region.
+
+*/
+class CaloTTDescriptor
+{
+public:
+    
+    /** Default constructor */
+    CaloTTDescriptor();
+    
+    /** Constructor : set geom parameters of each descriptor of equal granularity TT regions  */
+    CaloTTDescriptor(float eta_min, float eta_max, float deta, 
+		     float phi_min, float phi_max, float dphi,
+		     int   sign_eta,short n_lay);
+
+    ~CaloTTDescriptor();
+
+    /** set internal data member m_id (which is unused. should be removed */
+    void	set			(const Identifier& id);
+
+    /** Identifier - indicates which calorimeter */
+    Identifier	identify(void) const;
+
+    /** descriptor parameter: sign of eta (+-1) */
+    int		sign_eta() const;          
+    /** descriptor parameter: min value of abs(eta) */
+    float	eta_min () const;
+    /** descriptor parameter: max value of abs(eta) */
+    float	eta_max	() const;
+    /** descriptor parameter: min value of phi */
+    float	phiMin	() const;	
+    /** descriptor parameter: max value of phi */
+    float	phiMax	() const;	
+    /** descriptor parameter: eta granularity */
+    float	deta	() const;
+    /** descriptor parameter: phi granularity */
+    float	dphi	() const;
+    /** descriptor parameter: number of eta bins */
+    short       nEta    () const;
+    /** descriptor parameter: number of phi bins */
+    short       nPhi    () const;
+    /** descriptor parameter: number of layers */
+    short       nLay    () const;
+
+    /** Print */
+    void	print	() const;
+
+    /** set descriptor parameters */
+    void        set ( float               eta_min,
+                      float               eta_max,
+                      float               deta,
+                      float               phi_min,
+                      float               phi_max,
+                      float               dphi,
+                      int                 sign_eta,
+		      short               n_lay);
+
+ 
+private:
+  
+    /** an identifier associated to the descriptor. actually useless. should be cleaned away */
+    Identifier		m_id;
+    /** descriptor parameter: sign of eta (+-1) */
+    int			m_sign_eta;
+    /** descriptor parameter: min value of abs(eta) */
+    float		m_eta_min;
+    /** descriptor parameter: max value of abs(eta) */
+    float		m_eta_max;
+    /** descriptor parameter: eta granularity */
+    float		m_deta;
+    /** descriptor parameter: min value of phi */
+    float		m_phi_min;
+    /** descriptor parameter: max value of phi */
+    float		m_phi_max;
+    /** descriptor parameter: phi granularity */
+    float		m_dphi;
+    /** descriptor parameter: number of eta bins */
+    short               m_nEta;
+    /** descriptor parameter: number of phi bins */
+    short               m_nPhi;
+    /** descriptor parameter: number of layers */
+    short               m_nLay;
+
+
+};
+
+
+inline
+CaloTTDescriptor::CaloTTDescriptor()
+    :
+    m_sign_eta(0),
+    m_eta_min(0), 
+    m_eta_max(0),
+    m_deta(0),
+    m_phi_min(0),
+    m_phi_max(0),
+    m_dphi(0),
+    m_nEta(0),
+    m_nPhi(0),
+    m_nLay(0)
+
+{
+}
+
+inline void	
+CaloTTDescriptor::set (const Identifier& id)
+{
+    m_id = id;
+}
+
+
+inline Identifier	
+CaloTTDescriptor::identify(void) const
+{
+    return m_id;
+}
+
+inline int
+CaloTTDescriptor::sign_eta	() const
+{ return m_sign_eta; }
+
+inline float	
+CaloTTDescriptor::eta_min	() const
+{ return m_eta_min; }
+
+inline float	
+CaloTTDescriptor::eta_max	() const
+{ return m_eta_max; }
+
+inline float	
+CaloTTDescriptor::phiMin	() const
+{ return m_phi_min; }
+
+inline float	
+CaloTTDescriptor::phiMax	() const
+{ return m_phi_max; }
+
+inline float	
+CaloTTDescriptor::deta	() const
+{ return m_deta; }
+
+inline float	
+CaloTTDescriptor::dphi	() const
+{ return m_dphi; }	
+
+inline short
+CaloTTDescriptor::nEta	() const
+{ return m_nEta; }	
+
+inline short
+CaloTTDescriptor::nPhi	() const
+{ return m_nPhi; }	
+
+inline short
+CaloTTDescriptor::nLay	() const
+{ return m_nLay; }	
+
+
+#endif // CALODETDESCR_CALOTTDESCRIPTOR_H
+
diff --git a/Calorimeter/CaloTTDetDescr/cmt/requirements b/Calorimeter/CaloTTDetDescr/cmt/requirements
new file mode 100755
index 000000000000..8af74476820d
--- /dev/null
+++ b/Calorimeter/CaloTTDetDescr/cmt/requirements
@@ -0,0 +1,16 @@
+package CaloTTDetDescr
+
+author Fabienne Ledroit <ledroit@isn.in2p3.fr>
+author Johann Collot <collot@isn.in2p3.fr>
+
+use AtlasPolicy        AtlasPolicy-* 
+use Identifier         Identifier-*         DetectorDescription
+use CLIDSvc            CLIDSvc-*            Control
+
+private
+use CaloIdentifier     CaloIdentifier-*     Calorimeter
+end_private
+
+
+library CaloTTDetDescr *.cxx
+apply_pattern installed_library
diff --git a/Calorimeter/CaloTTDetDescr/doc/mainpage.h b/Calorimeter/CaloTTDetDescr/doc/mainpage.h
new file mode 100644
index 000000000000..15daa500f11e
--- /dev/null
+++ b/Calorimeter/CaloTTDetDescr/doc/mainpage.h
@@ -0,0 +1,16 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+
+@mainpage
+
+CaloTTDetDescr is a small package which manages the detector description for the Calorimeter Trigger Towers. <br>
+It must be noted that, as of now (Aug. 07) the TT geometry is ideal and does not follow the LAr or Tile description.
+
+@htmlinclude used_packages.html
+
+@include requirements
+
+*/
diff --git a/Calorimeter/CaloTTDetDescr/src/CaloTTDescrManager.cxx b/Calorimeter/CaloTTDetDescr/src/CaloTTDescrManager.cxx
new file mode 100755
index 000000000000..63dd5c525b38
--- /dev/null
+++ b/Calorimeter/CaloTTDetDescr/src/CaloTTDescrManager.cxx
@@ -0,0 +1,160 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/***************************************************************************
+ Calo description package
+ -----------------------------------------
+ ***************************************************************************/
+
+//<doc><file>	$Id: CaloTTDescrManager.cxx,v 1.8 2006-07-21 12:39:14 fledroit Exp $
+//<version>	$Name: not supported by cvs2svn $
+
+//<<<<<< INCLUDES                                                       >>>>>>
+
+#include "CaloTTDetDescr/CaloTTDescrManager.h"
+#include "CaloTTDetDescr/CaloTTDescrRegion.h"
+#include "CaloTTDetDescr/CaloTTDescriptor.h"
+#include "CaloIdentifier/CaloLVL1_ID.h"
+#include <iostream>
+
+
+
+CaloTTDescrManager::CaloTTDescrManager() 
+    :
+    m_is_initialized(false),
+    m_calo_lvl1_id(0)
+{
+}
+
+CaloTTDescrManager::~CaloTTDescrManager() 
+{
+//  Remove regions and descriptors
+    clear();
+}
+
+CaloTTDescrRegion*			
+CaloTTDescrManager::find_calo_region	(const Identifier& region) const
+{
+  calo_region_map::const_iterator p = m_calo_region_map.find(region);
+  if(p != m_calo_region_map.end()) {
+    return p->second;
+  } else {
+    // no CaloTTDescrRegion corresponding to Identifier
+    // this is expected as some Identifiers have no real counter part)
+    return(0);
+  }
+   
+}
+
+CaloTTDescrManager::calo_region_const_iterator
+CaloTTDescrManager::calo_region_begin	() const
+{
+    return m_calo_region_vec.begin();
+}
+
+CaloTTDescrManager::calo_region_const_iterator
+CaloTTDescrManager::calo_region_end	() const
+{
+    return m_calo_region_vec.end();
+}
+
+CaloTTDescrManager::calo_region_vec_size
+CaloTTDescrManager::calo_region_size	() const
+{
+    return m_calo_region_vec.size();
+}
+
+CaloTTDescrManager::calo_descr_const_iterator
+CaloTTDescrManager::calo_descriptors_begin () const
+{
+    return m_calo_descr_vec.begin();
+}
+
+CaloTTDescrManager::calo_descr_const_iterator
+CaloTTDescrManager::calo_descriptors_end	() const
+{
+    return m_calo_descr_vec.end();
+}
+
+CaloTTDescrManager::calo_descr_size
+CaloTTDescrManager::calo_descriptors_size () const
+{
+    return m_calo_descr_vec.size();
+}
+
+const CaloLVL1_ID*CaloTTDescrManager::get_lvl1_id() const
+{
+    return (m_calo_lvl1_id);
+}
+
+    
+
+void 				
+CaloTTDescrManager::initialize()
+{
+  // initialization actually done in CaloTTMgrDetDescrCnv
+  m_is_initialized = true;
+}
+
+bool CaloTTDescrManager::is_initialized()
+{
+  return m_is_initialized;
+}
+
+
+void
+CaloTTDescrManager::add        	(CaloTTDescrRegion* region)
+{
+    m_calo_region_vec.push_back(region);
+    //    m_calo_region_map[region->identify()] = region;    
+    m_calo_region_map.insert(std::pair<Identifier, CaloTTDescrRegion*>((region->identify()),region));
+}
+
+void
+CaloTTDescrManager::add         (CaloTTDescriptor*	descriptor)
+{
+    m_calo_descr_vec.push_back(descriptor);
+}
+
+void			
+CaloTTDescrManager::set_helper	(const CaloLVL1_ID* id_helper)
+{
+    m_calo_lvl1_id = id_helper;
+}
+
+
+void
+CaloTTDescrManager::print	() const
+{
+  std::cout << "CaloTTDescrManager       : " << std::endl;
+  std::cout << "   Number of Calo TT Regions : " << m_calo_region_vec.size() << std::endl;
+  std::cout << "   Number of Calo descriptors   : " << m_calo_descr_vec.size() << std::endl;
+
+  calo_region_const_iterator	first = calo_region_begin();
+  calo_region_const_iterator	last  = calo_region_end();
+      
+  for (; first != last; ++first) {
+    (*first)->print();
+  }
+
+}
+
+void CaloTTDescrManager::clear()
+{
+//  Remove regions and descriptors
+    calo_region_const_iterator first = m_calo_region_vec.begin();
+    calo_region_const_iterator last  = m_calo_region_vec.end();
+    for (; first != last; ++first) delete (*first);
+    m_calo_region_vec.clear();
+
+    calo_descr_const_iterator first2 = m_calo_descr_vec.begin();
+    calo_descr_const_iterator last2  = m_calo_descr_vec.end();
+    for (; first2 != last2; ++first2) delete (*first2);
+    m_calo_descr_vec.clear();
+
+    m_is_initialized = false;
+}
+
+
+
diff --git a/Calorimeter/CaloTTDetDescr/src/CaloTTDescrRegion.cxx b/Calorimeter/CaloTTDetDescr/src/CaloTTDescrRegion.cxx
new file mode 100755
index 000000000000..771d408ef827
--- /dev/null
+++ b/Calorimeter/CaloTTDetDescr/src/CaloTTDescrRegion.cxx
@@ -0,0 +1,148 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/***************************************************************************
+ Calorimeter LVL1 TT description package
+ -----------------------------------------
+ ***************************************************************************/
+
+//<doc><file>	$Id: CaloTTDescrRegion.cxx,v 1.6 2006-07-21 12:39:15 fledroit Exp $
+//<version>	$Name: not supported by cvs2svn $
+
+//<<<<<< INCLUDES                                                       >>>>>>
+
+#include "CaloTTDetDescr/CaloTTDescrRegion.h"
+#include <iostream>
+
+//<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
+
+
+Identifier
+CaloTTDescrRegion::identify() const
+{
+    return m_id;
+}
+
+void 			
+CaloTTDescrRegion::set_spherical(    double     eta, 
+				     double     phi, 
+				     double     rho)
+{
+  m_eta = eta ; 
+  m_phi= phi;
+  m_rho = rho;
+
+  // from this recompute cartesian coordinates 
+  m_x = m_rho*cos(m_phi);
+  m_y = m_rho*sin(m_phi);
+  m_z = m_rho*sinh(m_eta);
+
+ }
+
+void 			
+CaloTTDescrRegion::set_spherical_size( double     deta,
+				       double     dphi,
+				       double     drho )
+{
+  m_deta = deta; 
+  m_dphi = dphi;
+  m_drho = drho;  
+
+  // from this recompute size in cartesian... to be completed !!!
+
+  double dx = 0.;
+  double dy = 0.;
+  double dz = 0.;
+  if(m_rho < 1600) {
+    dz = m_drho * fabs(sinh(m_eta)) + m_deta * m_rho * cosh(m_eta);
+  } else {
+    dz = m_drho * fabs(sinh(m_eta));
+  }
+
+  m_dx = fabs(dx);
+  m_dy = fabs(dy);
+  m_dz = fabs(dz);
+
+ }
+
+void 			
+CaloTTDescrRegion::set_cylindric(    double     eta, 
+				     double     phi, 
+				     double     z)
+{
+  m_eta = eta ; 
+  m_phi = phi;
+  m_z   = z;
+
+  // from this recompute complementary set of coordinates 
+  m_rho = m_z/sinh(m_eta);
+  m_x   = m_rho*cos(m_phi);
+  m_y   = m_rho*sin(m_phi);
+
+ }
+
+void 			
+CaloTTDescrRegion::set_cylindric_size( double     deta,
+				       double     dphi,
+				       double     dz )
+{
+  m_deta = deta; 
+  m_dphi = dphi;
+  m_dz   = dz;  
+
+  // from this recompute size in complementary set of coord. ... to be completed !!!
+
+  double dx   = 0.;
+  double dy   = 0.;
+  double drho = (-m_z*cosh(m_eta)/sinh(m_eta)*m_deta
+                 +m_dz) / sinh(m_eta);
+
+  m_dx   = fabs(dx);
+  m_dy   = fabs(dy);
+  m_drho = fabs(drho);
+      
+ }
+
+void 			
+CaloTTDescrRegion::set_cartesian ( double     x, 
+				   double     y, 
+				   double     z )
+{
+  m_x       = x;
+  m_y       = y;
+  m_z       = z;
+
+  // from this recompute (semi)spherical coordinates 
+  m_rho = sqrt ( m_x*m_x+m_y*m_y) ;
+  double big_r = sqrt(m_x*m_x+m_y*m_y+m_z*m_z);
+  m_eta = 0.5*log((big_r+m_z)/(big_r-m_z));
+  m_phi = atan2(m_y,m_x);
+}
+
+void 			
+CaloTTDescrRegion::set_cartesian_size ( double     dx, 
+					double     dy,
+					double     dz )
+{
+  m_dx       = dx;
+  m_dy       = dy;
+  m_dz       = dz;
+  
+  // from this recompute size in (semi)spherical... TBD !!!
+  m_deta = 0.;
+  m_dphi = 0.;
+  m_drho = 0.;
+}
+
+void 			
+CaloTTDescrRegion::print		() const
+{
+
+    std::cout << std::endl << " CaloTTDescrRegion print: " 
+	      << std::endl << std::endl;
+    
+    m_id.show();
+    m_descriptor->print();
+}
+
diff --git a/Calorimeter/CaloTTDetDescr/src/CaloTTDescriptor.cxx b/Calorimeter/CaloTTDetDescr/src/CaloTTDescriptor.cxx
new file mode 100755
index 000000000000..1ec93b279e53
--- /dev/null
+++ b/Calorimeter/CaloTTDetDescr/src/CaloTTDescriptor.cxx
@@ -0,0 +1,105 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/***************************************************************************
+ Liquid Argon detector description package
+ -----------------------------------------
+ Copyright (C) 1998 by ATLAS Collaboration
+ ***************************************************************************/
+
+//<doc><file>	$Id: CaloTTDescriptor.cxx,v 1.5 2006-02-15 09:05:19 fledroit Exp $
+//<version>	$Name: not supported by cvs2svn $
+
+//<<<<<< INCLUDES                                                       >>>>>>
+
+#include "CaloTTDetDescr/CaloTTDescriptor.h"
+
+//FLG#include "CaloIdentifier/CaloLVL1_ID.h"
+
+#ifdef HAVE_NEW_IOSTREAMS
+    #include <iostream>
+    #include <iomanip>
+#else
+    #include <iostream.h>
+    #include <iomanip.h>
+#endif
+
+CaloTTDescriptor::CaloTTDescriptor(float eta_min,   float eta_max,   float deta, 
+				   float phi_min,   float phi_max,   float dphi,
+				   int  sign_eta,   short n_lay)
+    : 
+    m_sign_eta	(sign_eta),
+    m_eta_min	(eta_min),
+    m_eta_max	(eta_max),
+    m_deta	(deta),
+    m_phi_min	(phi_min),
+    m_phi_max	(phi_max),
+    m_dphi	(dphi),
+    m_nEta      ((short) ((eta_max - eta_min)/deta + 0.501)),
+    m_nPhi      ((short) ((phi_max - phi_min)/dphi + 0.501)),
+    m_nLay      (n_lay)
+{
+}
+
+CaloTTDescriptor::~CaloTTDescriptor()
+{}
+
+void	
+CaloTTDescriptor::print	() const
+{
+    std::cout << std::endl << " CaloTTDescriptor print: " 
+	      << std::endl << std::endl;
+    
+    // Print out id
+    m_id.show();
+    
+    std::cout << " Calo LVL1 Trigger Towers: " << std::endl;
+    std::cout << "  eta min  eta max     deta   phi min   phi max      dphi   nLay"
+	      << std::endl;
+    std::cout << std::setiosflags(std::ios::fixed);
+    std::cout << std::setw(9) << std::setprecision(4) << m_eta_min << " " 
+	      << std::setw(9) << std::setprecision(4) << m_eta_max << " " 
+	      << std::setw(9) << std::setprecision(4) << m_deta    << " " 
+	      << std::setw(9) << std::setprecision(4) << m_phi_min << " " 
+	      << std::setw(9) << std::setprecision(4) << m_phi_max << " " 
+	      << std::setw(9) << std::setprecision(4) << m_dphi    << " "
+	      << std::setw(9) << std::setprecision(4) << m_nLay    << " "
+	      << std::endl;	    
+    
+    return;
+}
+
+    
+void 
+CaloTTDescriptor::set (float               eta_min,        
+		       float               eta_max,
+		       float               deta,
+		       float               phi_min,
+		       float               phi_max,
+		       float               dphi,
+		       int                 sign_eta,
+		       short               n_lay)
+{
+  m_eta_min  = eta_min;
+  m_eta_max  = eta_max;
+  m_deta     = deta;
+  m_phi_min  = phi_min;
+  m_phi_max  = phi_max;
+  m_dphi     = dphi;
+  m_nEta     = (short) ((eta_max - eta_min)/deta + 0.501);
+  m_nPhi     = (short) ((phi_max - phi_min)/dphi + 0.501);
+  m_sign_eta = sign_eta;
+  m_nLay = n_lay;
+}
+
+
+    
+
+
+
+
+
+
+
+
-- 
GitLab