ATLAS Offline Software
CaloNeighbours.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef CALOIDENTIFIER_CALONEIGHBOURS_H
6 #define CALOIDENTIFIER_CALONEIGHBOURS_H
7 //-----------------------------------------------------------------------
8 // File and Version Information:
9 //
10 //
11 //
12 // Description: Initialize and provide access to neighbours accross
13 // the calorimeter systems. The neighbours within a
14 // a single system are provided by the individual helper.
15 //
16 // Environment:
17 // Software developed for the ATLAS Detector at the CERN LHC
18 //
19 // Author List:
20 // Sven Menke
21 //
22 //-----------------------------------------------------------------------
23 #include <string>
24 #include <map>
25 #include <vector>
27 #include "Identifier/Range.h"
28 class ExpandedIdentifier;
29 
31 
32 struct ltIdHash{
33  bool operator()(const IdentifierHash& id1, const IdentifierHash& id2) const
34  {
35  return ((unsigned int)id1) < ((unsigned int)id2);
36  }
37 };
38 
39 
41  public:
42 
43  enum {SIDE = 2, SAMPL = 3, REGION = 4, ETA = 5, PHI = 6, TILESECTION = 1, TILEPHI = 3, TILEETA = 4, TILESAMPL = 5, FCALETA = 4, FCALPHI = 5};
44 
45  CaloNeighbourRegion(const std::string& name,
46  const CaloCell_Base_ID * theCaloId);
47 
49 
50  void setType(const NEIGHBOURTYPE type);
51  void setSourceRange(const Range & theRange);
52  void setTargetRange(const Range & theRange);
53  void setSide(const int side1, const int side2);
54  void setPhi(const int phi1, const int phi2);
55  int setNeighbours(ExpandedIdentifier& id1, std::vector<ExpandedIdentifier>& id2, std::map<IdentifierHash, std::vector<IdentifierHash>, ltIdHash>& neighbourMapPlus, std::map<IdentifierHash, std::vector<IdentifierHash>, ltIdHash>& neighbourMapMinus);
56 
57  void initializeVectors(std::map<IdentifierHash, std::vector<IdentifierHash>, ltIdHash>& neighbourMapPlus, std::map<IdentifierHash, std::vector<IdentifierHash>, ltIdHash>& neighbourMapMinus);
58 
59  int getNeighbours(const IdentifierHash caloHash, std::vector<IdentifierHash>& neighbourList) const;
60 
61  inline NEIGHBOURTYPE getType() const {
62  return m_type;
63  }
64 
65  inline const std::string& getName() const {
66  return m_name;
67  }
68 
69  private:
70 
71  int getId(ExpandedIdentifier& id, Identifier &rID, const Range &theRange, const int side = +1, const int dphi = 0) const;
72 
73  std::string m_name;
76 
78 
79  bool m_hasPhi;
81 
82  bool m_hasSide;
84 
86 
88  std::vector< std::unique_ptr<std::vector<IdentifierHash> > > m_neighbours_plus;
89  std::vector< std::unique_ptr<std::vector<IdentifierHash> > > m_neighbours_minus;
90 };
91 
93 
94 public:
95 
96  // default constructor
98 
99  // default destructor
100  virtual ~CaloNeighbours();
101 
102  int initialize(const CaloCell_Base_ID* caloID, const std::string& filename);
103 
104  int get_nextInCalo(const IdentifierHash &id,std::vector<IdentifierHash>& neighbourList) const;
105 
106  int get_prevInCalo(const IdentifierHash &id,std::vector<IdentifierHash>& neighbourList) const;
107 
108  static int get_neighbours(const IdentifierHash &id,
109  const std::vector<std::unique_ptr<CaloNeighbourRegion> > &regions,
110  std::vector<IdentifierHash>& neighbourList) ;
111 
112  private:
114 
115  std::vector<std::unique_ptr<CaloNeighbourRegion> > m_next_regions;
116  std::vector<std::unique_ptr<CaloNeighbourRegion> > m_prev_regions;
117 };
118 #endif // CALOIDENTIFIER_CALONEIGHBOURS_H
CaloNeighbourRegion::setSourceRange
void setSourceRange(const Range &theRange)
Definition: CaloNeighbours.cxx:72
CaloNeighbourRegion::m_iPhiSource
int m_iPhiSource
Definition: CaloNeighbours.h:80
CaloNeighbourRegion::setSide
void setSide(const int side1, const int side2)
Definition: CaloNeighbours.cxx:92
CaloNeighbourRegion::TILESECTION
@ TILESECTION
Definition: CaloNeighbours.h:43
CaloNeighbours::initialize
int initialize(const CaloCell_Base_ID *caloID, const std::string &filename)
Definition: CaloNeighbours.cxx:295
CaloNeighbourRegion::m_hasPhi
bool m_hasPhi
Definition: CaloNeighbours.h:79
CaloNeighbourRegion::m_isValidPlus
bool m_isValidPlus
Definition: CaloNeighbours.h:85
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CaloNeighbourRegion::initializeVectors
void initializeVectors(std::map< IdentifierHash, std::vector< IdentifierHash >, ltIdHash > &neighbourMapPlus, std::map< IdentifierHash, std::vector< IdentifierHash >, ltIdHash > &neighbourMapMinus)
Definition: CaloNeighbours.cxx:240
CaloNeighbours::m_calo_id
const CaloCell_Base_ID * m_calo_id
Definition: CaloNeighbours.h:113
CaloNeighbourRegion::TILEPHI
@ TILEPHI
Definition: CaloNeighbours.h:43
CaloNeighbourRegion::setNeighbours
int setNeighbours(ExpandedIdentifier &id1, std::vector< ExpandedIdentifier > &id2, std::map< IdentifierHash, std::vector< IdentifierHash >, ltIdHash > &neighbourMapPlus, std::map< IdentifierHash, std::vector< IdentifierHash >, ltIdHash > &neighbourMapMinus)
Definition: CaloNeighbours.cxx:181
CaloNeighbourRegion::REGION
@ REGION
Definition: CaloNeighbours.h:43
CaloNeighbourRegion
Definition: CaloNeighbours.h:40
Range.h
CaloNeighbourRegion::m_isValidMinus
bool m_isValidMinus
Definition: CaloNeighbours.h:85
CaloNeighbourRegion::m_name
std::string m_name
Definition: CaloNeighbours.h:73
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
CaloNeighbourRegion::getId
int getId(ExpandedIdentifier &id, Identifier &rID, const Range &theRange, const int side=+1, const int dphi=0) const
Definition: CaloNeighbours.cxx:111
CaloNeighbours::get_nextInCalo
int get_nextInCalo(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
Definition: CaloNeighbours.cxx:449
CaloNeighbourRegion::m_maxHashPlus
IdentifierHash m_maxHashPlus
Definition: CaloNeighbours.h:87
CaloNeighbourRegion::m_minHashMinus
IdentifierHash m_minHashMinus
Definition: CaloNeighbours.h:87
CaloNeighbourRegion::m_targetRange
Range m_targetRange
Definition: CaloNeighbours.h:77
CaloNeighbourRegion::m_hasSide
bool m_hasSide
Definition: CaloNeighbours.h:82
CaloNeighbourRegion::m_sourceRange
Range m_sourceRange
Definition: CaloNeighbours.h:77
CaloNeighbourRegion::FCALETA
@ FCALETA
Definition: CaloNeighbours.h:43
CaloNeighbourRegion::getName
const std::string & getName() const
Definition: CaloNeighbours.h:65
CaloNeighbourRegion::m_type
NEIGHBOURTYPE m_type
Definition: CaloNeighbours.h:74
CaloCell_ID.h
TRT::Hit::side
@ side
Definition: HitInfo.h:83
ltIdHash::operator()
bool operator()(const IdentifierHash &id1, const IdentifierHash &id2) const
Definition: CaloNeighbours.h:33
CaloNeighbourRegion::m_minHashPlus
IdentifierHash m_minHashPlus
Definition: CaloNeighbours.h:87
CaloNeighbourRegion::getType
NEIGHBOURTYPE getType() const
Definition: CaloNeighbours.h:61
id2
HWIdentifier id2
Definition: LArRodBlockPhysicsV0.cxx:562
CaloNeighbours
Definition: CaloNeighbours.h:92
NEIGHBOURTYPE
NEIGHBOURTYPE
Definition: CaloNeighbours.h:30
nextInCalo
@ nextInCalo
Definition: CaloNeighbours.h:30
CaloNeighbourRegion::setTargetRange
void setTargetRange(const Range &theRange)
Definition: CaloNeighbours.cxx:85
CaloNeighbourRegion::setPhi
void setPhi(const int phi1, const int phi2)
Definition: CaloNeighbours.cxx:101
CaloNeighbourRegion::~CaloNeighbourRegion
virtual ~CaloNeighbourRegion()
CaloNeighbourRegion::m_maxHashMinus
IdentifierHash m_maxHashMinus
Definition: CaloNeighbours.h:87
CaloNeighbourRegion::TILEETA
@ TILEETA
Definition: CaloNeighbours.h:43
CaloNeighbours::m_prev_regions
std::vector< std::unique_ptr< CaloNeighbourRegion > > m_prev_regions
Definition: CaloNeighbours.h:116
ltIdHash
Definition: CaloNeighbours.h:32
CaloNeighbourRegion::m_neighbours_minus
std::vector< std::unique_ptr< std::vector< IdentifierHash > > > m_neighbours_minus
Definition: CaloNeighbours.h:89
CaloNeighbourRegion::m_iSideSource
int m_iSideSource
Definition: CaloNeighbours.h:83
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
CaloNeighbourRegion::m_neighbours_plus
std::vector< std::unique_ptr< std::vector< IdentifierHash > > > m_neighbours_plus
Definition: CaloNeighbours.h:88
CaloNeighbourRegion::m_iSideTarget
int m_iSideTarget
Definition: CaloNeighbours.h:83
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition: DetectorDescription/Identifier/Identifier/Range.h:29
CaloNeighbours::get_neighbours
static int get_neighbours(const IdentifierHash &id, const std::vector< std::unique_ptr< CaloNeighbourRegion > > &regions, std::vector< IdentifierHash > &neighbourList)
Definition: CaloNeighbours.cxx:463
prevInCalo
@ prevInCalo
Definition: CaloNeighbours.h:30
CaloNeighbours::m_next_regions
std::vector< std::unique_ptr< CaloNeighbourRegion > > m_next_regions
Definition: CaloNeighbours.h:115
CaloNeighbourRegion::TILESAMPL
@ TILESAMPL
Definition: CaloNeighbours.h:43
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CaloNeighbourRegion::SAMPL
@ SAMPL
Definition: CaloNeighbours.h:43
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
CaloNeighbourRegion::m_calo_id
const CaloCell_Base_ID * m_calo_id
Definition: CaloNeighbours.h:75
CaloNeighbours::CaloNeighbours
CaloNeighbours()
Definition: CaloNeighbours.cxx:284
CaloNeighbourRegion::setType
void setType(const NEIGHBOURTYPE type)
Definition: CaloNeighbours.cxx:65
CaloNeighbourRegion::m_iPhiTarget
int m_iPhiTarget
Definition: CaloNeighbours.h:80
CaloNeighbourRegion::getNeighbours
int getNeighbours(const IdentifierHash caloHash, std::vector< IdentifierHash > &neighbourList) const
Definition: CaloNeighbours.cxx:263
SIDE
SIDE
Definition: CellClusterLinkTool.h:52
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
CaloCell_Base_ID
Helper base class for offline cell identifiers.
Definition: CaloCell_Base_ID.h:41
CaloNeighbourRegion::ETA
@ ETA
Definition: CaloNeighbours.h:43
CaloNeighbours::get_prevInCalo
int get_prevInCalo(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
Definition: CaloNeighbours.cxx:456
CaloNeighbourRegion::FCALPHI
@ FCALPHI
Definition: CaloNeighbours.h:43
CaloNeighbourRegion::PHI
@ PHI
Definition: CaloNeighbours.h:43
CaloNeighbours::~CaloNeighbours
virtual ~CaloNeighbours()
CaloNeighbourRegion::CaloNeighbourRegion
CaloNeighbourRegion(const std::string &name, const CaloCell_Base_ID *theCaloId)
Definition: CaloNeighbours.cxx:42
Identifier
Definition: IdentifierFieldParser.cxx:14