ATLAS Offline Software
Loading...
Searching...
No Matches
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"
29
31
32struct 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
81
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
94public:
95
96 // default constructor
98
99 // default destructor
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
NEIGHBOURTYPE
@ nextInCalo
@ prevInCalo
HWIdentifier id2
static const std::vector< std::string > regions
Helper base class for offline cell identifiers.
NEIGHBOURTYPE getType() const
std::vector< std::unique_ptr< std::vector< IdentifierHash > > > m_neighbours_minus
CaloNeighbourRegion(const std::string &name, const CaloCell_Base_ID *theCaloId)
void initializeVectors(std::map< IdentifierHash, std::vector< IdentifierHash >, ltIdHash > &neighbourMapPlus, std::map< IdentifierHash, std::vector< IdentifierHash >, ltIdHash > &neighbourMapMinus)
void setSourceRange(const Range &theRange)
IdentifierHash m_maxHashPlus
virtual ~CaloNeighbourRegion()
IdentifierHash m_minHashPlus
int getNeighbours(const IdentifierHash caloHash, std::vector< IdentifierHash > &neighbourList) const
IdentifierHash m_maxHashMinus
const std::string & getName() const
int getId(ExpandedIdentifier &id, Identifier &rID, const Range &theRange, const int side=+1, const int dphi=0) const
void setTargetRange(const Range &theRange)
void setType(const NEIGHBOURTYPE type)
void setPhi(const int phi1, const int phi2)
void setSide(const int side1, const int side2)
IdentifierHash m_minHashMinus
NEIGHBOURTYPE m_type
const CaloCell_Base_ID * m_calo_id
int setNeighbours(ExpandedIdentifier &id1, std::vector< ExpandedIdentifier > &id2, std::map< IdentifierHash, std::vector< IdentifierHash >, ltIdHash > &neighbourMapPlus, std::map< IdentifierHash, std::vector< IdentifierHash >, ltIdHash > &neighbourMapMinus)
std::vector< std::unique_ptr< std::vector< IdentifierHash > > > m_neighbours_plus
std::vector< std::unique_ptr< CaloNeighbourRegion > > m_next_regions
virtual ~CaloNeighbours()
std::vector< std::unique_ptr< CaloNeighbourRegion > > m_prev_regions
int get_nextInCalo(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
int get_prevInCalo(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
const CaloCell_Base_ID * m_calo_id
static int get_neighbours(const IdentifierHash &id, const std::vector< std::unique_ptr< CaloNeighbourRegion > > &regions, std::vector< IdentifierHash > &neighbourList)
This is a "hash" representation of an Identifier.
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
void initialize()
bool operator()(const IdentifierHash &id1, const IdentifierHash &id2) const