Project
Loading...
Searching...
No Matches
TRKPetalCase.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
15
16#include "Framework/Logger.h"
17
18#include "TGeoTube.h"
19#include "TGeoMatrix.h"
20#include "TGeoCompositeShape.h"
21#include "TGeoVolume.h"
22#include "TString.h"
23#include "TMath.h"
24
25namespace o2
26{
27namespace trk
28{
29TRKPetalCase::TRKPetalCase(Int_t number, TGeoVolume* motherVolume, Bool_t irisOpen) : mPetalCaseNumber(number), mOpenState(irisOpen)
30{
31
32 mWallThickness = .15e-1; // cm // Assume all the walls have the same thickness for now.
33 mRIn = 0.48; // cm
34 mROut = 3; // cm
35 mRInOpenState = 1.5; // cm
36 mPetalCaseLength = 70.; // cm
37
38 // Calculate angular coverages of azimuthal part of wall (equivalent to that of the sensitive volumes)
39 mAngularCoverageAzimuthalWall = (0.25 * (2 * mRIn * TMath::Pi()) - 2 * mWallThickness) / mRIn;
40 mAngularCoverageRadialWall = mWallThickness / mRIn;
41 mToDeg = 180 / TMath::Pi();
42
43 // Calculate the center of the petal (x_c, y_c, z_c) based on whether it is open or not
44 mZPos = 0;
45 if (mOpenState) {
46 Double_t rHalfPetal = 0.5 * (mRIn + mROut);
47 Double_t rOpenStateCenter = TMath::Sqrt(rHalfPetal * rHalfPetal + mRInOpenState * mRInOpenState);
48 mXPos = rOpenStateCenter * TMath::Cos(0.25 * TMath::Pi() + (mPetalCaseNumber - 1) * 0.5 * TMath::Pi());
49 mYPos = rOpenStateCenter * TMath::Sin(0.25 * TMath::Pi() + (mPetalCaseNumber - 1) * 0.5 * TMath::Pi());
50 } else {
51 mXPos = 0.;
52 mYPos = 0.;
53 }
54
55 // Make the petal case
56 constructCase(motherVolume);
57 // Make coldplate
58 constructColdPlate(motherVolume);
59 // Add the detection petals (quarter disks and barrel layers)
60 constructDetectionPetals(motherVolume);
61}
62
64{
65 TString fullCompositeName = Form("PETALCASE%d_FULLCOMPOSITE", mPetalCaseNumber);
66 TGeoCompositeShape* fullCompositeShape = new TGeoCompositeShape(fullCompositeName, mFullCompositeFormula);
67 return fullCompositeName;
68}
69
70void TRKPetalCase::constructCase(TGeoVolume* motherVolume)
71{
72
73 // Petal case parts in TGeoTubeSeg
74 mInnerAzimuthalWall = new TGeoTubeSeg(Form("PETAL%d_INNER_AZIMUTHAL_WALL", mPetalCaseNumber), mRIn, mRIn + mWallThickness, mPetalCaseLength / 2., -0.5 * mAngularCoverageAzimuthalWall * mToDeg, 0.5 * mAngularCoverageAzimuthalWall * mToDeg);
75 mOuterAzimuthalWall = new TGeoTubeSeg(Form("PETAL%d_OUTER_AZIMUTHAL_WALL", mPetalCaseNumber), mROut, mROut + mWallThickness, mPetalCaseLength / 2., -0.5 * mAngularCoverageAzimuthalWall * mToDeg, 0.5 * mAngularCoverageAzimuthalWall * mToDeg);
76 mRadialWall = new TGeoTubeSeg(Form("PETAL%d_RADIAL_WALL", mPetalCaseNumber), mRIn, mROut + mWallThickness, mPetalCaseLength / 2., -0.5 * mAngularCoverageRadialWall * mToDeg, 0.5 * mAngularCoverageRadialWall * mToDeg);
77 mForwardWall = new TGeoTubeSeg(Form("PETAL%d_FORWARD_WALL", mPetalCaseNumber), mRIn, mROut + mWallThickness, mWallThickness / 2., -0.5 * (mAngularCoverageAzimuthalWall + 2 * mAngularCoverageRadialWall) * mToDeg, 0.5 * (mAngularCoverageAzimuthalWall + 2 * mAngularCoverageRadialWall) * mToDeg);
78
79 // Rotate to correct section : 0-3
80 mAzimuthalWallRot = new TGeoRotation((TString)Form("PETAL%d_AZIMUTHAL_WALL_ROT", mPetalCaseNumber), (mPetalCaseNumber * 0.5 * TMath::Pi() + 0.5 * mAngularCoverageAzimuthalWall + mAngularCoverageRadialWall) * mToDeg, 0., 0.);
81 mAzimuthalWallRot->RegisterYourself();
82 mRadialWall1Rot = new TGeoRotation((TString)Form("PETAL%d_RADIAL_WALL1_ROT", mPetalCaseNumber), (mPetalCaseNumber * 0.5 * TMath::Pi() + 0.5 * mAngularCoverageRadialWall) * mToDeg, 0., 0.);
83 mRadialWall1Rot->RegisterYourself();
84 mRadialWall2Rot = new TGeoRotation((TString)Form("PETAL%d_RADIAL_WALL2_ROT", mPetalCaseNumber), (mPetalCaseNumber * 0.5 * TMath::Pi() + mAngularCoverageAzimuthalWall + 1.5 * mAngularCoverageRadialWall) * mToDeg, 0., 0.);
85 mRadialWall2Rot->RegisterYourself();
86
87 // Place to correct position (open or closed)
88 mAzimuthalWallCombiTrans = new TGeoCombiTrans((TString)Form("PETAL%d_AZIMUTHAL_WALL_COMBITRANS", mPetalCaseNumber), mXPos, mYPos, mZPos, mAzimuthalWallRot);
89 mAzimuthalWallCombiTrans->RegisterYourself();
90 mRadialWall1CombiTrans = new TGeoCombiTrans((TString)Form("PETAL%d_RADIAL_WALL1_COMBITRANS", mPetalCaseNumber), mXPos, mYPos, mZPos, mRadialWall1Rot);
91 mRadialWall1CombiTrans->RegisterYourself();
92 mRadialWall2CombiTrans = new TGeoCombiTrans((TString)Form("PETAL%d_RADIAL_WALL2_COMBITRANS", mPetalCaseNumber), mXPos, mYPos, mZPos, mRadialWall2Rot);
93 mRadialWall2CombiTrans->RegisterYourself();
94 mForwardWall1CombiTrans = new TGeoCombiTrans((TString)Form("PETAL%d_FORWARD_WALL1_COMBITRANS", mPetalCaseNumber), mXPos, mYPos, (mPetalCaseLength + mWallThickness) / 2., mAzimuthalWallRot);
95 mForwardWall1CombiTrans->RegisterYourself();
96 mForwardWall2CombiTrans = new TGeoCombiTrans((TString)Form("PETAL%d_FORWARD_WALL2_COMBITRANS", mPetalCaseNumber), mXPos, mYPos, -(mPetalCaseLength + mWallThickness) / 2., mAzimuthalWallRot);
97 mForwardWall2CombiTrans->RegisterYourself();
98
99 TString petalCaseCompositeFormula = (TString)Form("PETAL%d_INNER_AZIMUTHAL_WALL:PETAL%d_AZIMUTHAL_WALL_COMBITRANS", mPetalCaseNumber, mPetalCaseNumber) + (TString)Form("+PETAL%d_OUTER_AZIMUTHAL_WALL:PETAL%d_AZIMUTHAL_WALL_COMBITRANS", mPetalCaseNumber, mPetalCaseNumber) + (TString)Form("+PETAL%d_RADIAL_WALL:PETAL%d_RADIAL_WALL1_COMBITRANS", mPetalCaseNumber, mPetalCaseNumber) + (TString)Form("+PETAL%d_RADIAL_WALL:PETAL%d_RADIAL_WALL2_COMBITRANS", mPetalCaseNumber, mPetalCaseNumber) + (TString)Form("+PETAL%d_FORWARD_WALL:PETAL%d_FORWARD_WALL1_COMBITRANS", mPetalCaseNumber, mPetalCaseNumber) + (TString)Form("+PETAL%d_FORWARD_WALL:PETAL%d_FORWARD_WALL2_COMBITRANS", mPetalCaseNumber, mPetalCaseNumber);
100
101 TGeoCompositeShape* petalCaseComposite = new TGeoCompositeShape((TString)Form("PETALCASE%dsh", mPetalCaseNumber), petalCaseCompositeFormula);
102 mFullCompositeFormula = petalCaseComposite->GetName();
104 const TGeoMedium* kMedBe = matmgr.getTGeoMedium("ALICE3_TRKSERVICES_BERYLLIUM");
105
106 mPetalCaseName = Form("PETALCASE%d", mPetalCaseNumber);
107 mPetalCaseVolume = new TGeoVolume(mPetalCaseName, petalCaseComposite, kMedBe);
108 mPetalCaseVolume->SetVisibility(1);
109 mPetalCaseVolume->SetLineColor(kGray);
110
111 LOGP(info, "Creating IRIS Tracker vacuum petal case {}", mPetalCaseNumber);
112 LOGP(info, "Inserting {} in {} ", mPetalCaseVolume->GetName(), motherVolume->GetName());
113 motherVolume->AddNode(mPetalCaseVolume, 1, nullptr);
114}
115
116void TRKPetalCase::constructColdPlate(TGeoVolume* motherVolume)
117{
118 Double_t coldPlateRadius = 2.6; // cm
119 Double_t coldPlateThickness = 0.15; // cm
120 Double_t coldPlateLength = 50.; // cm
121
122 mColdPlate = new TGeoTubeSeg((TString)Form("PETAL%d_COLDPLATE", mPetalCaseNumber), coldPlateRadius, coldPlateRadius + coldPlateThickness, coldPlateLength / 2., -0.5 * mAngularCoverageAzimuthalWall * mToDeg, 0.5 * mAngularCoverageAzimuthalWall * mToDeg);
124 const TGeoMedium* medCeramic = matmgr.getTGeoMedium("ALICE3_TRKSERVICES_CERAMIC");
125 mColdPlateVolume = new TGeoVolume(Form("COLDPLATE%d", mPetalCaseNumber), mColdPlate, medCeramic);
126
127 TString coldPlateCompositeFormula = mColdPlate->GetName();
128 coldPlateCompositeFormula += ":";
129 coldPlateCompositeFormula += mAzimuthalWallCombiTrans->GetName();
130 addToPetalCaseComposite(coldPlateCompositeFormula);
131
132 mColdPlateVolume->SetVisibility(1);
133 mColdPlateVolume->SetLineColor(kGray);
134
135 LOGP(info, "Creating cold plate service");
136 LOGP(info, "Inserting {} in {} ", mColdPlateVolume->GetName(), motherVolume->GetName());
137 motherVolume->AddNode(mColdPlateVolume, 1, mAzimuthalWallCombiTrans);
138}
139
140void TRKPetalCase::constructDetectionPetals(TGeoVolume* motherVolume)
141{
142 // Add petal layers
143 // layerNumber, layerName, rIn, angularCoverage, zLength, layerx2X0
144 mPetalLayers.emplace_back(0, Form("%s_LAYER%d", mPetalCaseName.Data(), 0), 0.5f, mAngularCoverageAzimuthalWall, 50.f, 1.e-3);
145 mPetalLayers.emplace_back(1, Form("%s_LAYER%d", mPetalCaseName.Data(), 1), 1.2f, mAngularCoverageAzimuthalWall, 50.f, 1.e-3);
146 mPetalLayers.emplace_back(2, Form("%s_LAYER%d", mPetalCaseName.Data(), 2), 2.5f, mAngularCoverageAzimuthalWall, 50.f, 1.e-3);
147 for (Int_t i = 0; i < mPetalLayers.size(); ++i) {
148 mPetalLayers[i].createLayer(motherVolume, mAzimuthalWallCombiTrans);
149 }
150
151 // Add petal disks
152 // diskNumber, diskName, zPos, rIn, rOut, angularCoverage, diskx2X0
153 mPetalDisks.emplace_back(0, Form("%s_DISK%d", mPetalCaseName.Data(), 0), 26., .5, 2.5, mAngularCoverageAzimuthalWall, 1.e-3);
154 mPetalDisks.emplace_back(1, Form("%s_DISK%d", mPetalCaseName.Data(), 1), 30., .5, 2.5, mAngularCoverageAzimuthalWall, 1.e-3);
155 mPetalDisks.emplace_back(2, Form("%s_DISK%d", mPetalCaseName.Data(), 2), 34., .5, 2.5, mAngularCoverageAzimuthalWall, 1.e-3);
156 mPetalDisks.emplace_back(3, Form("%s_DISK%d", mPetalCaseName.Data(), 3), -26., .5, 2.5, mAngularCoverageAzimuthalWall, 1.e-3);
157 mPetalDisks.emplace_back(4, Form("%s_DISK%d", mPetalCaseName.Data(), 4), -30., .5, 2.5, mAngularCoverageAzimuthalWall, 1.e-3);
158 mPetalDisks.emplace_back(5, Form("%s_DISK%d", mPetalCaseName.Data(), 5), -34., .5, 2.5, mAngularCoverageAzimuthalWall, 1.e-3);
159 for (Int_t i = 0; i < mPetalDisks.size(); ++i) {
160 mPetalDisks[i].createDisk(motherVolume, mAzimuthalWallCombiTrans);
161 }
162
163 addDetectionPetelsToFullComposite();
164}
165
166void TRKPetalCase::addDetectionPetelsToFullComposite()
167{
168 for (Int_t i = 0; i < mPetalLayers.size(); ++i) {
169 Double_t zLength = mPetalLayers[i].getZLength();
170 Double_t rIn = mPetalLayers[i].getInnerRadius();
171 Double_t thickness = mPetalLayers[i].getChipThickness();
172 Double_t angularCoverage = mPetalLayers[i].getAngularCoverage();
173 TGeoTubeSeg* layerForExcavation = new TGeoTubeSeg(Form("PETALCASE%d_EXCAVATIONLAYER%d", mPetalCaseNumber, i), rIn, rIn + thickness, zLength / 2., -0.5 * angularCoverage * mToDeg, 0.5 * angularCoverage * mToDeg);
174
175 TString layerForExcavationCompositeFormula = layerForExcavation->GetName();
176 layerForExcavationCompositeFormula += ":";
177 layerForExcavationCompositeFormula += mAzimuthalWallCombiTrans->GetName();
178 addToPetalCaseComposite(layerForExcavationCompositeFormula);
179 }
180
181 for (Int_t i = 0; i < mPetalDisks.size(); ++i) {
182 Double_t zPos = mPetalDisks[i].getZ();
183 Double_t rIn = mPetalDisks[i].getInnerRadius();
184 Double_t rOut = mPetalDisks[i].getOuterRadius();
185 Double_t thickness = mPetalDisks[i].getThickness();
186 Double_t angularCoverage = mPetalDisks[i].getAngularCoverage();
187 TGeoTubeSeg* diskForExcavation = new TGeoTubeSeg(Form("PETALCASE%d_EXCAVATIONDISK%d", mPetalCaseNumber, i), rIn, rOut, thickness / 2., -0.5 * angularCoverage * mToDeg, 0.5 * angularCoverage * mToDeg);
188 TGeoCombiTrans* diskForExcavationCombiTrans = new TGeoCombiTrans(*(mAzimuthalWallCombiTrans->MakeClone())); // Copy from petal case
189 diskForExcavationCombiTrans->SetName((TString)Form("PETALCASE%d_EXCAVATIONDISK%d_COMBITRANS", mPetalCaseNumber, i));
190 diskForExcavationCombiTrans->SetDz(zPos); // Overwrite z location
191 diskForExcavationCombiTrans->RegisterYourself();
192
193 TString diskForExcavationCompositeFormula = diskForExcavation->GetName();
194 diskForExcavationCompositeFormula += ":";
195 diskForExcavationCompositeFormula += diskForExcavationCombiTrans->GetName();
196 addToPetalCaseComposite(diskForExcavationCompositeFormula);
197 }
198}
199
200// ClassImp(TRKPetalCase);
201} // namespace trk
202} // namespace o2
int32_t i
static MaterialManager & Instance()
std::vector< TRKPetalDisk > mPetalDisks
std::vector< TRKPetalLayer > mPetalLayers
constexpr float thickness
Definition SpecsV2.h:114
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...