27TRKLayer::TRKLayer(
int layerNumber, std::string layerName,
float rInn,
float rOut,
float zLength,
float layerX2X0)
28 : mLayerNumber(layerNumber), mLayerName(layerName), mInnerRadius(rInn), mOuterRadius(rOut), mZ(zLength), mX2X0(layerX2X0), mModuleWidth(4.54), mLayout(
kCylinder)
31 mChipThickness = mX2X0 * Si_X0;
32 LOGP(info,
"Creating layer: id: {} rInner: {} rOuter: {} zLength: {} x2X0: {}", mLayerNumber, mInnerRadius, mOuterRadius, mZ, mX2X0);
35TRKLayer::TRKLayer(
int layerNumber, std::string layerName,
float rInn,
float zLength,
float thick)
36 : mLayerNumber(layerNumber), mLayerName(layerName), mInnerRadius(rInn), mZ(zLength), mChipThickness(thick), mModuleWidth(4.54), mLayout(
kCylinder)
39 mOuterRadius = rInn + thick;
40 mX2X0 = mChipThickness / Si_X0;
41 LOGP(info,
"Creating layer: id: {} rInner: {} rOuter: {} zLength: {} x2X0: {}", mLayerNumber, mInnerRadius, mOuterRadius, mZ, mX2X0);
46 TGeoMedium* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
51 if (
type ==
"cylinder") {
52 sensor =
new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2);
53 }
else if (
type ==
"flat") {
55 LOGP(fatal,
"Attempting to create sensor with invalid width");
57 sensor =
new TGeoBBox(
width / 2, mChipThickness / 2, mZ / 2);
59 LOGP(fatal,
"Sensor of type '{}' is not implemented",
type);
62 TGeoVolume* sensVol =
new TGeoVolume(sensName.c_str(), sensor, medSi);
63 sensVol->SetLineColor(kYellow);
70 TGeoMedium* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
76 if (
type ==
"cylinder") {
77 chip =
new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2);
79 }
else if (
type ==
"flat") {
81 LOGP(fatal,
"Attempting to create chip with invalid width");
83 chip =
new TGeoBBox(
width / 2, mChipThickness / 2, mZ / 2);
86 LOGP(fatal,
"Sensor of type '{}' is not implemented",
type);
89 TGeoVolume* chipVol =
new TGeoVolume(chipName.c_str(), chip, medSi);
90 LOGP(info,
"Inserting {} in {} ", sensVol->GetName(), chipVol->GetName());
91 chipVol->AddNode(sensVol, 1,
nullptr);
92 chipVol->SetLineColor(kYellow);
99 TGeoMedium* medAir = gGeoManager->GetMedium(
"TRK_AIR$");
103 TGeoVolume* staveVol;
106 if (
type ==
"cylinder") {
107 stave =
new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2);
109 staveVol =
new TGeoVolume(staveName.c_str(), stave, medAir);
110 LOGP(info,
"Inserting {} in {} ", chipVol->GetName(), staveVol->GetName());
111 staveVol->AddNode(chipVol, 1,
nullptr);
112 }
else if (
type ==
"flat") {
114 LOGP(fatal,
"Attempting to create stave with invalid width");
116 stave =
new TGeoBBox(
width / 2, mChipThickness / 2, mZ / 2);
118 staveVol =
new TGeoVolume(staveName.c_str(), stave, medAir);
119 LOGP(info,
"Inserting {} in {} ", chipVol->GetName(), staveVol->GetName());
120 staveVol->AddNode(chipVol, 1,
nullptr);
121 }
else if (
type ==
"staggered") {
122 double width = mModuleWidth * 2;
123 stave =
new TGeoBBox(
width / 2, mLogicalVolumeThickness / 2, mZ / 2);
124 TGeoVolume* chipVolLeft =
createChip(
"flat", mModuleWidth);
125 TGeoVolume* chipVolRight =
createChip(
"flat", mModuleWidth);
126 staveVol =
new TGeoVolume(staveName.c_str(), stave, medAir);
128 TGeoCombiTrans* transLeft =
new TGeoCombiTrans();
129 transLeft->SetTranslation(-mModuleWidth / 2 + 0.05, 0, 0);
130 LOGP(info,
"Inserting {} in {} ", chipVolLeft->GetName(), staveVol->GetName());
131 staveVol->AddNode(chipVolLeft, 0, transLeft);
133 TGeoCombiTrans* transRight =
new TGeoCombiTrans();
134 transRight->SetTranslation(mModuleWidth / 2 - 0.05, 0.2, 0);
135 LOGP(info,
"Inserting {} in {} ", chipVolRight->GetName(), staveVol->GetName());
136 staveVol->AddNode(chipVolRight, 1, transRight);
138 LOGP(fatal,
"Chip of type '{}' is not implemented",
type);
141 staveVol->SetLineColor(kYellow);
148 TGeoMedium* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
149 TGeoMedium* medAir = gGeoManager->GetMedium(
"TRK_AIR$");
155 double layerThickness = mChipThickness;
157 layerThickness = mLogicalVolumeThickness;
159 TGeoTube*
layer =
new TGeoTube(mInnerRadius - 0.333 * layerThickness, mInnerRadius + 0.667 * layerThickness, mZ / 2);
161 TGeoVolume* layerVol =
new TGeoVolume(mLayerName.c_str(),
layer, medAir);
162 layerVol->SetLineColor(kYellow);
166 LOGP(info,
"Inserting {} in {} ", staveVol->GetName(), layerVol->GetName());
167 layerVol->AddNode(staveVol, 1,
nullptr);
170 double width = mModuleWidth;
171 if (mInnerRadius > 25) {
175 int nStaves = (
int)std::ceil(mInnerRadius * 2 * TMath::Pi() /
width);
176 nStaves += nStaves % 2;
179 double theta = 2 * TMath::Pi() / nStaves;
180 double theta1 = std::atan(
width / 2 / mInnerRadius);
181 double st = std::sin(theta);
182 double ct = std::cos(theta);
183 double theta2 = std::atan((mInnerRadius *
st -
width / 2 * ct) / (mInnerRadius * ct +
width / 2 *
st));
184 double overlap = (theta1 - theta2) * mInnerRadius;
185 LOGP(info,
"Creating a layer with {} staves and {} mm overlap", nStaves, overlap * 10);
187 for (
int iStave = 0; iStave < nStaves; iStave++) {
191 TGeoCombiTrans* trans =
new TGeoCombiTrans();
192 double theta = 360. * iStave / nStaves;
193 TGeoRotation* rot =
new TGeoRotation(
"rot", theta + 90 + 3, 0, 0);
194 trans->SetRotation(rot);
195 trans->SetTranslation(mInnerRadius * std::cos(2. * TMath::Pi() * iStave / nStaves), mInnerRadius * std::sin(2 * TMath::Pi() * iStave / nStaves), 0);
197 LOGP(info,
"Inserting {} in {} ", staveVol->GetName(), layerVol->GetName());
198 layerVol->AddNode(staveVol, iStave, trans);
202 double width = mModuleWidth * 2;
203 int nStaves = (
int)std::ceil(mInnerRadius * 2 * TMath::Pi() /
width);
204 nStaves += nStaves % 2;
207 double theta = 2 * TMath::Pi() / nStaves;
208 double theta1 = std::atan(
width / 2 / mInnerRadius);
209 double st = std::sin(theta);
210 double ct = std::cos(theta);
211 double theta2 = std::atan((mInnerRadius *
st -
width / 2 * ct) / (mInnerRadius * ct +
width / 2 *
st));
212 double overlap = (theta1 - theta2) * mInnerRadius;
213 LOGP(info,
"Creating a layer with {} staves and {} mm overlap", nStaves, overlap * 10);
215 for (
int iStave = 0; iStave < nStaves; iStave++) {
219 TGeoCombiTrans* trans =
new TGeoCombiTrans();
220 double theta = 360. * iStave / nStaves;
221 TGeoRotation* rot =
new TGeoRotation(
"rot", theta + 90, 0, 0);
222 trans->SetRotation(rot);
223 trans->SetTranslation(mInnerRadius * std::cos(2. * TMath::Pi() * iStave / nStaves), mInnerRadius * std::sin(2 * TMath::Pi() * iStave / nStaves), 0);
225 LOGP(info,
"Inserting {} in {} ", staveVol->GetName(), layerVol->GetName());
226 layerVol->AddNode(staveVol, iStave, trans);
229 LOGP(fatal,
"Layout not implemented");
231 LOGP(info,
"Inserting {} in {} ", layerVol->GetName(), motherVolume->GetName());
232 motherVolume->AddNode(layerVol, 1,
nullptr);