diff --git a/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h b/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h index 2671fd1f9e26a..d6b456a206f30 100644 --- a/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h +++ b/Detectors/FIT/FT0/simulation/include/FT0Simulation/Detector.h @@ -135,6 +135,97 @@ class Detector : public o2::base::DetImpl /// Define the sensitive volumes of the geometry void defineSensitiveVolumes(); + // 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(); + + + // define some error to avoid overlaps + static constexpr Float_t sEps = 0.025; + + // 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; + static constexpr Float_t sFrame1PosY = 9.2454; + 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; + static constexpr Float_t sFrame2PosY = -8.3446; + 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 dimensions + static constexpr Float_t sPmtSide = 5.950; + static constexpr Float_t sPmtZ = 3.750; + + // quartz radiator dimensions + static constexpr Float_t sQuartzRadiatorSide = 5.350; + static constexpr Float_t sQuartzRadiatorZ = 1.950; + + // for the rounded 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; + + // quartz & PMT 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 sPmtCornerPos = 2.825; + static constexpr Float_t sEdgeCornerPos[2] = {-6.515, -.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}; + Detector& operator=(const Detector&); Geometry* mGeometry = nullptr; //! Geometry diff --git a/Detectors/FIT/FT0/simulation/src/Detector.cxx b/Detectors/FIT/FT0/simulation/src/Detector.cxx index 9837c6d834c84..1518aa406a065 100644 --- a/Detectors/FIT/FT0/simulation/src/Detector.cxx +++ b/Detectors/FIT/FT0/simulation/src/Detector.cxx @@ -15,6 +15,8 @@ #include "TSystem.h" #include "TVirtualMC.h" #include "TVector3.h" +#include "TGeoTube.h" +#include "TGeoCompositeShape.h" #include "FairRootManager.h" // for FairRootManager #include "FairLogger.h" @@ -147,11 +149,14 @@ void Detector::ConstructGeometry() } // A Side - Float_t xa[Geometry::NCellsA] = {-11.8, -5.9, 0, 5.9, 11.8, -11.8, -5.9, 0, 5.9, 11.8, -12.8, -6.9, - 6.9, 12.8, -11.8, -5.9, 0, 5.9, 11.8, -11.8, -5.9, 0, 5.9, 11.8}; + Float_t xa[Geometry::NCellsA] = {-12.5028, -6.4028, 0.3028, 6.4028, 12.5028, -12.5028, -6.4028, 0.3028, 6.4028, 12.5028, + -13.8328, -7.7328, 7.7328, 13.8328, -12.5028, -6.4028, 0, 6.4028, 12.5028, -12.5028, + -6.4028, 0, 6.4028, 12.5028}; + + Float_t ya[Geometry::NCellsA] = {12.8571, 12.8571, 12.8729, 11.5429, 11.5429, 6.7571, 6.7571, 6.7729, 5.4429, 5.4429, + 0.6571, 0.6571, -0.6571, -0.6571, -5.4429, -5.4429, -7., -6.7571, -6.7571, -11.5429, + -11.5429, -12.9, -12.8571, -12.8571}; - Float_t ya[Geometry::NCellsA] = {11.9, 11.9, 12.9, 11.9, 11.9, 6.0, 6.0, 7.0, 6.0, 6.0, -0.1, -0.1, - 0.1, 0.1, -6.0, -6.0, -7.0, -6.0, -6.0, -11.9, -11.9, -12.9, -11.9, -11.9}; TGeoVolumeAssembly* stlinA = new TGeoVolumeAssembly("0STL"); // A side mother TGeoVolumeAssembly* stlinC = new TGeoVolumeAssembly("0STR"); // C side mother @@ -197,6 +202,7 @@ void Detector::ConstructGeometry() stlinC->AddNode(ins, itr, ph); } + stlinA->AddNode(constructFrameGeometry(), 1, new TGeoTranslation(0,0,-pstartA[2] + pinstart[2])); TGeoVolume* alice = gGeoManager->GetVolume("cave"); alice->AddNode(stlinA, 1, new TGeoTranslation(0, 0, zdetA)); TGeoRotation* rotC = new TGeoRotation("rotC", 90., 0., 90., 90., 180., 0.); @@ -357,6 +363,399 @@ void Detector::SetOneMCP(TGeoVolume* ins) // ins->AddNode(alsup,1); } +TGeoVolume* Detector::constructFrameGeometry() +{ + // define the media + TGeoMedium* air = gGeoManager->GetMedium("FT0_Air$"); + TGeoMedium* Al = gGeoManager->GetMedium("FT0_Aluminium$"); + + // make a volume assembly for the frame + TGeoVolumeAssembly* FT0_Frame = new TGeoVolumeAssembly("FT0_Frame"); + + // define translations for the quartz radiators and PMTs + defineTransformations(); + + // approximate the frame with some rectangles + TGeoBBox* frame1 = new TGeoBBox("frame1", sFrame1X / 2, sFrame1Y / 2, sFrameZ / 2); + TGeoBBox* frame2 = new TGeoBBox("frame2", sFrame2X / 2, sFrame2Y / 2, sFrameZ / 2); + TGeoBBox* quartzRadiator = new TGeoBBox("quartzRadiator", sQuartzRadiatorSide / 2, sQuartzRadiatorSide / 2, sQuartzRadiatorZ / 2); + 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 + sEps); + 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); + + // PMT needs round edges + TGeoBBox* pmtBox = new TGeoBBox("pmtBox", sPmtSide / 2 + sEps, sPmtSide / 2 + sEps, sPmtZ / 2 + sEps); + TGeoBBox* pmtCornerRect = new TGeoBBox("pmtCornerRect", sCornerRadius / 2, sCornerRadius / 2, sPmtZ / 2); + TGeoTube* pmtCornerTube = new TGeoTube("pmtCornerTube", 0, sCornerRadius, sPmtZ / 2); + TGeoVolume* pmtCorner = new TGeoVolume("pmtCorner", new TGeoCompositeShape("pmtCorner", pmtCornerCompositeShapeBoolean().c_str()), Al); + TGeoVolume* PMT = new TGeoVolume("PMT", new TGeoCompositeShape("PMT", pmtCompositeShapeBoolean().c_str()), air); + + // 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 quartz radiators and PMTs from the frame + TGeoCompositeShape* frameRemovedPmtAndRadiators1 = new TGeoCompositeShape("frameRemovedPmtAndRadiators1", frame1CompositeShapeBoolean().c_str()); + TGeoCompositeShape* frameRemovedPmtAndRadiators2 = new TGeoCompositeShape("frameRemovedPmtAndRadiators2", frame2CompositeShapeBoolean().c_str()); + + // make the right side frame + 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 the right and left sides to top volume + FT0_Frame->AddNode(frame, 1); // right side + FT0_Frame->AddNode(frame, 2, reflect); // left side + + return FT0_Frame; +} + +std::string Detector::frame1CompositeShapeBoolean() +{ + // create a string for the boolean operations for the composite frame shape + std::string frame1CompositeShapeBoolean = ""; + frame1CompositeShapeBoolean += "((frame1"; + + // remove the radiators + frame1CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr1"; + frame1CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr2"; + frame1CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr3"; + frame1CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr4"; + frame1CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr5"; + frame1CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr6)"; + + // remove the PMTs + frame1CompositeShapeBoolean += " - PMT:PMTTr1"; + frame1CompositeShapeBoolean += " - PMT:PMTTr2"; + frame1CompositeShapeBoolean += " - PMT:PMTTr3"; + frame1CompositeShapeBoolean += " - PMT:PMTTr4"; + frame1CompositeShapeBoolean += " - PMT:PMTTr5"; + frame1CompositeShapeBoolean += " - PMT:PMTTr6)"; + + return frame1CompositeShapeBoolean; +} + +std::string Detector::frame2CompositeShapeBoolean() +{ + std::string frame2CompositeShapeBoolean = ""; + frame2CompositeShapeBoolean += "((frame2"; + + // remove the radiators + frame2CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr7"; + frame2CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr8"; + frame2CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr9"; + frame2CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr10"; + frame2CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr11"; + frame2CompositeShapeBoolean += " - quartzRadiator:quartzRadiatorTr12)"; + + // remove the PMTs + frame2CompositeShapeBoolean += " - PMT:PMTTr7"; + frame2CompositeShapeBoolean += " - PMT:PMTTr8"; + frame2CompositeShapeBoolean += " - PMT:PMTTr9"; + frame2CompositeShapeBoolean += " - PMT:PMTTr10"; + frame2CompositeShapeBoolean += " - PMT:PMTTr11"; + frame2CompositeShapeBoolean += " - PMT:PMTTr12)"; + + return frame2CompositeShapeBoolean; +} + +std::string Detector::frameCompositeShapeBoolean() +{ + // create a string for the boolean operations for the composite plateGroup shape + std::string frameCompositeShapeBoolean = ""; + + // add frames 1 and 2 + frameCompositeShapeBoolean += "frameRemovedPmtAndRadiators1:frameTr1"; + frameCompositeShapeBoolean += " + frameRemovedPmtAndRadiators2:frameTr2"; + + // add the plateGroups + frameCompositeShapeBoolean += " + plateGroup:plateGroupTr1"; + frameCompositeShapeBoolean += " + plateGroup:plateGroupTr2"; + + // subtract the extra Al + 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; +} + +std::string Detector::plateGroupCompositeShapeBoolean() +{ + // create a string for the boolean operations for the composite plateGroup shape + std::string plateGroupCompositeShapeBoolean = ""; + + // add the plateBoxes to the plateGroup + plateGroupCompositeShapeBoolean += "plateBox:plateTr1"; + plateGroupCompositeShapeBoolean += " + plateBox:plateTr2"; + plateGroupCompositeShapeBoolean += " + plateBox:plateTr3"; + + return plateGroupCompositeShapeBoolean; +} + +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; +} + +std::string Detector::opticalFiberPlateCompositeShapeBoolean2() +{ + // create a string for the boolean operations for the composite opticalFiberPlate2 shape + std::string opticalFiberPlateCompositeShapeBoolean2 = ""; + + // remove the opticalFiberHeads from the cablePlate + opticalFiberPlateCompositeShapeBoolean2 += "cablePlate"; + opticalFiberPlateCompositeShapeBoolean2 += " - opticalFiberHead:opticalFiberHeadTr5"; + opticalFiberPlateCompositeShapeBoolean2 += " - opticalFiberHead:opticalFiberHeadTr6"; + opticalFiberPlateCompositeShapeBoolean2 += " - opticalFiberHead:opticalFiberHeadTr7"; + opticalFiberPlateCompositeShapeBoolean2 += " - opticalFiberHead:opticalFiberHeadTr8"; + + return opticalFiberPlateCompositeShapeBoolean2; +} + +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"; + + return pmtCornerCompositeShapeBoolean; +} + +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; +} + +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; +} + +void Detector::defineTransformations() +{ + defineQuartzRadiatorTransformations(); + definePmtTransformations(); + definePlateTransformations(); + defineFrameTransformations(); +} + +void Detector::defineQuartzRadiatorTransformations() +{ + // translations for quartz radiators in frame 1 + 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 radiators in frame 2 + 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(); +} + +void Detector::definePmtTransformations() +{ + // translations for PMTs in frame 1 + 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 PMTs in frame 2 + 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(); +} + +void Detector::definePlateTransformations() +{ + // TODO: redefine fiber head transformations + // 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 + // 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(); +} + +void Detector::defineFrameTransformations() +{ + // position of the two rectangles used to approximate the frame + TGeoTranslation* frameTr1 = new TGeoTranslation("frameTr1", sFrame1PosX, sFrame1PosY, 0); + frameTr1->RegisterYourself(); + TGeoTranslation* frameTr2 = new TGeoTranslation("frameTr2", sFrame2PosX, sFrame2PosY, 0); + frameTr2->RegisterYourself(); + + // remove the two smaller rectangles from the frame + TGeoTranslation* rectTr1 = new TGeoTranslation("rectTr1", sFrame1PosX + 3.25, sFrame1PosY + 6.1875, 0); + rectTr1->RegisterYourself(); + + TGeoTranslation* rectTr2 = new TGeoTranslation("rectTr2", sFrame1PosX + 9.3, sFrame1PosY - 0.5775, sMountZ / 2); + rectTr2->RegisterYourself(); + + TGeoTranslation* rectTr3 = new TGeoTranslation("rectTr3", sFrame1PosX + 10.75 - sRect3X / 2, sFrame1PosY - 6.8525 + sRect3Y / 2, 0); + rectTr3->RegisterYourself(); + + TGeoTranslation* rectTr4 = new TGeoTranslation("rectTr4", sFrame1PosX - 7.925, sFrame1PosY - 6.44, 0); + rectTr4->RegisterYourself(); + + TGeoTranslation* rectTr5 = new TGeoTranslation("rectTr5", sFrame2PosX + 6.965 - sRect5X / 2, sFrame2PosY + 4.3625 - sRect5Y / 2, 0); + rectTr5->RegisterYourself(); + + TGeoTranslation* rectTr6 = new TGeoTranslation("rectTr6", sFrame2PosX + 6.965 - sRect6X / 2, sFrame2PosY - 10.7375 + sRect6Y / 2, 0); + rectTr6->RegisterYourself(); + + TGeoTranslation* rectTr7 = new TGeoTranslation("rectTr7", sFrame2PosX + 6.965 - sRect6X - sRect7X / 2, sFrame2PosY - 10.7375 + sRect7Y / 2, sMountZ / 2); + rectTr7->RegisterYourself(); + + TGeoTranslation* rectTr8 = new TGeoTranslation("rectTr8", sFrame2PosX - 5.89 - sRect8X / 2, sFrame2PosY + 5.1125 + sRect8Y / 2, 0); + rectTr8->RegisterYourself(); +} + Bool_t Detector::ProcessHits(FairVolume* v) { TVirtualMCStack* stack = fMC->GetStack();