226  Material(1, 
"Si $", aSi, zSi, dSi, x0Si, 18.5);
 
  233  Material(0, 
"W $", aW, zW, dW, x0W, 17.1);
 
  236  Material(3, 
"Cu   $", 63.54, 29., 8.96, 1.43, 15.);
 
  239  Material(9, 
"Al$", 26.98, 13.0, 2.7, 8.9, 37.2);
 
  242  Material(10, 
"Pb    $", 207.19, 82., 11.35, .56, 18.5);
 
  246  float aP[2] = {12.011, 1.00794};
 
  247  float zP[2] = {6.0, 1.0};
 
  248  float wP[2] = {1.0, 1.0};
 
  250  Mixture(11, 
"Polystyrene$", aP, zP, dP, -2, wP);
 
  254  float aG10[4] = {1., 12.011, 15.9994, 28.086};
 
  255  float zG10[4] = {1., 6., 8., 14.};
 
  257  float wG10[4] = {0.15201, 0.10641, 0.49444, 0.24714};
 
  258  Mixture(2, 
"G10  $", aG10, zG10, 1.7, 4, wG10);
 
  261  float aAlloy[3] = {183.84, 58.6934, 63.54};
 
  262  float zAlloy[3] = {74.0, 28, 29};
 
  263  float wAlloy[3] = {0.94, 0.04, 0.02};
 
  264  float dAlloy = wAlloy[0] * 19.3 + wAlloy[1] * 8.908 + wAlloy[2] * 8.96;
 
  265  Mixture(5, 
"Alloy $", aAlloy, zAlloy, dAlloy, 3, wAlloy);
 
  268  float aSteel[4] = {55.847, 51.9961, 58.6934, 28.0855};
 
  269  float zSteel[4] = {26., 24., 28., 14.};
 
  270  float wSteel[4] = {.715, .18, .1, .005};
 
  272  Mixture(4, 
"STAINLESS STEEL$", aSteel, zSteel, dSteel, 4, wSteel);
 
  275  float aAir[4] = {12.0107, 14.0067, 15.9994, 39.948};
 
  276  float zAir[4] = {6., 7., 8., 18.};
 
  277  float wAir[4] = {0.000124, 0.755268, 0.231781, 0.012827};
 
  278  float dAir1 = 1.20479E-10;
 
  279  float dAir = 1.20479E-3;
 
  280  Mixture(98, 
"Vacum$", aAir, zAir, dAir1, 4, wAir);
 
  281  Mixture(99, 
"Air  $", aAir, zAir, dAir, 4, wAir);
 
  286  float aal2o3[2] = {26.981539, 15.9994};
 
  287  float zal2o3[2] = {13., 8.};
 
  288  float wal2o3[2] = {2., 3.};
 
  291  float aglass[2] = {28.0855, 15.9994};
 
  292  float zglass[2] = {14., 8.};
 
  293  float wglass[2] = {1., 2.};
 
  295  Mixture(6, 
"Al2O3   $", aal2o3, zal2o3, denscer, -2, wal2o3);
 
  296  Mixture(7, 
"glass   $", aglass, zglass, dglass, -2, wglass);
 
  319  Mixture(8, 
"Ceramic    $", aal2o3, zal2o3, denscer, -2, wal2o3);
 
  324  float tmaxfdSi = 10.0; 
 
  325  float stemaxSi = 0.1;  
 
  326  float deemaxSi = 0.1;  
 
  328  float epsilSi = 1.e-3; 
 
  329  float stminSi = 0.001; 
 
  341         isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 
nullptr, 0);
 
  344         isxfld, sxmgmx, tmaxfdSi, stemaxSi, deemaxSi, epsilSi, stminSi, 
nullptr, 0);
 
  347         isxfld, sxmgmx, tmaxfdSi, stemaxSi, deemaxSi, epsilSi, stminSi, 
nullptr, 0);
 
  351         isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.01, 
nullptr, 0);
 
  355         isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.0001, 
nullptr, 0);
 
  359         isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.0001, 
nullptr, 0);
 
  363         isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 
nullptr, 0);
 
  367         isxfld, sxmgmx, 10.0, 0.01, 0.1, 0.003, 0.003, 
nullptr, 0);
 
  371  Medium(
ID_PB, 
"Pb // The Scintillator must be first in order in vector for Rin to be set$", 10, 0,
 
  372         isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 
nullptr, 0);
 
  375         isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 
nullptr, 0);
 
  379         isxfld, sxmgmx, 10.0, 0.1, 0.1, epsil, 0.001, 
nullptr, 0);
 
  383         isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 
nullptr, 0);
 
  387         isxfld, sxmgmx, 10.0, 1.0, 0.1, 0.1, 1.0, 
