5 #include "TGeoVolume.h"
6 #include "TGeoMatrix.h"
10 #include "tables/St_ssdDimensions_Table.h"
11 #include "tables/St_ssdConfiguration_Table.h"
12 #include "tables/St_ssdWafersPosition_Table.h"
15 #include "Sti/Base/Factory.h"
16 #include "Sti/StiPlanarShape.h"
17 #include "Sti/StiCylindricalShape.h"
18 #include "Sti/StiMaterial.h"
19 #include "Sti/StiPlacement.h"
20 #include "Sti/StiDetector.h"
22 #include "StiSsd/StiSstDetectorBuilder.h"
24 #include "StiSsd/StiSsdIsActiveFunctor.h"
25 #include "StSsdUtil/StSstConsts.h"
26 #include "StDetectorDbMaker/StiSstHitErrorCalculator.h"
53 throw runtime_error(
"StiSstDetectorBuilder::buildDetectors() "
54 "- Cannot build Sti geometry due to missing global object of TGeoManager class. "
55 "Make sure STAR geometry is properly loaded with BFC AgML option");
57 if (!mBuildIdealGeom) {
60 LOG_ERROR <<
"StiSstDetectorBuilder::buildDetectors() - SST geometry was requested from "
61 "DB but no StSstDb object found. Check for sstDb option in BFC chain" << endm;
68 LOG_INFO <<
"StiSstDetectorBuilder::buildDetectors() - Will build SST geometry from DB tables" << endm;
71 SetCurrentDetectorBuilder(
this);
74 const TGeoMaterial* geoMat = gGeoManager->GetMaterial(
"AIR");
76 _gasMat = geoMat ? add(
new StiMaterial(geoMat->GetName(), geoMat->GetZ(), geoMat->GetA(), geoMat->GetDensity(), geoMat->GetRadLen()))
77 : add(
new StiMaterial(
"AIR", 7.3, 14.61, 0.001205, 30420.));
79 if (StiVMCToolKit::GetVMC()) {
95 const TGeoMaterial* geoMat = gGeoManager->GetMaterial(
"SILICON");
97 StiMaterial* silicon = geoMat ? add(
new StiMaterial(geoMat->GetName(), geoMat->GetZ(), geoMat->GetA(), geoMat->GetDensity(), geoMat->GetRadLen()))
98 : add(
new StiMaterial(
"SILICON", 14, 28.0855, 2.33, 9.36) );
101 int stiRow = getNRows();
103 int iSensor = floor(kSstNumSensorsPerLadder/2);
105 for (
int iLadder = 1; iLadder <= kSstNumLadders; ++iLadder)
109 if ( geoPath.empty() ) {
110 LOG_WARN <<
"StiSstDetectorBuilder::useVMCGeometry() - Cannot find path to SFSD (SST sensitive) node. Skipping to next ladder..." << endm;
114 TGeoVolume* sensorVol = gGeoManager->GetCurrentNode()->GetVolume();
115 TGeoHMatrix sensorMatrix( *gGeoManager->MakePhysicalNode(geoPath.c_str())->GetMatrix() );
119 double idealOffsetZ = sensorMatrix.GetTranslation()[2];
121 if (!mBuildIdealGeom) {
124 if (!sensorMatrixDb) {
125 LOG_WARN <<
"StiSstDetectorBuilder::useVMCGeometry() - Cannot get SST sensor position matrix. Skipping to next ladder..." << endm;
129 sensorMatrix = *sensorMatrixDb;
133 sensorMatrix.SetDz(sensorMatrix.GetTranslation()[2] - idealOffsetZ);
135 TGeoBBox *sensorBBox = (TGeoBBox*) sensorVol->GetShape();
138 double sensorLength = kSstNumSensorsPerLadder * (sensorBBox->GetDZ() + 0.02);
139 StiShape *stiShape =
new StiPlanarShape(geoPath.c_str(), sensorLength, 2*sensorBBox->GetDY(), sensorBBox->GetDX());
148 stiDetector->
setProperties(geoPath, isActive, stiShape, pPlacement, getGasMat(), silicon);
149 stiDetector->setHitErrorCalculator(StiSstHitErrorCalculator::instance());
151 add(stiRow, iLadder-1, stiDetector);
210 StiMaterial* sfmoCntrInnMaterial =
new StiMaterial(
"SFMO_CNTR_INN", 7.38471, 14.7875, 0.7536000, 28128.1);
211 StiMaterial* sfmoCntrMidMaterial =
new StiMaterial(
"SFMO_CNTR_MID", 7.29364, 14.5971, 0.0147153, 30146.9);
212 StiMaterial* sfmoCntrOutMaterial =
new StiMaterial(
"SFMO_CNTR_OUT", 7.27831, 14.5655, 0.0372666, 29681.4);
214 StiMaterial* sfmoLeftInnMaterial =
new StiMaterial(
"SFMO_LEFT_INN", 7.90551, 15.8598, 0.5131150, 21711.5);
215 StiMaterial* sfmoLeftMidMaterial =
new StiMaterial(
"SFMO_LEFT_MID", 7.67447, 15.3544, 0.3013760, 23510.2);
216 StiMaterial* sfmoLeftOutMaterial =
new StiMaterial(
"SFMO_LEFT_OUT", 7.52669, 15.0602, 0.2235500, 25904.3);
218 StiMaterial* sfmoRghtInnMaterial =
new StiMaterial(
"SFMO_RGHT_INN", 7.92641, 15.9019, 0.5298270, 21402.6);
219 StiMaterial* sfmoRghtMidMaterial =
new StiMaterial(
"SFMO_RGHT_MID", 7.66531, 15.3361, 0.2953080, 23582.3);
220 StiMaterial* sfmoRghtOutMaterial =
new StiMaterial(
"SFMO_RGHT_OUT", 7.53069, 15.0682, 0.2273420, 25831.5);
223 std::string pfx(
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/");
227 add(getNRows(), 0, stiDetector);
231 add(getNRows(), 0, stiDetector);
235 add(getNRows(), 0, stiDetector);
240 add(getNRows(), 0, stiDetector);
244 add(getNRows(), 0, stiDetector);
248 add(getNRows(), 0, stiDetector);
253 add(getNRows(), 0, stiDetector);
257 add(getNRows(), 0, stiDetector);
261 add(getNRows(), 0, stiDetector);
272 const std::string tgeoPathToMother(
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/SFMO_1");
274 std::ostringstream geoPath;
276 geoPath << tgeoPathToMother <<
"/SFLM_" << ladder
277 <<
"/SFSW_" << sensor
280 bool found = gGeoManager->cd( geoPath.str().c_str() );
286 geoPath << tgeoPathToMother <<
"/SFSW_" << (ladder - 1)*16 + sensor
288 found = gGeoManager->cd( geoPath.str().c_str() );
291 return found ? geoPath.str() :
"";
static std::string formTGeoPath(int ladder, int sensor)
Returns a TGeo path to the sensor in the given ladder.
void setProperties(std::string name, StiIsActiveFunctor *activeFunctor, StiShape *shape, StiPlacement *placement, StiMaterial *gas, StiMaterial *material)
virtual void buildDetectors(StMaker &source)
virtual Abstract * getInstance()=0
Get a pointer to instance of objects served by this factory.
virtual void buildInactiveVolumes()
virtual void useVMCGeometry()
function object for determine a detector's active regions
static const TGeoHMatrix * getHMatrixSensorOnGlobal(int ladder, int sensor)
StiSstDetectorBuilder(bool active, bool buildIdealGeom=true)
Class implements an object which is never active.