G4double maxLength = 2*trackerLength, maxTime = 0.1*ns, minEkin = 10*MeV; trackerLV->SetUserLimits(new G4UserLimits(maxStep,
maxLength,
maxTime,
minEkin));
117{
118 G4Material* air = G4Material::GetMaterial(
"G4_AIR");
119
120
121
122 G4double chamberSpacing = 80*cm;
123
124 G4double chamberWidth = 20.0*cm;
125 G4double targetLength = 5.0*cm;
126
128
129 G4double worldLength = 1.2 * (2*targetLength + trackerLength);
130
131 G4double targetRadius = 0.5*targetLength;
132 targetLength = 0.5*targetLength;
133 G4double trackerSize = 0.5*trackerLength;
134
135
136
137
138
139 G4GeometryManager::GetInstance()->SetWorldMaximumExtent(worldLength);
140
141 G4cout << "Computed tolerance = "
142 << G4GeometryTolerance::GetInstance()->GetSurfaceTolerance()/mm
143 << " mm" << G4endl;
144
145 auto worldS =
new G4Box(
"world",
146 worldLength / 2, worldLength / 2, worldLength / 2);
148 air,
149 "World");
150
151
152
154 G4ThreeVector(),
155 worldLV,
156 "World",
157 nullptr,
158 false,
159 0,
161
162
163
164 G4ThreeVector positionTarget = G4ThreeVector(0,0,-(targetLength+trackerSize));
165
166 auto targetS =
new G4Tubs(
"target", 0., targetRadius, targetLength, 0. * deg, 360. * deg);
169 positionTarget,
171 "Target",
172 worldLV,
173 false,
174 0,
176
177 G4cout << "Target is " << 2*targetLength/cm << " cm of "
179
180
181
182 G4ThreeVector positionTracker = G4ThreeVector(0,0,0);
183
184 auto trackerS =
new G4Tubs(
"tracker", 0, trackerSize, trackerSize, 0. * deg, 360. * deg);
185 auto trackerLV =
new G4LogicalVolume(trackerS, air,
"Tracker",
nullptr,
nullptr,
nullptr);
187 positionTracker,
188 trackerLV,
189 "Tracker",
190 worldLV,
191 false,
192 0,
194
195
196
199
200 worldLV ->SetVisAttributes(boxVisAtt);
202 trackerLV ->SetVisAttributes(boxVisAtt);
203
204
205
206 G4cout <<
"There are " <<
fNbOfChambers <<
" chambers in the tracker region. "
207 << G4endl
208 << "The chambers are " << chamberWidth/cm << " cm of "
210 << "The distance between chamber is " << chamberSpacing/cm << " cm"
211 << G4endl;
212
213 G4double firstPosition = -trackerSize + chamberSpacing;
214 G4double firstLength = trackerLength/10;
215 G4double lastLength = trackerLength;
216
217 G4double halfWidth = 0.5*chamberWidth;
218 G4double rmaxFirst = 0.5 * firstLength;
219
220 G4double rmaxIncr = 0.0;
223 if (chamberSpacing < chamberWidth) {
224 G4Exception("DetectorConstruction::DefineVolumes()",
225 "InvalidSetup", FatalException,
226 "Width>Spacing");
227 }
228 }
229
231
232 G4double Zposition = firstPosition + copyNo * chamberSpacing;
233 G4double rmax = rmaxFirst + copyNo * rmaxIncr;
234
235 auto chamberS =
new G4Tubs(
"Chamber_solid", 0, rmax, halfWidth, 0. * deg, 360. * deg);
236
239
241
243 G4ThreeVector(0, 0, Zposition),
245 "Chamber_PV",
246 trackerLV,
247 false,
248 copyNo,
250 }
251
252
253
254
255
256
257
258
259 G4double maxStep = 0.5*chamberWidth;
262
263
264
265
266
267
268
269
270
271
272
273 return worldPV;
274}