120 for (
int sn=0; sn<=snMax; sn++) {
126 std::string stationTech;
127 switch(stationName[0]) {
148 if (stationTech ==
"TGC") {
149 if (stationName[2] ==
'E' && stationName[1] !=
'4') {
160 std::vector<const MuonGM::MuonStation *> *stations =
new std::vector<const MuonGM::MuonStation *>;
170 if (station) stations->push_back(station);
174 while (stations->size() > 0) {
179 HepGeom::Point3D<double> pos1 =
getPosition(station1, maxPhi);
182 double shift1 =
getShift(pos1, dphi1);
186 double signed_dz = station1->
Zsize()/2.;
187 if (pos1.z()<0) signed_dz *= -1;
188 double zi1 = pos1.z() - signed_dz;
189 double zo1 = pos1.z() + signed_dz;
190 double ri1 = pos1.perp() - station1->
Rsize()/2.;
191 double ro1 = pos1.perp() + station1->
Rsize()/2.;
192 double wi1 = station1->
Ssize();
196 std::string phiString =
DataType(phi1).toString();
199 stations->erase(stations->end()-1, stations->end());
203 std::vector<const MuonGM::MuonStation *>::iterator it;
204 for (it=stations->end()-1; it>=stations->begin(); --it) {
205 HepGeom::Point3D<double> pos2 =
getPosition(*it, maxPhi);
206 int phi2 = (*it)->getPhiIndex();
208 double shift2 =
getShift(pos2, dphi2);
211 double signed_dz2 = (*it)->Zsize()/2.;
212 if (pos2.z()<0) signed_dz2 *= -1;
213 double zi2 = pos2.z() - signed_dz2;
214 double zo2 = pos2.z() + signed_dz2;
215 double ri2 = pos2.perp() - (*it)->Rsize()/2.;
216 double ro2 = pos2.perp() + (*it)->Rsize()/2.;
217 double wi2 = (*it)->Ssize();
218 double wo2 = (*it)->LongSsize();
235 phiString +=
" " +
DataType(phi2).toString();
237 stations->erase(it, it+1);
242 if (stationName[0] ==
'B') {
250 if (stationName[1] ==
'M') {
253 }
else if (stationName[1] ==
'O') {
255 if (stationName[2] ==
'S') {
262 }
else if (stationName[1] ==
'I' &&
eta==7 && wi1>1800) {
268 out <<
"<ABox n=\"" << stationTech <<
"_" << stationName <<
"\""
269 <<
" zi=\"" << zi1/10. <<
"\"" <<
" zo=\"" << zo1/10. <<
"\""
270 <<
" ri=\"" << ri1/10. <<
"\"" <<
" ro=\"" << ro1/10. <<
"\""
271 <<
" w=\"" << wi1/10. <<
"\""
272 <<
" eta=\"" <<
eta <<
"\""
273 <<
" phi=\"" << phiString <<
"\"";
277 out <<
" dphi=\"" << 180/
M_PI * dphi1 <<
"\"";
281 out <<
" sh=\"" << shift1/10. <<
"\"";
285 out <<
" RPCi=\"" << rpci <<
"\"";
287 out <<
" RPCo=\"" << rpco <<
"\"";
288 out <<
" />" << std::endl;
293 writeATrd(out, stationTech, stationName, zi1, zo1, ri1, ro1, wi1, wo1,
eta, phiString, dphi1, shift1, alpha1);
399 if (
detStore()->retrieve(theExpt,
"ATLAS").isFailure()) {
400 ATH_MSG_ERROR(
"Could not retrieve the ATLAS GeoModelExperiment from detector store" );
405 GeoVolumeCursor av(world);
406 while (!av.atEnd()) {
407 if ( av.getName()==
"Muon") {
408 GeoVolumeCursor pv(av.getVolume());
409 while (!pv.atEnd()) {
410 if (pv.getVolume()->getLogVol()->getName()==
"NewSmallWheel") {
412 GeoVolumeCursor pvnsw(pv.getVolume());
414 while (!pvnsw.atEnd()){
415 std::string stationName = pvnsw.getVolume()->getLogVol()->getName();
418 if (stationName==
"NSW_MM"){
421 GeoVolumeCursor pvnswsub(pvnsw.getVolume());
422 bool newChamber =
true;
423 std::string phiString =
"";
424 std::string phiString_mirrorEta =
"";
425 double dphi=0, shift=0, zi=0, zo=0, ri=0, ro=0, wi=0, wo=0;
426 std::string chamberName=
"";
427 HepGeom::Point3D<double> pos_rot;
429 while (!pvnswsub.atEnd()){
430 if (((pvnswsub.getVolume()->getLogVol())->getShape())->typeID() == GeoTrd::getClassTypeID() ) {
435 readNSWMMPars(&pvnswsub, maxPhi, chamberName, pos_rot, zi, zo, ri, ro, wi, wo, dphi, shift, phiIndex);
436 phiString =
DataType(phiIndex).toString();
443 std::string chamberName2;
444 HepGeom::Point3D<double> pos_rot2;
445 double zi2, zo2, ri2, ro2, wi2, wo2, dphi2, shift2;
447 readNSWMMPars(&pvnswsub, maxPhi, chamberName2, pos_rot2, zi2, zo2, ri2, ro2, wi2, wo2, dphi2, shift2, phiIndex2);
449 if (chamberName != chamberName2
465 std::string stationPhi =
DataType(phiIndex2).toString();
466 if (phiString.find(stationPhi) == std::string::npos) phiString +=
" " + stationPhi;
469 else if (pos_rot.distance(HepGeom::Point3D<double>(pos_rot2.x(), pos_rot2.y(), -pos_rot2.z())) <
m_smallDistance
474 std::string stationPhi =
DataType(phiIndex2).toString();
475 if (phiString_mirrorEta.find(stationPhi) == std::string::npos){
476 if (not phiString_mirrorEta.empty()) phiString_mirrorEta +=
" ";
477 phiString_mirrorEta += stationPhi;
490 if (phiString!=
"" && (newChamber || pvnswsub.atEnd())){
494 std::string stationTech =
"MM";
495 std::string stationName =
"MM"+chamberName.substr(7,1);
496 int eta = std::stoi(chamberName.substr(8,1));
497 writeATrd(out, stationTech, stationName, zi, zo, ri, ro, wi, wo,
eta, phiString, dphi, shift, 0);
498 if (phiString_mirrorEta!=
"") {
499 writeATrd(out, stationTech, stationName, -zi, -zo, ri, ro, wi, wo, -
eta, phiString_mirrorEta, dphi, shift, 0);
503 phiString_mirrorEta =
"";
514 else if (stationName==
"NSW_sTGC"){
518 GeoVolumeCursor pvnswsub(pvnsw.getVolume());
519 bool newChamber =
true;
520 std::string phiString =
"";
521 std::string phiString_mirrorEta =
"";
523 double dz=0, dphi=0, shift=0;
524 std::string chamberName=
"";
525 HepGeom::Point3D<double> pos_rot;
526 const GeoSimplePolygonBrep* theBrep =
nullptr;
528 while (!pvnswsub.atEnd()){
529 if (((pvnswsub.getVolume()->getLogVol())->getShape())->typeID() == GeoShapeShift::getClassTypeID() ) {
535 readNSWSTGCPars(&pvnswsub, maxPhi, chamberName, pos_rot, theBrep, nvtx, dz, dphi, shift, phiIndex);
536 phiString =
DataType(phiIndex).toString();
544 std::string chamberName2;
545 HepGeom::Point3D<double> pos_rot2;
546 const GeoSimplePolygonBrep* theBrep2;
547 int nvtx2, phiIndex2;
548 double dz2, dphi2, shift2;
549 readNSWSTGCPars(&pvnswsub, maxPhi, chamberName2, pos_rot2, theBrep2, nvtx2, dz2, dphi2, shift2, phiIndex2);
552 bool isSameShape =
true;
554 for (
int i=0; i<nvtx; ++i){
555 if ( !
equalLength(theBrep->getXVertex(i), theBrep2->getXVertex(i))
556 || !
equalLength(theBrep->getYVertex(i), theBrep2->getYVertex(i)) )
567 if (chamberName != chamberName2
579 std::string stationPhi =
DataType(phiIndex2).toString();
580 if (phiString.find(stationPhi) == std::string::npos) phiString +=
" " + stationPhi;
583 else if (pos_rot.distance(HepGeom::Point3D<double>(pos_rot2.x(), pos_rot2.y(), -pos_rot2.z())) <
m_smallDistance) {
585 std::string stationPhi =
DataType(phiIndex2).toString();
586 if (phiString_mirrorEta.find(stationPhi) == std::string::npos) {
587 if (not phiString_mirrorEta.empty()) phiString_mirrorEta +=
" ";
588 phiString_mirrorEta += stationPhi;
600 if (phiString!=
"" && (newChamber || pvnswsub.atEnd())){
604 std::string stationTech =
"STGC";
605 std::string stationName =
"ST"+chamberName.substr(8,1);
606 int eta = std::stoi(chamberName.substr(9,1));
607 double signed_dz = dz;
608 if (pos_rot.z()<0) dz *= -1;
609 double zi = pos_rot.z() - signed_dz;
610 double zo = pos_rot.z() + signed_dz;
611 double rho = pos_rot.perp();
612 double ri, ro, wi, wo;
618 const int vtxList[] = {0, 1, 2, 3};
620 writeATrd(out, stationTech, stationName, zi, zo, ri, ro, wi, wo,
eta, phiString, dphi, shift, 0);
621 if (phiString_mirrorEta!=
"") {
622 writeATrd(out, stationTech, stationName, -zi, -zo, ri, ro, wi, wo, -
eta, phiString_mirrorEta, dphi, shift, 0);
634 const int vtxList1[] = {5, 2, 3, 4};
636 writeATrd(out, stationTech, stationName, zi, zo, ri, ro, wi, wo,
eta, phiString, dphi, shift, 0);
637 if (phiString_mirrorEta!=
"") {
638 writeATrd(out, stationTech, stationName, -zi, -zo, ri, ro, wi, wo, -
eta, phiString_mirrorEta, dphi, shift, 0);
642 const int vtxList2[] = {0, 1, 2, 5};
644 writeATrd(out, stationTech, stationName, zi, zo, ri, ro, wi, wo,
eta, phiString, dphi, shift, 0);
645 if (phiString_mirrorEta!=
"") {
646 writeATrd(out, stationTech, stationName, -zi, -zo, ri, ro, wi, wo, -
eta, phiString_mirrorEta, dphi, shift, 0);
652 ATH_MSG_ERROR(
"Shape not supported by GeometryJiveXML: polygon shape with "<<nvtx <<
" verticies in NSW sTGC." );
655 phiString_mirrorEta =
"";