30 #include "GeoModelRead/ReadGeoModel.h"
31 #include "GeoModelKernel/GeoTube.h"
32 #include "GeoModelKernel/GeoLogVol.h"
33 #include "GeoModelKernel/GeoPhysVol.h"
34 #include "GeoModelKernel/GeoFullPhysVol.h"
35 #include "GeoModelKernel/GeoNameTag.h"
36 #include "GeoModelKernel/GeoIdentifierTag.h"
37 #include "GeoModelKernel/GeoTransform.h"
38 #include "GeoModelKernel/GeoAlignableTransform.h"
39 #include "GeoModelKernel/GeoMaterial.h"
40 #include "GeoModelKernel/GeoShapeShift.h"
41 #include "GeoModelKernel/GeoDefinitions.h"
42 #include "GaudiKernel/SystemOfUnits.h"
49 inline double sqr(
double x) {
return x*
x;}
53 const std::vector<SCT_FwdModule *> & modules,
58 GeoModelIO::ReadGeoModel* sqliteReader,
59 std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
60 std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX)
82 for (
int iRing = 0; iRing <
m_numRings; iRing++) {
117 for (
int iLoc = 0; iLoc <
parameters->fwdNumCylinderServiceLocs(); iLoc++) {
119 if(
parameters->fwdCylinderServiceLocName(iLoc) ==
"NPipe") {
137 for (
int iRing = 0; iRing <
m_numRings; iRing++){
140 m_rings.push_back(std::make_unique<SCT_FwdRing>(ringName,
m_modules[
ringType],
m_iWheel, iRing,
m_endcap,
m_detectorManager,
m_geometryManager,
m_materials,
m_sqliteReader,
m_mapFPV,
m_mapAX));
147 for (
int iRing = 0; iRing <
m_numRings; iRing++){
164 m_pPConnector = std::make_unique<SCT_FwdPPConnector>(
"PPConnector",
168 m_pPCooling = std::make_unique<SCT_FwdPPCooling>(
"PPCooling",
172 m_discFixation = std::make_unique<SCT_FwdDiscFixation>(
"DiscFixation",
178 for (
unsigned int iFSI = 0; iFSI <
m_fsiVector->size(); iFSI++) {
179 int type = (*m_fsiVector)[iFSI]->simType();
190 double maxModuleThickness = 0.5 *
m_discSupport->thickness();
194 for (
int iRing = 0; iRing <
m_numRings; iRing++){
197 maxModuleThickness =
std::max(maxModuleThickness,
m_rings[iRing]->thicknessOuter() +
m_rings[iRing]->ringOffset());
214 maxOuterRadius =
std::max(ppCoolingOuterRadius, maxOuterRadius);
220 maxOuterRadius =
std::max(discFixationOuterRadius, maxOuterRadius);
248 const GeoShape & fwdWheelEnvelopeShape = *tmpShape << GeoTrf::Translate3D(0, 0, envelopeShift);
250 const GeoLogVol * fwdWheelLog =
264 for (
int iRing = 0; iRing <
m_numRings; iRing++){
275 GeoFullPhysVol * wheel=
new GeoFullPhysVol(
m_logVolume);
285 double powerTapeZMinusMax = -0.5 *
m_discSupport->thickness();
287 double maxZOfRingsFront = 0;
289 for (
int iRing = 0; iRing <
m_numRings; iRing++){
296 maxZOfRingsFront =
std::max(maxZOfRingsFront, ringOuterZ);
299 wheel->add(
new GeoNameTag(ringNameTag));
301 wheel->add(
new GeoTransform(GeoTrf::Translate3D(0, 0, ringZpos)));
310 wheel->add(
new GeoTransform(GeoTrf::TranslateZ3D(coolingZpos)));
325 double powerTapeZstart = powerTapeZpos - 0.5 * powerTape.
thickness();
326 if (powerTapeZstart < powerTapeZPlusMax) {
327 powerTapeZpos = powerTapeZPlusMax + 0.5 * powerTape.
thickness();
329 powerTapeZPlusMax = powerTapeZpos + 0.5 * powerTape.
thickness();
331 double powerTapeZstart = powerTapeZpos + 0.5 * powerTape.
thickness();
332 if (powerTapeZstart > powerTapeZMinusMax) {
333 powerTapeZpos = powerTapeZMinusMax - 0.5 * powerTape.
thickness();
335 powerTapeZMinusMax = powerTapeZpos - 0.5 * powerTape.
thickness();
338 std::cout <<
"ERROR: Power tapes clash with modules!!!" << std::endl;
340 wheel->add(
new GeoTransform(GeoTrf::TranslateZ3D(powerTapeZpos)));
356 double powerTapeZMax = 0;
357 if (patchPanelSide > 0) {
358 powerTapeZMax = powerTapeZPlusMax;
360 powerTapeZMax = -powerTapeZMinusMax;
372 if (ppType >=
m_numPatchPanelTypes) std::cout <<
"ERROR: Patch Panel type number out of range!" << std::endl;
373 for (
int iRepeat = 0; iRepeat < numRepeat; iRepeat++) {
377 double patchPanelZpos = patchPanelSide * (powerTapeZMax + 0.5*
m_patchPanel[ppType]->thickness() +
m_safety);
382 std::cout <<
"ERROR: Patch Panel clashes with middle ring" << std::endl;
383 std::cout <<
" PatchPanel inner radius: " <<
m_patchPanel[ppType]->innerRadius() << std::endl;
384 std::cout <<
" Ring outer radius: " <<
m_rings[1]->outerRadius() << std::endl;
388 wheel->add(
new GeoTransform(GeoTrf::RotateZ3D(patchPanelAngle)*GeoTrf::TranslateX3D(patchPanelR)*GeoTrf::TranslateZ3D(patchPanelZpos)));
394 double ppConnectorZpos = patchPanelSide * (powerTapeZMax + 0.5*
m_pPConnector->thickness() +
m_safety);
398 std::cout <<
"ERROR: Patch Panel Connector clashes outside wheel" << std::endl;
399 std::cout <<
" PatchPanel Connector outer radius: " << ppConnectorR + 0.5*
m_pPConnector->deltaR() << std::endl;
400 std::cout <<
" Wheel outer radius: " <<
m_outerRadius << std::endl;
403 wheel->add(
new GeoTransform(GeoTrf::RotateZ3D(patchPanelAngle)*GeoTrf::TranslateX3D(ppConnectorR)*GeoTrf::TranslateZ3D(ppConnectorZpos)));
410 double ppCoolingZpos = patchPanelSide * (powerTapeZMax + 0.5*
m_pPCooling->thickness() +
m_safety);
414 std::cout <<
"ERROR: Patch Panel Cooling clashes outside wheel" << std::endl;
415 std::cout <<
" PatchPanel Cooling outer radius: " << ppCoolingR + 0.5*
m_pPCooling->deltaR() << std::endl;
416 std::cout <<
" Wheel outer radius: " <<
m_outerRadius << std::endl;
419 wheel->add(
new GeoTransform(GeoTrf::RotateZ3D(patchPanelAngle)*GeoTrf::TranslateX3D(ppCoolingR)*GeoTrf::TranslateZ3D(ppCoolingZpos)));
431 std::string optoharnessName =
"OptoHarnessO";
437 wheel->add(
new GeoTransform(GeoTrf::TranslateZ3D(optoHarnessZpos)));
439 optoHarnessZMax = optoHarnessZpos + 0.5*optoharness.
thickness();
443 for (
unsigned int iFSI = 0; iFSI <
m_fsiVector->size(); iFSI++) {
444 int type = (*m_fsiVector)[iFSI]->simType();
445 double fsiRadius = (*m_fsiVector)[iFSI]->location().radius();
446 double fsiPhi = (*m_fsiVector)[iFSI]->location().phi();
447 int fsiUsualSide = (*m_fsiVector)[iFSI]->location().side();
452 if (fsiUsualSide < 0) {
453 double zMin = std::abs(fsiZpos) - 0.5*
m_fsiType[
type]->thickness();
454 if (maxZOfRingsFront > zMin) {
455 std::cout <<
"WARNING: FSI probably clashes with ring" << std::endl;
456 std::cout <<
" maxZOfRingsFront = " << maxZOfRingsFront << std::endl;
457 std::cout <<
" fsiZMin = " << zMin << std::endl;
464 double servicesZMax = (fsiRadius > diskMidRadius) ? powerTapeZMax : optoHarnessZMax;
465 double zMin = std::abs(fsiZpos) - 0.5*
m_fsiType[
type]->thickness();
466 if (servicesZMax > zMin) {
467 std::cout <<
"WARNING: FSI probably clashes with disc services" << std::endl;
468 std::cout <<
" servicesZMax = " << servicesZMax << std::endl;
469 std::cout <<
" fsiZMin = " << zMin << std::endl;
470 std::cout <<
" fsiRadius = " << fsiRadius << std::endl;
474 wheel->add(
new GeoTransform(GeoTrf::RotateZ3D(fsiPhi)*GeoTrf::TranslateX3D(fsiRadius)*GeoTrf::TranslateZ3D(fsiZpos)));
484 for (
int iRepeat = 0; iRepeat < 4; iRepeat++) {
490 std::cout <<
"ERROR: Disc Fixation outside wheel" << std::endl;
491 std::cout <<
"Disc fixation outer radius: " << discFixationR + 0.5*
m_discFixation->thickness() << std::endl;
492 std::cout <<
" Wheel outer radius: " <<
m_outerRadius << std::endl;
495 wheel->add(
new GeoTransform(GeoTrf::RotateY3D(90.*
Gaudi::Units::degree)*GeoTrf::RotateX3D(discFixationAngle)*GeoTrf::TranslateZ3D(discFixationR)));
503 xMat.
add(wheel,
"SCTDisc");
506 xMat.
add(wheel,
"SCTDiscA");
509 xMat.
add(wheel,
"SCTDiscC");