4 #include "St_base/StMessMgr.h"
5 #include "Sti/Base/Factory.h"
6 #include "Sti/StiPlanarShape.h"
7 #include "Sti/StiCylindricalShape.h"
8 #include "Sti/StiMaterial.h"
9 #include "Sti/StiPlacement.h"
10 #include "Sti/StiDetector.h"
12 #include "Sti/Star/StiStarDetectorBuilder.h"
17 void StiStarDetectorBuilder::buildDetectors(
StMaker&s) {
18 TGeoManager *geo = StiVMCToolKit::GetVMC();
21 LOG_INFO <<
"StiStarDetectorBuilder::buildDetectors() : Done" << endm;
24 void StiStarDetectorBuilder::useVMCGeometry() {
25 _TpcRefSys = (gGeoManager->GetVolume(
"TpcRefSys" )!=0)
26 || (gGeoManager->GetVolume(
"TpcRefSys_1")!=0);
27 TGeoVolume *pipc = gGeoManager->GetVolume(
"PIPC");
29 Warning(
"StiStarDetectorBuilder::useVMCGeometry",
"No PIPC volume\n");
34 _vacuumMaterial = add(
new StiMaterial(
"Vacuum",0., 1., 0., 1e30, 0.) );
35 _gasMat = (add(
new StiMaterial(
"Air",7.3, 14.61, 0.001205, 30420.*0.001205, 7.3*12.e-9)));
36 if (pipc->GetShape()->TestShapeBit(TGeoShape::kGeoTube)) {
41 TGeoVolume *osca = gGeoManager->GetVolume(
"OSCA");
42 if (osca) NewSuppCone();
43 TGeoVolume *fgtm = gGeoManager->GetVolume(
"FGTM");
47 void StiStarDetectorBuilder::OldBeamPipe() {
48 LOG_INFO <<
"StiStarDetectorBuilder::buildDetectors() : Use VMC old beam pipe geometry" << endm;
49 SetCurrentDetectorBuilder(
this);
51 {
"PIPE",
"the STAR beam pipe mother volume",
"HALL_1/CAVE_1/PIPE_%d",
"",
""},
53 {
"PIPC",
"the Central Beam PIPe Volume",
"HALL_1/CAVE_1/PIPE_%d/PIPC_1",
"",
""},
54 {
"PVAC",
"the Vacuum Volume of Be section of pipe",
"HALL_1/CAVE_1/PIPE_%d/PIPC_1/PVAC_1",
"",
""},
55 {
"PIPO",
"Steel pipe from Be to 1st flanges",
"HALL_1/CAVE_1/PIPE_%d/PIPO_1/PVAO_1",
"",
""},
56 {
"PVAO",
"its cavity",
"HALL_1/CAVE_1/PIPE_%d/PIPO_1/PVAO_1",
"",
""},
58 {
"SROD",
"Support rod",
"HALL_1/CAVE_1/SVTT_1/SROD_1-2",
"",
""},
59 {
"SBSP",
"Beampipe support mother",
"HALL_1/CAVE_1/SVTT_1/SBSP_1-2",
"",
""},
62 {
"FGCM",
"FGT nylon and Al ring",
"HALL_1/CAVE_1/FGTM_1",
"",
""},
63 {
"FGTH",
"mother volume for FGT disk",
"HALL_1/CAVE_1/FGTM_1",
"",
""},
64 {
"FGTD",
"mother volume for FGT disk",
"HALL_1/CAVE_1/FGTM_1",
"",
""},
65 {
"FGCN",
"FGT nylon 1st ring",
"HALL_1/CAVE_1/FGTM_1",
"",
""},
66 {
"FGCT",
"FGT inner cooling tube",
"HALL_1/CAVE_1/FGTM_1",
"",
""}
70 for (Int_t i = 1; i < 5; i += 2) {
71 MakePipe(i, &PipeVolumes[i],&PipeVolumes[i+1]);
73 Int_t NoExtraVols =
sizeof(PipeVolumes)/
sizeof(
VolumeMap_t);
74 TString pathT(
"HALL_1/CAVE_1");
76 for (Int_t i = 5; i < NoExtraVols; i++) {
77 gGeoManager->RestoreMasterVolume();
79 gGeoManager->cd(pathT); path = pathT;
80 TGeoNode *nodeT = gGeoManager->GetCurrentNode();
81 if (! nodeT)
continue;
82 StiVMCToolKit::LoopOverNodes(nodeT, path, PipeVolumes[i].name, MakeAverageVolume);
86 void StiStarDetectorBuilder::HftBeamPipe() {
87 LOG_INFO <<
"StiStarDetectorBuilder::buildDetectors() : Use VMC HFT beam pipe geometry" << endm;
88 SetCurrentDetectorBuilder(
this);
134 {
"PALS",
"East aluminium part" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/PIPI_1/PALS_1" ,
"",
""},
135 {
"PBES",
"Berillium part" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/PIPI_1/PBES_1" ,
"",
""},
136 {
"PALI",
"West aluminium part" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/PIPI_1/PALI_1" ,
"",
""},
137 {
"SSCF",
"Stainless Steel conflat flange" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/PIPI_1/SSCF_%d",
"",
""},
140 {
"PALQ",
"East end tube" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/PIPE_1/PALQ_1" ,
"",
""},
141 {
"PALR",
"East transition tube" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/PIPE_1/PALR_1" ,
"",
""},
142 {
"SSCG",
"Stainless Steel conflat flange" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/PIPE_1/SSCG_%d",
"",
""},
143 {
"SSCF",
"Stainless Steel conflat flange" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/PIPE_1/SSCF_1" ,
"",
""},
146 {
"PALJ",
"West transition tube" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/PIPW_1/PALJ_1" ,
"",
""},
147 {
"PALK",
"West end tube" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/PIPW_1/PALK_1" ,
"",
""},
148 {
"SSCG",
"Stainless Steel conflat flange" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/PIPW_1/SSCG_%d",
"",
""},
149 {
"PIPA",
"outer East section" ,
"/HALL_1/CAVE_1/PIPA_1" ,
"",
""},
150 {
"PIPB",
"outer east bellow section" ,
"/HALL_1/CAVE_1/PIPA_1/PIPB_1" ,
"",
""},
151 {
"PVPB",
"vacuum part of bellow" ,
"/HALL_1/CAVE_1/PIPA_1/PIPB_1/PVPB_1" ,
"",
""},
152 {
"PIPC",
"east outset steel section" ,
"/HALL_1/CAVE_1/PIPA_1/PIPC_1" ,
"",
""},
153 {
"PVPC",
"vacuum section" ,
"/HALL_1/CAVE_1/PIPA_1/PIPC_1/PVPC_1" ,
"",
""},
154 {
"PRIS",
"Bellow" ,
"/HALL_1/CAVE_1/PIPA_1/PRIS_1" ,
"",
""},
156 {
"PFLO",
"is the 1nd set of flanges" ,
"/HALL_1/CAVE_1/PIPA_1/PFLO_1" ,
"",
""},
157 {
"PFLT",
"Flanges for bellow section " ,
"/HALL_1/CAVE_1/PIPA_1/PFLT_1" ,
"",
""},
158 {
"PIWA",
"outer West section" ,
"/HALL_1/CAVE_1/PIWA_1" ,
"",
""},
159 {
"PIWB",
"outer West bellow section" ,
"/HALL_1/CAVE_1/PIWA_1/PIWB_1" ,
"",
""},
160 {
"PVWB",
"vacuum part of bellow" ,
"/HALL_1/CAVE_1/PIWA_1/PIWB_1/PVWB_1" ,
"",
""},
161 {
"PIWC",
"east outset steel section" ,
"/HALL_1/CAVE_1/PIWA_1/PIWC_1" ,
"",
""},
162 {
"PVWC",
"vacuum section" ,
"/HALL_1/CAVE_1/PIWA_1/PIWC_1/PVWC_1" ,
"",
""},
163 {
"PRWS",
"West bellow section" ,
"/HALL_1/CAVE_1/PIWA_1/PRWS_1" ,
"",
""},
165 {
"PFLO",
"is the 1nd set of flange" ,
"/HALL_1/CAVE_1/PIWA_1/PFLO_1" ,
"",
""},
166 {
"PFLT",
"Flanges for bellow section" ,
"/HALL_1/CAVE_1/PIWA_1/PFLT_1" ,
"",
""},
169 {
"FGCM",
"FGT nylon and Al ring" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/FGTM_1/FGCM_1" ,
"",
""},
170 {
"FGTD",
"mother volume for FGT disk" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/FGTM_1/FGTD_1" ,
"",
""},
171 {
"FGCN",
"FGT nylon 1st ring" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/FGTM_1/FGCN_1" ,
"",
""},
172 {
"FGCT",
"FGT inner cooling tube" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/FGTM_1/FGCT_1" ,
"",
""}
175 Int_t NVol =
sizeof(PipeVolumes)/
sizeof(
VolumeMap_t);
176 for (Int_t i = 0; i < NVol; i++) {
177 TGeoVolume *pipe = gGeoManager->GetVolume(PipeVolumes[i].name);
179 Warning(
"StiStarDetectorBuilder::useVMCGeometry",
"No %s volume\n",PipeVolumes[i].name);
182 TString pathT(gSystem->DirName(PipeVolumes[i].path));
184 if (pipe->GetShape()->TestShapeBit(TGeoShape::kGeoTube)) {
185 TString pm(PipeVolumes[i].path);
187 if (i < NVol - 1 && PipeVolumes[i+1].name) {
188 pv = pm; pv +=
"/"; pv += PipeVolumes[i+1].name;pv +=
"_1";
190 if (i < NVol - 1 && pv == TString(PipeVolumes[i+1].path)) {
191 MakePipe(0, &PipeVolumes[i],&PipeVolumes[i+1]);
194 gGeoManager->RestoreMasterVolume();
195 gGeoManager->CdTop();
197 pathT.ReplaceAll(
"/TpcRefSys_1",
"");
198 pathT.ReplaceAll(
"/TpcRefSys",
"");
200 gGeoManager->cd(pathT); path = pathT;
201 TGeoNode *nodeT = gGeoManager->GetCurrentNode();
202 if (! nodeT)
continue;
203 StiVMCToolKit::LoopOverNodes(nodeT, path, PipeVolumes[i].name, MakeAverageVolume);
207 if (! pipe->GetShape()->TestShapeBit(TGeoShape::kGeoPcon)) {
208 Warning(
"StiStarDetectorBuilder::useVMCGeometry",
"Shape for %s volume is not recognized\n",PipeVolumes[i].name);
212 TGeoPcon *pcon = (TGeoPcon*) pipe->GetShape();
213 TGeoMaterial *pipeMaterial = pipe->GetMaterial();
214 Double_t PotI = StiVMCToolKit::GetPotI(pipeMaterial);
215 Double_t density = pipeMaterial->GetDensity();
216 _pipeMaterial = add(
new StiMaterial(pipeMaterial->GetName(),
217 pipeMaterial->GetZ(),
218 pipeMaterial->GetA(),
220 density*pipeMaterial->GetRadLen(),
223 Double_t Rmax, Rmin, radius, dZ, Z;
224 Int_t Nz = pcon->GetNz();
226 LOG_INFO << pathT.Data() <<
"\t" << PipeVolumes[i].name << endm;
227 for (Int_t k = 0; k < Nz; k++) {
228 LOG_INFO << k <<
"\tZ\t" << pcon->GetZ(k) <<
"\tRmin\t" << pcon->GetRmin(k) <<
"\tRmax\t" << pcon->GetRmax(k) <<
233 for (Int_t k = 0; k < Nz-1; k++) {
234 dZ = TMath::Abs(pcon->GetZ(k) - pcon->GetZ(k+1))/2;
235 if (dZ < 1e-7)
continue;
236 Z = (pcon->GetZ(k) + pcon->GetZ(k+1))/2;
237 _pipeMaterial2 = _pipeMaterial;
238 if (pcon->GetRmin(k) == pcon->GetRmin(k+1) &&
239 pcon->GetRmax(k) == pcon->GetRmax(k+1)) {
240 Rmax = pcon->GetRmax(k);
241 Rmin = pcon->GetRmin(k);
242 radius = (Rmin + Rmax)/2;
244 Rmax = TMath::Max(pcon->GetRmax(k),pcon->GetRmax(k+1));
245 Rmin = TMath::Min(pcon->GetRmin(k),pcon->GetRmin(k+1));
246 Double_t scale = (pcon->GetRmax(k+1)*pcon->GetRmax(k+1) - pcon->GetRmin(k+1)*pcon->GetRmin(k+1) +
247 pcon->GetRmax(k )*pcon->GetRmax(k ) - pcon->GetRmin(k )*pcon->GetRmin(k ))/
248 (Rmax*Rmax - Rmin*Rmin);
249 Double_t dens = density*scale;
250 _pipeMaterial2 = add(
new StiMaterial(pipeMaterial->GetName(),
251 pipeMaterial->GetZ(),
252 pipeMaterial->GetA(),
254 density*pipeMaterial->GetRadLen(),
257 radius = (Rmin + Rmax)/2;
259 TString comment(PipeVolumes[i].comment,15);
260 _beamPipeShape->
setName(comment.Data());
261 _beamPipeShape->setThickness(Rmax-Rmin);
262 _beamPipeShape->setHalfDepth( dZ );
263 _beamPipeShape->setOpeningAngle( TMath::TwoPi() );
264 _beamPipeShape->setOuterRadius(Rmax);
269 p->setLayerRadius(radius);
271 p->setNormalRep(0, radius, 0.);
272 p->setRegion(StiPlacement::kMidRapidity);
273 TString nameP = PipeVolumes[i].name; nameP +=
"#"; section++; nameP += section;
274 nameP.ReplaceAll(
"HALL_1/CAVE_1/",
"");
275 nameP.ReplaceAll(
"/TpcRefSys_1",
"");
276 nameP.ReplaceAll(
"/TpcRefSys",
"");
277 nameP.ReplaceAll(
"/IDSM_1",
"");
278 nameP.Resize(30); nameP.Strip();
280 pipeVolume->
setName(nameP.Data());
281 pipeVolume->setIsOn(
true);
283 pipeVolume->setIsContinuousMedium(
false);
284 pipeVolume->setIsDiscreteScatterer(
true);
285 pipeVolume->setShape(_beamPipeShape);
286 pipeVolume->setPlacement(p);
287 pipeVolume->setGas(_vacuumMaterial);
288 pipeVolume->setMaterial(_pipeMaterial2);
289 Int_t layer = getNRows();
290 add(layer,0,pipeVolume);
295 void StiStarDetectorBuilder::NewSuppCone() {
296 LOG_INFO <<
"StiStarDetectorBuilder::buildDetectors() : Use VMC Support Cone geometry" << endm;
297 SetCurrentDetectorBuilder(
this);
300 {
"OSCA",
"central CFiber tube" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/OSCA_1" ,
"",
""},
301 {
"SUCB",
"small Alu ring" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/SUCB_%d",
"",
""},
302 {
"SUCC",
"CFiber cone section" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/SUCC_%d",
"",
""},
303 {
"SUCD",
"large Al ring at cone" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/SUCD_%d",
"",
""},
304 {
"SUCE",
"CFiber tube" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/SUCE_%d",
"",
""},
305 {
"SUCF",
"large Alu ring" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/SUCF_%d",
"",
""},
306 {
"SUCG",
"large Alu end disk" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/SUCG_%d",
"",
""},
307 {
"FGRL",
"FGT rail" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/FGRL_%d",
"",
""},
309 {
"EFSA",
"Electrostatic shroud" ,
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/EFSA_%d",
"",
""}
311 Int_t NVol =
sizeof(PipeVolumes)/
sizeof(
VolumeMap_t);
312 TString pathT(
"HALL_1/CAVE_1");
314 for (Int_t i = 0; i < NVol; i++) {
315 gGeoManager->RestoreMasterVolume();
316 gGeoManager->CdTop();
318 pathT.ReplaceAll(
"/TpcRefSys_1",
"");
319 pathT.ReplaceAll(
"/TpcRefSys" ,
"");
321 gGeoManager->cd(pathT); path = pathT;
322 TGeoNode *nodeT = gGeoManager->GetCurrentNode();
323 if (! nodeT)
continue;
324 StiVMCToolKit::LoopOverNodes(nodeT, path, PipeVolumes[i].name, MakeAverageVolume);
330 if (! ptube || ! pvacu)
return;
331 TGeoVolume *pipe = gGeoManager->GetVolume(ptube->name);
333 Warning(
"StiStarDetectorBuilder::useVMCGeometry",
"No %s volume\n",ptube->name);
337 TGeoMaterial *pipeMaterial = pipe->GetMaterial();
338 Double_t PotI = StiVMCToolKit::GetPotI(pipeMaterial);
339 _pipeMaterial = add(
new StiMaterial(pipeMaterial->GetName(),
340 pipeMaterial->GetZ(),
341 pipeMaterial->GetA(),
342 pipeMaterial->GetDensity(),
343 pipeMaterial->GetDensity()*pipeMaterial->GetRadLen(),
345 TGeoTube *pipeShape = (TGeoTube *) pipe->GetShape();
346 Double_t Rmax = pipeShape->GetRmax();
347 Double_t Rmin = pipeShape->GetRmin();
348 Double_t dZ = pipeShape->GetDz();
349 if (Rmin < 1e-3 && pvacu->name) {
350 TGeoVolume *vac = gGeoManager->GetVolume(pvacu->name);
352 Warning(
"StiStarDetectorBuilder::useVMCGeometry",
"No %s volume\n",pvacu->name);
356 TGeoTube *vacShape = (TGeoTube *) vac->GetShape();
357 Rmin = vacShape->GetRmax();
359 Double_t radius = (Rmin + Rmax)/2;
362 TString comment(ptube->comment,15);
363 _beamPipeShape->
setName(comment.Data());
364 _beamPipeShape->setThickness(Rmax-Rmin);
365 if (iflag == 1) _beamPipeShape->setHalfDepth( 2*dZ );
366 else _beamPipeShape->setHalfDepth( dZ );
367 _beamPipeShape->setOpeningAngle( TMath::TwoPi() );
368 _beamPipeShape->setOuterRadius(Rmax);
370 for (Int_t j = 0; j < 2; j++) {
371 if (iflag <= 1 && j == 1)
continue;
373 TString pathT = ptube->path;
374 if (pathT.Contains(
"%d")) pathT = Form(ptube->path,j+1);
375 TGeoPhysicalNode *nodeP = gGeoManager->MakePhysicalNode(pathT);
376 if (! nodeP)
continue;
377 if (iflag == 1) p->setZcenter(0);
379 TGeoHMatrix *hmat = nodeP->GetMatrix();
380 Double_t *xyz = hmat->GetTranslation();
381 p->setZcenter(xyz[2]);
383 p->setLayerRadius(radius);
385 p->setNormalRep(0, radius, 0.);
386 p->setRegion(StiPlacement::kMidRapidity);
388 TString nameP = pathT.Data();
389 nameP.ReplaceAll(
"HALL_1/CAVE_1/",
"");
390 nameP.ReplaceAll(
"/TpcRefSys_1",
"");
391 nameP.ReplaceAll(
"/TpcRefSys",
"");
392 nameP.ReplaceAll(
"/IDSM",
"");
393 nameP.Resize(30); nameP.Strip();
394 pipeVolume->
setName(nameP.Data());
395 pipeVolume->setIsOn(
true);
397 pipeVolume->setIsContinuousMedium(
false);
398 pipeVolume->setIsDiscreteScatterer(
true);
399 pipeVolume->setShape(_beamPipeShape);
400 pipeVolume->setPlacement(p);
401 pipeVolume->setGas(_vacuumMaterial);
402 pipeVolume->setMaterial(_pipeMaterial);
403 Int_t layer = getNRows();
404 add(layer,0,pipeVolume);
408 void StiStarDetectorBuilder::Fgt() {
409 LOG_INFO <<
"StiStarDetectorBuilder::buildDetectors() : Use VMC old beam pipe geometry" << endm;
410 SetCurrentDetectorBuilder(
this);
413 {
"FGCM",
"FGT nylon and Al ring",
"HALL_1/CAVE_1/FGTM_1",
"",
""},
414 {
"FGTH",
"mother volume for FGT disk",
"HALL_1/CAVE_1/FGTM_1",
"",
""},
415 {
"FGTD",
"mother volume for FGT disk",
"HALL_1/CAVE_1/FGTM_1",
"",
""},
416 {
"FGCN",
"FGT nylon 1st ring",
"HALL_1/CAVE_1/FGTM_1",
"",
""},
417 {
"FGCT",
"FGT inner cooling tube",
"HALL_1/CAVE_1/FGTM_1",
"",
""}
419 Int_t NoExtraVols =
sizeof(FgtVolumes)/
sizeof(
VolumeMap_t);
420 TString pathT(
"HALL_1/CAVE_1");
422 for (Int_t i = 0; i < NoExtraVols; i++) {
423 gGeoManager->RestoreMasterVolume();
424 gGeoManager->CdTop();
425 gGeoManager->cd(pathT); path = pathT;
426 TGeoNode *nodeT = gGeoManager->GetCurrentNode();
427 if (! nodeT)
continue;
428 StiVMCToolKit::LoopOverNodes(nodeT, path, FgtVolumes[i].name, MakeAverageVolume);
virtual Abstract * getInstance()=0
Get a pointer to instance of objects served by this factory.
void setName(const string &newName)
Set the name of the object.
Class implements an object which is never active.