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, mChipThickness / 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 TGeoTube*
layer =
new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2);
157 TGeoVolume* layerVol =
new TGeoVolume(mLayerName.c_str(),
layer, medAir);
158 layerVol->SetLineColor(kYellow);
162 LOGP(info,
"Inserting {} in {} ", staveVol->GetName(), layerVol->GetName());
163 layerVol->AddNode(staveVol, 1,
nullptr);
166 double width = mModuleWidth;
167 if (mInnerRadius > 25) {
171 int nStaves = (
int)std::ceil(mInnerRadius * 2 * TMath::Pi() /
width);
172 nStaves += nStaves % 2;
175 double theta = 2 * TMath::Pi() / nStaves;
176 double theta1 = std::atan(
width / 2 / mInnerRadius);
177 double st = std::sin(theta);
178 double ct = std::cos(theta);
179 double theta2 = std::atan((mInnerRadius *
st -
width / 2 * ct) / (mInnerRadius * ct +
width / 2 *
st));
180 double overlap = (theta1 - theta2) * mInnerRadius;
181 LOGP(info,
"Creating a layer with {} staves and {} mm overlap", nStaves, overlap * 10);
183 for (
int iStave = 0; iStave < nStaves; iStave++) {
187 TGeoCombiTrans* trans =
new TGeoCombiTrans();
188 double theta = 360. * iStave / nStaves;
189 TGeoRotation* rot =
new TGeoRotation(
"rot", theta + 90 + 3, 0, 0);
190 trans->SetRotation(rot);
191 trans->SetTranslation(mInnerRadius * std::cos(2. * TMath::Pi() * iStave / nStaves), mInnerRadius * std::sin(2 * TMath::Pi() * iStave / nStaves), 0);
193 LOGP(info,
"Inserting {} in {} ", staveVol->GetName(), layerVol->GetName());
194 layerVol->AddNode(staveVol, iStave, trans);
198 double width = mModuleWidth * 2;
199 int nStaves = (
int)std::ceil(mInnerRadius * 2 * TMath::Pi() /
width);
200 nStaves += nStaves % 2;
203 double theta = 2 * TMath::Pi() / nStaves;
204 double theta1 = std::atan(
width / 2 / mInnerRadius);
205 double st = std::sin(theta);
206 double ct = std::cos(theta);
207 double theta2 = std::atan((mInnerRadius *
st -
width / 2 * ct) / (mInnerRadius * ct +
width / 2 *
st));
208 double overlap = (theta1 - theta2) * mInnerRadius;
209 LOGP(info,
"Creating a layer with {} staves and {} mm overlap", nStaves, overlap * 10);
211 for (
int iStave = 0; iStave < nStaves; iStave++) {
215 TGeoCombiTrans* trans =
new TGeoCombiTrans();
216 double theta = 360. * iStave / nStaves;
217 TGeoRotation* rot =
new TGeoRotation(
"rot", theta + 90, 0, 0);
218 trans->SetRotation(rot);
219 trans->SetTranslation(mInnerRadius * std::cos(2. * TMath::Pi() * iStave / nStaves), mInnerRadius * std::sin(2 * TMath::Pi() * iStave / nStaves), 0);
221 LOGP(info,
"Inserting {} in {} ", staveVol->GetName(), layerVol->GetName());
222 layerVol->AddNode(staveVol, iStave, trans);
225 LOGP(fatal,
"Layout not implemented");
227 LOGP(info,
"Inserting {} in {} ", layerVol->GetName(), motherVolume->GetName());
228 motherVolume->AddNode(layerVol, 1,
nullptr);