From 1325c9ce00e38e66d6dd1bcce8f4ddf67f5efb34 Mon Sep 17 00:00:00 2001 From: Jochen Meyer <Jochen.Meyer@cern.ch> Date: Tue, 16 Sep 2014 08:13:20 +0200 Subject: [PATCH] fixing compiler warning (MuonChamberT0s-00-02-03) --- .../MuonChamberT0s/ChamberT0s.h | 84 +++++++++++++++++++ .../MuonChamberT0s/MuonChamberT0sDict.h | 6 ++ .../MuonChamberT0s/selection.xml | 8 ++ .../MuonChamberT0s/cmt/requirements | 19 +++++ .../MuonChamberT0s/src/ChamberT0s.cxx | 24 ++++++ 5 files changed, 141 insertions(+) create mode 100755 MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/MuonChamberT0s/ChamberT0s.h create mode 100644 MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/MuonChamberT0s/MuonChamberT0sDict.h create mode 100644 MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/MuonChamberT0s/selection.xml create mode 100755 MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/cmt/requirements create mode 100755 MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/src/ChamberT0s.cxx diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/MuonChamberT0s/ChamberT0s.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/MuonChamberT0s/ChamberT0s.h new file mode 100755 index 0000000000000..585631d844a97 --- /dev/null +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/MuonChamberT0s/ChamberT0s.h @@ -0,0 +1,84 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// MuonSegPatAssMap.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +#ifndef MUONCHAMBERT0S_CHAMBERT0S_H +#define MUONCHAMBERT0S_CHAMBERT0S_H + +#include "Identifier/Identifier.h" +#include "CLIDSvc/CLASS_DEF.h" +#include <algorithm> +#include <ext/functional> + +namespace Muon { + + +/** + Stores links between chambers and the reconstructed T0. + @author edward.moyse@cern.ch +*/ + class ChamberT0s { + public: + /** Value returned by ChamberT0s::getT0(...) when chamber is not known to ChamberT0s*/ + static float ChamberUnknown ; + + ChamberT0s( ) ; + + ChamberT0s( std::vector< std::pair < Identifier, float > > t0s ) ; + + ~ChamberT0s(); + + /** Returns true if we have the T0 for this chamber? */ + bool haveChamber(const Identifier& id) const; + + /** Returns the T0 for this chamber (or ChamberT0s::ChamberUnknown if the chamber is not in list) + + You could use this as e.g. + @code + float t0 = chamberT0.getT0( chamberId ); + if (t0!=ChamberT0s::ChamberUnknown) { + // we know about chamber, so use T0 + } + @endcode + */ + float getT0( const Identifier& id) const; + + /** Returns entire list of T0s. + It consists of a vector of pairs, where the first element is the Chamber Identifier, and the + second is the T0*/ + const std::vector< std::pair < Identifier, float > >& getAllT0s() const; + + private: + std::vector< std::pair < Identifier, float > > m_t0s; + }; + +inline bool ChamberT0s::haveChamber(const Identifier& id) const { + using namespace __gnu_cxx; + using namespace std; + vector< pair < Identifier, float > >::const_iterator it + = find_if(m_t0s.begin(), m_t0s.end(), compose1(bind2nd(equal_to<Identifier>(), id), select1st<std::pair <Identifier, float> >())); + return (it!=m_t0s.end()); +} + +inline float ChamberT0s::getT0(const Identifier& id) const { + using namespace __gnu_cxx; + using namespace std; + vector< pair < Identifier, float > >::const_iterator it + = find_if(m_t0s.begin(), m_t0s.end(), compose1(bind2nd(equal_to<Identifier>(), id), select1st<std::pair <Identifier, float> >())); + if (it==m_t0s.end()) return ChamberUnknown; // No such chamber known. + return (it->second); +} + +inline const std::vector< std::pair < Identifier, float > >& ChamberT0s::getAllT0s() const { + return m_t0s; +} + +} + +CLASS_DEF( Muon::ChamberT0s , 42363316 , 1 ) + +#endif diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/MuonChamberT0s/MuonChamberT0sDict.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/MuonChamberT0s/MuonChamberT0sDict.h new file mode 100644 index 0000000000000..44abd11e9b980 --- /dev/null +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/MuonChamberT0s/MuonChamberT0sDict.h @@ -0,0 +1,6 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonChamberT0s/ChamberT0s.h" + diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/MuonChamberT0s/selection.xml b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/MuonChamberT0s/selection.xml new file mode 100644 index 0000000000000..28609e060a640 --- /dev/null +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/MuonChamberT0s/selection.xml @@ -0,0 +1,8 @@ +<lcgdict> + + <class name="Muon::ChamberT0s" /> + <class name="std::vector< std::pair < Identifier, float > >"/> + <class name="std::pair < Identifier, float >" /> + <function pattern="ChamberT0Utils::*" /> + +</lcgdict> diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/cmt/requirements b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/cmt/requirements new file mode 100755 index 0000000000000..82db00ca24649 --- /dev/null +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/cmt/requirements @@ -0,0 +1,19 @@ +package MuonChamberT0s + +manager Edward.Moyse@cern.ch + +public +use AtlasPolicy AtlasPolicy-* +use CLIDSvc CLIDSvc-* Control +use Identifier Identifier-* DetectorDescription + +apply_pattern installed_library +library MuonChamberT0s *.cxx + +private +use AtlasReflex AtlasReflex-* External -no_auto_imports + +apply_pattern lcgdict dict=MuonChamberT0s selectionfile=selection.xml headerfiles="../MuonChamberT0s/MuonChamberT0sDict.h" +end_private + + diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/src/ChamberT0s.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/src/ChamberT0s.cxx new file mode 100755 index 0000000000000..4e4f6f63d520f --- /dev/null +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonChamberT0s/src/ChamberT0s.cxx @@ -0,0 +1,24 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonChamberT0s/ChamberT0s.h" + +namespace Muon { + +float ChamberT0s::ChamberUnknown = -99999.9; + +ChamberT0s::ChamberT0s( ) +{} + +ChamberT0s::ChamberT0s( std::vector< std::pair < Identifier, float > > t0s ) + : + m_t0s (t0s) +{} + +ChamberT0s::~ChamberT0s( ) +{} + + + +} -- GitLab