ATLAS Offline Software
WaferTree.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef INDETGEOMODELUTILS_WAFERTREE_H
6 #define INDETGEOMODELUTILS_WAFERTREE_H
7 //
8 // For "numerology". Create a nested set of maps. Bottom layer of leaves are wafer information.
9 // Order is barrelEndcap/layerDisk/phiModule/etaModule/side; each of these has a map of integer-key (the
10 // value of the integer index) and value -- a map to the next layer down.
11 //
12 // User should only create the top level item, a WaferTree, and Wafers (which are copied: user deletes his own copy).
13 // add(bec, layer, phi, eta, side, Wafer) for each wafer.
14 //
15 // Then the number of items at a given layer can be found from the nXxxxxs member functions of each sub-layer.
16 //
17 #include <map>
18 #include <string>
19 #include <sstream>
20 
21 // Error message build up is spread in many routines; instead of cerr, build up a string. Caller can
22 // print this string with Athena message service.
23 
24 
25 static thread_local std::ostringstream errmsg;
26 
27 class Wafer {
28 public:
29  Wafer(int unsigned hashId): m_hashId(hashId) {}
30  unsigned int hashId() {return m_hashId;}
31  void setHashId(unsigned int hashId) {m_hashId = hashId;}
32 private:
33  unsigned int m_hashId;
34 };
35 
36 class Side: public std::map<int, Wafer> {
37 public:
38  bool add(int side, Wafer &wafer);
39  Wafer & operator[](int side) {return at(side);}
40  int nSides() const {return size();}
41 };
42 
43 class PhiModule: public std::map<int, Side> {
44 public:
45  bool add(int phi, int side, Wafer &wafer);
46  Side & operator[](int phi) {return at(phi);}
47  int nPhiModules() const {return size();}
48 };
49 
50 class EtaModule: public std::map<int, PhiModule> {
51 public:
52  bool add(int eta, int phi, int side, Wafer &wafer);
53  PhiModule & operator[](int eta) {return at(eta);}
54  int nEtaModules() const {return size();}
55 };
56 
57 class LayerDisk: public std::map<int, EtaModule> {
58 public:
59  bool add(int ld, int eta, int phi, int side, Wafer &wafer);
60  EtaModule & operator[](int ld) {return at(ld);}
61  int nLayers() const {return size();}
62 };
63 
64 class BarrelEndcap: public std::map<int, LayerDisk> {
65 public:
66  bool add(int bec, int ld, int eta, int phi, int side, Wafer &wafer, std::string &errorMessage);
67  bool add(int bec, int ld, int eta, int phi, Wafer &wafer, std::string &errorMessage); //version without side index for pixels
68  LayerDisk & operator[](int bec) {return at(bec);}
69  int nParts() const {return size();}
70 };
71 
72 
73 
74 class WaferTree: public BarrelEndcap { // Just a more descriptive name for the class.
75 };
76 
77 #endif
Wafer::m_hashId
unsigned int m_hashId
Definition: WaferTree.h:33
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
ParticleGun_SamplingFraction.bec
int bec
Definition: ParticleGun_SamplingFraction.py:89
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
Side::nSides
int nSides() const
Definition: WaferTree.h:40
Wafer::hashId
unsigned int hashId()
Definition: WaferTree.h:30
LayerDisk::nLayers
int nLayers() const
Definition: WaferTree.h:61
PhiModule::operator[]
Side & operator[](int phi)
Definition: WaferTree.h:46
LayerDisk::operator[]
EtaModule & operator[](int ld)
Definition: WaferTree.h:60
TRT::Hit::side
@ side
Definition: HitInfo.h:83
Wafer::setHashId
void setHashId(unsigned int hashId)
Definition: WaferTree.h:31
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
BarrelEndcap
Definition: WaferTree.h:64
EtaModule
Definition: WaferTree.h:50
LayerDisk
Definition: WaferTree.h:57
EtaModule::operator[]
PhiModule & operator[](int eta)
Definition: WaferTree.h:53
Wafer
Definition: WaferTree.h:27
BarrelEndcap::add
bool add(int bec, int ld, int eta, int phi, int side, Wafer &wafer, std::string &errorMessage)
Definition: WaferTree.cxx:55
Side
Definition: WaferTree.h:36
EtaModule::nEtaModules
int nEtaModules() const
Definition: WaferTree.h:54
LayerDisk::add
bool add(int ld, int eta, int phi, int side, Wafer &wafer)
Definition: WaferTree.cxx:44
Wafer::Wafer
Wafer(int unsigned hashId)
Definition: WaferTree.h:29
Side::add
bool add(int side, Wafer &wafer)
Definition: WaferTree.cxx:9
Side::operator[]
Wafer & operator[](int side)
Definition: WaferTree.h:39
BarrelEndcap::operator[]
LayerDisk & operator[](int bec)
Definition: WaferTree.h:68
PhiModule::add
bool add(int phi, int side, Wafer &wafer)
Definition: WaferTree.cxx:22
PhiModule::nPhiModules
int nPhiModules() const
Definition: WaferTree.h:47
PhiModule
Definition: WaferTree.h:43
BarrelEndcap::nParts
int nParts() const
Definition: WaferTree.h:69
EtaModule::add
bool add(int eta, int phi, int side, Wafer &wafer)
Definition: WaferTree.cxx:33
geometry_dat_to_json.ld
ld
Definition: geometry_dat_to_json.py:14
WaferTree
Definition: WaferTree.h:74