ATLAS Offline Software
HIEventShapeMapTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 HIEventShapeMapTool::HIEventShapeMapTool(const std::string& n) : asg::AsgTool(n){
10 
11 }
12 
14 
15  HIEventShapeIndex index_1, index_2;
18  m_map[ HI::BinningScheme::COMPACT ] = index_1;
19  m_map[ HI::BinningScheme::TOWER ] = index_2;
20 
21  return StatusCode::SUCCESS;
22 }
23 
25 {
26  std::string myKey;
27  if(key == HI::BinningScheme::COMPACT) myKey="COMPACT";
28  else if (key == HI::BinningScheme::TOWER ) myKey="TOWER";
29  else myKey = "UNKNOWN SHAPE";
30 
31  auto itr=m_map.find(key);
32  if(itr==m_map.end()) {
33  ATH_MSG_ERROR("HIEventShapeMapTool failed to find map w/ format " << myKey);
34  return nullptr;
35  }
36  return &(itr->second);
37 }
38 
40 {
41  ATH_MSG_DEBUG("In getIndexFromShape, Shape size " << shape->size() << " And TOWER is: " << (HI::TowerBins::numLayers()*HI::TowerBins::numEtaBins()));
42  if(shape->size() == HI::BinningScheme::TOWER){
43  //TOWER
44  auto itr = m_map.find( HI::BinningScheme::TOWER );
45  return &(itr->second);
46  }
47  else if(shape->size() == HI::BinningScheme::COMPACT){
48  //COMPACT
49  auto itr = m_map.find( HI::BinningScheme::COMPACT );
50  return &(itr->second);
51  }
52  else {
53  ATH_MSG_FATAL("Event Shape w/ unknown binning! Not TOWER or COMPACT. Not possible to get Index");
54  return nullptr;
55  }
56 }
57 
59 {
60  return (m_map.find(key)!=m_map.end());
61 }
HIEventShapeMapTool.h
HI::TOWER
@ TOWER
Definition: HIEventDefs.h:16
HIEventShapeMapTool::getIndex
virtual const HIEventShapeIndex * getIndex(HI::BinningScheme key) const override
Definition: HIEventShapeMapTool.cxx:24
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
HIEventShapeIndex.h
HIEventShapeMapTool::m_map
std::map< HI::BinningScheme,HIEventShapeIndex > m_map
Definition: HIEventShapeMapTool.h:36
HIEventShapeMapTool::hasKey
virtual bool hasKey(HI::BinningScheme key) override
Definition: HIEventShapeMapTool.cxx:58
asg
Definition: DataHandleTestTool.h:28
HIEventShapeMapTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: HIEventShapeMapTool.cxx:13
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HIEventShapeIndex::setBinning
unsigned int setBinning(const TH2 *h2, bool asMask)
Definition: HIEventShapeIndex.cxx:24
HIEventShape.h
HI::COMPACT
@ COMPACT
Definition: HIEventDefs.h:16
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
HI::TowerBins::numEtaBins
constexpr unsigned int numEtaBins()
Definition: HIEventDefs.h:19
HIEventShapeMapTool::getIndexFromShape
virtual const HIEventShapeIndex * getIndexFromShape(const xAOD::HIEventShapeContainer *shape) const override
Definition: HIEventShapeMapTool.cxx:39
HIEventShapeIndex
Definition: HIEventShapeIndex.h:16
HIEventShapeMapTool::HIEventShapeMapTool
HIEventShapeMapTool(const std::string &n)
Definition: HIEventShapeMapTool.cxx:9
HI::TowerBins::numLayers
constexpr unsigned int numLayers()
Definition: HIEventDefs.h:23
HI::BinningScheme
BinningScheme
Definition: HIEventDefs.h:16
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37