ATLAS Offline Software
Loading...
Searching...
No Matches
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
25static thread_local std::ostringstream errmsg;
26
27class Wafer {
28public:
29 Wafer(int unsigned hashId): m_hashId(hashId) {}
30 unsigned int hashId() {return m_hashId;}
31 void setHashId(unsigned int hashId) {m_hashId = hashId;}
32private:
33 unsigned int m_hashId;
34};
35
36class Side: public std::map<int, Wafer> {
37public:
38 bool add(int side, Wafer &wafer);
39 Wafer & operator[](int side) {return at(side);}
40 int nSides() const {return size();}
41};
42
43class PhiModule: public std::map<int, Side> {
44public:
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
50class EtaModule: public std::map<int, PhiModule> {
51public:
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
57class LayerDisk: public std::map<int, EtaModule> {
58public:
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
64class BarrelEndcap: public std::map<int, LayerDisk> {
65public:
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
74class WaferTree: public BarrelEndcap { // Just a more descriptive name for the class.
75};
76
77#endif
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
static thread_local std::ostringstream errmsg
Definition WaferTree.h:25
int nParts() const
Definition WaferTree.h:69
bool add(int bec, int ld, int eta, int phi, int side, Wafer &wafer, std::string &errorMessage)
Definition WaferTree.cxx:55
LayerDisk & operator[](int bec)
Definition WaferTree.h:68
bool add(int eta, int phi, int side, Wafer &wafer)
Definition WaferTree.cxx:33
int nEtaModules() const
Definition WaferTree.h:54
PhiModule & operator[](int eta)
Definition WaferTree.h:53
int nLayers() const
Definition WaferTree.h:61
EtaModule & operator[](int ld)
Definition WaferTree.h:60
bool add(int ld, int eta, int phi, int side, Wafer &wafer)
Definition WaferTree.cxx:44
Side & operator[](int phi)
Definition WaferTree.h:46
bool add(int phi, int side, Wafer &wafer)
Definition WaferTree.cxx:22
int nPhiModules() const
Definition WaferTree.h:47
Wafer & operator[](int side)
Definition WaferTree.h:39
int nSides() const
Definition WaferTree.h:40
bool add(int side, Wafer &wafer)
Definition WaferTree.cxx:9
unsigned int m_hashId
Definition WaferTree.h:33
Wafer(int unsigned hashId)
Definition WaferTree.h:29
void setHashId(unsigned int hashId)
Definition WaferTree.h:31
unsigned int hashId()
Definition WaferTree.h:30