287{
288
289
290
291 int readoutSide{1};
292
294 double thickness{0.320};
295 double stereoAngle{0.020};
296 double centreR{500.};
299 std::vector<double> phiPitch;
300 std::vector<double> startR;
301 std::vector<double> endR;
302 bool usePC{false};
303
304 std::string carrierString;
305 getParameter(typeName, parameters,
"carrierType", carrierString);
306 if (carrierString == "electrons") {
308 } else if (carrierString == "holes") {
310 } else {
311 throw GaudiException("Parameter carrierType should be electrons or holes for " + typeName,
312 "StripGmxInterface::makeStereoAnnulus", StatusCode::FAILURE);
313 }
314
315 std::string readoutSideString;
316 getParameter(typeName, parameters,
"readoutSide", readoutSideString);
317 if (readoutSideString == "+") {
318 readoutSide = 1;
319 } else if (readoutSideString == "-") {
320 readoutSide = -1;
321 } else {
322 throw GaudiException("Parameter readoutSide should be + or - for " + typeName,
323 "StripGmxInterface::makeStereoAnnulus", StatusCode::FAILURE);
324 }
325
326 std::string fieldDirectionString;
327 getParameter(typeName, parameters,
"fieldDirection", fieldDirectionString);
328 auto fieldDirectionOptional =
direction(fieldDirectionString);
329 if (!fieldDirectionOptional){
330 throw GaudiException("Parameter fieldDirection should be x, y, or z for " + typeName,
331 "StripGmxInterface::makeStereoAnnulus", StatusCode::FAILURE);
332 }
333 const auto fieldDirection = *fieldDirectionOptional;
334
335 std::string stripDirectionString;
336 getParameter(typeName, parameters,
"stripDirection", stripDirectionString);
337 auto stripDirectionOptional =
direction(stripDirectionString);
338 if (!stripDirectionOptional){
339 throw GaudiException("Parameter stripDirection should be x, y, or z for " + typeName,
340 "StripGmxInterface::makeStereoAnnulus", StatusCode::FAILURE);
341 }
342 const auto stripDirection = *stripDirectionOptional;
343 getParameter(typeName, parameters,
"thickness", thickness);
344 getParameter(typeName, parameters,
"stereoAngle", stereoAngle);
347
348 getParameters(typeName, parameters, "nStrips", nStrips);
349 if (
nStrips.size() !=
static_cast<size_t>(nRows)) {
350 throw GaudiException(
"Wrong number of nStrips " + std::to_string(
nStrips.size()) +
" " + typeName,
351 "StripGmxInterface::makeStereoAnnulus", StatusCode::FAILURE);
352 }
353
354 getParameters(typeName, parameters, "phiPitch", phiPitch);
355 if (phiPitch.size() != static_cast<size_t>(nRows)) {
356 throw GaudiException("Wrong number of pitches " + std::to_string(phiPitch.size()) + " " + typeName,
357 "StripGmxInterface::makeStereoAnnulus", StatusCode::FAILURE);
358 }
359
360 getParameters(typeName, parameters, "startR", startR);
361 if (startR.size() != static_cast<size_t>(nRows)) {
362 throw GaudiException("Wrong number of startRs " + std::to_string(startR.size()) + " " + typeName,
363 "StripGmxInterface::makeStereoAnnulus", StatusCode::FAILURE);
364 }
365
366 getParameters(typeName, parameters, "endR", endR);
367 if (endR.size() != static_cast<size_t>(nRows)) {
368 throw GaudiException("Wrong number of endRs " + std::to_string(endR.size()) + " " + typeName,
369 "StripGmxInterface::makeStereoAnnulus", StatusCode::FAILURE);
370 }
371
372 if (checkParameter(typeName, parameters,
"usePC", usePC))
ATH_MSG_INFO(
"Using polar co-ordinates for strip stereo annulus modules");
373
374
375
376
378 int detectorTypeEnum = 0;
379 if (checkParameter(typeName, parameters, "detectorType", detectorTypeEnum)) {
381 else ATH_MSG_WARNING(
"Non-strip endcap type set for strip annulus DetectorElement - is this intended?");
382 }
383
384
385
386
387 std::vector<int> singleRowStrips;
388 std::vector<double> singleRowPitch;
389 std::vector<double> singleRowMinR;
390 std::vector<double> singleRowMaxR;
391
392 int splitLevel{};
393 if (checkParameter(typeName, parameters, "splitLevel", splitLevel)) {
394
395 auto motherDesign = std::make_unique<StripStereoAnnulusDesign>(stripDirection,
396 fieldDirection,
397 thickness,
398 readoutSide,
399 carrier,
400 nRows,
401 nStrips,
402 phiPitch,
403 startR,
404 endR,
405 stereoAngle,
406 centreR,
407 usePC,
408 detectorType);
409
410 for (
int i = 0;
i < splitLevel;
i++) {
411 singleRowStrips.clear();
412 singleRowPitch.clear();
413 singleRowMinR.clear();
414 singleRowMaxR.clear();
415
416 singleRowStrips.push_back(nStrips[i]);
417 singleRowPitch.push_back(phiPitch[i]);
418 singleRowMinR.push_back(startR[i]);
419 singleRowMaxR.push_back(endR[i]);
420
421
422
423 double thisCentreR = (singleRowMinR[0] + singleRowMaxR[0] ) *0.5;
424
425 auto design = std::make_unique<StripStereoAnnulusDesign>(stripDirection,
426 fieldDirection,
427 thickness,
428 readoutSide,
429 carrier,
430 1,
431 singleRowStrips,
432 singleRowPitch,
433 singleRowMinR,
434 singleRowMaxR,
435 stereoAngle,
436 thisCentreR,
437 centreR,
438 usePC,
439 detectorType);
440
441
442 std::string splitName =
typeName +
"_" + std::to_string(i);
443 design->setMother(motherDesign.get());
444 motherDesign->addChildDesign(i,design.get());
445
448
449 }
450
451
454
455 } else {
456 auto design = std::make_unique<StripStereoAnnulusDesign>(stripDirection,
457 fieldDirection,
458 thickness,
459 readoutSide,
460 carrier,
461 nRows,
462 nStrips,
463 phiPitch,
464 startR,
465 endR,
466 stereoAngle,
467 centreR,
468 usePC,
469 detectorType);
470
473 }
474}