2 #include "StDbUtilities/StGlobalCoordinate.hh"
3 #include "StDbUtilities/StSvtLocalCoordinate.hh"
4 #include "StDbUtilities/StSvtCoordinateTransform.hh"
5 #include "StiSvtDetectorBuilder.h"
6 #include "StSvtClassLibrary/StSvtConfig.hh"
7 #include "StSvtClassLibrary/StSvtGeometry.hh"
8 #include "StSvtClassLibrary/StSvtWaferGeometry.hh"
9 #include "StSvtDbMaker/StSvtDbMaker.h"
10 #include "StDbUtilities/St_svtRDOstrippedC.h"
11 #include "Sti/Base/Factory.h"
12 #include "Sti/StiPlanarShape.h"
13 #include "Sti/StiMaterial.h"
14 #include "Sti/StiPlacement.h"
15 #include "Sti/StiDetector.h"
20 #include "StDetectorDbMaker/StiSvtHitErrorCalculator.h"
22 #include "tables/St_HitError_Table.h"
23 #include "StThreeVectorD.hh"
24 #include "StiSvtHitLoader.h"
105 StiSvtDetectorBuilder::StiSvtDetectorBuilder(
bool active)
108 StiSvtDetectorBuilder::~StiSvtDetectorBuilder() {}
110 void StiSvtDetectorBuilder::buildDetectors(
StMaker & source)
114 cout <<
"StiSvtDetectorBuilder::buildDetectors() -I- Started" << endl;
117 dataSet = source.GetDataSet(
"StSvtConfig");
118 if (!dataSet)
throw runtime_error(
"StiSvtDetectorBuilder::loadDb() -E- dataSet==0 while getting StSvtConfig");
120 if (!_config)
throw runtime_error(
"StiSvtDetectorBuilder::loadDb() -E- _config==0");
122 dataSet = source.GetDataSet(
"StSvtGeometry");
123 if (!dataSet)
throw runtime_error(
"StiSvtDetectorBuilder::loadDb() -E- dataSet==0 while getting StSvtGeometry");
125 if (!_geometry)
throw runtime_error(
"StiSvtDetectorBuilder::loadDb() -E- _geometry==0");
126 nRows = 2* _config->getNumberOfBarrels();
129 cout <<
"SVT Number of Rows : "<<2* _config->getNumberOfBarrels()<<endl
130 <<
" Layer# numberOfLadders Radius" << endl;
131 cout <<
"StiSvtDetectorBuilder::buildDetectors() -I- Define Svt Materials" << endl;
133 _gasMat = add(
new StiMaterial(
"Air",7.3, 14.61, 0.001205, 30420.*0.001205, 7.3*12.e-9));
135 _siMat = add(
new StiMaterial(
"Si", 14., 28.0855, 2.33, 21.82, 14.*12.*1e-9) );
137 _hybridMat = add(
new StiMaterial(
"Hybrid", 14., 28.0855, 2.33, 21.82, 14.*12.*1e-9) );
138 cout <<
"StiSvtDetectorBuilder::buildDetectors() -I- Define Svt Shapes" << endl;
143 for (
int layer=0;layer<nRows;layer++) {
144 cout <<
" "<<layer<<
" "<<_config->getNumberOfLadders(1+layer/2)/2 <<
" "
145 << _geometry->getBarrelRadius(layer+1) << endl;
146 Int_t svtLayer = layer+1;
147 Int_t svtBarrel = StiSvtHitLoader::getSvtBarrel(svtLayer);
148 int nWafers = _config->getNumberOfWafers(svtBarrel);
150 sprintf(name,
"Svt/Layer_%d/Wafers", layer);
153 2.*_geometry->getWaferThickness(),
155 add(_waferShape[layer]);
156 int nSectors = _config->getNumberOfLadders(svtBarrel)/2;
157 setNSectors(layer,nSectors);
163 float fLadderRadius = _geometry->getBarrelRadius(svtLayer);
164 if (fLadderRadius<=0)
throw runtime_error(
"StiSvtDetectorBuilder::buildDetectors() - FATAL - fLadderRadius<=0");
166 Int_t index1, index2;
168 for(
unsigned int ladder = 0; ladder<
getNSectors(layer); ladder++) {
169 Int_t svtLadder = 2*(ladder+1) - (svtLayer-1)%2;
170 Int_t wafer = nWafers/2+1;
171 index1 = _geometry->getWaferIndex(svtBarrel,svtLadder,wafer);
172 assert (index1 >= 0);
174 if (_debug) waferGeom->print();
175 StThreeVectorD centerVector(waferGeom->x(0), waferGeom->x(1), waferGeom->x(2) );
176 if ( nWafers%2 == 0) {
177 index2 = _geometry->getWaferIndex(svtBarrel,svtLadder,wafer-1);
180 StThreeVectorD centerVector2(waferGeom2->x(0), waferGeom2->x(1), waferGeom2->x(2) );
181 if (_debug) waferGeom2->print();
182 centerVector += centerVector2;
185 StThreeVectorD normalVector(waferGeom->n(0), waferGeom->n(1), waferGeom->n(2) );
186 Double_t prod = centerVector.x()*normalVector.x() + centerVector.y()*normalVector.y();
187 if (prod < 0) normalVector *= -1;
188 double phi = centerVector.phi();
189 double phiD = normalVector.phi();
190 double r = centerVector.perp();
191 cout <<
"Det Id = "<<waferGeom->getID()<<
"\tcv\t:"<<centerVector<<
"\tphi:\t"<<phi<<
"\tr:\t"<<r<<
"\tz:\t" << centerVector.z() << endl;
193 pPlacement->setZcenter(centerVector.z());
194 pPlacement->setLayerRadius(r);
195 pPlacement->setLayerAngle(phi);
196 pPlacement->setRegion(StiPlacement::kMidRapidity);
197 pPlacement->setNormalRep(phiD, r*TMath::Cos(phi-phiD), r*TMath::Sin(phi-phiD));
198 sprintf(name,
"Svt/Layer_%d/Ladder_%d/Wafers", layer, ladder);
201 pLadder->setIsOn(
true);
202 pLadder->setIsActive(
new StiIsSvtActiveFunctor(svtBarrel,svtLadder, nWafers, _geometry->getWaferWidth(), _geometry->getWaferLength(), _active));
203 pLadder->setIsContinuousMedium(
true);
204 pLadder->setIsDiscreteScatterer(
true);
205 pLadder->setGas(_gasMat);
206 pLadder->setMaterial(_siMat);
207 pLadder->setShape(_waferShape[layer]);
208 pLadder->setPlacement(pPlacement);
209 pLadder->setHitErrorCalculator(StiSvtHitErrorCalculator::instance());
210 pLadder->setKey(1,layer);
211 pLadder->setKey(2,ladder);
213 add(layer,ladder,pLadder);
216 if (StiVMCToolKit::GetVMC()) {useVMCGeometry();}
218 cout <<
"StiSvtDetectorBuilder::buildDetectors list of built detectors" << endl;
219 Int_t nlayers = _detectors.size();
220 for (Int_t layer = 0; layer < nlayers; layer++) {
221 Int_t nLadders = _detectors[layer].size();
222 for (Int_t ladder = 0; ladder < nLadders; ladder++) {
223 cout <<
"layer " << layer <<
"\tladder = " << ladder <<
"\t" << _detectors[layer][ladder]->getName() << endl;
229 void StiSvtDetectorBuilder::useVMCGeometry() {
230 cout <<
"StiSvtDetectorBuilder::buildDetectors() -I- Use VMC geometry" << endl;
231 SetCurrentDetectorBuilder(
this);
238 {
"SILICON", &_siMat},
239 {
"SILICON", &_hybridMat}
241 Int_t M =
sizeof(map)/
sizeof(Material_t);
242 for (Int_t i = 0; i < M; i++) {
243 const TGeoMaterial *mat = gGeoManager->GetMaterial(map[i].name);
245 Double_t PotI = StiVMCToolKit::GetPotI(mat);
250 mat->GetDensity()*mat->GetRadLen(),
254 {
"SOUM",
"Outer shileding structure",
"HALL_1/CAVE_1/SVTT_1/SOUM_1/*",
"",
""},
255 {
"SXRL",
"Circular water feeds",
"HALL_1/CAVE_1/SVTT_1/SXRL_1-2/*",
"",
""},
256 {
"SXR1",
"Circular water feeds",
"HALL_1/CAVE_1/SVTT_1/SXR1_3-4/*",
"",
""},
257 {
"SXR2",
"Circular water feeds",
"HALL_1/CAVE_1/SVTT_1/SXR2_5-6/*",
"",
""},
259 {
"SCBL",
"The bundles of cables connecting PCBs with the transition boards",
"HALL_1/CAVE_1/SVTT_1/SCBM_1-2/SCBL_1",
"",
""},
260 {
"SCB1",
"The bundles of cables connecting PCBs with the transition boards",
"HALL_1/CAVE_1/SVTT_1/SCBM_1-2/SCB1_2",
"",
""},
261 {
"SCB2",
"The bundles of cables connecting PCBs with the transition boards",
"HALL_1/CAVE_1/SVTT_1/SCBM_1-2/SCB2_3",
"",
""},
262 {
"SCB3",
"The bundles of cables connecting PCBs with the transition boards",
"HALL_1/CAVE_1/SVTT_1/SCBM_1-2/SCB3_4",
"",
""},
263 {
"SFED",
"bundles of water pipes",
"HALL_1/CAVE_1/SVTT_1/SCBM_1-2/SFED_1",
"",
""},
264 {
"SFE1",
"bundles of water pipes",
"HALL_1/CAVE_1/SVTT_1/SCBM_1-2/SFE1_2",
"",
""},
265 {
"SFE2",
"bundles of water pipes",
"HALL_1/CAVE_1/SVTT_1/SCBM_1-2/SFE2_3",
"",
""},
266 {
"SPLS",
"plastic of the water pipes",
"HALL_1/CAVE_1/SVTT_1/SCBM_1-2/SPLS_1",
"",
""},
267 {
"SPL1",
"plastic of the water pipes",
"HALL_1/CAVE_1/SVTT_1/SCBM_1-2/SPL1_2",
"",
""},
268 {
"SPL2",
"plastic of the water pipes",
"HALL_1/CAVE_1/SVTT_1/SCBM_1-2/SPL2_3",
"",
""},
269 {
"SALM",
"aluminum shield mesh",
"HALL_1/CAVE_1/SVTT_1/SALM_1-2",
"",
""},
270 {
"SOSH",
"SVT outer shield",
"HALL_1/CAVE_1/SVTT_1/SOSH_1",
"",
""},
271 {
"SISH",
"SVT inner shield",
"HALL_1/CAVE_1/SVTT_1/SISH_1",
"",
""},
278 {
"SELE",
"electronics mother volume",
"HALL_1/CAVE_1/SVTT_1/SLYD_1/SLSD_1/SELE_1",
"",
""},
280 {
"SEL1",
"electronics mother volume",
"HALL_1/CAVE_1/SVTT_1/SLYD_2/SLSD_1/SELE_1",
"",
""},
281 {
"SEL2",
"electronics mother volume",
"HALL_1/CAVE_1/SVTT_1/SLYD_3/SLSD_1/SELE_1",
"",
""},
282 {
"SEL3",
"electronics mother volume",
"HALL_1/CAVE_1/SVTT_1/SLYD_4/SLSD_1/SELE_1",
"",
""},
283 {
"SEL4",
"electronics mother volume",
"HALL_1/CAVE_1/SVTT_1/SLYD_5/SLSD_1/SELE_1",
"",
""},
284 {
"SEL5",
"electronics mother volume",
"HALL_1/CAVE_1/SVTT_1/SLYD_6/SLSD_1/SELE_1",
"",
""},
287 {
"SBWC",
"water manifold to support cone bracket mother",
"HALL_1/CAVE_1/SVTT_1/SBWC_1-2/*",
"",
""},
288 {
"SWMM",
"water manifold mother",
"HALL_1/CAVE_1/SVTT_1/SWMM_1-2/*",
"",
""},
289 {
"SIES",
"Volume to hold inner endring screws",
"HALL_1/CAVE_1/SVTT_1/SIES_1-2/*",
"",
""},
290 {
"SOES",
"Volume to hold outer endring screws",
"HALL_1/CAVE_1/SVTT_1/SOES_1-2/*",
"",
""},
291 {
"SBRG",
"Bracket joining the end rungs",
"HALL_1/CAVE_1/SVTT_1/SBRG_1-2/*",
"",
""},
292 {
"SOER",
"outer end ring",
"HALL_1/CAVE_1/SVTT_1/SOER_1-2/*",
"",
""},
293 {
"SIRT",
"inner end ring tube piece ",
"HALL_1/CAVE_1/SVTT_1/SIRT_1-2",
"",
""},
294 {
"SIRP",
"inner end ring polygon piece ",
"HALL_1/CAVE_1/SVTT_1/SIRP_1-2",
"",
""}
298 Int_t NoSvtVols =
sizeof(SvtVolumes)/
sizeof(
VolumeMap_t);
299 TString pathT(
"HALL_1/CAVE_1");
301 for (Int_t i = 0; i < NoSvtVols; i++) {
302 gGeoManager->RestoreMasterVolume();
303 gGeoManager->CdTop();
304 gGeoManager->cd(pathT); path = pathT;
305 TGeoNode *nodeT = gGeoManager->GetCurrentNode();
306 if (! nodeT)
continue;
307 StiVMCToolKit::LoopOverNodes(nodeT, path, SvtVolumes[i].name, MakeAverageVolume);
function object for determine a detector's active regions
virtual Abstract * getInstance()=0
Get a pointer to instance of objects served by this factory.
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
virtual void setNRows(UInt_t nRows)
void setName(const string &newName)
Set the name of the object.
virtual UInt_t getNSectors(UInt_t row=0) const