19#include <TGeoCompositeShape.h>
20#include <TGeoManager.h>
21#include <TGeoMatrix.h>
22#include <TGeoMedium.h>
23#include <TGeoVolume.h>
31 "Radiator",
"Window",
"Volume",
"BackPanel",
"FEB",
"AUX"};
36 LOG(error) <<
"GetMaterial(" << mname <<
") failed.";
46 string modName = modTxt;
47 auto posstart = modName.find(
"module") + 6;
49 auto partoftype = modName.at(posstart);
50 while (std::isdigit(partoftype) && (ndigits + posstart) < modName.size()) {
51 partoftype = modName.at(posstart + ndigits);
54 info.
type = stoi(modName.substr(posstart, ndigits));
57 int modCopyNo = stoi(modName.substr(posstart, string::npos));
58 if ((modCopyNo / 100000000) < 0) {
59 LOG(warning) << modTxt <<
" Module in ancient (< 2013) format. Ask expert.";
66 info.
id = (modCopyNo % 1000) - 1;
67 info.
superId = ((modCopyNo / 1000) % 100) - 1;
68 info.
rotation = ((modCopyNo / 100000) % 10);
77 string febName = febTxt;
78 auto posstart = febName.find(
"FEB") + 3;
80 info.
type = stoi(febName.substr(posstart, 2));
85 int febNo = stoi(febName.substr(posstart + 3, string::npos));
86 info.
id = febNo % 100;
88 info.
superId = (febNo / 100) % 1000;
89 info.
rotation = (febNo / 100000) % 10;
92 catch (invalid_argument a) {
93 LOG(error) <<
"FEB name does not follow syntax rules : \"FEBxy_identifier\", \"x\" = superType, \"y\" = Type. "
94 "Couldn't initialize.";
98 LOG(error) <<
"FEB name does not follow syntax rules";
102 default: LOG(info) <<
" : Un-identified violation.";
break;
138 if (info ==
nullptr) {
139 LOG(error) <<
"WriteFebInfo : Info for FEB is missing";
143 LOG(warning) <<
"WriteFebInfo : Info for FEB is incomplete : id=" << info->
id <<
" superId=" << info->
superId
144 <<
" rotatation=" << info->
rotation;
186 LOG(info) <<
"Init for TRD2D.";
197 LOG(info) <<
"Init for TRD1D type " <<
fChmbTyp <<
".";
199 default: LOG(fatal) <<
"Unknown TRD chamber type " <<
fChmbTyp <<
". Abort.";
break;
203 TGeoManager* gGeoMan = (TGeoManager*) gROOT->FindObject(
"FAIRGeom");
206 imat.second = gGeoMan->GetMedium(imat.first.data());
217 if (!icomp)
continue;
218 auto status = icomp->Init();
219 if (status != kSUCCESS)
return status;
233 if (!icomp)
continue;
234 vh[idx] = icomp->GetHeight();
244 fVol->SetLineColor(kGreen);
245 fVol->SetTransparency(80);
249 double hh(-hTot / 2);
252 if (!icomp)
continue;
259 for (
int ifeb(0), jfeb(0); ifeb <
Nfebs; ifeb++) {
264 vFeb->AddNode(icomp->fVol, jfeb,
new TGeoTranslation(
"",
feb_pos[ifeb][0],
feb_pos[ifeb][1], 0.));
266 fVol->AddNode(vFeb, 1,
new TGeoTranslation(
"", 0, 0, hh));
268 default:
fVol->AddNode(icomp->fVol, 1,
new TGeoTranslation(
"", 0., 0., hh));
break;
271 hh += 0.5 * vh[idx++];
277 if (!
fVol)
return 0.;
279 fVol->GetShape()->GetAxisRange(3., zlo, zhi);
280 return 0.5 * (zlo + zhi);
300 TGeoBBox* winIn_C =
new TGeoBBox(
"winIn_C", win_size_x / 2., win_size_y / 2.,
winIn_C_thickness / 2.);
301 TGeoVolume* vol_winIn_C =
303 vol_winIn_C->SetLineColor(kBlack);
307 TGeoBBox* winIn_HC =
new TGeoBBox(
"winIn_HC", hc_size_x / 2., hc_size_y / 2.,
winIn_HC_thickness / 2.);
309 vol_winIn_HC->SetLineColor(kOrange);
316 vol_winIn_fx->SetLineColor(kBlue);
319 TGeoVolume* vol_winIn_xout =
321 vol_winIn_xout->SetLineColor(kBlue + 2);
326 vol_winIn_fy->SetLineColor(kCyan);
330 vol_winIn_k->SetLineColor(kViolet);
331 TGeoBBox* winIn_yout =
334 TGeoVolume* vol_winIn_yout =
336 vol_winIn_yout->SetLineColor(kViolet + 5);
341 fVol->SetLineColor(kOrange);
342 fVol->SetTransparency(50);
346 fVol->AddNode(vol_winIn_HC, 1,
new TGeoTranslation(
"", 0., 0.,
fHeight));
348 fVol->AddNode(vol_winIn_fx, 1,
new TGeoTranslation(
"", 0.,
y,
fHeight));
349 fVol->AddNode(vol_winIn_fx, 2,
new TGeoTranslation(
"", 0., -
y,
fHeight));
351 fVol->AddNode(vol_winIn_xout, 1,
new TGeoTranslation(
"", 0.,
y,
fHeight));
352 fVol->AddNode(vol_winIn_xout, 2,
new TGeoTranslation(
"", 0., -
y,
fHeight));
354 fVol->AddNode(vol_winIn_fy, 1,
new TGeoTranslation(
"",
x, 0.,
fHeight));
355 fVol->AddNode(vol_winIn_fy, 2,
new TGeoTranslation(
"", -
x, 0.,
fHeight));
357 fVol->AddNode(vol_winIn_k, 1,
new TGeoTranslation(
"",
x, 0.,
fHeight));
358 fVol->AddNode(vol_winIn_k, 2,
new TGeoTranslation(
"", -
x, 0.,
fHeight));
360 fVol->AddNode(vol_winIn_yout, 1,
new TGeoTranslation(
"",
x, 0.,
fHeight));
361 fVol->AddNode(vol_winIn_yout, 2,
new TGeoTranslation(
"", -
x, 0.,
fHeight));
364 fVol->AddNode(vol_winIn_C, 1,
new TGeoTranslation(
"", 0., 0.,
fHeight));
378 vol_gas->SetLineColor(kRed);
382 vol_gas_ext->SetLineColor(kMagenta);
392 vol_gas_xin->SetLineColor(kViolet + 5);
396 vol_gas_xout->SetLineColor(kViolet + 5);
400 vol_gas_k->SetLineColor(kViolet);
403 vol_gas_a->SetLineColor(kViolet + 2);
406 vol_gas_d->SetLineColor(kViolet + 4);
410 vol_gas_yout->SetLineColor(kViolet + 5);
415 fVol->SetLineColor(kYellow);
416 fVol->SetTransparency(50);
420 fVol->AddNode(vol_gas, 0,
new TGeoTranslation(
"", 0., 0.,
fHeight));
425 fVol->AddNode(vol_gas_a, 1,
new TGeoTranslation(
"",
x, 0.,
fHeight));
426 fVol->AddNode(vol_gas_a, 2,
new TGeoTranslation(
"", -
x, 0.,
fHeight));
431 fVol->AddNode(vol_gas_yout, 1,
new TGeoTranslation(
"",
x, 0.,
fHeight ));
432 fVol->AddNode(vol_gas_yout, 2,
new TGeoTranslation(
"", -
x, 0.,
fHeight ));
434 fVol->AddNode(vol_gas_ext, 0,
new TGeoTranslation(
"", 0.,
y,
fHeight));
435 fVol->AddNode(vol_gas_ext, 1,
new TGeoTranslation(
"", 0., -
y,
fHeight));
437 fVol->AddNode(vol_gas_xin, 1,
new TGeoTranslation(
"", 0,
y,
fHeight));
438 fVol->AddNode(vol_gas_xin, 2,
new TGeoTranslation(
"", 0, -
y,
fHeight));
440 fVol->AddNode(vol_gas_xout, 1,
new TGeoTranslation(
"", 0,
y,
fHeight ));
441 fVol->AddNode(vol_gas_xout, 2,
new TGeoTranslation(
"", 0, -
y,
fHeight ));
458 vol_pp->SetLineColor(kBlue);
462 TGeoBBox* pp_PCB =
new TGeoBBox(
"pp_pcb", bkp_size_x / 2., bkp_size_y / 2.,
pp_pcb_thickness / 2.);
464 vol_pp_PCB->SetLineColor(kGreen);
468 auto vol_bp =
new TGeoVolumeAssembly(
"bkp_int");
469 auto vol_bp_ASIC =
new TGeoVolumeAssembly(
"");
471 Color_t bp_col[3] = {kOrange, kGray, kRed + 2};
472 const char* matName[3] = {
"TRDaramide",
"TRDG10",
"TRDcopper"};
477 for (
int ibpz(0); ibpz < 3; ibpz++) {
478 hHC += 0.5 * hHCz[ibpz];
479 for (
int ibpy(-1), jbp(0); ibpy < 2; ibpy += 2) {
480 auto bpShp =
new TGeoBBox(
"", dxHC[0], dyHC[0], hHCz[ibpz] / 2.);
482 vol_cmp->SetLineColor(bp_col[ibpz]);
483 vol_bp_ASIC->AddNode(vol_cmp, jbp++,
new TGeoTranslation(
"", 0., ibpy * hHCy, hHC));
485 for (
int ibpx(-1), jbp(0); ibpx < 2; ibpx += 2) {
486 auto bpShp =
new TGeoBBox(
"", dxHC[1], dyHC[1], hHCz[ibpz] / 2.);
488 vol_cmp->SetLineColor(bp_col[ibpz]);
489 vol_bp_ASIC->AddNode(vol_cmp, jbp++,
new TGeoTranslation(
"", ibpx * hHCx, 0., hHC));
491 hHC += 0.5 * hHCz[ibpz];
494 for (
Int_t c(0), ifc(0); c < 9; c++) {
495 for (
Int_t r(0); r < 10; r++) {
496 vol_bp->AddNode(vol_bp_ASIC, ifc++,
new TGeoTranslation(
"", (c - 4) *
hc_unitx,
hc_unity * (0.5 + r), 0.));
497 vol_bp->AddNode(vol_bp_ASIC, ifc++,
new TGeoTranslation(
"", (c - 4) *
hc_unitx, -
hc_unity * (r + 0.5), 0.));
503 TGeoVolume* vol_faspro_fy =
505 vol_faspro_fy->SetLineColor(kViolet + 2);
514 auto vol_bkp_xout =
new TGeoVolumeAssembly(
"bkp_xout");
515 vol_bkp_xout->AddNode(
517 vol_bkp_xout->AddNode(xvolBd, 1,
new TGeoTranslation(
"", 0., 0.,
BKP_Frame_closure / 2));
518 vol_bkp_xout->SetLineColor(kViolet + 2);
526 auto vol_bkp_yout =
new TGeoVolumeAssembly(
"bkp_yout");
527 vol_bkp_yout->AddNode(yvolFc, 1,
530 vol_bkp_yout->AddNode(yvolBd, 1,
new TGeoTranslation(
"t_bkp_yout_bd", 0., 0.,
BKP_Frame_closure / 2));
531 vol_bkp_yout->SetLineColor(kViolet + 2);
535 fVol =
new TGeoVolume(GetName(),
new TGeoBBox(
"", bkp_size_x / 2, bkp_size_y / 2, height / 2),
537 fVol->SetLineColor(kOrange);
538 fVol->SetTransparency(50);
542 fVol->AddNode(vol_pp, 1,
new TGeoTranslation(
"", 0., 0.,
fHeight));
544 fVol->AddNode(vol_pp_PCB, 1,
new TGeoTranslation(
"", 0., 0.,
fHeight));
546 fVol->AddNode(vol_bp, 1,
new TGeoTranslation(
"", 0., 0.,
fHeight));
550 auto* fy_tra =
new TGeoTranslation(
"",
x, 0.,
fHeight);
551 fVol->AddNode(vol_bkp_yout, 1, fy_tra);
552 auto* fy_rot =
new TGeoRotation();
553 fy_rot->RotateZ(180.);
554 auto* fy_mat =
new TGeoHMatrix(
"");
555 (*fy_mat) = (*fy_rot) * (*fy_tra);
556 fVol->AddNode(vol_bkp_yout, 2, fy_mat);
558 fy_tra =
new TGeoTranslation(
"", 0.,
y,
fHeight);
559 fVol->AddNode(vol_bkp_xout, 1, fy_tra);
560 fy_mat =
new TGeoHMatrix(
"");
561 (*fy_mat) = (*fy_rot) * (*fy_tra);
562 fVol->AddNode(vol_bkp_xout, 2, fy_mat);
566 for (
int ifeb(0); ifeb <
Nfebs; ifeb++) {
567 if (ifeb % 5 != 0)
continue;
590 TString scu =
"", spcb =
"";
591 TGeoTranslation* tr(
nullptr);
592 double FASPRO_thickness(0.);
597 FASPRO_thickness += lyThickEff / 2;
598 tr =
new TGeoTranslation(Form(
"t_faspro_ly%02d", ily), 0., 0., FASPRO_thickness);
599 tr->RegisterYourself();
600 scu += Form(
"%cfaspro_ly%02d:t_faspro_ly%02d", (ily ?
'+' :
' '), ily, ily);
601 FASPRO_thickness += lyThickEff / 2;
606 FASPRO_thickness += lyThickPcb;
607 tr =
new TGeoTranslation(Form(
"t_faspro_ly%02d_pcb", ily), 0., 0., FASPRO_thickness);
608 tr->RegisterYourself();
609 spcb += Form(
"%cfaspro_ly%02d_pcb:t_faspro_ly%02d_pcb", (ily ?
'+' :
' '), ily, ily);
610 FASPRO_thickness += lyThickPcb;
615 new TGeoTranslation(Form(
"t_faspro_hole%d", ihole),
HOLE_pos[ihole][0],
HOLE_pos[ihole][1], FASPRO_thickness / 2);
616 tr->RegisterYourself();
617 scu += Form(
"-faspro_hole%d:t_faspro_hole%d", ihole, ihole);
618 spcb += Form(
"-faspro_hole%d:t_faspro_hole%d", ihole, ihole);
620 auto faspro_cu =
new TGeoCompositeShape(
"faspro_cu", scu.Data());
622 vol_faspro_cu->SetLineColor(kRed - 3);
623 auto faspro_pcb =
new TGeoCompositeShape(
"faspro_pcb", spcb.Data());
624 auto vol_faspro_pcb =
new TGeoVolume(
"faspro_pcb", faspro_pcb,
626 vol_faspro_pcb->SetLineColor(kGreen + 3);
633 vol_fasp->SetLineColor(kBlack);
637 vol_adc->SetLineColor(kBlack);
641 vol_fpga->SetLineColor(kBlack);
645 vol_dcdc->SetLineColor(kBlack);
649 vol_conn_fc->SetLineColor(kYellow);
653 vol_conn_brg->SetLineColor(kYellow + 2);
661 fVol =
new TGeoVolume(Form(
"%s1%d", GetName(), fType),
664 fVol->SetLineColor(kGreen);
665 fVol->SetTransparency(50);
668 double offset = -0.5 *
fHeight;
672 for (
int ifasp(0), jfasp(0); ifasp <
faspFeb[fType].nasic; ifasp++) {
673 vol_fasp->SetTitle(Form(
"%x", 0xff ));
678 fVol->AddNode(vol_faspro_cu, 1,
new TGeoTranslation(
"", 0., 0.,
fHeight));
679 fVol->AddNode(vol_faspro_pcb, 1,
new TGeoTranslation(
"", 0., 0.,
fHeight));
686 fVol->AddNode(vol_fpga, ifpga + 1,
689 fVol->AddNode(vol_dcdc, idcdc + 1,
693 fVol->AddNode(vol_conn_fc, ifasp + 1,
695 for (
int iconn(0); iconn < 2; iconn++)
696 fVol->AddNode(vol_conn_brg, iconn + 1,
713 vol_conn_brg->SetLineColor(kYellow + 2);
719 vol_ga01_bd->SetLineColor(kGreen + 7);
721 TGeoBBox* sata_conn =
new TGeoBBox(
"sata_conn", 0.5 *
SATAx, 0.5 *
SATAy, 0.5 *
SATAz);
723 vol_conn_sata->SetLineColor(kGray + 2);
725 TGeoVolumeAssembly* ga01 =
new TGeoVolumeAssembly(
"GA01");
726 ga01->AddNode(vol_ga01_bd, 1,
new TGeoTranslation(
"", 0., 0., 0.5 * ga01_z -
SATAz - 0.5 *
GA01_z));
727 Float_t sataConnPosX[] = {2, 1.2, -1.}, sataConnPosY[] = {0, 1.5, 1};
728 for (
Int_t ic(-2); ic <= 2; ic++) {
729 ga01->AddNode(vol_conn_sata, ic + 2,
730 new TGeoTranslation(
"", sataConnPosX[abs(ic)], (ic > 0 ? 1 : -1) * sataConnPosY[abs(ic)],
731 0.5 * ga01_z - 0.5 *
SATAz));
733 ga01->AddNode(vol_conn_brg, 1,
738 TGeoBBox* b2b_bd =
new TGeoBBox(
"b2b_bd",
B2B_y / 2.,
B2B_x / 2.,
B2B_z / 2.);
740 vol_b2b_bd->SetLineColor(kGreen + 7);
743 TGeoVolumeAssembly* b2b =
new TGeoVolumeAssembly(
"B2B");
744 b2b->AddNode(vol_b2b_bd, 1,
new TGeoTranslation(
"", 0., 0., 0.5 * b2b_z - 0.5 *
B2B_z));
752 tr->RegisterYourself();
755 tr->RegisterYourself();
756 auto vttx_bd =
new TGeoCompositeShape(
"vttx_bd",
"vttx_bd0 - vttx_bd1:t_vttx_bd1 - vttx_bd2:t_vttx_bd2");
758 vol_vttx_bd->SetLineColor(kGreen + 7);
760 TGeoVolumeAssembly* vttx =
new TGeoVolumeAssembly(
"VTTX");
761 vttx->AddNode(vol_vttx_bd, 1,
new TGeoTranslation(
"", 0., 0., 0.5 * vttx_z - 0.5 *
VTTX_z));
762 vttx->AddNode(vol_conn_brg, 1,
772 fVol->SetLineColor(kGreen);
773 fVol->SetTransparency(50);
776 for (
int ifeb(0), ib2b(0), ivttx(0); ifeb <
Nfebs; ifeb++) {
780 fVol->AddNode(b2b, ib2b++,
784 fVol->AddNode(vttx, ivttx++,
804 fVol->SetLineColor(kRed);
ClassImp(CbmConverterManager)
Helper class to convert unique channel ID back and forth.
Builder class for the TRD chamber geometry.
static uint32_t GetAddress(int32_t layerId, int32_t moduleId, int32_t sectorId, int32_t rowId, int32_t columnId)
Return address from system ID, layer, module, sector, column and row IDs.
Inner class describing the geometry of the TRD AUXILIARY boards (FEE):
virtual InitStatus Init()
Init task.
Inner class describing the back panel of composed of.
virtual InitStatus Init()
Init task.
const double BKP_Frame_closure
Global width of the perimetral frame (including indentation)
const double hc_holey
dimension of flat-cable hole x-dimension (along wires)
const double BKP_OutY_thickness
outside framing
const double BKP_OutY_correct
outside framing
const double hc_holex
area opearted by one FASP 6 x 2.7 cm2
const double pp_pcb_thickness
cu coverage of PP PCB
const double cu_pcb_thickness
dimension of flat-cable hole x-dimension (along wires)
const double hc_unity
area opearted by one FASP 6 x 2.7 cm2
const double BKP_OutX_thickness
Perimetral frame indentation.
const double pp_pads_thickness
const double hc_unitx
Honneycomb backpanel support thickness.
const double hc_thickness
PP support PCB thickness.
const double BKP_Frame_width
Electric shield Cu covarage thickness.
const double cu_thickness
Electric shield PCB support thickness.
static const char * fgName[(int) eGeoPart::kNparts]
Component(const char *name)
Constructor of the TRD chamber component. It links the chamber class.
virtual double GetCenter() const
Inner class describing the geometry of the TRD Front End Electronics (FEE):
const double FPGA_pos[FASPRO_Nfpga][2]
static constexpr double ConnBRG_y
const double FASPRO_ly_cu[FASPRO_Nly][2]
static constexpr double FASPRO_width
length of FASP FEBs in cm
const double FASPRO_hole_y
static constexpr double FASPRO_length
gap size between boards
static const int FASPRO_Nadc
virtual InitStatus Init()
Init task.
const double FASPRO_hole_x
const double DCDC_pos[FASPRO_Ndcdc][2]
static constexpr double ConnBRG_z
static constexpr double ConnBRG_x
static const int FASPRO_Ndcdc
static const int FASPRO_Nly
const double ConnFC_pos[FASPRO_Nfasp][2]
const double FASPRO_ly_pcb[FASPRO_Nly - 1]
static constexpr double ConnBRG_pos[2][2]
const double FASP_pos[FASPRO_Nfasp][2]
const double ADC_pos[FASPRO_Nadc][2]
static const int FASPRO_Nfasp
const double HOLE_pos[FASPRO_Nfasp][2]
static constexpr double FASPRO_zspace
static const int FASPRO_Nfpga
const double radiator_thickness
virtual InitStatus Init()
Init task.
Inner class describing a :
const double anode_width
cathode
virtual InitStatus Init()
Init task.
const double ledge_thickness
closure to pad-plane dimension
const double gas_thickness
extra volume of gas parallel to wires
const double WIN_OutX_thickness
distance from anode to PP
const double WIN_OutY_thickness
outside framing
const double cathode_width
ledge thickness supporting A/K wires
const double dist_width
anode
const double WIN_FrameX_thickness
9mm HC structure
const double WIN_OutY_thickness
outside framing at win 3.5x9 mm2
const double WIN_FrameY_thickness
entrance window framing 5x9 mm2
const double winIn_C_thickness
Window()
Constructor of entrance window for the TRD chamber.
const double WIN_OutX_thickness
entrance window framing 5x9 mm2
const double winIn_HC_thickness
100um C foil + 25um KaptonAl
virtual InitStatus Init()
Init task.
array< Component *,(int) eGeoPart::kNparts > fComponent
chamber type [1, 3, 5, 7]
ChamberBuilder(int typ=1)
Constructor for the chamber. Adds all elements according to config.
short fChmbTyp
bit map of the setter flags
virtual void Exec(Option_t *)
Executed task.
static constexpr double feb_pos[Nfebs][2]
static const int Nfebs
list of chamber component builders
virtual InitStatus Init()
Init task.
const TGeoMedium * GetMaterial(const char *mname)
material mapping (name, value)
bool ReadModuleInfo(const char *modTxt, info_t &info)
Identify information related to the module encrypted in the geoManager path. Based on legacy function...
bool ReadFebInfo(const char *febTxt, info_t &info)
Identify information related to one FEB encrypted in the geoManager path.
int WriteFebInfo(info_t *info)
Put up information related to the FEB and store it in the geoManager path.
int WriteModuleInfo(info_t *info)
Put up information related to the module and store it in the geoManager path. Based on legacy version...
static double activeAreaY
static map< const string, const TGeoMedium * > fMaterial
active area
static double activeAreaX
total area
static constexpr FEB faspFeb[2]
@ kSpadic
SPADIC type definition.
@ kFasp
FASP ASIC definition.
void SetPP(uint16_t config, bool twod=true)
Define the pad-plane type of the chamber.
void SetFEE(uint16_t config, bool fasp=true)
Define the read-out FEE type of the module.
Information to be storred in the geoManager path. Based on legacy class CbmTrdGeoHandler.
int id
global addressing of element
int type
global (wrt setup) id of element
int superType
version of element wrt superType family
int superId
local (wrt installation) id of element
int rotation
global type wrt TRD design