From f4822bc4766c1123bc854b0e48ff54de36d66f03 Mon Sep 17 00:00:00 2001 From: Jennifer Klay Date: Tue, 12 Jul 2022 18:41:40 +0000 Subject: [PATCH 1/4] major revision: updated FT0 frame geometry for both A and C side detectors --- Detectors/FIT/FT0/base/src/Geometry.cxx | 22 +- .../include/FT0Simulation/Detector.h | 87 +- Detectors/FIT/FT0/simulation/src/Detector.cxx | 1168 ++++++++++------- 3 files changed, 739 insertions(+), 538 deletions(-) diff --git a/Detectors/FIT/FT0/base/src/Geometry.cxx b/Detectors/FIT/FT0/base/src/Geometry.cxx index 09eead0a77a41..af7dfa9440235 100644 --- a/Detectors/FIT/FT0/base/src/Geometry.cxx +++ b/Detectors/FIT/FT0/base/src/Geometry.cxx @@ -31,16 +31,20 @@ Geometry::Geometry() : mMCP{{0, 0, 0}} void Geometry::setAsideModules() { - Float_t mPosModuleAx[Geometry::NCellsA] = {-12.2, -6.1, 0, 6.1, 12.2, -12.2, -6.1, 0, - 6.1, 12.2, -13.3743, -7.274299999999999, - 7.274299999999999, 13.3743, -12.2, -6.1, 0, - 6.1, 12.2, -12.2, -6.1, 0, 6.1, 12.2}; - - Float_t mPosModuleAy[Geometry::NCellsA] = {12.2, 12.2, 13.53, 12.2, 12.2, 6.1, 6.1, - 7.43, 6.1, 6.1, 0, 0, 0, 0, -6.1, -6.1, - -7.43, -6.1, -6.1, -12.2, -12.2, -13.53, - -12.2, -12.2}; + //These are coordinate positions for the sensitive elements within the FIT mother volume + //measured from the CAD drawings. The positive/negative X values are referenced + //from the back side of the frame lookinmg toward the interaction point + Float_t mPosModuleAx[Geometry::NCellsA] = { -12.25, -6.15, -0.05, 6.15, 12.25, + -12.25, -6.15, -0.05, 6.15, 12.25, + -13.58, -7.48, 7.48, 13.58, + -12.25, -6.15, 0.05, 6.15, 12.25, + -12.25, -6.15, 0.05, 6.15, 12.25}; + Float_t mPosModuleAy[Geometry::NCellsA] = { 12.2, 12.2, 13.53, 12.2, 12.2, + 6.1, 6.1, 7.43, 6.1, 6.1, + 0.0, 0.0, 0.0, 0.0, + -6.1, -6.1, -7.43, -6.1, -6.1, + -12.2, -12.2, -13.53, -12.2, -12.2}; // A side Translations for (Int_t ipmt = 0; ipmt < NCellsA; ipmt++) { mMCP[ipmt].SetXYZ(mPosModuleAx[ipmt], mPosModuleAy[ipmt], ZdetA); diff --git a/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h b/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h index 9f40cbe34d27b..856cadeb2e65e 100644 --- a/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h +++ b/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h @@ -149,99 +149,32 @@ class Detector : public o2::base::DetImpl std::vector mRindexFrontWindow; // Define the aluminium frame for the detector - TGeoVolume* constructFrameGeometry(); - std::string frame1CompositeShapeBoolean(); - std::string frame2CompositeShapeBoolean(); - std::string frameCompositeShapeBoolean(); - std::string plateGroupCompositeShapeBoolean(); - std::string opticalFiberPlateCompositeShapeBoolean1(); - std::string opticalFiberPlateCompositeShapeBoolean2(); - std::string pmtCornerCompositeShapeBoolean(); - std::string pmtCompositeShapeBoolean(); - std::string plateBoxCompositeShapeBoolean(); - void defineTransformations(); - void defineQuartzRadiatorTransformations(); - void definePmtTransformations(); - void definePlateTransformations(); - void defineFrameTransformations(); - + TGeoVolume* constructFrameAGeometry(); //A-side + TGeoVolume* constructFrameCGeometry(); //C-side + std::string cPlateShapeString(); + // BEGIN: Support structure constants // define some error to avoid overlaps static constexpr Float_t sEps = 0.05; - // offset found to potentially remove overlaps - static constexpr Float_t sXoffset = 0.3027999999999995; - static constexpr Float_t sYoffset = -0.6570999999999998; - - // frame 1 has a longer side horizontal - static constexpr Float_t sFrame1X = 21.500; - static constexpr Float_t sFrame1Y = 13.705; - static constexpr Float_t sFrame1PosX = 7.9278 - sXoffset; - static constexpr Float_t sFrame1PosY = 9.2454 - sYoffset; - static constexpr Float_t sRect1X = 15; - static constexpr Float_t sRect1Y = 1.33; - static constexpr Float_t sRect2X = 2.9; - static constexpr Float_t sRect2Y = 12.2; - static constexpr Float_t sRect3X = 1.57; - static constexpr Float_t sRect3Y = .175; - static constexpr Float_t sRect4X = 5.65; - static constexpr Float_t sRect4Y = 1.075; - // frame 2 has a longer side vertical - static constexpr Float_t sFrame2X = 13.930; - static constexpr Float_t sFrame2Y = 21.475; - static constexpr Float_t sFrame2PosX = 10.1428 - sXoffset; - static constexpr Float_t sFrame2PosY = -8.3446 - sYoffset; - static constexpr Float_t sRect5X = 1.33; - static constexpr Float_t sRect5Y = 12.1; - - static constexpr Float_t sRect6X = .83; - static constexpr Float_t sRect6Y = 3.0; - static constexpr Float_t sRect7X = 13.1; - static constexpr Float_t sRect7Y = 3.0; - static constexpr Float_t sRect8X = 1.425; - static constexpr Float_t sRect8Y = 5.5; - - // both frame boxes are the same height static constexpr Float_t sFrameZ = 5.700; - static constexpr Float_t sMountZ = 1.5; // PMT socket dimensions static constexpr Float_t sPmtSide = 5.950; static constexpr Float_t sPmtZ = 3.750; // quartz radiator socket dimensions - // static constexpr Float_t sQuartzRadiatorSide = 5.350; - // static constexpr Float_t sQuartzRadiatorZ = 1.950; - static constexpr Float_t sQuartzRadiatorSide = 5.40; - static constexpr Float_t sQuartzRadiatorZ = 2.0; + static constexpr Float_t sQuartzRadiatorSide = 5.350; + static constexpr Float_t sQuartzRadiatorZ = 1.950; // for the rounded socket corners - static constexpr Float_t sCornerRadius = .300; - - // bottom plates on the frame - static constexpr Float_t sPlateSide = 6.000; - static constexpr Float_t sBasicPlateZ = 0.200; - static constexpr Float_t sCablePlateZ = 0.500; - static constexpr Float_t sFiberHeadX = 0.675 * 2; - static constexpr Float_t sFiberHeadY = 0.275 * 2; - - // plate transformations - static constexpr Float_t sOpticalFiberPlateZ = 0.35; - static constexpr Float_t sPlateSpacing = 6.100; - static constexpr Float_t sPlateDisplacementDeltaY = 1.33; - static constexpr Float_t sPlateDisplacementX = sPlateSpacing + 0.3028; - static constexpr Float_t sPlateDisplacementY = 12.8789 - sPlateDisplacementDeltaY; - static constexpr Float_t sPlateGroupZ = -sFrameZ / 2 - sOpticalFiberPlateZ; + static constexpr Float_t sCornerRadius = 0.300; // quartz & PMT socket transformations static constexpr Float_t sQuartzHeight = -sFrameZ / 2 + sQuartzRadiatorZ / 2; static constexpr Float_t sPmtHeight = sFrameZ / 2 - sPmtZ / 2; - static constexpr Float_t sPmtCornerTubePos = -.15; + static constexpr Float_t sPmtCornerTubePos = -0.15; static constexpr Float_t sPmtCornerPos = 2.825; - static constexpr Float_t sEdgeCornerPos[2] = {-6.515, -.515}; + static constexpr Float_t sEdgeCornerPos[2] = {-6.515, -0.515}; static constexpr Float_t sQuartzFrameOffsetX = -1.525; - static constexpr Float_t sPos1X[3] = {sQuartzFrameOffsetX - sPlateSpacing, sQuartzFrameOffsetX, sQuartzFrameOffsetX + sPlateSpacing}; - static constexpr Float_t sPos1Y[4] = {3.6275, -2.4725, 2.2975, -3.8025}; - static constexpr Float_t sPos2X[4] = {3.69, -2.410, 2.360, -3.740}; - static constexpr Float_t sPos2Y[3] = {7.6875, 1.5875, -4.5125}; // END: Support structure constants /// Container for data points @@ -276,7 +209,7 @@ class Detector : public o2::base::DetImpl Float_t mStartA[3] = {20., 20., 5}; Float_t mInStart[3] = {2.9491, 2.9491, 2.6}; - ClassDefOverride(Detector, 5); + ClassDefOverride(Detector, 6); }; // Input and output function for standard C++ input/output. diff --git a/Detectors/FIT/FT0/simulation/src/Detector.cxx b/Detectors/FIT/FT0/simulation/src/Detector.cxx index b9a999f03d37c..39619c5a9aa8c 100644 --- a/Detectors/FIT/FT0/simulation/src/Detector.cxx +++ b/Detectors/FIT/FT0/simulation/src/Detector.cxx @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include "TGeoManager.h" // for TGeoManager @@ -122,8 +123,9 @@ void Detector::ConstructGeometry() LOG(debug) << " A geom " << itr << " " << mPosModuleAx[itr] << " " << mPosModuleAy[itr]; } SetCablesA(stlinA); + // Add FT0-A support Structure to the geometry - stlinA->AddNode(constructFrameGeometry(), 1, new TGeoTranslation(0, 0, -mStartA[2] + mInStart[2])); + stlinA->AddNode(constructFrameAGeometry(), 1, new TGeoTranslation(0, 0, -mStartA[2] + mInStart[2])); // C Side TGeoRotation* rot[nCellsC]; @@ -132,6 +134,12 @@ void Detector::ConstructGeometry() TGeoCombiTrans* comCable[nCellsC]; TString nameCom; + //Additional elements for the C-side frame + TGeoCombiTrans* plateCom[nCellsC]; + TGeoMedium* Al = gGeoManager->GetMedium("FT0_Aluminium$"); + TGeoCompositeShape* plateCompositeShape = new TGeoCompositeShape("plateCompositeShape", cPlateShapeString().c_str()); + TGeoVolume* plateVol = new TGeoVolume("plateVol", plateCompositeShape, Al); + for (Int_t itr = Geometry::NCellsA; itr < Geometry::NCellsA + nCellsC; itr++) { nameTr = Form("0TR%i", itr + 1); nameRot = Form("0Rot%i", itr + 1); @@ -153,14 +161,26 @@ void Detector::ConstructGeometry() TGeoVolume* cables = SetCablesSize(itr); LOG(debug) << " C " << mPosModuleCx[ic] << " " << mPosModuleCy[ic]; // cables->Print(); - comCable[ic] = new TGeoCombiTrans(mPosModuleCx[ic], mPosModuleCy[ic], mPosModuleCz[ic] + mInStart[2] + 0.2, rot[ic]); + //Additional shift (+0.1) introduced to cable planes so they don't overlap the C-side frame + comCable[ic] = new TGeoCombiTrans(mPosModuleCx[ic], mPosModuleCy[ic], mPosModuleCz[ic] + mInStart[2] + 0.2 + 0.1, rot[ic]); TGeoHMatrix hmCable = *comCable[ic]; TGeoHMatrix* phCable = new TGeoHMatrix(hmCable); stlinC->AddNode(cables, itr, comCable[ic]); - } + //C-side frame elements - module plates + plateCom[ic] = new TGeoCombiTrans(mPosModuleCx[ic], mPosModuleCy[ic], (mPosModuleCz[ic] - 3), rot[ic]); + TGeoHMatrix hmPlate = *plateCom[ic]; + TGeoHMatrix* phPlate = new TGeoHMatrix(hmPlate); + stlinC->AddNode(plateVol, itr, phPlate); + } + //Add C-side frame + stlinC->AddNode(constructFrameCGeometry(), nCellsA + nCellsC + 1); + TGeoVolume* alice = gGeoManager->GetVolume("barrel"); - alice->AddNode(stlinA, 1, new TGeoTranslation(0, 30., zdetA)); + //Add A-side detector + alice->AddNode(stlinA, 1, new TGeoTranslation(0, 30., zdetA+0.63)); //offset to avoid overlap with FV0 + + //Add C-side detector TGeoRotation* rotC = new TGeoRotation("rotC", 90., 0., 90., 90., 180., 0.); alice->AddNode(stlinC, 1, new TGeoCombiTrans(0., 30., -zdetC, rotC)); @@ -384,13 +404,19 @@ void Detector::addAlignableVolumes() const } } -// Class wrapper for construction of FT0-A support structure -// The frame is constructed by defining two aluminum boxes that are placed in an L-shape, -// with material sequentially removed to re-create the CAD drawings, -// including sockets defined by the parameters of the sensitive elements that they are placed into -// Two L-shaped elements form the full support structure, with one reflected about the axes of symmetry -// First written by Joe Crowley and revised by Jason Pruitt from Cal Poly in 2019-2021 -TGeoVolume* Detector::constructFrameGeometry() +//Construction of FT0-A support structure +//The frame is constructed by first building a block of Aluminum as a mother volume from which details can +//be subtracted. First, 6 boxe shapes are subtracted from around the edges and 2 from the center of the frame +//to create the fin shapes at the edges of the detector and the cross shape at the center of the detector. +//These boxe shapes are then subtracted again but from positions reflected in both x and y which is +//reflects the symmetry of the frame. Then a loop is used to subtract out the PMT sockets which are also +//box shapes from the positions given in the Geometry.cxx file. In the loop, after a socket is subtracted, +//either an inner or an outer plate group is placed inside of it. Inner and outer plate groups are +//both composed of a cover plate and a cable plate with fiber heads subtracted from the cable plate. +//The orientation of these holes differs between the inner and outer plates making them distinct. +//Contributors: Joe Crowley (2019-20), Jason Pruitt (2020-21), Sam Christensen (2021-22), +//and Jennifer Klay (2019-22) from Cal Poly SLO. +TGeoVolume* Detector::constructFrameAGeometry() { // define the media TGeoMedium* Vacuum = gGeoManager->GetMedium("FT0_Vacuum$"); @@ -399,477 +425,715 @@ TGeoVolume* Detector::constructFrameGeometry() // make a volume assembly for the frame TGeoVolumeAssembly* FT0_Frame = new TGeoVolumeAssembly("FT0_Frame"); - // define translations for the quartz radiator and PMT sockets - defineTransformations(); - - // frame1 and frame2 are rectangles that approximate the outline of one L - // shape of the frame - TGeoBBox* frame1 = new TGeoBBox("frame1", sFrame1X / 2, sFrame1Y / 2, sFrameZ / 2); - TGeoBBox* frame2 = new TGeoBBox("frame2", sFrame2X / 2, sFrame2Y / 2, sFrameZ / 2); - - // the following elements are subtracted from frame1 and frame2 to better - // approximate the CAD shape - TGeoBBox* rect1 = new TGeoBBox("rect1", sRect1X / 2, sRect1Y / 2, sFrameZ / 2); - TGeoBBox* rect2 = new TGeoBBox("rect2", sRect2X / 2, sRect2Y / 2 + sEps, sFrameZ / 2 - sMountZ / 2); - TGeoBBox* rect3 = new TGeoBBox("rect3", sRect3X / 2, sRect3Y / 2, sFrameZ / 2); - TGeoBBox* rect4 = new TGeoBBox("rect4", sRect4X / 2, sRect4Y / 2, sFrameZ / 2); - TGeoBBox* rect5 = new TGeoBBox("rect5", sRect5X / 2 + sEps, sRect5Y / 2 + sEps, sFrameZ / 2 + sEps); - TGeoBBox* rect6 = new TGeoBBox("rect6", sRect6X / 2 + sEps, sRect6Y / 2 + sEps, sFrameZ / 2 + sEps); - TGeoBBox* rect7 = new TGeoBBox("rect7", sRect7X / 2 + sEps, sRect7Y / 2 + sEps, sFrameZ / 2 - sMountZ / 2 + sEps); - TGeoBBox* rect8 = new TGeoBBox("rect8", sRect8X / 2 + sEps, sRect8Y / 2 + sEps, sFrameZ / 2 + sEps); - - // Define a value to overcut the coincidence between the closure of the tube - // and the edge of the rectangle to eliminate artifacts - Double_t flopsErr = .00001; - // PMT and quartz radiator shapes provide the dimensions of the sockets to be subtracted - // from the frame that will make room for a sensitive element to fit - TGeoBBox* quartzRadiator = new TGeoBBox("quartzRadiator", sQuartzRadiatorSide / 2, sQuartzRadiatorSide / 2, sQuartzRadiatorZ / 2); - TGeoBBox* pmtBox = new TGeoBBox("pmtBox", sPmtSide / 2 + sEps, sPmtSide / 2 + sEps, sPmtZ / 2 + sEps); - - // these two shapes create a subtraction so that the corners of the holes that - // seat the sens elements are rounded - TGeoBBox* pmtCornerRect = new TGeoBBox("pmtCornerRect", sCornerRadius / 2 - flopsErr, sCornerRadius / 2 - flopsErr, sPmtZ / 2); - TGeoTube* pmtCornerTube = new TGeoTube("pmtCornerTube", 0, sCornerRadius, sPmtZ / 2 + sEps); - TGeoVolume* PMTCorner = new TGeoVolume("PMTCorner", new TGeoCompositeShape("PMTCorner", pmtCornerCompositeShapeBoolean().c_str()), Al); - // TGeoVolume* PMT = new TGeoVolume("PMT", new TGeoCompositeShape("PMT", pmtCompositeShapeBoolean().c_str()), Vacuum); - TGeoVolume* PMT = gGeoManager->MakeBox("PMT", Vacuum, sPmtSide / 2 + sEps, sPmtSide / 2 + sEps, sPmtZ / 2 + sEps); - - // add the plates on the bottom of the frame - TGeoBBox* basicPlate = new TGeoBBox("basicPlate", sPlateSide / 2, sPlateSide / 2, sBasicPlateZ / 2); - TGeoBBox* cablePlate = new TGeoBBox("cablePlate", sPlateSide / 2, sPlateSide / 2, sCablePlateZ / 2); - TGeoBBox* opticalFiberHead = new TGeoBBox("opticalFiberHead", sFiberHeadX / 2, sFiberHeadY / 2, sCablePlateZ / 2); - TGeoCompositeShape* opticalFiberPlate1 = new TGeoCompositeShape("opticalFiberPlate1", opticalFiberPlateCompositeShapeBoolean1().c_str()); - TGeoCompositeShape* opticalFiberPlate2 = new TGeoCompositeShape("opticalFiberPlate2", opticalFiberPlateCompositeShapeBoolean2().c_str()); - TGeoCompositeShape* plateBox = new TGeoCompositeShape("plateBox", plateBoxCompositeShapeBoolean().c_str()); - // holds 2 basic plates and 2 cable plates - TGeoVolume* plateGroup = new TGeoVolume("plateGroup", new TGeoCompositeShape("plateGroup", plateGroupCompositeShapeBoolean().c_str()), Al); // holds 3 plate boxes - // remove the material to form the sockets for the quartz radiators and PMTs - TGeoCompositeShape* frameRemovedPMTandRadiators1 = new TGeoCompositeShape("frameRemovedPMTandRadiators1", frame1CompositeShapeBoolean().c_str()); - TGeoCompositeShape* frameRemovedPMTandRadiators2 = new TGeoCompositeShape("frameRemovedPMTandRadiators2", frame2CompositeShapeBoolean().c_str()); - - // make the right side frame - L shape - TGeoVolume* frame = new TGeoVolume("frame", new TGeoCompositeShape("frame", frameCompositeShapeBoolean().c_str()), Al); - - // reflection for the left side of the frame - TGeoRotation* reflect = new TGeoRotation("reflect"); - reflect->ReflectX(true); - reflect->ReflectY(true); - reflect->RegisterYourself(); - - // add a shift to eliminate overlaps between sens elements and frame sockets - // this shift will apply to both sides of the frame - TGeoTranslation* xshift = new TGeoTranslation("xshift", .1028, 0, 0); - - // add the right and left sides to top volume - FT0_Frame->AddNode(frame, 1, xshift); // right side - FT0_Frame->AddNode(frame, 2, reflect); // left side + //Define the block of aluminum that forms the frame + Double_t blockdX = 37.1; //slightly larger in x + Double_t blockdY = 36.85; //than y + Double_t blockdZ = 6.95; //thickness of frame and back plates + TGeoBBox* block = new TGeoBBox("block",blockdX/2,blockdY/2,blockdZ/2); + + //To form the outer frame shape with fins that bolt it to the FV0, remove + //aluminum in six chunks (boxes) from two sides, then reflect these to remove + //from the other sides. As viewed from the back side of the detector, count + //clockwise from bottom left for numbering. + Double_t box1dX = 1.57; //narrower + Double_t box1dY = 6.55; //than it is tall + Double_t box1PosX = -(blockdX/2 - box1dX/2); //placement on the frame block + Double_t box1PosY = 0; //starts at the middle + TGeoBBox* box1 = new TGeoBBox("box1",box1dX/2,box1dY/2,blockdZ/2); + TGeoTranslation* box1Tr1 = new TGeoTranslation("box1Tr1",box1PosX,box1PosY,0); + box1Tr1->RegisterYourself(); + TGeoTranslation* box1Tr2 = new TGeoTranslation("box1Tr2",-box1PosX,-box1PosY,0); + box1Tr2->RegisterYourself(); + + Double_t box2dX = 2.9; + Double_t box2dY = 15.1; + Double_t box2PosX = -(blockdX/2 - box2dX/2); + Double_t box2PosY = blockdY/2 - box2dY/2; + TGeoBBox* box2 = new TGeoBBox("box2",box2dX/2,box2dY/2,blockdZ/2); + TGeoTranslation* box2Tr1 = new TGeoTranslation("box2Tr1",box2PosX,box2PosY,0); + box2Tr1->RegisterYourself(); + TGeoTranslation* box2Tr2 = new TGeoTranslation("box2Tr2",-box2PosX,-box2PosY,0); + box2Tr2->RegisterYourself(); + + //Box 3 is shallower than the others to preserve the aluminum fin where the + //FT0 is bolted to the FV0 + Double_t box3dX = 12.7; + Double_t box3dY = 3; + Double_t box3dZ = 5.45; + Double_t box3PosX = -(blockdX/2 - box2dX - box3dZ/2); + Double_t box3PosY = blockdY/2 - box3dY/2; + Double_t box3PosZ = blockdZ/2 - box3dZ/2; //subtract from the back, leaving fin on the front + TGeoBBox* box3 = new TGeoBBox("box3",box3dX/2,box3dY/2,box3dZ/2); + TGeoTranslation* box3Tr1 = new TGeoTranslation("box3Tr1",box3PosX,box3PosY,box3PosZ); + box3Tr1->RegisterYourself(); + TGeoTranslation* box3Tr2 = new TGeoTranslation("box3Tr2",-box3PosX,-box3PosY,box3PosZ); + box3Tr2->RegisterYourself(); + + Double_t box4dX = 6.6; + Double_t box4dY = 1.67; + Double_t box4PosX = 0; + Double_t box4PosY = blockdY/2 - box4dY/2; + TGeoBBox* box4 = new TGeoBBox("box4",box4dX/2,box4dY/2,blockdZ/2); + TGeoTranslation* box4Tr1 = new TGeoTranslation("box4Tr1",box4PosX,box4PosY,0); + box4Tr1->RegisterYourself(); + TGeoTranslation* box4Tr2 = new TGeoTranslation("box4Tr2",-box4PosX,-box4PosY,0); + box4Tr2->RegisterYourself(); + + Double_t box5dX = 15; + Double_t box5dY = 3; + Double_t box5PosX = blockdX/2 - box5dX/2; + Double_t box5PosY = blockdY/2 - box5dY/2; + TGeoBBox* box5 = new TGeoBBox("box5",box5dX/2,box5dY/2,blockdZ/2); + TGeoTranslation* box5Tr1 = new TGeoTranslation("box5Tr1",box5PosX,box5PosY,0); + box5Tr1->RegisterYourself(); + TGeoTranslation* box5Tr2 = new TGeoTranslation("box5Tr2",-box5PosX,-box5PosY,0); + box5Tr2->RegisterYourself(); + + //Similar to box 3, box 6 is shallower in z to leave aluminum for the fin that + //bolts FT0 to FV0 + Double_t box6dX = 2.9; + Double_t box6dY = 12.2; + Double_t box6dZ = 5.45; + Double_t box6PosX = blockdX/2 - box6dX/2; + Double_t box6PosY = blockdY/2 - box5dY - box6dY/2; + Double_t box6PosZ = blockdZ/2 - box6dZ/2; //subtract from the back, leaving fin at the front + TGeoBBox* box6 = new TGeoBBox("box6",box6dX/2,box6dY/2,box6dZ/2); + TGeoTranslation* box6Tr1 = new TGeoTranslation("box6Tr1",box6PosX,box6PosY,box6PosZ); + box6Tr1->RegisterYourself(); + TGeoTranslation* box6Tr2 = new TGeoTranslation("box6Tr2",-box6PosX,-box6PosY,box6PosZ); + box6Tr2->RegisterYourself(); + + //The central hole that accommodates the beam pipe is not the same on all four sides + //so we define two rectangular boxes - one vertical and one horizontal - and copy/rotate them + //to remove the aluminum in a "+" shape at the center + // cbox is a central rectangle + Double_t cbox1dX = 7.175; //horizontal center box + Double_t cbox1dY = 5.5; + Double_t cbox1Xoffset = 14.425; + Double_t cbox1PosX = -(blockdX/2 - cbox1Xoffset - cbox1dX/2); + Double_t cbox1PosY = 0; + TGeoBBox* cbox1 = new TGeoBBox("cbox1",cbox1dX/2,cbox1dY/2,blockdZ/2); + TGeoTranslation* cbox1Tr1 = new TGeoTranslation("cbox1Tr1",cbox1PosX,cbox1PosY,0); + cbox1Tr1->RegisterYourself(); + TGeoTranslation* cbox1Tr2 = new TGeoTranslation("cbox1Tr2",-cbox1PosX,-cbox1PosY,0); + cbox1Tr2->RegisterYourself(); + + Double_t cbox2dX = 5.75; //vertical center box + + Double_t cbox2dY = 6.575; + Double_t cbox2Yoffset = 14.425; + Double_t cbox2PosX = 0; + Double_t cbox2PosY = blockdY/2 - cbox2Yoffset - cbox2dY/2; + TGeoBBox* cbox2 = new TGeoBBox("cbox2",cbox2dX/2,cbox2dY/2,blockdZ/2); + TGeoTranslation* cbox2Tr1 = new TGeoTranslation("cbox2Tr1",cbox2PosX,cbox2PosY,0); + cbox2Tr1->RegisterYourself(); + TGeoTranslation* cbox2Tr2 = new TGeoTranslation("cbox2Tr2",-cbox2PosX,-cbox2PosY,0); + cbox2Tr2->RegisterYourself(); + + //The two L-shaped pieces that form the frame have a small 1mm gap between them, + //where they come together. As viewed from the back, the gaps are on the upper + //left and lower right, so that for the center column of modules, the upper two + //are shifted slightly to the right (as viewed from the back) and the lower two + //are shifted slightly to the left (as viewed from the back) + Double_t gapBoxdX=0.1; + Double_t gapBoxdY=blockdY/2; + Double_t gapPosX=-(sPmtSide/2 + sEps + gapBoxdX/2); + Double_t gapPosY=blockdY/4; + TGeoBBox* gapBox = new TGeoBBox("gapBox",gapBoxdX/2,gapBoxdY/2,blockdZ/2); + TGeoTranslation* gapBoxTr1 = new TGeoTranslation("gapBoxTr1",gapPosX,gapPosY,0); + gapBoxTr1->RegisterYourself(); + TGeoTranslation* gapBoxTr2 = new TGeoTranslation("gapBoxTr2",-gapPosX,-gapPosY,0); + gapBoxTr2->RegisterYourself(); + + + //Create a string to define the complete frame object shape + //Start from the aluminum block then subtract the boxes + std::string frameACompositeString = "block "; + frameACompositeString += "- box1:box1Tr1 - box1:box1Tr2 "; + frameACompositeString += "- box2:box2Tr1 - box2:box2Tr2 "; + frameACompositeString += "- box3:box3Tr1 - box3:box3Tr2 "; + frameACompositeString += "- box4:box4Tr1 - box4:box4Tr2 "; + frameACompositeString += "- box5:box5Tr1 - box5:box5Tr2 "; + frameACompositeString += "- box6:box6Tr1 - box6:box6Tr2 "; + frameACompositeString += "- cbox1:cbox1Tr1 - cbox1:cbox1Tr2 "; + frameACompositeString += "- cbox2:cbox2Tr1 - cbox2:cbox2Tr2 "; + frameACompositeString += "- gapBox:gapBoxTr1 - gapBox:gapBoxTr2"; + + //The next section defines the objects that form the sockets in the + //frame for the sensitive elements and the individual cover plates + //at the front of the detector which include the optical fiber + //heads that permit the LED pulser light to reach the quartz radiator + //surfaces of each module + + //There are two fiber head configurations, called "inner" and "outer" + //with different locations and angles of the fiber heads. + Double_t coverPlatedZ = 0.2; //top cover thickness + Double_t fiberPlatedZ = 0.5; //fiberhead plate is underneath + + //Each fiber is guided to a small rectangular opening in the plate + Double_t opticalFiberHeaddY = 0.52; //narrow side + Double_t opticalFiberHeaddX = 1.142; //long side + + //The "top" two fiber heads are positioned at slightly different + //locations than the bottom two, which are also rotated + + //"Outer" fiberhead placements + Double_t fh1TopPosX = -1.6; + Double_t fh1TopPosY = 1.325; + Double_t fh1BotPosX = 1.555; + Double_t fh1BotPosY = 1.249; + Double_t fh1BotAngle = 16; //degrees + + //"Inner" fiberhead placements + //All of these are placed at an angle + Double_t fh2TopPosX = -1.563; + Double_t fh2TopPosY = 1.4625; + Double_t fh2TopAngle = 60; + + Double_t fh2BotPosX = 1.084; + Double_t fh2BotPosY = 1.186; + Double_t fh2BotAngle = -30; + + // Define cover plate, fiber plate, and optical Fiber Head shapes + TGeoBBox* coverPlate = new TGeoBBox("coverPlate", sPmtSide/2 + sEps, sPmtSide/2 + sEps, coverPlatedZ/2); + TGeoBBox* fiberPlate = new TGeoBBox("fiberPlate", sPmtSide/2 + sEps, sPmtSide/2 + sEps, fiberPlatedZ/2); + TGeoBBox* opticalFiberHead = new TGeoBBox("opticalFiberHead", opticalFiberHeaddX/2, opticalFiberHeaddY/2, fiberPlatedZ/2); + + // Define transformations of optical fiber heads for outer plate + TGeoTranslation* coverPlateTr = new TGeoTranslation("coverPlateTr",0,0,fiberPlatedZ/2 + coverPlatedZ/2); + coverPlateTr->RegisterYourself(); + TGeoTranslation* fh1TopTr1 = new TGeoTranslation("fh1TopTr1",fh1TopPosX,fh1TopPosY,0); + fh1TopTr1->RegisterYourself(); + TGeoTranslation* fh1TopTr2 = new TGeoTranslation("fh1TopTr2",fh1TopPosX,-fh1TopPosY,0); + fh1TopTr2->RegisterYourself(); + TGeoCombiTrans* fh1BotTr1 = new TGeoCombiTrans("fh1BotTr1",fh1BotPosX,fh1BotPosY,0,new TGeoRotation("fh1BotRot1",fh1BotAngle,0,0)); + fh1BotTr1->RegisterYourself(); + TGeoCombiTrans* fh1BotTr2 = new TGeoCombiTrans("fh1BotTr2",fh1BotPosX,-fh1BotPosY,0,new TGeoRotation("fh1BotRot2",-fh1BotAngle,0,0)); + fh1BotTr2->RegisterYourself(); + TGeoCombiTrans* fh2TopTr1 = new TGeoCombiTrans("fh2TopTr1",fh2TopPosX,fh2TopPosY,0,new TGeoRotation("fh2TopRot1",fh2TopAngle+90,0,0)); + fh2TopTr1->RegisterYourself(); + TGeoCombiTrans* fh2TopTr2 = new TGeoCombiTrans("fh2TopTr2",fh2TopPosX,-fh2TopPosY,0,new TGeoRotation("fh2TopRot2",-fh2TopAngle-90,0,0)); + fh2TopTr2->RegisterYourself(); + TGeoCombiTrans* fh2BotTr1 = new TGeoCombiTrans("fh2BotTr1",fh2BotPosX,fh2BotPosY,0,new TGeoRotation("fh2BotRot1",-fh2BotAngle,0,0)); + fh2BotTr1->RegisterYourself(); + TGeoCombiTrans* fh2BotTr2 = new TGeoCombiTrans("fh2BotTr2",fh2BotPosX,-fh2BotPosY,0,new TGeoRotation("fh2BotRot2",fh2BotAngle,0,0)); + fh2BotTr2->RegisterYourself(); + + //Create a string that defines the plate group for the outer plates + std::string outerPlateGroupString = "fiberPlate "; + outerPlateGroupString+="- opticalFiberHead:fh1TopTr1 "; + outerPlateGroupString+="- opticalFiberHead:fh1TopTr2 "; + outerPlateGroupString+="- opticalFiberHead:fh1BotTr1 "; + outerPlateGroupString+="- opticalFiberHead:fh1BotTr2 "; + outerPlateGroupString+="+ coverPlate:coverPlateTr"; + + //Create the composite shape for the outer plates + TGeoCompositeShape* outerPlateGroup = new TGeoCompositeShape("outerPlateGroup", outerPlateGroupString.c_str()); + + //Create a string that defines the plate group for the inner plates + std::string innerPlateGroupString = "fiberPlate "; + innerPlateGroupString+="- opticalFiberHead:fh2TopTr1 "; + innerPlateGroupString+="- opticalFiberHead:fh2TopTr2 "; + innerPlateGroupString+="- opticalFiberHead:fh2BotTr1 "; + innerPlateGroupString+="- opticalFiberHead:fh2BotTr2 "; + innerPlateGroupString+="+ coverPlate:coverPlateTr"; + + //Create the composite shape for the inner plates + TGeoCompositeShape* innerPlateGroup = new TGeoCompositeShape("innerPlateGroup", innerPlateGroupString.c_str()); + + //The sockets that are cut out of the aluminum block for the senitive elements + //to fit into are offset slightly in z to leave a thin plate of aluminum at the + //back - the back plate covers + Double_t backPlanedZ = 0.25; + Double_t socketdZ = blockdZ - backPlanedZ; + + //Define the socket volume as a box of vacuum + TGeoVolume* socket = gGeoManager->MakeBox("Socket", Vacuum, sPmtSide / 2 + sEps, sPmtSide / 2 + sEps, socketdZ/2); + + //Define the orientation angles of the plate groups that will cover + //the sockets holding the sensitive elements + Double_t rotAngle[Geometry::NCellsA] = {0,0,-90,-90,-90,0,0,-90,-90,-90,0,0,180,180,90,90,90,180,180,90,90,90,180,180}; + //Define the socket and plate group translations + TGeoTranslation* trSocket[Geometry::NCellsA]; + TString nameTrSocket; + TGeoCombiTrans* trPlateGroup[Geometry::NCellsA]; + TString nameTrPlateGroup; + TString namePGRot; + + //Loop over the number of modules, subtracting the sockets and adding back in the + //plate groups at the position of each module + for (Int_t itr = 0; itr < Geometry::NCellsA; itr++){ + + nameTrSocket = Form("trSocket%i",itr+1); + float z = -backPlanedZ/4.0; + trSocket[itr] = new TGeoTranslation(nameTrSocket.Data(), mPosModuleAx[itr], mPosModuleAy[itr], z); + trSocket[itr]->RegisterYourself(); + frameACompositeString+="- Socket:"; //subtract it from the aluminum block + frameACompositeString+=nameTrSocket.Data(); //at its corresponding location + + nameTrPlateGroup = Form("trPlateGroup%i",itr+1); + namePGRot = Form("pgRot%i",itr+1); + float z2= -blockdZ/2 + (coverPlatedZ+fiberPlatedZ)/2; + trPlateGroup[itr]=new TGeoCombiTrans(nameTrPlateGroup.Data(),mPosModuleAx[itr],mPosModuleAy[itr],z2,new TGeoRotation(namePGRot.Data(),rotAngle[itr],0,0)); + trPlateGroup[itr]->RegisterYourself(); + + if (itr==0||itr==2||itr==3||itr==4||itr==5||itr==10||itr==13||itr==18||itr==19||itr==20||itr==21||itr==23){ + frameACompositeString+=" + outerPlateGroup:"; //add the outer plate group back on to these modules + frameACompositeString+=nameTrPlateGroup.Data(); + frameACompositeString+=" "; + } + else { + frameACompositeString+=" + innerPlateGroup:"; //or add the inner plate group back on to all other modules + frameACompositeString+=nameTrPlateGroup.Data(); + frameACompositeString+=" "; + + } + } + + //Finally, define the A side frame object from the complete composite shape defined above + TGeoVolume* frameA= new TGeoVolume("frameA",new TGeoCompositeShape("frameA",frameACompositeString.c_str()), Al); + + //Add the frame object to the mother volume + FT0_Frame->AddNode(frameA,1); return FT0_Frame; } -// the following are continually concatenated strings that ROOT Geometry will -// read in order to piece together the objects and translations that are -// defined above (what ROOT Geometry calls Booleans) -// frame1 is a horizontal aluminum box piece of the L-shape -std::string Detector::frame1CompositeShapeBoolean() +//C-side Support Structure +//This code was written by Jason Pruitt and Sam Christensen of Cal Poly in 2021 +//They followed a similar method as for the A-side frame but had to account for the +//spherical geometry of the C-side. +TGeoVolume* Detector::constructFrameCGeometry() { - // create a string for the boolean operations for the composite frame shape - std::string frame1CompositeShapeBoolean = ""; - frame1CompositeShapeBoolean += "((frame1"; - - // remove the radiator shapes for the sockets - // frame1 is the horizontal piece of the right-hand L-shape (looking from back) - // with its own internal numbering for the sockets. To more easily map between - // the sensitive elements and their socket locations, we've included the correspondence - // between them. Within the horizontal piece, the sockets are numbered column by column - // from left to right - // --------- - // | | <-----Rectangle 1 removed here - // | 1 |----------------- ^ - // | | | | | - // --------- 3 | 5 | | - // | | | | | Rectangle 2 removed here - // | 2 |----------------- | - // | | | | | - // --------| 4 | 6 | | - // | | | v - // ^ ------------------ <------Rectangle 3 removed here - // | - // | - // Rectangle 4 removed here - // - // internal numbering for each is mapped to the sensitive element numbering - // for ease of comparison and identification - // Since one L is reflected about the axes of symmetry, the correspondence with - // sensitive element numbering for the left-side L-shape is also included here. - frame1CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr1"; // Sens Elmt 2,21 - frame1CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr2"; // Sens Elmt 7,16 - frame1CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr3"; // Sens Elmt 3,20 - frame1CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr4"; // Sens Elmt 8,15 - frame1CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr5"; // Sens Elmt 4,19 - frame1CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr6)"; // Sens Elmt 9,14 - - // remove the PMT shapes for the sockets - frame1CompositeShapeBoolean += " - PMT:PMTTr1"; - frame1CompositeShapeBoolean += " - PMT:PMTTr2"; - frame1CompositeShapeBoolean += " - PMT:PMTTr3"; - frame1CompositeShapeBoolean += " - PMT:PMTTr4"; - frame1CompositeShapeBoolean += " - PMT:PMTTr5"; - frame1CompositeShapeBoolean += " - PMT:PMTTr6)"; - - return frame1CompositeShapeBoolean; -} -// frame2 is the vertical aluminum box piece of the L-shape -std::string Detector::frame2CompositeShapeBoolean() -{ - std::string frame2CompositeShapeBoolean = ""; - frame2CompositeShapeBoolean += "((frame2"; - - // remove the radiator shapes for the sockets - // frame2 is the vertical piece of the right-hand L-shape (looking from back) - // with its own internal numbering for the sockets. To more easily map between - // the sensitive elements and their socket locations, we've included the correspondence - // between them. Within the vertical piece, the sockets are numbered row by row - // from right to left - // ----------------- - // | | | - // Rectangle--> | 8 | 7 | - // 8 | | | - // removed -------------------- - // here | | | ^ - // | 10 | 9 | | - // | | | | Rectangle 5 removed here - // ----------------- | - // | | | | - // | 12 | 11 | v - // | | | <-----Rectangle 6 removed here - // ----------------- - // <----------------> - // Rectangle 7 removed here - // - // internal numbering for each is mapped to the sensitive element numbering - // for ease of comparison and identification - // Since one L is reflected about the axes of symmetry, the correspondence with - // sensitive element numbering for the left-side L-shape is also included here. - frame2CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr7"; // Sens Elmt 13,10 - frame2CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr8"; // Sens Elmt 12,11 - frame2CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr9"; // Sens Elmt 18,14 - frame2CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr10"; // Sens Elmt 17,15 - frame2CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr11"; // Sens Elmt 23,0 - frame2CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr12)"; // Sens Elmt 22,1 - - // remove the PMT shapes for the sockets - frame2CompositeShapeBoolean += " - PMT:PMTTr7"; - frame2CompositeShapeBoolean += " - PMT:PMTTr8"; - frame2CompositeShapeBoolean += " - PMT:PMTTr9"; - frame2CompositeShapeBoolean += " - PMT:PMTTr10"; - frame2CompositeShapeBoolean += " - PMT:PMTTr11"; - frame2CompositeShapeBoolean += " - PMT:PMTTr12)"; - - return frame2CompositeShapeBoolean; -} -// Support structure L-shape element definition -std::string Detector::frameCompositeShapeBoolean() -{ - // create a string for the boolean operations for the composite plateGroup shape - std::string frameCompositeShapeBoolean = ""; - - // add the two pieces called frame 1 and 2 into a single L-shaped element - frameCompositeShapeBoolean += "frameRemovedPMTandRadiators1:frameTr1"; - frameCompositeShapeBoolean += " + frameRemovedPMTandRadiators2:frameTr2"; - - // add the plateGroups to the L-shaped elements - frameCompositeShapeBoolean += " + plateGroup:plateGroupTr1"; - frameCompositeShapeBoolean += " + plateGroup:plateGroupTr2"; - - // subtract the extra Al from the L-shaped elements - frameCompositeShapeBoolean += " - rect1:rectTr1"; - frameCompositeShapeBoolean += " - rect2:rectTr2"; - frameCompositeShapeBoolean += " - rect3:rectTr3"; - frameCompositeShapeBoolean += " - rect4:rectTr4"; - frameCompositeShapeBoolean += " - rect5:rectTr5"; - frameCompositeShapeBoolean += " - rect6:rectTr6"; - frameCompositeShapeBoolean += " - rect7:rectTr7"; - frameCompositeShapeBoolean += " - rect8:rectTr8"; - - return frameCompositeShapeBoolean; -} + // define the media + TGeoMedium* Vacuum = gGeoManager->GetMedium("FT0_Vacuum$"); + TGeoMedium* Al = gGeoManager->GetMedium("FT0_Aluminium$"); + static constexpr Double_t sFrameZC = 5.5632; + static constexpr Double_t frameHeightC = 2.5; // pinstart[2] or l_s + + // quartz & PMT C-side transformations + static constexpr Double_t sensShift = 0.5; + static constexpr Double_t sQuartzRadiatorZC = 1.94360; // Dimension variable (l_{q} + static constexpr Double_t sQuartzHeightC = (-sFrameZC / 2 + sQuartzRadiatorZC / 2); // placement variable ) + static constexpr Double_t sPmtZC = 3.600; // Dimension variable (l_{p} + static constexpr Double_t sPmtHeightC = (sFrameZC / 2 - sPmtZC / 2); // placement variable + + Double_t crad = 82.; + static constexpr Int_t NCellsC = Geometry::NCellsC; + static constexpr Int_t NCellsA = Geometry::NCellsA; + + Float_t sweep = 3.5*2; + Float_t rMin = 81.9791; + Float_t rMax = rMin + sFrameZC; + Float_t tMin = 0; + Float_t tMax = 35; + Float_t pMin = 0; + Float_t pMax = 180; + Float_t pinstart[3] = {2.9491, 2.9491, 2.5}; + Float_t pstartC[3] = {20., 20, 5}; + + Float_t multCorn = 1.275; // multiplication factor for corners + Double_t xCorn = multCorn*(-14.75272569); + Double_t yCorn = multCorn*(14.9043284); + Double_t zCorn = 79.27306024; + + Double_t xCorn2 = -xCorn; + Double_t yCorn2 = yCorn; + Double_t zCorn2 = zCorn; + + Double_t acCorn = TMath::ATan(yCorn / xCorn) - TMath::Pi() / 2 + 2 * TMath::Pi(); + Double_t bcCorn = /*(-1)**/ TMath::ACos(zCorn / crad); + Double_t gcCorn = -1 * acCorn; + + // holepunch corners not implemented for quartzRadiatorSeat, rounded corners are + // in place for PMT + Double_t flopsErr = 0.00001; + Double_t exag = 5; + + // highest overlap values + Double_t errPMTZ = 10*sEps; + Double_t errPMTXY = 0.02; + Double_t errQrdZ = 0.143 + 0.22; + Double_t errQrdXY = 0.35; + + Float_t backPlateZ = 0.5; + + // sphere1 is the spherical shell that will be subtracted + // to approximate the c-side support frame and the subsequent + // spheres clip the shape with curvature preserved + TGeoSphere* sphere1 = new TGeoSphere("sphere1", rMin, rMax, tMin, tMax, pMin, pMax); + TGeoSphere* sphere2 = new TGeoSphere("sphere2", rMin - sweep, rMax + sweep, tMin, tMax, pMin, pMax); + TGeoSphere* sphere3 = new TGeoSphere("sphere3", rMin, rMin + backPlateZ, tMin, tMax, pMin, pMax); + TGeoSphere* sphere4 = new TGeoSphere("sphere4", rMin - sweep, rMax + backPlateZ + sweep, tMin, tMax, pMin, pMax); + + TGeoBBox* insSeat = new TGeoBBox("insSeat", pinstart[0]*2, pinstart[1]*2, pinstart[2]*2); + + TGeoBBox* quartzRadiatorSeat = new TGeoBBox("quartzRadiatorSeat", + sQuartzRadiatorSide / 2 + sEps + errQrdXY, + sQuartzRadiatorSide / 2 + sEps + errQrdXY, + sQuartzRadiatorZC / 2 + sEps + errQrdZ); + + TGeoBBox* pmtBoxSeat = new TGeoBBox("pmtBoxSeat", + sPmtSide / 2 + sEps + errPMTXY, + sPmtSide / 2 + sEps + errPMTXY, + sPmtZ / 2 + sEps + errPMTZ); + TGeoBBox* pmtCornerRect = new TGeoBBox("pmtCornerRect", + sCornerRadius / 2 - flopsErr, + sCornerRadius / 2 - flopsErr, + sPmtZ / 2); + + TGeoBBox* framecornerBox = new TGeoBBox("framecornerBox", 5, 5, 10); + + // C-side transformations + TGeoRotation* rot1 = new TGeoRotation("rot1", 90, 0, 0); + rot1->RegisterYourself(); + TGeoCombiTrans* rotTr1 = new TGeoCombiTrans("rotTr1", -20, -1, -5, rot1); // cuts off left side of shell + rotTr1->RegisterYourself(); + + TGeoRotation* rot2 = new TGeoRotation("rot2", -90, 0, 0); + rot2->RegisterYourself(); + TGeoCombiTrans* rotTr2 = new TGeoCombiTrans("rotTr2", 20, -1, -5, rot2); + rotTr2->RegisterYourself(); + + TGeoRotation* rot3 = new TGeoRotation("rot3", 0, 0, 0); + rot3->RegisterYourself(); + TGeoCombiTrans* rotTr3 = new TGeoCombiTrans("rotTr3", 0, 20, -5, rot3); + rotTr3->RegisterYourself(); + + TGeoTranslation* centerTrans = new TGeoTranslation("centerTrans", 0, 0, 85); + centerTrans->RegisterYourself(); + + TGeoRotation* reflectC1 = new TGeoRotation("reflectC1", 0, 0, 0); + reflectC1->ReflectX(true); + reflectC1->ReflectY(true); + reflectC1->RegisterYourself(); + + TGeoRotation* rotCorners= new TGeoRotation("rotCorners", acCorn, bcCorn, gcCorn); + rotCorners->RegisterYourself(); + + TGeoCombiTrans* comCorners= new TGeoCombiTrans("comCorners", xCorn, yCorn, zCorn, rotCorners); + comCorners->RegisterYourself(); + + TGeoCombiTrans* comCorners2= new TGeoCombiTrans("comCorners2", xCorn2, yCorn2, zCorn2, rotCorners); + comCorners2->RegisterYourself(); + + //Create a string that defines the composite shape + std::string shellString = ""; + shellString += "sphere1"; // start with spherical shell - this will be reflected + shellString += "- sphere2:rotTr1"; // copy and combitrans a subtraction + shellString += "- sphere2:rotTr2"; // + shellString += "- sphere2:rotTr3"; // + shellString += "- insSeat:centerTrans"; // subtract center + shellString += "- framecornerBox:comCorners"; // subtract corners + shellString += "- framecornerBox:comCorners2"; // + + //Create string that defines the back plate composite shape + std::string backPlateString = ""; + backPlateString += "sphere3"; + backPlateString += "- sphere4:rotTr1"; + backPlateString += "- sphere4:rotTr2"; + backPlateString += "- sphere4:rotTr3"; + backPlateString += "- insSeat:centerTrans"; + backPlateString += "- framecornerBox:comCorners"; + backPlateString += "- framecornerBox:comCorners2"; + + //These could be set up to use the values in the geometry file after some + //investigation of subtle differences... + static constexpr Double_t xi[NCellsC] = {-15.038271418735729, 15.038271418735729, + -15.003757581112167, 15.003757581112167, -9.02690018974363, + 9.02690018974363, -9.026897413747076, 9.026897413747076, + -9.026896531935773, 9.026896531935773, -3.0004568618531313, + 3.0004568618531313, -3.0270795197907225, 3.0270795197907225, + 3.0003978432927543, -3.0003978432927543, 3.0270569670429572, + -3.0270569670429572, 9.026750365564254, -9.026750365564254, + 9.026837450695885, -9.026837450695885, 9.026849243816981, + -9.026849243816981, 15.038129472387304, -15.038129472387304, + 15.003621961057961, -15.003621961057961}; + static constexpr Double_t yi[NCellsC] = {3.1599494336464455, -3.1599494336464455, + 9.165191680982874, -9.165191680982874, 3.1383331772537426, + -3.1383331772537426, 9.165226363918643, -9.165226363918643, + 15.141616002932361, -15.141616002932361, 9.16517861649866, + -9.16517861649866, 15.188854859073416, -15.188854859073416, + 9.165053319552113, -9.165053319552113, 15.188703787345304, + -15.188703787345304, 3.138263189805292, -3.138263189805292, + 9.165104089644917, -9.165104089644917, 15.141494417823818, + -15.141494417823818, 3.1599158563428644, -3.1599158563428644, + 9.165116302773846, -9.165116302773846}; + Double_t zi[NCellsC]; + for (Int_t ic = 0; ic < NCellsC; ic++) { + zi[ic] = TMath::Sqrt(TMath::Power(crad, 2) - TMath::Power(xi[ic], 2) - TMath::Power(yi[ic], 2)); + } -// Plate group elements -std::string Detector::plateGroupCompositeShapeBoolean() -{ - // create a string for the boolean operations for the composite plateGroup shape - std::string plateGroupCompositeShapeBoolean = ""; + // get rotation data + Double_t ac[NCellsC], bc[NCellsC], gc[NCellsC]; + for (Int_t i = 0; i < NCellsC; i++) { + ac[i] = TMath::ATan(yi[i] / xi[i]) - TMath::Pi() / 2 + 2 * TMath::Pi(); + if (xi[i] < 0) { + bc[i] = TMath::ACos(zi[i] / crad); + } else { + bc[i] = -1 * TMath::ACos(zi[i] / crad); + } + } - // add the plateBoxes to the plateGroup - plateGroupCompositeShapeBoolean += "plateBox:plateTr1"; - plateGroupCompositeShapeBoolean += " + plateBox:plateTr2"; - plateGroupCompositeShapeBoolean += " + plateBox:plateTr3"; + Double_t xc2[NCellsC], yc2[NCellsC], zc2[NCellsC]; + + // compensation based on node position within individual detector geometries + // determine compensated radius + Double_t rcomp = crad + pstartC[2] / 2.0; + for (Int_t i = 0; i < NCellsC; i++) { + // Get compensated translation data + xc2[i] = rcomp * TMath::Cos(ac[i] + TMath::Pi() / 2) * TMath::Sin(-1 * bc[i]); + yc2[i] = rcomp * TMath::Sin(ac[i] + TMath::Pi() / 2) * TMath::Sin(-1 * bc[i]); + zc2[i] = rcomp * TMath::Cos(bc[i]); + + // Convert angles to degrees + ac[i] *= 180 / TMath::Pi(); + bc[i] *= 180 / TMath::Pi(); + gc[i] = -1 * ac[i]; + } - return plateGroupCompositeShapeBoolean; -} -// Optical fiber plate for the first aluminum box in the L-shaped element -std::string Detector::opticalFiberPlateCompositeShapeBoolean1() -{ - // create a string for the boolean operations for the composite opticalFiberPlate1 shape - std::string opticalFiberPlateCompositeShapeBoolean1 = ""; - opticalFiberPlateCompositeShapeBoolean1 += "cablePlate"; - opticalFiberPlateCompositeShapeBoolean1 += " - opticalFiberHead:opticalFiberHeadTr1"; - opticalFiberPlateCompositeShapeBoolean1 += " - opticalFiberHead:opticalFiberHeadTr2"; - opticalFiberPlateCompositeShapeBoolean1 += " - opticalFiberHead:opticalFiberHeadTr3"; - opticalFiberPlateCompositeShapeBoolean1 += " - opticalFiberHead:opticalFiberHeadTr4"; - - return opticalFiberPlateCompositeShapeBoolean1; -} + Double_t rmag = sqrt(xc2[0]*xc2[0] + yc2[0]*yc2[0] + zc2[0]*zc2[0]); -// Optical fiber plate for the second aluminum box in the L-shaped element -std::string Detector::opticalFiberPlateCompositeShapeBoolean2() -{ - // create a string for the boolean operations for the composite opticalFiberPlate2 shape - std::string opticalFiberPlateCompositeShapeBoolean2 = ""; + Double_t scalePMT = (rmag + (frameHeightC / 2.0) - (sPmtHeightC / 2)) / rmag; + Double_t scaleQrad = (rmag + (frameHeightC / 2.0) - sPmtHeightC - (sQuartzRadiatorZC / 2.0)) / rmag; - // remove the opticalFiberHead shapes from the cablePlate - opticalFiberPlateCompositeShapeBoolean2 += "cablePlate"; - opticalFiberPlateCompositeShapeBoolean2 += " - opticalFiberHead:opticalFiberHeadTr5"; - opticalFiberPlateCompositeShapeBoolean2 += " - opticalFiberHead:opticalFiberHeadTr6"; - opticalFiberPlateCompositeShapeBoolean2 += " - opticalFiberHead:opticalFiberHeadTr7"; - opticalFiberPlateCompositeShapeBoolean2 += " - opticalFiberHead:opticalFiberHeadTr8"; + Double_t xPMT[NCellsC]; Double_t yPMT[NCellsC]; Double_t zPMT[NCellsC]; + Double_t aPMT[NCellsC]; Double_t bPMT[NCellsC]; Double_t gPMT[NCellsC]; + + Double_t xQrad[NCellsC]; Double_t yQrad[NCellsC]; Double_t zQrad[NCellsC]; + Double_t aQrad[NCellsC]; Double_t bQrad[NCellsC]; Double_t gQrad[NCellsC]; - return opticalFiberPlateCompositeShapeBoolean2; -} -// Create rounded PMT socket corners -std::string Detector::pmtCornerCompositeShapeBoolean() -{ - // create a string for the boolean operations for the composite pmtCorner shape - std::string pmtCornerCompositeShapeBoolean = ""; - pmtCornerCompositeShapeBoolean += "pmtCornerRect:pmtCornerRectTr"; - pmtCornerCompositeShapeBoolean += " - pmtCornerTube:pmtCornerTubeTr"; + Double_t rotC[NCellsC]; + Double_t comC[NCellsC]; - return pmtCornerCompositeShapeBoolean; -} + for (Int_t i = 0; i < NCellsC; i++) { + // PMT Transformations + xPMT[i] = scalePMT * xc2[i]; + yPMT[i] = scalePMT * yc2[i]; + zPMT[i] = scalePMT * zc2[i]; -// Create PMT socket shape -std::string Detector::pmtCompositeShapeBoolean() -{ - // create a string for the boolean operations for the composite PMT shape - std::string pmtCompositeShapeBoolean = ""; - pmtCompositeShapeBoolean += "pmtBox"; - pmtCompositeShapeBoolean += " - PMTCorner:PMTCornerTr1"; - pmtCompositeShapeBoolean += " - PMTCorner:PMTCornerTr2"; - pmtCompositeShapeBoolean += " - PMTCorner:PMTCornerTr3"; - pmtCompositeShapeBoolean += " - PMTCorner:PMTCornerTr4"; - - return pmtCompositeShapeBoolean; -} -// Plate composite structure -std::string Detector::plateBoxCompositeShapeBoolean() -{ - // create a string for the boolean operations for the composite plateBox shape - std::string plateBoxCompositeShapeBoolean = ""; - plateBoxCompositeShapeBoolean += "basicPlate"; - plateBoxCompositeShapeBoolean += " + basicPlate:basicPlateTr"; - plateBoxCompositeShapeBoolean += " + opticalFiberPlate1:opticalFiberPlateTr1"; - plateBoxCompositeShapeBoolean += " + opticalFiberPlate2:opticalFiberPlateTr2"; - - return plateBoxCompositeShapeBoolean; -} + aPMT[i] = TMath::ATan(yPMT[i] / xPMT[i]) - TMath::Pi() / 2 + 2 * TMath::Pi(); + if (xPMT[i] < 0) { + bPMT[i] = TMath::ACos(zPMT[i] / crad); + } else { + bPMT[i] = -1 * TMath::ACos(zPMT[i] / crad); + } -// Wrapper function to define all support structure transformations at once -void Detector::defineTransformations() -{ - defineQuartzRadiatorTransformations(); - definePmtTransformations(); - definePlateTransformations(); - defineFrameTransformations(); -} + aPMT[i] *= 180 / TMath::Pi(); + bPMT[i] *= 180 / TMath::Pi(); + gPMT[i] = -1 * aPMT[i]; -// Transformations for quartz radiator sockets -void Detector::defineQuartzRadiatorTransformations() -{ - // translations for quartz radiator shapes to be removed from the frame2 pice of the L-shaped element - TGeoTranslation* quartzRadiatorTr1 = new TGeoTranslation("quartzRadiatorTr1", sPos1X[0], sPos1Y[0], sQuartzHeight); - quartzRadiatorTr1->RegisterYourself(); - TGeoTranslation* quartzRadiatorTr2 = new TGeoTranslation("quartzRadiatorTr2", sPos1X[0], sPos1Y[1], sQuartzHeight); - quartzRadiatorTr2->RegisterYourself(); - TGeoTranslation* quartzRadiatorTr3 = new TGeoTranslation("quartzRadiatorTr3", sPos1X[1], sPos1Y[2], sQuartzHeight); - quartzRadiatorTr3->RegisterYourself(); - TGeoTranslation* quartzRadiatorTr4 = new TGeoTranslation("quartzRadiatorTr4", sPos1X[1], sPos1Y[3], sQuartzHeight); - quartzRadiatorTr4->RegisterYourself(); - TGeoTranslation* quartzRadiatorTr5 = new TGeoTranslation("quartzRadiatorTr5", sPos1X[2], sPos1Y[2], sQuartzHeight); - quartzRadiatorTr5->RegisterYourself(); - TGeoTranslation* quartzRadiatorTr6 = new TGeoTranslation("quartzRadiatorTr6", sPos1X[2], sPos1Y[3], sQuartzHeight); - quartzRadiatorTr6->RegisterYourself(); - - // translations for quartz radiator shapes to be removed from the frame1 piece of the L-shaped element - TGeoTranslation* quartzRadiatorTr7 = new TGeoTranslation("quartzRadiatorTr7", sPos2X[0], sPos2Y[0], sQuartzHeight); - quartzRadiatorTr7->RegisterYourself(); - TGeoTranslation* quartzRadiatorTr8 = new TGeoTranslation("quartzRadiatorTr8", sPos2X[1], sPos2Y[0], sQuartzHeight); - quartzRadiatorTr8->RegisterYourself(); - TGeoTranslation* quartzRadiatorTr9 = new TGeoTranslation("quartzRadiatorTr9", sPos2X[2], sPos2Y[1], sQuartzHeight); - quartzRadiatorTr9->RegisterYourself(); - TGeoTranslation* quartzRadiatorTr10 = new TGeoTranslation("quartzRadiatorTr10", sPos2X[3], sPos2Y[1], sQuartzHeight); - quartzRadiatorTr10->RegisterYourself(); - TGeoTranslation* quartzRadiatorTr11 = new TGeoTranslation("quartzRadiatorTr11", sPos2X[2], sPos2Y[2], sQuartzHeight); - quartzRadiatorTr11->RegisterYourself(); - TGeoTranslation* quartzRadiatorTr12 = new TGeoTranslation("quartzRadiatorTr12", sPos2X[3], sPos2Y[2], sQuartzHeight); - quartzRadiatorTr12->RegisterYourself(); -} -// Transformations for PMT sockets, including rounded corners -void Detector::definePmtTransformations() -{ - // translations for PMT shapes to be removed from the frame2 piece in the L-shaped element - TGeoTranslation* PMTTr1 = new TGeoTranslation("PMTTr1", sPos1X[0], sPos1Y[0], sPmtHeight); - PMTTr1->RegisterYourself(); - TGeoTranslation* PMTTr2 = new TGeoTranslation("PMTTr2", sPos1X[0], sPos1Y[1], sPmtHeight); - PMTTr2->RegisterYourself(); - TGeoTranslation* PMTTr3 = new TGeoTranslation("PMTTr3", sPos1X[1], sPos1Y[2], sPmtHeight); - PMTTr3->RegisterYourself(); - TGeoTranslation* PMTTr4 = new TGeoTranslation("PMTTr4", sPos1X[1], sPos1Y[3], sPmtHeight); - PMTTr4->RegisterYourself(); - TGeoTranslation* PMTTr5 = new TGeoTranslation("PMTTr5", sPos1X[2], sPos1Y[2], sPmtHeight); - PMTTr5->RegisterYourself(); - TGeoTranslation* PMTTr6 = new TGeoTranslation("PMTTr6", sPos1X[2], sPos1Y[3], sPmtHeight); - PMTTr6->RegisterYourself(); - - // translations for PMT shapes to be removed from the frame1 piece in the L-shaped element - TGeoTranslation* PMTTr7 = new TGeoTranslation("PMTTr7", sPos2X[0], sPos2Y[0], sPmtHeight); - PMTTr7->RegisterYourself(); - TGeoTranslation* PMTTr8 = new TGeoTranslation("PMTTr8", sPos2X[1], sPos2Y[0], sPmtHeight); - PMTTr8->RegisterYourself(); - TGeoTranslation* PMTTr9 = new TGeoTranslation("PMTTr9", sPos2X[2], sPos2Y[1], sPmtHeight); - PMTTr9->RegisterYourself(); - TGeoTranslation* PMTTr10 = new TGeoTranslation("PMTTr10", sPos2X[3], sPos2Y[1], sPmtHeight); - PMTTr10->RegisterYourself(); - TGeoTranslation* PMTTr11 = new TGeoTranslation("PMTTr11", sPos2X[2], sPos2Y[2], sPmtHeight); - PMTTr11->RegisterYourself(); - TGeoTranslation* PMTTr12 = new TGeoTranslation("PMTTr12", sPos2X[3], sPos2Y[2], sPmtHeight); - PMTTr12->RegisterYourself(); - - // define pmtCorner transformations - TGeoTranslation* pmtCornerTubeTr = new TGeoTranslation("pmtCornerTubeTr", sPmtCornerTubePos, sPmtCornerTubePos, 0); - pmtCornerTubeTr->RegisterYourself(); - TGeoTranslation* pmtCornerRectTr = new TGeoTranslation("pmtCornerRectTr", 0, 0, 0); - pmtCornerRectTr->RegisterYourself(); - TGeoTranslation* PMTCornerTr1 = new TGeoTranslation("PMTCornerTr1", sPmtCornerPos, sPmtCornerPos, 0); - PMTCornerTr1->RegisterYourself(); - TGeoRotation* reflect2 = new TGeoRotation(); - reflect2->ReflectX(true); - reflect2->RegisterYourself(); - TGeoCombiTrans* PMTCornerTr2 = new TGeoCombiTrans("PMTCornerTr2", -sPmtCornerPos, sPmtCornerPos, 0, reflect2); - PMTCornerTr2->RegisterYourself(); - TGeoRotation* reflect3 = new TGeoRotation(); - reflect3->ReflectX(true); - reflect3->ReflectY(true); - reflect3->RegisterYourself(); - TGeoCombiTrans* PMTCornerTr3 = new TGeoCombiTrans("PMTCornerTr3", -sPmtCornerPos, -sPmtCornerPos, 0, reflect3); - PMTCornerTr3->RegisterYourself(); - TGeoRotation* reflect4 = new TGeoRotation(); - reflect4->ReflectY(true); - reflect4->RegisterYourself(); - TGeoCombiTrans* PMTCornerTr4 = new TGeoCombiTrans("PMTCornerTr4", sPmtCornerPos, -sPmtCornerPos, 0, reflect4); - PMTCornerTr4->RegisterYourself(); - TGeoRotation* reflect5 = new TGeoRotation(); - reflect5->ReflectX(true); - reflect5->ReflectY(true); - reflect5->RegisterYourself(); - TGeoCombiTrans* edgeCornerTr = new TGeoCombiTrans("edgeCornerTr", sEdgeCornerPos[0], sEdgeCornerPos[1], 0, reflect5); - edgeCornerTr->RegisterYourself(); -} -// Transformations for plate elements -void Detector::definePlateTransformations() -{ - // TODO: redefine fiber head transformations - // TODO: move hard-coded numbers to be variables in the constants lists - // define transformations for the fiber heads in opticalFiberPlate1 - TGeoTranslation* opticalFiberHeadTr1 = new TGeoTranslation("opticalFiberHeadTr1", 1.7384, 1.36, 0); - opticalFiberHeadTr1->RegisterYourself(); - TGeoTranslation* opticalFiberHeadTr2 = new TGeoTranslation("opticalFiberHeadTr2", 1.7384, -1.36, 0); - opticalFiberHeadTr2->RegisterYourself(); - TGeoCombiTrans* opticalFiberHeadTr3 = new TGeoCombiTrans("opticalFiberHeadTr3", -0.9252, -.9375, 0, new TGeoRotation("rot3", 15, 0, 0)); - opticalFiberHeadTr3->RegisterYourself(); - TGeoCombiTrans* opticalFiberHeadTr4 = new TGeoCombiTrans("opticalFiberHeadTr4", -0.9252, .9375, 0, new TGeoRotation("rot4", -15, 0, 0)); - opticalFiberHeadTr4->RegisterYourself(); - - // make the transformations for the fiber heads in opticalFiberPlate2 - TGeoCombiTrans* opticalFiberHeadTr5 = new TGeoCombiTrans("opticalFiberHeadTr5", 1.6714, 1.525, 0, new TGeoRotation("rot5", 30, 0, 0)); - opticalFiberHeadTr5->RegisterYourself(); - TGeoCombiTrans* opticalFiberHeadTr6 = new TGeoCombiTrans("opticalFiberHeadTr6", 1.6714, -1.525, 0, new TGeoRotation("rot6", -30, 0, 0)); - opticalFiberHeadTr6->RegisterYourself(); - TGeoCombiTrans* opticalFiberHeadTr7 = new TGeoCombiTrans("opticalFiberHeadTr7", -0.9786, -1.125, 0, new TGeoRotation("rot7", 30, 0, 0)); - opticalFiberHeadTr7->RegisterYourself(); - TGeoCombiTrans* opticalFiberHeadTr8 = new TGeoCombiTrans("opticalFiberHeadTr8", -0.9786, 1.125, 0, new TGeoRotation("rot8", -30, 0, 0)); - opticalFiberHeadTr8->RegisterYourself(); - - // define transformations to form a plateBox (2 basicPlates and 2 cablePlates) - TGeoCombiTrans* basicPlateTr = new TGeoCombiTrans("basicPlateTr", 0, -sPlateSpacing, 0, new TGeoRotation("basicPlateRot", 90, 0, 0)); - basicPlateTr->RegisterYourself(); - TGeoCombiTrans* opticalFiberPlateTr1 = new TGeoCombiTrans("opticalFiberPlateTr1", 0, 0, sOpticalFiberPlateZ, new TGeoRotation("opticalFiberPlateRot1", 90, 0, 0)); - opticalFiberPlateTr1->RegisterYourself(); - TGeoCombiTrans* opticalFiberPlateTr2 = new TGeoCombiTrans("opticalFiberPlateTr2", 0, -sPlateSpacing, sOpticalFiberPlateZ, new TGeoRotation("opticalFiberPlateRot2", 90, 0, 0)); - opticalFiberPlateTr2->RegisterYourself(); - - // define transformations to form a plateGroup - TGeoTranslation* plateTr1 = new TGeoTranslation("plateTr1", -sPlateSpacing, sPlateDisplacementDeltaY, 0); - plateTr1->RegisterYourself(); - TGeoTranslation* plateTr2 = new TGeoTranslation("plateTr2", 0, 0, 0); - plateTr2->RegisterYourself(); - TGeoTranslation* plateTr3 = new TGeoTranslation("plateTr3", sPlateSpacing, 0, 0); - plateTr3->RegisterYourself(); - - // TODO: fix plateGroupTr2 - // TODO: Move hard-coded numbers to variables defined in the constants list - // define transformations for the plateGroups (6 basicPlates and 6 cablePlates) - TGeoTranslation* plateGroupTr1 = new TGeoTranslation("plateGroupTr1", sPlateDisplacementX, sPlateDisplacementY, sPlateGroupZ); - plateGroupTr1->RegisterYourself(); - TGeoCombiTrans* plateGroupTr2 = new TGeoCombiTrans("plateGroupTr2", 10.4358 + 1.5 * sPlateDisplacementDeltaY, -7.0747, sPlateGroupZ, new TGeoRotation("plateGroup2Rotation", -90, 0, 0)); - plateGroupTr2->RegisterYourself(); -} + // Quartz radiator transformations + xQrad[i] = scaleQrad * xc2[i]; + yQrad[i] = scaleQrad * yc2[i]; + zQrad[i] = scaleQrad * zc2[i]; -// Transformations for the L-shaped elements -void Detector::defineFrameTransformations() -{ + aQrad[i] = TMath::ATan(yQrad[i] / xQrad[i]) - TMath::Pi() / 2 + 2 * TMath::Pi(); + if (xQrad[i] < 0) { + bQrad[i] = TMath::ACos(zQrad[i] / crad); + } else { + bQrad[i] = -1 * TMath::ACos(zQrad[i] / crad); + } + aQrad[i] *= 180 / TMath::Pi(); + bQrad[i] *= 180 / TMath::Pi(); + gQrad[i] = -1 * aQrad[i]; + + } + + TString nameRot; + TString nameComPMT; + TString nameComQuartz; + TString nameComPlates; + TString nameComC; - // TODO: Confirm shifts that eliminate internal overlaps do not then cause - // overlaps with FV0 or other elements - // TODO: Move these hard-coded numbers to be variables in the list of constants - Float_t zshift = .2741; - Float_t rectShift = .274101; - Float_t frameXshift = -.1009; + for (Int_t itr = NCellsA; itr < NCellsA + NCellsC; itr++) { + nameRot = Form("0Rot%i", itr + 1); + int ic = itr - NCellsA; + nameComPMT = Form("0ComPMT%i", ic + 1); + nameComQuartz = Form("0ComQuartz%i", ic + 1); + + // getting even indices to skip reflections -> reflections happen later in + // frame construction + if (ic%2==0){ + TGeoRotation* rotC = new TGeoRotation(nameRot.Data(), ac[ic], bc[ic], gc[ic]); + rotC->RegisterYourself(); + + TGeoCombiTrans* comC = new TGeoCombiTrans(nameComC.Data(), xc2[ic], yc2[ic], zc2[ic], rotC); + comC->RegisterYourself(); + + TGeoRotation* rotPMT = new TGeoRotation(nameRot.Data(), ac[ic], bc[ic], gc[ic]); + rotPMT->RegisterYourself(); + + TGeoCombiTrans* comPMT = new TGeoCombiTrans(nameComPMT.Data(), + xPMT[ic], yPMT[ic], + zPMT[ic], rotPMT); + comPMT->RegisterYourself(); + + TGeoRotation* rotQuartz = new TGeoRotation(nameRot.Data(), + ac[ic], bc[ic], gc[ic]); + rotQuartz->RegisterYourself(); + + TGeoCombiTrans* comQuartz = new TGeoCombiTrans(nameComQuartz.Data(), + xQrad[ic], yQrad[ic], + zQrad[ic] - (sQuartzRadiatorZC/2 + 3*sEps), + rotQuartz); + comQuartz->RegisterYourself(); + + TGeoRotation* rotPlates = new TGeoRotation(nameRot.Data(), + ac[ic], bc[ic], gc[ic]); + rotPlates->RegisterYourself(); + TGeoCombiTrans* comPlates = new TGeoCombiTrans(nameComPlates.Data(), + xQrad[ic], yQrad[ic], + zQrad[ic], + rotPlates); + comPlates->RegisterYourself(); + + // Subtract the PMTs from the frame + std::string pmtCombiString = ""; + pmtCombiString += "- "; + pmtCombiString += "pmtBoxSeat:"; + pmtCombiString += nameComPMT.Data(); + shellString += pmtCombiString; + + // Subtract the QuartzRadiators from the frame + std::string quartzCombiString = ""; + quartzCombiString += "- "; + quartzCombiString += "quartzRadiatorSeat:"; + quartzCombiString += nameComQuartz.Data(); + shellString += quartzCombiString; + } + } + + // Construct composite shape from boolean + TGeoCompositeShape* shellCompShape = new TGeoCompositeShape("shellCompShape", + shellString.c_str()); - // position of the two rectangles used to approximate the L-shaped frame element - TGeoTranslation* frameTr1 = new TGeoTranslation("frameTr1", sFrame1PosX + frameXshift, sFrame1PosY, 0 + zshift); - frameTr1->RegisterYourself(); - TGeoTranslation* frameTr2 = new TGeoTranslation("frameTr2", sFrame2PosX + frameXshift, sFrame2PosY, 0 + zshift); - frameTr2->RegisterYourself(); + TGeoVolume* shellVol = new TGeoVolume("shellVol", shellCompShape, Al); - // remove the two smaller rectangles from the L-shaped frame element - TGeoTranslation* rectTr1 = new TGeoTranslation("rectTr1", sFrame1PosX + sXoffset + frameXshift + 3.25, sFrame1PosY + sYoffset + 6.1875, 0 + zshift); - rectTr1->RegisterYourself(); + // frame mother assembly + TGeoVolumeAssembly* FT0_C_Frame = new TGeoVolumeAssembly("FT0_C_Frame"); - TGeoTranslation* rectTr2 = new TGeoTranslation("rectTr2", sFrame1PosX + sXoffset + frameXshift + 9.3, sFrame1PosY + sYoffset - 0.5775, sMountZ / 2 + zshift); - rectTr2->RegisterYourself(); + // placement and reflections of frame approxes + TGeoTranslation* shellTr1 = new TGeoTranslation("shellTr1", 0, 0, -80); + shellTr1->RegisterYourself(); - TGeoTranslation* rectTr3 = new TGeoTranslation("rectTr3", sFrame1PosX + sXoffset + frameXshift + 10.75 - sRect3X / 2, sFrame1PosY + sYoffset - 6.8525 + sRect3Y / 2, 0 + zshift); - rectTr3->RegisterYourself(); + TGeoCombiTrans* shellTr2 = new TGeoCombiTrans("shellTr2", 0, 0, -80, reflectC1); + shellTr2->RegisterYourself(); - TGeoTranslation* rectTr4 = new TGeoTranslation("rectTr4", sFrame1PosX + sXoffset + frameXshift - 7.925, sFrame1PosY + sYoffset - 6.44, 0 + zshift + 10); - rectTr4->RegisterYourself(); + FT0_C_Frame->AddNode(shellVol, 1, shellTr1); + FT0_C_Frame->AddNode(shellVol, 2, shellTr2); - TGeoTranslation* rectTr5 = new TGeoTranslation("rectTr5", sFrame2PosX + sXoffset + frameXshift + 6.965 + sRect5X / 2, sFrame2PosY + sYoffset + 4.3625 - sRect5Y / 2, 0 + zshift + rectShift); - rectTr5->RegisterYourself(); + TGeoTranslation* backPlateTr1 = new TGeoTranslation("backPlateTr1", 0, 0, -74); + backPlateTr1->RegisterYourself(); - TGeoTranslation* rectTr6 = new TGeoTranslation("rectTr6", sFrame2PosX + sXoffset + frameXshift + 6.965 - sRect6X / 2, sFrame2PosY + sYoffset - 10.7375 + sRect6Y / 2, 0 + zshift); - rectTr6->RegisterYourself(); + TGeoCombiTrans* backPlateTr2 = new TGeoCombiTrans("backPlateTr2", 0, 0, -74, reflectC1); + backPlateTr2->RegisterYourself(); - TGeoTranslation* rectTr7 = new TGeoTranslation("rectTr7", sFrame2PosX + sXoffset + frameXshift + 6.965 - sRect6X - sRect7X / 2, sFrame2PosY + sYoffset - 10.7375 + sRect7Y / 2, sMountZ / 2 + zshift); - rectTr7->RegisterYourself(); + TGeoCompositeShape* backPlateShape = new TGeoCompositeShape("backPlateShape", backPlateString.c_str()); + TGeoVolume* backPlateVol = new TGeoVolume("backPlateVol", backPlateShape, Al); - TGeoTranslation* rectTr8 = new TGeoTranslation("rectTr8", sFrame2PosX + sXoffset + frameXshift - 5.89 - sRect8X / 2, sFrame2PosY + sYoffset + 5.1125 + sRect8Y / 2, 0 + zshift); - rectTr8->RegisterYourself(); + FT0_C_Frame->AddNode(backPlateVol, 3, backPlateTr1); + FT0_C_Frame->AddNode(backPlateVol, 4, backPlateTr2); + + return FT0_C_Frame; } +std::string Detector::cPlateShapeString() +{ + Double_t prismHeight = 0.3895; //height of vertical edge of square prism part of base + Double_t prismSide = 5.9; //width and length of square prism part of base + Double_t radCurve = 81.9469; //radius of curvature of top part of base + Double_t delHeight = radCurve* + (1.0-TMath::Sqrt(1.0-0.5*TMath::Power(prismSide/radCurve,2.0))); + //height from top of square prism to center of curved top surface of base + + Double_t heightBase = prismHeight + delHeight; //from center of bottom to center of top + Double_t sliceSide = 5.3; //side lengths of slice's flat top + Double_t heightBaseBox = 2 * heightBase; + Double_t totalHeight = 0.5; + Double_t sliceHeight = 0.5 - heightBase; + + //cable dimensions and distances + Double_t cableHoleWidth = 0.3503; + Double_t cableHoleLength = 0.9003; + Double_t cableHoleDepth = 1; //really big just to punch a hole + + //sholes denotes "straight holes" and rholes denote "rotated holes" + //all distances measured from edges of slice + //up and down sholes + Double_t sHolesBottomEdge = 1.585; + Double_t sHolesTopEdge = 0.515; + Double_t sHolesAvgTopBottom = (sHolesBottomEdge+sHolesTopEdge)/2.0; + Double_t sHolesUpFromCenter = ( (sliceSide/2.0) - sHolesAvgTopBottom ); //amount up in x the sholes need to move + //left and right sholes + Double_t sHolesFarEdge = 1.585; + Double_t sHolesNearEdge = 1.065; + Double_t sHolesAvgNearFar = (sHolesFarEdge+sHolesNearEdge)/2.0; + Double_t sHolesLateralFromCenter = ( (sliceSide/2.0) - sHolesAvgNearFar ); + + // Create Boxes + TGeoBBox *box = new TGeoBBox("BASE", prismSide/2.0, heightBaseBox/2.0, prismSide/2.0); + + // Base raw box to be subtracted + TGeoBBox *slice = new TGeoBBox("SLICE", sliceSide/2.0, heightBaseBox/2.0, sliceSide/2.0); + TGeoBBox *cableHole = new TGeoBBox("CABLE", cableHoleLength/2.0, cableHoleDepth/2.0, cableHoleWidth/2.0); + TGeoBBox *cableHole2 = new TGeoBBox("CABLE2", cableHoleWidth/2.0, cableHoleLength/2.0, cableHoleDepth/2.0); + + TGeoSphere *baseShape = new TGeoSphere("BASE_SUBTRACTION", radCurve, radCurve+5.0, 80, 100, 80, 100); + + TGeoTranslation *rTrans= new TGeoTranslation("rTrans",0,radCurve,0); + rTrans->RegisterYourself(); + + TGeoTranslation *rBackTrans = new TGeoTranslation("rBackTrans",0,-1.0*radCurve,0); + rBackTrans->RegisterYourself(); + + TGeoTranslation *subSliceTrans = new TGeoTranslation("subSliceTrans",0,(heightBaseBox/2.0)+sliceHeight,0); + subSliceTrans->RegisterYourself(); + + TGeoTranslation *sHolesTopLeftTrans = new TGeoTranslation("sHolesTopLeftTrans",sHolesUpFromCenter,0,sHolesLateralFromCenter); + sHolesTopLeftTrans->RegisterYourself(); + + TGeoTranslation *sHolesTopRightTrans = new TGeoTranslation("sHolesTopRightTrans",sHolesUpFromCenter,0,-1.0*sHolesLateralFromCenter); + sHolesTopRightTrans->RegisterYourself(); + + TGeoTranslation *testTrans = new TGeoTranslation("testTrans",0.1,0.1,0); + testTrans->RegisterYourself(); + + TGeoRotation *switchToZ = new TGeoRotation("switchToZ",90,90,0); + switchToZ->RegisterYourself(); + + TGeoRotation *rotateHolesLeft = new TGeoRotation("rotateHolesLeft",345,0,0); + rotateHolesLeft->RegisterYourself(); + + TGeoRotation *rotateHolesRight = new TGeoRotation("rotatetHolesRight",15,0,0); + rotateHolesRight->RegisterYourself(); + + // Bottom holes rotation and translation with combitrans + TGeoCombiTrans *rHolesBottomLeftTrans = new TGeoCombiTrans("rHolesBottomLeftTrans",-1.0*sHolesLateralFromCenter,-1.0*sHolesUpFromCenter,0,rotateHolesLeft); + rHolesBottomLeftTrans->RegisterYourself(); + + TGeoCombiTrans *rHolesBottomRightTrans = new TGeoCombiTrans("rHolesBottomRightTrans",sHolesLateralFromCenter,-1.0*sHolesUpFromCenter,0,rotateHolesRight); + rHolesBottomRightTrans->RegisterYourself(); + + std::string plateString = " "; + plateString += "(((BASE:rTrans"; + plateString += "- BASE_SUBTRACTION)"; + plateString += "+ (SLICE:rTrans))"; + plateString += ":rBackTrans"; + plateString += "- BASE:subSliceTrans"; + plateString += "- (CABLE:sHolesTopLeftTrans)"; + plateString += "- (CABLE:sHolesTopRightTrans))"; + plateString += ":switchToZ"; + plateString += "- (CABLE2:rHolesBottomLeftTrans)"; + plateString += "- (CABLE2:rHolesBottomRightTrans)"; + + return plateString; +} +//End Support structure code +//////////////////////////////////////////// + Bool_t Detector::ProcessHits(FairVolume* v) { From d9cbc262c0ec9efc428bd3739253244d9ee15488 Mon Sep 17 00:00:00 2001 From: Jennifer Klay Date: Tue, 12 Jul 2022 19:01:43 +0000 Subject: [PATCH 2/4] remove a few errant whitespace characters --- Detectors/FIT/FT0/base/src/Geometry.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Detectors/FIT/FT0/base/src/Geometry.cxx b/Detectors/FIT/FT0/base/src/Geometry.cxx index af7dfa9440235..cf450d11384cc 100644 --- a/Detectors/FIT/FT0/base/src/Geometry.cxx +++ b/Detectors/FIT/FT0/base/src/Geometry.cxx @@ -33,7 +33,7 @@ void Geometry::setAsideModules() { //These are coordinate positions for the sensitive elements within the FIT mother volume //measured from the CAD drawings. The positive/negative X values are referenced - //from the back side of the frame lookinmg toward the interaction point + //from the back side of the frame lookinmg toward the interaction point Float_t mPosModuleAx[Geometry::NCellsA] = { -12.25, -6.15, -0.05, 6.15, 12.25, -12.25, -6.15, -0.05, 6.15, 12.25, -13.58, -7.48, 7.48, 13.58, @@ -44,7 +44,7 @@ void Geometry::setAsideModules() 6.1, 6.1, 7.43, 6.1, 6.1, 0.0, 0.0, 0.0, 0.0, -6.1, -6.1, -7.43, -6.1, -6.1, - -12.2, -12.2, -13.53, -12.2, -12.2}; + -12.2, -12.2, -13.53, -12.2, -12.2}; // A side Translations for (Int_t ipmt = 0; ipmt < NCellsA; ipmt++) { mMCP[ipmt].SetXYZ(mPosModuleAx[ipmt], mPosModuleAy[ipmt], ZdetA); From 8c1c9374f706b852870c1234ce4f4a6b9e5adda3 Mon Sep 17 00:00:00 2001 From: Jennifer Klay Date: Tue, 12 Jul 2022 19:02:19 +0000 Subject: [PATCH 3/4] remove a few errant whitespace characters --- Detectors/FIT/FT0/simulation/src/Detector.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/FIT/FT0/simulation/src/Detector.cxx b/Detectors/FIT/FT0/simulation/src/Detector.cxx index 39619c5a9aa8c..3b01241c425c7 100644 --- a/Detectors/FIT/FT0/simulation/src/Detector.cxx +++ b/Detectors/FIT/FT0/simulation/src/Detector.cxx @@ -404,7 +404,7 @@ void Detector::addAlignableVolumes() const } } -//Construction of FT0-A support structure +//Construction of FT0-A support structure //The frame is constructed by first building a block of Aluminum as a mother volume from which details can //be subtracted. First, 6 boxe shapes are subtracted from around the edges and 2 from the center of the frame //to create the fin shapes at the edges of the detector and the cross shape at the center of the detector. From 6f999c60a4a98512db986e937bdc87941bccf32c Mon Sep 17 00:00:00 2001 From: Jennifer Klay Date: Tue, 12 Jul 2022 20:21:54 +0000 Subject: [PATCH 4/4] fixing formatting to match clang-format requirements --- Detectors/FIT/FT0/base/src/Geometry.cxx | 13 +- .../include/FT0Simulation/Detector.h | 2 +- Detectors/FIT/FT0/simulation/src/Detector.cxx | 328 +++++++++--------- 3 files changed, 161 insertions(+), 182 deletions(-) diff --git a/Detectors/FIT/FT0/base/src/Geometry.cxx b/Detectors/FIT/FT0/base/src/Geometry.cxx index cf450d11384cc..de9b3ddad4c21 100644 --- a/Detectors/FIT/FT0/base/src/Geometry.cxx +++ b/Detectors/FIT/FT0/base/src/Geometry.cxx @@ -34,17 +34,10 @@ void Geometry::setAsideModules() //These are coordinate positions for the sensitive elements within the FIT mother volume //measured from the CAD drawings. The positive/negative X values are referenced //from the back side of the frame lookinmg toward the interaction point - Float_t mPosModuleAx[Geometry::NCellsA] = { -12.25, -6.15, -0.05, 6.15, 12.25, - -12.25, -6.15, -0.05, 6.15, 12.25, - -13.58, -7.48, 7.48, 13.58, - -12.25, -6.15, 0.05, 6.15, 12.25, - -12.25, -6.15, 0.05, 6.15, 12.25}; + Float_t mPosModuleAx[Geometry::NCellsA] = {-12.25, -6.15, -0.05, 6.15, 12.25, -12.25, -6.15, -0.05, 6.15, 12.25, -13.58, -7.48, 7.48, 13.58, -12.25, -6.15, 0.05, 6.15, 12.25, -12.25, -6.15, 0.05, 6.15, 12.25}; + + Float_t mPosModuleAy[Geometry::NCellsA] = {12.2, 12.2, 13.53, 12.2, 12.2, 6.1, 6.1, 7.43, 6.1, 6.1, 0.0, 0.0, 0.0, 0.0, -6.1, -6.1, -7.43, -6.1, -6.1, -12.2, -12.2, -13.53, -12.2, -12.2}; - Float_t mPosModuleAy[Geometry::NCellsA] = { 12.2, 12.2, 13.53, 12.2, 12.2, - 6.1, 6.1, 7.43, 6.1, 6.1, - 0.0, 0.0, 0.0, 0.0, - -6.1, -6.1, -7.43, -6.1, -6.1, - -12.2, -12.2, -13.53, -12.2, -12.2}; // A side Translations for (Int_t ipmt = 0; ipmt < NCellsA; ipmt++) { mMCP[ipmt].SetXYZ(mPosModuleAx[ipmt], mPosModuleAy[ipmt], ZdetA); diff --git a/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h b/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h index 856cadeb2e65e..ebfe6e4a1ba3a 100644 --- a/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h +++ b/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h @@ -152,7 +152,7 @@ class Detector : public o2::base::DetImpl TGeoVolume* constructFrameAGeometry(); //A-side TGeoVolume* constructFrameCGeometry(); //C-side std::string cPlateShapeString(); - + // BEGIN: Support structure constants // define some error to avoid overlaps static constexpr Float_t sEps = 0.05; diff --git a/Detectors/FIT/FT0/simulation/src/Detector.cxx b/Detectors/FIT/FT0/simulation/src/Detector.cxx index 3b01241c425c7..dc8d982309001 100644 --- a/Detectors/FIT/FT0/simulation/src/Detector.cxx +++ b/Detectors/FIT/FT0/simulation/src/Detector.cxx @@ -139,7 +139,7 @@ void Detector::ConstructGeometry() TGeoMedium* Al = gGeoManager->GetMedium("FT0_Aluminium$"); TGeoCompositeShape* plateCompositeShape = new TGeoCompositeShape("plateCompositeShape", cPlateShapeString().c_str()); TGeoVolume* plateVol = new TGeoVolume("plateVol", plateCompositeShape, Al); - + for (Int_t itr = Geometry::NCellsA; itr < Geometry::NCellsA + nCellsC; itr++) { nameTr = Form("0TR%i", itr + 1); nameRot = Form("0Rot%i", itr + 1); @@ -175,10 +175,10 @@ void Detector::ConstructGeometry() } //Add C-side frame stlinC->AddNode(constructFrameCGeometry(), nCellsA + nCellsC + 1); - + TGeoVolume* alice = gGeoManager->GetVolume("barrel"); //Add A-side detector - alice->AddNode(stlinA, 1, new TGeoTranslation(0, 30., zdetA+0.63)); //offset to avoid overlap with FV0 + alice->AddNode(stlinA, 1, new TGeoTranslation(0, 30., zdetA + 0.63)); //offset to avoid overlap with FV0 //Add C-side detector TGeoRotation* rotC = new TGeoRotation("rotC", 90., 0., 90., 90., 180., 0.); @@ -429,30 +429,30 @@ TGeoVolume* Detector::constructFrameAGeometry() Double_t blockdX = 37.1; //slightly larger in x Double_t blockdY = 36.85; //than y Double_t blockdZ = 6.95; //thickness of frame and back plates - TGeoBBox* block = new TGeoBBox("block",blockdX/2,blockdY/2,blockdZ/2); + TGeoBBox* block = new TGeoBBox("block", blockdX / 2, blockdY / 2, blockdZ / 2); //To form the outer frame shape with fins that bolt it to the FV0, remove //aluminum in six chunks (boxes) from two sides, then reflect these to remove //from the other sides. As viewed from the back side of the detector, count //clockwise from bottom left for numbering. - Double_t box1dX = 1.57; //narrower - Double_t box1dY = 6.55; //than it is tall - Double_t box1PosX = -(blockdX/2 - box1dX/2); //placement on the frame block - Double_t box1PosY = 0; //starts at the middle - TGeoBBox* box1 = new TGeoBBox("box1",box1dX/2,box1dY/2,blockdZ/2); - TGeoTranslation* box1Tr1 = new TGeoTranslation("box1Tr1",box1PosX,box1PosY,0); + Double_t box1dX = 1.57; //narrower + Double_t box1dY = 6.55; //than it is tall + Double_t box1PosX = -(blockdX / 2 - box1dX / 2); //placement on the frame block + Double_t box1PosY = 0; //starts at the middle + TGeoBBox* box1 = new TGeoBBox("box1", box1dX / 2, box1dY / 2, blockdZ / 2); + TGeoTranslation* box1Tr1 = new TGeoTranslation("box1Tr1", box1PosX, box1PosY, 0); box1Tr1->RegisterYourself(); - TGeoTranslation* box1Tr2 = new TGeoTranslation("box1Tr2",-box1PosX,-box1PosY,0); + TGeoTranslation* box1Tr2 = new TGeoTranslation("box1Tr2", -box1PosX, -box1PosY, 0); box1Tr2->RegisterYourself(); - + Double_t box2dX = 2.9; Double_t box2dY = 15.1; - Double_t box2PosX = -(blockdX/2 - box2dX/2); - Double_t box2PosY = blockdY/2 - box2dY/2; - TGeoBBox* box2 = new TGeoBBox("box2",box2dX/2,box2dY/2,blockdZ/2); - TGeoTranslation* box2Tr1 = new TGeoTranslation("box2Tr1",box2PosX,box2PosY,0); + Double_t box2PosX = -(blockdX / 2 - box2dX / 2); + Double_t box2PosY = blockdY / 2 - box2dY / 2; + TGeoBBox* box2 = new TGeoBBox("box2", box2dX / 2, box2dY / 2, blockdZ / 2); + TGeoTranslation* box2Tr1 = new TGeoTranslation("box2Tr1", box2PosX, box2PosY, 0); box2Tr1->RegisterYourself(); - TGeoTranslation* box2Tr2 = new TGeoTranslation("box2Tr2",-box2PosX,-box2PosY,0); + TGeoTranslation* box2Tr2 = new TGeoTranslation("box2Tr2", -box2PosX, -box2PosY, 0); box2Tr2->RegisterYourself(); //Box 3 is shallower than the others to preserve the aluminum fin where the @@ -460,33 +460,33 @@ TGeoVolume* Detector::constructFrameAGeometry() Double_t box3dX = 12.7; Double_t box3dY = 3; Double_t box3dZ = 5.45; - Double_t box3PosX = -(blockdX/2 - box2dX - box3dZ/2); - Double_t box3PosY = blockdY/2 - box3dY/2; - Double_t box3PosZ = blockdZ/2 - box3dZ/2; //subtract from the back, leaving fin on the front - TGeoBBox* box3 = new TGeoBBox("box3",box3dX/2,box3dY/2,box3dZ/2); - TGeoTranslation* box3Tr1 = new TGeoTranslation("box3Tr1",box3PosX,box3PosY,box3PosZ); + Double_t box3PosX = -(blockdX / 2 - box2dX - box3dZ / 2); + Double_t box3PosY = blockdY / 2 - box3dY / 2; + Double_t box3PosZ = blockdZ / 2 - box3dZ / 2; //subtract from the back, leaving fin on the front + TGeoBBox* box3 = new TGeoBBox("box3", box3dX / 2, box3dY / 2, box3dZ / 2); + TGeoTranslation* box3Tr1 = new TGeoTranslation("box3Tr1", box3PosX, box3PosY, box3PosZ); box3Tr1->RegisterYourself(); - TGeoTranslation* box3Tr2 = new TGeoTranslation("box3Tr2",-box3PosX,-box3PosY,box3PosZ); + TGeoTranslation* box3Tr2 = new TGeoTranslation("box3Tr2", -box3PosX, -box3PosY, box3PosZ); box3Tr2->RegisterYourself(); Double_t box4dX = 6.6; Double_t box4dY = 1.67; Double_t box4PosX = 0; - Double_t box4PosY = blockdY/2 - box4dY/2; - TGeoBBox* box4 = new TGeoBBox("box4",box4dX/2,box4dY/2,blockdZ/2); - TGeoTranslation* box4Tr1 = new TGeoTranslation("box4Tr1",box4PosX,box4PosY,0); + Double_t box4PosY = blockdY / 2 - box4dY / 2; + TGeoBBox* box4 = new TGeoBBox("box4", box4dX / 2, box4dY / 2, blockdZ / 2); + TGeoTranslation* box4Tr1 = new TGeoTranslation("box4Tr1", box4PosX, box4PosY, 0); box4Tr1->RegisterYourself(); - TGeoTranslation* box4Tr2 = new TGeoTranslation("box4Tr2",-box4PosX,-box4PosY,0); + TGeoTranslation* box4Tr2 = new TGeoTranslation("box4Tr2", -box4PosX, -box4PosY, 0); box4Tr2->RegisterYourself(); Double_t box5dX = 15; Double_t box5dY = 3; - Double_t box5PosX = blockdX/2 - box5dX/2; - Double_t box5PosY = blockdY/2 - box5dY/2; - TGeoBBox* box5 = new TGeoBBox("box5",box5dX/2,box5dY/2,blockdZ/2); - TGeoTranslation* box5Tr1 = new TGeoTranslation("box5Tr1",box5PosX,box5PosY,0); + Double_t box5PosX = blockdX / 2 - box5dX / 2; + Double_t box5PosY = blockdY / 2 - box5dY / 2; + TGeoBBox* box5 = new TGeoBBox("box5", box5dX / 2, box5dY / 2, blockdZ / 2); + TGeoTranslation* box5Tr1 = new TGeoTranslation("box5Tr1", box5PosX, box5PosY, 0); box5Tr1->RegisterYourself(); - TGeoTranslation* box5Tr2 = new TGeoTranslation("box5Tr2",-box5PosX,-box5PosY,0); + TGeoTranslation* box5Tr2 = new TGeoTranslation("box5Tr2", -box5PosX, -box5PosY, 0); box5Tr2->RegisterYourself(); //Similar to box 3, box 6 is shallower in z to leave aluminum for the fin that @@ -494,13 +494,13 @@ TGeoVolume* Detector::constructFrameAGeometry() Double_t box6dX = 2.9; Double_t box6dY = 12.2; Double_t box6dZ = 5.45; - Double_t box6PosX = blockdX/2 - box6dX/2; - Double_t box6PosY = blockdY/2 - box5dY - box6dY/2; - Double_t box6PosZ = blockdZ/2 - box6dZ/2; //subtract from the back, leaving fin at the front - TGeoBBox* box6 = new TGeoBBox("box6",box6dX/2,box6dY/2,box6dZ/2); - TGeoTranslation* box6Tr1 = new TGeoTranslation("box6Tr1",box6PosX,box6PosY,box6PosZ); + Double_t box6PosX = blockdX / 2 - box6dX / 2; + Double_t box6PosY = blockdY / 2 - box5dY - box6dY / 2; + Double_t box6PosZ = blockdZ / 2 - box6dZ / 2; //subtract from the back, leaving fin at the front + TGeoBBox* box6 = new TGeoBBox("box6", box6dX / 2, box6dY / 2, box6dZ / 2); + TGeoTranslation* box6Tr1 = new TGeoTranslation("box6Tr1", box6PosX, box6PosY, box6PosZ); box6Tr1->RegisterYourself(); - TGeoTranslation* box6Tr2 = new TGeoTranslation("box6Tr2",-box6PosX,-box6PosY,box6PosZ); + TGeoTranslation* box6Tr2 = new TGeoTranslation("box6Tr2", -box6PosX, -box6PosY, box6PosZ); box6Tr2->RegisterYourself(); //The central hole that accommodates the beam pipe is not the same on all four sides @@ -510,24 +510,24 @@ TGeoVolume* Detector::constructFrameAGeometry() Double_t cbox1dX = 7.175; //horizontal center box Double_t cbox1dY = 5.5; Double_t cbox1Xoffset = 14.425; - Double_t cbox1PosX = -(blockdX/2 - cbox1Xoffset - cbox1dX/2); + Double_t cbox1PosX = -(blockdX / 2 - cbox1Xoffset - cbox1dX / 2); Double_t cbox1PosY = 0; - TGeoBBox* cbox1 = new TGeoBBox("cbox1",cbox1dX/2,cbox1dY/2,blockdZ/2); - TGeoTranslation* cbox1Tr1 = new TGeoTranslation("cbox1Tr1",cbox1PosX,cbox1PosY,0); + TGeoBBox* cbox1 = new TGeoBBox("cbox1", cbox1dX / 2, cbox1dY / 2, blockdZ / 2); + TGeoTranslation* cbox1Tr1 = new TGeoTranslation("cbox1Tr1", cbox1PosX, cbox1PosY, 0); cbox1Tr1->RegisterYourself(); - TGeoTranslation* cbox1Tr2 = new TGeoTranslation("cbox1Tr2",-cbox1PosX,-cbox1PosY,0); + TGeoTranslation* cbox1Tr2 = new TGeoTranslation("cbox1Tr2", -cbox1PosX, -cbox1PosY, 0); cbox1Tr2->RegisterYourself(); Double_t cbox2dX = 5.75; //vertical center box - + Double_t cbox2dY = 6.575; Double_t cbox2Yoffset = 14.425; Double_t cbox2PosX = 0; - Double_t cbox2PosY = blockdY/2 - cbox2Yoffset - cbox2dY/2; - TGeoBBox* cbox2 = new TGeoBBox("cbox2",cbox2dX/2,cbox2dY/2,blockdZ/2); - TGeoTranslation* cbox2Tr1 = new TGeoTranslation("cbox2Tr1",cbox2PosX,cbox2PosY,0); + Double_t cbox2PosY = blockdY / 2 - cbox2Yoffset - cbox2dY / 2; + TGeoBBox* cbox2 = new TGeoBBox("cbox2", cbox2dX / 2, cbox2dY / 2, blockdZ / 2); + TGeoTranslation* cbox2Tr1 = new TGeoTranslation("cbox2Tr1", cbox2PosX, cbox2PosY, 0); cbox2Tr1->RegisterYourself(); - TGeoTranslation* cbox2Tr2 = new TGeoTranslation("cbox2Tr2",-cbox2PosX,-cbox2PosY,0); + TGeoTranslation* cbox2Tr2 = new TGeoTranslation("cbox2Tr2", -cbox2PosX, -cbox2PosY, 0); cbox2Tr2->RegisterYourself(); //The two L-shaped pieces that form the frame have a small 1mm gap between them, @@ -535,17 +535,16 @@ TGeoVolume* Detector::constructFrameAGeometry() //left and lower right, so that for the center column of modules, the upper two //are shifted slightly to the right (as viewed from the back) and the lower two //are shifted slightly to the left (as viewed from the back) - Double_t gapBoxdX=0.1; - Double_t gapBoxdY=blockdY/2; - Double_t gapPosX=-(sPmtSide/2 + sEps + gapBoxdX/2); - Double_t gapPosY=blockdY/4; - TGeoBBox* gapBox = new TGeoBBox("gapBox",gapBoxdX/2,gapBoxdY/2,blockdZ/2); - TGeoTranslation* gapBoxTr1 = new TGeoTranslation("gapBoxTr1",gapPosX,gapPosY,0); + Double_t gapBoxdX = 0.1; + Double_t gapBoxdY = blockdY / 2; + Double_t gapPosX = -(sPmtSide / 2 + sEps + gapBoxdX / 2); + Double_t gapPosY = blockdY / 4; + TGeoBBox* gapBox = new TGeoBBox("gapBox", gapBoxdX / 2, gapBoxdY / 2, blockdZ / 2); + TGeoTranslation* gapBoxTr1 = new TGeoTranslation("gapBoxTr1", gapPosX, gapPosY, 0); gapBoxTr1->RegisterYourself(); - TGeoTranslation* gapBoxTr2 = new TGeoTranslation("gapBoxTr2",-gapPosX,-gapPosY,0); + TGeoTranslation* gapBoxTr2 = new TGeoTranslation("gapBoxTr2", -gapPosX, -gapPosY, 0); gapBoxTr2->RegisterYourself(); - //Create a string to define the complete frame object shape //Start from the aluminum block then subtract the boxes std::string frameACompositeString = "block "; @@ -571,7 +570,7 @@ TGeoVolume* Detector::constructFrameAGeometry() Double_t fiberPlatedZ = 0.5; //fiberhead plate is underneath //Each fiber is guided to a small rectangular opening in the plate - Double_t opticalFiberHeaddY = 0.52; //narrow side + Double_t opticalFiberHeaddY = 0.52; //narrow side Double_t opticalFiberHeaddX = 1.142; //long side //The "top" two fiber heads are positioned at slightly different @@ -595,48 +594,48 @@ TGeoVolume* Detector::constructFrameAGeometry() Double_t fh2BotAngle = -30; // Define cover plate, fiber plate, and optical Fiber Head shapes - TGeoBBox* coverPlate = new TGeoBBox("coverPlate", sPmtSide/2 + sEps, sPmtSide/2 + sEps, coverPlatedZ/2); - TGeoBBox* fiberPlate = new TGeoBBox("fiberPlate", sPmtSide/2 + sEps, sPmtSide/2 + sEps, fiberPlatedZ/2); - TGeoBBox* opticalFiberHead = new TGeoBBox("opticalFiberHead", opticalFiberHeaddX/2, opticalFiberHeaddY/2, fiberPlatedZ/2); + TGeoBBox* coverPlate = new TGeoBBox("coverPlate", sPmtSide / 2 + sEps, sPmtSide / 2 + sEps, coverPlatedZ / 2); + TGeoBBox* fiberPlate = new TGeoBBox("fiberPlate", sPmtSide / 2 + sEps, sPmtSide / 2 + sEps, fiberPlatedZ / 2); + TGeoBBox* opticalFiberHead = new TGeoBBox("opticalFiberHead", opticalFiberHeaddX / 2, opticalFiberHeaddY / 2, fiberPlatedZ / 2); // Define transformations of optical fiber heads for outer plate - TGeoTranslation* coverPlateTr = new TGeoTranslation("coverPlateTr",0,0,fiberPlatedZ/2 + coverPlatedZ/2); + TGeoTranslation* coverPlateTr = new TGeoTranslation("coverPlateTr", 0, 0, fiberPlatedZ / 2 + coverPlatedZ / 2); coverPlateTr->RegisterYourself(); - TGeoTranslation* fh1TopTr1 = new TGeoTranslation("fh1TopTr1",fh1TopPosX,fh1TopPosY,0); + TGeoTranslation* fh1TopTr1 = new TGeoTranslation("fh1TopTr1", fh1TopPosX, fh1TopPosY, 0); fh1TopTr1->RegisterYourself(); - TGeoTranslation* fh1TopTr2 = new TGeoTranslation("fh1TopTr2",fh1TopPosX,-fh1TopPosY,0); + TGeoTranslation* fh1TopTr2 = new TGeoTranslation("fh1TopTr2", fh1TopPosX, -fh1TopPosY, 0); fh1TopTr2->RegisterYourself(); - TGeoCombiTrans* fh1BotTr1 = new TGeoCombiTrans("fh1BotTr1",fh1BotPosX,fh1BotPosY,0,new TGeoRotation("fh1BotRot1",fh1BotAngle,0,0)); + TGeoCombiTrans* fh1BotTr1 = new TGeoCombiTrans("fh1BotTr1", fh1BotPosX, fh1BotPosY, 0, new TGeoRotation("fh1BotRot1", fh1BotAngle, 0, 0)); fh1BotTr1->RegisterYourself(); - TGeoCombiTrans* fh1BotTr2 = new TGeoCombiTrans("fh1BotTr2",fh1BotPosX,-fh1BotPosY,0,new TGeoRotation("fh1BotRot2",-fh1BotAngle,0,0)); + TGeoCombiTrans* fh1BotTr2 = new TGeoCombiTrans("fh1BotTr2", fh1BotPosX, -fh1BotPosY, 0, new TGeoRotation("fh1BotRot2", -fh1BotAngle, 0, 0)); fh1BotTr2->RegisterYourself(); - TGeoCombiTrans* fh2TopTr1 = new TGeoCombiTrans("fh2TopTr1",fh2TopPosX,fh2TopPosY,0,new TGeoRotation("fh2TopRot1",fh2TopAngle+90,0,0)); + TGeoCombiTrans* fh2TopTr1 = new TGeoCombiTrans("fh2TopTr1", fh2TopPosX, fh2TopPosY, 0, new TGeoRotation("fh2TopRot1", fh2TopAngle + 90, 0, 0)); fh2TopTr1->RegisterYourself(); - TGeoCombiTrans* fh2TopTr2 = new TGeoCombiTrans("fh2TopTr2",fh2TopPosX,-fh2TopPosY,0,new TGeoRotation("fh2TopRot2",-fh2TopAngle-90,0,0)); + TGeoCombiTrans* fh2TopTr2 = new TGeoCombiTrans("fh2TopTr2", fh2TopPosX, -fh2TopPosY, 0, new TGeoRotation("fh2TopRot2", -fh2TopAngle - 90, 0, 0)); fh2TopTr2->RegisterYourself(); - TGeoCombiTrans* fh2BotTr1 = new TGeoCombiTrans("fh2BotTr1",fh2BotPosX,fh2BotPosY,0,new TGeoRotation("fh2BotRot1",-fh2BotAngle,0,0)); + TGeoCombiTrans* fh2BotTr1 = new TGeoCombiTrans("fh2BotTr1", fh2BotPosX, fh2BotPosY, 0, new TGeoRotation("fh2BotRot1", -fh2BotAngle, 0, 0)); fh2BotTr1->RegisterYourself(); - TGeoCombiTrans* fh2BotTr2 = new TGeoCombiTrans("fh2BotTr2",fh2BotPosX,-fh2BotPosY,0,new TGeoRotation("fh2BotRot2",fh2BotAngle,0,0)); + TGeoCombiTrans* fh2BotTr2 = new TGeoCombiTrans("fh2BotTr2", fh2BotPosX, -fh2BotPosY, 0, new TGeoRotation("fh2BotRot2", fh2BotAngle, 0, 0)); fh2BotTr2->RegisterYourself(); //Create a string that defines the plate group for the outer plates std::string outerPlateGroupString = "fiberPlate "; - outerPlateGroupString+="- opticalFiberHead:fh1TopTr1 "; - outerPlateGroupString+="- opticalFiberHead:fh1TopTr2 "; - outerPlateGroupString+="- opticalFiberHead:fh1BotTr1 "; - outerPlateGroupString+="- opticalFiberHead:fh1BotTr2 "; - outerPlateGroupString+="+ coverPlate:coverPlateTr"; + outerPlateGroupString += "- opticalFiberHead:fh1TopTr1 "; + outerPlateGroupString += "- opticalFiberHead:fh1TopTr2 "; + outerPlateGroupString += "- opticalFiberHead:fh1BotTr1 "; + outerPlateGroupString += "- opticalFiberHead:fh1BotTr2 "; + outerPlateGroupString += "+ coverPlate:coverPlateTr"; //Create the composite shape for the outer plates TGeoCompositeShape* outerPlateGroup = new TGeoCompositeShape("outerPlateGroup", outerPlateGroupString.c_str()); //Create a string that defines the plate group for the inner plates std::string innerPlateGroupString = "fiberPlate "; - innerPlateGroupString+="- opticalFiberHead:fh2TopTr1 "; - innerPlateGroupString+="- opticalFiberHead:fh2TopTr2 "; - innerPlateGroupString+="- opticalFiberHead:fh2BotTr1 "; - innerPlateGroupString+="- opticalFiberHead:fh2BotTr2 "; - innerPlateGroupString+="+ coverPlate:coverPlateTr"; + innerPlateGroupString += "- opticalFiberHead:fh2TopTr1 "; + innerPlateGroupString += "- opticalFiberHead:fh2TopTr2 "; + innerPlateGroupString += "- opticalFiberHead:fh2BotTr1 "; + innerPlateGroupString += "- opticalFiberHead:fh2BotTr2 "; + innerPlateGroupString += "+ coverPlate:coverPlateTr"; //Create the composite shape for the inner plates TGeoCompositeShape* innerPlateGroup = new TGeoCompositeShape("innerPlateGroup", innerPlateGroupString.c_str()); @@ -644,15 +643,15 @@ TGeoVolume* Detector::constructFrameAGeometry() //The sockets that are cut out of the aluminum block for the senitive elements //to fit into are offset slightly in z to leave a thin plate of aluminum at the //back - the back plate covers - Double_t backPlanedZ = 0.25; + Double_t backPlanedZ = 0.25; Double_t socketdZ = blockdZ - backPlanedZ; //Define the socket volume as a box of vacuum - TGeoVolume* socket = gGeoManager->MakeBox("Socket", Vacuum, sPmtSide / 2 + sEps, sPmtSide / 2 + sEps, socketdZ/2); + TGeoVolume* socket = gGeoManager->MakeBox("Socket", Vacuum, sPmtSide / 2 + sEps, sPmtSide / 2 + sEps, socketdZ / 2); //Define the orientation angles of the plate groups that will cover //the sockets holding the sensitive elements - Double_t rotAngle[Geometry::NCellsA] = {0,0,-90,-90,-90,0,0,-90,-90,-90,0,0,180,180,90,90,90,180,180,90,90,90,180,180}; + Double_t rotAngle[Geometry::NCellsA] = {0, 0, -90, -90, -90, 0, 0, -90, -90, -90, 0, 0, 180, 180, 90, 90, 90, 180, 180, 90, 90, 90, 180, 180}; //Define the socket and plate group translations TGeoTranslation* trSocket[Geometry::NCellsA]; TString nameTrSocket; @@ -662,39 +661,37 @@ TGeoVolume* Detector::constructFrameAGeometry() //Loop over the number of modules, subtracting the sockets and adding back in the //plate groups at the position of each module - for (Int_t itr = 0; itr < Geometry::NCellsA; itr++){ + for (Int_t itr = 0; itr < Geometry::NCellsA; itr++) { - nameTrSocket = Form("trSocket%i",itr+1); - float z = -backPlanedZ/4.0; + nameTrSocket = Form("trSocket%i", itr + 1); + float z = -backPlanedZ / 4.0; trSocket[itr] = new TGeoTranslation(nameTrSocket.Data(), mPosModuleAx[itr], mPosModuleAy[itr], z); trSocket[itr]->RegisterYourself(); - frameACompositeString+="- Socket:"; //subtract it from the aluminum block - frameACompositeString+=nameTrSocket.Data(); //at its corresponding location + frameACompositeString += "- Socket:"; //subtract it from the aluminum block + frameACompositeString += nameTrSocket.Data(); //at its corresponding location - nameTrPlateGroup = Form("trPlateGroup%i",itr+1); - namePGRot = Form("pgRot%i",itr+1); - float z2= -blockdZ/2 + (coverPlatedZ+fiberPlatedZ)/2; - trPlateGroup[itr]=new TGeoCombiTrans(nameTrPlateGroup.Data(),mPosModuleAx[itr],mPosModuleAy[itr],z2,new TGeoRotation(namePGRot.Data(),rotAngle[itr],0,0)); + nameTrPlateGroup = Form("trPlateGroup%i", itr + 1); + namePGRot = Form("pgRot%i", itr + 1); + float z2 = -blockdZ / 2 + (coverPlatedZ + fiberPlatedZ) / 2; + trPlateGroup[itr] = new TGeoCombiTrans(nameTrPlateGroup.Data(), mPosModuleAx[itr], mPosModuleAy[itr], z2, new TGeoRotation(namePGRot.Data(), rotAngle[itr], 0, 0)); trPlateGroup[itr]->RegisterYourself(); - if (itr==0||itr==2||itr==3||itr==4||itr==5||itr==10||itr==13||itr==18||itr==19||itr==20||itr==21||itr==23){ - frameACompositeString+=" + outerPlateGroup:"; //add the outer plate group back on to these modules - frameACompositeString+=nameTrPlateGroup.Data(); - frameACompositeString+=" "; - } - else { - frameACompositeString+=" + innerPlateGroup:"; //or add the inner plate group back on to all other modules - frameACompositeString+=nameTrPlateGroup.Data(); - frameACompositeString+=" "; - + if (itr == 0 || itr == 2 || itr == 3 || itr == 4 || itr == 5 || itr == 10 || itr == 13 || itr == 18 || itr == 19 || itr == 20 || itr == 21 || itr == 23) { + frameACompositeString += " + outerPlateGroup:"; //add the outer plate group back on to these modules + frameACompositeString += nameTrPlateGroup.Data(); + frameACompositeString += " "; + } else { + frameACompositeString += " + innerPlateGroup:"; //or add the inner plate group back on to all other modules + frameACompositeString += nameTrPlateGroup.Data(); + frameACompositeString += " "; } } //Finally, define the A side frame object from the complete composite shape defined above - TGeoVolume* frameA= new TGeoVolume("frameA",new TGeoCompositeShape("frameA",frameACompositeString.c_str()), Al); + TGeoVolume* frameA = new TGeoVolume("frameA", new TGeoCompositeShape("frameA", frameACompositeString.c_str()), Al); //Add the frame object to the mother volume - FT0_Frame->AddNode(frameA,1); + FT0_Frame->AddNode(frameA, 1); return FT0_Frame; } @@ -714,16 +711,16 @@ TGeoVolume* Detector::constructFrameCGeometry() // quartz & PMT C-side transformations static constexpr Double_t sensShift = 0.5; - static constexpr Double_t sQuartzRadiatorZC = 1.94360; // Dimension variable (l_{q} + static constexpr Double_t sQuartzRadiatorZC = 1.94360; // Dimension variable (l_{q} static constexpr Double_t sQuartzHeightC = (-sFrameZC / 2 + sQuartzRadiatorZC / 2); // placement variable ) - static constexpr Double_t sPmtZC = 3.600; // Dimension variable (l_{p} - static constexpr Double_t sPmtHeightC = (sFrameZC / 2 - sPmtZC / 2); // placement variable + static constexpr Double_t sPmtZC = 3.600; // Dimension variable (l_{p} + static constexpr Double_t sPmtHeightC = (sFrameZC / 2 - sPmtZC / 2); // placement variable Double_t crad = 82.; static constexpr Int_t NCellsC = Geometry::NCellsC; static constexpr Int_t NCellsA = Geometry::NCellsA; - Float_t sweep = 3.5*2; + Float_t sweep = 3.5 * 2; Float_t rMin = 81.9791; Float_t rMax = rMin + sFrameZC; Float_t tMin = 0; @@ -734,8 +731,8 @@ TGeoVolume* Detector::constructFrameCGeometry() Float_t pstartC[3] = {20., 20, 5}; Float_t multCorn = 1.275; // multiplication factor for corners - Double_t xCorn = multCorn*(-14.75272569); - Double_t yCorn = multCorn*(14.9043284); + Double_t xCorn = multCorn * (-14.75272569); + Double_t yCorn = multCorn * (14.9043284); Double_t zCorn = 79.27306024; Double_t xCorn2 = -xCorn; @@ -752,7 +749,7 @@ TGeoVolume* Detector::constructFrameCGeometry() Double_t exag = 5; // highest overlap values - Double_t errPMTZ = 10*sEps; + Double_t errPMTZ = 10 * sEps; Double_t errPMTXY = 0.02; Double_t errQrdZ = 0.143 + 0.22; Double_t errQrdXY = 0.35; @@ -767,7 +764,7 @@ TGeoVolume* Detector::constructFrameCGeometry() TGeoSphere* sphere3 = new TGeoSphere("sphere3", rMin, rMin + backPlateZ, tMin, tMax, pMin, pMax); TGeoSphere* sphere4 = new TGeoSphere("sphere4", rMin - sweep, rMax + backPlateZ + sweep, tMin, tMax, pMin, pMax); - TGeoBBox* insSeat = new TGeoBBox("insSeat", pinstart[0]*2, pinstart[1]*2, pinstart[2]*2); + TGeoBBox* insSeat = new TGeoBBox("insSeat", pinstart[0] * 2, pinstart[1] * 2, pinstart[2] * 2); TGeoBBox* quartzRadiatorSeat = new TGeoBBox("quartzRadiatorSeat", sQuartzRadiatorSide / 2 + sEps + errQrdXY, @@ -809,13 +806,13 @@ TGeoVolume* Detector::constructFrameCGeometry() reflectC1->ReflectY(true); reflectC1->RegisterYourself(); - TGeoRotation* rotCorners= new TGeoRotation("rotCorners", acCorn, bcCorn, gcCorn); + TGeoRotation* rotCorners = new TGeoRotation("rotCorners", acCorn, bcCorn, gcCorn); rotCorners->RegisterYourself(); - TGeoCombiTrans* comCorners= new TGeoCombiTrans("comCorners", xCorn, yCorn, zCorn, rotCorners); + TGeoCombiTrans* comCorners = new TGeoCombiTrans("comCorners", xCorn, yCorn, zCorn, rotCorners); comCorners->RegisterYourself(); - TGeoCombiTrans* comCorners2= new TGeoCombiTrans("comCorners2", xCorn2, yCorn2, zCorn2, rotCorners); + TGeoCombiTrans* comCorners2 = new TGeoCombiTrans("comCorners2", xCorn2, yCorn2, zCorn2, rotCorners); comCorners2->RegisterYourself(); //Create a string that defines the composite shape @@ -840,26 +837,9 @@ TGeoVolume* Detector::constructFrameCGeometry() //These could be set up to use the values in the geometry file after some //investigation of subtle differences... - static constexpr Double_t xi[NCellsC] = {-15.038271418735729, 15.038271418735729, - -15.003757581112167, 15.003757581112167, -9.02690018974363, - 9.02690018974363, -9.026897413747076, 9.026897413747076, - -9.026896531935773, 9.026896531935773, -3.0004568618531313, - 3.0004568618531313, -3.0270795197907225, 3.0270795197907225, - 3.0003978432927543, -3.0003978432927543, 3.0270569670429572, - -3.0270569670429572, 9.026750365564254, -9.026750365564254, - 9.026837450695885, -9.026837450695885, 9.026849243816981, - -9.026849243816981, 15.038129472387304, -15.038129472387304, - 15.003621961057961, -15.003621961057961}; - static constexpr Double_t yi[NCellsC] = {3.1599494336464455, -3.1599494336464455, - 9.165191680982874, -9.165191680982874, 3.1383331772537426, - -3.1383331772537426, 9.165226363918643, -9.165226363918643, - 15.141616002932361, -15.141616002932361, 9.16517861649866, - -9.16517861649866, 15.188854859073416, -15.188854859073416, - 9.165053319552113, -9.165053319552113, 15.188703787345304, - -15.188703787345304, 3.138263189805292, -3.138263189805292, - 9.165104089644917, -9.165104089644917, 15.141494417823818, - -15.141494417823818, 3.1599158563428644, -3.1599158563428644, - 9.165116302773846, -9.165116302773846}; + static constexpr Double_t xi[NCellsC] = {-15.038271418735729, 15.038271418735729, -15.003757581112167, 15.003757581112167, -9.02690018974363, 9.02690018974363, -9.026897413747076, 9.026897413747076, -9.026896531935773, 9.026896531935773, -3.0004568618531313, 3.0004568618531313, -3.0270795197907225, 3.0270795197907225, 3.0003978432927543, -3.0003978432927543, 3.0270569670429572, -3.0270569670429572, 9.026750365564254, -9.026750365564254, 9.026837450695885, -9.026837450695885, 9.026849243816981, -9.026849243816981, 15.038129472387304, -15.038129472387304, 15.003621961057961, -15.003621961057961}; + static constexpr Double_t yi[NCellsC] = {3.1599494336464455, -3.1599494336464455, 9.165191680982874, -9.165191680982874, 3.1383331772537426, -3.1383331772537426, 9.165226363918643, -9.165226363918643, 15.141616002932361, -15.141616002932361, 9.16517861649866, -9.16517861649866, 15.188854859073416, -15.188854859073416, 9.165053319552113, -9.165053319552113, 15.188703787345304, -15.188703787345304, 3.138263189805292, -3.138263189805292, 9.165104089644917, -9.165104089644917, 15.141494417823818, -15.141494417823818, 3.1599158563428644, -3.1599158563428644, 9.165116302773846, -9.165116302773846}; + Double_t zi[NCellsC]; for (Int_t ic = 0; ic < NCellsC; ic++) { zi[ic] = TMath::Sqrt(TMath::Power(crad, 2) - TMath::Power(xi[ic], 2) - TMath::Power(yi[ic], 2)); @@ -893,17 +873,26 @@ TGeoVolume* Detector::constructFrameCGeometry() gc[i] = -1 * ac[i]; } - - Double_t rmag = sqrt(xc2[0]*xc2[0] + yc2[0]*yc2[0] + zc2[0]*zc2[0]); + Double_t rmag = sqrt(xc2[0] * xc2[0] + yc2[0] * yc2[0] + zc2[0] * zc2[0]); Double_t scalePMT = (rmag + (frameHeightC / 2.0) - (sPmtHeightC / 2)) / rmag; Double_t scaleQrad = (rmag + (frameHeightC / 2.0) - sPmtHeightC - (sQuartzRadiatorZC / 2.0)) / rmag; - Double_t xPMT[NCellsC]; Double_t yPMT[NCellsC]; Double_t zPMT[NCellsC]; - Double_t aPMT[NCellsC]; Double_t bPMT[NCellsC]; Double_t gPMT[NCellsC]; - - Double_t xQrad[NCellsC]; Double_t yQrad[NCellsC]; Double_t zQrad[NCellsC]; - Double_t aQrad[NCellsC]; Double_t bQrad[NCellsC]; Double_t gQrad[NCellsC]; + Double_t xPMT[NCellsC]; + Double_t yPMT[NCellsC]; + Double_t zPMT[NCellsC]; + + Double_t aPMT[NCellsC]; + Double_t bPMT[NCellsC]; + Double_t gPMT[NCellsC]; + + Double_t xQrad[NCellsC]; + Double_t yQrad[NCellsC]; + Double_t zQrad[NCellsC]; + + Double_t aQrad[NCellsC]; + Double_t bQrad[NCellsC]; + Double_t gQrad[NCellsC]; Double_t rotC[NCellsC]; Double_t comC[NCellsC]; @@ -939,7 +928,6 @@ TGeoVolume* Detector::constructFrameCGeometry() aQrad[i] *= 180 / TMath::Pi(); bQrad[i] *= 180 / TMath::Pi(); gQrad[i] = -1 * aQrad[i]; - } TString nameRot; @@ -956,7 +944,7 @@ TGeoVolume* Detector::constructFrameCGeometry() // getting even indices to skip reflections -> reflections happen later in // frame construction - if (ic%2==0){ + if (ic % 2 == 0) { TGeoRotation* rotC = new TGeoRotation(nameRot.Data(), ac[ic], bc[ic], gc[ic]); rotC->RegisterYourself(); @@ -977,7 +965,7 @@ TGeoVolume* Detector::constructFrameCGeometry() TGeoCombiTrans* comQuartz = new TGeoCombiTrans(nameComQuartz.Data(), xQrad[ic], yQrad[ic], - zQrad[ic] - (sQuartzRadiatorZC/2 + 3*sEps), + zQrad[ic] - (sQuartzRadiatorZC / 2 + 3 * sEps), rotQuartz); comQuartz->RegisterYourself(); @@ -1007,8 +995,7 @@ TGeoVolume* Detector::constructFrameCGeometry() } // Construct composite shape from boolean - TGeoCompositeShape* shellCompShape = new TGeoCompositeShape("shellCompShape", - shellString.c_str()); + TGeoCompositeShape* shellCompShape = new TGeoCompositeShape("shellCompShape", shellString.c_str()); TGeoVolume* shellVol = new TGeoVolume("shellVol", shellCompShape, Al); @@ -1043,14 +1030,13 @@ TGeoVolume* Detector::constructFrameCGeometry() std::string Detector::cPlateShapeString() { Double_t prismHeight = 0.3895; //height of vertical edge of square prism part of base - Double_t prismSide = 5.9; //width and length of square prism part of base - Double_t radCurve = 81.9469; //radius of curvature of top part of base - Double_t delHeight = radCurve* - (1.0-TMath::Sqrt(1.0-0.5*TMath::Power(prismSide/radCurve,2.0))); + Double_t prismSide = 5.9; //width and length of square prism part of base + Double_t radCurve = 81.9469; //radius of curvature of top part of base + Double_t delHeight = radCurve * (1.0 - TMath::Sqrt(1.0 - 0.5 * TMath::Power(prismSide / radCurve, 2.0))); //height from top of square prism to center of curved top surface of base Double_t heightBase = prismHeight + delHeight; //from center of bottom to center of top - Double_t sliceSide = 5.3; //side lengths of slice's flat top + Double_t sliceSide = 5.3; //side lengths of slice's flat top Double_t heightBaseBox = 2 * heightBase; Double_t totalHeight = 0.5; Double_t sliceHeight = 0.5 - heightBase; @@ -1065,56 +1051,56 @@ std::string Detector::cPlateShapeString() //up and down sholes Double_t sHolesBottomEdge = 1.585; Double_t sHolesTopEdge = 0.515; - Double_t sHolesAvgTopBottom = (sHolesBottomEdge+sHolesTopEdge)/2.0; - Double_t sHolesUpFromCenter = ( (sliceSide/2.0) - sHolesAvgTopBottom ); //amount up in x the sholes need to move + Double_t sHolesAvgTopBottom = (sHolesBottomEdge + sHolesTopEdge) / 2.0; + Double_t sHolesUpFromCenter = ((sliceSide / 2.0) - sHolesAvgTopBottom); //amount up in x the sholes need to move //left and right sholes Double_t sHolesFarEdge = 1.585; Double_t sHolesNearEdge = 1.065; - Double_t sHolesAvgNearFar = (sHolesFarEdge+sHolesNearEdge)/2.0; - Double_t sHolesLateralFromCenter = ( (sliceSide/2.0) - sHolesAvgNearFar ); + Double_t sHolesAvgNearFar = (sHolesFarEdge + sHolesNearEdge) / 2.0; + Double_t sHolesLateralFromCenter = ((sliceSide / 2.0) - sHolesAvgNearFar); // Create Boxes - TGeoBBox *box = new TGeoBBox("BASE", prismSide/2.0, heightBaseBox/2.0, prismSide/2.0); + TGeoBBox* box = new TGeoBBox("BASE", prismSide / 2.0, heightBaseBox / 2.0, prismSide / 2.0); // Base raw box to be subtracted - TGeoBBox *slice = new TGeoBBox("SLICE", sliceSide/2.0, heightBaseBox/2.0, sliceSide/2.0); - TGeoBBox *cableHole = new TGeoBBox("CABLE", cableHoleLength/2.0, cableHoleDepth/2.0, cableHoleWidth/2.0); - TGeoBBox *cableHole2 = new TGeoBBox("CABLE2", cableHoleWidth/2.0, cableHoleLength/2.0, cableHoleDepth/2.0); + TGeoBBox* slice = new TGeoBBox("SLICE", sliceSide / 2.0, heightBaseBox / 2.0, sliceSide / 2.0); + TGeoBBox* cableHole = new TGeoBBox("CABLE", cableHoleLength / 2.0, cableHoleDepth / 2.0, cableHoleWidth / 2.0); + TGeoBBox* cableHole2 = new TGeoBBox("CABLE2", cableHoleWidth / 2.0, cableHoleLength / 2.0, cableHoleDepth / 2.0); - TGeoSphere *baseShape = new TGeoSphere("BASE_SUBTRACTION", radCurve, radCurve+5.0, 80, 100, 80, 100); + TGeoSphere* baseShape = new TGeoSphere("BASE_SUBTRACTION", radCurve, radCurve + 5.0, 80, 100, 80, 100); - TGeoTranslation *rTrans= new TGeoTranslation("rTrans",0,radCurve,0); + TGeoTranslation* rTrans = new TGeoTranslation("rTrans", 0, radCurve, 0); rTrans->RegisterYourself(); - TGeoTranslation *rBackTrans = new TGeoTranslation("rBackTrans",0,-1.0*radCurve,0); + TGeoTranslation* rBackTrans = new TGeoTranslation("rBackTrans", 0, -1.0 * radCurve, 0); rBackTrans->RegisterYourself(); - TGeoTranslation *subSliceTrans = new TGeoTranslation("subSliceTrans",0,(heightBaseBox/2.0)+sliceHeight,0); + TGeoTranslation* subSliceTrans = new TGeoTranslation("subSliceTrans", 0, (heightBaseBox / 2.0) + sliceHeight, 0); subSliceTrans->RegisterYourself(); - TGeoTranslation *sHolesTopLeftTrans = new TGeoTranslation("sHolesTopLeftTrans",sHolesUpFromCenter,0,sHolesLateralFromCenter); + TGeoTranslation* sHolesTopLeftTrans = new TGeoTranslation("sHolesTopLeftTrans", sHolesUpFromCenter, 0, sHolesLateralFromCenter); sHolesTopLeftTrans->RegisterYourself(); - TGeoTranslation *sHolesTopRightTrans = new TGeoTranslation("sHolesTopRightTrans",sHolesUpFromCenter,0,-1.0*sHolesLateralFromCenter); + TGeoTranslation* sHolesTopRightTrans = new TGeoTranslation("sHolesTopRightTrans", sHolesUpFromCenter, 0, -1.0 * sHolesLateralFromCenter); sHolesTopRightTrans->RegisterYourself(); - TGeoTranslation *testTrans = new TGeoTranslation("testTrans",0.1,0.1,0); + TGeoTranslation* testTrans = new TGeoTranslation("testTrans", 0.1, 0.1, 0); testTrans->RegisterYourself(); - TGeoRotation *switchToZ = new TGeoRotation("switchToZ",90,90,0); + TGeoRotation* switchToZ = new TGeoRotation("switchToZ", 90, 90, 0); switchToZ->RegisterYourself(); - TGeoRotation *rotateHolesLeft = new TGeoRotation("rotateHolesLeft",345,0,0); + TGeoRotation* rotateHolesLeft = new TGeoRotation("rotateHolesLeft", 345, 0, 0); rotateHolesLeft->RegisterYourself(); - TGeoRotation *rotateHolesRight = new TGeoRotation("rotatetHolesRight",15,0,0); + TGeoRotation* rotateHolesRight = new TGeoRotation("rotatetHolesRight", 15, 0, 0); rotateHolesRight->RegisterYourself(); // Bottom holes rotation and translation with combitrans - TGeoCombiTrans *rHolesBottomLeftTrans = new TGeoCombiTrans("rHolesBottomLeftTrans",-1.0*sHolesLateralFromCenter,-1.0*sHolesUpFromCenter,0,rotateHolesLeft); + TGeoCombiTrans* rHolesBottomLeftTrans = new TGeoCombiTrans("rHolesBottomLeftTrans", -1.0 * sHolesLateralFromCenter, -1.0 * sHolesUpFromCenter, 0, rotateHolesLeft); rHolesBottomLeftTrans->RegisterYourself(); - TGeoCombiTrans *rHolesBottomRightTrans = new TGeoCombiTrans("rHolesBottomRightTrans",sHolesLateralFromCenter,-1.0*sHolesUpFromCenter,0,rotateHolesRight); + TGeoCombiTrans* rHolesBottomRightTrans = new TGeoCombiTrans("rHolesBottomRightTrans", sHolesLateralFromCenter, -1.0 * sHolesUpFromCenter, 0, rotateHolesRight); rHolesBottomRightTrans->RegisterYourself(); std::string plateString = " "; @@ -1130,7 +1116,7 @@ std::string Detector::cPlateShapeString() plateString += "- (CABLE2:rHolesBottomRightTrans)"; return plateString; -} +} //End Support structure code ////////////////////////////////////////////