nullptr, 0);
 
  391         isxfld, sxmgmx, 10.0, 1.0, 0.1, epsil, 0.001, 
nullptr, 0);
 
 
  506  TGeoVolumeAssembly* volHCAL = 
new TGeoVolumeAssembly(
"HCAL");
 
  508  TGeoVolumeAssembly* HcalTube = gGeoManager->MakeVolumeAssembly(
"ScintCuTubes");
 
  510  TGeoVolume* volCuTube;
 
  511  TGeoVolume* volSciFi;
 
  518  for (
auto& icomp : mGeoCompositions) {
 
  519    Length = icomp->sizeZ() / 2;
 
  521    if (icomp->material() == 
"Pb") {
 
  522      Rout = icomp->sizeX() / 2;
 
  524      volCuTube = gGeoManager->MakeTube(
"Tube", medium, Rin, Rout, Length); 
 
  525      volCuTube->SetLineWidth(2);
 
  526      volCuTube->SetLineColor(kRed);
 
  527      mSensitive.push_back(volCuTube->GetName());
 
  529      HcalTube->AddNode(volCuTube, 1, 
nullptr);
 
  531    if (icomp->material() == 
"Scint") {
 
  532      RScint = icomp->sizeX() / 2;
 
  533      Rin = RScint + 0.005;
 
  535      volSciFi = gGeoManager->MakeTube(
"ScintFiber", medium, 0., RScint, Length);
 
  536      volSciFi->SetLineWidth(2);
 
  537      volSciFi->SetLineColor(kBlue);
 
  539      mSensitive.push_back(volSciFi->GetName());
 
  540      HcalTube->AddNode(volSciFi, 1, 
nullptr);
 
  542    if (icomp->material() == 
"CuHCAL") {
 
  543      Rout = icomp->sizeX() / 2;
 
  545      volCuTube = gGeoManager->MakeTube(
"Tube", medium, Rin, Rout, Length); 
 
  546      volCuTube->SetLineWidth(2);
 
  547      volCuTube->SetLineColor(kRed);
 
  549      mSensitive.push_back(volCuTube->GetName());
 
  550      HcalTube->AddNode(volCuTube, 1, 
nullptr);
 
  557  double CuBoxThickness = 0.3; 
 
  559  TGeoBBox* ODBox = 
new TGeoBBox(
"TowerOD", TowerSize / 2, TowerSize / 2, Length);
 
  560  TGeoBBox* IDBox = 
new TGeoBBox(
"TowerID", (TowerSize - CuBoxThickness) / 2, (TowerSize - CuBoxThickness) / 2, Length + 0.01);
 
  561  TGeoCompositeShape* TowerHCAL = 
new TGeoCompositeShape(
"TowerHCAL", 
"TowerOD - TowerID");
 
  562  TGeoVolume* volTower = 
new TGeoVolume(
"volTower", TowerHCAL, gGeoManager->GetMedium(
getMediumID(
ID_COPPER)));
 
  563  volTower->SetLineWidth(2);
 
  564  volTower->SetLineColor(42);
 
  566  mSensitive.push_back(volTower->GetName());
 
  568  TGeoVolumeAssembly* volTowerHCAL = 
new TGeoVolumeAssembly(
"volTowerHCAL");
 
  569  volTowerHCAL->AddNode(volTower, 1, 
nullptr);
 
  577  while (RowPos + CuBoxThickness / 2 + Rout + 2 * Rout < TowerSize) {
 
  579    float ColumnPos = (Rows % 2 == 0) ? 0. : Rout;
 
  580    while (ColumnPos + CuBoxThickness / 2 + Rout + 2 * Rout < TowerSize) {
 
  582      TGeoTranslation* trans = 
new TGeoTranslation(ColumnPos - TowerSize / 2 + CuBoxThickness / 2 + Rout, RowPos - TowerSize / 2 + CuBoxThickness / 2 + Rout, 0.);
 
  584      trans->SetName(Form(
"trans_Num_%d", NumTubes));
 
  585      trans->RegisterYourself();
 
  587      volTowerHCAL->AddNode(HcalTube, NumTubes, trans);
 
  592      ColumnPos = Columns * 2 * Rout + ((Rows % 2 == 0) ? 0. : Rout);
 
  597    RowPos = Rows * 2 * Rout * TMath::Sin(TMath::Pi() / 3);
 
  601  Double_t BeamPipeRadius = 3.0;                             
 
  602  Double_t TowerHalfDiag = TMath::Sqrt2() * 0.5 * TowerSize; 
 
  603  Double_t MinRadius = BeamPipeRadius + TowerSize / 2;
 
  617    SizeXHCAL = SizeXHCAL / 2;
 
  619    TGeoVolumeAssembly* volHalfHCAL = 
new TGeoVolumeAssembly(
"HalfHCAL");
 
  621    for (Rows = 0; Rows < nTowersY; Rows++) {
 
  623      float ColumnPos = 0.;
 
  624      RowPos = Rows * TowerSize;
 
  625      for (Columns = 0; Columns < nTowersX / 2; Columns++) {
 
  626        ColumnPos = Columns * TowerSize;
 
  627        TGeoTranslation* trans = 
new TGeoTranslation(ColumnPos - SizeXHCAL / 2 + TowerSize / 2, RowPos - SizeYHCAL / 2 + TowerSize / 2, 0.);
 
  630        if (Rows == nTowersY / 2) {
 
  631          trans->SetDx(trans->GetTranslation()[0] + TowerSize / 2);
 
  635        volHalfHCAL->AddNode(volTowerHCAL, NumTowers, trans);
 
  639      volHCAL->AddNode(volHalfHCAL, 1, 
new TGeoTranslation(SizeXHCAL / 2 + mGeometry->
getDetectorOpeningRight(), 0, 0));
 
  640      TGeoRotation* rotFlipZ = 
new TGeoRotation();
 
  641      rotFlipZ->RotateY(180); 
 
  642      TGeoCombiTrans* combHalf = 
new TGeoCombiTrans(-SizeXHCAL / 2 - mGeometry->
getDetectorOpeningLeft(), 0., 0., rotFlipZ);
 
  643      volHCAL->AddNode(volHalfHCAL, 2, combHalf);
 
  646    for (Rows = 0; Rows < nTowersY; Rows++) {
 
  648      float ColumnPos = 0.;
 
  649      RowPos = Rows * TowerSize;
 
  650      for (Columns = 0; Columns < nTowersX; Columns++) {
 
  651        ColumnPos = Columns * TowerSize;
 
  652        TGeoTranslation* trans = 
new TGeoTranslation(ColumnPos - SizeXHCAL / 2 + TowerSize / 2, RowPos - SizeYHCAL / 2 + TowerSize / 2, 0.);
 
  655        Double_t RadialDistance = TMath::Power(trans->GetTranslation()[0], 2) + TMath::Power(trans->GetTranslation()[1], 2);
 
  657        if (RadialDistance < MinRadius * MinRadius || TMath::Abs(trans->GetTranslation()[0]) > SizeXHCAL / 2) {
 
  662        volHCAL->AddNode(volTowerHCAL, NumTowers, trans);
 
  669  LOG(info) << 
"Number of Towers is: " << (NumTowers - 1);
 
  670  LOG(info) << 
"Number of tubes is: " << (NumTubes - 1) * (NumTowers - 1);
 
  674  TGeoBBox* alHcalBox = 
new TGeoBBox(
"AlHCalBox", SizeXHCAL / 2.0, SizeYHCAL / 2.0, 0.5 / 2.0);
 
  675  TGeoVolume* volumeAlHcalBox = 
new TGeoVolume(
"volAlHcalBox", alHcalBox, gGeoManager->GetMedium(
getMediumID(
ID_ALUMINIUM)));
 
  676  volumeAlHcalBox->SetLineColor(kOrange);
 
  678    TVirtualMC::GetMC()->Gspos(
"volAlHcalBox", 9999, 
"FOCAL", 0.0, 0.0, +1.0 * mGeometry->
getFOCALSizeZ() / 2.0 + 1.0, 0, 
"ONLY");
 
  680    mSensitive.push_back(
"volAlHcalBox");
 
  682  TGeoBBox* alUnderBox = 
new TGeoBBox(
"AlUnderBox", SizeXHCAL / 2.0, 0.5, mGeometry->
getFOCALSizeZ() / 2.0 + 1.5);
 
  683  TGeoVolume* volumeAlUnderBox = 
new TGeoVolume(
"volAlUnderBox", alUnderBox, gGeoManager->GetMedium(
getMediumID(
ID_ALUMINIUM)));
 
  684  volumeAlUnderBox->SetLineColor(kOrange);
 
  686    TVirtualMC::GetMC()->Gspos(
"volAlUnderBox", 9999, 
"FOCAL", 0.0, -1.0 * mGeometry->
getFOCALSizeY() / 2 - 10.5, 0.0, 0, 
"ONLY");
 
  688    mSensitive.push_back(
"volAlUnderBox");
 
  691  volHCAL->SetVisibility();
 
  692  volHCAL->SetVisDaughters();
 
 
  701                                                  double hole_diameter,
 
  714  TGeoVolumeAssembly* pitchAssembly = 
new TGeoVolumeAssembly(
"pitchAssembly");
 
  717  float holeStart = 0.15; 
 
  718  float holeEnd = 0.35;   
 
  720  TGeoVolumeAssembly* volLowerSheetwHoles = 
new TGeoVolumeAssembly(Form(
"volLowerSheetwHoles_%s", suffix.c_str()));
 
  721  TGeoVolume* cuSheet = gGeoManager->MakeBox(
"cuSheet", copper, Lx / 2, (Ly1 - fiber_radius * 2) / 2, Lz / 2);
 
  722  cuSheet->SetLineColor(kOrange + 2);
 
  723  mSensitive.push_back(cuSheet->GetName());
 
  724  TGeoVolume* boxbegin = gGeoManager->MakeBox(
"BoxBegin", copper, holeStart / 2, fiber_radius, Lz / 2);
 
  725  boxbegin->SetLineColor(kOrange + 2);
 
  726  mSensitive.push_back(boxbegin->GetName());
 
  727  TGeoVolume* boxMiddle = gGeoManager->MakeBox(
"BoxMiddle", copper, (hole_spacing - hole_diameter) / 2, fiber_radius, Lz / 2);
 
  728  boxMiddle->SetLineColor(kOrange + 2);
 
  729  mSensitive.push_back(boxMiddle->GetName());
 
  730  TGeoVolume* boxEnd = gGeoManager->MakeBox(
"BoxEnd", copper, holeEnd / 2, fiber_radius, Lz / 2);
 
  731  boxEnd->SetLineColor(kOrange + 2);
 
  732  mSensitive.push_back(boxEnd->GetName());
 
  734  double yPlacement = Ly1 / 2 - fiber_radius;
 
  740  volLowerSheetwHoles->AddNode(cuSheet, 0, 
new TGeoTranslation(0, -Ly1 / 2 + (Ly1 - fiber_radius * 2) / 2, zpos));
 
  743  float start_x = -Lx / 2 + holeStart;
 
  745  for (
int ihole = 0; ihole < nholes; ++ihole) {
 
  746    float holePlacement = start_x + ihole * hole_spacing + hole_diameter / 2;
 
  748      volLowerSheetwHoles->AddNode(boxbegin, ihole, 
new TGeoTranslation(holePlacement - holeStart / 2 - hole_diameter / 2, yPlacement, zpos));
 
  749      volLowerSheetwHoles->AddNode(boxMiddle, ihole, 
new TGeoTranslation(holePlacement + hole_diameter / 2 + (hole_spacing - hole_diameter) / 2, yPlacement, zpos));
 
  750    } 
else if (ihole == nholes - 1) {
 
  751      if ((holePlacement + hole_diameter / 2 + holeStart) < Lx / 2 - 0.005) {
 
  752        volLowerSheetwHoles->AddNode(boxEnd, ihole, 
new TGeoTranslation(holePlacement + hole_diameter / 2 + holeEnd / 2, yPlacement, zpos));
 
  754        volLowerSheetwHoles->AddNode(boxbegin, ihole, 
new TGeoTranslation(holePlacement + hole_diameter / 2 + holeStart / 2, yPlacement, zpos));
 
  757      volLowerSheetwHoles->AddNode(boxMiddle, ihole, 
new TGeoTranslation(holePlacement + hole_diameter / 2 + (hole_spacing - hole_diameter) / 2, yPlacement, zpos));
 
  761  pitchAssembly->AddNode(volLowerSheetwHoles, 0, 
new TGeoTranslation(0, Ly1 / 2, zpos)); 
 
  766  TGeoVolume* fullSheet1 = gGeoManager->MakeBox(
"FullSheet1", copper, Lx / 2, Ly2 / 2, Lz / 2);
 
  767  fullSheet1->SetLineColor(kOrange + 2);
 
  768  mSensitive.push_back(fullSheet1->GetName());
 
  769  pitchAssembly->AddNode(fullSheet1, 0, 
new TGeoTranslation(0, Ly1 / 2 + Ly2 / 2 + Ly1 / 2, zpos)); 
 
  775  TGeoVolumeAssembly* volUpperSheetwHoles = 
new TGeoVolumeAssembly(Form(
"volUpperSheetwHoles_%s", suffix.c_str()));
 
  777  volUpperSheetwHoles->AddNode(cuSheet, 0, 
new TGeoTranslation(0, -Ly1 / 2 + (Ly1 - fiber_radius * 2) / 2, zpos));
 
  780  float start_x2 = -Lx / 2 + holeEnd;
 
  782  for (
int ihole = 0; ihole < nholes; ++ihole) {
 
  783    float holePlacement = start_x2 + ihole * hole_spacing + hole_diameter / 2;
 
  785      volUpperSheetwHoles->AddNode(boxEnd, ihole, 
new TGeoTranslation(holePlacement - hole_diameter / 2 - holeEnd / 2, yPlacement, zpos));
 
  786      volUpperSheetwHoles->AddNode(boxMiddle, ihole, 
new TGeoTranslation(holePlacement + hole_diameter / 2 + (hole_spacing - hole_diameter) / 2, yPlacement, zpos));
 
  787    } 
else if (ihole == nholes - 1) {
 
  788      volUpperSheetwHoles->AddNode(boxbegin, ihole, 
new TGeoTranslation(holePlacement + holeStart / 2 + hole_diameter / 2, yPlacement, zpos));
 
  790      if ((holePlacement + hole_spacing + hole_diameter / 2) < Lx / 2 - 0.005) {
 
  791        volUpperSheetwHoles->AddNode(boxMiddle, ihole, 
new TGeoTranslation(holePlacement + hole_diameter / 2 + (hole_spacing - hole_diameter) / 2, yPlacement, zpos));
 
  793        volUpperSheetwHoles->AddNode(boxEnd, ihole, 
new TGeoTranslation(holePlacement + hole_diameter / 2 + holeEnd / 2, yPlacement, zpos));
 
  799  pitchAssembly->AddNode(volUpperSheetwHoles, 0, 
new TGeoTranslation(0, Ly1 / 2 + Ly2 + Ly1 / 2 + Ly1 / 2, zpos)); 
 
  804  pitchAssembly->AddNode(fullSheet1, 1, 
new TGeoTranslation(0, Ly1 / 2 + Ly2 + Ly1 + Ly2 / 2 + Ly1 / 2, zpos)); 
 
  810  TGeoVolume* fiber = gGeoManager->MakeTube(
"Fiber", scint, 0, fiber_radius, Lz / 2);
 
  811  fiber->SetLineColor(kBlue);
 
  812  mSensitive.push_back(fiber->GetName());
 
  813  for (
int i = 0; 
i < nholes; ++
i) {
 
  814    float x_fiber = start_x + 
i * hole_spacing + hole_diameter / 2;
 
  815    pitchAssembly->AddNode(fiber, 
i, 
new TGeoTranslation(x_fiber, Ly1 / 2 - fiber_radius + Ly1 / 2, zpos));
 
  819  for (
int i = 0; 
i < nholes; ++
i) {
 
  820    float x_fiber = start_x2 + 
i * hole_spacing + hole_diameter / 2;
 
  821    if (x_fiber > Lx / 2 - 0.05) {
 
  824    pitchAssembly->AddNode(fiber, 
i + nholes, 
new TGeoTranslation(x_fiber, Ly1 / 2 + Ly2 + Ly1 / 2 + Ly1 / 2 - fiber_radius + Ly1 / 2, zpos));
 
  827  return pitchAssembly;
 
 
  833  TGeoVolumeAssembly* volHCAL = 
new TGeoVolumeAssembly(
"HCAL");
 
  841  double fiber_radius = 0.05;
 
  845  for (
auto& comp : mGeoCompositions) {
 
  848    if (comp->material() == 
"Scint") {
 
  849      fiber_radius = comp->sizeX() / 2;
 
  851    if (comp->material() == 
"CuHCAL" && icomp == 0) {
 
  855    if (comp->material() == 
"CuHCAL" && icomp == 2) {
 
  861  double hole_diameter = fiber_radius * 2 + 0.01; 
 
  863  int nholes = (
int)(Lx / hole_spacing); 
 
  866  int nBeamPipeHoles = (
int)((Lx - beamPipeHole / 2) / hole_spacing); 
 
  869  float pitch_height = Ly1 + Ly2 + Ly1 + Ly2;
 
  872  int numberOfPitchesBeamPipe = (
int)((beamPipeHole + 0.001) / pitch_height);    
 
  873  int numberofPitchesOnYaxis = (totalNumberOfPitches - numberOfPitchesBeamPipe); 
 
  875  TGeoVolumeAssembly* pitchAssembly = 
CreatePitchAssembly(Lx, Ly1, Ly2, Lz, hole_diameter, hole_spacing, nholes, fiber_radius, 
"Main");
 
  876  pitchAssembly->SetVisibility(
true);
 
  877  TGeoVolumeAssembly* beamPipeAssembly = 
CreatePitchAssembly(Lx - beamPipeHole / 2, Ly1, Ly2, Lz, hole_diameter, hole_spacing, nBeamPipeHoles, fiber_radius, 
"BeamPipe");
 
  878  beamPipeAssembly->SetVisibility(
true);
 
  880  TGeoVolumeAssembly* HalfHCAL = 
new TGeoVolumeAssembly(
"HalfHCAL");
 
  882  for (
int iPitch = 0; iPitch < numberofPitchesOnYaxis; iPitch++) {
 
  883    float placement = iPitch * pitch_height - pitch_height * (totalNumberOfPitches) / 2.0;
 
  884    if (placement < -beamPipeHole / 2.0) {
 
  885      HalfHCAL->AddNode(pitchAssembly, iPitch, 
new TGeoTranslation(0, placement, 0.));
 
  887      placement += beamPipeHole;
 
  888      HalfHCAL->AddNode(pitchAssembly, iPitch, 
new TGeoTranslation(0, placement, 0.));
 
  892  for (
int iPitch = 0; iPitch < numberOfPitchesBeamPipe; iPitch++) {
 
  893    float placement = iPitch * pitch_height - beamPipeHole / 2.0;
 
  894    HalfHCAL->AddNode(beamPipeAssembly, iPitch, 
new TGeoTranslation(-beamPipeHole / 4, placement, 0.));
 
  897  HalfHCAL->SetVisibility(
true);
 
  898  HalfHCAL->SetVisDaughters(
true);
 
  900  volHCAL->AddNode(HalfHCAL, 0, 
new TGeoTranslation(-Lx / 2, 0, 0.));
 
  901  TGeoRotation* rotFlipZ = 
new TGeoRotation();
 
  902  rotFlipZ->RotateY(180); 
 
  903  TGeoCombiTrans* combHalf = 
new TGeoCombiTrans(Lx / 2, 0., 0., rotFlipZ);
 
  904  volHCAL->AddNode(HalfHCAL, 1, combHalf);
 
 
  912  TGeoVolumeAssembly* volHCAL = 
new TGeoVolumeAssembly(
"HCAL");
 
  923  TGeoVolumeAssembly* volTower = 
new TGeoVolumeAssembly(
"Tower");
 
  925  int iCu(0), iScint(0);
 
  926  for (
auto& icomp : mGeoCompositions) {
 
  928    pars[0] = icomp->sizeX() / 2;
 
  929    pars[1] = icomp->sizeY() / 2;
 
  930    pars[2] = icomp->sizeZ() / 2;
 
  935    if (icomp->material() == 
"Pb") {
 
  938      const TGeoBBox* HPadBox = 
new TGeoBBox(
"HPadBox", pars[0], pars[1], pars[2]);
 
  939      TGeoVolume* HPad = 
new TGeoVolume(
"HPad", HPadBox, medium);
 
  940      HPad->SetLineColor(kGray);
 
  942      mSensitive.push_back(HPad->GetName());
 
  943      TGeoTranslation* trans = 
new TGeoTranslation(icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset);
 
  944      volTower->AddNode(HPad, iCu, trans);
 
  946    if (icomp->material() == 
"Scint") {
 
  949      const TGeoBBox* HScintBox = 
new TGeoBBox(
"HScintBox", pars[0], pars[1], pars[2]);
 
  950      TGeoVolume* HScint = 
new TGeoVolume(
"HScint", HScintBox, medium);
 
  951      HScint->SetLineColor(kBlue);
 
  953      mSensitive.push_back(HScint->GetName());
 
  954      TGeoTranslation* trans = 
new TGeoTranslation(icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset);
 
  955      volTower->AddNode(HScint, iScint, trans);
 
  957    if (icomp->material() == 
"CuHCAL") {
 
  960      const TGeoBBox* HPadBox = 
new TGeoBBox(
"HPadBox", pars[0], pars[1], pars[2]);
 
  961      TGeoVolume* HPad = 
new TGeoVolume(
"HPad", HPadBox, medium);
 
  962      HPad->SetLineColor(kRed);
 
  964      mSensitive.push_back(HPad->GetName());
 
  965      TGeoTranslation* trans = 
new TGeoTranslation(icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset);
 
  966      volTower->AddNode(HPad, iCu, trans);
 
  972  double BeamPipeRadius = 3.6;                             
 
  973  double TowerHalfDiag = TMath::Sqrt2() * 0.5 * TowerSize; 
 
  974  double MinRadius = BeamPipeRadius + TowerHalfDiag;
 
  988  for (Rows = 0; Rows < nTowersY; Rows++) {
 
  990    float ColumnPos = 0.;
 
  991    RowPos = Rows * TowerSize;
 
  992    for (Columns = 0; Columns < nTowersX; Columns++) {
 
  993      ColumnPos = Columns * TowerSize;
 
  995      TGeoTranslation* trans = 
new TGeoTranslation(ColumnPos - SizeXHCAL / 2 + TowerSize / 2, RowPos - SizeYHCAL / 2 + TowerSize / 2, 0.);
 
  998      double RadialDistance = TMath::Power(ColumnPos - SizeXHCAL / 2 + TowerSize / 2, 2) + TMath::Power(RowPos - SizeYHCAL / 2 + TowerSize / 2, 2);
 
 1000      if (RadialDistance < MinRadius * MinRadius) {
 
 1005      volHCAL->AddNode(volTower, NumTowers, trans);
 
 1010  LOG(info) << 
"Number of Towers is: " << (NumTowers - 1);
 
 1014  TGeoBBox* alHcalBox = 
new TGeoBBox(
"AlHCalBox", SizeXHCAL / 2.0, SizeYHCAL / 2.0, 0.5 / 2.0);
 
 1015  TGeoVolume* volumeAlHcalBox = 
new TGeoVolume(
"volAlHcalBox", alHcalBox, gGeoManager->GetMedium(
getMediumID(
ID_ALUMINIUM)));
 
 1016  volumeAlHcalBox->SetLineColor(kOrange);
 
 1018    TVirtualMC::GetMC()->Gspos(
"volAlHcalBox", 9999, 
"FOCAL", 0.0, 0.0, +1.0 * mGeometry->
getFOCALSizeZ() / 2.0 + 1.0, 0, 
"ONLY");
 
 1020  TGeoBBox* alUnderBox = 
new TGeoBBox(
"AlUnderBox", SizeXHCAL / 2.0, 0.5, mGeometry->
getFOCALSizeZ() / 2.0 + 1.5);
 
 1021  TGeoVolume* volumeAlUnderBox = 
new TGeoVolume(
"volAlUnderBox", alUnderBox, gGeoManager->GetMedium(
getMediumID(
ID_ALUMINIUM)));
 
 1022  volumeAlUnderBox->SetLineColor(kOrange);
 
 1024    TVirtualMC::GetMC()->Gspos(
"volAlUnderBox", 9999, 
"FOCAL", 0.0, -1.0 * mGeometry->
getFOCALSizeY() / 2 - 10.5, 0.0, 0, 
"ONLY");
 
 1027  TGeoVolume* volFOCAL = gGeoManager->GetVolume(
"FOCAL");
 
 
 1063  mSensitive.push_back(
"EMSC1");
 
 1064  mSensitive.push_back(
"EMSC2");
 
 1071  for (
auto& icomp : mGeoCompositions) {
 
 1073    pars[0] = icomp->sizeX() / 2.;
 
 1074    pars[1] = icomp->sizeY() / 2.;
 
 1075    pars[2] = icomp->sizeZ() / 2.;
 
 1078    if (icomp->material() == 
"PureW") {
 
 1082      mSensitive.push_back(
"EW1");
 
 1083      gGeoManager->GetVolume(
"EW1")->SetLineColor(kBlue);
 
 1084      TVirtualMC::GetMC()->Gspos(
"EW1", icomp->id() + 1, 
"EMSC1",
 
 1085                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1086      TVirtualMC::GetMC()->Gspos(
"EW1", icomp->id() + 1, 
"EMSC2",
 
 1087                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1089    if (icomp->material() == 
"Alloy") {
 
 1093      mSensitive.push_back(
"EW1");
 
 1094      TVirtualMC::GetMC()->Gspos(
"EW1", icomp->id() + 1, 
"EMSC1",
 
 1095                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1096      TVirtualMC::GetMC()->Gspos(
"EW1", icomp->id() + 1, 
"EMSC2",
 
 1097                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1100    if (icomp->material() == 
"G10") {
 
 1104      mSensitive.push_back(
"G10RO1");
 
 1105      gGeoManager->GetVolume(
"G10RO1")->SetLineColor(kGreen);
 
 1106      TVirtualMC::GetMC()->Gspos(
"G10RO1", icomp->id() + 1, 
"EMSC1",
 
 1107                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1108      TVirtualMC::GetMC()->Gspos(
"G10RO1", icomp->id() + 1, 
"EMSC2",
 
 1109                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1112    if (icomp->material() == 
"Cu") {
 
 1116      mSensitive.push_back(
"EWCU");
 
 1117      gGeoManager->GetVolume(
"EWCU")->SetLineColor(kViolet);
 
 1118      TVirtualMC::GetMC()->Gspos(
"EWCU", icomp->id() + 1, 
"EMSC1",
 
 1119                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1120      TVirtualMC::GetMC()->Gspos(
"EWCU", icomp->id() + 1, 
"EMSC2",
 
 1121                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1124    if (icomp->material() == 
"Air") {
 
 1128      mSensitive.push_back(
"EWAIR1");
 
 1129      gGeoManager->GetVolume(
"EWAIR1")->SetLineColor(kGray);
 
 1130      TVirtualMC::GetMC()->Gspos(
"EWAIR1", icomp->id() + 1, 
"EMSC1",
 
 1131                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1132      TVirtualMC::GetMC()->Gspos(
"EWAIR1", icomp->id() + 1, 
"EMSC2",
 
 1133                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1136    if (icomp->material() == 
"Ceramic") {
 
 1140      mSensitive.push_back(
"EWAIR1");
 
 1141      TVirtualMC::GetMC()->Gspos(
"EWAIR1", icomp->id() + 1, 
"EMSC1",
 
 1142                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1143      TVirtualMC::GetMC()->Gspos(
"EWAIR1", icomp->id() + 1, 
"EMSC2",
 
 1144                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1147    if (icomp->material() == 
"SiPad") {
 
 1151      mSensitive.push_back(
"EWSIPAD1");
 
 1152      gGeoManager->GetVolume(
"EWSIPAD1")->SetLineColor(kOrange - 7);
 
 1153      int number = (icomp->id()) + (icomp->stack() << 12) + (icomp->layer() << 16);
 
 1155      TVirtualMC::GetMC()->Gspos(
"EWSIPAD1", number + 1, 
"EMSC1",
 
 1156                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1157      TVirtualMC::GetMC()->Gspos(
"EWSIPAD1", number + 1, 
"EMSC2",
 
 1158                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1162    if (icomp->material() == 
"SiPix") {
 
 1166      mSensitive.push_back(
"EWSIPIX1");
 
 1167      gGeoManager->GetVolume(
"EWSIPIX1")->SetLineColor(kPink);
 
 1169      int number = (icomp->id()) + (icomp->stack() << 12) + (icomp->layer() << 16);
 
 1170      TVirtualMC::GetMC()->Gspos(
"EWSIPIX1", number + 1, 
"EMSC1",
 
 1172      TVirtualMC::GetMC()->Gspos(
"EWSIPIX1", number + 1, 
"EMSC2",
 
 1177    if (icomp->material() == 
"Si") {
 
 1181      mSensitive.push_back(
"EWSI1");
 
 1182      gGeoManager->GetVolume(
"EWSI1")->SetLineColor(kPink);
 
 1183      TVirtualMC::GetMC()->Gspos(
"EWSI1", icomp->id() + 1, 
"EMSC1",
 
 1184                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1185      TVirtualMC::GetMC()->Gspos(
"EWSI1", icomp->id() + 1, 
"EMSC2",
 
 1186                                 icomp->centerX(), icomp->centerY(), icomp->centerZ() - 
offset, 0, 
"ONLY");
 
 1192  TGeoVolume* volumeColdPlate = 
nullptr;
 
 1196    volumeColdPlate = 
new TGeoVolume(
"volColdPlate", coldPlateBox, gGeoManager->GetMedium(
getMediumID(
ID_COPPER)));
 
 1199    volumeColdPlate = 
new TGeoVolume(
"volColdPlate", coldPlateBox, gGeoManager->GetMedium(
getMediumID(
ID_ALUMINIUM)));
 
 1201    volumeColdPlate = 
new TGeoVolume(
"volColdPlate", coldPlateBox, gGeoManager->GetMedium(
getMediumID(
ID_AIR)));
 
 1204  mSensitive.push_back(volumeColdPlate->GetName());
 
 1205  volumeColdPlate->SetLineColor(kOrange);
 
 1220  mSensitive.push_back(
"ECAL");
 
 1225  TGeoVolume* volumeSiPad = 
new TGeoVolume(
"volSiPad", siPadBox, gGeoManager->GetMedium(
getMediumID(
ID_SIPAD)));
 
 1226  volumeSiPad->SetLineColor(kOrange + 7);
 
 1229    mSensitive.push_back(volumeSiPad->GetName());
 
 1233  int itowerx, itowery;
 
 1248      TVirtualMC::GetMC()->Gspos(
"EMSC1", number + 1, 
"ECAL", xp, yp, 0, 0, 
"ONLY");
 
 1251        TVirtualMC::GetMC()->Gspos(
"volSiPad", -1 * (number + 1), 
"FOCAL", xp, yp, -1.0 * geom->
getFOCALSizeZ() / 2.0, 0, 
"ONLY");
 
 1253        mSensitive.push_back(
"volSiPad");
 
 1256        mSensitive.push_back(
"volSiPad");
 
 1264      TVirtualMC::GetMC()->Gspos(
"EMSC2", number + 1, 
"ECAL", xp, yp, 0, 0, 
"ONLY");
 
 1267        TVirtualMC::GetMC()->Gspos(
"volSiPad", -1 * (number + 1), 
"FOCAL", xp, yp, -1.0 * geom->
getFOCALSizeZ() / 2.0, 0, 
"ONLY");
 
 1269        mSensitive.push_back(
"volSiPad");
 
 1272        mSensitive.push_back(
"volSiPad");