31 ATH_MSG_FATAL(
"Please don't call this tool if usePixel and useSCT are false");
32 return StatusCode::FAILURE;
40 return StatusCode::SUCCESS;
49 return StatusCode::SUCCESS;
63 if (writeHandle.isValid()) {
64 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.fullKey() <<
" is already valid."
65 <<
". In theory this should not be called, but may happen"
66 <<
" if multiple concurrent events are being processed out of order.");
67 return StatusCode::SUCCESS;
70 std::unique_ptr<SiDetElementsLayerVectors_xk> writeCdo{std::make_unique<SiDetElementsLayerVectors_xk>(3)};
72 std::vector<const InDetDD::SiDetectorElement*> pW[3];
78 if (not pixelDetEleHandle.
isValid() or pixelDetEle==
nullptr) {
80 return StatusCode::FAILURE;
83 if (
s->isBarrel() ) pW[1].push_back(
s);
84 else if (
s->center().z() > 0.) pW[2].push_back(
s);
85 else pW[0].push_back(
s);
88 writeHandle.addDependency(pixelDetEleHandle);
95 if (not sctDetEleHandle.
isValid() or sctDetEle==
nullptr) {
97 return StatusCode::FAILURE;
100 if (
s->isBarrel() ) pW[1].push_back(
s);
101 else if (
s->center().z() > 0.) pW[2].push_back(
s);
102 else pW[0].push_back(
s);
105 writeHandle.addDependency(sctDetEleHandle);
108 int nel = pW[0].size()+pW[1].size()+pW[2].size();
111 return StatusCode::SUCCESS;
118 for(
int N=0;
N<3; ++
N) {
121 int im =
static_cast<int>(pW[
N].size())-1;
126 for (
int i = 0;
i<=
im; ++
i) {
134 if (fabs(
r-r0) > 10.) {
139 if (fabs(
z-
z0) > 10.) {
153 double rmin = 100000., rmax =-100000.;
154 double zmin = 100000.,
zmax =-100000.;
157 std::vector<const InDetDD::SiDetectorElement*> pE;
158 for (
int j=If; j<=Il; ++j) pE.push_back(pW[
N][j]);
163 for (
auto & j : pE) {
169 if (
P[ 9] < rmin ) rmin =
P[ 9];
170 if (
P[10] > rmax ) rmax =
P[10];
174 double df1 = fabs(
P[13]-
P[2]);
175 if (df1>
pi) df1 = fabs(df1-
pi2);
176 double df2 = fabs(
P[14]-
P[2]);
177 if (df2>
pi) df2 = fabs(df2-
pi2);
178 if (df1>dfm) dfm = df1;
179 if (df2>dfm) dfm = df2;
185 layer.sortDetectorElements();
186 double r =(rmax+rmin)*.5;
187 double dr =(rmax-rmin)*.5;
191 (writeCdo->at(
N)).push_back(
layer);
198 if (writeHandle.record(std::move(writeCdo)).isFailure()) {
200 <<
" with EventRange " << writeHandle.getRange()
201 <<
" into Conditions Store");
202 return StatusCode::FAILURE;
204 ATH_MSG_DEBUG(
"recorded new CDO " << writeHandle.key() <<
" with range " << writeHandle.getRange() <<
" into Conditions Store");
206 return StatusCode::SUCCESS;