126 const std::map<std::string, std::string> ¶meters)
133 double thickness{0.320};
141 std::string carrierString;
142 getParameter(typeName, parameters,
"carrierType", carrierString);
143 if (carrierString ==
"electrons") {
145 }
else if (carrierString ==
"holes") {
148 throw GaudiException(
"Parameter carrierType should be electrons or holes for " + typeName,
149 "StripGmxInterface::makeSiStripBox", StatusCode::FAILURE);
152 std::string readoutSideString;
153 getParameter(typeName, parameters,
"readoutSide", readoutSideString);
154 if (readoutSideString ==
"+") {
156 }
else if (readoutSideString ==
"-") {
159 throw GaudiException(
"Parameter readoutSide should be + or - for " + typeName,
160 "StripGmxInterface::makeSiStripBox", StatusCode::FAILURE);
163 std::string fieldDirectionString;
164 getParameter(typeName, parameters,
"fieldDirection", fieldDirectionString);
165 if (fieldDirectionString ==
"x") {
167 }
else if (fieldDirectionString ==
"y") {
169 }
else if (fieldDirectionString ==
"z") {
172 throw GaudiException(
"Parameter fieldDirection should be x, y, or z for " + typeName,
173 "StripGmxInterface::makeSiStripBox", StatusCode::FAILURE);
176 std::string stripDirectionString;
177 getParameter(typeName, parameters,
"stripDirection", stripDirectionString);
178 if (stripDirectionString ==
"x") {
180 }
else if (stripDirectionString ==
"y") {
182 }
else if (stripDirectionString ==
"z") {
185 throw GaudiException(
"Parameter stripDirection should be x, y, or z for " + typeName,
186 "StripGmxInterface::makeSiStripBox", StatusCode::FAILURE);
189 getParameter(typeName, parameters,
"thickness", thickness);
190 getParameter(typeName, parameters,
"nRows", nRows);
191 getParameter(typeName, parameters,
"nStrips", nStrips);
192 getParameter(typeName, parameters,
"pitch", pitch);
193 getParameter(typeName, parameters,
"stripLength",
length);
198 int detectorTypeEnum = 0;
199 if (checkParameter(typeName, parameters,
"detectorType", detectorTypeEnum)) {
201 else ATH_MSG_WARNING(
"Non-strip barrel type set for strip box DetectorElement - is this intended?");
210 if (checkParameter(typeName, parameters,
"splitLevel", splitLevel)) {
212 double initZShift =
length * (-
static_cast<double>(splitLevel) * 0.5 + 0.5);
217 auto motherDesign = std::make_unique<StripBoxDesign>(stripDirection,
228 for (
int i = 0; i< splitLevel; i++) {
229 for (
int side : {0,1}) {
230 int sign = (side == 0) ? 1 : -1;
231 double zShift =
sign * (initZShift + (i *
length));
233 auto design = std::make_unique<StripBoxDesign>(stripDirection,
245 design->setMother(motherDesign.get());
246 motherDesign->addChildDesign(i,design.get());
248 std::string splitName = typeName +
"_" + std::to_string(i) +
"_" + std::to_string(side);
257 auto design = std::make_unique<StripBoxDesign>(stripDirection,
276 const std::map<std::string, std::string> ¶meters)
285 double thickness{0.320};
286 double stereoAngle{0.020};
287 double centreR{500.};
289 std::vector <int> nStrips;
290 std::vector<double> phiPitch;
291 std::vector<double> startR;
292 std::vector<double> endR;
295 std::string carrierString;
296 getParameter(typeName, parameters,
"carrierType", carrierString);
297 if (carrierString ==
"electrons") {
299 }
else if (carrierString ==
"holes") {
302 throw GaudiException(
"Parameter carrierType should be electrons or holes for " + typeName,
303 "StripGmxInterface::makeStereoAnnulus", StatusCode::FAILURE);
306 std::string readoutSideString;
307 getParameter(typeName, parameters,
"readoutSide", readoutSideString);
308 if (readoutSideString ==
"+") {
310 }
else if (readoutSideString ==
"-") {
313 throw GaudiException(
"Parameter readoutSide should be + or - for " + typeName,
314 "StripGmxInterface::makeStereoAnnulus", StatusCode::FAILURE);
317 std::string fieldDirectionString;
318 getParameter(typeName, parameters,
"fieldDirection", fieldDirectionString);
319 if (fieldDirectionString ==
"x") {
321 }
else if (fieldDirectionString ==
"y") {
323 }
else if (fieldDirectionString ==
"z") {
326 throw GaudiException(
"Parameter fieldDirection should be x, y, or z for " + typeName,
327 "StripGmxInterface::makeStereoAnnulus", StatusCode::FAILURE);
330 std::string stripDirectionString;
331 getParameter(typeName, parameters,
"stripDirection", stripDirectionString);
332 if (stripDirectionString ==
"x") {
334 }
else if (stripDirectionString ==
"y") {
336 }
else if (stripDirectionString ==
"z") {
339 throw GaudiException(
"Parameter stripDirection should be x, y, or z for " + typeName,
340 "StripGmxInterface::makeStereoAnnulus", StatusCode::FAILURE);
343 getParameter(typeName, parameters,
"thickness", thickness);
344 getParameter(typeName, parameters,
"stereoAngle", stereoAngle);
345 getParameter(typeName, parameters,
"centreR", centreR);
346 getParameter(typeName, parameters,
"nRows", nRows);
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);
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);
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);
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);
372 if (checkParameter(typeName, parameters,
"usePC", usePC))
ATH_MSG_INFO(
"Using polar co-ordinates for strip stereo annulus modules");
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?");
387 std::vector<int> singleRowStrips;
388 std::vector<double> singleRowPitch;
389 std::vector<double> singleRowMinR;
390 std::vector<double> singleRowMaxR;
393 if (checkParameter(typeName, parameters,
"splitLevel", splitLevel)) {
395 auto motherDesign = std::make_unique<StripStereoAnnulusDesign>(stripDirection,
410 for (
int i = 0; i < splitLevel; i++) {
411 singleRowStrips.clear();
412 singleRowPitch.clear();
413 singleRowMinR.clear();
414 singleRowMaxR.clear();
416 singleRowStrips.push_back(nStrips[i]);
417 singleRowPitch.push_back(phiPitch[i]);
418 singleRowMinR.push_back(startR[i]);
419 singleRowMaxR.push_back(endR[i]);
423 double thisCentreR = (singleRowMinR[0] + singleRowMaxR[0] ) *0.5;
425 auto design = std::make_unique<StripStereoAnnulusDesign>(stripDirection,
442 std::string splitName = typeName +
"_" + std::to_string(i);
443 design->setMother(motherDesign.get());
444 motherDesign->addChildDesign(i,design.get());
456 auto design = std::make_unique<StripStereoAnnulusDesign>(stripDirection,
477 std::map<std::string, int> &
index,
478 std::pair<std::string, int> &extraIndex,
480 GeoVFullPhysVol *fpv,
483 std::map<std::string, int> updatedIndex;
485 int splitIndex = extraIndex.second;
490 if (not sctIdHelper){
491 ATH_MSG_ERROR(
"Failed dynamic cast to SCT_ID in StripGmxInterface::addSplitSensor");
495 updatedIndex[
"layer_wheel"],
496 updatedIndex[
"phi_module"],
497 updatedIndex[
"eta_module"],
498 updatedIndex[
"side"]);
507 ATH_MSG_ERROR(
"Invalid id for sensitive wafer " << typeName <<
" volume with indices");
508 for (
const auto& [key, value] :
index) {
509 msg() << MSG::ERROR << key <<
" = " << value <<
"; ";
512 ATH_MSG_ERROR(
"Refusing to make it into a sensitive element. Incompatible gmx and identifier-xml files.");
519 std::string splitTypeName = typeName +
"_" + std::to_string(splitIndex);
520 if (updatedIndex[
"barrel_endcap"] == 0) {
521 splitTypeName +=
"_" + std::to_string(updatedIndex[
"side"]);
526 ATH_MSG_ERROR(
"addSplitSensor: Error: Readout sensor type " << typeName <<
" not found.");
527 throw std::runtime_error(
"readout sensor type " + typeName +
" not found.");
536 Wafer wafer((
unsigned int) hashId);
537 std::string errorMessage(
"");
538 if (!
m_waferTree->add(updatedIndex[
"barrel_endcap"],
539 updatedIndex[
"layer_wheel"],
540 updatedIndex[
"eta_module"],
541 updatedIndex[
"phi_module"],
542 updatedIndex[
"side"],
729 const std::array<std::string,13> stereoAnnulusParamNames{
"thickness",
"carrierType",
"readoutSide",
"fieldDirection",
"stripDirection",
"stereoAngle",
"centreR",
"nRows",
"splitLevel",
"nStrips",
"phiPitch",
"startR",
"endR"};
731 if(stereoAnnulus->
size() !=0){
732 for (
unsigned int iR =0;iR<stereoAnnulus->
size();iR++){
733 std::map<std::string,std::string> stereoAnnulusMap;
734 for(
const std::string& paramName:stereoAnnulusParamNames){
735 stereoAnnulusMap[paramName] = (*stereoAnnulus)[iR]->getString(paramName);
737 std::string stereoAnnulusName = (*stereoAnnulus)[iR]->getString(
"SensorType");
744 const std::array<std::string,10> stripBoxParamNames{
"thickness",
"carrierType",
"readoutSide",
"fieldDirection",
"stripDirection",
"nRows",
"stripLength",
"splitLevel",
"nStrips",
"pitch"};
746 if(stripBox->
size() !=0){
747 for (
unsigned int iR =0;iR<stripBox->
size();iR++){
748 std::map<std::string,std::string> stripBoxMap;
749 for(
const std::string& paramName:stripBoxParamNames){
750 std::string paramValue = (*stripBox)[iR]->getString(paramName);
751 stripBoxMap[paramName] = std::move(paramValue);
753 std::string stripBoxName = (*stripBox)[iR]->getString(
"SensorType");
761 const std::array<std::string,5> fields{
"barrel_endcap",
"layer_wheel",
"phi_module",
"eta_module",
"side"};
764 const std::array<std::string,3> publishers{
"ITk",
"ITkStrip",
"GeoModelXML"};
767 std::map<std::string, GeoFullPhysVol*> mapFPV;
768 for (
auto & iPub : publishers){
770 mapFPV = sqlreader->getPublishedNodes<std::string, GeoFullPhysVol*>(iPub,
true);
771 if (!mapFPV.empty()) {
776 if (mapFPV.empty())
ATH_MSG_ERROR(
"Could not find any FPV tables under the expected names: "<<publishers);
777 for (
const auto&[fullPhysVolInfoString, fullPhysVolPointer] : mapFPV){
779 size_t startRG = fullPhysVolInfoString.find(
"RG_");
780 if(startRG==std::string::npos){
781 ATH_MSG_DEBUG(
"GeoFullPhysVol "<<fullPhysVolInfoString<<
" does not have the expected format. Skipping");
784 std::string typeName = fullPhysVolInfoString.substr(startRG);
785 std::map<std::string, int>
index;
786 for (
const std::string & field:fields){
787 size_t first = fullPhysVolInfoString.find(field+
"_");
788 size_t last = fullPhysVolInfoString.find(
'_',first+field.size()+1);
789 if(first==std::string::npos || last==std::string::npos){
790 ATH_MSG_DEBUG(
"Could not extract "<<field<<
" from "<<fullPhysVolInfoString<<
". Skipping");
793 std::string strNew = fullPhysVolInfoString.substr(first+field.size()+1,last-(first+field.size()+1));
794 index[field] = std::stoi(strNew);
797 size_t splitPos = fullPhysVolInfoString.find(
"split_");
798 if(splitPos!=std::string::npos){
799 size_t last = fullPhysVolInfoString.find(
'_',splitPos+6);
800 std::string strNew = fullPhysVolInfoString.substr(splitPos+6,last-(splitPos+6));
801 int splitLevel = std::stoi(strNew);
802 for(
int i=0;i<splitLevel;i++){
803 std::string field =
"eta_module";
804 std::pair<std::string,int> extraIndex(field,i);