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