6 #include "StThreeVectorD.hh"
8 #include "Sti/Base/Factory.h"
9 #include "Sti/StiPlanarShape.h"
10 #include "Sti/StiCylindricalShape.h"
11 #include "Sti/StiMaterial.h"
12 #include "Sti/StiPlacement.h"
13 #include "Sti/StiDetector.h"
17 #include "StiIst/StiIstIsActiveFunctor.h"
18 #include "StiIst/StiIstDetectorBuilder1.h"
19 #include "TDataSetIter.h"
20 #include "THashList.h"
22 #include "tables/St_HitError_Table.h"
23 #include "StEvent/StEvent.h"
25 #include "StEvent/StEventTypes.h"
26 #include "StDetectorDbMaker/StiIst1HitErrorCalculator.h"
27 #include "StIstDbMaker/StIstDb.h"
28 #include "StIstUtil/StIstConsts.h"
29 #include "StBFChain/StBFChain.h"
32 using namespace StIstConsts;
35 StiIstDetectorBuilder1::StiIstDetectorBuilder1(
bool active,
bool buildIdealGeom) :
50 {
"IHTC",
"Top Kapton hybrid east box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
51 {
"IHTH",
"Top Kapton hybrid west box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
52 {
"IHBC",
"Bottom Kapton hybrid east volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
53 {
"IHBH",
"Bottom Kapton hybrid west volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
55 {
"ICFC",
"carbon foam east box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
56 {
"ICFD",
"carbon foam west box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
57 {
"ICCU",
"CFRPMix honeycomb east box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
58 {
"ICCD",
"CFRPMix honeycomb west box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
59 {
"ISTC",
"top carbon fiber skin east box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
60 {
"ISTH",
"top carbon fiber skin west box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
61 {
"ISBC",
"bottom carbon fiber skin east box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
62 {
"ISBH",
"bottom carbon fiber skin west box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
63 {
"IECE",
"east aluminum end-cap box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
64 {
"IECW",
"west PEEK CF 30 end-cap box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
65 {
"ICTC",
"middle aluminum cooling tube volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
66 {
"ICTE",
"middle aluminum cooling tube east cone volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
67 {
"ICTW",
"middle aluminum cooling tube west cone volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
68 {
"IBCW",
"middle Novec 7200 cooling liquid volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
69 {
"IBRB",
"G10 T-board box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
70 {
"IRSA",
"Delrin T-board slot A box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
71 {
"IRSB",
"Delrin T-board slot B box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
72 {
"IRSC",
"Delrin T-board slot C box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
73 {
"IBTS",
"Slicon thermal sensor box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
74 {
"IBAP",
"inactive silicon volume APV chips",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
75 {
"ISCA",
"east short cable A volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
76 {
"ISCB",
"east short cable B volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
77 {
"ISCC",
"east short cable C volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
78 {
"ICLE",
"east short tube liquid volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
79 {
"ICTJ",
"east short cooling tube joint volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
80 {
"ICTA",
"east short cooling tube connector volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
81 {
"ICTB",
"east short cooling tube right volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
82 {
"ICJS",
"west cooling loop left tube volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
83 {
"ICJA",
"west cooling loop left cone volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
84 {
"ICJU",
"west cooling loop left connector volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
85 {
"ICLN",
"west cooling loop right liquid volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
86 {
"ISRR",
"PEEK CF 30 support block south side sub-volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
87 {
"ISRB",
"PEEK CF 30 support block north side sub-volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
88 {
"ISRL",
"PEEK CF 30 support block trapezoid sub-volume volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
89 {
"ISRO",
"PEEK CF 30 support block top-right volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
90 {
"ISRC",
"PEEK CF 30 support block trapezoid volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
91 {
"ISRS",
"PEEK CF 30 support block small box volume",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1",
"",
""},
92 {
"ICCT",
"Cooling line and cablings in transition area",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1" ,
"",
""},
93 {
"ICCA",
"Copper cablings on PIT",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1" ,
"",
""},
94 {
"ICCL",
"Al cooling lines on PIT",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1" ,
"",
""},
95 {
"ICLP",
"Liquid coolant on PIT",
"HALL_1/CAVE_1/TpcRefSys_1/IDSM_1" ,
"",
""}
99 Int_t nVolumes =
sizeof(volumes) /
sizeof(
VolumeMap_t);
100 gGeoManager->RestoreMasterVolume();
101 gGeoManager->CdTop();
106 for (Int_t i = 0; i < nVolumes; i++) {
108 if ( !gGeoManager->cd(volumes[i].path) ) {
109 Warning(
"buildInactiveVolumes()",
"Cannot find path to %s node. Skipping to next node...", volumes[i].name);
113 TGeoNode *geoNode = gGeoManager->GetCurrentNode();
115 if (!geoNode)
continue;
117 LOG_DEBUG <<
"Current node : " << i <<
"/" << nVolumes <<
" path is : " << volumes[i].name << endm;
118 LOG_DEBUG <<
"Number of daughters : " << geoNode->GetNdaughters() <<
" weight : " << geoNode->GetVolume()->Weight() << endm;
120 StiVMCToolKit::LoopOverNodes(geoNode, volumes[i].path, volumes[i].name, MakeAverageVolume);
121 TGeoVolume *gvolu = gGeoManager->FindVolumeFast(volumes[i].name);
124 int row = getNRows() - 1;
128 StiDetector *stiDetector = getDetector(row, sector);
136 TString ts,dir;
int idx;
137 if (std::string(volumes[i].name) == std::string(
"ICFC")) {
141 row = startRow + iICFC;
142 stiDetector = getDetector(row, sector);
143 assert(strstr(stiDetector->
getName().c_str(),
"/ICFC_"));
145 dir = stiDetector->
getName().c_str();idx = dir.Last(
'/'); assert(idx>=0); dir.Remove(idx+1,999);
148 StiPlacement *stiPlacementICFC = stiDetector->getPlacement();
152 ts = dir; ts +=
"ICFCn";
153 buildPlanerVolume(*stiDetectorN, ts.Data(), 8.825 * 0.5, 0.5663, 1.25 * 0.5, 0.625, 0., 0., stiPlacementICFC, matICFC);
155 add(row, sector, stiDetectorN);
156 LOG_DEBUG <<
"StiIstDetectorBuilder1::build planar volume for ICFC north side " << stiDetectorN->
getName() <<
" at layer " << row << endm;
160 ts = dir; ts +=
"ICFCb.";
161 buildPlanerVolume(*stiDetectorB, ts.Data(), 8.825 * 0.5, 0.042775, 0.47625 * 0.5, -0.238125, -0.2617625, 0., stiPlacementICFC, matICFC);
162 int layer = getNRows();
163 add(layer, sector, stiDetectorB);
164 LOG_DEBUG <<
"StiIstDetectorBuilder1::build planar volume for ICFC bottom side " << stiDetectorB->
getName() <<
" at layer " << layer << endm;
168 ts = dir;; ts +=
"ICFCs";
169 buildPlanerVolume(*stiDetectorS, ts.Data(), 8.825 * 0.5, 0.5663, 0.77375 * 0.5, -0.863125, 0., 0., stiPlacementICFC, matICFC);
171 add(layer, sector, stiDetectorS);
172 LOG_DEBUG <<
"StiIstDetectorBuilder1::build planar volume for ICFC south side " << stiDetectorS->
getName() <<
" at layer " << layer << endm;
177 if (std::string(volumes[i].name) == std::string(
"ICFD")) {
181 row = startRow + iICFD;
182 stiDetector = getDetector(row, sector);
183 assert(strstr(stiDetector->
getName().c_str(),
"/ICFD_"));
185 dir = stiDetector->
getName().c_str();idx = dir.Last(
'/'); assert(idx>=0); dir.Remove(idx+1,999);
188 StiPlacement *stiPlacementICFD = stiDetector->getPlacement();
192 ts = dir; ts+=
"ICFDn";
193 buildPlanerVolume(*stiDetectorN, ts.Data(), 47.055 * 0.5, 0.58, 1.25 * 0.5, 0.625, 0., 0., stiPlacementICFD, matICFD);
195 add(row, sector, stiDetectorN);
196 LOG_DEBUG <<
"StiIstDetectorBuilder1::build planar volume for ICFD north side " << stiDetectorN->
getName() <<
" at layer " << row << endm;
200 ts = dir; ts+=
"ICFDb";
201 buildPlanerVolume(*stiDetectorB, ts.Data(), 47.055 * 0.5, 0.049675, 0.47625 * 0.5, -0.238125, -0.2651625, 0., stiPlacementICFD, matICFD);
202 int layer = getNRows();
203 add(layer, sector, stiDetectorB);
204 LOG_DEBUG <<
"StiIstDetectorBuilder1::build planar volume for ICFD bottom side " << stiDetectorB->
getName() <<
" at layer " << layer << endm;
209 buildPlanerVolume(*stiDetectorS, ts.Data(), 47.055 * 0.5, 0.58, 0.77375 * 0.5, -0.863125, 0., 0., stiPlacementICFD, matICFD);
211 add(layer, sector, stiDetectorS);
212 LOG_DEBUG <<
"StiIstDetectorBuilder1::build planar volume for ICFD south side " << stiDetectorS->
getName() <<
" at layer " << layer << endm;
217 if (std::string(volumes[i].name) == std::string(
"IECE")) {
221 row = startRow + iIECE;
222 stiDetector = getDetector(row, sector);
223 assert(strstr(stiDetector->
getName().c_str(),
"/IECE_"));
225 dir = stiDetector->
getName().c_str();idx = dir.Last(
'/'); assert(idx>=0); dir.Remove(idx+1,999);
229 StiPlacement *stiPlacementIECE = stiDetector->getPlacement();
233 ts = dir; ts +=
"IECEn";
234 buildPlanerVolume(*stiDetectorN, ts.Data(), 2.25 * 0.5, 0.5413, 1.23485 * 0.5, 2.4326, 0., 0., stiPlacementIECE, matIECE);
236 add(row, sector, stiDetectorN);
237 LOG_DEBUG <<
"StiIstDetectorBuilder1::build planar volume for IECE north side " << stiDetectorN->
getName() <<
" at layer " << row << endm;
241 ts = dir; ts +=
"IECEb";
242 buildPlanerVolume(*stiDetectorB, ts.Data(), 2.25 * 0.5, 0.0193, 0.5065 * 0.5, 1.5619, -0.261, 0., stiPlacementIECE, matIECE);
243 int layer = getNRows();
244 add(layer, sector, stiDetectorB);
245 LOG_DEBUG <<
"StiIstDetectorBuilder1::build planar volume for IECE bottom side " << stiDetectorB->
getName() <<
" at layer " << layer << endm;
249 ts = dir; ts +=
"IECEs";
250 buildPlanerVolume(*stiDetectorS, ts.Data(), 2.25 * 0.5, 0.5413, 4.35865 * 0.5, -0.870675, 0., 0., stiPlacementIECE, matIECE);
252 add(layer, sector, stiDetectorS);
253 LOG_DEBUG <<
"StiIstDetectorBuilder1::build planar volume for IECE south side " << stiDetectorS->
getName() <<
" at layer " << layer << endm;
258 if (std::string(volumes[i].name) == std::string(
"IECW")) {
262 row = startRow + iIECW;
263 stiDetector = getDetector(row, sector);
264 assert(strstr(stiDetector->
getName().c_str(),
"/IECW_"));
266 dir = stiDetector->
getName().c_str();idx = dir.Last(
'/'); assert(idx>=0); dir.Remove(idx+1,999);
270 StiPlacement *stiPlacementIECW = stiDetector->getPlacement();
274 ts = dir; ts +=
"IECWn";
275 buildPlanerVolume(*stiDetectorN, ts.Data(), 2.25 * 0.5, 0.555, 1.23485 * 0.5, 2.4326, 0., 0., stiPlacementIECW, matIECW);
277 add(row, sector, stiDetectorN);
278 LOG_DEBUG <<
"StiIstDetectorBuilder1::build planar volume for IECW north side " << stiDetectorN->
getName() <<
" at layer " << row << endm;
283 ts = dir; ts +=
"IECWb";
284 buildPlanerVolume(*stiDetectorB, ts.Data(), 2.25 * 0.5, 0.01925, 0.5065 * 0.5, 1.5619, -0.267875, 0., stiPlacementIECW, matIECW);
285 int layer = getNRows();
286 add(layer, sector, stiDetectorB);
287 LOG_DEBUG <<
"StiIstDetectorBuilder1::build planar volume for IECW bottom side " << stiDetectorB->
getName() <<
" at layer " << layer << endm;
291 ts = dir; ts +=
"IECWs";
292 buildPlanerVolume(*stiDetectorS, ts.Data(), 2.25 * 0.5, 0.555, 4.35865 * 0.5, -0.870675, 0., 0., stiPlacementIECW, matIECW);
294 add(layer, sector, stiDetectorS);
295 LOG_DEBUG <<
"StiIstDetectorBuilder1::build planar volume for IECW south side " << stiDetectorS->
getName() <<
" at layer " << layer << endm;
300 if (std::string(volumes[i].name) == std::string(
"ICJS")) {
304 row = startRow + iICJS;
305 stiDetector = getDetector(row, sector);
306 assert(strstr(stiDetector->
getName().c_str(),
"/ICJS_"));
308 dir = stiDetector->
getName().c_str();idx = dir.Last(
'/'); assert(idx>=0); dir.Remove(idx+1,999);
311 StiPlacement *stiPlacementICJS1 = stiDetector->getPlacement();
313 stiDetector = getDetector(row + 1, sector);
315 StiPlacement *stiPlacementICJS2 = stiDetector->getPlacement();
318 ts = dir; ts +=
"ICJRn."; ts+=iICJS ;
319 buildPlanerVolume(*stiDetectorICJR, ts.Data(), 0.524188 * 0.5, 0.47625, 4.41625 * 0.5, stiPlacementICJS2->getNormalYoffset(), 0., 0.524188 * 0.5 + 6.35 * 0.5, stiPlacementICJS1, matICJS);
320 int layer = getNRows();
321 add(layer, sector, stiDetectorICJR);
322 LOG_DEBUG <<
"StiIstDetectorBuilder1::build west cooling loop volume " << stiDetectorICJR->
getName() <<
" at layer " << layer << endm;
328 if (std::string(volumes[i].name) == std::string(
"ICCT")) {
329 assert(strstr(stiDetector->
getName().c_str(),
"/ICCT_"));
331 stiShape->setOuterRadius(20.28725);
335 if (std::string(volumes[i].name) == std::string(
"ISRR")) {
336 assert(strstr(stiDetector->
getName().c_str(),
"/ISRR_"));
338 matISRA = stiDetector->getMaterial();
345 float halfDepth = 0.5 * 1.27;
346 float thickness = 0.15;
347 float outerRadius = 12.0753;
348 float openingAngle = 2 * M_PI;
352 buildTubeVolume(*stiDetectorISRAeast,
"ISRAeast", halfDepth, thickness, outerRadius, openingAngle, -34.19005 + 0.15875, matISRA);
353 int layer = getNRows();
354 add(layer, 0, stiDetectorISRAeast);
355 LOG_DEBUG <<
"StiIstDetectorBuilder1::build east support block thin tube volume " << stiDetectorISRAeast->
getName() <<
" at layer " << layer << endm;
359 buildTubeVolume(*stiDetectorISRAwest,
"ISRAwest", halfDepth, thickness, outerRadius, openingAngle, 24.68995 + 0.15875, matISRA);
361 add(layer, 0, stiDetectorISRAwest);
362 LOG_DEBUG <<
"StiIstDetectorBuilder1::build west support block thin tube volume " << stiDetectorISRAwest->
getName() <<
" at layer " << layer << endm;
370 void StiIstDetectorBuilder1::buildPlanerVolume(
StiDetector &detector, std::string detName,
float halfDepth,
float thickness,
float halfWidth,
float yShift,
float rShift,
float zShift,
StiPlacement *placement,
StiMaterial *mat)
373 std::string shapeName = detName +
"_planar";
378 float yOffset = placement->getNormalYoffset() + yShift;
379 float normalRadius = placement->getNormalRadius() + rShift;
381 stiPlacementN->setZcenter(placement->getZcenter() + zShift);
382 stiPlacementN->setLayerRadius(sqrt(yOffset * yOffset + normalRadius * normalRadius));
383 stiPlacementN->setLayerAngle(placement->getNormalRefAngle() - atan2(yOffset, normalRadius));
384 stiPlacementN->setRegion(StiPlacement::kMidRapidity);
385 stiPlacementN->setNormalRep(placement->getNormalRefAngle(), normalRadius, yOffset);
388 detector.
setName(detName.data());
390 detector.setShape(stiShapeN);
391 detector.setPlacement(stiPlacementN);
392 detector.setGas(getGasMat());
393 detector.setMaterial(mat);
397 void StiIstDetectorBuilder1::buildTubeVolume(
StiDetector &detector, std::string detName,
float halfDepth,
float thickness,
float outerRadius,
float openingAngle,
float zCenter,
StiMaterial *mat)
400 std::string shapeName = detName +
"_tube";
406 stiPlacementN->setZcenter(zCenter);
407 stiPlacementN->setLayerRadius(outerRadius - thickness / 2);
408 stiPlacementN->setLayerAngle(0);
409 stiPlacementN->setRegion(StiPlacement::kMidRapidity);
410 stiPlacementN->setNormalRep(0, outerRadius - thickness / 2, 0);
413 detector.
setName(detName.data());
415 detector.setShape(stiShapeN);
416 detector.setPlacement(stiPlacementN);
417 detector.setGas(getGasMat());
418 detector.setMaterial(mat);
const int kIstNumLadders
24 IST Ladders
virtual void buildInactiveVolumes()
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.
const string & getName() const
Get the name of the object.
Class implements an object which is never active.