26{
28
29
31
32
35
36
38
39
40
42 if (curRZ->size()==0) {
43 ATH_MSG_ERROR(
"Unable to create volume representation for geoID="<<geoID);
44 return StatusCode::FAILURE;
45 }
46 ATH_MSG_VERBOSE(
"Found " << curRZ->size() <<
" (r,z) pairs with positive z for geoID=" << geoID);
47
48
49
50
51
52
53
54
55
56
57 ATH_MSG_DEBUG(
"Preparing " << curRZ->size() <<
" (r,z) pairs with positive z for geoID=" << geoID);
58 while ( curRZ->size()) {
59
60 double maxR = std::max( curRZ->front().first , curRZ->back().first );
61 double zFront = curRZ->front().second;
62 double zBack = curRZ->back().second;
63 double minZ = std::min( zFront, zBack);
64
65 ATH_MSG_VERBOSE(
" minz=" << minZ <<
" zBack="<<zBack<<
" zFront="<<zFront<<
" maxR="<<maxR<<
" curRZ->size()="<<curRZ->size());
66
67
68
69 if (zFront<zBack) curRZ->pop_front();
70 else if (zBack<zFront) curRZ->pop_back();
71 else {
72
73 curRZ->pop_front();
74 if (curRZ->size()>0) curRZ->pop_back();
75 }
76
77
78 size_t curZBin = tmpZBins[geoID].size();
79
80 if ( (curZBin>0) && ( fabs(tmpZBins[geoID][curZBin-1]-minZ) <
m_tolerance) )
continue;
81
82 tmpZBins[geoID].push_back(minZ);
83
84
85
86
87
88
91
92 tmpRBins[geoID][curZBin] = maxR*maxR;
93 }
94 }
95
96 ATH_MSG_DEBUG(
"Combining individual volumen boundaries in one common representation");
97
98
99
102 tmpZBinIndex[geoID] = 0;
103 std::vector<double> tmpZBinsGlobal;
104 std::map< size_t, RadiusGeoIDPairSet > tmpRBinsGlobal;
106 double minZ = 1e99;
107 double prevMinZ;
108 while (true) {
110
111
112
113 do {
115 prevMinZ = minZ;
116 minZ = 1e99;
117 curRadiusGeoIDs.clear();
118
119
121 size_t curTmpZBinIndex = tmpZBinIndex[geoID];
122
123
124 if ( curTmpZBinIndex >= tmpZBins[geoID].size()) continue;
125 double curZ = tmpZBins[geoID][curTmpZBinIndex];
126
128 (tmpZBinIndex[geoID])++;
129 }
130
131
132
133 else if ( curZ<minZ) {
134 minZ = curZ;
136 }
137 double curR2 = tmpRBins[geoID][curTmpZBinIndex];
138
140 " geoID=" << geoID << " for minZ<=" << minZ);
142 }
143
144 (tmpZBinIndex[minZGeoID])++;
146
147
148 if ( curRadiusGeoIDs.size()==0) break;
150 " curRadiusGeoIDs.size()=" << curRadiusGeoIDs.size() );
151
152
153 size_t curZBinGlobal = tmpZBinsGlobal.size();
154 tmpZBinsGlobal.push_back(minZ);
155 tmpRBinsGlobal[curZBinGlobal] = curRadiusGeoIDs;
156 };
157
158 ATH_MSG_DEBUG(
"Converting volume representation into faster format");
159
160
164
168
169 RadiusGeoIDPairSet::iterator radIt = tmpRBinsGlobal[
i].begin();
170 RadiusGeoIDPairSet::iterator radItEnd = tmpRBinsGlobal[
i].end();
171 size_t ii = 0;
172 for ( ; radIt!=radItEnd; ++radIt) {
173 double curR = sqrt((*radIt).first);
174
176
178 " --> geoID=" << (*radIt).second);
180 }
181
183 };
184
185 return StatusCode::SUCCESS;
186}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
ServiceHandle< IEnvelopeDefSvc > m_envDefSvc
service providing the envelope dimensions for the different sub-detectors
std::unique_ptr< RZPairList > prepareRZPairs(AtlasDetDescr::AtlasRegion geoID)
std::set< RadiusGeoIDPair, SortByRadius > RadiusGeoIDPairSet
std::pair< double, AtlasDetDescr::AtlasRegion > RadiusGeoIDPair