Project
Loading...
Searching...
No Matches
FCTLayer.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
16
20
21#include <fairlogger/Logger.h> // for LOG
22
23#include <TGeoManager.h> // for TGeoManager, gGeoManager
24#include <TGeoMatrix.h> // for TGeoCombiTrans, TGeoRotation, etc
25#include <TGeoMedium.h>
26#include <TGeoTube.h> // for TGeoTube, TGeoTubeSeg
27#include <TGeoVolume.h> // for TGeoVolume, TGeoVolumeAssembly
28#include <TGeoCompositeShape.h> // for TGeoCompositeShape
29#include "TMathBase.h" // for Abs
30#include <TMath.h> // for Sin, RadToDeg, DegToRad, Cos, Tan, etc
31
32#include <cstdio> // for snprintf
33
34using namespace TMath;
35using namespace o2::fct;
36using namespace o2::itsmft;
37
39
40FCTLayer::~FCTLayer() = default;
41
42FCTLayer::FCTLayer(Int_t layerNumber, std::string layerName, Float_t z, Float_t rIn, Float_t rOut_SideL, Float_t Layerx2X0, Int_t type) : mLayerNumber(layerNumber), mLayerName(layerName), mx2X0(Layerx2X0), mType(type), mInnerRadius(rIn)
43{
44 mZ = z;
45 if (type == 0 || type == 2) { // Disk
46 mOuterRadius = rOut_SideL;
47 } else if (type == 1) { // Square
48 mSideLength = rOut_SideL;
49 }
50 Float_t Si_X0 = 9.37; // In cm
51 Float_t Pb_X0 = 0.5612; // In cm
52
53 if (mType == 0) {
54 mChipThickness = Layerx2X0 * Si_X0;
55 LOG(info) << "Creating FCT Disk Layer " << mLayerNumber;
56 LOG(info) << " Using silicon X0 = " << Si_X0 << " to emulate layer radiation length.";
57 LOG(info) << " Layer z = " << mZ << " ; R_in = " << mInnerRadius << " ; R_out = " << mOuterRadius << " ; x2X0 = " << mx2X0 << " ; ChipThickness = " << mChipThickness;
58 } else if (mType == 1) {
59 mChipThickness = Layerx2X0 * Si_X0;
60 LOG(info) << "Creating FCT Square Layer " << mLayerNumber;
61 LOG(info) << " Using silicon X0 = " << Si_X0 << " to emulate layer radiation length.";
62 LOG(info) << " Layer z = " << mZ << " ; R_in = " << mInnerRadius << " ; L_side = " << mSideLength << " ; x2X0 = " << mx2X0 << " ; ChipThickness = " << mChipThickness;
63 } else if (mType == 2) {
64 mChipThickness = Layerx2X0 * Pb_X0;
65 LOG(info) << "Creating FCT Converter Layer " << mLayerNumber;
66 LOG(info) << " Using lead X0 = " << Pb_X0 << " to emulate layer radiation length.";
67 LOG(info) << " Layer z = " << mZ << " ; R_in = " << mInnerRadius << " ; R_out = " << mOuterRadius << " ; x2X0 = " << mx2X0 << " ; ChipThickness = " << mChipThickness;
68 }
69}
70
71void FCTLayer::createLayer(TGeoVolume* motherVolume)
72{
73 if (mType == 0) {
74 createDiskLayer(motherVolume);
75 } else if (mType == 1) {
76 createSquareLayer(motherVolume);
77 } else if (mType == 2) {
78 createConverterLayer(motherVolume);
79 }
80 return;
81}
82
83void FCTLayer::createDiskLayer(TGeoVolume* motherVolume)
84{
85 if (mLayerNumber < 0) {
86 return;
87 }
88 // Create tube, set sensitive volume, add to mother volume
89
90 std::string chipName = o2::fct::GeometryTGeo::getFCTChipPattern() + std::to_string(mLayerNumber),
91 sensName = Form("%s_%d", GeometryTGeo::getFCTSensorPattern(), mLayerNumber);
92 TGeoTube* sensor = new TGeoTube(mInnerRadius, mOuterRadius, mChipThickness / 2);
93 TGeoTube* chip = new TGeoTube(mInnerRadius, mOuterRadius, mChipThickness / 2);
94 TGeoTube* layer = new TGeoTube(mInnerRadius, mOuterRadius, mChipThickness / 2);
95
96 TGeoMedium* medSi = gGeoManager->GetMedium("FCT_SILICON$");
97 TGeoMedium* medAir = gGeoManager->GetMedium("FCT_AIR$");
98
99 TGeoVolume* sensVol = new TGeoVolume(sensName.c_str(), sensor, medSi);
100 sensVol->SetLineColor(kSpring + 5);
101 TGeoVolume* chipVol = new TGeoVolume(chipName.c_str(), chip, medSi);
102 chipVol->SetLineColor(kSpring + 5);
103 TGeoVolume* layerVol = new TGeoVolume(mLayerName.c_str(), layer, medAir);
104 layerVol->SetLineColor(kSpring + 5);
105
106 LOG(info) << "Inserting " << sensVol->GetName() << " inside " << chipVol->GetName();
107 chipVol->AddNode(sensVol, 1, nullptr);
108
109 LOG(info) << "Inserting " << chipVol->GetName() << " inside " << layerVol->GetName();
110 layerVol->AddNode(chipVol, 1, nullptr);
111
112 // Finally put everything in the mother volume
113 auto FwdDiskRotation = new TGeoRotation("FwdDiskRotation", 0, 0, 180);
114 auto FwdDiskCombiTrans = new TGeoCombiTrans(0, 0, mZ, FwdDiskRotation);
115
116 LOG(info) << "Inserting " << layerVol->GetName() << " inside " << motherVolume->GetName();
117 motherVolume->AddNode(layerVol, 1, FwdDiskCombiTrans);
118}
119
120void FCTLayer::createSquareLayer(TGeoVolume* motherVolume)
121{
122 if (mLayerNumber < 0) {
123 return;
124 }
125
126 LOG(info) << "Constructing a layer and adding it to the motherVolume";
127
128 std::string chipName = o2::fct::GeometryTGeo::getFCTChipPattern() + std::to_string(mLayerNumber),
129 sensName = Form("%s_%d", GeometryTGeo::getFCTSensorPattern(), mLayerNumber);
130 TGeoBBox* sensorBox = new TGeoBBox("SensorBox", mSideLength, mSideLength, mChipThickness / 2);
131 TGeoBBox* chipBox = new TGeoBBox("ChipBox", mSideLength, mSideLength, mChipThickness / 2);
132 TGeoBBox* layerBox = new TGeoBBox("LayerBox", mSideLength, mSideLength, mChipThickness / 2);
133
134 TGeoTube* sensorCutout = new TGeoTube("SensorTube", 0., mInnerRadius, mChipThickness / 2);
135 TGeoTube* chipCutout = new TGeoTube("ChipTube", 0., mInnerRadius, mChipThickness / 2);
136 TGeoTube* layerCutout = new TGeoTube("LayerTube", 0., mInnerRadius, mChipThickness / 2);
137
138 TGeoCompositeShape* SensorComp = new TGeoCompositeShape("SensorComp", "SensorBox - SensorTube");
139 TGeoCompositeShape* ChipComp = new TGeoCompositeShape("SensorComp", "ChipBox - ChipTube");
140 TGeoCompositeShape* LayerComp = new TGeoCompositeShape("SensorComp", "LayerBox - LayerTube");
141
142 TGeoMedium* medSi = gGeoManager->GetMedium("FCT_SI$");
143 TGeoMedium* medAir = gGeoManager->GetMedium("FCT_AIR$");
144
145 TGeoVolume* sensVol = new TGeoVolume(sensName.c_str(), SensorComp, medSi);
146 TGeoVolume* chipVol = new TGeoVolume(chipName.c_str(), ChipComp, medSi);
147 TGeoVolume* layerVol = new TGeoVolume(mLayerName.c_str(), LayerComp, medAir);
148
149 LOG(info) << "Inserting " << sensVol->GetName() << " inside " << chipVol->GetName();
150 chipVol->AddNode(sensVol, 1, nullptr);
151
152 LOG(info) << "Inserting " << chipVol->GetName() << " inside " << layerVol->GetName();
153 layerVol->AddNode(chipVol, 1, nullptr);
154
155 // Finally put everything in the mother volume
156 auto FwdLayerRotation = new TGeoRotation("FwdDiskRotation", 0, 0, 180);
157 auto FwdLayerCombiTrans = new TGeoCombiTrans(0, 0, mZ, FwdLayerRotation);
158
159 LOG(info) << "Inserting " << layerVol->GetName() << " inside " << motherVolume->GetName();
160 motherVolume->AddNode(layerVol, 1, FwdLayerCombiTrans);
161}
162
163void FCTLayer::createConverterLayer(TGeoVolume* motherVolume)
164{
165 if (mLayerNumber < 0) {
166 return;
167 }
168
169 LOG(info) << "Constructing a passive converter layer and adding it to the motherVolume";
170 std::string chipName = o2::fct::GeometryTGeo::getFCTChipPattern() + std::to_string(mLayerNumber),
171 sensName = Form("%s_%d", GeometryTGeo::getFCTSensorPattern(), mLayerNumber);
172 TGeoTube* sensor = new TGeoTube(mInnerRadius, mOuterRadius, mChipThickness / 2);
173 TGeoTube* chip = new TGeoTube(mInnerRadius, mOuterRadius, mChipThickness / 2);
174 TGeoTube* layer = new TGeoTube(mInnerRadius, mOuterRadius, mChipThickness / 2);
175
176 TGeoMedium* medPb = gGeoManager->GetMedium("FCT_LEAD$");
177 TGeoMedium* medAir = gGeoManager->GetMedium("FCT_AIR$");
178
179 TGeoVolume* sensVol = new TGeoVolume(sensName.c_str(), sensor, medPb);
180 TGeoVolume* chipVol = new TGeoVolume(chipName.c_str(), chip, medPb);
181 TGeoVolume* layerVol = new TGeoVolume(mLayerName.c_str(), layer, medPb);
182
183 LOG(info) << "Inserting " << sensVol->GetName() << " inside " << chipVol->GetName();
184 chipVol->AddNode(sensVol, 1, nullptr);
185
186 LOG(info) << "Inserting " << chipVol->GetName() << " inside " << layerVol->GetName();
187 layerVol->AddNode(chipVol, 1, nullptr);
188
189 // Finally put everything in the mother volume
190 auto FwdDiskRotation = new TGeoRotation("FwdDiskRotation", 0, 0, 180);
191 auto FwdDiskCombiTrans = new TGeoCombiTrans(0, 0, mZ, FwdDiskRotation);
192
193 LOG(info) << "Inserting " << layerVol->GetName() << " inside " << motherVolume->GetName();
194 motherVolume->AddNode(layerVol, 1, FwdDiskCombiTrans);
195}
ClassImp(FCTLayer)
Definition of the FCTLayer class.
Definition of the GeometryTGeo class.
Definition of the Detector class.
virtual void createLayer(TGeoVolume *motherVolume)
Definition FCTLayer.cxx:71
FCTLayer()=default
~FCTLayer() override
Default destructor.
static const char * getFCTChipPattern()
static const char * getFCTSensorPattern()
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"