5 #include "TGeoVolume.h"
6 #include "TGeoMatrix.h"
10 #include "StThreeVectorD.hh"
12 #include "Sti/Base/Factory.h"
13 #include "Sti/StiPlanarShape.h"
14 #include "Sti/StiCylindricalShape.h"
15 #include "Sti/StiMaterial.h"
16 #include "Sti/StiPlacement.h"
17 #include "Sti/StiDetector.h"
21 #include "StiIst/StiIstIsActiveFunctor.h"
22 #include "StiIst/StiIstDetectorBuilder.h"
23 #include "tables/St_HitError_Table.h"
24 #include "StEvent/StEvent.h"
26 #include "StEvent/StEventTypes.h"
27 #include "StDetectorDbMaker/StiIst1HitErrorCalculator.h"
28 #include "StIstDbMaker/StIstDb.h"
29 #include "StIstUtil/StIstConsts.h"
30 #include "StBFChain/StBFChain.h"
33 using namespace StIstConsts;
58 throw runtime_error(
"StiIstDetectorBuilder::StiIstDetectorBuilder() "
59 "- Cannot build Sti geometry due to missing global object of TGeoManager class. "
60 "Make sure STAR geometry is properly loaded with BFC AgML option");
62 SetCurrentDetectorBuilder(
this);
64 if (!mBuildIdealGeom) {
68 LOG_ERROR <<
"StiIstDetectorBuilder::buildDetectors() - IST geometry was requested from "
69 "DB but no StIstDb object found. Check for istDb option in BFC chain" << endm;
76 LOG_INFO <<
"StiIstDetectorBuilder::buildDetectors() - Will build IST geometry from DB tables" << endm;
80 const TGeoMaterial* geoMat = gGeoManager->GetMaterial(
"AIR");
82 _gasMat = geoMat ? add(
new StiMaterial(geoMat->GetName(), geoMat->GetZ(), geoMat->GetA(), geoMat->GetDensity(), geoMat->GetRadLen()))
83 : add(
new StiMaterial(
"AIR", 7.3, 14.61, 0.001205, 30420.));
85 if (StiVMCToolKit::GetVMC()) {
101 const TGeoMaterial* geoMat = gGeoManager->GetMaterial(
"SILICON");
103 StiMaterial* silicon = geoMat ? add(
new StiMaterial(geoMat->GetName(), geoMat->GetZ(), geoMat->GetA(), geoMat->GetDensity(), geoMat->GetRadLen()))
104 : add(
new StiMaterial(
"SILICON", 14, 28.0855, 2.33, 9.36) );
113 if ( geoPath.empty() )
115 LOG_WARN <<
"StiIstDetectorBuilder::useVMCGeometry() - Cannot find path to IBSS (IST sensitive) node. Skipping to next ladder..." << endm;
119 TGeoVolume* sensorVol = gGeoManager->GetCurrentNode()->GetVolume();
120 TGeoHMatrix sensorMatrix( *gGeoManager->MakePhysicalNode(geoPath.c_str())->GetMatrix() );
124 double idealOffsetZ = sensorMatrix.GetTranslation()[2];
126 if (!mBuildIdealGeom) {
129 if (!sensorMatrixDb) {
130 LOG_WARN <<
"StiIstDetectorBuilder::useVMCGeometry() - Cannot get IST sensor position matrix. Skipping to next ladder..." << endm;
134 sensorMatrix = *sensorMatrixDb;
138 sensorMatrix.SetDz(sensorMatrix.GetTranslation()[2] - idealOffsetZ);
140 TGeoBBox *sensorBBox = (TGeoBBox*) sensorVol->GetShape();
143 for (
int iLadderHalf = 1; iLadderHalf <= 2; iLadderHalf++)
146 std::string halfLadderName(geoPath + (iLadderHalf == 1 ?
"_HALF1" :
"_HALF2") );
150 StiShape *stiShape =
new StiPlanarShape(halfLadderName.c_str(), sensorLength, 2*sensorBBox->GetDY(), sensorBBox->GetDX()/2);
152 TVector3 offset((iLadderHalf == 1 ? -sensorBBox->GetDX()/2 : sensorBBox->GetDX()/2), 0, 0);
160 stiDetector->
setProperties(halfLadderName, isActive, stiShape, pPlacement, getGasMat(), silicon);
161 stiDetector->setHitErrorCalculator(StiIst1HitErrorCalculator::instance());
164 add(iLadderHalf-1, iLadder-1, stiDetector);
185 if (ladder < 1 || ladder >
kIstNumLadders || sensorHalf < 1 || sensorHalf > 2)
188 return getDetector(sensorHalf-1, ladder-1);
206 StiMaterial* alumConnectorMaterial =
new StiMaterial(
"IBAM_ALUM_CONNECTOR", 13.00, 26.98, 1.05*2.70, 8.8751);
207 StiMaterial* gtenConnectorMaterial =
new StiMaterial(
"IBAM_GTEN_CONNECTOR", 9.01, 18.02, 1.10*1.70, 18.2086);
211 TVector3 digiBoardOffset (2.11591, -2.087862, -25.4911);
212 TVector3 alumConnectorOffset(0.47779, -0.352065, -29.3221);
213 TVector3 gtenConnectorOffset(0.47779, -0.352065, 28.8080);
214 TVector3 cfBackingOffset (0.47779, -0.352065, -0.5141);
217 int stiRow = getNRows();
223 std::ostringstream geoPath, ssPfx;
224 geoPath <<
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1/IBAM_" << iLadder <<
"/IBLM_" << iSensor <<
"/IBSS_1";
225 ssPfx <<
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1/IBAM_" << iLadder <<
"/";
228 std::string pfx(ssPfx.str());
230 bool isAvail = gGeoManager->cd(geoPath.str().c_str());
233 LOG_WARN <<
"StiIstDetectorBuilder::useVMCGeometry() - Cannot find path to IBSS (IST sensitive) node. Skipping to next ladder..." << endm;
237 TGeoHMatrix transMatrix( *gGeoManager->MakePhysicalNode(geoPath.str().c_str())->GetMatrix() );
241 double idealOffsetZ = transMatrix.GetTranslation()[2];
243 if (!mBuildIdealGeom) {
246 if (!transMatrixDb) {
247 LOG_WARN <<
"StiIstDetectorBuilder::useVMCGeometry() - Cannot get IST sensor position matrix. Skipping to next ladder..." << endm;
251 transMatrix = *transMatrixDb;
255 transMatrix.SetDz(transMatrix.GetTranslation()[2] - idealOffsetZ);
264 add(stiRow, iLadder-1, stiDetector);
268 add(stiRow+1, iLadder-1, stiDetector);
272 add(stiRow+2, iLadder-1, stiDetector);
276 add(stiRow+3, iLadder-1, stiDetector);
279 std::string pfx(
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1/");
289 add(getNRows(), 0, stiDetector);
293 add(getNRows(), 0, stiDetector);
302 add(getNRows(), 0, stiDetector);
313 const std::string tgeoPathToMother(
"/HALL_1/CAVE_1/TpcRefSys_1/IDSM_1/IBMO_1");
315 std::ostringstream geoPath;
317 geoPath << tgeoPathToMother <<
"/IBAM_" << ladder
318 <<
"/IBLM_" << sensor
321 bool found = gGeoManager->cd( geoPath.str().c_str() );
327 geoPath << tgeoPathToMother <<
"/IBSS_" << (ladder - 1)*6 + sensor;
328 found = gGeoManager->cd( geoPath.str().c_str() );
331 return found ? geoPath.str() :
"";
virtual void buildDetectors(StMaker &source)
void setProperties(std::string name, StiIsActiveFunctor *activeFunctor, StiShape *shape, StiPlacement *placement, StiMaterial *gas, StiMaterial *material)
virtual void buildInactiveVolumes()
const StiDetector * getActiveDetector(int ladder, int sensorHalf) const
function object for determine a Ist padrow's active regions
virtual void useVMCGeometry()
const int kIstNumLadders
24 IST Ladders
static std::string formTGeoPath(int ladder, int sensor)
Returns a TGeo path to the sensor in the given ladder.
StiIstDetectorBuilder(bool active, bool buildIdealGeom=true)
virtual Abstract * getInstance()=0
Get a pointer to instance of objects served by this factory.
function object for determine a detector's active regions
const int kIstNumSensorsPerLadder
6 sensor per one IST Ladder
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
static const TGeoHMatrix * getHMatrixSensorOnGlobal(int ladder, int sensor)
Class implements an object which is never active.