13#ifndef MUONGEOMODEL_DBREADER_H
14#define MUONGEOMODEL_DBREADER_H
19#include "GaudiKernel/SystemOfUnits.h"
104#define verbose_posmap false
105#define verbose_alimap false
106#define RPCprint false
111 class MuonDetectorManager;
140 static std::atomic<int>
nmdt{0};
141 static std::atomic<int>
nrpc{0};
142 static std::atomic<int>
ntgc{0};
143 static std::atomic<int>
ncsc{0};
144 static std::atomic<int>
nspa{0};
145 static std::atomic<int>
nded{0};
146 static std::atomic<int>
nsup{0};
147 static std::atomic<int>
nchv{0};
148 static std::atomic<int>
ncro{0};
149 static std::atomic<int>
ncmi{0};
150 static std::atomic<int>
nlbi{0};
153 template <
class TYPEdhwmdt,
class TYPEwmdt>
154 static void ProcessMDT(
MYSQL& mysql,
const TYPEdhwmdt dhwmdt,
const TYPEwmdt *wmdt,
const std::string& s) {
159 MDT *mdt =
new MDT(mysql, s);
162 for (
unsigned int i = 0; i < dhwmdt->size(); i++) {
165 mdt->
innerRadius = wmdt[i].tubrad * Gaudi::Units::cm;
167 mdt->
pitch = wmdt[i].tubpit * Gaudi::Units::cm;
176 for (
unsigned int k = 0; k < 4; k++)
177 mdt->
y[k] = wmdt[i].tubyco[k] * Gaudi::Units::cm;
178 for (
unsigned int j = 0; j < 4; j++)
179 mdt->
x[j] = wmdt[i].tubxco[j] * Gaudi::Units::cm;
184 template <
class TYPEdhwrpc,
class TYPEwrpc,
class TYPEdhwrpcall,
class TYPEwrpcall>
185 static void ProcessRPC(
MYSQL& mysql,
const TYPEdhwrpc dhwrpc,
const TYPEwrpc *wrpc,
const TYPEdhwrpcall ,
const TYPEwrpcall *wrpcall,
const std::string& s) {
192 RPC *rpc =
new RPC(mysql, s);
203 rpc->
gasThickness = (wrpcall->tckgas) * Gaudi::Units::cm;
215 log << MSG::INFO <<
"ProcessRPC::WARNING redefining RPC::bakeliteThickness to include pet " << rpc->
bakeliteThickness <<
endmsg;
218 rpc->
spacerPitch = (wrpcall->sppitc) * Gaudi::Units::cm;
223 log << MSG::INFO <<
" ProcessRPC:: spacerDiam, pitch, MidChamberDeadRegion_in_s, MidChamberDeadRegion_in_z " << rpc->
spacerDiameter <<
" " << rpc->
spacerPitch <<
" "
250 log << MSG::INFO <<
"ProcessRPC::WARNING redefining RPC::stripPanelFoamThickness to include pet on both sides " << rpc->
stripPanelFoamThickness <<
endmsg;
256 log << MSG::INFO <<
"ProcessRPC:: rpcLayerComputedTck = " << rpcLayerComputedTck <<
" while rpcLayerThickness in Nova = " << rpc->
rpcLayerThickness <<
endmsg;
260 int nStruct = dhwrpc->size();
262 for (
unsigned int i = 0; (i < dhwrpc->size() && !done); i++) {
265 log << MSG::INFO <<
" ProcessRPC " << s <<
" index " << i <<
" jsta =" << wrpc[i].jsta <<
" strings comparison:: <" << s.substr(3, s.size() - 3) <<
">=<"
283 log << MSG::INFO <<
"ProcessRPC:: (computed) Total RPC thickness = " << rpc->
TotalThickness <<
endmsg;
291 rpc->
stripPitchS = (wrpc[i].spitch) * Gaudi::Units::cm;
292 rpc->
stripPitchZ = (wrpc[i].zpitch) * Gaudi::Units::cm;
309 log << MSG::INFO <<
" index = " << i <<
" nstruct " << nStruct <<
" " << dhwrpc->size() <<
endmsg;
314 template <
class TYPEdhwtgc,
class TYPEwtgc,
class TYPEdhwtgcall,
class TYPEwtgcall>
316 const TYPEdhwtgc dhwtgc,
const TYPEwtgc *wtgc,
const TYPEdhwtgcall dhwtgcall,
const TYPEwtgcall *wtgcall,
const std::string& s) {
321 TGC *tgc =
new TGC(mysql, s);
323 std::string v[] = {
"muo::TGCGas",
"std::G10",
"muo::Honeycomb",
"std::Copper"};
327 for (
unsigned int i = 0; i < dhwtgcall->size(); i++) {
329 tgc->
nlayers = wtgcall[i].nbevol;
330 tgc->
thickness = wtgcall[i].widchb * Gaudi::Units::cm;
331 tgc->
frame_h = wtgcall[i].fwirch * Gaudi::Units::cm;
332 tgc->
frame_ab = wtgcall[i].fwixch * Gaudi::Units::cm;
337 for (
unsigned int j = firstj; j < dhwtgc->size(); j++) {
338 if (wtgc[j].jsta != wtgcall[i].jsta)
341 mat = (int)wtgc[j].icovol;
342 p = wtgc[j].zpovol * Gaudi::Units::cm;
343 t = wtgc[j].widvol * Gaudi::Units::cm;
346 tgc->
tck.push_back(t);
353 for (
int ilyr = 0; ilyr < 3; ilyr++) {
358 for (
int idir = 0; idir < 2; idir++) {
368 template <
class TYPEdhwcsc,
class TYPEwcsc>
369 static void ProcessCSC(
MYSQL& mysql,
const TYPEdhwcsc dhwcsc,
const TYPEwcsc *wcsc,
const std::string& s) {
371 log << MSG::DEBUG <<
" Enter in ProcessCSC" <<
endmsg;
377 CSC *csc =
new CSC(mysql, s);
381 std::string tname = s;
382 while (tname !=
"XXXXX") {
383 for (
unsigned int i = 0; i < dhwcsc->size(); i++) {
390 csc->
g10thick = wcsc[i].tlag10 * Gaudi::Units::cm;
393 csc->
wirespacing = wcsc[i].wispa * Gaudi::Units::cm;
428 csc->
wirebarposx = wcsc[i].pba1wi * Gaudi::Units::cm;
429 csc->
wirebarposy = wcsc[i].pba2wi * Gaudi::Units::cm;
430 csc->
wirebarposz = wcsc[i].pba3wi * Gaudi::Units::cm;
440 log << MSG::WARNING <<
" No DB entry found for the current technology sub-type " << s <<
"\n using previous sub-type " << tname
448 log << MSG::WARNING <<
" update by hand a few numbers for the current technology sub-type " << s <<
" // Layout = " << mysql.
getGeometryVersion()
449 <<
" OK if layout is Q02, Q02_initial" <<
endmsg;
464 template <
class TYPEdhwspa,
class TYPEwspa>
466 const TYPEdhwspa dhwspa,
const TYPEwspa *wspa,
const std::string& s) {
471 SPA *spa =
new SPA(mysql, s);
474 for (
unsigned int i = 0; i < dhwspa->size(); i++) {
476 spa->
thickness = wspa[i].tckspa * Gaudi::Units::cm;
481 template <
class TYPEdhwsup,
class TYPEwsup>
482 static void ProcessSUP(
MYSQL& mysql,
const TYPEdhwsup dhwsup,
const TYPEwsup *wsup,
const std::string& s) {
487 SUP *sup =
new SUP(mysql, s);
490 for (
unsigned int i = 0; i < dhwsup->size(); i++) {
494 if (s.compare(3, s.size() - 3,
"03") == 0) {
496 sup->
alVerFlangeLength = wsup[i].xxsup[1] * Gaudi::Units::cm - wsup[i].xxsup[0] * Gaudi::Units::cm;
498 sup->
alHorProfileThickness = wsup[i].xxsup[3] * Gaudi::Units::cm - wsup[i].xxsup[2] * Gaudi::Units::cm;
501 sup->
HorClearance = wsup[i].zzsup[2] * Gaudi::Units::cm;
530 template <
class TYPEdhwded,
class TYPEwded>
531 static void ProcessDED(
MYSQL& mysql,
const TYPEdhwded dhwded,
const TYPEwded *wded,
const std::string& s) {
536 DED *ded =
new DED(mysql, s);
539 for (
unsigned int i = 0; i < dhwded->size(); i++) {
543 ded->
thickness = (wded[i].auphcb) * Gaudi::Units::cm;
550 template <
class TYPEdhwchv,
class TYPEwchv>
552 const TYPEdhwchv dhwchv,
const TYPEwchv *wchv,
const std::string& s) {
557 int nStruct = dhwchv->size();
558 CHV *chv =
new CHV(mysql, s);
561 for (
int i = 0; i < nStruct; i++) {
563 chv->
thickness = wchv[i].thickness * Gaudi::Units::cm;
564 chv->
largeness = wchv[i].largeness * Gaudi::Units::cm;
565 chv->
height = wchv[i].heightness * Gaudi::Units::cm;
570 template <
class TYPEdhwcro,
class TYPEwcro>
571 static void ProcessCRO(
MYSQL& mysql,
const TYPEdhwcro dhwcro,
const TYPEwcro *wcro,
const std::string& s) {
576 int nStruct = dhwcro->size();
577 CRO *cro =
new CRO(mysql, s);
580 for (
int i = 0; i < nStruct; i++) {
582 cro->
thickness = wcro[i].thickness * Gaudi::Units::cm;
583 cro->
largeness = wcro[i].largeness * Gaudi::Units::cm;
584 cro->
height = wcro[i].heightness * Gaudi::Units::cm;
589 template <
class TYPEdhwcmi,
class TYPEwcmi>
591 const TYPEdhwcmi dhwcmi,
const TYPEwcmi *wcmi,
const std::string& s) {
596 int nStruct = dhwcmi->size();
597 CMI *cmi =
new CMI(mysql, s);
600 for (
int i = 0; i < nStruct; i++) {
602 cmi->
thickness = wcmi[i].thickness * Gaudi::Units::cm;
603 cmi->
largeness = wcmi[i].largeness * Gaudi::Units::cm;
604 cmi->
height = wcmi[i].heightness * Gaudi::Units::cm;
609 template <
class TYPEdhwlbi,
class TYPEwlbi>
611 const TYPEdhwlbi dhwlbi,
const TYPEwlbi *wlbi,
const std::string& s) {
616 int nStruct = dhwlbi->size();
617 LBI *lbi =
new LBI(mysql, s);
620 for (
int i = 0; i < nStruct; i++) {
622 lbi->
thickness = wlbi[i].thickness * Gaudi::Units::cm;
623 lbi->
height = wlbi[i].height * Gaudi::Units::cm;
625 lbi->
yShift = wlbi[i].yShift * Gaudi::Units::cm;
630 template <
class TYPEdnaptp,
class TYPEaptp>
635 double default_halfpitch = 0.5 * (mdtobj->
pitch);
636 double halfpitch = default_halfpitch;
638 std::string oldname =
"XXX0";
639 std::string oldnamejtyp =
"XXX";
647 std::vector<std::string> jtypvec;
648 std::vector<std::string> jtypstvec;
650 for (
unsigned int ipos = 0; ipos < dnaptp->size(); ipos++) {
654 int subType = aptp[ipos].i;
655 int iCut = aptp[ipos].icut;
657 sprintf(stype_name,
"%i", aptp[ipos].i);
658 std::string name = std::string(aptp[ipos].
type, 0, 3) + stype_name;
659 bool already_there =
false;
661 if (name != oldname) {
662 for (
auto it = jtypstvec.begin(); it != jtypstvec.end(); ++it) {
664 already_there =
true;
667 if (!already_there) {
668 jtypstvec.push_back(name);
671 log << MSG::VERBOSE <<
" Building position map for station " << name <<
" # of stat.s positioned up to now " << nswithpos <<
endmsg;
675 log << MSG::VERBOSE <<
" ... it is an update (!) of the map for " << name <<
endmsg;
681 std::string namejtyp = std::string(aptp[ipos].
type, 0, 3);
682 already_there =
false;
684 if (namejtyp != oldnamejtyp) {
685 for (
auto it = jtypvec.begin(); it != jtypvec.end(); ++it) {
686 if (namejtyp == (*it))
687 already_there =
true;
689 if (!already_there) {
691 jtypvec.push_back(std::string(aptp[ipos].
type, 0, 3));
693 oldnamejtyp = namejtyp;
698 log << MSG::ERROR <<
" station " << name <<
" not found; no " << name <<
" element will be located at iz " << aptp[ipos].iz <<
endmsg;
701 bool hasMdts = stat->hasMdts();
704 halfpitch = default_halfpitch;
705 for (
int icomp = 0; icomp < stat->GetNrOfComponents(); ++icomp) {
706 const Component *c = stat->GetComponent(icomp);
707 if (c->name.compare(0, 3,
"MDT") != 0)
711 log << MSG::ERROR <<
"Cannot find MDT definition for component " << c->name <<
endmsg;
714 halfpitch = 0.5 * (mdtobj->
pitch);
715 log << MSG::DEBUG <<
"Setting halfpitch " << halfpitch <<
" for station " << name <<
endmsg;
721 p.zindex = aptp[ipos].iz;
722 for (
int phiindex = 0; phiindex < 8; ++phiindex) {
723 if (aptp[ipos].iphi[phiindex] == 0)
725 p.phitype = aptp[ipos].iphi[phiindex];
728 p.phiindex = phiindex;
729 p.phi = aptp[ipos].dphi + double(phiindex) * 45.;
730 p.radius = aptp[ipos].r * Gaudi::Units::cm;
731 p.z = aptp[ipos].z * Gaudi::Units::cm;
732 if (p.zindex < 0 && name.compare(0, 1,
"B") == 0 && hasMdts)
733 p.z = p.z - halfpitch;
734 p.shift = aptp[ipos].s * Gaudi::Units::cm;
736 log << MSG::VERBOSE <<
"p.zindex,p.phi " << p.zindex <<
" " << p.phiindex <<
" shift is " << p.shift <<
endmsg;
743 p.inclination = aptp[ipos].gamma;
744 p.gamma = aptp[ipos].gamma;
745 p.alpha = aptp[ipos].alfa;
746 p.beta = aptp[ipos].beta;
747 p.isMirrored =
false;
748 p.isBarrelLike =
false;
750 p.isBarrelLike =
true;
753 stat->SetPosition(p);
755 mysql.
addallocPos(name.substr(0, 3), p.phiindex, p.zindex, subType, iCut);
758 log << MSG::INFO <<
" *** N. of stations positioned in the setup " << nswithpos <<
endmsg;
759 log << MSG::INFO <<
" *** N. of stations described in mysql " << mysql.
NStations() <<
endmsg;
760 log << MSG::INFO <<
" *** N. of types " << njtyp <<
" size of jtypvec " << jtypvec.size() <<
endmsg;
764 for (
const auto& [name, stat] : mysql.
stationMap()) {
766 np = stat->Npositions();
768 log << MSG::VERBOSE <<
" Symmetrizing position map for station " << name <<
" with " << np <<
" not mirrored positions " <<
endmsg;
772 int iz = ((*ip).second).zindex;
773 int iphi = ((*ip).second).phiindex;
774 int phitype = ((*ip).second).phitype;
776 std::string skey =
" ";
777 if (iz > 0 && phitype != 2) {
780 log << MSG::VERBOSE <<
" Looking for skey = " << skey <<
endmsg;
785 newp.
phitype = ((*ip).second).phitype;
786 newp.
subtype = ((*ip).second).subtype;
787 newp.
icut = ((*ip).second).icut;
791 newp.
phi = ((*ip).second).
phi;
792 newp.
radius = ((*ip).second).radius;
793 if (name[0] ==
'B') {
794 newp.
z = -((*ip).second).
z - stat->GetLength();
796 newp.
z = -((*ip).second).
z - stat->GetThickness(mysql);
799 newp.
shift = ((*ip).second).shift;
801 newp.
alpha = ((*ip).second).alpha;
802 newp.
beta = ((*ip).second).beta;
803 newp.
gamma = ((*ip).second).gamma;
805 stat->SetPosition(newp);
808 log << MSG::VERBOSE <<
" symmetric pos. created at iz,iphi, z " << newp.
zindex <<
" " << newp.
phiindex <<
" " << newp.
z <<
endmsg;
820 log << MSG::VERBOSE <<
" *** Position map for station " << name <<
" has " << stat->Npositions() <<
" entries" <<
endmsg;
822 nnodes += stat->Npositions();
825 log << MSG::INFO <<
" *** : " << nstat <<
" kinds of stations (type*sub_type) " <<
endmsg;
826 log << MSG::INFO <<
" *** : " << nnodes <<
" physical stations in space - according to the MuonDD DataBase" <<
endmsg;
829 template <
class TYPEaptp>
static bool isBarrelLike(
const TYPEaptp * ,
int ,
int ) {
834 template <
class TYPEdnaszt,
class TYPEaszt>
840 log << MSG::VERBOSE <<
" ProcessAlignements:: how many stations there are ? " << mysql.
NStations() <<
endmsg;
845 for (
unsigned int ipos = 0; ipos < dnaszt->size(); ipos++) {
846 std::string name = std::string(aszt[ipos].
type, 0, 3);
847 fi = aszt[ipos].jff - 1;
850 log << MSG::VERBOSE <<
" ProcessAlignements:: --- Alignment for " << name <<
endmsg;
858 log << MSG::VERBOSE <<
" corresponding subtype/cutout are " << subtype <<
"/" << cutout <<
endmsg;
865 log << MSG::VERBOSE <<
" Station named " << stname <<
" not found " <<
endmsg;
869 pit = stat->FindPosition(zi, fi);
870 if (pit != stat->end()) {
871 if ((*pit).second.zindex == zi && (*pit).second.phiindex == fi) {
873 ap.tras = 0. * Gaudi::Units::cm;
874 ap.traz = 0. * Gaudi::Units::cm;
875 ap.trat = 0. * Gaudi::Units::cm;
881 ap.tras = aszt[ipos].tras * Gaudi::Units::cm;
882 ap.traz = aszt[ipos].traz * Gaudi::Units::cm;
883 ap.trat = aszt[ipos].trat * Gaudi::Units::cm;
884 ap.rots = aszt[ipos].rots;
885 ap.rotz = aszt[ipos].rotz;
886 ap.rott = aszt[ipos].rott;
889 log << MSG::VERBOSE <<
"A-line: " << ap.tras <<
" " << ap.traz <<
" " << ap.trat <<
" " << ap.rots <<
" " << ap.rotz <<
" " << ap.rott
893 ap.phiindex = aszt[ipos].jff - 1;
894 ap.jobindex = aszt[ipos].job;
895 ap.zindex = aszt[ipos].jzz;
898 if (name.compare(0, 1,
"B") == 0 || name.compare(0, 1,
"R") == 0) {
900 ap.isTrapezoid =
false;
903 ap.isTrapezoid =
true;
907 if ((*pit).second.isBarrelLike) {
912 log << MSG::VERBOSE <<
" Setting aligned position for station " << stname <<
" with key " << key <<
endmsg;
914 stat->SetAlignPos(ap);
920 log << MSG::VERBOSE <<
" No Position allocated for key " << key <<
endmsg;
926 template <
class TYPEdnalmn,
class TYPEalmn,
class TYPEdnatyp,
class TYPEatyp,
class TYPEdhwmdt,
class TYPEwmdt>
927 static void ProcessStations(
MYSQL& mysql,
const TYPEdnalmn dnalmn,
const TYPEalmn *almn,
const TYPEdnatyp dnatyp,
const TYPEatyp *atyp,
const TYPEdhwmdt dhwmdt,
const TYPEwmdt *wmdt) {
929 log << MSG::INFO <<
" Processing Stations and Components" <<
endmsg;
932 Station *stat = NULL, *previous_stat = NULL, *previous_stored = NULL;
935 int previous_jtyp = 0;
936 int previous_subt = 0;
938 std::string name =
"XXX0", type_name =
"XXX";
942 double default_halfpitch = 15.0175 * Gaudi::Units::mm;
943 double halfpitch = default_halfpitch;
946 for (
unsigned int icomp = 0; icomp < dnalmn->size(); ++icomp) {
947 if (almn[icomp].jtyp != previous_jtyp || almn[icomp].indx != previous_subt) {
949 if (previous_stat != NULL && previous_stat != previous_stored) {
951 previous_stored = previous_stat;
955 unsigned int type_ind = 0;
957 for (type_ind = 0; type_ind < dnatyp->size(); ++type_ind) {
958 if (almn[icomp].jtyp == atyp[type_ind].jtyp)
962 if (strcmp(atyp[type_ind].
type.c_str(),
"!") != 0) {
963 type_name = std::string(atyp[type_ind].
type, 0, 3);
966 log << MSG::ERROR <<
" ProcessStations station-name not well defined " << atyp[type_ind].type <<
endmsg;
972 stat =
new Station(mysql, name);
973 previous_stat = stat;
975 log << MSG::DEBUG <<
" a new station has been built with name " << name <<
" nstat = " << nstat <<
endmsg;
978 halfpitch = default_halfpitch;
979 for (
unsigned int ic = icomp; ic < dnalmn->size(); ++ic) {
980 if (almn[icomp].jtyp != almn[ic].jtyp || almn[icomp].indx != almn[ic].indx)
982 int jtech = almn[ic].iw;
983 cartec = std::string(almn[ic].tec, 0, 3);
984 if (cartec ==
"MDT") {
985 if (((
unsigned int)(jtech - 1)) > dhwmdt->size()) {
986 log << MSG::ERROR <<
"MDT jtech index not found in W MDT table, cannot determine half pitch"
987 <<
" for " << name <<
endmsg;
990 halfpitch = 0.5 * wmdt[jtech - 1].tubpit * Gaudi::Units::cm;
991 log << MSG::DEBUG <<
"Found new halfpitch: " << halfpitch <<
" for " << name <<
endmsg;
997 bool known_comp =
true;
998 int jtech = almn[icomp].iw;
999 cartec = std::string(almn[icomp].tec, 0, 3);
1002 if (cartec ==
"CSC") {
1004 }
else if (cartec ==
"SPA") {
1006 }
else if (cartec ==
"MDT") {
1008 }
else if (cartec ==
"RPC") {
1010 }
else if (cartec ==
"TGC") {
1012 }
else if (cartec ==
"CRO" || cartec ==
"CMI" || cartec ==
"CHV") {
1014 }
else if (cartec.compare(0, 2,
"LB") == 0) {
1021 c->posx = almn[icomp].dx * Gaudi::Units::cm;
1022 c->posy = almn[icomp].dy * Gaudi::Units::cm;
1023 c->posz = almn[icomp].dz * Gaudi::Units::cm;
1024 c->index = almn[icomp].job;
1026 c->iswap = almn[icomp].ishape;
1027 c->dx1 = almn[icomp].width_xs * Gaudi::Units::cm;
1028 c->dx2 = almn[icomp].width_xl * Gaudi::Units::cm;
1029 c->dy = almn[icomp].length_y * Gaudi::Units::cm;
1030 c->excent = almn[icomp].excent * Gaudi::Units::cm;
1031 c->deadx = almn[icomp].dead1 * Gaudi::Units::cm;
1032 c->deady = almn[icomp].dead2 * Gaudi::Units::cm;
1033 c->dead3 = almn[icomp].dead3 * Gaudi::Units::cm;
1035 if (cartec ==
"CSC") {
1038 log << MSG::WARNING <<
" There is a problem" <<
endmsg;
1040 if (name[2] ==
'L') {
1041 derc->
dy = 1129.20 * Gaudi::Units::mm;
1044 derc->
maxwdy = almn[icomp].length_y * Gaudi::Units::cm;
1048 }
else if (cartec ==
"SPA") {
1051 if (jtech == 6 && name.compare(0, 3,
"CSL") == 0) {
1052 derc->
dy = 1129.20 * Gaudi::Units::mm;
1054 }
else if (cartec ==
"MDT") {
1063 derc->
dy = derc->
dy + halfpitch;
1064 }
else if (cartec ==
"RPC") {
1069 }
else if (cartec ==
"DED") {
1071 }
else if (cartec ==
"SUP" || cartec ==
"TGC" || cartec ==
"CHV" || cartec ==
"CRO" || cartec ==
"CMI" || cartec.compare(0, 2,
"LB") == 0) {
1073 if (cartec.compare(0, 2,
"LB") == 0) {
1076 if ((name ==
"BMF1" || name ==
"BMF2" || name ==
"BMF3" || name ==
"BMF4" || name ==
"BMF5" || name ==
"BMF6") && derc->
name ==
"LB02") {
1078 log << MSG::DEBUG <<
"In this layout Station" << name <<
" has LB of type = " << derc->
name <<
" ---- A problem in primary NUMBERS ? ---- resetting to LB01"
1080 derc->
name =
"LB01";
1086 log << MSG::WARNING <<
" Unknown technology - component " << c->name <<
" will not be added to station " << stat->GetName() <<
endmsg;
1089 if (known_comp && stat != NULL)
1090 stat->SetComponent(c);
1095 if (cartec ==
"MDT" && stat != NULL)
1096 stat->setHasMdts(
true);
1098 previous_jtyp = almn[icomp].jtyp;
1099 previous_subt = almn[icomp].indx;
1100 previous_stat = stat;
1102 log << MSG::INFO <<
" Processing Stations and Components DONE" <<
endmsg;
1106 template <
class TYPEdnacut,
class TYPEacut,
class TYPEdnalin,
class TYPEalin,
class TYPEdnatyp,
class TYPEatyp>
1107 static void ProcessCutouts(
MYSQL& mysql,
const TYPEdnacut dnacut,
const TYPEacut *acut,
const TYPEdnalin dnalin,
const TYPEalin *alin,
const TYPEdnatyp dnatyp,
const TYPEatyp *atyp) {
1110 log << MSG::INFO <<
" Processing Cutouts for geometry layout " << mysql.
getLayoutName() <<
endmsg;
1112 std::string name =
"XXX0", type_name =
"XXX";
1117 for (
unsigned int icomp = 0; icomp < dnacut->size(); ++icomp) {
1118 log << MSG::VERBOSE <<
" ------------- this is ACUT = " << icomp + 1 <<
" out of " << dnacut->size() <<
" station type index = " << acut[icomp].i
1119 <<
" cutout index: " << acut[icomp].icut <<
" there are " << acut[icomp].n <<
" cutouts in this station" <<
endmsg;
1122 if (countalin + acut[icomp].n <= (
int)dnalin->size()) {
1123 for (
int ialin = countalin; ialin < countalin + acut[icomp].n; ++ialin) {
1124 log << MSG::VERBOSE <<
" this is ALIN = " << ialin + 1 <<
" out of " << dnalin->size() <<
" Station type =" << alin[ialin].jtyp <<
" Index/Cutout-index: ("
1125 << alin[ialin].indx <<
"," << alin[ialin].icut <<
") should match (" << acut[icomp].i <<
"," << acut[icomp].icut <<
")"
1126 <<
" component with subcut i = " << alin[ialin].i <<
endmsg;
1128 c->dx = alin[ialin].dx * Gaudi::Units::cm;
1129 c->dy = alin[ialin].dy * Gaudi::Units::cm;
1130 c->widthXs = alin[ialin].width_xs * Gaudi::Units::cm;
1131 c->widthXl = alin[ialin].width_xl * Gaudi::Units::cm;
1133 if (alin[ialin].jtyp == 11 && (c->dy > 0.0001 && c->dy < 1.)) {
1134 log << MSG::VERBOSE <<
"DBREADER redefining dy of the cutout from " << c->dy;
1135 c->dy = 0.000 * Gaudi::Units::mm;
1136 log <<
" to " << c->dy <<
endmsg;
1139 c->lengthY = alin[ialin].length_y * Gaudi::Units::cm;
1140 c->excent = alin[ialin].excent * Gaudi::Units::cm;
1141 c->dead1 = alin[ialin].dead1;
1145 c->ijob = alin[ialin].i;
1146 c->subtype = alin[ialin].indx;
1147 c->icut = alin[ialin].icut;
1150 unsigned int type_ind;
1151 for (type_ind = 0; type_ind < dnatyp->size(); ++type_ind) {
1152 if (alin[ialin].jtyp == atyp[type_ind].jtyp)
1156 if (strcmp(atyp[type_ind].
type.c_str(),
"!") != 0) {
1157 type_name = std::string(atyp[type_ind].
type, 0, 3);
1163 log << MSG::ERROR <<
" station " << name <<
" not found! " <<
endmsg;
1168 log << MSG::VERBOSE <<
" adding a new cut-line to station " << stat->GetName() <<
" cutindex/Stsubtype/component " << c->icut <<
"/" << c->subtype <<
"/"
1170 log << MSG::VERBOSE <<
" There are now " << stat->GetNrOfCutouts() <<
" cutouts in station " << stat->GetName() <<
endmsg;
1174 log << MSG::ERROR <<
" ProcessCutouts station-name not well defined " << atyp[type_ind].type <<
endmsg;
1181 countalin = countalin + acut[icomp].n;
1184 log << MSG::INFO <<
" Processing Cutouts DONE" <<
endmsg;
Scalar phi() const
phi method
double floatingstripswidth
double fullgasgapwirewidth
double readoutstripswidth
double fullwirefixbarwidth
void setManager(MuonDetectorManager *detmgr)
std::vector< std::string > m_tgcReadoutMapping
void setGeometryVersion(std::string s)
virtual StatusCode ProcessDB(MYSQL &)
MuonDetectorManager * m_mgr
std::string TGCreadoutName(int ichtyp)
const std::string & getGeometryVersion() const
double HoneyCombThickness
std::string associated_CMIsubtype
std::array< double, 4 > y
std::array< double, 4 > x
const std::string & getGeometryVersion() const
const Station * GetStation(const std::string &name) const
const std::string & getLayoutName() const
Technology * GetTechnology(const std::string &name)
const Technology * GetATechnology(const std::string &name) const
const StationMap & stationMap() const
std::string allocPosBuildKey(const std::string &statType, int fi, int zi) const
allocPosIterator allocPosEnd() const
void addallocPos(const std::string &key, int value)
int allocPosFindCutout(const std::string &statType, int fi, int zi) const
allocPosIterator allocPosFind(const std::string &key) const
int allocPosFindSubtype(const std::string &statType, int fi, int zi) const
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
double lowerAlSupPanelThickness
double frontendBoardWidth
double upperSupPanelThickness
double MidChamberDeadRegion_in_z
double lowerSupPanelThickness
double stripPanelFoamThickness
double stripPanelCopperSkinThickness
double stripPanelStripSidePetThickness
double centralAlSupPanelThickness
double stripPanelThickness
double stripPanelGroundSidePetThickness
double externalAlSupPanelThickness
double centralSupPanelThickness
double externalSupPanelThickness
double bakelitePetThickness
double upperAlSupPanelThickness
double MidChamberDeadRegion_in_s
double alHorProfileThickness
double bottomsizewrtAMDB0
double alVerProfileThickness
std::array< double, 2 > pitchButton
std::array< double, 3 > offsetWireSupport
std::vector< std::string > materials
double distanceWireSupport
std::vector< double > tck
std::vector< double > positions
The Athena Transient Store API.
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)
Ensure that the Athena extensions are properly loaded.
static void ProcessMDT(MYSQL &mysql, const TYPEdhwmdt dhwmdt, const TYPEwmdt *wmdt, const std::string &s)
static void ProcessCMI(MYSQL &mysql, const TYPEdhwcmi dhwcmi, const TYPEwcmi *wcmi, const std::string &s)
static void ProcessSUP(MYSQL &mysql, const TYPEdhwsup dhwsup, const TYPEwsup *wsup, const std::string &s)
static std::atomic< int > nmdt
static void ProcessCHV(MYSQL &mysql, const TYPEdhwchv dhwchv, const TYPEwchv *wchv, const std::string &s)
static void ProcessCutouts(MYSQL &mysql, const TYPEdnacut dnacut, const TYPEacut *acut, const TYPEdnalin dnalin, const TYPEalin *alin, const TYPEdnatyp dnatyp, const TYPEatyp *atyp)
static void ProcessAlignements(MYSQL &mysql, const TYPEdnaszt dnaszt, const TYPEaszt *aszt)
static std::atomic< int > nchv
static void ProcessLBI(MYSQL &mysql, const TYPEdhwlbi dhwlbi, const TYPEwlbi *wlbi, const std::string &s)
static std::atomic< int > ncsc
std::string buildString(int i, int ncha)
static std::atomic< int > nded
static void ProcessSPA(MYSQL &mysql, const TYPEdhwspa dhwspa, const TYPEwspa *wspa, const std::string &s)
static std::atomic< int > nsup
static std::atomic< int > nrpc
static void ProcessCRO(MYSQL &mysql, const TYPEdhwcro dhwcro, const TYPEwcro *wcro, const std::string &s)
static void ProcessTGC(MYSQL &mysql, const TYPEdhwtgc dhwtgc, const TYPEwtgc *wtgc, const TYPEdhwtgcall dhwtgcall, const TYPEwtgcall *wtgcall, const std::string &s)
static std::atomic< int > ncmi
int strtoint(std::string_view str, unsigned int istart, unsigned int length)
std::map< int, Position, std::less< int > >::const_iterator PositionIterator
static void ProcessStations(MYSQL &mysql, const TYPEdnalmn dnalmn, const TYPEalmn *almn, const TYPEdnatyp dnatyp, const TYPEatyp *atyp, const TYPEdhwmdt dhwmdt, const TYPEwmdt *wmdt)
static void ProcessCSC(MYSQL &mysql, const TYPEdhwcsc dhwcsc, const TYPEwcsc *wcsc, const std::string &s)
static bool isBarrelLike(const TYPEaptp *, int, int)
static std::atomic< int > ntgc
static std::atomic< int > nspa
static std::atomic< int > ncro
static void ProcessRPC(MYSQL &mysql, const TYPEdhwrpc dhwrpc, const TYPEwrpc *wrpc, const TYPEdhwrpcall, const TYPEwrpcall *wrpcall, const std::string &s)
static void ProcessPositions(MYSQL &mysql, const TYPEdnaptp dnaptp, const TYPEaptp *aptp)
static void ProcessDED(MYSQL &mysql, const TYPEdhwded dhwded, const TYPEwded *wded, const std::string &s)
static std::atomic< int > nlbi