StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StiIstDetectorBuilder1.cxx
1 #include <assert.h>
2 #include <sstream>
3 #include <string>
4 
5 #include "StMessMgr.h"
6 #include "StThreeVectorD.hh"
7 
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"
14 #include "Sti/StiToolkit.h"
15 #include "Sti/StiIsActiveFunctor.h"
17 #include "StiIst/StiIstIsActiveFunctor.h"
18 #include "StiIst/StiIstDetectorBuilder1.h"
19 #include "TDataSetIter.h"
20 #include "THashList.h"
21 #include "TString.h"
22 #include "tables/St_HitError_Table.h"
23 #include "StEvent/StEvent.h"
24 #include "StEvent/StEnumerations.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"
30 
31 
32 using namespace StIstConsts;
33 
34 
35 StiIstDetectorBuilder1::StiIstDetectorBuilder1(bool active, bool buildIdealGeom) :
36  StiIstDetectorBuilder(active, buildIdealGeom)
37 {
38 }
39 
40 
47 {
48  // Build average inactive volumes
49  const VolumeMap_t volumes[] = {
50  {"IHTC", "Top Kapton hybrid east box volume", "HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1", "", ""}, //kapton hybrid
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", "", ""},
54  //{"IBHC", "North Kapton hybrid edge tub 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", "", ""}, //carbon foam
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", "", ""}, //carbon honeycomb
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", "", ""}, //top carbon skin
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", "", ""}, //bottom carbon skin
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", "", ""}, //east AL end-cap
64  {"IECW", "west PEEK CF 30 end-cap box volume", "HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1", "", ""}, //west carbon end-cap
65  {"ICTC", "middle aluminum cooling tube volume", "HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1", "", ""}, //middle cooling tube
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", "", ""}, //liquid coolant
69  {"IBRB", "G10 T-board box volume", "HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1", "", ""}, //T-Board
70  {"IRSA", "Delrin T-board slot A box volume", "HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1", "", ""}, //connectors
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", "", ""}, //thermal sensor
74  {"IBAP", "inactive silicon volume APV chips", "HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1", "", ""}, //APV chips
75  {"ISCA", "east short cable A volume", "HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1", "", ""}, //east short cables
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", "", ""}, //east liquid coolant
79  {"ICTJ", "east short cooling tube joint volume", "HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1", "", ""}, //east cooling tube joint volume
80  {"ICTA", "east short cooling tube connector volume", "HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1", "", ""}, //east cooling tube connector volume
81  {"ICTB", "east short cooling tube right volume", "HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1", "", ""}, //east cooling tube right volume
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", "", ""}, //support block
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" , "", ""}
96  };
97 
98  // Build the volume map and loop over all found volumes
99  Int_t nVolumes = sizeof(volumes) / sizeof(VolumeMap_t);
100  gGeoManager->RestoreMasterVolume();
101  gGeoManager->CdTop();
102 
103  // material for support block inner thin tube volume (ISRA)
104  StiMaterial *matISRA = NULL;
105 
106  for (Int_t i = 0; i < nVolumes; i++) {
107 
108  if ( !gGeoManager->cd(volumes[i].path) ) {
109  Warning("buildInactiveVolumes()", "Cannot find path to %s node. Skipping to next node...", volumes[i].name);
110  continue;
111  }
112 
113  TGeoNode *geoNode = gGeoManager->GetCurrentNode();
114 
115  if (!geoNode) continue;
116 
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;
119 
120  StiVMCToolKit::LoopOverNodes(geoNode, volumes[i].path, volumes[i].name, MakeAverageVolume);
121  TGeoVolume *gvolu = gGeoManager->FindVolumeFast(volumes[i].name);
122  assert(gvolu);
123  // Access last added volume
124  int row = getNRows() - 1;
125  int sector = 0;
126 
127  // Make Sti detector active, i.e. use it in tracking
128  StiDetector *stiDetector = getDetector(row, sector);
129 
130  // Retrieve material, placement, energy loss information of carbon foam stave for re-definitions.
131  // The loaded carbon foam volumes (ICFC and ICFD) are disabled in tracking and removed by zero volume.
132  // The new carbon foam stave will consist of three simple box volumes to avoid overlap when place
133  // cooling tube and coolant. This method have been applied to IST east and west end-caps.
134  // Detailed information can be found at:
135  // https://drupal.star.bnl.gov/STAR/blog/ypwang/ist-sti-geometry
136  TString ts,dir;int idx;
137  if (std::string(volumes[i].name) == std::string("ICFC")) {
138  int startRow = getNRows() - kIstNumLadders;
139 
140  for (int iICFC = 0; iICFC < kIstNumLadders; iICFC++) {
141  row = startRow + iICFC;
142  stiDetector = getDetector(row, sector);
143  assert(strstr(stiDetector->getName().c_str(),"/ICFC_"));
144  // prepare "directory"
145  dir = stiDetector->getName().c_str();idx = dir.Last('/'); assert(idx>=0); dir.Remove(idx+1,999);
146 
147  StiMaterial *matICFC = stiDetector->getMaterial();
148  StiPlacement *stiPlacementICFC = stiDetector->getPlacement();
149 
150  // Construct carbon foam stave north side volume
151  StiDetector *stiDetectorN = getDetectorFactory()->getInstance();
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);
154  del(row, sector);
155  add(row, sector, stiDetectorN);
156  LOG_DEBUG << "StiIstDetectorBuilder1::build planar volume for ICFC north side " << stiDetectorN->getName() << " at layer " << row << endm;
157 
158  // Construct carbon foam stave bottom side volume
159  StiDetector *stiDetectorB = getDetectorFactory()->getInstance();
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;
165 
166  //construct carbon foam stave south side volume
167  StiDetector *stiDetectorS = getDetectorFactory()->getInstance();
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);
170  layer = getNRows();
171  add(layer, sector, stiDetectorS);
172  LOG_DEBUG << "StiIstDetectorBuilder1::build planar volume for ICFC south side " << stiDetectorS->getName() << " at layer " << layer << endm;
173  }
174 
175  }
176 
177  if (std::string(volumes[i].name) == std::string("ICFD")) {
178  int startRow = getNRows() - kIstNumLadders;
179 
180  for (int iICFD = 0; iICFD < kIstNumLadders; iICFD++) {
181  row = startRow + iICFD;
182  stiDetector = getDetector(row, sector);
183  assert(strstr(stiDetector->getName().c_str(),"/ICFD_"));
184 // prepare "directory"
185  dir = stiDetector->getName().c_str();idx = dir.Last('/'); assert(idx>=0); dir.Remove(idx+1,999);
186 
187  StiMaterial *matICFD = stiDetector->getMaterial();
188  StiPlacement *stiPlacementICFD = stiDetector->getPlacement();
189 
190  //construct carbon foam north side volume
191  StiDetector *stiDetectorN = getDetectorFactory()->getInstance();
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);
194  del(row, sector);
195  add(row, sector, stiDetectorN);
196  LOG_DEBUG << "StiIstDetectorBuilder1::build planar volume for ICFD north side " << stiDetectorN->getName() << " at layer " << row << endm;
197 
198  //construct carbon foam bottom side volume
199  StiDetector *stiDetectorB = getDetectorFactory()->getInstance();
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;
205 
206  //construct carbon foam south side volume
207  StiDetector *stiDetectorS = getDetectorFactory()->getInstance();
208  ts=dir;ts+="ICFDs";
209  buildPlanerVolume(*stiDetectorS, ts.Data(), 47.055 * 0.5, 0.58, 0.77375 * 0.5, -0.863125, 0., 0., stiPlacementICFD, matICFD);
210  layer = getNRows();
211  add(layer, sector, stiDetectorS);
212  LOG_DEBUG << "StiIstDetectorBuilder1::build planar volume for ICFD south side " << stiDetectorS->getName() << " at layer " << layer << endm;
213  }
214  }
215 
216  // Retrieve info. of east aluminum end-cap volume
217  if (std::string(volumes[i].name) == std::string("IECE")) {
218  int startRow = getNRows() - kIstNumLadders;
219 
220  for (int iIECE = 0; iIECE < kIstNumLadders; iIECE++) {
221  row = startRow + iIECE;
222  stiDetector = getDetector(row, sector);
223  assert(strstr(stiDetector->getName().c_str(),"/IECE_"));
224 // prepare "directory"
225  dir = stiDetector->getName().c_str();idx = dir.Last('/'); assert(idx>=0); dir.Remove(idx+1,999);
226 
227 
228  StiMaterial *matIECE = stiDetector->getMaterial();
229  StiPlacement *stiPlacementIECE = stiDetector->getPlacement();
230 
231  //construct east end-cap north side volume
232  StiDetector *stiDetectorN = getDetectorFactory()->getInstance();
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);
235  del(row, sector);
236  add(row, sector, stiDetectorN);
237  LOG_DEBUG << "StiIstDetectorBuilder1::build planar volume for IECE north side " << stiDetectorN->getName() << " at layer " << row << endm;
238 
239  //construct east end-cap bottom side volume
240  StiDetector *stiDetectorB = getDetectorFactory()->getInstance();
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;
246 
247  //construct east end-cap south side volume
248  StiDetector *stiDetectorS = getDetectorFactory()->getInstance();
249  ts = dir; ts +="IECEs"; //ts+=iIECE;
250  buildPlanerVolume(*stiDetectorS, ts.Data(), 2.25 * 0.5, 0.5413, 4.35865 * 0.5, -0.870675, 0., 0., stiPlacementIECE, matIECE);
251  layer = getNRows();
252  add(layer, sector, stiDetectorS);
253  LOG_DEBUG << "StiIstDetectorBuilder1::build planar volume for IECE south side " << stiDetectorS->getName() << " at layer " << layer << endm;
254  }
255  }
256 
257  // Modify dimensions of west carbon end-cap volume
258  if (std::string(volumes[i].name) == std::string("IECW")) {
259  int startRow = getNRows() - kIstNumLadders;
260 
261  for (int iIECW = 0; iIECW < kIstNumLadders; iIECW++) {
262  row = startRow + iIECW;
263  stiDetector = getDetector(row, sector);
264  assert(strstr(stiDetector->getName().c_str(),"/IECW_"));
265 // prepare "directory"
266  dir = stiDetector->getName().c_str();idx = dir.Last('/'); assert(idx>=0); dir.Remove(idx+1,999);
267 
268 
269  StiMaterial *matIECW = stiDetector->getMaterial();
270  StiPlacement *stiPlacementIECW = stiDetector->getPlacement();
271 
272  //construct west end-cap north side volume
273  StiDetector *stiDetectorN = getDetectorFactory()->getInstance();
274  ts = dir; ts +="IECWn"; //ts+=iIECW;
275  buildPlanerVolume(*stiDetectorN, ts.Data(), 2.25 * 0.5, 0.555, 1.23485 * 0.5, 2.4326, 0., 0., stiPlacementIECW, matIECW);
276  del(row, sector);
277  add(row, sector, stiDetectorN);
278  LOG_DEBUG << "StiIstDetectorBuilder1::build planar volume for IECW north side " << stiDetectorN->getName() << " at layer " << row << endm;
279 
280  //construct west end-cap bottom side volume
281  StiDetector *stiDetectorB = getDetectorFactory()->getInstance();
282 
283  ts = dir; ts +="IECWb"; //ts+=iIECW;
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;
288 
289  //construct west end-cap south side volume
290  StiDetector *stiDetectorS = getDetectorFactory()->getInstance();
291  ts = dir; ts +="IECWs"; //ts+=iIECW;
292  buildPlanerVolume(*stiDetectorS, ts.Data(), 2.25 * 0.5, 0.555, 4.35865 * 0.5, -0.870675, 0., 0., stiPlacementIECW, matIECW);
293  layer = getNRows();
294  add(layer, sector, stiDetectorS);
295  LOG_DEBUG << "StiIstDetectorBuilder1::build planar volume for IECW south side " << stiDetectorS->getName() << " at layer " << layer << endm;
296  }
297  }
298 
299  // Modify/Simplify west cooling loop (ICJR) to a box shape with same volume, and retrieve placement/material information from ICJS volume
300  if (std::string(volumes[i].name) == std::string("ICJS")) {
301  int startRow = getNRows() - kIstNumLadders;
302 
303  for (int iICJS = 0; iICJS < kIstNumLadders;iICJS += 2) {
304  row = startRow + iICJS;
305  stiDetector = getDetector(row, sector);
306  assert(strstr(stiDetector->getName().c_str(),"/ICJS_"));
307 // prepare "directory"
308  dir = stiDetector->getName().c_str();idx = dir.Last('/'); assert(idx>=0); dir.Remove(idx+1,999);
309 
310  StiMaterial *matICJS = stiDetector->getMaterial();
311  StiPlacement *stiPlacementICJS1 = stiDetector->getPlacement();
312 
313  stiDetector = getDetector(row + 1, sector);
314 // dir = stiDetector->getName().c_str();idx = dir.Last('/'); assert(idx>=0); dir.Remove(idx+1,999);
315  StiPlacement *stiPlacementICJS2 = stiDetector->getPlacement();
316 
317  StiDetector *stiDetectorICJR = getDetectorFactory()->getInstance();
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;
323 
324  }
325  }
326 
327  //resize the dimenssion of cooling/cabling in transition area
328  if (std::string(volumes[i].name) == std::string("ICCT")) {
329  assert(strstr(stiDetector->getName().c_str(),"/ICCT_"));
330  StiCylindricalShape *stiShape = (StiCylindricalShape *) stiDetector->getShape();
331  stiShape->setOuterRadius(20.28725);
332  }
333 
334  // retrieve material, energy loss information for support block tube ring re-definition
335  if (std::string(volumes[i].name) == std::string("ISRR")) {
336  assert(strstr(stiDetector->getName().c_str(),"/ISRR_"));
337  if (!matISRA)
338  matISRA = stiDetector->getMaterial();
339  }
340  }
341 
342  if (matISRA) {
343 
344  //StiShape for the support block inner thin tube volume (as a whole for all 24 support blocks)
345  float halfDepth = 0.5 * 1.27;
346  float thickness = 0.15;
347  float outerRadius = 12.0753;
348  float openingAngle = 2 * M_PI;
349 
350  //east support block inner thin tube volume
351  StiDetector *stiDetectorISRAeast = getDetectorFactory()->getInstance();
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;
356 
357  //west support block inner thin tube volume
358  StiDetector *stiDetectorISRAwest = getDetectorFactory()->getInstance();
359  buildTubeVolume(*stiDetectorISRAwest, "ISRAwest", halfDepth, thickness, outerRadius, openingAngle, 24.68995 + 0.15875, matISRA);
360  layer = getNRows();
361  add(layer, 0, stiDetectorISRAwest);
362  LOG_DEBUG << "StiIstDetectorBuilder1::build west support block thin tube volume " << stiDetectorISRAwest->getName() << " at layer " << layer << endm;
363  }
364 
365 
366 
367 }
368 
369 
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)
371 {
372  //planar shape definition
373  std::string shapeName = detName + "_planar";
374  StiPlanarShape *stiShapeN = new StiPlanarShape(shapeName.data(), halfDepth, thickness, halfWidth);
375  add(stiShapeN);
376 
377  //plannar placement definition
378  float yOffset = placement->getNormalYoffset() + yShift;
379  float normalRadius = placement->getNormalRadius() + rShift;
380  StiPlacement *stiPlacementN = new StiPlacement();
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);
386 
387  //detector definition
388  detector.setName(detName.data());
389  detector.setIsActive(new StiNeverActiveFunctor());
390  detector.setShape(stiShapeN);
391  detector.setPlacement(stiPlacementN);
392  detector.setGas(getGasMat());
393  detector.setMaterial(mat);
394 }
395 
396 
397 void StiIstDetectorBuilder1::buildTubeVolume(StiDetector &detector, std::string detName, float halfDepth, float thickness, float outerRadius, float openingAngle, float zCenter, StiMaterial *mat)
398 {
399  //tube shape definition
400  std::string shapeName = detName + "_tube";
401  StiShape *stiShapeN = new StiCylindricalShape(shapeName.data(), halfDepth, thickness, outerRadius, openingAngle);
402  add(stiShapeN);
403 
404  //tube placement definition
405  StiPlacement *stiPlacementN = new StiPlacement();
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);
411 
412  //detector definition
413  detector.setName(detName.data());
414  detector.setIsActive(new StiNeverActiveFunctor());
415  detector.setShape(stiShapeN);
416  detector.setPlacement(stiPlacementN);
417  detector.setGas(getGasMat());
418  detector.setMaterial(mat);
419 }
const int kIstNumLadders
24 IST Ladders
virtual Abstract * getInstance()=0
Get a pointer to instance of objects served by this factory.
Abstract interface for a STI toolkit.
void setName(const string &newName)
Set the name of the object.
Definition: Named.cxx:15
const string & getName() const
Get the name of the object.
Definition: Named.cxx:22
Class implements an object which is never active.